@dx-do/cli 5.2.49 → 6.0.1

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 (185) hide show
  1. package/README.md +24 -6
  2. package/dist-node/01-discover-vertices.tas-pwngv2fz.md +31 -0
  3. package/dist-node/01-discover-vertices.tas.data-store-svjfrm1f.json5 +29 -0
  4. package/dist-node/01-discover-vertices.tas.data-store-tmd-w650nfzt.json +4 -0
  5. package/dist-node/02-discover-services.tas-867m0m88.md +30 -0
  6. package/dist-node/02-discover-services.tas.data-store-jz0gx5vn.json5 +40 -0
  7. package/dist-node/02-discover-services.tas.data-store-tmd-eq264m6y.json +4 -0
  8. package/dist-node/03-discover-sources.nassql-4tgp9jvv.md +34 -0
  9. package/dist-node/03-discover-sources.nassql.data-store-by6sqk23.json5 +63 -0
  10. package/dist-node/03-discover-sources.nassql.data-store-tmd-n3gy57wm.json +4 -0
  11. package/dist-node/04-discover-metadata-columns.nassql-vhzb0mrq.md +26 -0
  12. package/dist-node/04-discover-metadata-columns.nassql.data-store-c9zr7p0q.json5 +35 -0
  13. package/dist-node/04-discover-metadata-columns.nassql.data-store-tmd-4ygrjvty.json +4 -0
  14. package/dist-node/10-filter-attribute-matches.tas-tafqmtw1.md +33 -0
  15. package/dist-node/10-filter-attribute-matches.tas.data-store-tmd-m2sendv0.json +4 -0
  16. package/dist-node/10-filter-attribute-matches.tas.data-store-whdc6vbc.json5 +35 -0
  17. package/dist-node/11-filter-and-compose.tas-m8856738.md +29 -0
  18. package/dist-node/11-filter-and-compose.tas.data-store-dh5meyk8.json5 +56 -0
  19. package/dist-node/11-filter-and-compose.tas.data-store-tmd-mfn8a16f.json +4 -0
  20. package/dist-node/12-filter-or-not.tas-21zab96s.md +35 -0
  21. package/dist-node/12-filter-or-not.tas.data-store-7vjr4fnd.json5 +83 -0
  22. package/dist-node/12-filter-or-not.tas.data-store-tmd-am9smwe5.json +4 -0
  23. package/dist-node/13-filter-layer.tas-r1ff5anv.md +29 -0
  24. package/dist-node/13-filter-layer.tas.data-store-5mneyz77.json5 +30 -0
  25. package/dist-node/13-filter-layer.tas.data-store-tmd-9qmhyfzr.json +4 -0
  26. package/dist-node/14-filter-traverse.tas-da9jene0.md +38 -0
  27. package/dist-node/14-filter-traverse.tas.data-store-p0vxtfvj.json5 +63 -0
  28. package/dist-node/14-filter-traverse.tas.data-store-tmd-5hepg5wf.json +4 -0
  29. package/dist-node/15-filter-take-vertices-edges.tas-m160qc7z.md +35 -0
  30. package/dist-node/15-filter-take-vertices-edges.tas.data-store-drmcme43.json5 +46 -0
  31. package/dist-node/15-filter-take-vertices-edges.tas.data-store-tmd-8fewsp5s.json +4 -0
  32. package/dist-node/16-filter-projection.tas-dh39mcx8.md +31 -0
  33. package/dist-node/16-filter-projection.tas.data-store-tmd-3r8anggx.json +4 -0
  34. package/dist-node/16-filter-projection.tas.data-store-xjbdry1x.json5 +36 -0
  35. package/dist-node/17-filter-lucene.tas-gyvtzwaa.md +29 -0
  36. package/dist-node/17-filter-lucene.tas.data-store-1knw6srt.json5 +39 -0
  37. package/dist-node/17-filter-lucene.tas.data-store-tmd-5cf3tygg.json +5 -0
  38. package/dist-node/18-filter-variable-reuse.tas-89fq0y6x.md +46 -0
  39. package/dist-node/18-filter-variable-reuse.tas.data-store-by35113t.json5 +55 -0
  40. package/dist-node/18-filter-variable-reuse.tas.data-store-tmd-ak7aprgk.json +4 -0
  41. package/dist-node/19-filter-order-statefilter.tas-hm3z71qj.md +36 -0
  42. package/dist-node/19-filter-order-statefilter.tas.data-store-ra9hj1rz.json5 +51 -0
  43. package/dist-node/19-filter-order-statefilter.tas.data-store-tmd-wqer9xy2.json +4 -0
  44. package/dist-node/20-nassql-from-metadata-basic.nassql-szr2xax1.md +28 -0
  45. package/dist-node/20-nassql-from-metadata-basic.nassql.data-store-tmd-c7drxs1m.json +4 -0
  46. package/dist-node/20-nassql-from-metadata-basic.nassql.data-store-zdf1gp1v.json5 +42 -0
  47. package/dist-node/21-nassql-from-metadata-regex.nassql-78jnsn3e.md +30 -0
  48. package/dist-node/21-nassql-from-metadata-regex.nassql.data-store-ckzsv7h1.json5 +53 -0
  49. package/dist-node/21-nassql-from-metadata-regex.nassql.data-store-tmd-zgr6r9my.json +4 -0
  50. package/dist-node/22-nassql-from-topology.nassql-a71qw9r0.md +42 -0
  51. package/dist-node/22-nassql-from-topology.nassql.data-store-81m23nge.json5 +58 -0
  52. package/dist-node/22-nassql-from-topology.nassql.data-store-tmd-vhpjy6c7.json +4 -0
  53. package/dist-node/23-nassql-join-topology-metadata.nassql-hywxhcg2.md +35 -0
  54. package/dist-node/23-nassql-join-topology-metadata.nassql.data-store-da7q90n2.json5 +76 -0
  55. package/dist-node/23-nassql-join-topology-metadata.nassql.data-store-tmd-rr8wt9qa.json +4 -0
  56. package/dist-node/24-nassql-from-data-window-mean.nassql-q6qsgdxw.md +33 -0
  57. package/dist-node/24-nassql-from-data-window-mean.nassql.data-store-j7xmg7fc.json5 +81 -0
  58. package/dist-node/24-nassql-from-data-window-mean.nassql.data-store-tmd-qgzz2f7v.json +4 -0
  59. package/dist-node/25-nassql-group-order-top.nassql-awgnwn3r.md +30 -0
  60. package/dist-node/25-nassql-group-order-top.nassql.data-store-cmrn300b.json5 +48 -0
  61. package/dist-node/25-nassql-group-order-top.nassql.data-store-tmd-7xpqeh7c.json +4 -0
  62. package/dist-node/26-nassql-filter-predicate.nassql-2t27h5ev.md +41 -0
  63. package/dist-node/26-nassql-filter-predicate.nassql.data-store-k2rgp609.json5 +59 -0
  64. package/dist-node/26-nassql-filter-predicate.nassql.data-store-tmd-m4dddgwm.json +4 -0
  65. package/dist-node/27-nassql-distinct-keep.nassql-6z55dvk3.md +24 -0
  66. package/dist-node/27-nassql-distinct-keep.nassql.data-store-mrx00ys5.json5 +52 -0
  67. package/dist-node/27-nassql-distinct-keep.nassql.data-store-tmd-0p9hy42g.json +4 -0
  68. package/dist-node/28-nassql-format-time.nassql-6wraqgdk.md +30 -0
  69. package/dist-node/28-nassql-format-time.nassql.data-store-tmd-bbbqhz1x.json +4 -0
  70. package/dist-node/28-nassql-format-time.nassql.data-store-tvy8y2cs.json5 +59 -0
  71. package/dist-node/29-nassql-describe-log.nassql-t9vnxeb0.md +31 -0
  72. package/dist-node/29-nassql-describe-log.nassql.data-store-tmd-q4mtczy8.json +4 -0
  73. package/dist-node/29-nassql-describe-log.nassql.data-store-x16y4crx.json5 +51 -0
  74. package/dist-node/30-nassql-map-string.nassql-f2tdknzs.md +30 -0
  75. package/dist-node/30-nassql-map-string.nassql.data-store-t8ahcabn.json5 +53 -0
  76. package/dist-node/30-nassql-map-string.nassql.data-store-tmd-a6xq0bdx.json +4 -0
  77. package/dist-node/31-nassql-join-data-sum.nassql-p16y3xk6.md +26 -0
  78. package/dist-node/31-nassql-join-data-sum.nassql.data-store-dje7wm6v.json5 +64 -0
  79. package/dist-node/31-nassql-join-data-sum.nassql.data-store-tmd-c1pyx1qw.json +4 -0
  80. package/dist-node/32-nassql-bottom-aggregation.nassql-hpgfn77p.md +26 -0
  81. package/dist-node/32-nassql-bottom-aggregation.nassql.data-store-tmd-p0ssj1vc.json +4 -0
  82. package/dist-node/32-nassql-bottom-aggregation.nassql.data-store-v9580caa.json5 +43 -0
  83. package/dist-node/33-nassql-cross-domain-pipeline.nassql-fm0ynphf.md +45 -0
  84. package/dist-node/33-nassql-cross-domain-pipeline.nassql.data-store-tmd-18881drs.json +4 -0
  85. package/dist-node/33-nassql-cross-domain-pipeline.nassql.data-store-vqs9hkx4.json5 +79 -0
  86. package/dist-node/3rdpartylicenses-hx59bakt.txt +885 -0
  87. package/dist-node/50-discover-custom-layers.tas-2hvvpkzw.md +66 -0
  88. package/dist-node/50-discover-custom-layers.tas.data-store-h85zgna9.json5 +36 -0
  89. package/dist-node/50-discover-custom-layers.tas.data-store-tmd-hagn9eak.json +4 -0
  90. package/dist-node/51-collect-counts-everything.tas-nz0ksgdc.md +46 -0
  91. package/dist-node/51-collect-counts-everything.tas.data-store-eypcjah8.json5 +48 -0
  92. package/dist-node/51-collect-counts-everything.tas.data-store-tmd-4pcj94s9.json +4 -0
  93. package/dist-node/52-collect-counts-bulk.tas-eerw4z8s.md +54 -0
  94. package/dist-node/52-collect-counts-bulk.tas.data-store-scedtw1m.json5 +65 -0
  95. package/dist-node/52-collect-counts-bulk.tas.data-store-tmd-csyzj189.json +4 -0
  96. package/dist-node/53-collect-attributes-by-type.tas-cw0285hx.md +71 -0
  97. package/dist-node/53-collect-attributes-by-type.tas.data-store-fvjge4yr.json5 +65 -0
  98. package/dist-node/53-collect-attributes-by-type.tas.data-store-tmd-274qrd8f.json +4 -0
  99. package/dist-node/README-ghxecaz0.md +84 -0
  100. package/dist-node/SKILL-1xn7r9nt.md +104 -0
  101. package/dist-node/agent-25q752kd.md +55 -0
  102. package/dist-node/agent_connection_and_status-0dq7zkpc.md +62 -0
  103. package/dist-node/agent_source_collector-6s06n3rs.md +40 -0
  104. package/dist-node/agentic-mcp-rycd2gh8.md +140 -0
  105. package/dist-node/application-dfva8tz0.md +48 -0
  106. package/dist-node/application-m0q2vaxj.md +74 -0
  107. package/dist-node/attribute_resource_metric_name-pxrceab5.md +56 -0
  108. package/dist-node/browseragent-snippet.template-9megjp8a.html +12 -0
  109. package/dist-node/bulkvertexpatch-1a4qy5vb.md +78 -0
  110. package/dist-node/bundle.pbd-38r15kyd.template +13 -0
  111. package/dist-node/bundle.profile-1wpzpt3d.template +2 -0
  112. package/dist-node/business_transaction-mbqz5ex9.md +61 -0
  113. package/dist-node/chunk-4I3HBO6U-2ebgf7kh.js +127 -0
  114. package/dist-node/chunk-4PMCLJMS-0mqvr4m4.js +1 -0
  115. package/dist-node/chunk-5VSFINOX-ewzpx7wh.js +5 -0
  116. package/dist-node/chunk-72HYG3XZ-kf7hy4vs.js +3625 -0
  117. package/dist-node/chunk-JRM4BLOM-rg32z8w4.js +1 -0
  118. package/dist-node/chunk-Q2JA73UH-akkb8bh3.js +14 -0
  119. package/dist-node/chunk-RNMHSXZF-pdwasrg7.js +1358 -0
  120. package/dist-node/chunk-VV2FJEMA-3rvtkmga.js +321 -0
  121. package/dist-node/chunk-YVD3UK5I-9pxr1jka.js +695 -0
  122. package/dist-node/configuration-1vczsdex.md +104 -0
  123. package/dist-node/dashboards-x0xddksy.md +17 -0
  124. package/dist-node/database_or_inferred-8vqf5gyr.md +75 -0
  125. package/dist-node/default-licensing-config-0p879qpb.template +122 -0
  126. package/dist-node/dependency-3b0neg5x.md +40 -0
  127. package/dist-node/description.md-qwc2bj9r.template +30 -0
  128. package/dist-node/discovery-flow-fw79kbx4.md +116 -0
  129. package/dist-node/dxi_service-13prnpd5.md +59 -0
  130. package/dist-node/entity-relationships-cevz61kj.md +142 -0
  131. package/dist-node/gotchas-8ab64kcd.md +389 -0
  132. package/dist-node/host-es6fxtgx.md +46 -0
  133. package/dist-node/host-j3qqrm5f.md +55 -0
  134. package/dist-node/index-104hyb1m.html +13 -0
  135. package/dist-node/index-7fp2dfas.json +178 -0
  136. package/dist-node/index-g3hh5wez.json +403 -0
  137. package/dist-node/index-mbzg9rhc.json +270 -0
  138. package/dist-node/index-qffdhwgm.json +2479 -0
  139. package/dist-node/inferred-w998vfq1.md +41 -0
  140. package/dist-node/installInstructions.md-k9ghf3dr.template +21 -0
  141. package/dist-node/inventorize-xc9h9bjr.md +34 -0
  142. package/dist-node/investigation-planning-6kcm01h9.md +149 -0
  143. package/dist-node/investigator-flow-jc2s0n46.md +186 -0
  144. package/dist-node/k8s_deployment_and_namespace-69c29152.md +88 -0
  145. package/dist-node/k8s_pod_and_container-9h4v6cmj.md +64 -0
  146. package/dist-node/main-SGLYO5YX-ht69eb0y.js +13 -0
  147. package/dist-node/main.js +397415 -0
  148. package/dist-node/marketplace-srdmzxkj.json +15 -0
  149. package/dist-node/metric-source-names-6cbczyks.md +75 -0
  150. package/dist-node/metrics-grounding-2h4kkbe3.md +130 -0
  151. package/dist-node/mm-cookbook-23jpw721.md +231 -0
  152. package/dist-node/mm-quickstart-x2adfc16.md +106 -0
  153. package/dist-node/nassql-cookbook-n8kc0mff.md +812 -0
  154. package/dist-node/nassql-quickstart-090e0yex.md +149 -0
  155. package/dist-node/plugin-c3bavxvf.json +18 -0
  156. package/dist-node/polyfills-A7ZF72EO-mp884a0b.js +2 -0
  157. package/dist-node/prerendered-routes-523d8gat.json +3 -0
  158. package/dist-node/primeicons-4GST5W3O-jac3wxrf.woff2 +0 -0
  159. package/dist-node/primeicons-DHQU4SEP-760n99pp.svg +345 -0
  160. package/dist-node/primeicons-GEFHGEHP-rc4kaa3b.ttf +0 -0
  161. package/dist-node/primeicons-P53SE5CV-4saz3d5j.woff +0 -0
  162. package/dist-node/primeicons-RSSEDYLY-4d4vbd67.eot +0 -0
  163. package/dist-node/query-vs-analysis-separation-sag1ezcq.md +97 -0
  164. package/dist-node/run-query-vs-run-partial-6138pc94.md +80 -0
  165. package/dist-node/service-5pz5nhzf.md +133 -0
  166. package/dist-node/service-hierarchies-87a4ynpj.md +178 -0
  167. package/dist-node/service-k4f5mkbq.md +51 -0
  168. package/dist-node/servlet_or_frontend-1kjcb7ar.md +76 -0
  169. package/dist-node/src-apm-mfnsq6vw.svg +4 -0
  170. package/dist-node/src-axa-nn28yqmj.svg +4 -0
  171. package/dist-node/src-dxim-fv7ne4qa.svg +4 -0
  172. package/dist-node/styles-23VUPSCU-9ehggc1f.css +1 -0
  173. package/dist-node/tas-cookbook-0y4826rp.md +693 -0
  174. package/dist-node/tas-quickstart-wgcvwffc.md +138 -0
  175. package/dist-node/time-format-0595g01j.md +41 -0
  176. package/dist-node/toggles.pbd-9wscbmng.template +2 -0
  177. package/dist-node/type-host-agbhmn6v.svg +6 -0
  178. package/dist-node/type-metric-p9b90bpx.svg +4 -0
  179. package/dist-node/type-service-k7f1x71k.svg +4 -0
  180. package/dist-node/ui-0b5grqrg.md +113 -0
  181. package/dist-node/universe-b9nhf325.md +47 -0
  182. package/dist-node/universe-fzpwzvxr.md +91 -0
  183. package/dist-node/universes-and-scopes-1cb9pfk7.md +105 -0
  184. package/dist-node/vertex_entity_node-mm3yp9d0.md +31 -0
  185. package/package.json +1 -1
@@ -0,0 +1,321 @@
1
+ import{a as Wl}from"./chunk-JRM4BLOM.js";import{a as Ep,g as Xl}from"./chunk-Q2JA73UH.js";import{$ as qe,Db as Sr,Eb as vr,Fb as Fr,Gb as nt,Hb as Re,La as _e,Pb as Vl,Qb as ql,R as Fl,Sb as Gl,Tb as ca,Ub as Hl,W as dr,Wb as Te,Xb as ir,Yb as Vr,Za as Nr,a as Nt,aa as Ge,b as Tn,bd as Pn,d as ot,f as zl,g as Er,ka as Ke,la as ar,nb as Wt,ob as Xt,qc as $l,rb as ii,rc as kt,sb as oi,tb as _n,ub as pt,uc as kr,vb as At,vc as Yt,wb as zr,wc as Ul,xb as Pe,yb as ke,zb as Cr}from"./chunk-5VSFINOX.js";var al=ot(sn=>{"use strict";Object.defineProperty(sn,"__esModule",{value:!0});var nl=(function(){function r(e,t,n){this.source=e,this.target=t,this.type=n}return r})();sn.PowerEdge=nl;var ph=(function(){function r(e,t,n,a){var i=this;if(this.linkAccessor=n,this.modules=new Array(e),this.roots=[],a)this.initModulesFromGroup(a);else{this.roots.push(new jn);for(var o=0;o<e;++o)this.roots[0].add(this.modules[o]=new Wa(o))}this.R=t.length,t.forEach(function(s){var u=i.modules[n.getSourceIndex(s)],l=i.modules[n.getTargetIndex(s)],c=n.getType(s);u.outgoing.add(c,l),l.incoming.add(c,u)})}return r.prototype.initModulesFromGroup=function(e){var t=new jn;this.roots.push(t);for(var n=0;n<e.leaves.length;++n){var a=e.leaves[n],i=new Wa(a.id);this.modules[a.id]=i,t.add(i)}if(e.groups)for(var o=0;o<e.groups.length;++o){var s=e.groups[o],u={};for(var l in s)l!=="leaves"&&l!=="groups"&&s.hasOwnProperty(l)&&(u[l]=s[l]);t.add(new Wa(-1-o,new Xa,new Xa,this.initModulesFromGroup(s),u))}return t},r.prototype.merge=function(e,t,n){n===void 0&&(n=0);var a=e.incoming.intersection(t.incoming),i=e.outgoing.intersection(t.outgoing),o=new jn;o.add(e),o.add(t);var s=new Wa(this.modules.length,i,a,o);this.modules.push(s);var u=function(l,c,f){l.forAll(function(d,h){d.forAll(function(v){var y=v[c];y.add(h,s),y.remove(h,e),y.remove(h,t),e[f].remove(h,v),t[f].remove(h,v)})})};return u(i,"incoming","outgoing"),u(a,"outgoing","incoming"),this.R-=a.count()+i.count(),this.roots[n].remove(e),this.roots[n].remove(t),this.roots[n].add(s),s},r.prototype.rootMerges=function(e){e===void 0&&(e=0);for(var t=this.roots[e].modules(),n=t.length,a=new Array(n*(n-1)),i=0,o=0,s=n-1;o<s;++o)for(var u=o+1;u<n;++u){var l=t[o],c=t[u];a[i]={id:i,nEdges:this.nEdges(l,c),a:l,b:c},i++}return a},r.prototype.greedyMerge=function(){for(var e=0;e<this.roots.length;++e)if(!(this.roots[e].modules().length<2)){var t=this.rootMerges(e).sort(function(a,i){return a.nEdges==i.nEdges?a.id-i.id:a.nEdges-i.nEdges}),n=t[0];if(!(n.nEdges>=this.R))return this.merge(n.a,n.b,e),!0}},r.prototype.nEdges=function(e,t){var n=e.incoming.intersection(t.incoming),a=e.outgoing.intersection(t.outgoing);return this.R-n.count()-a.count()},r.prototype.getGroupHierarchy=function(e){var t=this,n=[],a={};gh(this.roots[0],a,n);var i=this.allEdges();return i.forEach(function(o){var s=t.modules[o.source],u=t.modules[o.target];e.push(new nl(typeof s.gid>"u"?o.source:n[s.gid],typeof u.gid>"u"?o.target:n[u.gid],o.type))}),n},r.prototype.allEdges=function(){var e=[];return r.getEdges(this.roots[0],e),e},r.getEdges=function(e,t){e.forAll(function(n){n.getEdges(t),r.getEdges(n.children,t)})},r})();sn.Configuration=ph;function gh(r,e,t){r.forAll(function(n){if(n.isLeaf())e.leaves||(e.leaves=[]),e.leaves.push(n.id);else{var a=e;if(n.gid=t.length,!n.isIsland()||n.isPredefined()){if(a={id:n.gid},n.isPredefined())for(var i in n.definition)a[i]=n.definition[i];e.groups||(e.groups=[]),e.groups.push(n.gid),t.push(a)}gh(n.children,a,t)}})}var Wa=(function(){function r(e,t,n,a,i){t===void 0&&(t=new Xa),n===void 0&&(n=new Xa),a===void 0&&(a=new jn),this.id=e,this.outgoing=t,this.incoming=n,this.children=a,this.definition=i}return r.prototype.getEdges=function(e){var t=this;this.outgoing.forAll(function(n,a){n.forAll(function(i){e.push(new nl(t.id,i.id,a))})})},r.prototype.isLeaf=function(){return this.children.count()===0},r.prototype.isIsland=function(){return this.outgoing.count()===0&&this.incoming.count()===0},r.prototype.isPredefined=function(){return typeof this.definition<"u"},r})();sn.Module=Wa;function tx(r,e){var t={};for(var n in r)n in e&&(t[n]=r[n]);return t}var jn=(function(){function r(){this.table={}}return r.prototype.count=function(){return Object.keys(this.table).length},r.prototype.intersection=function(e){var t=new r;return t.table=tx(this.table,e.table),t},r.prototype.intersectionCount=function(e){return this.intersection(e).count()},r.prototype.contains=function(e){return e in this.table},r.prototype.add=function(e){this.table[e.id]=e},r.prototype.remove=function(e){delete this.table[e.id]},r.prototype.forAll=function(e){for(var t in this.table)e(this.table[t])},r.prototype.modules=function(){var e=[];return this.forAll(function(t){t.isPredefined()||e.push(t)}),e},r})();sn.ModuleSet=jn;var Xa=(function(){function r(){this.sets={},this.n=0}return r.prototype.count=function(){return this.n},r.prototype.contains=function(e){var t=!1;return this.forAllModules(function(n){!t&&n.id==e&&(t=!0)}),t},r.prototype.add=function(e,t){var n=e in this.sets?this.sets[e]:this.sets[e]=new jn;n.add(t),++this.n},r.prototype.remove=function(e,t){var n=this.sets[e];n.remove(t),n.count()===0&&delete this.sets[e],--this.n},r.prototype.forAll=function(e){for(var t in this.sets)e(this.sets[t],Number(t))},r.prototype.forAllModules=function(e){this.forAll(function(t,n){return t.forAll(e)})},r.prototype.intersection=function(e){var t=new r;return this.forAll(function(n,a){if(a in e.sets){var i=n.intersection(e.sets[a]),o=i.count();o>0&&(t.sets[a]=i,t.n+=o)}}),t},r})();sn.LinkSets=Xa;function rx(r,e,t,n){for(var a=r.length,i=new ph(a,e,t,n);i.greedyMerge(););var o=[],s=i.getGroupHierarchy(o);return o.forEach(function(u){var l=function(c){var f=u[c];typeof f=="number"&&(u[c]=r[f])};l("source"),l("target")}),{groups:s,powerEdges:o}}sn.getGroups=rx});var lo=ot(ea=>{"use strict";Object.defineProperty(ea,"__esModule",{value:!0});function yh(r,e){var t={};for(var n in r)t[n]={};for(var n in e)t[n]={};return Object.keys(t).length}function mh(r,e){var t=0;for(var n in r)typeof e[n]<"u"&&++t;return t}function nx(r,e){var t={},n=function(a,i){typeof t[a]>"u"&&(t[a]={}),t[a][i]={}};return r.forEach(function(a){var i=e.getSourceIndex(a),o=e.getTargetIndex(a);n(i,o),n(o,i)}),t}function bh(r,e,t,n){var a=nx(r,n);r.forEach(function(i){var o=a[n.getSourceIndex(i)],s=a[n.getTargetIndex(i)];n.setLength(i,1+e*t(o,s))})}function ax(r,e,t){t===void 0&&(t=1),bh(r,t,function(n,a){return Math.sqrt(yh(n,a)-mh(n,a))},e)}ea.symmetricDiffLinkLengths=ax;function ix(r,e,t){t===void 0&&(t=1),bh(r,t,function(n,a){return Math.min(Object.keys(n).length,Object.keys(a).length)<1.1?0:mh(n,a)/yh(n,a)},e)}ea.jaccardLinkLengths=ix;function ox(r,e,t,n){var a=xh(r,e,n),i={};a.forEach(function(s,u){return s.forEach(function(l){return i[l]=u})});var o=[];return e.forEach(function(s){var u=n.getSourceIndex(s),l=n.getTargetIndex(s),c=i[u],f=i[l];c!==f&&o.push({axis:t,left:u,right:l,gap:n.getMinSeparation(s)})}),o}ea.generateDirectedEdgeConstraints=ox;function xh(r,e,t){var n=[],a=0,i=[],o=[];function s(p){p.index=p.lowlink=a++,i.push(p),p.onStack=!0;for(var m=0,b=p.out;m<b.length;m++){var x=b[m];typeof x.index>"u"?(s(x),p.lowlink=Math.min(p.lowlink,x.lowlink)):x.onStack&&(p.lowlink=Math.min(p.lowlink,x.index))}if(p.lowlink===p.index){for(var E=[];i.length&&(x=i.pop(),x.onStack=!1,E.push(x),x!==p););o.push(E.map(function(S){return S.id}))}}for(var u=0;u<r;u++)n.push({id:u,out:[]});for(var l=0,c=e;l<c.length;l++){var f=c[l],d=n[t.getSourceIndex(f)],h=n[t.getTargetIndex(f)];d.out.push(h)}for(var v=0,y=n;v<y.length;v++){var g=y[v];typeof g.index>"u"&&s(g)}return o}ea.stronglyConnectedComponents=xh});var co=ot(Ya=>{"use strict";Object.defineProperty(Ya,"__esModule",{value:!0});var wh=(function(){function r(){this.locks={}}return r.prototype.add=function(e,t){this.locks[e]=t},r.prototype.clear=function(){this.locks={}},r.prototype.isEmpty=function(){for(var e in this.locks)return!1;return!0},r.prototype.apply=function(e){for(var t in this.locks)e(Number(t),this.locks[t])},r})();Ya.Locks=wh;var sx=(function(){function r(e,t,n){n===void 0&&(n=null),this.D=t,this.G=n,this.threshold=1e-4,this.numGridSnapNodes=0,this.snapGridSize=100,this.snapStrength=1e3,this.scaleSnapByMaxH=!1,this.random=new Eh,this.project=null,this.x=e,this.k=e.length;var a=this.n=e[0].length;this.H=new Array(this.k),this.g=new Array(this.k),this.Hd=new Array(this.k),this.a=new Array(this.k),this.b=new Array(this.k),this.c=new Array(this.k),this.d=new Array(this.k),this.e=new Array(this.k),this.ia=new Array(this.k),this.ib=new Array(this.k),this.xtmp=new Array(this.k),this.locks=new wh,this.minD=Number.MAX_VALUE;for(var i=a,o;i--;)for(o=a;--o>i;){var s=t[i][o];s>0&&s<this.minD&&(this.minD=s)}for(this.minD===Number.MAX_VALUE&&(this.minD=1),i=this.k;i--;){for(this.g[i]=new Array(a),this.H[i]=new Array(a),o=a;o--;)this.H[i][o]=new Array(a);this.Hd[i]=new Array(a),this.a[i]=new Array(a),this.b[i]=new Array(a),this.c[i]=new Array(a),this.d[i]=new Array(a),this.e[i]=new Array(a),this.ia[i]=new Array(a),this.ib[i]=new Array(a),this.xtmp[i]=new Array(a)}}return r.createSquareMatrix=function(e,t){for(var n=new Array(e),a=0;a<e;++a){n[a]=new Array(e);for(var i=0;i<e;++i)n[a][i]=t(a,i)}return n},r.prototype.offsetDir=function(){for(var e=this,t=new Array(this.k),n=0,a=0;a<this.k;++a){var i=t[a]=this.random.getNextBetween(.01,1)-.5;n+=i*i}return n=Math.sqrt(n),t.map(function(o){return o*=e.minD/n})},r.prototype.computeDerivatives=function(e){var t=this,n=this.n;if(!(n<1)){for(var a,i=new Array(this.k),o=new Array(this.k),s=new Array(this.k),u=0,l=0;l<n;++l){for(a=0;a<this.k;++a)s[a]=this.g[a][l]=0;for(var c=0;c<n;++c)if(l!==c){for(var f=n;f--;){var d=0;for(a=0;a<this.k;++a){var h=i[a]=e[a][l]-e[a][c];d+=o[a]=h*h}if(d>1e-9)break;var v=this.offsetDir();for(a=0;a<this.k;++a)e[a][c]+=v[a]}var y=Math.sqrt(d),g=this.D[l][c],p=this.G!=null?this.G[l][c]:1;if(p>1&&y>g||!isFinite(g)){for(a=0;a<this.k;++a)this.H[a][l][c]=0;continue}p>1&&(p=1);var m=g*g,b=2*p*(y-g)/(m*y),x=y*y*y,E=2*-p/(m*x);for(isFinite(b)||console.log(b),a=0;a<this.k;++a)this.g[a][l]+=i[a]*b,s[a]-=this.H[a][l][c]=E*(x+g*(o[a]-d)+y*d)}for(a=0;a<this.k;++a)u=Math.max(u,this.H[a][l][l]=s[a])}for(var S=this.snapGridSize/2,w=this.snapGridSize,k=this.snapStrength,_=k/(S*S),C=this.numGridSnapNodes,l=0;l<C;++l)for(a=0;a<this.k;++a){var T=this.x[a][l],D=T/w,A=D%1,R=D-A,M=Math.abs(A),h=M<=.5?T-R*w:T>0?T-(R+1)*w:T-(R-1)*w;-S<h&&h<=S&&(this.scaleSnapByMaxH?(this.g[a][l]+=u*_*h,this.H[a][l][l]+=u*_):(this.g[a][l]+=_*h,this.H[a][l][l]+=_))}this.locks.isEmpty()||this.locks.apply(function(L,B){for(a=0;a<t.k;++a)t.H[a][L][L]+=u,t.g[a][L]-=u*(B[a]-e[a][L])})}},r.dotProd=function(e,t){for(var n=0,a=e.length;a--;)n+=e[a]*t[a];return n},r.rightMultiply=function(e,t,n){for(var a=e.length;a--;)n[a]=r.dotProd(e[a],t)},r.prototype.computeStepSize=function(e){for(var t=0,n=0,a=0;a<this.k;++a)t+=r.dotProd(this.g[a],e[a]),r.rightMultiply(this.H[a],e[a],this.Hd[a]),n+=r.dotProd(e[a],this.Hd[a]);return n===0||!isFinite(n)?0:1*t/n},r.prototype.reduceStress=function(){this.computeDerivatives(this.x);for(var e=this.computeStepSize(this.g),t=0;t<this.k;++t)this.takeDescentStep(this.x[t],this.g[t],e);return this.computeStress()},r.copy=function(e,t){for(var n=e.length,a=t[0].length,i=0;i<n;++i)for(var o=0;o<a;++o)t[i][o]=e[i][o]},r.prototype.stepAndProject=function(e,t,n,a){r.copy(e,t),this.takeDescentStep(t[0],n[0],a),this.project&&this.project[0](e[0],e[1],t[0]),this.takeDescentStep(t[1],n[1],a),this.project&&this.project[1](t[0],e[1],t[1]);for(var i=2;i<this.k;i++)this.takeDescentStep(t[i],n[i],a)},r.mApply=function(e,t,n){for(var a=e;a-- >0;)for(var i=t;i-- >0;)n(a,i)},r.prototype.matrixApply=function(e){r.mApply(this.k,this.n,e)},r.prototype.computeNextPosition=function(e,t){var n=this;this.computeDerivatives(e);var a=this.computeStepSize(this.g);if(this.stepAndProject(e,t,this.g,a),this.project){this.matrixApply(function(o,s){return n.e[o][s]=e[o][s]-t[o][s]});var i=this.computeStepSize(this.e);i=Math.max(.2,Math.min(i,1)),this.stepAndProject(e,t,this.e,i)}},r.prototype.run=function(e){for(var t=Number.MAX_VALUE,n=!1;!n&&e-- >0;){var a=this.rungeKutta();n=Math.abs(t/a-1)<this.threshold,t=a}return t},r.prototype.rungeKutta=function(){var e=this;this.computeNextPosition(this.x,this.a),r.mid(this.x,this.a,this.ia),this.computeNextPosition(this.ia,this.b),r.mid(this.x,this.b,this.ib),this.computeNextPosition(this.ib,this.c),this.computeNextPosition(this.c,this.d);var t=0;return this.matrixApply(function(n,a){var i=(e.a[n][a]+2*e.b[n][a]+2*e.c[n][a]+e.d[n][a])/6,o=e.x[n][a]-i;t+=o*o,e.x[n][a]=i}),t},r.mid=function(e,t,n){r.mApply(e.length,e[0].length,function(a,i){return n[a][i]=e[a][i]+(t[a][i]-e[a][i])/2})},r.prototype.takeDescentStep=function(e,t,n){for(var a=0;a<this.n;++a)e[a]=e[a]-n*t[a]},r.prototype.computeStress=function(){for(var e=0,t=0,n=this.n-1;t<n;++t)for(var a=t+1,i=this.n;a<i;++a){for(var o=0,s=0;s<this.k;++s){var u=this.x[s][t]-this.x[s][a];o+=u*u}o=Math.sqrt(o);var l=this.D[t][a];if(isFinite(l)){var c=l-o,f=l*l;e+=c*c/f}}return e},r.zeroDistance=1e-10,r})();Ya.Descent=sx;var Eh=(function(){function r(e){e===void 0&&(e=1),this.seed=e,this.a=214013,this.c=2531011,this.m=2147483648,this.range=32767}return r.prototype.getNext=function(){return this.seed=(this.seed*this.a+this.c)%this.m,(this.seed>>16)/this.range},r.prototype.getNextBetween=function(e,t){return e+this.getNext()*(t-e)},r})();Ya.PseudoRandom=Eh});var ho=ot(Lr=>{"use strict";Object.defineProperty(Lr,"__esModule",{value:!0});var Ch=(function(){function r(e){this.scale=e,this.AB=0,this.AD=0,this.A2=0}return r.prototype.addVariable=function(e){var t=this.scale/e.scale,n=e.offset/e.scale,a=e.weight;this.AB+=a*t*n,this.AD+=a*t*e.desiredPosition,this.A2+=a*t*t},r.prototype.getPosn=function(){return(this.AD-this.AB)/this.A2},r})();Lr.PositionStats=Ch;var fo=(function(){function r(e,t,n,a){a===void 0&&(a=!1),this.left=e,this.right=t,this.gap=n,this.equality=a,this.active=!1,this.unsatisfiable=!1,this.left=e,this.right=t,this.gap=n,this.equality=a}return r.prototype.slack=function(){return this.unsatisfiable?Number.MAX_VALUE:this.right.scale*this.right.position()-this.gap-this.left.scale*this.left.position()},r})();Lr.Constraint=fo;var vo=(function(){function r(e,t,n){t===void 0&&(t=1),n===void 0&&(n=1),this.desiredPosition=e,this.weight=t,this.scale=n,this.offset=0}return r.prototype.dfdv=function(){return 2*this.weight*(this.position()-this.desiredPosition)},r.prototype.position=function(){return(this.block.ps.scale*this.block.posn+this.offset)/this.scale},r.prototype.visitNeighbours=function(e,t){var n=function(a,i){return a.active&&e!==i&&t(a,i)};this.cOut.forEach(function(a){return n(a,a.right)}),this.cIn.forEach(function(a){return n(a,a.left)})},r})();Lr.Variable=vo;var il=(function(){function r(e){this.vars=[],e.offset=0,this.ps=new Ch(e.scale),this.addVariable(e)}return r.prototype.addVariable=function(e){e.block=this,this.vars.push(e),this.ps.addVariable(e),this.posn=this.ps.getPosn()},r.prototype.updateWeightedPosition=function(){this.ps.AB=this.ps.AD=this.ps.A2=0;for(var e=0,t=this.vars.length;e<t;++e)this.ps.addVariable(this.vars[e]);this.posn=this.ps.getPosn()},r.prototype.compute_lm=function(e,t,n){var a=this,i=e.dfdv();return e.visitNeighbours(t,function(o,s){var u=a.compute_lm(s,e,n);s===o.right?(i+=u*o.left.scale,o.lm=u):(i+=u*o.right.scale,o.lm=-u),n(o)}),i/e.scale},r.prototype.populateSplitBlock=function(e,t){var n=this;e.visitNeighbours(t,function(a,i){i.offset=e.offset+(i===a.right?a.gap:-a.gap),n.addVariable(i),n.populateSplitBlock(i,e)})},r.prototype.traverse=function(e,t,n,a){var i=this;n===void 0&&(n=this.vars[0]),a===void 0&&(a=null),n.visitNeighbours(a,function(o,s){t.push(e(o)),i.traverse(e,t,s,n)})},r.prototype.findMinLM=function(){var e=null;return this.compute_lm(this.vars[0],null,function(t){!t.equality&&(e===null||t.lm<e.lm)&&(e=t)}),e},r.prototype.findMinLMBetween=function(e,t){this.compute_lm(e,null,function(){});var n=null;return this.findPath(e,null,t,function(a,i){!a.equality&&a.right===i&&(n===null||a.lm<n.lm)&&(n=a)}),n},r.prototype.findPath=function(e,t,n,a){var i=this,o=!1;return e.visitNeighbours(t,function(s,u){!o&&(u===n||i.findPath(u,e,n,a))&&(o=!0,a(s,u))}),o},r.prototype.isActiveDirectedPathBetween=function(e,t){if(e===t)return!0;for(var n=e.cOut.length;n--;){var a=e.cOut[n];if(a.active&&this.isActiveDirectedPathBetween(a.right,t))return!0}return!1},r.split=function(e){return e.active=!1,[r.createSplitBlock(e.left),r.createSplitBlock(e.right)]},r.createSplitBlock=function(e){var t=new r(e);return t.populateSplitBlock(e,null),t},r.prototype.splitBetween=function(e,t){var n=this.findMinLMBetween(e,t);if(n!==null){var a=r.split(n);return{constraint:n,lb:a[0],rb:a[1]}}return null},r.prototype.mergeAcross=function(e,t,n){t.active=!0;for(var a=0,i=e.vars.length;a<i;++a){var o=e.vars[a];o.offset+=n,this.addVariable(o)}this.posn=this.ps.getPosn()},r.prototype.cost=function(){for(var e=0,t=this.vars.length;t--;){var n=this.vars[t],a=n.position()-n.desiredPosition;e+=a*a*n.weight}return e},r})();Lr.Block=il;var ol=(function(){function r(e){this.vs=e;var t=e.length;for(this.list=new Array(t);t--;){var n=new il(e[t]);this.list[t]=n,n.blockInd=t}}return r.prototype.cost=function(){for(var e=0,t=this.list.length;t--;)e+=this.list[t].cost();return e},r.prototype.insert=function(e){e.blockInd=this.list.length,this.list.push(e)},r.prototype.remove=function(e){var t=this.list.length-1,n=this.list[t];this.list.length=t,e!==n&&(this.list[e.blockInd]=n,n.blockInd=e.blockInd)},r.prototype.merge=function(e){var t=e.left.block,n=e.right.block,a=e.right.offset-e.left.offset-e.gap;t.vars.length<n.vars.length?(n.mergeAcross(t,e,a),this.remove(t)):(t.mergeAcross(n,e,-a),this.remove(n))},r.prototype.forEach=function(e){this.list.forEach(e)},r.prototype.updateBlockPositions=function(){this.list.forEach(function(e){return e.updateWeightedPosition()})},r.prototype.split=function(e){var t=this;this.updateBlockPositions(),this.list.forEach(function(n){var a=n.findMinLM();a!==null&&a.lm<sl.LAGRANGIAN_TOLERANCE&&(n=a.left.block,il.split(a).forEach(function(i){return t.insert(i)}),t.remove(n),e.push(a))})},r})();Lr.Blocks=ol;var sl=(function(){function r(e,t){this.vs=e,this.cs=t,this.vs=e,e.forEach(function(n){n.cIn=[],n.cOut=[]}),this.cs=t,t.forEach(function(n){n.left.cOut.push(n),n.right.cIn.push(n)}),this.inactive=t.map(function(n){return n.active=!1,n}),this.bs=null}return r.prototype.cost=function(){return this.bs.cost()},r.prototype.setStartingPositions=function(e){this.inactive=this.cs.map(function(t){return t.active=!1,t}),this.bs=new ol(this.vs),this.bs.forEach(function(t,n){return t.posn=e[n]})},r.prototype.setDesiredPositions=function(e){this.vs.forEach(function(t,n){return t.desiredPosition=e[n]})},r.prototype.mostViolated=function(){for(var e=Number.MAX_VALUE,t=null,n=this.inactive,a=n.length,i=a,o=0;o<a;++o){var s=n[o];if(!s.unsatisfiable){var u=s.slack();if((s.equality||u<e)&&(e=u,t=s,i=o,s.equality))break}}return i!==a&&(e<r.ZERO_UPPERBOUND&&!t.active||t.equality)&&(n[i]=n[a-1],n.length=a-1),t},r.prototype.satisfy=function(){this.bs==null&&(this.bs=new ol(this.vs)),this.bs.split(this.inactive);for(var e=null;(e=this.mostViolated())&&(e.equality||e.slack()<r.ZERO_UPPERBOUND&&!e.active);){var t=e.left.block,n=e.right.block;if(t!==n)this.bs.merge(e);else{if(t.isActiveDirectedPathBetween(e.right,e.left)){e.unsatisfiable=!0;continue}var a=t.splitBetween(e.left,e.right);if(a!==null)this.bs.insert(a.lb),this.bs.insert(a.rb),this.bs.remove(t),this.inactive.push(a.constraint);else{e.unsatisfiable=!0;continue}e.slack()>=0?this.inactive.push(e):this.bs.merge(e)}}},r.prototype.solve=function(){this.satisfy();for(var e=Number.MAX_VALUE,t=this.bs.cost();Math.abs(e-t)>1e-4;)this.satisfy(),e=t,t=this.bs.cost();return t},r.LAGRANGIAN_TOLERANCE=-1e-4,r.ZERO_UPPERBOUND=-1e-10,r})();Lr.Solver=sl;function ux(r,e,t){for(var n=r.map(function(g){return new vo(g.desiredCenter)}),a=[],i=r.length,o=0;o<i-1;o++){var s=r[o],u=r[o+1];a.push(new fo(n[o],n[o+1],(s.size+u.size)/2))}var l=n[0],c=n[i-1],f=r[0].size/2,d=r[i-1].size/2,h=null,v=null;e&&(h=new vo(e,l.weight*1e3),n.push(h),a.push(new fo(h,l,f))),t&&(v=new vo(t,c.weight*1e3),n.push(v),a.push(new fo(c,v,d)));var y=new sl(n,a);return y.solve(),{newCenters:n.slice(0,r.length).map(function(g){return g.position()}),lowerBound:h?h.position():l.position()-f,upperBound:v?v.position():c.position()+d}}Lr.removeOverlapInOneDimension=ux});var ul=ot(kn=>{"use strict";var lx=kn&&kn.__extends||(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var i in a)a.hasOwnProperty(i)&&(n[i]=a[i])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})();Object.defineProperty(kn,"__esModule",{value:!0});var Sh=(function(){function r(){this.findIter=function(e){for(var t=this._root,n=this.iterator();t!==null;){var a=this._comparator(e,t.data);if(a===0)return n._cursor=t,n;n._ancestors.push(t),t=t.get_child(a>0)}return null}}return r.prototype.clear=function(){this._root=null,this.size=0},r.prototype.find=function(e){for(var t=this._root;t!==null;){var n=this._comparator(e,t.data);if(n===0)return t.data;t=t.get_child(n>0)}return null},r.prototype.lowerBound=function(e){return this._bound(e,this._comparator)},r.prototype.upperBound=function(e){var t=this._comparator;function n(a,i){return t(i,a)}return this._bound(e,n)},r.prototype.min=function(){var e=this._root;if(e===null)return null;for(;e.left!==null;)e=e.left;return e.data},r.prototype.max=function(){var e=this._root;if(e===null)return null;for(;e.right!==null;)e=e.right;return e.data},r.prototype.iterator=function(){return new kh(this)},r.prototype.each=function(e){for(var t=this.iterator(),n;(n=t.next())!==null;)e(n)},r.prototype.reach=function(e){for(var t=this.iterator(),n;(n=t.prev())!==null;)e(n)},r.prototype._bound=function(e,t){for(var n=this._root,a=this.iterator();n!==null;){var i=this._comparator(e,n.data);if(i===0)return a._cursor=n,a;a._ancestors.push(n),n=n.get_child(i>0)}for(var o=a._ancestors.length-1;o>=0;--o)if(n=a._ancestors[o],t(e,n.data)>0)return a._cursor=n,a._ancestors.length=o,a;return a._ancestors.length=0,a},r})();kn.TreeBase=Sh;var kh=(function(){function r(e){this._tree=e,this._ancestors=[],this._cursor=null}return r.prototype.data=function(){return this._cursor!==null?this._cursor.data:null},r.prototype.next=function(){if(this._cursor===null){var e=this._tree._root;e!==null&&this._minNode(e)}else if(this._cursor.right===null){var t;do if(t=this._cursor,this._ancestors.length)this._cursor=this._ancestors.pop();else{this._cursor=null;break}while(this._cursor.right===t)}else this._ancestors.push(this._cursor),this._minNode(this._cursor.right);return this._cursor!==null?this._cursor.data:null},r.prototype.prev=function(){if(this._cursor===null){var e=this._tree._root;e!==null&&this._maxNode(e)}else if(this._cursor.left===null){var t;do if(t=this._cursor,this._ancestors.length)this._cursor=this._ancestors.pop();else{this._cursor=null;break}while(this._cursor.left===t)}else this._ancestors.push(this._cursor),this._maxNode(this._cursor.left);return this._cursor!==null?this._cursor.data:null},r.prototype._minNode=function(e){for(;e.left!==null;)this._ancestors.push(e),e=e.left;this._cursor=e},r.prototype._maxNode=function(e){for(;e.right!==null;)this._ancestors.push(e),e=e.right;this._cursor=e},r})();kn.Iterator=kh;var po=(function(){function r(e){this.data=e,this.left=null,this.right=null,this.red=!0}return r.prototype.get_child=function(e){return e?this.right:this.left},r.prototype.set_child=function(e,t){e?this.right=t:this.left=t},r})(),cx=(function(r){lx(e,r);function e(t){var n=r.call(this)||this;return n._root=null,n._comparator=t,n.size=0,n}return e.prototype.insert=function(t){var n=!1;if(this._root===null)this._root=new po(t),n=!0,this.size++;else{var a=new po(void 0),i=!1,o=!1,s=null,u=a,l=null,c=this._root;for(u.right=this._root;;){if(c===null?(c=new po(t),l.set_child(i,c),n=!0,this.size++):e.is_red(c.left)&&e.is_red(c.right)&&(c.red=!0,c.left.red=!1,c.right.red=!1),e.is_red(c)&&e.is_red(l)){var f=u.right===s;c===l.get_child(o)?u.set_child(f,e.single_rotate(s,!o)):u.set_child(f,e.double_rotate(s,!o))}var d=this._comparator(c.data,t);if(d===0)break;o=i,i=d<0,s!==null&&(u=s),s=l,l=c,c=c.get_child(i)}this._root=a.right}return this._root.red=!1,n},e.prototype.remove=function(t){if(this._root===null)return!1;var n=new po(void 0),a=n;a.right=this._root;for(var i=null,o=null,s=null,u=!0;a.get_child(u)!==null;){var l=u;o=i,i=a,a=a.get_child(u);var c=this._comparator(t,a.data);if(u=c>0,c===0&&(s=a),!e.is_red(a)&&!e.is_red(a.get_child(u))){if(e.is_red(a.get_child(!u))){var f=e.single_rotate(a,u);i.set_child(l,f),i=f}else if(!e.is_red(a.get_child(!u))){var d=i.get_child(!l);if(d!==null)if(!e.is_red(d.get_child(!l))&&!e.is_red(d.get_child(l)))i.red=!1,d.red=!0,a.red=!0;else{var h=o.right===i;e.is_red(d.get_child(l))?o.set_child(h,e.double_rotate(i,l)):e.is_red(d.get_child(!l))&&o.set_child(h,e.single_rotate(i,l));var v=o.get_child(h);v.red=!0,a.red=!0,v.left.red=!1,v.right.red=!1}}}}return s!==null&&(s.data=a.data,i.set_child(i.right===a,a.get_child(a.left===null)),this.size--),this._root=n.right,this._root!==null&&(this._root.red=!1),s!==null},e.is_red=function(t){return t!==null&&t.red},e.single_rotate=function(t,n){var a=t.get_child(!n);return t.set_child(!n,a.get_child(n)),a.set_child(n,t),t.red=!0,a.red=!1,a},e.double_rotate=function(t,n){return t.set_child(!n,e.single_rotate(t.get_child(!n),!n)),e.single_rotate(t,n)},e})(Sh);kn.RBTree=cx});var ta=ot(Lt=>{"use strict";var fx=Lt&&Lt.__extends||(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var i in a)a.hasOwnProperty(i)&&(n[i]=a[i])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})();Object.defineProperty(Lt,"__esModule",{value:!0});var Or=ho(),dx=ul();function Ka(r){return r.bounds=typeof r.leaves<"u"?r.leaves.reduce(function(e,t){return t.bounds.union(e)},un.empty()):un.empty(),typeof r.groups<"u"&&(r.bounds=r.groups.reduce(function(e,t){return Ka(t).union(e)},r.bounds)),r.bounds=r.bounds.inflate(r.padding),r.bounds}Lt.computeGroupBounds=Ka;var un=(function(){function r(e,t,n,a){this.x=e,this.X=t,this.y=n,this.Y=a}return r.empty=function(){return new r(Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY)},r.prototype.cx=function(){return(this.x+this.X)/2},r.prototype.cy=function(){return(this.y+this.Y)/2},r.prototype.overlapX=function(e){var t=this.cx(),n=e.cx();return t<=n&&e.x<this.X?this.X-e.x:n<=t&&this.x<e.X?e.X-this.x:0},r.prototype.overlapY=function(e){var t=this.cy(),n=e.cy();return t<=n&&e.y<this.Y?this.Y-e.y:n<=t&&this.y<e.Y?e.Y-this.y:0},r.prototype.setXCentre=function(e){var t=e-this.cx();this.x+=t,this.X+=t},r.prototype.setYCentre=function(e){var t=e-this.cy();this.y+=t,this.Y+=t},r.prototype.width=function(){return this.X-this.x},r.prototype.height=function(){return this.Y-this.y},r.prototype.union=function(e){return new r(Math.min(this.x,e.x),Math.max(this.X,e.X),Math.min(this.y,e.y),Math.max(this.Y,e.Y))},r.prototype.lineIntersections=function(e,t,n,a){for(var i=[[this.x,this.y,this.X,this.y],[this.X,this.y,this.X,this.Y],[this.X,this.Y,this.x,this.Y],[this.x,this.Y,this.x,this.y]],o=[],s=0;s<4;++s){var u=r.lineIntersection(e,t,n,a,i[s][0],i[s][1],i[s][2],i[s][3]);u!==null&&o.push({x:u.x,y:u.y})}return o},r.prototype.rayIntersection=function(e,t){var n=this.lineIntersections(this.cx(),this.cy(),e,t);return n.length>0?n[0]:null},r.prototype.vertices=function(){return[{x:this.x,y:this.y},{x:this.X,y:this.y},{x:this.X,y:this.Y},{x:this.x,y:this.Y}]},r.lineIntersection=function(e,t,n,a,i,o,s,u){var l=n-e,c=s-i,f=a-t,d=u-o,h=d*l-c*f;if(h==0)return null;var v=e-i,y=t-o,g=c*y-d*v,p=g/h,m=l*y-f*v,b=m/h;return p>=0&&p<=1&&b>=0&&b<=1?{x:e+p*l,y:t+p*f}:null},r.prototype.inflate=function(e){return new r(this.x-e,this.X+e,this.y-e,this.Y+e)},r})();Lt.Rectangle=un;function vx(r,e,t){var n=r.rayIntersection(e.cx(),e.cy())||{x:r.cx(),y:r.cy()},a=e.rayIntersection(r.cx(),r.cy())||{x:e.cx(),y:e.cy()},i=a.x-n.x,o=a.y-n.y,s=Math.sqrt(i*i+o*o),u=s-t;return{sourceIntersection:n,targetIntersection:a,arrowStart:{x:n.x+u*i/s,y:n.y+u*o/s}}}Lt.makeEdgeBetween=vx;function hx(r,e,t){var n=e.rayIntersection(r.x,r.y);n||(n={x:e.cx(),y:e.cy()});var a=n.x-r.x,i=n.y-r.y,o=Math.sqrt(a*a+i*i);return{x:n.x-t*a/o,y:n.y-t*i/o}}Lt.makeEdgeTo=hx;var px=(function(){function r(e,t,n){this.v=e,this.r=t,this.pos=n,this.prev=ll(),this.next=ll()}return r})(),Th=(function(){function r(e,t,n){this.isOpen=e,this.v=t,this.pos=n}return r})();function gx(r,e){return r.pos>e.pos?1:r.pos<e.pos||r.isOpen?-1:e.isOpen?1:0}function ll(){return new dx.RBTree(function(r,e){return r.pos-e.pos})}var _h={getCentre:function(r){return r.cx()},getOpen:function(r){return r.y},getClose:function(r){return r.Y},getSize:function(r){return r.width()},makeRect:function(r,e,t,n){return new un(t-n/2,t+n/2,r,e)},findNeighbours:yx},Ph={getCentre:function(r){return r.cy()},getOpen:function(r){return r.x},getClose:function(r){return r.X},getSize:function(r){return r.height()},makeRect:function(r,e,t,n){return new un(r,e,t-n/2,t+n/2)},findNeighbours:mx};function cl(r,e,t,n){n===void 0&&(n=!1);var a=r.padding,i=typeof r.groups<"u"?r.groups.length:0,o=typeof r.leaves<"u"?r.leaves.length:0,s=i?r.groups.reduce(function(E,S){return E.concat(cl(S,e,t,!0))},[]):[],u=(n?2:0)+o+i,l=new Array(u),c=new Array(u),f=0,d=function(E,S){c[f]=E,l[f++]=S};if(n){var h=r.bounds,v=e.getCentre(h),y=e.getSize(h)/2,g=e.getOpen(h),p=e.getClose(h),m=v-y+a/2,b=v+y-a/2;r.minVar.desiredPosition=m,d(e.makeRect(g,p,m,a),r.minVar),r.maxVar.desiredPosition=b,d(e.makeRect(g,p,b,a),r.maxVar)}o&&r.leaves.forEach(function(E){return d(E.bounds,E.variable)}),i&&r.groups.forEach(function(E){var S=E.bounds;d(e.makeRect(e.getOpen(S),e.getClose(S),e.getCentre(S),e.getSize(S)),E.minVar)});var x=fl(c,l,e,t);return i&&(l.forEach(function(E){E.cOut=[],E.cIn=[]}),x.forEach(function(E){E.left.cOut.push(E),E.right.cIn.push(E)}),r.groups.forEach(function(E){var S=(E.padding-e.getSize(E.bounds))/2;E.minVar.cIn.forEach(function(w){return w.gap+=S}),E.minVar.cOut.forEach(function(w){w.left=E.maxVar,w.gap+=S})})),s.concat(x)}function fl(r,e,t,n){var a,i=r.length,o=2*i;console.assert(e.length>=i);var s=new Array(o);for(a=0;a<i;++a){var u=r[a],l=new px(e[a],u,t.getCentre(u));s[a]=new Th(!0,l,t.getOpen(u)),s[a+i]=new Th(!1,l,t.getClose(u))}s.sort(gx);var c=new Array,f=ll();for(a=0;a<o;++a){var d=s[a],l=d.v;if(d.isOpen)f.insert(l),t.findNeighbours(l,f);else{f.remove(l);var h=function(g,p){var m=(t.getSize(g.r)+t.getSize(p.r))/2+n;c.push(new Or.Constraint(g.v,p.v,m))},v=function(g,p,m){for(var b,x=l[g].iterator();(b=x[g]())!==null;)m(b,l),b[p].remove(l)};v("prev","next",function(g,p){return h(g,p)}),v("next","prev",function(g,p){return h(p,g)})}}return console.assert(f.size===0),c}function yx(r,e){var t=function(n,a){for(var i=e.findIter(r),o;(o=i[n]())!==null;){var s=o.r.overlapX(r.r);if((s<=0||s<=o.r.overlapY(r.r))&&(r[n].insert(o),o[a].insert(r)),s<=0)break}};t("next","prev"),t("prev","next")}function mx(r,e){var t=function(n,a){var i=e.findIter(r)[n]();i!==null&&i.r.overlapX(r.r)>0&&(r[n].insert(i),i[a].insert(r))};t("next","prev"),t("prev","next")}function Dh(r,e){return fl(r,e,_h,1e-6)}Lt.generateXConstraints=Dh;function Ah(r,e){return fl(r,e,Ph,1e-6)}Lt.generateYConstraints=Ah;function Mh(r){return cl(r,_h,1e-6)}Lt.generateXGroupConstraints=Mh;function Rh(r){return cl(r,Ph,1e-6)}Lt.generateYGroupConstraints=Rh;function bx(r){var e=r.map(function(a){return new Or.Variable(a.cx())}),t=Dh(r,e),n=new Or.Solver(e,t);n.solve(),e.forEach(function(a,i){return r[i].setXCentre(a.position())}),e=r.map(function(a){return new Or.Variable(a.cy())}),t=Ah(r,e),n=new Or.Solver(e,t),n.solve(),e.forEach(function(a,i){return r[i].setYCentre(a.position())})}Lt.removeOverlaps=bx;var go=(function(r){fx(e,r);function e(t,n){var a=r.call(this,0,n)||this;return a.index=t,a}return e})(Or.Variable);Lt.IndexedVariable=go;var xx=(function(){function r(e,t,n,a,i){var o=this;if(n===void 0&&(n=null),a===void 0&&(a=null),i===void 0&&(i=!1),this.nodes=e,this.groups=t,this.rootGroup=n,this.avoidOverlaps=i,this.variables=e.map(function(u,l){return u.variable=new go(l,1)}),a&&this.createConstraints(a),i&&n&&typeof n.groups<"u"){e.forEach(function(u){if(!u.width||!u.height){u.bounds=new un(u.x,u.x,u.y,u.y);return}var l=u.width/2,c=u.height/2;u.bounds=new un(u.x-l,u.x+l,u.y-c,u.y+c)}),Ka(n);var s=e.length;t.forEach(function(u){o.variables[s]=u.minVar=new go(s++,typeof u.stiffness<"u"?u.stiffness:.01),o.variables[s]=u.maxVar=new go(s++,typeof u.stiffness<"u"?u.stiffness:.01)})}}return r.prototype.createSeparation=function(e){return new Or.Constraint(this.nodes[e.left].variable,this.nodes[e.right].variable,e.gap,typeof e.equality<"u"?e.equality:!1)},r.prototype.makeFeasible=function(e){var t=this;if(this.avoidOverlaps){var n="x",a="width";e.axis==="x"&&(n="y",a="height");var i=e.offsets.map(function(s){return t.nodes[s.node]}).sort(function(s,u){return s[n]-u[n]}),o=null;i.forEach(function(s){if(o){var u=o[n]+o[a];u>s[n]&&(s[n]=u)}o=s})}},r.prototype.createAlignment=function(e){var t=this,n=this.nodes[e.offsets[0].node].variable;this.makeFeasible(e);var a=e.axis==="x"?this.xConstraints:this.yConstraints;e.offsets.slice(1).forEach(function(i){var o=t.nodes[i.node].variable;a.push(new Or.Constraint(n,o,i.offset,!0))})},r.prototype.createConstraints=function(e){var t=this,n=function(a){return typeof a.type>"u"||a.type==="separation"};this.xConstraints=e.filter(function(a){return a.axis==="x"&&n(a)}).map(function(a){return t.createSeparation(a)}),this.yConstraints=e.filter(function(a){return a.axis==="y"&&n(a)}).map(function(a){return t.createSeparation(a)}),e.filter(function(a){return a.type==="alignment"}).forEach(function(a){return t.createAlignment(a)})},r.prototype.setupVariablesAndBounds=function(e,t,n,a){this.nodes.forEach(function(i,o){i.fixed?(i.variable.weight=i.fixedWeight?i.fixedWeight:1e3,n[o]=a(i)):i.variable.weight=1;var s=(i.width||0)/2,u=(i.height||0)/2,l=e[o],c=t[o];i.bounds=new un(l-s,l+s,c-u,c+u)})},r.prototype.xProject=function(e,t,n){!this.rootGroup&&!(this.avoidOverlaps||this.xConstraints)||this.project(e,t,e,n,function(a){return a.px},this.xConstraints,Mh,function(a){return a.bounds.setXCentre(n[a.variable.index]=a.variable.position())},function(a){var i=n[a.minVar.index]=a.minVar.position(),o=n[a.maxVar.index]=a.maxVar.position(),s=a.padding/2;a.bounds.x=i-s,a.bounds.X=o+s})},r.prototype.yProject=function(e,t,n){!this.rootGroup&&!this.yConstraints||this.project(e,t,t,n,function(a){return a.py},this.yConstraints,Rh,function(a){return a.bounds.setYCentre(n[a.variable.index]=a.variable.position())},function(a){var i=n[a.minVar.index]=a.minVar.position(),o=n[a.maxVar.index]=a.maxVar.position(),s=a.padding/2;a.bounds.y=i-s,a.bounds.Y=o+s})},r.prototype.projectFunctions=function(){var e=this;return[function(t,n,a){return e.xProject(t,n,a)},function(t,n,a){return e.yProject(t,n,a)}]},r.prototype.project=function(e,t,n,a,i,o,s,u,l){this.setupVariablesAndBounds(e,t,a,i),this.rootGroup&&this.avoidOverlaps&&(Ka(this.rootGroup),o=o.concat(s(this.rootGroup))),this.solve(this.variables,o,n,a),this.nodes.forEach(u),this.rootGroup&&this.avoidOverlaps&&(this.groups.forEach(l),Ka(this.rootGroup))},r.prototype.solve=function(e,t,n,a){var i=new Or.Solver(e,t);i.setStartingPositions(n),i.setDesiredPositions(a),i.solve()},r})();Lt.Projection=xx});var dl=ot(yo=>{"use strict";Object.defineProperty(yo,"__esModule",{value:!0});var Bh=(function(){function r(e){this.elem=e,this.subheaps=[]}return r.prototype.toString=function(e){for(var t="",n=!1,a=0;a<this.subheaps.length;++a){var i=this.subheaps[a];if(!i.elem){n=!1;continue}n&&(t=t+","),t=t+i.toString(e),n=!0}return t!==""&&(t="("+t+")"),(this.elem?e(this.elem):"")+t},r.prototype.forEach=function(e){this.empty()||(e(this.elem,this),this.subheaps.forEach(function(t){return t.forEach(e)}))},r.prototype.count=function(){return this.empty()?0:1+this.subheaps.reduce(function(e,t){return e+t.count()},0)},r.prototype.min=function(){return this.elem},r.prototype.empty=function(){return this.elem==null},r.prototype.contains=function(e){if(this===e)return!0;for(var t=0;t<this.subheaps.length;t++)if(this.subheaps[t].contains(e))return!0;return!1},r.prototype.isHeap=function(e){var t=this;return this.subheaps.every(function(n){return e(t.elem,n.elem)&&n.isHeap(e)})},r.prototype.insert=function(e,t){return this.merge(new r(e),t)},r.prototype.merge=function(e,t){return this.empty()?e:e.empty()?this:t(this.elem,e.elem)?(this.subheaps.push(e),this):(e.subheaps.push(this),e)},r.prototype.removeMin=function(e){return this.empty()?null:this.mergePairs(e)},r.prototype.mergePairs=function(e){if(this.subheaps.length==0)return new r(null);if(this.subheaps.length==1)return this.subheaps[0];var t=this.subheaps.pop().merge(this.subheaps.pop(),e),n=this.mergePairs(e);return t.merge(n,e)},r.prototype.decreaseKey=function(e,t,n,a){var i=e.removeMin(a);e.elem=i.elem,e.subheaps=i.subheaps,n!==null&&i.elem!==null&&n(e.elem,e);var o=new r(t);return n!==null&&n(t,o),this.merge(o,a)},r})();yo.PairingHeap=Bh;var wx=(function(){function r(e){this.lessThan=e}return r.prototype.top=function(){return this.empty()?null:this.root.elem},r.prototype.push=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var n,a=0,i;i=e[a];++a)n=new Bh(i),this.root=this.empty()?n:this.root.merge(n,this.lessThan);return n},r.prototype.empty=function(){return!this.root||!this.root.elem},r.prototype.isHeap=function(){return this.root.isHeap(this.lessThan)},r.prototype.forEach=function(e){this.root.forEach(e)},r.prototype.pop=function(){if(this.empty())return null;var e=this.root.min();return this.root=this.root.removeMin(this.lessThan),e},r.prototype.reduceKey=function(e,t,n){n===void 0&&(n=null),this.root=this.root.decreaseKey(e,t,n,this.lessThan)},r.prototype.toString=function(e){return this.root.toString(e)},r.prototype.count=function(){return this.root.count()},r})();yo.PriorityQueue=wx});var Za=ot(vl=>{"use strict";Object.defineProperty(vl,"__esModule",{value:!0});var Lh=dl(),Oh=(function(){function r(e,t){this.id=e,this.distance=t}return r})(),Ex=(function(){function r(e){this.id=e,this.neighbours=[]}return r})(),Ih=(function(){function r(e,t,n){this.node=e,this.prev=t,this.d=n}return r})(),Cx=(function(){function r(e,t,n,a,i){this.n=e,this.es=t,this.neighbours=new Array(this.n);for(var o=this.n;o--;)this.neighbours[o]=new Ex(o);for(o=this.es.length;o--;){var s=this.es[o],u=n(s),l=a(s),c=i(s);this.neighbours[u].neighbours.push(new Oh(l,c)),this.neighbours[l].neighbours.push(new Oh(u,c))}}return r.prototype.DistanceMatrix=function(){for(var e=new Array(this.n),t=0;t<this.n;++t)e[t]=this.dijkstraNeighbours(t);return e},r.prototype.DistancesFromNode=function(e){return this.dijkstraNeighbours(e)},r.prototype.PathFromNodeToNode=function(e,t){return this.dijkstraNeighbours(e,t)},r.prototype.PathFromNodeToNodeWithPrevCost=function(e,t,n){var a=new Lh.PriorityQueue(function(y,g){return y.d<=g.d}),i=this.neighbours[e],o=new Ih(i,null,0),s={};for(a.push(o);!a.empty()&&(o=a.pop(),i=o.node,i.id!==t);)for(var u=i.neighbours.length;u--;){var l=i.neighbours[u],c=this.neighbours[l.id];if(!(o.prev&&c.id===o.prev.node.id)){var f=c.id+","+i.id;if(!(f in s&&s[f]<=o.d)){var d=o.prev?n(o.prev.node.id,i.id,c.id):0,h=o.d+l.distance+d;s[f]=h,a.push(new Ih(c,o,h))}}}for(var v=[];o.prev;)o=o.prev,v.push(o.node.id);return v},r.prototype.dijkstraNeighbours=function(e,t){t===void 0&&(t=-1);for(var n=new Lh.PriorityQueue(function(d,h){return d.d<=h.d}),a=this.neighbours.length,i=new Array(a);a--;){var o=this.neighbours[a];o.d=a===e?0:Number.POSITIVE_INFINITY,o.q=n.push(o)}for(;!n.empty();){var s=n.pop();if(i[s.id]=s.d,s.id===t){for(var u=[],l=s;typeof l.prev<"u";)u.push(l.prev.id),l=l.prev;return u}for(a=s.neighbours.length;a--;){var c=s.neighbours[a],l=this.neighbours[c.id],f=s.d+c.distance;s.d!==Number.MAX_VALUE&&l.d>f&&(l.d=f,l.prev=s,n.reduceKey(l.q,l,function(h,v){return h.q=v}))}}return i},r})();vl.Calculator=Cx});var yl=ot(et=>{"use strict";var zh=et&&et.__extends||(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var i in a)a.hasOwnProperty(i)&&(n[i]=a[i])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})();Object.defineProperty(et,"__esModule",{value:!0});var Sx=ta(),pl=(function(){function r(){}return r})();et.Point=pl;var gl=(function(){function r(e,t,n,a){this.x1=e,this.y1=t,this.x2=n,this.y2=a}return r})();et.LineSegment=gl;var kx=(function(r){zh(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e})(pl);et.PolyPoint=kx;function Gt(r,e,t){return(e.x-r.x)*(t.y-r.y)-(t.x-r.x)*(e.y-r.y)}et.isLeft=Gt;function lr(r,e,t){return Gt(r,e,t)>0}function Jt(r,e,t){return Gt(r,e,t)<0}function Tx(r){var e=r.slice(0).sort(function(d,h){return d.x!==h.x?h.x-d.x:h.y-d.y}),t=r.length,n,a=0,i=e[0].x;for(n=1;n<t&&e[n].x===i;++n);var o=n-1,s=[];if(s.push(e[a]),o===t-1)e[o].y!==e[a].y&&s.push(e[o]);else{var u,l=t-1,c=e[t-1].x;for(n=t-2;n>=0&&e[n].x===c;n--);for(u=n+1,n=o;++n<=u;)if(!(Gt(e[a],e[u],e[n])>=0&&n<u)){for(;s.length>1&&!(Gt(s[s.length-2],s[s.length-1],e[n])>0);)s.length-=1;n!=a&&s.push(e[n])}l!=u&&s.push(e[l]);var f=s.length;for(n=u;--n>=o;)if(!(Gt(e[l],e[o],e[n])>=0&&n>o)){for(;s.length>f&&!(Gt(s[s.length-2],s[s.length-1],e[n])>0);)s.length-=1;n!=a&&s.push(e[n])}}return s}et.ConvexHull=Tx;function _x(r,e,t){e.slice(0).sort(function(n,a){return Math.atan2(n.y-r.y,n.x-r.x)-Math.atan2(a.y-r.y,a.x-r.x)}).forEach(t)}et.clockwiseRadialSweep=_x;function Px(r,e){var t=e.slice(0);return t.push(e[0]),{rtan:bo(r,t),ltan:xo(r,t)}}function bo(r,e){var t=e.length-1,n,a,i,o,s;if(Jt(r,e[1],e[0])&&!lr(r,e[t-1],e[0]))return 0;for(n=0,a=t;;){if(a-n===1)return lr(r,e[n],e[a])?n:a;if(i=Math.floor((n+a)/2),s=Jt(r,e[i+1],e[i]),s&&!lr(r,e[i-1],e[i]))return i;o=lr(r,e[n+1],e[n]),o?s||lr(r,e[n],e[i])?a=i:n=i:s&&Jt(r,e[n],e[i])?a=i:n=i}}function xo(r,e){var t=e.length-1,n,a,i,o,s;if(lr(r,e[t-1],e[0])&&!Jt(r,e[1],e[0]))return 0;for(n=0,a=t;;){if(a-n===1)return Jt(r,e[n],e[a])?n:a;if(i=Math.floor((n+a)/2),s=Jt(r,e[i+1],e[i]),lr(r,e[i-1],e[i])&&!s)return i;o=Jt(r,e[n+1],e[n]),o?s?Jt(r,e[n],e[i])?a=i:n=i:a=i:s?n=i:lr(r,e[n],e[i])?a=i:n=i}}function wo(r,e,t,n,a,i){var o,s;o=t(e[0],r),s=n(r[o],e);for(var u=!1;!u;){for(u=!0;o===r.length-1&&(o=0),!a(e[s],r[o],r[o+1]);)++o;for(;s===0&&(s=e.length-1),!i(r[o],e[s],e[s-1]);)--s,u=!1}return{t1:o,t2:s}}et.tangent_PolyPolyC=wo;function Dx(r,e){var t=Fh(e,r);return{t1:t.t2,t2:t.t1}}et.LRtangent_PolyPolyC=Dx;function Fh(r,e){return wo(r,e,bo,xo,lr,Jt)}et.RLtangent_PolyPolyC=Fh;function Ax(r,e){return wo(r,e,xo,xo,Jt,Jt)}et.LLtangent_PolyPolyC=Ax;function Mx(r,e){return wo(r,e,bo,bo,lr,lr)}et.RRtangent_PolyPolyC=Mx;var Qa=(function(){function r(e,t){this.t1=e,this.t2=t}return r})();et.BiTangent=Qa;var Vh=(function(){function r(){}return r})();et.BiTangents=Vh;var Rx=(function(r){zh(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e})(pl);et.TVGPoint=Rx;var hl=(function(){function r(e,t,n,a){this.id=e,this.polyid=t,this.polyvertid=n,this.p=a,a.vv=this}return r})();et.VisibilityVertex=hl;var mo=(function(){function r(e,t){this.source=e,this.target=t}return r.prototype.length=function(){var e=this.source.p.x-this.target.p.x,t=this.source.p.y-this.target.p.y;return Math.sqrt(e*e+t*t)},r})();et.VisibilityEdge=mo;var Bx=(function(){function r(e,t){if(this.P=e,this.V=[],this.E=[],t)this.V=t.V.slice(0),this.E=t.E.slice(0);else{for(var n=e.length,a=0;a<n;a++){for(var i=e[a],o=0;o<i.length;++o){var s=i[o],u=new hl(this.V.length,a,o,s);this.V.push(u),o>0&&this.E.push(new mo(i[o-1].vv,u))}i.length>1&&this.E.push(new mo(i[0].vv,i[i.length-1].vv))}for(var a=0;a<n-1;a++)for(var l=e[a],o=a+1;o<n;o++){var c=e[o],f=Gh(l,c);for(var d in f){var h=f[d],v=l[h.t1],y=c[h.t2];this.addEdgeIfVisible(v,y,a,o)}}}}return r.prototype.addEdgeIfVisible=function(e,t,n,a){this.intersectsPolys(new gl(e.x,e.y,t.x,t.y),n,a)||this.E.push(new mo(e.vv,t.vv))},r.prototype.addPoint=function(e,t){var n=this.P.length;this.V.push(new hl(this.V.length,n,0,e));for(var a=0;a<n;++a)if(a!==t){var i=this.P[a],o=Px(e,i);this.addEdgeIfVisible(e,i[o.ltan],t,a),this.addEdgeIfVisible(e,i[o.rtan],t,a)}return e.vv},r.prototype.intersectsPolys=function(e,t,n){for(var a=0,i=this.P.length;a<i;++a)if(a!=t&&a!=n&&qh(e,this.P[a]).length>0)return!0;return!1},r})();et.TangentVisibilityGraph=Bx;function qh(r,e){for(var t=[],n=1,a=e.length;n<a;++n){var i=Sx.Rectangle.lineIntersection(r.x1,r.y1,r.x2,r.y2,e[n-1].x,e[n-1].y,e[n].x,e[n].y);i&&t.push(i)}return t}function Gh(r,e){for(var t=r.length-1,n=e.length-1,a=new Vh,i=0;i<t;++i)for(var o=0;o<n;++o){var s=r[i==0?t-1:i-1],u=r[i],l=r[i+1],c=e[o==0?n-1:o-1],f=e[o],d=e[o+1],h=Gt(s,u,f),v=Gt(u,c,f),y=Gt(u,f,d),g=Gt(c,f,u),p=Gt(f,s,u),m=Gt(f,u,l);h>=0&&v>=0&&y<0&&g>=0&&p>=0&&m<0?a.ll=new Qa(i,o):h<=0&&v<=0&&y>0&&g<=0&&p<=0&&m>0?a.rr=new Qa(i,o):h<=0&&v>0&&y<=0&&g>=0&&p<0&&m>=0?a.rl=new Qa(i,o):h>=0&&v<0&&y>=0&&g<=0&&p>0&&m<=0&&(a.lr=new Qa(i,o))}return a}et.tangents=Gh;function Lx(r,e){for(var t=1,n=e.length;t<n;++t)if(Jt(e[t-1],e[t],r))return!1;return!0}function Nh(r,e){return!r.every(function(t){return!Lx(t,e)})}function Ox(r,e){if(Nh(r,e)||Nh(e,r))return!0;for(var t=1,n=r.length;t<n;++t){var a=r[t],i=r[t-1];if(qh(new gl(i.x,i.y,a.x,a.y),e).length>0)return!0}return!1}et.polysOverlap=Ox});var ml=ot(Eo=>{"use strict";Object.defineProperty(Eo,"__esModule",{value:!0});var jt={PADDING:10,GOLDEN_SECTION:(1+Math.sqrt(5))/2,FLOAT_EPSILON:1e-4,MAX_INERATIONS:100};function Ix(r,e,t,f,c,i){c===void 0&&(c=1),i===void 0&&(i=!0);var o=0,s=0,u=e,l=t,c=typeof c<"u"?c:1,f=typeof f<"u"?f:0,d=0,h=0,v=0,y=0,g=[];if(r.length==0)return;p(r),b(r,c),i&&m(r);function p(k){k.forEach(function(C){_(C)});function _(C){var T=Number.MAX_VALUE,D=Number.MAX_VALUE,A=0,R=0;C.array.forEach(function(M){var L=typeof M.width<"u"?M.width:f,B=typeof M.height<"u"?M.height:f;L/=2,B/=2,A=Math.max(M.x+L,A),T=Math.min(M.x-L,T),R=Math.max(M.y+B,R),D=Math.min(M.y-B,D)}),C.width=A-T,C.height=R-D}}function m(k){k.forEach(function(_){var C={x:0,y:0};_.array.forEach(function(A){C.x+=A.x,C.y+=A.y}),C.x/=_.array.length,C.y/=_.array.length;var T={x:C.x-_.width/2,y:C.y-_.height/2},D={x:_.x-T.x+u/2-d/2,y:_.y-T.y+l/2-h/2};_.array.forEach(function(A){A.x+=D.x,A.y+=D.y})})}function b(k,_){var C=Number.POSITIVE_INFINITY,T=0;k.sort(function(G,X){return X.height-G.height}),v=k.reduce(function(G,X){return G.width<X.width?G.width:X.width});for(var D=q=v,A=N=S(k),R=0,M=Number.MAX_VALUE,L=Number.MAX_VALUE,B=-1,I=Number.MAX_VALUE,H=Number.MAX_VALUE;I>v||H>jt.FLOAT_EPSILON;){if(B!=1)var q=A-(A-D)/jt.GOLDEN_SECTION,M=x(k,q);if(B!=0)var N=D+(A-D)/jt.GOLDEN_SECTION,L=x(k,N);if(I=Math.abs(q-N),H=Math.abs(M-L),M<C&&(C=M,T=q),L<C&&(C=L,T=N),M>L?(D=q,q=N,M=L,B=1):(A=N,N=q,L=M,B=0),R++>100)break}x(k,T)}function x(k,_){g=[],d=0,h=0,y=s;for(var C=0;C<k.length;C++){var T=k[C];E(T,_)}return Math.abs(w()-c)}function E(k,_){for(var C=void 0,T=0;T<g.length;T++)if(g[T].space_left>=k.height&&g[T].x+g[T].width+k.width+jt.PADDING-_<=jt.FLOAT_EPSILON){C=g[T];break}g.push(k),C!==void 0?(k.x=C.x+C.width+jt.PADDING,k.y=C.bottom,k.space_left=k.height,k.bottom=k.y,C.space_left-=k.height+jt.PADDING,C.bottom+=k.height+jt.PADDING):(k.y=y,y+=k.height+jt.PADDING,k.x=o,k.bottom=k.y,k.space_left=k.height),k.y+k.height-h>-jt.FLOAT_EPSILON&&(h=k.y+k.height-s),k.x+k.width-d>-jt.FLOAT_EPSILON&&(d=k.x+k.width-o)}function S(k){var _=0;return k.forEach(function(C){return _+=C.width+jt.PADDING}),_}function w(){return d/h}}Eo.applyPacking=Ix;function Nx(r,e){for(var t={},n={},a=[],i=0,o=0;o<e.length;o++){var s=e[o],u=s.source,l=s.target;n[u.index]?n[u.index].push(l):n[u.index]=[l],n[l.index]?n[l.index].push(u):n[l.index]=[u]}for(var o=0;o<r.length;o++){var c=r[o];t[c.index]||f(c,!0)}function f(d,h){if(t[d.index]===void 0){h&&(i++,a.push({array:[]})),t[d.index]=i,a[i-1].array.push(d);var v=n[d.index];if(v)for(var y=0;y<v.length;y++)f(v[y],!1)}}return a}Eo.separateGraphs=Nx});var ra=ot(ja=>{"use strict";Object.defineProperty(ja,"__esModule",{value:!0});var zx=al(),bl=lo(),Co=co(),So=ta(),Hh=Za(),$h=yl(),Uh=ml(),Ja;(function(r){r[r.start=0]="start",r[r.tick=1]="tick",r[r.end=2]="end"})(Ja=ja.EventType||(ja.EventType={}));function ko(r){return typeof r.leaves<"u"||typeof r.groups<"u"}var Fx=(function(){function r(){var e=this;this._canvasSize=[1,1],this._linkDistance=20,this._defaultNodeSize=10,this._linkLengthCalculator=null,this._linkType=null,this._avoidOverlaps=!1,this._handleDisconnected=!0,this._running=!1,this._nodes=[],this._groups=[],this._rootGroup=null,this._links=[],this._constraints=[],this._distanceMatrix=null,this._descent=null,this._directedLinkConstraints=null,this._threshold=.01,this._visibilityGraph=null,this._groupCompactness=1e-6,this.event=null,this.linkAccessor={getSourceIndex:r.getSourceIndex,getTargetIndex:r.getTargetIndex,setLength:r.setLinkLength,getType:function(t){return typeof e._linkType=="function"?e._linkType(t):0}}}return r.prototype.on=function(e,t){return this.event||(this.event={}),typeof e=="string"?this.event[Ja[e]]=t:this.event[e]=t,this},r.prototype.trigger=function(e){this.event&&typeof this.event[e.type]<"u"&&this.event[e.type](e)},r.prototype.kick=function(){for(;!this.tick(););},r.prototype.tick=function(){if(this._alpha<this._threshold)return this._running=!1,this.trigger({type:Ja.end,alpha:this._alpha=0,stress:this._lastStress}),!0;var e=this._nodes.length,t=this._links.length,n,a;for(this._descent.locks.clear(),a=0;a<e;++a)if(n=this._nodes[a],n.fixed){(typeof n.px>"u"||typeof n.py>"u")&&(n.px=n.x,n.py=n.y);var i=[n.px,n.py];this._descent.locks.add(a,i)}var o=this._descent.rungeKutta();return o===0?this._alpha=0:typeof this._lastStress<"u"&&(this._alpha=o),this._lastStress=o,this.updateNodePositions(),this.trigger({type:Ja.tick,alpha:this._alpha,stress:this._lastStress}),!1},r.prototype.updateNodePositions=function(){for(var e=this._descent.x[0],t=this._descent.x[1],n,a=this._nodes.length;a--;)n=this._nodes[a],n.x=e[a],n.y=t[a]},r.prototype.nodes=function(e){if(!e){if(this._nodes.length===0&&this._links.length>0){var t=0;this._links.forEach(function(a){t=Math.max(t,a.source,a.target)}),this._nodes=new Array(++t);for(var n=0;n<t;++n)this._nodes[n]={}}return this._nodes}return this._nodes=e,this},r.prototype.groups=function(e){var t=this;return e?(this._groups=e,this._rootGroup={},this._groups.forEach(function(n){typeof n.padding>"u"&&(n.padding=1),typeof n.leaves<"u"&&n.leaves.forEach(function(a,i){typeof a=="number"&&((n.leaves[i]=t._nodes[a]).parent=n)}),typeof n.groups<"u"&&n.groups.forEach(function(a,i){typeof a=="number"&&((n.groups[i]=t._groups[a]).parent=n)})}),this._rootGroup.leaves=this._nodes.filter(function(n){return typeof n.parent>"u"}),this._rootGroup.groups=this._groups.filter(function(n){return typeof n.parent>"u"}),this):this._groups},r.prototype.powerGraphGroups=function(e){var t=zx.getGroups(this._nodes,this._links,this.linkAccessor,this._rootGroup);return this.groups(t.groups),e(t),this},r.prototype.avoidOverlaps=function(e){return arguments.length?(this._avoidOverlaps=e,this):this._avoidOverlaps},r.prototype.handleDisconnected=function(e){return arguments.length?(this._handleDisconnected=e,this):this._handleDisconnected},r.prototype.flowLayout=function(e,t){return arguments.length||(e="y"),this._directedLinkConstraints={axis:e,getMinSeparation:typeof t=="number"?function(){return t}:t},this},r.prototype.links=function(e){return arguments.length?(this._links=e,this):this._links},r.prototype.constraints=function(e){return arguments.length?(this._constraints=e,this):this._constraints},r.prototype.distanceMatrix=function(e){return arguments.length?(this._distanceMatrix=e,this):this._distanceMatrix},r.prototype.size=function(e){return e?(this._canvasSize=e,this):this._canvasSize},r.prototype.defaultNodeSize=function(e){return e?(this._defaultNodeSize=e,this):this._defaultNodeSize},r.prototype.groupCompactness=function(e){return e?(this._groupCompactness=e,this):this._groupCompactness},r.prototype.linkDistance=function(e){return e?(this._linkDistance=typeof e=="function"?e:+e,this._linkLengthCalculator=null,this):this._linkDistance},r.prototype.linkType=function(e){return this._linkType=e,this},r.prototype.convergenceThreshold=function(e){return e?(this._threshold=typeof e=="function"?e:+e,this):this._threshold},r.prototype.alpha=function(e){return arguments.length?(e=+e,this._alpha?e>0?this._alpha=e:this._alpha=0:e>0&&(this._running||(this._running=!0,this.trigger({type:Ja.start,alpha:this._alpha=e}),this.kick())),this):this._alpha},r.prototype.getLinkLength=function(e){return typeof this._linkDistance=="function"?+this._linkDistance(e):this._linkDistance},r.setLinkLength=function(e,t){e.length=t},r.prototype.getLinkType=function(e){return typeof this._linkType=="function"?this._linkType(e):0},r.prototype.symmetricDiffLinkLengths=function(e,t){var n=this;return t===void 0&&(t=1),this.linkDistance(function(a){return e*a.length}),this._linkLengthCalculator=function(){return bl.symmetricDiffLinkLengths(n._links,n.linkAccessor,t)},this},r.prototype.jaccardLinkLengths=function(e,t){var n=this;return t===void 0&&(t=1),this.linkDistance(function(a){return e*a.length}),this._linkLengthCalculator=function(){return bl.jaccardLinkLengths(n._links,n.linkAccessor,t)},this},r.prototype.start=function(e,t,n,a,i,o){var s=this;e===void 0&&(e=0),t===void 0&&(t=0),n===void 0&&(n=0),a===void 0&&(a=0),i===void 0&&(i=!0),o===void 0&&(o=!0);var u,l,c=this.nodes().length,f=c+2*this._groups.length,d=this._links.length,h=this._canvasSize[0],v=this._canvasSize[1],y=new Array(f),g=new Array(f),p=null,m=this._avoidOverlaps;this._nodes.forEach(function(C,T){C.index=T,typeof C.x>"u"&&(C.x=h/2,C.y=v/2),y[T]=C.x,g[T]=C.y}),this._linkLengthCalculator&&this._linkLengthCalculator();var b;this._distanceMatrix?b=this._distanceMatrix:(b=new Hh.Calculator(f,this._links,r.getSourceIndex,r.getTargetIndex,function(C){return s.getLinkLength(C)}).DistanceMatrix(),p=Co.Descent.createSquareMatrix(f,function(){return 2}),this._links.forEach(function(C){typeof C.source=="number"&&(C.source=s._nodes[C.source]),typeof C.target=="number"&&(C.target=s._nodes[C.target])}),this._links.forEach(function(C){var T=r.getSourceIndex(C),D=r.getTargetIndex(C);p[T][D]=p[D][T]=C.weight||1}));var x=Co.Descent.createSquareMatrix(f,function(C,T){return b[C][T]});if(this._rootGroup&&typeof this._rootGroup.groups<"u"){var u=c,E=function(T,D,A,R){p[T][D]=p[D][T]=A,x[T][D]=x[D][T]=R};this._groups.forEach(function(T){E(u,u+1,s._groupCompactness,.1),y[u]=0,g[u++]=0,y[u]=0,g[u++]=0})}else this._rootGroup={leaves:this._nodes,groups:[]};var S=this._constraints||[];this._directedLinkConstraints&&(this.linkAccessor.getMinSeparation=this._directedLinkConstraints.getMinSeparation,S=S.concat(bl.generateDirectedEdgeConstraints(c,this._links,this._directedLinkConstraints.axis,this.linkAccessor))),this.avoidOverlaps(!1),this._descent=new Co.Descent([y,g],x),this._descent.locks.clear();for(var u=0;u<c;++u){var w=this._nodes[u];if(w.fixed){w.px=w.x,w.py=w.y;var k=[w.x,w.y];this._descent.locks.add(u,k)}}if(this._descent.threshold=this._threshold,this.initialLayout(e,y,g),S.length>0&&(this._descent.project=new So.Projection(this._nodes,this._groups,this._rootGroup,S).projectFunctions()),this._descent.run(t),this.separateOverlappingComponents(h,v,o),this.avoidOverlaps(m),m&&(this._nodes.forEach(function(C,T){C.x=y[T],C.y=g[T]}),this._descent.project=new So.Projection(this._nodes,this._groups,this._rootGroup,S,!0).projectFunctions(),this._nodes.forEach(function(C,T){y[T]=C.x,g[T]=C.y})),this._descent.G=p,this._descent.run(n),a){this._descent.snapStrength=1e3,this._descent.snapGridSize=this._nodes[0].width,this._descent.numGridSnapNodes=c,this._descent.scaleSnapByMaxH=c!=f;var _=Co.Descent.createSquareMatrix(f,function(C,T){return C>=c||T>=c?p[C][T]:0});this._descent.G=_,this._descent.run(a)}return this.updateNodePositions(),this.separateOverlappingComponents(h,v,o),i?this.resume():this},r.prototype.initialLayout=function(e,t,n){if(this._groups.length>0&&e>0){var a=this._nodes.length,i=this._links.map(function(s){return{source:s.source.index,target:s.target.index}}),o=this._nodes.map(function(s){return{index:s.index}});this._groups.forEach(function(s,u){o.push({index:s.index=a+u})}),this._groups.forEach(function(s,u){typeof s.leaves<"u"&&s.leaves.forEach(function(l){return i.push({source:s.index,target:l.index})}),typeof s.groups<"u"&&s.groups.forEach(function(l){return i.push({source:s.index,target:l.index})})}),new r().size(this.size()).nodes(o).links(i).avoidOverlaps(!1).linkDistance(this.linkDistance()).symmetricDiffLinkLengths(5).convergenceThreshold(1e-4).start(e,0,0,0,!1),this._nodes.forEach(function(s){t[s.index]=o[s.index].x,n[s.index]=o[s.index].y})}else this._descent.run(e)},r.prototype.separateOverlappingComponents=function(e,t,n){var a=this;if(n===void 0&&(n=!0),!this._distanceMatrix&&this._handleDisconnected){var i=this._descent.x[0],o=this._descent.x[1];this._nodes.forEach(function(u,l){u.x=i[l],u.y=o[l]});var s=Uh.separateGraphs(this._nodes,this._links);Uh.applyPacking(s,e,t,this._defaultNodeSize,1,n),this._nodes.forEach(function(u,l){a._descent.x[0][l]=u.x,a._descent.x[1][l]=u.y,u.bounds&&(u.bounds.setXCentre(u.x),u.bounds.setYCentre(u.y))})}},r.prototype.resume=function(){return this.alpha(.1)},r.prototype.stop=function(){return this.alpha(0)},r.prototype.prepareEdgeRouting=function(e){e===void 0&&(e=0),this._visibilityGraph=new $h.TangentVisibilityGraph(this._nodes.map(function(t){return t.bounds.inflate(-e).vertices()}))},r.prototype.routeEdge=function(e,t,n){t===void 0&&(t=5);var a=[],i=new $h.TangentVisibilityGraph(this._visibilityGraph.P,{V:this._visibilityGraph.V,E:this._visibilityGraph.E}),o={x:e.source.x,y:e.source.y},s={x:e.target.x,y:e.target.y},u=i.addPoint(o,e.source.index),l=i.addPoint(s,e.target.index);i.addEdgeIfVisible(o,s,e.source.index,e.target.index),typeof n<"u"&&n(i);var c=function(x){return x.source.id},f=function(x){return x.target.id},d=function(x){return x.length()},h=new Hh.Calculator(i.V.length,i.E,c,f,d),v=h.PathFromNodeToNode(u.id,l.id);if(v.length===1||v.length===i.V.length){var y=So.makeEdgeBetween(e.source.innerBounds,e.target.innerBounds,t);a=[y.sourceIntersection,y.arrowStart]}else{for(var g=v.length-2,p=i.V[v[g]].p,m=i.V[v[0]].p,a=[e.source.innerBounds.rayIntersection(p.x,p.y)],b=g;b>=0;--b)a.push(i.V[v[b]].p);a.push(So.makeEdgeTo(m,e.target.innerBounds,t))}return a},r.getSourceIndex=function(e){return typeof e.source=="number"?e.source:e.source.index},r.getTargetIndex=function(e){return typeof e.target=="number"?e.target:e.target.index},r.linkId=function(e){return r.getSourceIndex(e)+"-"+r.getTargetIndex(e)},r.dragStart=function(e){ko(e)?r.storeOffset(e,r.dragOrigin(e)):(r.stopNode(e),e.fixed|=2)},r.stopNode=function(e){e.px=e.x,e.py=e.y},r.storeOffset=function(e,t){typeof e.leaves<"u"&&e.leaves.forEach(function(n){n.fixed|=2,r.stopNode(n),n._dragGroupOffsetX=n.x-t.x,n._dragGroupOffsetY=n.y-t.y}),typeof e.groups<"u"&&e.groups.forEach(function(n){return r.storeOffset(n,t)})},r.dragOrigin=function(e){return ko(e)?{x:e.bounds.cx(),y:e.bounds.cy()}:e},r.drag=function(e,t){ko(e)?(typeof e.leaves<"u"&&e.leaves.forEach(function(n){e.bounds.setXCentre(t.x),e.bounds.setYCentre(t.y),n.px=n._dragGroupOffsetX+t.x,n.py=n._dragGroupOffsetY+t.y}),typeof e.groups<"u"&&e.groups.forEach(function(n){return r.drag(n,t)})):(e.px=t.x,e.py=t.y)},r.dragEnd=function(e){ko(e)?(typeof e.leaves<"u"&&e.leaves.forEach(function(t){r.dragEnd(t),delete t._dragGroupOffsetX,delete t._dragGroupOffsetY}),typeof e.groups<"u"&&e.groups.forEach(r.dragEnd)):e.fixed&=-7},r.mouseOver=function(e){e.fixed|=4,e.px=e.x,e.py=e.y},r.mouseOut=function(e){e.fixed&=-5},r})();ja.Layout=Fx});var Xh=ot(na=>{"use strict";var Vx=na&&na.__extends||(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var i in a)a.hasOwnProperty(i)&&(n[i]=a[i])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})();Object.defineProperty(na,"__esModule",{value:!0});var xl=ra(),Wh=(function(r){Vx(e,r);function e(t){var n=r.call(this)||this,a=n,i=t;return i.trigger&&(n.trigger=i.trigger),i.kick&&(n.kick=i.kick),i.drag&&(n.drag=i.drag),i.on&&(n.on=i.on),n.dragstart=n.dragStart=xl.Layout.dragStart,n.dragend=n.dragEnd=xl.Layout.dragEnd,n}return e.prototype.trigger=function(t){},e.prototype.kick=function(){},e.prototype.drag=function(){},e.prototype.on=function(t,n){return this},e})(xl.Layout);na.LayoutAdaptor=Wh;function qx(r){return new Wh(r)}na.adaptor=qx});var Kh=ot(aa=>{"use strict";var Gx=aa&&aa.__extends||(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var i in a)a.hasOwnProperty(i)&&(n[i]=a[i])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})();Object.defineProperty(aa,"__esModule",{value:!0});var Ht=ra(),Yh=(function(r){Gx(e,r);function e(){var t=r.call(this)||this;t.event=d3.dispatch(Ht.EventType[Ht.EventType.start],Ht.EventType[Ht.EventType.tick],Ht.EventType[Ht.EventType.end]);var n=t,a;return t.drag=function(){if(!i)var i=d3.behavior.drag().origin(Ht.Layout.dragOrigin).on("dragstart.d3adaptor",Ht.Layout.dragStart).on("drag.d3adaptor",function(o){Ht.Layout.drag(o,d3.event),n.resume()}).on("dragend.d3adaptor",Ht.Layout.dragEnd);if(!arguments.length)return i;this.call(i)},t}return e.prototype.trigger=function(t){var n={type:Ht.EventType[t.type],alpha:t.alpha,stress:t.stress};this.event[n.type](n)},e.prototype.kick=function(){var t=this;d3.timer(function(){return r.prototype.tick.call(t)})},e.prototype.on=function(t,n){return typeof t=="string"?this.event.on(t,n):this.event.on(Ht.EventType[t],n),this},e})(Ht.Layout);aa.D3StyleLayoutAdaptor=Yh;function Hx(){return new Yh}aa.d3adaptor=Hx});var Zh=ot(ei=>{"use strict";var $x=ei&&ei.__extends||(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var i in a)a.hasOwnProperty(i)&&(n[i]=a[i])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})();Object.defineProperty(ei,"__esModule",{value:!0});var $t=ra(),Ux=(function(r){$x(e,r);function e(t){var n=r.call(this)||this;n.d3Context=t,n.event=t.dispatch($t.EventType[$t.EventType.start],$t.EventType[$t.EventType.tick],$t.EventType[$t.EventType.end]);var a=n,i;return n.drag=function(){if(!o)var o=t.drag().subject($t.Layout.dragOrigin).on("start.d3adaptor",$t.Layout.dragStart).on("drag.d3adaptor",function(s){$t.Layout.drag(s,t.event),a.resume()}).on("end.d3adaptor",$t.Layout.dragEnd);if(!arguments.length)return o;arguments[0].call(o)},n}return e.prototype.trigger=function(t){var n={type:$t.EventType[t.type],alpha:t.alpha,stress:t.stress};this.event.call(n.type,n)},e.prototype.kick=function(){var t=this,n=this.d3Context.timer(function(){return r.prototype.tick.call(t)&&n.stop()})},e.prototype.on=function(t,n){return typeof t=="string"?this.event.on(t,n):this.event.on($t.EventType[t],n),this},e})($t.Layout);ei.D3StyleLayoutAdaptor=Ux});var Qh=ot(wl=>{"use strict";Object.defineProperty(wl,"__esModule",{value:!0});var Wx=Kh(),Xx=Zh();function Yx(r){return!r||Kx(r)?new Wx.D3StyleLayoutAdaptor:new Xx.D3StyleLayoutAdaptor(r)}wl.d3adaptor=Yx;function Kx(r){var e=/^3\./;return r.version&&r.version.match(e)!==null}});var kl=ot(ia=>{"use strict";Object.defineProperty(ia,"__esModule",{value:!0});var Zx=ta(),El=ho(),Qx=Za(),Jh=(function(){function r(e,t,n){this.id=e,this.rect=t,this.children=n,this.leaf=typeof n>"u"||n.length===0}return r})();ia.NodeWrapper=Jh;var Cl=(function(){function r(e,t,n,a,i){a===void 0&&(a=null),i===void 0&&(i=null),this.id=e,this.x=t,this.y=n,this.node=a,this.line=i}return r})();ia.Vert=Cl;var Sl=(function(){function r(e,t){this.s=e,this.t=t;var n=r.findMatch(e,t),a=t.slice(0).reverse(),i=r.findMatch(e,a);n.length>=i.length?(this.length=n.length,this.si=n.si,this.ti=n.ti,this.reversed=!1):(this.length=i.length,this.si=i.si,this.ti=t.length-i.ti-i.length,this.reversed=!0)}return r.findMatch=function(e,t){for(var n=e.length,a=t.length,i={length:0,si:-1,ti:-1},o=new Array(n),s=0;s<n;s++){o[s]=new Array(a);for(var u=0;u<a;u++)if(e[s]===t[u]){var l=o[s][u]=s===0||u===0?1:o[s-1][u-1]+1;l>i.length&&(i.length=l,i.si=s-l+1,i.ti=u-l+1)}else o[s][u]=0}return i},r.prototype.getSequence=function(){return this.length>=0?this.s.slice(this.si,this.si+this.length):[]},r})();ia.LongestCommonSubsequence=Sl;var Jx=(function(){function r(e,t,n){var a=this;n===void 0&&(n=12),this.originalnodes=e,this.groupPadding=n,this.leaves=null,this.nodes=e.map(function(y,g){return new Jh(g,t.getBounds(y),t.getChildren(y))}),this.leaves=this.nodes.filter(function(y){return y.leaf}),this.groups=this.nodes.filter(function(y){return!y.leaf}),this.cols=this.getGridLines("x"),this.rows=this.getGridLines("y"),this.groups.forEach(function(y){return y.children.forEach(function(g){return a.nodes[g].parent=y})}),this.root={children:[]},this.nodes.forEach(function(y){typeof y.parent>"u"&&(y.parent=a.root,a.root.children.push(y.id)),y.ports=[]}),this.backToFront=this.nodes.slice(0),this.backToFront.sort(function(y,g){return a.getDepth(y)-a.getDepth(g)});var i=this.backToFront.slice(0).reverse().filter(function(y){return!y.leaf});i.forEach(function(y){var g=Zx.Rectangle.empty();y.children.forEach(function(p){return g=g.union(a.nodes[p].rect)}),y.rect=g.inflate(a.groupPadding)});var o=this.midPoints(this.cols.map(function(y){return y.pos})),s=this.midPoints(this.rows.map(function(y){return y.pos})),u=o[0],l=o[o.length-1],c=s[0],f=s[s.length-1],d=this.rows.map(function(y){return{x1:u,x2:l,y1:y.pos,y2:y.pos}}).concat(s.map(function(y){return{x1:u,x2:l,y1:y,y2:y}})),h=this.cols.map(function(y){return{x1:y.pos,x2:y.pos,y1:c,y2:f}}).concat(o.map(function(y){return{x1:y,x2:y,y1:c,y2:f}})),v=d.concat(h);v.forEach(function(y){return y.verts=[]}),this.verts=[],this.edges=[],d.forEach(function(y){return h.forEach(function(g){var p=new Cl(a.verts.length,g.x1,y.y1);y.verts.push(p),g.verts.push(p),a.verts.push(p);for(var m=a.backToFront.length;m-- >0;){var b=a.backToFront[m],x=b.rect,E=Math.abs(p.x-x.cx()),S=Math.abs(p.y-x.cy());if(E<x.width()/2&&S<x.height()/2){p.node=b;break}}})}),v.forEach(function(y,g){a.nodes.forEach(function(S,w){S.rect.lineIntersections(y.x1,y.y1,y.x2,y.y2).forEach(function(k,_){var C=new Cl(a.verts.length,k.x,k.y,S,y);a.verts.push(C),y.verts.push(C),S.ports.push(C)})});var p=Math.abs(y.y1-y.y2)<.1,m=function(S,w){return p?w.x-S.x:w.y-S.y};y.verts.sort(m);for(var b=1;b<y.verts.length;b++){var x=y.verts[b-1],E=y.verts[b];x.node&&x.node===E.node&&x.node.leaf||a.edges.push({source:x.id,target:E.id,length:Math.abs(m(x,E))})}})}return r.prototype.avg=function(e){return e.reduce(function(t,n){return t+n})/e.length},r.prototype.getGridLines=function(e){for(var t=[],n=this.leaves.slice(0,this.leaves.length);n.length>0;){var a=n.filter(function(o){return o.rect["overlap"+e.toUpperCase()](n[0].rect)}),i={nodes:a,pos:this.avg(a.map(function(o){return o.rect["c"+e]()}))};t.push(i),i.nodes.forEach(function(o){return n.splice(n.indexOf(o),1)})}return t.sort(function(o,s){return o.pos-s.pos}),t},r.prototype.getDepth=function(e){for(var t=0;e.parent!==this.root;)t++,e=e.parent;return t},r.prototype.midPoints=function(e){for(var t=e[1]-e[0],n=[e[0]-t/2],a=1;a<e.length;a++)n.push((e[a]+e[a-1])/2);return n.push(e[e.length-1]+t/2),n},r.prototype.findLineage=function(e){var t=[e];do e=e.parent,t.push(e);while(e!==this.root);return t.reverse()},r.prototype.findAncestorPathBetween=function(e,t){for(var n=this.findLineage(e),a=this.findLineage(t),i=0;n[i]===a[i];)i++;return{commonAncestor:n[i-1],lineages:n.slice(i).concat(a.slice(i))}},r.prototype.siblingObstacles=function(e,t){var n=this,a=this.findAncestorPathBetween(e,t),i={};a.lineages.forEach(function(s){return i[s.id]={}});var o=a.commonAncestor.children.filter(function(s){return!(s in i)});return a.lineages.filter(function(s){return s.parent!==a.commonAncestor}).forEach(function(s){return o=o.concat(s.parent.children.filter(function(u){return u!==s.id}))}),o.map(function(s){return n.nodes[s]})},r.getSegmentSets=function(e,t,n){for(var a=[],i=0;i<e.length;i++)for(var o=e[i],s=0;s<o.length;s++){var u=o[s];u.edgeid=i,u.i=s;var l=u[1][t]-u[0][t];Math.abs(l)<.1&&a.push(u)}a.sort(function(h,v){return h[0][t]-v[0][t]});for(var c=[],f=null,d=0;d<a.length;d++){var u=a[d];(!f||Math.abs(u[0][t]-f.pos)>.1)&&(f={pos:u[0][t],segments:[]},c.push(f)),f.segments.push(u)}return c},r.nudgeSegs=function(e,t,n,a,i,o){var s=a.length;if(!(s<=1)){for(var u=a.map(function(b){return new El.Variable(b[0][e])}),l=[],c=0;c<s;c++)for(var f=0;f<s;f++)if(c!==f){var d=a[c],h=a[f],v=d.edgeid,y=h.edgeid,g=-1,p=-1;e=="x"?i(v,y)&&(d[0][t]<d[1][t]?(g=f,p=c):(g=c,p=f)):i(v,y)&&(d[0][t]<d[1][t]?(g=c,p=f):(g=f,p=c)),g>=0&&l.push(new El.Constraint(u[g],u[p],o))}var m=new El.Solver(u,l);m.solve(),u.forEach(function(b,x){var E=a[x],S=b.position();E[0][e]=E[1][e]=S;var w=n[E.edgeid];E.i>0&&(w[E.i-1][1][e]=S),E.i<w.length-1&&(w[E.i+1][0][e]=S)})}},r.nudgeSegments=function(e,t,n,a,i){for(var o=r.getSegmentSets(e,t,n),s=0;s<o.length;s++){for(var u=o[s],l=[],c=0;c<u.segments.length;c++){var f=u.segments[c];l.push({type:0,s:f,pos:Math.min(f[0][n],f[1][n])}),l.push({type:1,s:f,pos:Math.max(f[0][n],f[1][n])})}l.sort(function(v,y){return v.pos-y.pos+v.type-y.type});var d=[],h=0;l.forEach(function(v){v.type===0?(d.push(v.s),h++):h--,h==0&&(r.nudgeSegs(t,n,e,d,a,i),d=[])})}},r.prototype.routeEdges=function(e,t,n,a){var i=this,o=e.map(function(l){return i.route(n(l),a(l))}),s=r.orderEdges(o),u=o.map(function(l){return r.makeSegments(l)});return r.nudgeSegments(u,"x","y",s,t),r.nudgeSegments(u,"y","x",s,t),r.unreverseEdges(u,o),u},r.unreverseEdges=function(e,t){e.forEach(function(n,a){var i=t[a];i.reversed&&(n.reverse(),n.forEach(function(o){o.reverse()}))})},r.angleBetween2Lines=function(e,t){var n=Math.atan2(e[0].y-e[1].y,e[0].x-e[1].x),a=Math.atan2(t[0].y-t[1].y,t[0].x-t[1].x),i=n-a;return(i>Math.PI||i<-Math.PI)&&(i=a-n),i},r.isLeft=function(e,t,n){return(t.x-e.x)*(n.y-e.y)-(t.y-e.y)*(n.x-e.x)<=0},r.getOrder=function(e){for(var t={},n=0;n<e.length;n++){var a=e[n];typeof t[a.l]>"u"&&(t[a.l]={}),t[a.l][a.r]=!0}return function(i,o){return typeof t[i]<"u"&&t[i][o]}},r.orderEdges=function(e){for(var t=[],n=0;n<e.length-1;n++)for(var a=n+1;a<e.length;a++){var i=e[n],o=e[a],s=new Sl(i,o),u,l,c;if(s.length!==0){if(s.reversed&&(o.reverse(),o.reversed=!0,s=new Sl(i,o)),(s.si<=0||s.ti<=0)&&(s.si+s.length>=i.length||s.ti+s.length>=o.length)){t.push({l:n,r:a});continue}s.si+s.length>=i.length||s.ti+s.length>=o.length?(u=i[s.si+1],c=i[s.si-1],l=o[s.ti-1]):(u=i[s.si+s.length-2],l=i[s.si+s.length],c=o[s.ti+s.length]),r.isLeft(u,l,c)?t.push({l:a,r:n}):t.push({l:n,r:a})}}return r.getOrder(t)},r.makeSegments=function(e){function t(l){return{x:l.x,y:l.y}}for(var n=function(l,c,f){return Math.abs((c.x-l.x)*(f.y-l.y)-(c.y-l.y)*(f.x-l.x))<.001},a=[],i=t(e[0]),o=1;o<e.length;o++){var s=t(e[o]),u=o<e.length-1?e[o+1]:null;(!u||!n(i,s,u))&&(a.push([i,s]),i=s)}return a},r.prototype.route=function(e,t){var n=this,a=this.nodes[e],i=this.nodes[t];this.obstacles=this.siblingObstacles(a,i);var o={};this.obstacles.forEach(function(p){return o[p.id]=p}),this.passableEdges=this.edges.filter(function(p){var m=n.verts[p.source],b=n.verts[p.target];return!(m.node&&m.node.id in o||b.node&&b.node.id in o)});for(var s=1;s<a.ports.length;s++){var u=a.ports[0].id,l=a.ports[s].id;this.passableEdges.push({source:u,target:l,length:0})}for(var s=1;s<i.ports.length;s++){var u=i.ports[0].id,l=i.ports[s].id;this.passableEdges.push({source:u,target:l,length:0})}var c=function(p){return p.source},f=function(p){return p.target},d=function(p){return p.length},h=new Qx.Calculator(this.verts.length,this.passableEdges,c,f,d),v=function(p,m,b){var x=n.verts[p],E=n.verts[m],S=n.verts[b],w=Math.abs(S.x-x.x),k=Math.abs(S.y-x.y);return x.node===a&&x.node===E.node||E.node===i&&E.node===S.node?0:w>1&&k>1?1e3:0},y=h.PathFromNodeToNodeWithPrevCost(a.ports[0].id,i.ports[0].id,v),g=y.reverse().map(function(p){return n.verts[p]});return g.push(this.nodes[i.id].ports[0]),g.filter(function(p,m){return!(m<g.length-1&&g[m+1].node===a&&p.node===a||m>0&&p.node===i&&g[m-1].node===i)})},r.getRoutePath=function(e,t,n,a){var i={routepath:"M "+e[0][0].x+" "+e[0][0].y+" ",arrowpath:""};if(e.length>1)for(var o=0;o<e.length;o++){var s=e[o],u=s[1].x,l=s[1].y,c=u-s[0].x,f=l-s[0].y;if(o<e.length-1){Math.abs(c)>0?u-=c/Math.abs(c)*t:l-=f/Math.abs(f)*t,i.routepath+="L "+u+" "+l+" ";var d=e[o+1],h=d[0].x,v=d[0].y,y=d[1].x,g=d[1].y;c=y-h,f=g-v;var p=r.angleBetween2Lines(s,d)<0?1:0,m,b;Math.abs(c)>0?(m=h+c/Math.abs(c)*t,b=v):(m=h,b=v+f/Math.abs(f)*t);var x=Math.abs(m-u),E=Math.abs(b-l);i.routepath+="A "+x+" "+E+" 0 0 "+p+" "+m+" "+b+" "}else{var S=[u,l],w,k;Math.abs(c)>0?(u-=c/Math.abs(c)*a,w=[u,l+n],k=[u,l-n]):(l-=f/Math.abs(f)*a,w=[u+n,l],k=[u-n,l]),i.routepath+="L "+u+" "+l+" ",a>0&&(i.arrowpath="M "+S[0]+" "+S[1]+" L "+w[0]+" "+w[1]+" L "+k[0]+" "+k[1])}}else{var s=e[0],u=s[1].x,l=s[1].y,c=u-s[0].x,f=l-s[0].y,S=[u,l],w,k;Math.abs(c)>0?(u-=c/Math.abs(c)*a,w=[u,l+n],k=[u,l-n]):(l-=f/Math.abs(f)*a,w=[u+n,l],k=[u-n,l]),i.routepath+="L "+u+" "+l+" ",a>0&&(i.arrowpath="M "+S[0]+" "+S[1]+" L "+w[0]+" "+w[1]+" L "+k[0]+" "+k[1])}return i},r})();ia.GridRouter=Jx});var jh=ot(ti=>{"use strict";Object.defineProperty(ti,"__esModule",{value:!0});var jx=Za(),Tl=co(),ew=ta(),tw=lo(),rw=(function(){function r(e,t){this.source=e,this.target=t}return r.prototype.actualLength=function(e){var t=this;return Math.sqrt(e.reduce(function(n,a){var i=a[t.target]-a[t.source];return n+i*i},0))},r})();ti.Link3D=rw;var nw=(function(){function r(e,t,n){e===void 0&&(e=0),t===void 0&&(t=0),n===void 0&&(n=0),this.x=e,this.y=t,this.z=n}return r})();ti.Node3D=nw;var aw=(function(){function r(e,t,n){var a=this;n===void 0&&(n=1),this.nodes=e,this.links=t,this.idealLinkLength=n,this.constraints=null,this.useJaccardLinkLengths=!0,this.result=new Array(r.k);for(var i=0;i<r.k;++i)this.result[i]=new Array(e.length);e.forEach(function(o,s){for(var u=0,l=r.dims;u<l.length;u++){var c=l[u];typeof o[c]>"u"&&(o[c]=Math.random())}a.result[0][s]=o.x,a.result[1][s]=o.y,a.result[2][s]=o.z})}return r.prototype.linkLength=function(e){return e.actualLength(this.result)},r.prototype.start=function(e){var t=this;e===void 0&&(e=100);var n=this.nodes.length,a=new iw;this.useJaccardLinkLengths&&tw.jaccardLinkLengths(this.links,a,1.5),this.links.forEach(function(c){return c.length*=t.idealLinkLength});var i=new jx.Calculator(n,this.links,function(c){return c.source},function(c){return c.target},function(c){return c.length}).DistanceMatrix(),o=Tl.Descent.createSquareMatrix(n,function(c,f){return i[c][f]}),s=Tl.Descent.createSquareMatrix(n,function(){return 2});this.links.forEach(function(c){var f=c.source,d=c.target;return s[f][d]=s[d][f]=1}),this.descent=new Tl.Descent(this.result,o),this.descent.threshold=.001,this.descent.G=s,this.constraints&&(this.descent.project=new ew.Projection(this.nodes,null,null,this.constraints).projectFunctions());for(var u=0;u<this.nodes.length;u++){var l=this.nodes[u];l.fixed&&this.descent.locks.add(u,[l.x,l.y,l.z])}return this.descent.run(e),this},r.prototype.tick=function(){this.descent.locks.clear();for(var e=0;e<this.nodes.length;e++){var t=this.nodes[e];t.fixed&&this.descent.locks.add(e,[t.x,t.y,t.z])}return this.descent.rungeKutta()},r.dims=["x","y","z"],r.k=r.dims.length,r})();ti.Layout3D=aw;var iw=(function(){function r(){}return r.prototype.getSourceIndex=function(e){return e.source},r.prototype.getTargetIndex=function(e){return e.target},r.prototype.getLength=function(e){return e.length},r.prototype.setLength=function(e,t){e.length=t},r})()});var ep=ot(To=>{"use strict";Object.defineProperty(To,"__esModule",{value:!0});var _l=ra(),ow=kl();function sw(r,e,t,n){r.cola.start(0,0,0,10,!1);var a=uw(r.cola.nodes(),r.cola.groups(),t,n);return a.routeEdges(r.powerGraph.powerEdges,e,function(i){return i.source.routerNode.id},function(i){return i.target.routerNode.id})}To.gridify=sw;function uw(r,e,t,n){r.forEach(function(i){i.routerNode={name:i.name,bounds:i.bounds.inflate(-t)}}),e.forEach(function(i){i.routerNode={bounds:i.bounds.inflate(-n),children:(typeof i.groups<"u"?i.groups.map(function(o){return r.length+o.id}):[]).concat(typeof i.leaves<"u"?i.leaves.map(function(o){return o.index}):[])}});var a=r.concat(e).map(function(i,o){return i.routerNode.id=o,i.routerNode});return new ow.GridRouter(a,{getChildren:function(i){return i.children},getBounds:function(i){return i.bounds}},t-n)}function lw(r,e,t){var n;r.nodes.forEach(function(s,u){return s.index=u}),new _l.Layout().avoidOverlaps(!1).nodes(r.nodes).links(r.links).powerGraphGroups(function(s){n=s,n.groups.forEach(function(u){return u.padding=t})});var a=r.nodes.length,i=[],o=r.nodes.slice(0);return o.forEach(function(s,u){return s.index=u}),n.groups.forEach(function(s){var u=s.index=s.id+a;o.push(s),typeof s.leaves<"u"&&s.leaves.forEach(function(l){return i.push({source:u,target:l.index})}),typeof s.groups<"u"&&s.groups.forEach(function(l){return i.push({source:u,target:l.id+a})})}),n.powerEdges.forEach(function(s){i.push({source:s.source.index,target:s.target.index})}),new _l.Layout().size(e).nodes(o).links(i).avoidOverlaps(!1).linkDistance(30).symmetricDiffLinkLengths(5).convergenceThreshold(1e-4).start(100,0,0,0,!1),{cola:new _l.Layout().convergenceThreshold(.001).size(e).avoidOverlaps(!0).nodes(r.nodes).links(r.links).groupCompactness(1e-4).linkDistance(30).symmetricDiffLinkLengths(5).powerGraphGroups(function(s){n=s,n.groups.forEach(function(u){u.padding=t})}).start(50,0,100,0,!1),powerGraph:n}}To.powerGraphGridLayout=lw});var Pl=ot(_o=>{"use strict";function Dt(r){for(var e in r)_o.hasOwnProperty(e)||(_o[e]=r[e])}Object.defineProperty(_o,"__esModule",{value:!0});Dt(Xh());Dt(Qh());Dt(co());Dt(yl());Dt(kl());Dt(ml());Dt(ra());Dt(jh());Dt(lo());Dt(al());Dt(dl());Dt(ul());Dt(ta());Dt(Za());Dt(ho());Dt(ep())});var tp=ot((ri,Dl)=>{"use strict";(function(e,t){typeof ri=="object"&&typeof Dl=="object"?Dl.exports=t(Pl()):typeof define=="function"&&define.amd?define(["webcola"],t):typeof ri=="object"?ri.cytoscapeCola=t(Pl()):e.cytoscapeCola=t(e.webcola)})(ri,function(r){return(function(e){var t={};function n(a){if(t[a])return t[a].exports;var i=t[a]={i:a,l:!1,exports:{}};return e[a].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.i=function(a){return a},n.d=function(a,i,o){n.o(a,i)||Object.defineProperty(a,i,{configurable:!1,enumerable:!0,get:o})},n.n=function(a){var i=a&&a.__esModule?function(){return a.default}:function(){return a};return n.d(i,"a",i),i},n.o=function(a,i){return Object.prototype.hasOwnProperty.call(a,i)},n.p="",n(n.s=3)})([(function(e,t,n){"use strict";var a=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(g){return typeof g}:function(g){return g&&typeof Symbol=="function"&&g.constructor===Symbol&&g!==Symbol.prototype?"symbol":typeof g},i=n(1),o=n(2),s=n(5)||(typeof window<"u"?window.cola:null),u=n(4),l=function(p){return(typeof p>"u"?"undefined":a(p))===a("")},c=function(p){return(typeof p>"u"?"undefined":a(p))===a(0)},f=function(p){return p!=null&&(typeof p>"u"?"undefined":a(p))===a({})},d=function(p){return p!=null&&(typeof p>"u"?"undefined":a(p))===a(function(){})},h=function(){},v=function(p,m){if(d(p)){var b=p;return b.apply(m,[m])}else return p};function y(g){this.options=i({},o,g)}y.prototype.run=function(){var g=this,p=this.options;g.manuallyStopped=!1;var m=p.cy,b=p.eles,x=b.nodes(),E=b.edges(),S=!1,w=function(O){return O.isParent()},k=x.filter(w),_=x.subtract(k),C=p.boundingBox||{x1:0,y1:0,w:m.width(),h:m.height()};C.x2===void 0&&(C.x2=C.x1+C.w),C.w===void 0&&(C.w=C.x2-C.x1),C.y2===void 0&&(C.y2=C.y1+C.h),C.h===void 0&&(C.h=C.y2-C.y1);var T=function(){for(var O=0;O<x.length;O++){var z=x[O],V=z.layoutDimensions(p),W=z.scratch("cola");if(!W.updatedDims){var re=v(p.nodeSpacing,z);W.width=V.w+2*re,W.height=V.h+2*re}}x.positions(function(se){var Ce=se.scratch().cola,pe=void 0;return!se.grabbed()&&_.contains(se)&&(pe={x:C.x1+Ce.x,y:C.y1+Ce.y},(!c(pe.x)||!c(pe.y))&&(pe=void 0)),pe}),x.updateCompoundBounds(),S||(A(),S=!0),p.fit&&m.fit(p.padding)},D=function(){p.ungrabifyWhileSimulating&&L.grabify(),m.off("destroy",B),x.off("grab free position",I),x.off("lock unlock",H),g.one("layoutstop",p.stop),g.trigger({type:"layoutstop",layout:g})},A=function(){g.one("layoutready",p.ready),g.trigger({type:"layoutready",layout:g})},R=p.refresh;p.refresh<0?R=1:R=Math.max(1,R);var M=g.adaptor=s.adaptor({trigger:function(O){var z=s.EventType?s.EventType.tick:null,V=s.EventType?s.EventType.end:null;switch(O.type){case"tick":case z:p.animate&&T();break;case"end":case V:T(),p.infinite||D();break}},kick:function(){var O=!0,z=function(){if(g.manuallyStopped)return D(),!0;var se=M.tick();return!p.infinite&&!O&&M.convergenceThreshold(p.convergenceThreshold),O=!1,se&&p.infinite&&M.resume(),se},V=function(){for(var se=void 0,Ce=0;Ce<R&&!se;Ce++)se=se||z();return se};if(p.animate){var W=function re(){V()||u(re)};u(W)}else for(;!z(););},on:h,drag:h});g.adaptor=M;var L=x.filter(":grabbable");p.ungrabifyWhileSimulating&&L.ungrabify();var B=void 0;m.one("destroy",B=function(){g.stop()});var I=void 0;x.on("grab free position",I=function(O){var z=this,V=z.scratch().cola,W=z.position(),re=O.cyTarget===z||O.target===z;if(re)switch(O.type){case"grab":M.dragstart(V);break;case"free":M.dragend(V);break;case"position":(V.px!==W.x-C.x1||V.py!==W.y-C.y1)&&(V.px=W.x-C.x1,V.py=W.y-C.y1);break}});var H=void 0;x.on("lock unlock",H=function(){var O=this,z=O.scratch().cola;z.fixed=O.locked(),O.locked()?M.dragstart(z):M.dragend(z)}),M.nodes(_.map(function($,O){var z=v(p.nodeSpacing,$),V=$.position(),W=$.layoutDimensions(p),re=$.scratch().cola={x:p.randomize&&!$.locked()||V.x===void 0?Math.round(Math.random()*C.w):V.x,y:p.randomize&&!$.locked()||V.y===void 0?Math.round(Math.random()*C.h):V.y,width:W.w+2*z,height:W.h+2*z,index:O,fixed:$.locked()};return re}));var q=[];if(p.alignment){if(p.alignment.vertical){var N=p.alignment.vertical;N.forEach(function($){var O=[];$.forEach(function(z){var V=z.node,W=V.scratch().cola,re=W.index;O.push({node:re,offset:z.offset?z.offset:0})}),q.push({type:"alignment",axis:"x",offsets:O})})}if(p.alignment.horizontal){var G=p.alignment.horizontal;G.forEach(function($){var O=[];$.forEach(function(z){var V=z.node,W=V.scratch().cola,re=W.index;O.push({node:re,offset:z.offset?z.offset:0})}),q.push({type:"alignment",axis:"y",offsets:O})})}}p.gapInequalities&&p.gapInequalities.forEach(function($){var O=$.left.scratch().cola.index,z=$.right.scratch().cola.index;q.push({axis:$.axis,left:O,right:z,gap:$.gap,equality:$.equality})}),q.length>0&&M.constraints(q),M.groups(k.map(function($,O){var z=v(p.nodeSpacing,$),V=function(ye){return parseFloat($.style("padding-"+ye))},W=V("left")+z,re=V("right")+z,se=V("top")+z,Ce=V("bottom")+z;return $.scratch().cola={index:O,padding:Math.max(W,re,se,Ce),leaves:$.children().intersection(_).map(function(pe){return pe[0].scratch().cola.index}),fixed:$.locked()},$}).map(function($){return $.scratch().cola.groups=$.children().intersection(k).map(function(O){return O.scratch().cola.index}),$.scratch().cola}));var X=void 0,j=void 0;p.edgeLength!=null?(X=p.edgeLength,j="linkDistance"):p.edgeSymDiffLength!=null?(X=p.edgeSymDiffLength,j="symmetricDiffLinkLengths"):p.edgeJaccardLength!=null?(X=p.edgeJaccardLength,j="jaccardLinkLengths"):(X=100,j="linkDistance");var Q=function(O){return O.calcLength};if(M.links(E.stdFilter(function($){return _.contains($.source())&&_.contains($.target())}).map(function($){var O=$.scratch().cola={source:$.source()[0].scratch().cola.index,target:$.target()[0].scratch().cola.index};return X!=null&&(O.calcLength=v(X,$)),O})),M.size([C.w,C.h]),X!=null&&M[j](Q),p.flow){var Z=void 0,te="y",ne=50;l(p.flow)?Z={axis:p.flow,minSeparation:ne}:c(p.flow)?Z={axis:te,minSeparation:p.flow}:f(p.flow)?(Z=p.flow,Z.axis=Z.axis||te,Z.minSeparation=Z.minSeparation!=null?Z.minSeparation:ne):Z={axis:te,minSeparation:ne},M.flowLayout(Z.axis,Z.minSeparation)}return g.trigger({type:"layoutstart",layout:g}),M.avoidOverlaps(p.avoidOverlap).handleDisconnected(p.handleDisconnected).start(p.unconstrIter,p.userConstIter,p.allConstIter,void 0,void 0,p.centerGraph),p.infinite||setTimeout(function(){g.manuallyStopped||M.stop()},p.maxSimulationTime),this},y.prototype.stop=function(){return this.adaptor&&(this.manuallyStopped=!0,this.adaptor.stop()),this},e.exports=y}),(function(e,t,n){"use strict";e.exports=Object.assign!=null?Object.assign.bind(Object):function(a){for(var i=arguments.length,o=Array(i>1?i-1:0),s=1;s<i;s++)o[s-1]=arguments[s];return o.filter(function(u){return u!=null}).forEach(function(u){Object.keys(u).forEach(function(l){return a[l]=u[l]})}),a}}),(function(e,t,n){"use strict";var a={animate:!0,refresh:1,maxSimulationTime:4e3,ungrabifyWhileSimulating:!1,fit:!0,padding:30,boundingBox:void 0,nodeDimensionsIncludeLabels:!1,ready:function(){},stop:function(){},randomize:!1,avoidOverlap:!0,handleDisconnected:!0,convergenceThreshold:.01,nodeSpacing:function(o){return 10},flow:void 0,alignment:void 0,gapInequalities:void 0,centerGraph:!0,edgeLength:void 0,edgeSymDiffLength:void 0,edgeJaccardLength:void 0,unconstrIter:void 0,userConstIter:void 0,allConstIter:void 0,infinite:!1};e.exports=a}),(function(e,t,n){"use strict";var a=n(0),i=function(s){s&&s("layout","cola",a)};typeof cytoscape<"u"&&i(cytoscape),e.exports=i}),(function(e,t,n){"use strict";var a=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(o){return typeof o}:function(o){return o&&typeof Symbol=="function"&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},i=void 0;(typeof window>"u"?"undefined":a(window))!=="undefined"?i=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.msRequestAnimationFrame||function(o){return setTimeout(o,16)}:i=function(s){s()},e.exports=i}),(function(e,t){e.exports=r})])})});function du(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,n=Array(e);t<e;t++)n[t]=r[t];return n}function Cp(r){if(Array.isArray(r))return r}function Sp(r){if(Array.isArray(r))return du(r)}function tn(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function kp(r,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(r,Sd(n.key),n)}}function rn(r,e,t){return e&&kp(r.prototype,e),Object.defineProperty(r,"prototype",{writable:!1}),r}function Vt(r,e){var t=typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(!t){if(Array.isArray(r)||(t=Ru(r))||e){t&&(r=t);var n=0,a=function(){};return{s:a,n:function(){return n>=r.length?{done:!0}:{done:!1,value:r[n++]}},e:function(u){throw u},f:a}}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 u=t.next();return o=u.done,u},e:function(u){s=!0,i=u},f:function(){try{o||t.return==null||t.return()}finally{if(s)throw i}}}}function Cd(r,e,t){return(e=Sd(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Tp(r){if(typeof Symbol<"u"&&r[Symbol.iterator]!=null||r["@@iterator"]!=null)return Array.from(r)}function _p(r,e){var t=r==null?null:typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(t!=null){var n,a,i,o,s=[],u=!0,l=!1;try{if(i=(t=t.call(r)).next,e===0){if(Object(t)!==t)return;u=!1}else for(;!(u=(n=i.call(t)).done)&&(s.push(n.value),s.length!==e);u=!0);}catch(c){l=!0,a=c}finally{try{if(!u&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(l)throw a}}return s}}function Pp(){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 Dp(){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 ut(r,e){return Cp(r)||_p(r,e)||Ru(r,e)||Pp()}function Mi(r){return Sp(r)||Tp(r)||Ru(r)||Dp()}function Ap(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(r)}function Sd(r){var e=Ap(r,"string");return typeof e=="symbol"?e:e+""}function dt(r){"@babel/helpers - typeof";return dt=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},dt(r)}function Ru(r,e){if(r){if(typeof r=="string")return du(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)?du(r,e):void 0}}var ct=typeof window>"u"?null:window,Yl=ct?ct.navigator:null;ct&&ct.document;var Mp=dt(""),kd=dt({}),Rp=dt(function(){}),Bp=typeof HTMLElement>"u"?"undefined":dt(HTMLElement),La=function(e){return e&&e.instanceString&&je(e.instanceString)?e.instanceString():null},he=function(e){return e!=null&&dt(e)==Mp},je=function(e){return e!=null&&dt(e)===Rp},We=function(e){return!qt(e)&&(Array.isArray?Array.isArray(e):e!=null&&e instanceof Array)},Ne=function(e){return e!=null&&dt(e)===kd&&!We(e)&&e.constructor===Object},Lp=function(e){return e!=null&&dt(e)===kd},ae=function(e){return e!=null&&dt(e)===dt(1)&&!isNaN(e)},Op=function(e){return ae(e)&&Math.floor(e)===e},Ri=function(e){if(Bp!=="undefined")return e!=null&&e instanceof HTMLElement},qt=function(e){return Oa(e)||Td(e)},Oa=function(e){return La(e)==="collection"&&e._private.single},Td=function(e){return La(e)==="collection"&&!e._private.single},Bu=function(e){return La(e)==="core"},_d=function(e){return La(e)==="stylesheet"},Ip=function(e){return La(e)==="event"},Kr=function(e){return e==null?!0:!!(e===""||e.match(/^\s+$/))},Np=function(e){return typeof HTMLElement>"u"?!1:e instanceof HTMLElement},zp=function(e){return Ne(e)&&ae(e.x1)&&ae(e.x2)&&ae(e.y1)&&ae(e.y2)},Fp=function(e){return Lp(e)&&je(e.then)},Vp=function(){return Yl&&Yl.userAgent.match(/msie|trident|edge/i)},$n=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 n=function(){var i=this,o=arguments,s,u=t.apply(i,o),l=n.cache;return(s=l[u])||(s=l[u]=e.apply(i,o)),s};return n.cache={},n},Lu=$n(function(r){return r.replace(/([A-Z])/g,function(e){return"-"+e.toLowerCase()})}),Ui=$n(function(r){return r.replace(/(-\w)/g,function(e){return e[1].toUpperCase()})}),Pd=$n(function(r,e){return r+e[0].toUpperCase()+e.substring(1)},function(r,e){return r+"$"+e}),Kl=function(e){return Kr(e)?e:e.charAt(0).toUpperCase()+e.substring(1)},$r=function(e,t){return e.slice(-1*t.length)===t},ft="(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))",qp="rgb[a]?\\(("+ft+"[%]?)\\s*,\\s*("+ft+"[%]?)\\s*,\\s*("+ft+"[%]?)(?:\\s*,\\s*("+ft+"))?\\)",Gp="rgb[a]?\\((?:"+ft+"[%]?)\\s*,\\s*(?:"+ft+"[%]?)\\s*,\\s*(?:"+ft+"[%]?)(?:\\s*,\\s*(?:"+ft+"))?\\)",Hp="hsl[a]?\\(("+ft+")\\s*,\\s*("+ft+"[%])\\s*,\\s*("+ft+"[%])(?:\\s*,\\s*("+ft+"))?\\)",$p="hsl[a]?\\((?:"+ft+")\\s*,\\s*(?:"+ft+"[%])\\s*,\\s*(?:"+ft+"[%])(?:\\s*,\\s*(?:"+ft+"))?\\)",Up="\\#[0-9a-fA-F]{3}",Wp="\\#[0-9a-fA-F]{6}",Dd=function(e,t){return e<t?-1:e>t?1:0},Xp=function(e,t){return-1*Dd(e,t)},be=Object.assign!=null?Object.assign.bind(Object):function(r){for(var e=arguments,t=1;t<e.length;t++){var n=e[t];if(n!=null)for(var a=Object.keys(n),i=0;i<a.length;i++){var o=a[i];r[o]=n[o]}}return r},Yp=function(e){if(!(!(e.length===4||e.length===7)||e[0]!=="#")){var t=e.length===4,n,a,i,o=16;return t?(n=parseInt(e[1]+e[1],o),a=parseInt(e[2]+e[2],o),i=parseInt(e[3]+e[3],o)):(n=parseInt(e[1]+e[2],o),a=parseInt(e[3]+e[4],o),i=parseInt(e[5]+e[6],o)),[n,a,i]}},Kp=function(e){var t,n,a,i,o,s,u,l;function c(v,y,g){return g<0&&(g+=1),g>1&&(g-=1),g<1/6?v+(y-v)*6*g:g<1/2?y:g<2/3?v+(y-v)*(2/3-g)*6:v}var f=new RegExp("^"+Hp+"$").exec(e);if(f){if(n=parseInt(f[1]),n<0?n=(360- -1*n%360)%360:n>360&&(n=n%360),n/=360,a=parseFloat(f[2]),a<0||a>100||(a=a/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(a===0)s=u=l=Math.round(i*255);else{var d=i<.5?i*(1+a):i+a-i*a,h=2*i-d;s=Math.round(255*c(h,d,n+1/3)),u=Math.round(255*c(h,d,n)),l=Math.round(255*c(h,d,n-1/3))}t=[s,u,l,o]}return t},Zp=function(e){var t,n=new RegExp("^"+qp+"$").exec(e);if(n){t=[];for(var a=[],i=1;i<=3;i++){var o=n[i];if(o[o.length-1]==="%"&&(a[i]=!0),o=parseFloat(o),a[i]&&(o=o/100*255),o<0||o>255)return;t.push(Math.floor(o))}var s=a[1]||a[2]||a[3],u=a[1]&&a[2]&&a[3];if(s&&!u)return;var l=n[4];if(l!==void 0){if(l=parseFloat(l),l<0||l>1)return;t.push(l)}}return t},Qp=function(e){return Jp[e.toLowerCase()]},Ad=function(e){return(We(e)?e:null)||Qp(e)||Yp(e)||Zp(e)||Kp(e)},Jp={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]},Md=function(e){for(var t=e.map,n=e.keys,a=n.length,i=0;i<a;i++){var o=n[i];if(Ne(o))throw Error("Tried to set map with object key");i<n.length-1?(t[o]==null&&(t[o]={}),t=t[o]):t[o]=e.value}},Rd=function(e){for(var t=e.map,n=e.keys,a=n.length,i=0;i<a;i++){var o=n[i];if(Ne(o))throw Error("Tried to get map with object key");if(t=t[o],t==null)return t}return t},si=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ia(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Io,Zl;function Na(){if(Zl)return Io;Zl=1;function r(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}return Io=r,Io}var No,Ql;function jp(){if(Ql)return No;Ql=1;var r=typeof si=="object"&&si&&si.Object===Object&&si;return No=r,No}var zo,Jl;function Wi(){if(Jl)return zo;Jl=1;var r=jp(),e=typeof self=="object"&&self&&self.Object===Object&&self,t=r||e||Function("return this")();return zo=t,zo}var Fo,jl;function eg(){if(jl)return Fo;jl=1;var r=Wi(),e=function(){return r.Date.now()};return Fo=e,Fo}var Vo,ec;function tg(){if(ec)return Vo;ec=1;var r=/\s/;function e(t){for(var n=t.length;n--&&r.test(t.charAt(n)););return n}return Vo=e,Vo}var qo,tc;function rg(){if(tc)return qo;tc=1;var r=tg(),e=/^\s+/;function t(n){return n&&n.slice(0,r(n)+1).replace(e,"")}return qo=t,qo}var Go,rc;function Ou(){if(rc)return Go;rc=1;var r=Wi(),e=r.Symbol;return Go=e,Go}var Ho,nc;function ng(){if(nc)return Ho;nc=1;var r=Ou(),e=Object.prototype,t=e.hasOwnProperty,n=e.toString,a=r?r.toStringTag:void 0;function i(o){var s=t.call(o,a),u=o[a];try{o[a]=void 0;var l=!0}catch(f){}var c=n.call(o);return l&&(s?o[a]=u:delete o[a]),c}return Ho=i,Ho}var $o,ac;function ag(){if(ac)return $o;ac=1;var r=Object.prototype,e=r.toString;function t(n){return e.call(n)}return $o=t,$o}var Uo,ic;function Bd(){if(ic)return Uo;ic=1;var r=Ou(),e=ng(),t=ag(),n="[object Null]",a="[object Undefined]",i=r?r.toStringTag:void 0;function o(s){return s==null?s===void 0?a:n:i&&i in Object(s)?e(s):t(s)}return Uo=o,Uo}var Wo,oc;function ig(){if(oc)return Wo;oc=1;function r(e){return e!=null&&typeof e=="object"}return Wo=r,Wo}var Xo,sc;function za(){if(sc)return Xo;sc=1;var r=Bd(),e=ig(),t="[object Symbol]";function n(a){return typeof a=="symbol"||e(a)&&r(a)==t}return Xo=n,Xo}var Yo,uc;function og(){if(uc)return Yo;uc=1;var r=rg(),e=Na(),t=za(),n=NaN,a=/^[-+]0x[0-9a-f]+$/i,i=/^0b[01]+$/i,o=/^0o[0-7]+$/i,s=parseInt;function u(l){if(typeof l=="number")return l;if(t(l))return n;if(e(l)){var c=typeof l.valueOf=="function"?l.valueOf():l;l=e(c)?c+"":c}if(typeof l!="string")return l===0?l:+l;l=r(l);var f=i.test(l);return f||o.test(l)?s(l.slice(2),f?2:8):a.test(l)?n:+l}return Yo=u,Yo}var Ko,lc;function sg(){if(lc)return Ko;lc=1;var r=Na(),e=eg(),t=og(),n="Expected a function",a=Math.max,i=Math.min;function o(s,u,l){var c,f,d,h,v,y,g=0,p=!1,m=!1,b=!0;if(typeof s!="function")throw new TypeError(n);u=t(u)||0,r(l)&&(p=!!l.leading,m="maxWait"in l,d=m?a(t(l.maxWait)||0,u):d,b="trailing"in l?!!l.trailing:b);function x(A){var R=c,M=f;return c=f=void 0,g=A,h=s.apply(M,R),h}function E(A){return g=A,v=setTimeout(k,u),p?x(A):h}function S(A){var R=A-y,M=A-g,L=u-R;return m?i(L,d-M):L}function w(A){var R=A-y,M=A-g;return y===void 0||R>=u||R<0||m&&M>=d}function k(){var A=e();if(w(A))return _(A);v=setTimeout(k,S(A))}function _(A){return v=void 0,b&&c?x(A):(c=f=void 0,h)}function C(){v!==void 0&&clearTimeout(v),g=0,c=y=f=v=void 0}function T(){return v===void 0?h:_(e())}function D(){var A=e(),R=w(A);if(c=arguments,f=this,y=A,R){if(v===void 0)return E(y);if(m)return clearTimeout(v),v=setTimeout(k,u),x(y)}return v===void 0&&(v=setTimeout(k,u)),h}return D.cancel=C,D.flush=T,D}return Ko=o,Ko}var ug=sg(),Fa=Ia(ug),Zo=ct?ct.performance:null,Ld=Zo&&Zo.now?function(){return Zo.now()}:function(){return Date.now()},lg=(function(){if(ct){if(ct.requestAnimationFrame)return function(r){ct.requestAnimationFrame(r)};if(ct.mozRequestAnimationFrame)return function(r){ct.mozRequestAnimationFrame(r)};if(ct.webkitRequestAnimationFrame)return function(r){ct.webkitRequestAnimationFrame(r)};if(ct.msRequestAnimationFrame)return function(r){ct.msRequestAnimationFrame(r)}}return function(r){r&&setTimeout(function(){r(Ld())},1e3/60)}})(),Bi=function(e){return lg(e)},Dr=Ld,pn=9261,Od=65599,In=5381,Id=function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:pn,n=t,a;a=e.next(),!a.done;)n=n*Od+a.value|0;return n},Sa=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:pn;return t*Od+e|0},ka=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:In;return(t<<5)+t+e|0},cg=function(e,t){return e*2097152+t},qr=function(e){return e[0]*2097152+e[1]},ui=function(e,t){return[Sa(e[0],t[0]),ka(e[1],t[1])]},cc=function(e,t){var n={value:0,done:!1},a=0,i=e.length,o={next:function(){return a<i?n.value=e[a++]:n.done=!0,n}};return Id(o,t)},mn=function(e,t){var n={value:0,done:!1},a=0,i=e.length,o={next:function(){return a<i?n.value=e.charCodeAt(a++):n.done=!0,n}};return Id(o,t)},Nd=function(){return fg(arguments)},fg=function(e){for(var t,n=0;n<e.length;n++){var a=e[n];n===0?t=mn(a):t=mn(a,t)}return t};function dg(r,e,t,n,a){var i=a*Math.PI/180,o=Math.cos(i)*(r-t)-Math.sin(i)*(e-n)+t,s=Math.sin(i)*(r-t)+Math.cos(i)*(e-n)+n;return{x:o,y:s}}var vg=function(e,t,n,a,i,o){return{x:(e-n)*i+n,y:(t-a)*o+a}};function hg(r,e,t){if(t===0)return r;var n=(e.x1+e.x2)/2,a=(e.y1+e.y2)/2,i=e.w/e.h,o=1/i,s=dg(r.x,r.y,n,a,t),u=vg(s.x,s.y,n,a,i,o);return{x:u.x,y:u.y}}var fc=!0,pg=console.warn!=null,gg=console.trace!=null,Iu=Number.MAX_SAFE_INTEGER||9007199254740991,zd=function(){return!0},Li=function(){return!1},dc=function(){return 0},Nu=function(){},Qe=function(e){throw new Error(e)},Fd=function(e){if(e!==void 0)fc=!!e;else return fc},$e=function(e){Fd()&&(pg?console.warn(e):(console.log(e),gg&&console.trace()))},yg=function(e){return be({},e)},yr=function(e){return e==null?e:We(e)?e.slice():Ne(e)?yg(e):e},mg=function(e){return e.slice()},Vd=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},bg={},qd=function(){return bg},Et=function(e){var t=Object.keys(e);return function(n){for(var a={},i=0;i<t.length;i++){var o=t[i],s=n?.[o];a[o]=s===void 0?e[o]:s}return a}},Zr=function(e,t,n){for(var a=e.length-1;a>=0;a--)e[a]===t&&e.splice(a,1)},zu=function(e){e.splice(0,e.length)},xg=function(e,t){for(var n=0;n<t.length;n++){var a=t[n];e.push(a)}},zt=function(e,t,n){return n&&(t=Pd(n,t)),e[t]},_r=function(e,t,n,a){n&&(t=Pd(n,t)),e[t]=a},wg=(function(){function r(){tn(this,r),this._obj={}}return rn(r,[{key:"set",value:function(t,n){return this._obj[t]=n,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]}}])})(),Pr=typeof Map<"u"?Map:wg,Eg="undefined",Cg=(function(){function r(e){if(tn(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 n=0;n<t.length;n++)this.add(t[n])}}return rn(r,[{key:"instanceString",value:function(){return"set"}},{key:"add",value:function(t){var n=this._obj;n[t]!==1&&(n[t]=1,this.size++)}},{key:"delete",value:function(t){var n=this._obj;n[t]===1&&(n[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(n){return t.has(n)})}},{key:"forEach",value:function(t,n){return this.toArray().forEach(t,n)}}])})(),Xn=(typeof Set>"u"?"undefined":dt(Set))!==Eg?Set:Cg,Xi=function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(e===void 0||t===void 0||!Bu(e)){Qe("An element must have a core reference and parameters set");return}var a=t.group;if(a==null&&(t.data&&t.data.source!=null&&t.data.target!=null?a="edges":a="nodes"),a!=="nodes"&&a!=="edges"){Qe("An element must be of type `nodes` or `edges`; you specified `"+a+"`");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:a,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?a==="edges":!!t.pannable,active:!1,classes:new Xn,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(),u=e.zoom();i.position={x:(o.x-s.x)/u,y:(o.y-s.y)/u}}var l=[];We(t.classes)?l=t.classes:he(t.classes)&&(l=t.classes.split(/\s+/));for(var c=0,f=l.length;c<f;c++){var d=l[c];!d||d===""||i.classes.add(d)}this.createEmitter(),(n===void 0||n)&&this.restore();var h=t.style||t.css;h&&($e("Setting a `style` bypass at element creation should be done only when absolutely necessary. Try to use the stylesheet instead."),this.style(h))},vc=function(e){return e={bfs:e.bfs||!e.dfs,dfs:e.dfs||!e.bfs},function(n,a,i){var o;Ne(n)&&!qt(n)&&(o=n,n=o.roots||o.root,a=o.visit,i=o.directed),i=arguments.length===2&&!je(a)?a:i,a=je(a)?a:function(){};for(var s=this._private.cy,u=n=he(n)?this.filter(n):n,l=[],c=[],f={},d={},h={},v=0,y,g=this.byGroup(),p=g.nodes,m=g.edges,b=0;b<u.length;b++){var x=u[b],E=x.id();x.isNode()&&(l.unshift(x),e.bfs&&(h[E]=!0,c.push(x)),d[E]=0)}for(var S=function(){var A=e.bfs?l.shift():l.pop(),R=A.id();if(e.dfs){if(h[R])return 0;h[R]=!0,c.push(A)}var M=d[R],L=f[R],B=L!=null?L.source():null,I=L!=null?L.target():null,H=L==null?void 0:A.same(B)?I[0]:B[0],q;if(q=a(A,L,H,v++,M),q===!0)return y=A,1;if(q===!1)return 1;for(var N=A.connectedEdges().filter(function(Z){return(!i||Z.source().same(A))&&m.has(Z)}),G=0;G<N.length;G++){var X=N[G],j=X.connectedNodes().filter(function(Z){return!Z.same(A)&&p.has(Z)}),Q=j.id();j.length!==0&&!h[Q]&&(j=j[0],l.push(j),e.bfs&&(h[Q]=!0,c.push(j)),f[Q]=X,d[Q]=d[R]+1)}},w;l.length!==0&&(w=S(),!(w!==0&&w===1)););for(var k=s.collection(),_=0;_<c.length;_++){var C=c[_],T=f[C.id()];T!=null&&k.push(T),k.push(C)}return{path:s.collection(k),found:s.collection(y)}}},Ta={breadthFirstSearch:vc({bfs:!0}),depthFirstSearch:vc({dfs:!0})};Ta.bfs=Ta.breadthFirstSearch;Ta.dfs=Ta.depthFirstSearch;var xi={exports:{}},Sg=xi.exports,hc;function kg(){return hc||(hc=1,(function(r,e){(function(){var t,n,a,i,o,s,u,l,c,f,d,h,v,y,g;a=Math.floor,f=Math.min,n=function(p,m){return p<m?-1:p>m?1:0},c=function(p,m,b,x,E){var S;if(b==null&&(b=0),E==null&&(E=n),b<0)throw new Error("lo must be non-negative");for(x==null&&(x=p.length);b<x;)S=a((b+x)/2),E(m,p[S])<0?x=S:b=S+1;return[].splice.apply(p,[b,b-b].concat(m)),m},s=function(p,m,b){return b==null&&(b=n),p.push(m),y(p,0,p.length-1,b)},o=function(p,m){var b,x;return m==null&&(m=n),b=p.pop(),p.length?(x=p[0],p[0]=b,g(p,0,m)):x=b,x},l=function(p,m,b){var x;return b==null&&(b=n),x=p[0],p[0]=m,g(p,0,b),x},u=function(p,m,b){var x;return b==null&&(b=n),p.length&&b(p[0],m)<0&&(x=[p[0],m],m=x[0],p[0]=x[1],g(p,0,b)),m},i=function(p,m){var b,x,E,S,w,k;for(m==null&&(m=n),S=function(){k=[];for(var _=0,C=a(p.length/2);0<=C?_<C:_>C;0<=C?_++:_--)k.push(_);return k}.apply(this).reverse(),w=[],x=0,E=S.length;x<E;x++)b=S[x],w.push(g(p,b,m));return w},v=function(p,m,b){var x;if(b==null&&(b=n),x=p.indexOf(m),x!==-1)return y(p,0,x,b),g(p,x,b)},d=function(p,m,b){var x,E,S,w,k;if(b==null&&(b=n),E=p.slice(0,m),!E.length)return E;for(i(E,b),k=p.slice(m),S=0,w=k.length;S<w;S++)x=k[S],u(E,x,b);return E.sort(b).reverse()},h=function(p,m,b){var x,E,S,w,k,_,C,T,D;if(b==null&&(b=n),m*10<=p.length){if(S=p.slice(0,m).sort(b),!S.length)return S;for(E=S[S.length-1],C=p.slice(m),w=0,_=C.length;w<_;w++)x=C[w],b(x,E)<0&&(c(S,x,0,null,b),S.pop(),E=S[S.length-1]);return S}for(i(p,b),D=[],k=0,T=f(m,p.length);0<=T?k<T:k>T;0<=T?++k:--k)D.push(o(p,b));return D},y=function(p,m,b,x){var E,S,w;for(x==null&&(x=n),E=p[b];b>m;){if(w=b-1>>1,S=p[w],x(E,S)<0){p[b]=S,b=w;continue}break}return p[b]=E},g=function(p,m,b){var x,E,S,w,k;for(b==null&&(b=n),E=p.length,k=m,S=p[m],x=2*m+1;x<E;)w=x+1,w<E&&!(b(p[x],p[w])<0)&&(x=w),p[m]=p[x],m=x,x=2*m+1;return p[m]=S,y(p,k,m,b)},t=(function(){p.push=s,p.pop=o,p.replace=l,p.pushpop=u,p.heapify=i,p.updateItem=v,p.nlargest=d,p.nsmallest=h;function p(m){this.cmp=m??n,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 l(this.nodes,m,this.cmp)},p.prototype.pushpop=function(m){return u(this.nodes,m,this.cmp)},p.prototype.heapify=function(){return i(this.nodes,this.cmp)},p.prototype.updateItem=function(m){return v(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(Sg)})(xi)),xi.exports}var Qo,pc;function Tg(){return pc||(pc=1,Qo=kg()),Qo}var _g=Tg(),Va=Ia(_g),Pg=Et({root:null,weight:function(e){return 1},directed:!1}),Dg={dijkstra:function(e){if(!Ne(e)){var t=arguments;e={root:t[0],weight:t[1],directed:t[2]}}var n=Pg(e),a=n.root,i=n.weight,o=n.directed,s=this,u=i,l=he(a)?this.filter(a)[0]:a[0],c={},f={},d={},h=this.byGroup(),v=h.nodes,y=h.edges;y.unmergeBy(function(M){return M.isLoop()});for(var g=function(L){return c[L.id()]},p=function(L,B){c[L.id()]=B,m.updateItem(L)},m=new Va(function(M,L){return g(M)-g(L)}),b=0;b<v.length;b++){var x=v[b];c[x.id()]=x.same(l)?0:1/0,m.push(x)}for(var E=function(L,B){for(var I=(o?L.edgesTo(B):L.edgesWith(B)).intersect(y),H=1/0,q,N=0;N<I.length;N++){var G=I[N],X=u(G);(X<H||!q)&&(H=X,q=G)}return{edge:q,dist:H}};m.size()>0;){var S=m.pop(),w=g(S),k=S.id();if(d[k]=w,w!==1/0)for(var _=S.neighborhood().intersect(v),C=0;C<_.length;C++){var T=_[C],D=T.id(),A=E(S,T),R=w+A.dist;R<g(T)&&(p(T,R),f[D]={node:S,edge:A.edge})}}return{distanceTo:function(L){var B=he(L)?v.filter(L)[0]:L[0];return d[B.id()]},pathTo:function(L){var B=he(L)?v.filter(L)[0]:L[0],I=[],H=B,q=H.id();if(B.length>0)for(I.unshift(B);f[q];){var N=f[q];I.unshift(N.edge),I.unshift(N.node),H=N.node,q=H.id()}return s.spawn(I)}}}},Ag={kruskal:function(e){e=e||function(b){return 1};for(var t=this.byGroup(),n=t.nodes,a=t.edges,i=n.length,o=new Array(i),s=n,u=function(x){for(var E=0;E<o.length;E++){var S=o[E];if(S.has(x))return E}},l=0;l<i;l++)o[l]=this.spawn(n[l]);for(var c=a.sort(function(b,x){return e(b)-e(x)}),f=0;f<c.length;f++){var d=c[f],h=d.source()[0],v=d.target()[0],y=u(h),g=u(v),p=o[y],m=o[g];y!==g&&(s.merge(d),p.merge(m),o.splice(g,1))}return s}},Mg=Et({root:null,goal:null,weight:function(e){return 1},heuristic:function(e){return 0},directed:!1}),Rg={aStar:function(e){var t=this.cy(),n=Mg(e),a=n.root,i=n.goal,o=n.heuristic,s=n.directed,u=n.weight;a=t.collection(a)[0],i=t.collection(i)[0];var l=a.id(),c=i.id(),f={},d={},h={},v=new Va(function(q,N){return d[q.id()]-d[N.id()]}),y=new Xn,g={},p={},m=function(N,G){v.push(N),y.add(G)},b,x,E=function(){b=v.pop(),x=b.id(),y.delete(x)},S=function(N){return y.has(N)};m(a,l),f[l]=0,d[l]=o(a);for(var w=0;v.size()>0;){if(E(),w++,x===c){for(var k=[],_=i,C=c,T=p[C];k.unshift(_),T!=null&&k.unshift(T),_=g[C],_!=null;)C=_.id(),T=p[C];return{found:!0,distance:f[x],path:this.spawn(k),steps:w}}h[x]=!0;for(var D=b._private.edges,A=0;A<D.length;A++){var R=D[A];if(this.hasElementWithId(R.id())&&!(s&&R.data("source")!==x)){var M=R.source(),L=R.target(),B=M.id()!==x?M:L,I=B.id();if(this.hasElementWithId(I)&&!h[I]){var H=f[x]+u(R);if(!S(I)){f[I]=H,d[I]=H+o(B),m(B,I),g[I]=b,p[I]=R;continue}H<f[I]&&(f[I]=H,d[I]=H+o(B),g[I]=b,p[I]=R)}}}}return{found:!1,distance:void 0,path:void 0,steps:w}}},Bg=Et({weight:function(e){return 1},directed:!1}),Lg={floydWarshall:function(e){for(var t=this.cy(),n=Bg(e),a=n.weight,i=n.directed,o=a,s=this.byGroup(),u=s.nodes,l=s.edges,c=u.length,f=c*c,d=function(X){return u.indexOf(X)},h=function(X){return u[X]},v=new Array(f),y=0;y<f;y++){var g=y%c,p=(y-g)/c;p===g?v[y]=0:v[y]=1/0}for(var m=new Array(f),b=new Array(f),x=0;x<l.length;x++){var E=l[x],S=E.source()[0],w=E.target()[0];if(S!==w){var k=d(S),_=d(w),C=k*c+_,T=o(E);if(v[C]>T&&(v[C]=T,m[C]=_,b[C]=E),!i){var D=_*c+k;!i&&v[D]>T&&(v[D]=T,m[D]=k,b[D]=E)}}}for(var A=0;A<c;A++)for(var R=0;R<c;R++)for(var M=R*c+A,L=0;L<c;L++){var B=R*c+L,I=A*c+L;v[M]+v[I]<v[B]&&(v[B]=v[M]+v[I],m[B]=m[M])}var H=function(X){return(he(X)?t.filter(X):X)[0]},q=function(X){return d(H(X))},N={distance:function(X,j){var Q=q(X),Z=q(j);return v[Q*c+Z]},path:function(X,j){var Q=q(X),Z=q(j),te=h(Q);if(Q===Z)return te.collection();if(m[Q*c+Z]==null)return t.collection();var ne=t.collection(),$=Q,O;for(ne.merge(te);Q!==Z;)$=Q,Q=m[Q*c+Z],O=b[$*c+Q],ne.merge(O),ne.merge(h(Q));return ne}};return N}},Og=Et({weight:function(e){return 1},directed:!1,root:null}),Ig={bellmanFord:function(e){var t=this,n=Og(e),a=n.weight,i=n.directed,o=n.root,s=a,u=this,l=this.cy(),c=this.byGroup(),f=c.edges,d=c.nodes,h=d.length,v=new Pr,y=!1,g=[];o=l.collection(o)[0],f.unmergeBy(function(pe){return pe.isLoop()});for(var p=f.length,m=function(ye){var ge=v.get(ye.id());return ge||(ge={},v.set(ye.id(),ge)),ge},b=function(ye){return(he(ye)?l.$(ye):ye)[0]},x=function(ye){return m(b(ye)).dist},E=function(ye){for(var ge=arguments.length>1&&arguments[1]!==void 0?arguments[1]:o,oe=b(ye),ve=[],de=oe;;){if(de==null)return t.spawn();var we=m(de),xe=we.edge,Ae=we.pred;if(ve.unshift(de[0]),de.same(ge)&&ve.length>0)break;xe!=null&&ve.unshift(xe),de=Ae}return u.spawn(ve)},S=0;S<h;S++){var w=d[S],k=m(w);w.same(o)?k.dist=0:k.dist=1/0,k.pred=null,k.edge=null}for(var _=!1,C=function(ye,ge,oe,ve,de,we){var xe=ve.dist+we;xe<de.dist&&!oe.same(ve.edge)&&(de.dist=xe,de.pred=ye,de.edge=oe,_=!0)},T=1;T<h;T++){_=!1;for(var D=0;D<p;D++){var A=f[D],R=A.source(),M=A.target(),L=s(A),B=m(R),I=m(M);C(R,M,A,B,I,L),i||C(M,R,A,I,B,L)}if(!_)break}if(_)for(var H=[],q=0;q<p;q++){var N=f[q],G=N.source(),X=N.target(),j=s(N),Q=m(G).dist,Z=m(X).dist;if(Q+j<Z||!i&&Z+j<Q)if(y||($e("Graph contains a negative weight cycle for Bellman-Ford"),y=!0),e.findNegativeWeightCycles!==!1){var te=[];Q+j<Z&&te.push(G),!i&&Z+j<Q&&te.push(X);for(var ne=te.length,$=0;$<ne;$++){var O=te[$],z=[O];z.push(m(O).edge);for(var V=m(O).pred;z.indexOf(V)===-1;)z.push(V),z.push(m(V).edge),V=m(V).pred;z=z.slice(z.indexOf(V));for(var W=z[0].id(),re=0,se=2;se<z.length;se+=2)z[se].id()<W&&(W=z[se].id(),re=se);z=z.slice(re).concat(z.slice(0,re)),z.push(z[0]);var Ce=z.map(function(pe){return pe.id()}).join(",");H.indexOf(Ce)===-1&&(g.push(u.spawn(z)),H.push(Ce))}}else break}return{distanceTo:x,pathTo:E,hasNegativeWeightCycle:y,negativeWeightCycles:g}}},Ng=Math.sqrt(2),zg=function(e,t,n){n.length===0&&Qe("Karger-Stein must be run on a connected (sub)graph");for(var a=n[e],i=a[1],o=a[2],s=t[i],u=t[o],l=n,c=l.length-1;c>=0;c--){var f=l[c],d=f[1],h=f[2];(t[d]===s&&t[h]===u||t[d]===u&&t[h]===s)&&l.splice(c,1)}for(var v=0;v<l.length;v++){var y=l[v];y[1]===u?(l[v]=y.slice(),l[v][1]=s):y[2]===u&&(l[v]=y.slice(),l[v][2]=s)}for(var g=0;g<t.length;g++)t[g]===u&&(t[g]=s);return l},Jo=function(e,t,n,a){for(;n>a;){var i=Math.floor(Math.random()*t.length);t=zg(i,e,t),n--}return t},Fg={kargerStein:function(){var e=this,t=this.byGroup(),n=t.nodes,a=t.edges;a.unmergeBy(function(I){return I.isLoop()});var i=n.length,o=a.length,s=Math.ceil(Math.pow(Math.log(i)/Math.LN2,2)),u=Math.floor(i/Ng);if(i<2){Qe("At least 2 nodes are required for Karger-Stein algorithm");return}for(var l=[],c=0;c<o;c++){var f=a[c];l.push([c,n.indexOf(f.source()),n.indexOf(f.target())])}for(var d=1/0,h=[],v=new Array(i),y=new Array(i),g=new Array(i),p=function(H,q){for(var N=0;N<i;N++)q[N]=H[N]},m=0;m<=s;m++){for(var b=0;b<i;b++)y[b]=b;var x=Jo(y,l.slice(),i,u),E=x.slice();p(y,g);var S=Jo(y,x,u,2),w=Jo(g,E,u,2);S.length<=w.length&&S.length<d?(d=S.length,h=S,p(y,v)):w.length<=S.length&&w.length<d&&(d=w.length,h=w,p(g,v))}for(var k=this.spawn(h.map(function(I){return a[I[0]]})),_=this.spawn(),C=this.spawn(),T=v[0],D=0;D<v.length;D++){var A=v[D],R=n[D];A===T?_.merge(R):C.merge(R)}var M=function(H){var q=e.spawn();return H.forEach(function(N){q.merge(N),N.connectedEdges().forEach(function(G){e.contains(G)&&!k.contains(G)&&q.merge(G)})}),q},L=[M(_),M(C)],B={cut:k,components:L,partition1:_,partition2:C};return B}},jo,Vg=function(e){return{x:e.x,y:e.y}},Yi=function(e,t,n){return{x:e.x*t+n.x,y:e.y*t+n.y}},Gd=function(e,t,n){return{x:(e.x-n.x)/t,y:(e.y-n.y)/t}},Nn=function(e){return{x:e[0],y:e[1]}},qg=function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,a=1/0,i=t;i<n;i++){var o=e[i];isFinite(o)&&(a=Math.min(o,a))}return a},Gg=function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,a=-1/0,i=t;i<n;i++){var o=e[i];isFinite(o)&&(a=Math.max(o,a))}return a},Hg=function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,a=0,i=0,o=t;o<n;o++){var s=e[o];isFinite(s)&&(a+=s,i++)}return a/i},$g=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,a=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;a?e=e.slice(t,n):(n<e.length&&e.splice(n,e.length-n),t>0&&e.splice(0,t));for(var s=0,u=e.length-1;u>=0;u--){var l=e[u];o?isFinite(l)||(e[u]=-1/0,s++):e.splice(u,1)}i&&e.sort(function(d,h){return d-h});var c=e.length,f=Math.floor(c/2);return c%2!==0?e[f+1+s]:(e[f-1+s]+e[f+s])/2},Ug=function(e){return Math.PI*e/180},li=function(e,t){return Math.atan2(t,e)-Math.PI/2},Fu=Math.log2||function(r){return Math.log(r)/Math.log(2)},Vu=function(e){return e>0?1:e<0?-1:0},bn=function(e,t){return Math.sqrt(vn(e,t))},vn=function(e,t){var n=t.x-e.x,a=t.y-e.y;return n*n+a*a},Wg=function(e){for(var t=e.length,n=0,a=0;a<t;a++)n+=e[a];for(var i=0;i<t;i++)e[i]=e[i]/n;return e},gt=function(e,t,n,a){return(1-a)*(1-a)*e+2*(1-a)*a*t+a*a*n},Vn=function(e,t,n,a){return{x:gt(e.x,t.x,n.x,a),y:gt(e.y,t.y,n.y,a)}},Xg=function(e,t,n,a){var i={x:t.x-e.x,y:t.y-e.y},o=bn(e,t),s={x:i.x/o,y:i.y/o};return n=n??0,a=a??n*o,{x:e.x+s.x*a,y:e.y+s.y*a}},_a=function(e,t,n){return Math.max(e,Math.min(n,t))},Rt=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}}},Yg=function(e){return{x1:e.x1,x2:e.x2,w:e.w,y1:e.y1,y2:e.y2,h:e.h}},Kg=function(e){e.x1=1/0,e.y1=1/0,e.x2=-1/0,e.y2=-1/0,e.w=0,e.h=0},Zg=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},Hd=function(e,t,n){e.x1=Math.min(e.x1,t),e.x2=Math.max(e.x2,t),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,n),e.y2=Math.max(e.y2,n),e.h=e.y2-e.y1},wi=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},Ei=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[0],n,a,i,o;if(t.length===1)n=a=i=o=t[0];else if(t.length===2)n=i=t[0],o=a=t[1];else if(t.length===4){var s=ut(t,4);n=s[0],a=s[1],i=s[2],o=s[3]}return e.x1-=o,e.x2+=a,e.y1-=n,e.y2+=i,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},gc=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},qu=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)},Ur=function(e,t,n){return e.x1<=t&&t<=e.x2&&e.y1<=n&&n<=e.y2},yc=function(e,t){return Ur(e,t.x,t.y)},$d=function(e,t){return Ur(e,t.x1,t.y1)&&Ur(e,t.x2,t.y2)},Qg=(jo=Math.hypot)!==null&&jo!==void 0?jo:function(r,e){return Math.sqrt(r*r+e*e)};function Jg(r,e){if(r.length<3)throw new Error("Need at least 3 vertices");var t=function(k,_){return{x:k.x+_.x,y:k.y+_.y}},n=function(k,_){return{x:k.x-_.x,y:k.y-_.y}},a=function(k,_){return{x:k.x*_,y:k.y*_}},i=function(k,_){return k.x*_.y-k.y*_.x},o=function(k){var _=Qg(k.x,k.y);return _===0?{x:0,y:0}:{x:k.x/_,y:k.y/_}},s=function(k){for(var _=0,C=0;C<k.length;C++){var T=k[C],D=k[(C+1)%k.length];_+=T.x*D.y-D.x*T.y}return _/2},u=function(k,_,C,T){var D=n(_,k),A=n(T,C),R=i(D,A);if(Math.abs(R)<1e-9)return t(k,a(D,.5));var M=i(n(C,k),A)/R;return t(k,a(D,M))},l=r.map(function(w){return{x:w.x,y:w.y}});s(l)<0&&l.reverse();for(var c=l.length,f=[],d=0;d<c;d++){var h=l[d],v=l[(d+1)%c],y=n(v,h),g=o({x:y.y,y:-y.x});f.push(g)}for(var p=f.map(function(w,k){var _=t(l[k],a(w,e)),C=t(l[(k+1)%c],a(w,e));return{p1:_,p2:C}}),m=[],b=0;b<c;b++){var x=p[(b-1+c)%c],E=p[b],S=u(x.p1,x.p2,E.p1,E.p2);m.push(S)}return m}function jg(r,e,t,n,a,i){var o=uy(r,e,t,n,a),s=Jg(o,i),u=Rt();return s.forEach(function(l){return Hd(u,l.x,l.y)}),u}var Ud=function(e,t,n,a,i,o,s){var u=arguments.length>7&&arguments[7]!==void 0?arguments[7]:"auto",l=u==="auto"?Qr(i,o):u,c=i/2,f=o/2;l=Math.min(l,c,f);var d=l!==c,h=l!==f,v;if(d){var y=n-c+l-s,g=a-f-s,p=n+c-l+s,m=g;if(v=Wr(e,t,n,a,y,g,p,m,!1),v.length>0)return v}if(h){var b=n+c+s,x=a-f+l-s,E=b,S=a+f-l+s;if(v=Wr(e,t,n,a,b,x,E,S,!1),v.length>0)return v}if(d){var w=n-c+l-s,k=a+f+s,_=n+c-l+s,C=k;if(v=Wr(e,t,n,a,w,k,_,C,!1),v.length>0)return v}if(h){var T=n-c-s,D=a-f+l-s,A=T,R=a+f-l+s;if(v=Wr(e,t,n,a,T,D,A,R,!1),v.length>0)return v}var M;{var L=n-c+l,B=a-f+l;if(M=ma(e,t,n,a,L,B,l+s),M.length>0&&M[0]<=L&&M[1]<=B)return[M[0],M[1]]}{var I=n+c-l,H=a-f+l;if(M=ma(e,t,n,a,I,H,l+s),M.length>0&&M[0]>=I&&M[1]<=H)return[M[0],M[1]]}{var q=n+c-l,N=a+f-l;if(M=ma(e,t,n,a,q,N,l+s),M.length>0&&M[0]>=q&&M[1]>=N)return[M[0],M[1]]}{var G=n-c+l,X=a+f-l;if(M=ma(e,t,n,a,G,X,l+s),M.length>0&&M[0]<=G&&M[1]>=X)return[M[0],M[1]]}return[]},ey=function(e,t,n,a,i,o,s){var u=s,l=Math.min(n,i),c=Math.max(n,i),f=Math.min(a,o),d=Math.max(a,o);return l-u<=e&&e<=c+u&&f-u<=t&&t<=d+u},ty=function(e,t,n,a,i,o,s,u,l){var c={x1:Math.min(n,s,i)-l,x2:Math.max(n,s,i)+l,y1:Math.min(a,u,o)-l,y2:Math.max(a,u,o)+l};return!(e<c.x1||e>c.x2||t<c.y1||t>c.y2)},ry=function(e,t,n,a){n-=a;var i=t*t-4*e*n;if(i<0)return[];var o=Math.sqrt(i),s=2*e,u=(-t+o)/s,l=(-t-o)/s;return[u,l]},ny=function(e,t,n,a,i){var o=1e-5;e===0&&(e=o),t/=e,n/=e,a/=e;var s,u,l,c,f,d,h,v;if(u=(3*n-t*t)/9,l=-(27*a)+t*(9*n-2*(t*t)),l/=54,s=u*u*u+l*l,i[1]=0,h=t/3,s>0){f=l+Math.sqrt(s),f=f<0?-Math.pow(-f,1/3):Math.pow(f,1/3),d=l-Math.sqrt(s),d=d<0?-Math.pow(-d,1/3):Math.pow(d,1/3),i[0]=-h+f+d,h+=(f+d)/2,i[4]=i[2]=-h,h=Math.sqrt(3)*(-d+f)/2,i[3]=h,i[5]=-h;return}if(i[5]=i[3]=0,s===0){v=l<0?-Math.pow(-l,1/3):Math.pow(l,1/3),i[0]=-h+2*v,i[4]=i[2]=-(v+h);return}u=-u,c=u*u*u,c=Math.acos(l/Math.sqrt(c)),v=2*Math.sqrt(u),i[0]=-h+v*Math.cos(c/3),i[2]=-h+v*Math.cos((c+2*Math.PI)/3),i[4]=-h+v*Math.cos((c+4*Math.PI)/3)},ay=function(e,t,n,a,i,o,s,u){var l=1*n*n-4*n*i+2*n*s+4*i*i-4*i*s+s*s+a*a-4*a*o+2*a*u+4*o*o-4*o*u+u*u,c=9*n*i-3*n*n-3*n*s-6*i*i+3*i*s+9*a*o-3*a*a-3*a*u-6*o*o+3*o*u,f=3*n*n-6*n*i+n*s-n*e+2*i*i+2*i*e-s*e+3*a*a-6*a*o+a*u-a*t+2*o*o+2*o*t-u*t,d=1*n*i-n*n+n*e-i*e+a*o-a*a+a*t-o*t,h=[];ny(l,c,f,d,h);for(var v=1e-7,y=[],g=0;g<6;g+=2)Math.abs(h[g+1])<v&&h[g]>=0&&h[g]<=1&&y.push(h[g]);y.push(1),y.push(0);for(var p=-1,m,b,x,E=0;E<y.length;E++)m=Math.pow(1-y[E],2)*n+2*(1-y[E])*y[E]*i+y[E]*y[E]*s,b=Math.pow(1-y[E],2)*a+2*(1-y[E])*y[E]*o+y[E]*y[E]*u,x=Math.pow(m-e,2)+Math.pow(b-t,2),p>=0?x<p&&(p=x):p=x;return p},iy=function(e,t,n,a,i,o){var s=[e-n,t-a],u=[i-n,o-a],l=u[0]*u[0]+u[1]*u[1],c=s[0]*s[0]+s[1]*s[1],f=s[0]*u[0]+s[1]*u[1],d=f*f/l;return f<0?c:d>l?(e-i)*(e-i)+(t-o)*(t-o):c-d},Ft=function(e,t,n){for(var a,i,o,s,u,l=0,c=0;c<n.length/2;c++)if(a=n[c*2],i=n[c*2+1],c+1<n.length/2?(o=n[(c+1)*2],s=n[(c+1)*2+1]):(o=n[(c+1-n.length/2)*2],s=n[(c+1-n.length/2)*2+1]),!(a==e&&o==e))if(a>=e&&e>=o||a<=e&&e<=o)u=(e-a)/(o-a)*(s-i)+i,u>t&&l++;else continue;return l%2!==0},Ar=function(e,t,n,a,i,o,s,u,l){var c=new Array(n.length),f;u[0]!=null?(f=Math.atan(u[1]/u[0]),u[0]<0?f=f+Math.PI/2:f=-f-Math.PI/2):f=u;for(var d=Math.cos(-f),h=Math.sin(-f),v=0;v<c.length/2;v++)c[v*2]=o/2*(n[v*2]*d-n[v*2+1]*h),c[v*2+1]=s/2*(n[v*2+1]*d+n[v*2]*h),c[v*2]+=a,c[v*2+1]+=i;var y;if(l>0){var g=Ii(c,-l);y=Oi(g)}else y=c;return Ft(e,t,y)},oy=function(e,t,n,a,i,o,s,u){for(var l=new Array(n.length*2),c=0;c<u.length;c++){var f=u[c];l[c*4+0]=f.startX,l[c*4+1]=f.startY,l[c*4+2]=f.stopX,l[c*4+3]=f.stopY;var d=Math.pow(f.cx-e,2)+Math.pow(f.cy-t,2);if(d<=Math.pow(f.radius,2))return!0}return Ft(e,t,l)},Oi=function(e){for(var t=new Array(e.length/2),n,a,i,o,s,u,l,c,f=0;f<e.length/4;f++){n=e[f*4],a=e[f*4+1],i=e[f*4+2],o=e[f*4+3],f<e.length/4-1?(s=e[(f+1)*4],u=e[(f+1)*4+1],l=e[(f+1)*4+2],c=e[(f+1)*4+3]):(s=e[0],u=e[1],l=e[2],c=e[3]);var d=Wr(n,a,i,o,s,u,l,c,!0);t[f*2]=d[0],t[f*2+1]=d[1]}return t},Ii=function(e,t){for(var n=new Array(e.length*2),a,i,o,s,u=0;u<e.length/2;u++){a=e[u*2],i=e[u*2+1],u<e.length/2-1?(o=e[(u+1)*2],s=e[(u+1)*2+1]):(o=e[0],s=e[1]);var l=s-i,c=-(o-a),f=Math.sqrt(l*l+c*c),d=l/f,h=c/f;n[u*4]=a+d*t,n[u*4+1]=i+h*t,n[u*4+2]=o+d*t,n[u*4+3]=s+h*t}return n},sy=function(e,t,n,a,i,o){var s=n-e,u=a-t;s/=i,u/=o;var l=Math.sqrt(s*s+u*u),c=l-1;if(c<0)return[];var f=c/l;return[(n-e)*f+e,(a-t)*f+t]},yn=function(e,t,n,a,i,o,s){return e-=i,t-=o,e/=n/2+s,t/=a/2+s,e*e+t*t<=1},ma=function(e,t,n,a,i,o,s){var u=[n-e,a-t],l=[e-i,t-o],c=u[0]*u[0]+u[1]*u[1],f=2*(l[0]*u[0]+l[1]*u[1]),d=l[0]*l[0]+l[1]*l[1]-s*s,h=f*f-4*c*d;if(h<0)return[];var v=(-f+Math.sqrt(h))/(2*c),y=(-f-Math.sqrt(h))/(2*c),g=Math.min(v,y),p=Math.max(v,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]*u[0]+e,x=m[0]*u[1]+t;if(m.length>1){if(m[0]==m[1])return[b,x];var E=m[1]*u[0]+e,S=m[1]*u[1]+t;return[b,x,E,S]}else return[b,x]},es=function(e,t,n){return t<=e&&e<=n||n<=e&&e<=t?e:e<=t&&t<=n||n<=t&&t<=e?t:n},Wr=function(e,t,n,a,i,o,s,u,l){var c=e-i,f=n-e,d=s-i,h=t-o,v=a-t,y=u-o,g=d*h-y*c,p=f*h-v*c,m=y*f-d*v;if(m!==0){var b=g/m,x=p/m,E=.001,S=0-E,w=1+E;return S<=b&&b<=w&&S<=x&&x<=w?[e+b*f,t+b*v]:l?[e+b*f,t+b*v]:[]}else return g===0||p===0?es(e,n,s)===s?[s,u]:es(e,n,i)===i?[i,o]:es(i,s,n)===n?[n,a]:[]:[]},uy=function(e,t,n,a,i){var o=[],s=a/2,u=i/2,l=t,c=n;o.push({x:l+s*e[0],y:c+u*e[1]});for(var f=1;f<e.length/2;f++)o.push({x:l+s*e[f*2],y:c+u*e[f*2+1]});return o},Pa=function(e,t,n,a,i,o,s,u){var l=[],c,f=new Array(n.length),d=!0;o==null&&(d=!1);var h;if(d){for(var v=0;v<f.length/2;v++)f[v*2]=n[v*2]*o+a,f[v*2+1]=n[v*2+1]*s+i;if(u>0){var y=Ii(f,-u);h=Oi(y)}else h=f}else h=n;for(var g,p,m,b,x=0;x<h.length/2;x++)g=h[x*2],p=h[x*2+1],x<h.length/2-1?(m=h[(x+1)*2],b=h[(x+1)*2+1]):(m=h[0],b=h[1]),c=Wr(e,t,a,i,g,p,m,b),c.length!==0&&l.push(c[0],c[1]);return l},ly=function(e,t,n,a,i,o,s,u,l){var c=[],f,d=new Array(n.length*2);l.forEach(function(m,b){b===0?(d[d.length-2]=m.startX,d[d.length-1]=m.startY):(d[b*4-2]=m.startX,d[b*4-1]=m.startY),d[b*4]=m.stopX,d[b*4+1]=m.stopY,f=ma(e,t,a,i,m.cx,m.cy,m.radius),f.length!==0&&c.push(f[0],f[1])});for(var h=0;h<d.length/4;h++)f=Wr(e,t,a,i,d[h*4],d[h*4+1],d[h*4+2],d[h*4+3],!1),f.length!==0&&c.push(f[0],f[1]);if(c.length>2){for(var v=[c[0],c[1]],y=Math.pow(v[0]-e,2)+Math.pow(v[1]-t,2),g=1;g<c.length/2;g++){var p=Math.pow(c[g*2]-e,2)+Math.pow(c[g*2+1]-t,2);p<=y&&(v[0]=c[g*2],v[1]=c[g*2+1],y=p)}return v}return c},ci=function(e,t,n){var a=[e[0]-t[0],e[1]-t[1]],i=Math.sqrt(a[0]*a[0]+a[1]*a[1]),o=(i-n)/i;return o<0&&(o=1e-5),[t[0]+o*a[0],t[1]+o*a[1]]},Mt=function(e,t){var n=vu(e,t);return n=Wd(n),n},Wd=function(e){for(var t,n,a=e.length/2,i=1/0,o=1/0,s=-1/0,u=-1/0,l=0;l<a;l++)t=e[2*l],n=e[2*l+1],i=Math.min(i,t),s=Math.max(s,t),o=Math.min(o,n),u=Math.max(u,n);for(var c=2/(s-i),f=2/(u-o),d=0;d<a;d++)t=e[2*d]=e[2*d]*c,n=e[2*d+1]=e[2*d+1]*f,i=Math.min(i,t),s=Math.max(s,t),o=Math.min(o,n),u=Math.max(u,n);if(o<-1)for(var h=0;h<a;h++)n=e[2*h+1]=e[2*h+1]+(-1-o);return e},vu=function(e,t){var n=1/e*2*Math.PI,a=e%2===0?Math.PI/2+n/2:Math.PI/2;a+=t;for(var i=new Array(e*2),o,s=0;s<e;s++)o=s*n+a,i[2*s]=Math.cos(o),i[2*s+1]=Math.sin(-o);return i},Qr=function(e,t){return Math.min(e/4,t/4,8)},Xd=function(e,t){return Math.min(e/10,t/10,8)},Gu=function(){return 8},cy=function(e,t,n){return[e-2*t+n,2*(t-e),e]},hu=function(e,t){return{heightOffset:Math.min(15,.05*t),widthOffset:Math.min(100,.25*e),ctrlPtOffsetPct:.05}};function ts(r,e){function t(f){for(var d=[],h=0;h<f.length;h++){var v=f[h],y=f[(h+1)%f.length],g={x:y.x-v.x,y:y.y-v.y},p={x:-g.y,y:g.x},m=Math.sqrt(p.x*p.x+p.y*p.y);d.push({x:p.x/m,y:p.y/m})}return d}function n(f,d){var h=1/0,v=-1/0,y=Vt(f),g;try{for(y.s();!(g=y.n()).done;){var p=g.value,m=p.x*d.x+p.y*d.y;h=Math.min(h,m),v=Math.max(v,m)}}catch(b){y.e(b)}finally{y.f()}return{min:h,max:v}}function a(f,d){return!(f.max<d.min||d.max<f.min)}var i=[].concat(Mi(t(r)),Mi(t(e))),o=Vt(i),s;try{for(o.s();!(s=o.n()).done;){var u=s.value,l=n(r,u),c=n(e,u);if(!a(l,c))return!1}}catch(f){o.e(f)}finally{o.f()}return!0}var fy=Et({dampingFactor:.8,precision:1e-6,iterations:200,weight:function(e){return 1}}),dy={pageRank:function(e){for(var t=fy(e),n=t.dampingFactor,a=t.precision,i=t.iterations,o=t.weight,s=this._private.cy,u=this.byGroup(),l=u.nodes,c=u.edges,f=l.length,d=f*f,h=c.length,v=new Array(d),y=new Array(f),g=(1-n)/f,p=0;p<f;p++){for(var m=0;m<f;m++){var b=p*f+m;v[b]=0}y[p]=0}for(var x=0;x<h;x++){var E=c[x],S=E.data("source"),w=E.data("target");if(S!==w){var k=l.indexOfId(S),_=l.indexOfId(w),C=o(E),T=_*f+k;v[T]+=C,y[k]+=C}}for(var D=1/f+g,A=0;A<f;A++)if(y[A]===0)for(var R=0;R<f;R++){var M=R*f+A;v[M]=D}else for(var L=0;L<f;L++){var B=L*f+A;v[B]=v[B]/y[A]+g}for(var I=new Array(f),H=new Array(f),q,N=0;N<f;N++)I[N]=1;for(var G=0;G<i;G++){for(var X=0;X<f;X++)H[X]=0;for(var j=0;j<f;j++)for(var Q=0;Q<f;Q++){var Z=j*f+Q;H[j]+=v[Z]*I[Q]}Wg(H),q=I,I=H,H=q;for(var te=0,ne=0;ne<f;ne++){var $=q[ne]-I[ne];te+=$*$}if(te<a)break}var O={rank:function(V){return V=s.collection(V)[0],I[l.indexOf(V)]}};return O}},mc=Et({root:null,weight:function(e){return 1},directed:!1,alpha:0}),qn={degreeCentralityNormalized:function(e){e=mc(e);var t=this.cy(),n=this.nodes(),a=n.length;if(e.directed){for(var c={},f={},d=0,h=0,v=0;v<a;v++){var y=n[v],g=y.id();e.root=y;var p=this.degreeCentrality(e);d<p.indegree&&(d=p.indegree),h<p.outdegree&&(h=p.outdegree),c[g]=p.indegree,f[g]=p.outdegree}return{indegree:function(b){return d==0?0:(he(b)&&(b=t.filter(b)),c[b.id()]/d)},outdegree:function(b){return h===0?0:(he(b)&&(b=t.filter(b)),f[b.id()]/h)}}}else{for(var i={},o=0,s=0;s<a;s++){var u=n[s];e.root=u;var l=this.degreeCentrality(e);o<l.degree&&(o=l.degree),i[u.id()]=l.degree}return{degree:function(b){return o===0?0:(he(b)&&(b=t.filter(b)),i[b.id()]/o)}}}},degreeCentrality:function(e){e=mc(e);var t=this.cy(),n=this,a=e,i=a.root,o=a.weight,s=a.directed,u=a.alpha;if(i=t.collection(i)[0],s){for(var h=i.connectedEdges(),v=h.filter(function(S){return S.target().same(i)&&n.has(S)}),y=h.filter(function(S){return S.source().same(i)&&n.has(S)}),g=v.length,p=y.length,m=0,b=0,x=0;x<v.length;x++)m+=o(v[x]);for(var E=0;E<y.length;E++)b+=o(y[E]);return{indegree:Math.pow(g,1-u)*Math.pow(m,u),outdegree:Math.pow(p,1-u)*Math.pow(b,u)}}else{for(var l=i.connectedEdges().intersection(n),c=l.length,f=0,d=0;d<l.length;d++)f+=o(l[d]);return{degree:Math.pow(c,1-u)*Math.pow(f,u)}}}};qn.dc=qn.degreeCentrality;qn.dcn=qn.degreeCentralityNormalised=qn.degreeCentralityNormalized;var bc=Et({harmonic:!0,weight:function(){return 1},directed:!1,root:null}),Gn={closenessCentralityNormalized:function(e){for(var t=bc(e),n=t.harmonic,a=t.weight,i=t.directed,o=this.cy(),s={},u=0,l=this.nodes(),c=this.floydWarshall({weight:a,directed:i}),f=0;f<l.length;f++){for(var d=0,h=l[f],v=0;v<l.length;v++)if(f!==v){var y=c.distance(h,l[v]);n?d+=1/y:d+=y}n||(d=1/d),u<d&&(u=d),s[h.id()]=d}return{closeness:function(p){return u==0?0:(he(p)?p=o.filter(p)[0].id():p=p.id(),s[p]/u)}}},closenessCentrality:function(e){var t=bc(e),n=t.root,a=t.weight,i=t.directed,o=t.harmonic;n=this.filter(n)[0];for(var s=this.dijkstra({root:n,weight:a,directed:i}),u=0,l=this.nodes(),c=0;c<l.length;c++){var f=l[c];if(!f.same(n)){var d=s.distanceTo(f);o?u+=1/d:u+=d}}return o?u:1/u}};Gn.cc=Gn.closenessCentrality;Gn.ccn=Gn.closenessCentralityNormalised=Gn.closenessCentralityNormalized;var vy=Et({weight:null,directed:!1}),pu={betweennessCentrality:function(e){for(var t=vy(e),n=t.directed,a=t.weight,i=a!=null,o=this.cy(),s=this.nodes(),u={},l={},c=0,f={set:function(b,x){l[b]=x,x>c&&(c=x)},get:function(b){return l[b]}},d=0;d<s.length;d++){var h=s[d],v=h.id();n?u[v]=h.outgoers().nodes():u[v]=h.openNeighborhood().nodes(),f.set(v,0)}for(var y=function(){for(var b=s[g].id(),x=[],E={},S={},w={},k=new Va(function(j,Q){return w[j]-w[Q]}),_=0;_<s.length;_++){var C=s[_].id();E[C]=[],S[C]=0,w[C]=1/0}for(S[b]=1,w[b]=0,k.push(b);!k.empty();){var T=k.pop();if(x.push(T),i)for(var D=0;D<u[T].length;D++){var A=u[T][D],R=o.getElementById(T),M=void 0;R.edgesTo(A).length>0?M=R.edgesTo(A)[0]:M=A.edgesTo(R)[0];var L=a(M);A=A.id(),w[A]>w[T]+L&&(w[A]=w[T]+L,k.nodes.indexOf(A)<0?k.push(A):k.updateItem(A),S[A]=0,E[A]=[]),w[A]==w[T]+L&&(S[A]=S[A]+S[T],E[A].push(T))}else for(var B=0;B<u[T].length;B++){var I=u[T][B].id();w[I]==1/0&&(k.push(I),w[I]=w[T]+1),w[I]==w[T]+1&&(S[I]=S[I]+S[T],E[I].push(T))}}for(var H={},q=0;q<s.length;q++)H[s[q].id()]=0;for(;x.length>0;){for(var N=x.pop(),G=0;G<E[N].length;G++){var X=E[N][G];H[X]=H[X]+S[X]/S[N]*(1+H[N])}N!=s[g].id()&&f.set(N,f.get(N)+H[N])}},g=0;g<s.length;g++)y();var p={betweenness:function(b){var x=o.collection(b).id();return f.get(x)},betweennessNormalized:function(b){if(c==0)return 0;var x=o.collection(b).id();return f.get(x)/c}};return p.betweennessNormalised=p.betweennessNormalized,p}};pu.bc=pu.betweennessCentrality;var hy=Et({expandFactor:2,inflateFactor:2,multFactor:1,maxIterations:20,attributes:[function(r){return 1}]}),py=function(e){return hy(e)},gy=function(e,t){for(var n=0,a=0;a<t.length;a++)n+=t[a](e);return n},yy=function(e,t,n){for(var a=0;a<t;a++)e[a*t+a]=n},Yd=function(e,t){for(var n,a=0;a<t;a++){n=0;for(var i=0;i<t;i++)n+=e[i*t+a];for(var o=0;o<t;o++)e[o*t+a]=e[o*t+a]/n}},my=function(e,t,n){for(var a=new Array(n*n),i=0;i<n;i++){for(var o=0;o<n;o++)a[i*n+o]=0;for(var s=0;s<n;s++)for(var u=0;u<n;u++)a[i*n+u]+=e[i*n+s]*t[s*n+u]}return a},by=function(e,t,n){for(var a=e.slice(0),i=1;i<n;i++)e=my(e,a,t);return e},xy=function(e,t,n){for(var a=new Array(t*t),i=0;i<t*t;i++)a[i]=Math.pow(e[i],n);return Yd(a,t),a},wy=function(e,t,n,a){for(var i=0;i<n;i++){var o=Math.round(e[i]*Math.pow(10,a))/Math.pow(10,a),s=Math.round(t[i]*Math.pow(10,a))/Math.pow(10,a);if(o!==s)return!1}return!0},Ey=function(e,t,n,a){for(var i=[],o=0;o<t;o++){for(var s=[],u=0;u<t;u++)Math.round(e[o*t+u]*1e3)/1e3>0&&s.push(n[u]);s.length!==0&&i.push(a.collection(s))}return i},Cy=function(e,t){for(var n=0;n<e.length;n++)if(!t[n]||e[n].id()!==t[n].id())return!1;return!0},Sy=function(e){for(var t=0;t<e.length;t++)for(var n=0;n<e.length;n++)t!=n&&Cy(e[t],e[n])&&e.splice(n,1);return e},xc=function(e){for(var t=this.nodes(),n=this.edges(),a=this.cy(),i=py(e),o={},s=0;s<t.length;s++)o[t[s].id()]=s;for(var u=t.length,l=u*u,c=new Array(l),f,d=0;d<l;d++)c[d]=0;for(var h=0;h<n.length;h++){var v=n[h],y=o[v.source().id()],g=o[v.target().id()],p=gy(v,i.attributes);c[y*u+g]+=p,c[g*u+y]+=p}yy(c,u,i.multFactor),Yd(c,u);for(var m=!0,b=0;m&&b<i.maxIterations;)m=!1,f=by(c,u,i.expandFactor),c=xy(f,u,i.inflateFactor),wy(c,f,l,4)||(m=!0),b++;var x=Ey(c,u,t,a);return x=Sy(x),x},ky={markovClustering:xc,mcl:xc},Ty=function(e){return e},Kd=function(e,t){return Math.abs(t-e)},wc=function(e,t,n){return e+Kd(t,n)},Ec=function(e,t,n){return e+Math.pow(n-t,2)},_y=function(e){return Math.sqrt(e)},Py=function(e,t,n){return Math.max(e,Kd(t,n))},fa=function(e,t,n,a,i){for(var o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:Ty,s=a,u,l,c=0;c<e;c++)u=t(c),l=n(c),s=i(s,u,l);return o(s)},Un={euclidean:function(e,t,n){return e>=2?fa(e,t,n,0,Ec,_y):fa(e,t,n,0,wc)},squaredEuclidean:function(e,t,n){return fa(e,t,n,0,Ec)},manhattan:function(e,t,n){return fa(e,t,n,0,wc)},max:function(e,t,n){return fa(e,t,n,-1/0,Py)}};Un["squared-euclidean"]=Un.squaredEuclidean;Un.squaredeuclidean=Un.squaredEuclidean;function Ki(r,e,t,n,a,i){var o;return je(r)?o=r:o=Un[r]||Un.euclidean,e===0&&je(r)?o(a,i):o(e,t,n,a,i)}var Dy=Et({k:2,m:2,sensitivityThreshold:1e-4,distance:"euclidean",maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),Hu=function(e){return Dy(e)},Ni=function(e,t,n,a,i){var o=i!=="kMedoids",s=o?function(f){return n[f]}:function(f){return a[f](n)},u=function(d){return a[d](t)},l=n,c=t;return Ki(e,a.length,s,u,l,c)},rs=function(e,t,n){for(var a=n.length,i=new Array(a),o=new Array(a),s=new Array(t),u=null,l=0;l<a;l++)i[l]=e.min(n[l]).value,o[l]=e.max(n[l]).value;for(var c=0;c<t;c++){u=[];for(var f=0;f<a;f++)u[f]=Math.random()*(o[f]-i[f])+i[f];s[c]=u}return s},Zd=function(e,t,n,a,i){for(var o=1/0,s=0,u=0;u<t.length;u++){var l=Ni(n,e,t[u],a,i);l<o&&(o=l,s=u)}return s},Qd=function(e,t,n){for(var a=[],i=null,o=0;o<t.length;o++)i=t[o],n[i.id()]===e&&a.push(i);return a},Ay=function(e,t,n){return Math.abs(t-e)<=n},My=function(e,t,n){for(var a=0;a<e.length;a++)for(var i=0;i<e[a].length;i++){var o=Math.abs(e[a][i]-t[a][i]);if(o>n)return!1}return!0},Ry=function(e,t,n){for(var a=0;a<n;a++)if(e===t[a])return!0;return!1},Cc=function(e,t){var n=new Array(t);if(e.length<50)for(var a=0;a<t;a++){for(var i=e[Math.floor(Math.random()*e.length)];Ry(i,n,a);)i=e[Math.floor(Math.random()*e.length)];n[a]=i}else for(var o=0;o<t;o++)n[o]=e[Math.floor(Math.random()*e.length)];return n},Sc=function(e,t,n){for(var a=0,i=0;i<t.length;i++)a+=Ni("manhattan",t[i],e,n,"kMedoids");return a},By=function(e){var t=this.cy(),n=this.nodes(),a=null,i=Hu(e),o=new Array(i.k),s={},u;i.testMode?typeof i.testCentroids=="number"?(i.testCentroids,u=rs(n,i.k,i.attributes)):dt(i.testCentroids)==="object"?u=i.testCentroids:u=rs(n,i.k,i.attributes):u=rs(n,i.k,i.attributes);for(var l=!0,c=0;l&&c<i.maxIterations;){for(var f=0;f<n.length;f++)a=n[f],s[a.id()]=Zd(a,u,i.distance,i.attributes,"kMeans");l=!1;for(var d=0;d<i.k;d++){var h=Qd(d,n,s);if(h.length!==0){for(var v=i.attributes.length,y=u[d],g=new Array(v),p=new Array(v),m=0;m<v;m++){p[m]=0;for(var b=0;b<h.length;b++)a=h[b],p[m]+=i.attributes[m](a);g[m]=p[m]/h.length,Ay(g[m],y[m],i.sensitivityThreshold)||(l=!0)}u[d]=g,o[d]=t.collection(h)}}c++}return o},Ly=function(e){var t=this.cy(),n=this.nodes(),a=null,i=Hu(e),o=new Array(i.k),s,u={},l,c=new Array(i.k);i.testMode?typeof i.testCentroids=="number"||(dt(i.testCentroids)==="object"?s=i.testCentroids:s=Cc(n,i.k)):s=Cc(n,i.k);for(var f=!0,d=0;f&&d<i.maxIterations;){for(var h=0;h<n.length;h++)a=n[h],u[a.id()]=Zd(a,s,i.distance,i.attributes,"kMedoids");f=!1;for(var v=0;v<s.length;v++){var y=Qd(v,n,u);if(y.length!==0){c[v]=Sc(s[v],y,i.attributes);for(var g=0;g<y.length;g++)l=Sc(y[g],y,i.attributes),l<c[v]&&(c[v]=l,s[v]=y[g],f=!0);o[v]=t.collection(y)}}d++}return o},Oy=function(e,t,n,a,i){for(var o,s,u=0;u<t.length;u++)for(var l=0;l<e.length;l++)a[u][l]=Math.pow(n[u][l],i.m);for(var c=0;c<e.length;c++)for(var f=0;f<i.attributes.length;f++){o=0,s=0;for(var d=0;d<t.length;d++)o+=a[d][c]*i.attributes[f](t[d]),s+=a[d][c];e[c][f]=o/s}},Iy=function(e,t,n,a,i){for(var o=0;o<e.length;o++)t[o]=e[o].slice();for(var s,u,l,c=2/(i.m-1),f=0;f<n.length;f++)for(var d=0;d<a.length;d++){s=0;for(var h=0;h<n.length;h++)u=Ni(i.distance,a[d],n[f],i.attributes,"cmeans"),l=Ni(i.distance,a[d],n[h],i.attributes,"cmeans"),s+=Math.pow(u/l,c);e[d][f]=1/s}},Ny=function(e,t,n,a){for(var i=new Array(n.k),o=0;o<i.length;o++)i[o]=[];for(var s,u,l=0;l<t.length;l++){s=-1/0,u=-1;for(var c=0;c<t[0].length;c++)t[l][c]>s&&(s=t[l][c],u=c);i[u].push(e[l])}for(var f=0;f<i.length;f++)i[f]=a.collection(i[f]);return i},kc=function(e){var t=this.cy(),n=this.nodes(),a=Hu(e),i,o,s,u,l;u=new Array(n.length);for(var c=0;c<n.length;c++)u[c]=new Array(a.k);s=new Array(n.length);for(var f=0;f<n.length;f++)s[f]=new Array(a.k);for(var d=0;d<n.length;d++){for(var h=0,v=0;v<a.k;v++)s[d][v]=Math.random(),h+=s[d][v];for(var y=0;y<a.k;y++)s[d][y]=s[d][y]/h}o=new Array(a.k);for(var g=0;g<a.k;g++)o[g]=new Array(a.attributes.length);l=new Array(n.length);for(var p=0;p<n.length;p++)l[p]=new Array(a.k);for(var m=!0,b=0;m&&b<a.maxIterations;)m=!1,Oy(o,n,s,l,a),Iy(s,u,o,n,a),My(s,u,a.sensitivityThreshold)||(m=!0),b++;return i=Ny(n,s,a,t),{clusters:i,degreeOfMembership:s}},zy={kMeans:By,kMedoids:Ly,fuzzyCMeans:kc,fcm:kc},Fy=Et({distance:"euclidean",linkage:"min",mode:"threshold",threshold:1/0,addDendrogram:!1,dendrogramDepth:0,attributes:[]}),Vy={single:"min",complete:"max"},qy=function(e){var t=Fy(e),n=Vy[t.linkage];return n!=null&&(t.linkage=n),t},Tc=function(e,t,n,a,i){for(var o=0,s=1/0,u,l=i.attributes,c=function(_,C){return Ki(i.distance,l.length,function(T){return l[T](_)},function(T){return l[T](C)},_,C)},f=0;f<e.length;f++){var d=e[f].key,h=n[d][a[d]];h<s&&(o=d,s=h)}if(i.mode==="threshold"&&s>=i.threshold||i.mode==="dendrogram"&&e.length===1)return!1;var v=t[o],y=t[a[o]],g;i.mode==="dendrogram"?g={left:v,right:y,key:v.key}:g={value:v.value.concat(y.value),key:v.key},e[v.index]=g,e.splice(y.index,1),t[v.key]=g;for(var p=0;p<e.length;p++){var m=e[p];v.key===m.key?u=1/0:i.linkage==="min"?(u=n[v.key][m.key],n[v.key][m.key]>n[y.key][m.key]&&(u=n[y.key][m.key])):i.linkage==="max"?(u=n[v.key][m.key],n[v.key][m.key]<n[y.key][m.key]&&(u=n[y.key][m.key])):i.linkage==="mean"?u=(n[v.key][m.key]*v.size+n[y.key][m.key]*y.size)/(v.size+y.size):i.mode==="dendrogram"?u=c(m.value,v.value):u=c(m.value[0],v.value[0]),n[v.key][m.key]=n[m.key][v.key]=u}for(var b=0;b<e.length;b++){var x=e[b].key;if(a[x]===v.key||a[x]===y.key){for(var E=x,S=0;S<e.length;S++){var w=e[S].key;n[x][w]<n[x][E]&&(E=w)}a[x]=E}e[b].index=b}return v.key=y.key=v.index=y.index=null,!0},zn=function(e,t,n){e&&(e.value?t.push(e.value):(e.left&&zn(e.left,t),e.right&&zn(e.right,t)))},gu=function(e,t){if(!e)return"";if(e.left&&e.right){var n=gu(e.left,t),a=gu(e.right,t),i=t.add({group:"nodes",data:{id:n+","+a}});return t.add({group:"edges",data:{source:n,target:i.id()}}),t.add({group:"edges",data:{source:a,target:i.id()}}),i.id()}else if(e.value)return e.value.id()},yu=function(e,t,n){if(!e)return[];var a=[],i=[],o=[];return t===0?(e.left&&zn(e.left,a),e.right&&zn(e.right,i),o=a.concat(i),[n.collection(o)]):t===1?e.value?[n.collection(e.value)]:(e.left&&zn(e.left,a),e.right&&zn(e.right,i),[n.collection(a),n.collection(i)]):e.value?[n.collection(e.value)]:(e.left&&(a=yu(e.left,t-1,n)),e.right&&(i=yu(e.right,t-1,n)),a.concat(i))},_c=function(e){for(var t=this.cy(),n=this.nodes(),a=qy(e),i=a.attributes,o=function(b,x){return Ki(a.distance,i.length,function(E){return i[E](b)},function(E){return i[E](x)},b,x)},s=[],u=[],l=[],c=[],f=0;f<n.length;f++){var d={value:a.mode==="dendrogram"?n[f]:[n[f]],key:f,index:f};s[f]=d,c[f]=d,u[f]=[],l[f]=0}for(var h=0;h<s.length;h++)for(var v=0;v<=h;v++){var y=void 0;a.mode==="dendrogram"?y=h===v?1/0:o(s[h].value,s[v].value):y=h===v?1/0:o(s[h].value[0],s[v].value[0]),u[h][v]=y,u[v][h]=y,y<u[h][l[h]]&&(l[h]=v)}for(var g=Tc(s,c,u,l,a);g;)g=Tc(s,c,u,l,a);var p;return a.mode==="dendrogram"?(p=yu(s[0],a.dendrogramDepth,t),a.addDendrogram&&gu(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},Gy={hierarchicalClustering:_c,hca:_c},Hy=Et({distance:"euclidean",preference:"median",damping:.8,maxIterations:1e3,minIterations:100,attributes:[]}),$y=function(e){var t=e.damping,n=e.preference;.5<=t&&t<1||Qe("Damping must range on [0.5, 1). Got: ".concat(t));var a=["median","mean","min","max"];return a.some(function(i){return i===n})||ae(n)||Qe("Preference must be one of [".concat(a.map(function(i){return"'".concat(i,"'")}).join(", "),"] or a number. Got: ").concat(n)),Hy(e)},Uy=function(e,t,n,a){var i=function(s,u){return a[u](s)};return-Ki(e,a.length,function(o){return i(t,o)},function(o){return i(n,o)},t,n)},Wy=function(e,t){var n=null;return t==="median"?n=$g(e):t==="mean"?n=Hg(e):t==="min"?n=qg(e):t==="max"?n=Gg(e):n=t,n},Xy=function(e,t,n){for(var a=[],i=0;i<e;i++)t[i*e+i]+n[i*e+i]>0&&a.push(i);return a},Pc=function(e,t,n){for(var a=[],i=0;i<e;i++){for(var o=-1,s=-1/0,u=0;u<n.length;u++){var l=n[u];t[i*e+l]>s&&(o=l,s=t[i*e+l])}o>0&&a.push(o)}for(var c=0;c<n.length;c++)a[n[c]]=n[c];return a},Yy=function(e,t,n){for(var a=Pc(e,t,n),i=0;i<n.length;i++){for(var o=[],s=0;s<a.length;s++)a[s]===n[i]&&o.push(s);for(var u=-1,l=-1/0,c=0;c<o.length;c++){for(var f=0,d=0;d<o.length;d++)f+=t[o[d]*e+o[c]];f>l&&(u=c,l=f)}n[i]=o[u]}return a=Pc(e,t,n),a},Dc=function(e){for(var t=this.cy(),n=this.nodes(),a=$y(e),i={},o=0;o<n.length;o++)i[n[o].id()]=o;var s,u,l,c,f,d;s=n.length,u=s*s,l=new Array(u);for(var h=0;h<u;h++)l[h]=-1/0;for(var v=0;v<s;v++)for(var y=0;y<s;y++)v!==y&&(l[v*s+y]=Uy(a.distance,n[v],n[y],a.attributes));c=Wy(l,a.preference);for(var g=0;g<s;g++)l[g*s+g]=c;f=new Array(u);for(var p=0;p<u;p++)f[p]=0;d=new Array(u);for(var m=0;m<u;m++)d[m]=0;for(var b=new Array(s),x=new Array(s),E=new Array(s),S=0;S<s;S++)b[S]=0,x[S]=0,E[S]=0;for(var w=new Array(s*a.minIterations),k=0;k<w.length;k++)w[k]=0;var _;for(_=0;_<a.maxIterations;_++){for(var C=0;C<s;C++){for(var T=-1/0,D=-1/0,A=-1,R=0,M=0;M<s;M++)b[M]=f[C*s+M],R=d[C*s+M]+l[C*s+M],R>=T?(D=T,T=R,A=M):R>D&&(D=R);for(var L=0;L<s;L++)f[C*s+L]=(1-a.damping)*(l[C*s+L]-T)+a.damping*b[L];f[C*s+A]=(1-a.damping)*(l[C*s+A]-D)+a.damping*b[A]}for(var B=0;B<s;B++){for(var I=0,H=0;H<s;H++)b[H]=d[H*s+B],x[H]=Math.max(0,f[H*s+B]),I+=x[H];I-=x[B],x[B]=f[B*s+B],I+=x[B];for(var q=0;q<s;q++)d[q*s+B]=(1-a.damping)*Math.min(0,I-x[q])+a.damping*b[q];d[B*s+B]=(1-a.damping)*(I-x[B])+a.damping*b[B]}for(var N=0,G=0;G<s;G++){var X=d[G*s+G]+f[G*s+G]>0?1:0;w[_%a.minIterations*s+G]=X,N+=X}if(N>0&&(_>=a.minIterations-1||_==a.maxIterations-1)){for(var j=0,Q=0;Q<s;Q++){E[Q]=0;for(var Z=0;Z<a.minIterations;Z++)E[Q]+=w[Z*s+Q];(E[Q]===0||E[Q]===a.minIterations)&&j++}if(j===s)break}}for(var te=Xy(s,f,d),ne=Yy(s,l,te),$={},O=0;O<te.length;O++)$[te[O]]=[];for(var z=0;z<n.length;z++){var V=i[n[z].id()],W=ne[V];W!=null&&$[W].push(n[z])}for(var re=new Array(te.length),se=0;se<te.length;se++)re[se]=t.collection($[te[se]]);return re},Ky={affinityPropagation:Dc,ap:Dc},Zy=Et({root:void 0,directed:!1}),Qy={hierholzer:function(e){if(!Ne(e)){var t=arguments;e={root:t[0],directed:t[1]}}var n=Zy(e),a=n.root,i=n.directed,o=this,s=!1,u,l,c;a&&(c=he(a)?this.filter(a)[0].id():a[0].id());var f={},d={};i?o.forEach(function(m){var b=m.id();if(m.isNode()){var x=m.indegree(!0),E=m.outdegree(!0),S=x-E,w=E-x;S==1?u?s=!0:u=b:w==1?l?s=!0:l=b:(w>1||S>1)&&(s=!0),f[b]=[],m.outgoers().forEach(function(k){k.isEdge()&&f[b].push(k.id())})}else d[b]=[void 0,m.target().id()]}):o.forEach(function(m){var b=m.id();if(m.isNode()){var x=m.degree(!0);x%2&&(u?l?s=!0:l=b:u=b),f[b]=[],m.connectedEdges().forEach(function(E){return f[b].push(E.id())})}else d[b]=[m.source().id(),m.target().id()]});var h={found:!1,trail:void 0};if(s)return h;if(l&&u)if(i){if(c&&l!=c)return h;c=l}else{if(c&&l!=c&&u!=c)return h;c||(c=l)}else c||(c=o[0].id());var v=function(b){for(var x=b,E=[b],S,w,k;f[x].length;)S=f[x].shift(),w=d[S][0],k=d[S][1],x!=k?(f[k]=f[k].filter(function(_){return _!=S}),x=k):!i&&x!=w&&(f[w]=f[w].filter(function(_){return _!=S}),x=w),E.unshift(S),E.unshift(x);return E},y=[],g=[];for(g=v(c);g.length!=1;)f[g[0]].length==0?(y.unshift(o.getElementById(g.shift())),y.unshift(o.getElementById(g.shift()))):g=v(g.shift()).concat(g);y.unshift(o.getElementById(g.shift()));for(var p in f)if(f[p].length)return h;return h.found=!0,h.trail=this.spawn(y,!0),h}},fi=function(){var e=this,t={},n=0,a=0,i=[],o=[],s={},u=function(d,h){for(var v=o.length-1,y=[],g=e.spawn();o[v].x!=d||o[v].y!=h;)y.push(o.pop().edge),v--;y.push(o.pop().edge),y.forEach(function(p){var m=p.connectedNodes().intersection(e);g.merge(p),m.forEach(function(b){var x=b.id(),E=b.connectedEdges().intersection(e);g.merge(b),t[x].cutVertex?g.merge(E.filter(function(S){return S.isLoop()})):g.merge(E)})}),i.push(g)},l=function(d,h,v){d===v&&(a+=1),t[h]={id:n,low:n++,cutVertex:!1};var y=e.getElementById(h).connectedEdges().intersection(e);if(y.size()===0)i.push(e.spawn(e.getElementById(h)));else{var g,p,m,b;y.forEach(function(x){g=x.source().id(),p=x.target().id(),m=g===h?p:g,m!==v&&(b=x.id(),s[b]||(s[b]=!0,o.push({x:h,y:m,edge:x})),m in t?t[h].low=Math.min(t[h].low,t[m].id):(l(d,m,h),t[h].low=Math.min(t[h].low,t[m].low),t[h].id<=t[m].low&&(t[h].cutVertex=!0,u(h,m))))})}};e.forEach(function(f){if(f.isNode()){var d=f.id();d in t||(a=0,l(d,d),t[d].cutVertex=a>1)}});var c=Object.keys(t).filter(function(f){return t[f].cutVertex}).map(function(f){return e.getElementById(f)});return{cut:e.spawn(c),components:i}},Jy={hopcroftTarjanBiconnected:fi,htbc:fi,htb:fi,hopcroftTarjanBiconnectedComponents:fi},di=function(){var e=this,t={},n=0,a=[],i=[],o=e.spawn(e),s=function(l){i.push(l),t[l]={index:n,low:n++,explored:!1};var c=e.getElementById(l).connectedEdges().intersection(e);if(c.forEach(function(y){var g=y.target().id();g!==l&&(g in t||s(g),t[g].explored||(t[l].low=Math.min(t[l].low,t[g].low)))}),t[l].index===t[l].low){for(var f=e.spawn();;){var d=i.pop();if(f.merge(e.getElementById(d)),t[d].low=t[l].index,t[d].explored=!0,d===l)break}var h=f.edgesWith(f),v=f.merge(h);a.push(v),o=o.difference(v)}};return e.forEach(function(u){if(u.isNode()){var l=u.id();l in t||s(l)}}),{cut:o,components:a}},jy={tarjanStronglyConnected:di,tsc:di,tscc:di,tarjanStronglyConnectedComponents:di},Jd={};[Ta,Dg,Ag,Rg,Lg,Ig,Fg,dy,qn,Gn,pu,ky,zy,Gy,Ky,Qy,Jy,jy].forEach(function(r){be(Jd,r)});var jd=0,ev=1,tv=2,ur=function(e){if(!(this instanceof ur))return new ur(e);this.id="Thenable/1.0.7",this.state=jd,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))};ur.prototype={fulfill:function(e){return Ac(this,ev,"fulfillValue",e)},reject:function(e){return Ac(this,tv,"rejectReason",e)},then:function(e,t){var n=this,a=new ur;return n.onFulfilled.push(Rc(e,a,"fulfill")),n.onRejected.push(Rc(t,a,"reject")),rv(n),a.proxy}};var Ac=function(e,t,n,a){return e.state===jd&&(e.state=t,e[n]=a,rv(e)),e},rv=function(e){e.state===ev?Mc(e,"onFulfilled",e.fulfillValue):e.state===tv&&Mc(e,"onRejected",e.rejectReason)},Mc=function(e,t,n){if(e[t].length!==0){var a=e[t];e[t]=[];var i=function(){for(var s=0;s<a.length;s++)a[s](n)};typeof setImmediate=="function"?setImmediate(i):setTimeout(i,0)}},Rc=function(e,t,n){return function(a){if(typeof e!="function")t[n].call(t,a);else{var i;try{i=e(a)}catch(o){t.reject(o);return}nv(t,i)}}},nv=function(e,t){if(e===t||e.proxy===t){e.reject(new TypeError("cannot resolve promise with itself"));return}var n;if(dt(t)==="object"&&t!==null||typeof t=="function")try{n=t.then}catch(i){e.reject(i);return}if(typeof n=="function"){var a=!1;try{n.call(t,function(i){a||(a=!0,i===t?e.reject(new TypeError("circular thenable chain")):nv(e,i))},function(i){a||(a=!0,e.reject(i))})}catch(i){a||e.reject(i)}return}e.fulfill(t)};ur.all=function(r){return new ur(function(e,t){for(var n=new Array(r.length),a=0,i=function(u,l){n[u]=l,a++,a===r.length&&e(n)},o=0;o<r.length;o++)(function(s){var u=r[s],l=u!=null&&u.then!=null;if(l)u.then(function(f){i(s,f)},function(f){t(f)});else{var c=u;i(s,c)}})(o)})};ur.resolve=function(r){return new ur(function(e,t){e(r)})};ur.reject=function(r){return new ur(function(e,t){t(r)})};var Yn=typeof Promise<"u"?Promise:ur,mu=function(e,t,n){var a=Bu(e),i=!a,o=this._private=be({duration:1e3},t,n);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&&je(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(a){var u=e.pan();o.startPan={x:u.x,y:u.y},o.startZoom=e.zoom()}this.length=1,this[0]=this},xn=mu.prototype;be(xn,{instanceString:function(){return"animation"},hook:function(){var e=this._private;if(!e.hooked){var t,n=e.target._private.animation;e.queue?t=n.queue:t=n.current,t.push(this),qt(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,n=t.playing;return e===void 0?t.progress:(n&&this.pause(),t.progress=e,t.started=!1,n&&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 n=function(l,c){var f=e[l];f!=null&&(e[l]=e[c],e[c]=f)};if(n("zoom","startZoom"),n("pan","startPan"),n("position","startPosition"),e.style)for(var a=0;a<e.style.length;a++){var i=e.style[a],o=i.name,s=e.startStyle[o];e.startStyle[o]=i,e.style[a]=s}return t&&this.play(),this},promise:function(e){var t=this._private,n;switch(e){case"frame":n=t.frames;break;default:case"complete":case"completed":n=t.completes}return new Yn(function(a,i){n.push(function(){a()})})}});xn.complete=xn.completed;xn.run=xn.play;xn.running=xn.playing;var em={animated:function(){return function(){var t=this,n=t.length!==void 0,a=n?t:[t],i=this._private.cy||this;if(!i.styleEnabled())return!1;var o=a[0];if(o)return o._private.animation.current.length>0}},clearQueue:function(){return function(){var t=this,n=t.length!==void 0,a=n?t:[t],i=this._private.cy||this;if(!i.styleEnabled())return this;for(var o=0;o<a.length;o++){var s=a[o];s._private.animation.queue=[]}return this}},delay:function(){return function(t,n){var a=this._private.cy||this;return a.styleEnabled()?this.animate({delay:t,duration:t,complete:n}):this}},delayAnimation:function(){return function(t,n){var a=this._private.cy||this;return a.styleEnabled()?this.animation({delay:t,duration:t,complete:n}):this}},animation:function(){return function(t,n){var a=this,i=a.length!==void 0,o=i?a:[a],s=this._private.cy||this,u=!i,l=!u;if(!s.styleEnabled())return this;var c=s.style();t=be({},t,n);var f=Object.keys(t).length===0;if(f)return new mu(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(l&&(t.style=c.getPropsList(t.style||t.css),t.css=void 0),l&&t.renderedPosition!=null){var d=t.renderedPosition,h=s.pan(),v=s.zoom();t.position=Gd(d,v,h)}if(u&&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(u&&p!=null){var m=s.getCenterPan(p.eles,t.zoom);m!=null&&(t.pan=m)}if(u&&t.fit!=null){var b=t.fit,x=s.getFitViewport(b.eles||b.boundingBox,b.padding);x!=null&&(t.pan=x.pan,t.zoom=x.zoom)}if(u&&Ne(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 mu(o[0],t)}},animate:function(){return function(t,n){var a=this,i=a.length!==void 0,o=i?a:[a],s=this._private.cy||this;if(!s.styleEnabled())return this;n&&(t=be({},t,n));for(var u=0;u<o.length;u++){var l=o[u],c=l.animated()&&(t.queue===void 0||t.queue),f=l.animation(t,c?{queue:!0}:void 0);f.play()}return this}},stop:function(){return function(t,n){var a=this,i=a.length!==void 0,o=i?a:[a],s=this._private.cy||this;if(!s.styleEnabled())return this;for(var u=0;u<o.length;u++){for(var l=o[u],c=l._private,f=c.animation.current,d=0;d<f.length;d++){var h=f[d],v=h._private;n&&(v.duration=0)}t&&(c.animation.queue=[]),n||(c.animation.current=[])}return s.notify("draw"),this}}},ns,Bc;function Zi(){if(Bc)return ns;Bc=1;var r=Array.isArray;return ns=r,ns}var as,Lc;function tm(){if(Lc)return as;Lc=1;var r=Zi(),e=za(),t=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,n=/^\w*$/;function a(i,o){if(r(i))return!1;var s=typeof i;return s=="number"||s=="symbol"||s=="boolean"||i==null||e(i)?!0:n.test(i)||!t.test(i)||o!=null&&i in Object(o)}return as=a,as}var is,Oc;function rm(){if(Oc)return is;Oc=1;var r=Bd(),e=Na(),t="[object AsyncFunction]",n="[object Function]",a="[object GeneratorFunction]",i="[object Proxy]";function o(s){if(!e(s))return!1;var u=r(s);return u==n||u==a||u==t||u==i}return is=o,is}var os,Ic;function nm(){if(Ic)return os;Ic=1;var r=Wi(),e=r["__core-js_shared__"];return os=e,os}var ss,Nc;function am(){if(Nc)return ss;Nc=1;var r=nm(),e=(function(){var n=/[^.]+$/.exec(r&&r.keys&&r.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""})();function t(n){return!!e&&e in n}return ss=t,ss}var us,zc;function im(){if(zc)return us;zc=1;var r=Function.prototype,e=r.toString;function t(n){if(n!=null){try{return e.call(n)}catch(a){}try{return n+""}catch(a){}}return""}return us=t,us}var ls,Fc;function om(){if(Fc)return ls;Fc=1;var r=rm(),e=am(),t=Na(),n=im(),a=/[\\^$.*+?()[\]{}|]/g,i=/^\[object .+?Constructor\]$/,o=Function.prototype,s=Object.prototype,u=o.toString,l=s.hasOwnProperty,c=RegExp("^"+u.call(l).replace(a,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function f(d){if(!t(d)||e(d))return!1;var h=r(d)?c:i;return h.test(n(d))}return ls=f,ls}var cs,Vc;function sm(){if(Vc)return cs;Vc=1;function r(e,t){return e?.[t]}return cs=r,cs}var fs,qc;function $u(){if(qc)return fs;qc=1;var r=om(),e=sm();function t(n,a){var i=e(n,a);return r(i)?i:void 0}return fs=t,fs}var ds,Gc;function Qi(){if(Gc)return ds;Gc=1;var r=$u(),e=r(Object,"create");return ds=e,ds}var vs,Hc;function um(){if(Hc)return vs;Hc=1;var r=Qi();function e(){this.__data__=r?r(null):{},this.size=0}return vs=e,vs}var hs,$c;function lm(){if($c)return hs;$c=1;function r(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}return hs=r,hs}var ps,Uc;function cm(){if(Uc)return ps;Uc=1;var r=Qi(),e="__lodash_hash_undefined__",t=Object.prototype,n=t.hasOwnProperty;function a(i){var o=this.__data__;if(r){var s=o[i];return s===e?void 0:s}return n.call(o,i)?o[i]:void 0}return ps=a,ps}var gs,Wc;function fm(){if(Wc)return gs;Wc=1;var r=Qi(),e=Object.prototype,t=e.hasOwnProperty;function n(a){var i=this.__data__;return r?i[a]!==void 0:t.call(i,a)}return gs=n,gs}var ys,Xc;function dm(){if(Xc)return ys;Xc=1;var r=Qi(),e="__lodash_hash_undefined__";function t(n,a){var i=this.__data__;return this.size+=this.has(n)?0:1,i[n]=r&&a===void 0?e:a,this}return ys=t,ys}var ms,Yc;function vm(){if(Yc)return ms;Yc=1;var r=um(),e=lm(),t=cm(),n=fm(),a=dm();function i(o){var s=-1,u=o==null?0:o.length;for(this.clear();++s<u;){var l=o[s];this.set(l[0],l[1])}}return i.prototype.clear=r,i.prototype.delete=e,i.prototype.get=t,i.prototype.has=n,i.prototype.set=a,ms=i,ms}var bs,Kc;function hm(){if(Kc)return bs;Kc=1;function r(){this.__data__=[],this.size=0}return bs=r,bs}var xs,Zc;function av(){if(Zc)return xs;Zc=1;function r(e,t){return e===t||e!==e&&t!==t}return xs=r,xs}var ws,Qc;function Ji(){if(Qc)return ws;Qc=1;var r=av();function e(t,n){for(var a=t.length;a--;)if(r(t[a][0],n))return a;return-1}return ws=e,ws}var Es,Jc;function pm(){if(Jc)return Es;Jc=1;var r=Ji(),e=Array.prototype,t=e.splice;function n(a){var i=this.__data__,o=r(i,a);if(o<0)return!1;var s=i.length-1;return o==s?i.pop():t.call(i,o,1),--this.size,!0}return Es=n,Es}var Cs,jc;function gm(){if(jc)return Cs;jc=1;var r=Ji();function e(t){var n=this.__data__,a=r(n,t);return a<0?void 0:n[a][1]}return Cs=e,Cs}var Ss,ef;function ym(){if(ef)return Ss;ef=1;var r=Ji();function e(t){return r(this.__data__,t)>-1}return Ss=e,Ss}var ks,tf;function mm(){if(tf)return ks;tf=1;var r=Ji();function e(t,n){var a=this.__data__,i=r(a,t);return i<0?(++this.size,a.push([t,n])):a[i][1]=n,this}return ks=e,ks}var Ts,rf;function bm(){if(rf)return Ts;rf=1;var r=hm(),e=pm(),t=gm(),n=ym(),a=mm();function i(o){var s=-1,u=o==null?0:o.length;for(this.clear();++s<u;){var l=o[s];this.set(l[0],l[1])}}return i.prototype.clear=r,i.prototype.delete=e,i.prototype.get=t,i.prototype.has=n,i.prototype.set=a,Ts=i,Ts}var _s,nf;function xm(){if(nf)return _s;nf=1;var r=$u(),e=Wi(),t=r(e,"Map");return _s=t,_s}var Ps,af;function wm(){if(af)return Ps;af=1;var r=vm(),e=bm(),t=xm();function n(){this.size=0,this.__data__={hash:new r,map:new(t||e),string:new r}}return Ps=n,Ps}var Ds,of;function Em(){if(of)return Ds;of=1;function r(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}return Ds=r,Ds}var As,sf;function ji(){if(sf)return As;sf=1;var r=Em();function e(t,n){var a=t.__data__;return r(n)?a[typeof n=="string"?"string":"hash"]:a.map}return As=e,As}var Ms,uf;function Cm(){if(uf)return Ms;uf=1;var r=ji();function e(t){var n=r(this,t).delete(t);return this.size-=n?1:0,n}return Ms=e,Ms}var Rs,lf;function Sm(){if(lf)return Rs;lf=1;var r=ji();function e(t){return r(this,t).get(t)}return Rs=e,Rs}var Bs,cf;function km(){if(cf)return Bs;cf=1;var r=ji();function e(t){return r(this,t).has(t)}return Bs=e,Bs}var Ls,ff;function Tm(){if(ff)return Ls;ff=1;var r=ji();function e(t,n){var a=r(this,t),i=a.size;return a.set(t,n),this.size+=a.size==i?0:1,this}return Ls=e,Ls}var Os,df;function _m(){if(df)return Os;df=1;var r=wm(),e=Cm(),t=Sm(),n=km(),a=Tm();function i(o){var s=-1,u=o==null?0:o.length;for(this.clear();++s<u;){var l=o[s];this.set(l[0],l[1])}}return i.prototype.clear=r,i.prototype.delete=e,i.prototype.get=t,i.prototype.has=n,i.prototype.set=a,Os=i,Os}var Is,vf;function Pm(){if(vf)return Is;vf=1;var r=_m(),e="Expected a function";function t(n,a){if(typeof n!="function"||a!=null&&typeof a!="function")throw new TypeError(e);var i=function(){var o=arguments,s=a?a.apply(this,o):o[0],u=i.cache;if(u.has(s))return u.get(s);var l=n.apply(this,o);return i.cache=u.set(s,l)||u,l};return i.cache=new(t.Cache||r),i}return t.Cache=r,Is=t,Is}var Ns,hf;function Dm(){if(hf)return Ns;hf=1;var r=Pm(),e=500;function t(n){var a=r(n,function(o){return i.size===e&&i.clear(),o}),i=a.cache;return a}return Ns=t,Ns}var zs,pf;function iv(){if(pf)return zs;pf=1;var r=Dm(),e=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,t=/\\(\\)?/g,n=r(function(a){var i=[];return a.charCodeAt(0)===46&&i.push(""),a.replace(e,function(o,s,u,l){i.push(u?l.replace(t,"$1"):s||o)}),i});return zs=n,zs}var Fs,gf;function ov(){if(gf)return Fs;gf=1;function r(e,t){for(var n=-1,a=e==null?0:e.length,i=Array(a);++n<a;)i[n]=t(e[n],n,e);return i}return Fs=r,Fs}var Vs,yf;function Am(){if(yf)return Vs;yf=1;var r=Ou(),e=ov(),t=Zi(),n=za(),a=r?r.prototype:void 0,i=a?a.toString:void 0;function o(s){if(typeof s=="string")return s;if(t(s))return e(s,o)+"";if(n(s))return i?i.call(s):"";var u=s+"";return u=="0"&&1/s==-1/0?"-0":u}return Vs=o,Vs}var qs,mf;function sv(){if(mf)return qs;mf=1;var r=Am();function e(t){return t==null?"":r(t)}return qs=e,qs}var Gs,bf;function uv(){if(bf)return Gs;bf=1;var r=Zi(),e=tm(),t=iv(),n=sv();function a(i,o){return r(i)?i:e(i,o)?[i]:t(n(i))}return Gs=a,Gs}var Hs,xf;function Uu(){if(xf)return Hs;xf=1;var r=za();function e(t){if(typeof t=="string"||r(t))return t;var n=t+"";return n=="0"&&1/t==-1/0?"-0":n}return Hs=e,Hs}var $s,wf;function Mm(){if(wf)return $s;wf=1;var r=uv(),e=Uu();function t(n,a){a=r(a,n);for(var i=0,o=a.length;n!=null&&i<o;)n=n[e(a[i++])];return i&&i==o?n:void 0}return $s=t,$s}var Us,Ef;function Rm(){if(Ef)return Us;Ef=1;var r=Mm();function e(t,n,a){var i=t==null?void 0:r(t,n);return i===void 0?a:i}return Us=e,Us}var Bm=Rm(),Lm=Ia(Bm),Ws,Cf;function Om(){if(Cf)return Ws;Cf=1;var r=$u(),e=(function(){try{var t=r(Object,"defineProperty");return t({},"",{}),t}catch(n){}})();return Ws=e,Ws}var Xs,Sf;function Im(){if(Sf)return Xs;Sf=1;var r=Om();function e(t,n,a){n=="__proto__"&&r?r(t,n,{configurable:!0,enumerable:!0,value:a,writable:!0}):t[n]=a}return Xs=e,Xs}var Ys,kf;function Nm(){if(kf)return Ys;kf=1;var r=Im(),e=av(),t=Object.prototype,n=t.hasOwnProperty;function a(i,o,s){var u=i[o];(!(n.call(i,o)&&e(u,s))||s===void 0&&!(o in i))&&r(i,o,s)}return Ys=a,Ys}var Ks,Tf;function zm(){if(Tf)return Ks;Tf=1;var r=9007199254740991,e=/^(?:0|[1-9]\d*)$/;function t(n,a){var i=typeof n;return a=a??r,!!a&&(i=="number"||i!="symbol"&&e.test(n))&&n>-1&&n%1==0&&n<a}return Ks=t,Ks}var Zs,_f;function Fm(){if(_f)return Zs;_f=1;var r=Nm(),e=uv(),t=zm(),n=Na(),a=Uu();function i(o,s,u,l){if(!n(o))return o;s=e(s,o);for(var c=-1,f=s.length,d=f-1,h=o;h!=null&&++c<f;){var v=a(s[c]),y=u;if(v==="__proto__"||v==="constructor"||v==="prototype")return o;if(c!=d){var g=h[v];y=l?l(g,v,h):void 0,y===void 0&&(y=n(g)?g:t(s[c+1])?[]:{})}r(h,v,y),h=h[v]}return o}return Zs=i,Zs}var Qs,Pf;function Vm(){if(Pf)return Qs;Pf=1;var r=Fm();function e(t,n,a){return t==null?t:r(t,n,a)}return Qs=e,Qs}var qm=Vm(),Gm=Ia(qm),Js,Df;function Hm(){if(Df)return Js;Df=1;function r(e,t){var n=-1,a=e.length;for(t||(t=Array(a));++n<a;)t[n]=e[n];return t}return Js=r,Js}var js,Af;function $m(){if(Af)return js;Af=1;var r=ov(),e=Hm(),t=Zi(),n=za(),a=iv(),i=Uu(),o=sv();function s(u){return t(u)?r(u,i):n(u)?[u]:e(a(o(u)))}return js=s,js}var Um=$m(),Wm=Ia(Um),Xm={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(a){},beforeSet:function(a,i){},onSet:function(a){},canSet:function(a){return!0}};return e=be({},t,e),function(a,i){var o=e,s=this,u=s.length!==void 0,l=u?s:[s],c=u?s[0]:s;if(he(a)){var f=a.indexOf(".")!==-1,d=f&&Wm(a);if(o.allowGetting&&i===void 0){var h;return c&&(o.beforeGet(c),d&&c._private[o.field][a]===void 0?h=Lm(c._private[o.field],d):h=c._private[o.field][a]),h}else if(o.allowSetting&&i!==void 0){var v=!o.immutableKeys[a];if(v){var y=Cd({},a,i);o.beforeSet(s,y);for(var g=0,p=l.length;g<p;g++){var m=l[g];o.canSet(m)&&(d&&c._private[o.field][a]===void 0?Gm(m._private[o.field],d,i):m._private[o.field][a]=i)}o.updateStyle&&s.updateStyle(),o.onSet(s),o.settingTriggersEvent&&s[o.triggerFnName](o.settingEvent)}}}else if(o.allowSetting&&Ne(a)){var b=a,x,E,S=Object.keys(b);o.beforeSet(s,b);for(var w=0;w<S.length;w++){x=S[w],E=b[x];var k=!o.immutableKeys[x];if(k)for(var _=0;_<l.length;_++){var C=l[_];o.canSet(C)&&(C._private[o.field][x]=E)}}o.updateStyle&&s.updateStyle(),o.onSet(s),o.settingTriggersEvent&&s[o.triggerFnName](o.settingEvent)}else if(o.allowBinding&&je(a)){var T=a;s.on(o.bindingEvent,T)}else if(o.allowGetting&&a===void 0){var D;return c&&(o.beforeGet(c),D=c._private[o.field]),D}return s}},removeData:function(e){var t={field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!1,immutableKeys:{}};return e=be({},t,e),function(a){var i=e,o=this,s=o.length!==void 0,u=s?o:[o];if(he(a)){for(var l=a.split(/\s+/),c=l.length,f=0;f<c;f++){var d=l[f];if(!Kr(d)){var h=!i.immutableKeys[d];if(h)for(var v=0,y=u.length;v<y;v++)u[v]._private[i.field][d]=void 0}}i.triggerEvent&&o[i.triggerFnName](i.event)}else if(a===void 0){for(var g=0,p=u.length;g<p;g++)for(var m=u[g]._private[i.field],b=Object.keys(m),x=0;x<b.length;x++){var E=b[x],S=!i.immutableKeys[E];S&&(m[E]=void 0)}i.triggerEvent&&o[i.triggerFnName](i.event)}return o}}},Ym={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(n,a){var i=this,o=Array.prototype.slice.call(arguments,0);return new Yn(function(s,u){var l=function(h){i.off.apply(i,f),s(h)},c=o.concat([l]),f=c.concat([]);i.on.apply(i,c)})}}},He={};[em,Xm,Ym].forEach(function(r){be(He,r)});var Km={animate:He.animate(),animation:He.animation(),animated:He.animated(),clearQueue:He.clearQueue(),delay:He.delay(),delayAnimation:He.delayAnimation(),stop:He.stop()},Ci={classes:function(e){var t=this;if(e===void 0){var n=[];return t[0]._private.classes.forEach(function(v){return n.push(v)}),n}else We(e)||(e=(e||"").match(/\S+/g)||[]);for(var a=[],i=new Xn(e),o=0;o<t.length;o++){for(var s=t[o],u=s._private,l=u.classes,c=!1,f=0;f<e.length;f++){var d=e[f],h=l.has(d);if(!h){c=!0;break}}c||(c=l.size!==e.length),c&&(u.classes=i,a.push(s))}return a.length>0&&this.spawn(a).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){We(e)||(e=e.match(/\S+/g)||[]);for(var n=this,a=t===void 0,i=[],o=0,s=n.length;o<s;o++)for(var u=n[o],l=u._private.classes,c=!1,f=0;f<e.length;f++){var d=e[f],h=l.has(d),v=!1;t||a&&!h?(l.add(d),v=!0):(!t||a&&h)&&(l.delete(d),v=!0),!c&&v&&(i.push(u),c=!0)}return i.length>0&&this.spawn(i).updateStyle().emit("class"),n},removeClass:function(e){return this.toggleClass(e,!1)},flashClass:function(e,t){var n=this;if(t==null)t=250;else if(t===0)return n;return n.addClass(e),setTimeout(function(){n.removeClass(e)},t),n}};Ci.className=Ci.classNames=Ci.classes;var Ie={metaChar:"[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:`"(?:\\\\"|[^"])*"|'(?:\\\\'|[^'])*'`,number:ft,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$",group:"node|edge|\\*",directedEdge:"\\s+->\\s+",undirectedEdge:"\\s+<->\\s+"};Ie.variable="(?:[\\w-.]|(?:\\\\"+Ie.metaChar+"))+";Ie.className="(?:[\\w-]|(?:\\\\"+Ie.metaChar+"))+";Ie.value=Ie.string+"|"+Ie.number;Ie.id=Ie.variable;(function(){var r,e,t;for(r=Ie.comparatorOp.split("|"),t=0;t<r.length;t++)e=r[t],Ie.comparatorOp+="|@"+e;for(r=Ie.comparatorOp.split("|"),t=0;t<r.length;t++)e=r[t],!(e.indexOf("!")>=0)&&e!=="="&&(Ie.comparatorOp+="|\\!"+e)})();var Ue=function(){return{checks:[]}},le={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},bu=[{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 Xp(r.selector,e.selector)}),Zm=(function(){for(var r={},e,t=0;t<bu.length;t++)e=bu[t],r[e.selector]=e.matches;return r})(),Qm=function(e,t){return Zm[e](t)},Jm="("+bu.map(function(r){return r.selector}).join("|")+")",Dn=function(e){return e.replace(new RegExp("\\\\("+Ie.metaChar+")","g"),function(t,n){return n})},Gr=function(e,t,n){e[e.length-1]=n},xu=[{name:"group",query:!0,regex:"("+Ie.group+")",populate:function(e,t,n){var a=ut(n,1),i=a[0];t.checks.push({type:le.GROUP,value:i==="*"?i:i+"s"})}},{name:"state",query:!0,regex:Jm,populate:function(e,t,n){var a=ut(n,1),i=a[0];t.checks.push({type:le.STATE,value:i})}},{name:"id",query:!0,regex:"\\#("+Ie.id+")",populate:function(e,t,n){var a=ut(n,1),i=a[0];t.checks.push({type:le.ID,value:Dn(i)})}},{name:"className",query:!0,regex:"\\.("+Ie.className+")",populate:function(e,t,n){var a=ut(n,1),i=a[0];t.checks.push({type:le.CLASS,value:Dn(i)})}},{name:"dataExists",query:!0,regex:"\\[\\s*("+Ie.variable+")\\s*\\]",populate:function(e,t,n){var a=ut(n,1),i=a[0];t.checks.push({type:le.DATA_EXIST,field:Dn(i)})}},{name:"dataCompare",query:!0,regex:"\\[\\s*("+Ie.variable+")\\s*("+Ie.comparatorOp+")\\s*("+Ie.value+")\\s*\\]",populate:function(e,t,n){var a=ut(n,3),i=a[0],o=a[1],s=a[2],u=new RegExp("^"+Ie.string+"$").exec(s)!=null;u?s=s.substring(1,s.length-1):s=parseFloat(s),t.checks.push({type:le.DATA_COMPARE,field:Dn(i),operator:o,value:s})}},{name:"dataBool",query:!0,regex:"\\[\\s*("+Ie.boolOp+")\\s*("+Ie.variable+")\\s*\\]",populate:function(e,t,n){var a=ut(n,2),i=a[0],o=a[1];t.checks.push({type:le.DATA_BOOL,field:Dn(o),operator:i})}},{name:"metaCompare",query:!0,regex:"\\[\\[\\s*("+Ie.meta+")\\s*("+Ie.comparatorOp+")\\s*("+Ie.number+")\\s*\\]\\]",populate:function(e,t,n){var a=ut(n,3),i=a[0],o=a[1],s=a[2];t.checks.push({type:le.META_COMPARE,field:Dn(i),operator:o,value:parseFloat(s)})}},{name:"nextQuery",separator:!0,regex:Ie.separator,populate:function(e,t){var n=e.currentSubject,a=e.edgeCount,i=e.compoundCount,o=e[e.length-1];n!=null&&(o.subject=n,e.currentSubject=null),o.edgeCount=a,o.compoundCount=i,e.edgeCount=0,e.compoundCount=0;var s=e[e.length++]=Ue();return s}},{name:"directedEdge",separator:!0,regex:Ie.directedEdge,populate:function(e,t){if(e.currentSubject==null){var n=Ue(),a=t,i=Ue();return n.checks.push({type:le.DIRECTED_EDGE,source:a,target:i}),Gr(e,t,n),e.edgeCount++,i}else{var o=Ue(),s=t,u=Ue();return o.checks.push({type:le.NODE_SOURCE,source:s,target:u}),Gr(e,t,o),e.edgeCount++,u}}},{name:"undirectedEdge",separator:!0,regex:Ie.undirectedEdge,populate:function(e,t){if(e.currentSubject==null){var n=Ue(),a=t,i=Ue();return n.checks.push({type:le.UNDIRECTED_EDGE,nodes:[a,i]}),Gr(e,t,n),e.edgeCount++,i}else{var o=Ue(),s=t,u=Ue();return o.checks.push({type:le.NODE_NEIGHBOR,node:s,neighbor:u}),Gr(e,t,o),u}}},{name:"child",separator:!0,regex:Ie.child,populate:function(e,t){if(e.currentSubject==null){var n=Ue(),a=Ue(),i=e[e.length-1];return n.checks.push({type:le.CHILD,parent:i,child:a}),Gr(e,t,n),e.compoundCount++,a}else if(e.currentSubject===t){var o=Ue(),s=e[e.length-1],u=Ue(),l=Ue(),c=Ue(),f=Ue();return o.checks.push({type:le.COMPOUND_SPLIT,left:s,right:u,subject:l}),l.checks=t.checks,t.checks=[{type:le.TRUE}],f.checks.push({type:le.TRUE}),u.checks.push({type:le.PARENT,parent:f,child:c}),Gr(e,s,o),e.currentSubject=l,e.compoundCount++,c}else{var d=Ue(),h=Ue(),v=[{type:le.PARENT,parent:d,child:h}];return d.checks=t.checks,t.checks=v,e.compoundCount++,h}}},{name:"descendant",separator:!0,regex:Ie.descendant,populate:function(e,t){if(e.currentSubject==null){var n=Ue(),a=Ue(),i=e[e.length-1];return n.checks.push({type:le.DESCENDANT,ancestor:i,descendant:a}),Gr(e,t,n),e.compoundCount++,a}else if(e.currentSubject===t){var o=Ue(),s=e[e.length-1],u=Ue(),l=Ue(),c=Ue(),f=Ue();return o.checks.push({type:le.COMPOUND_SPLIT,left:s,right:u,subject:l}),l.checks=t.checks,t.checks=[{type:le.TRUE}],f.checks.push({type:le.TRUE}),u.checks.push({type:le.ANCESTOR,ancestor:f,descendant:c}),Gr(e,s,o),e.currentSubject=l,e.compoundCount++,c}else{var d=Ue(),h=Ue(),v=[{type:le.ANCESTOR,ancestor:d,descendant:h}];return d.checks=t.checks,t.checks=v,e.compoundCount++,h}}},{name:"subject",modifier:!0,regex:Ie.subject,populate:function(e,t){if(e.currentSubject!=null&&e.currentSubject!==t)return $e("Redefinition of subject in selector `"+e.toString()+"`"),!1;e.currentSubject=t;var n=e[e.length-1],a=n.checks[0],i=a==null?null:a.type;i===le.DIRECTED_EDGE?a.type=le.NODE_TARGET:i===le.UNDIRECTED_EDGE&&(a.type=le.NODE_NEIGHBOR,a.node=a.nodes[1],a.neighbor=a.nodes[0],a.nodes=null)}}];xu.forEach(function(r){return r.regexObj=new RegExp("^"+r.regex)});var jm=function(e){for(var t,n,a,i=0;i<xu.length;i++){var o=xu[i],s=o.name,u=e.match(o.regexObj);if(u!=null){n=u,t=o,a=s;var l=u[0];e=e.substring(l.length);break}}return{expr:t,match:n,name:a,remaining:e}},e0=function(e){var t=e.match(/^\s+/);if(t){var n=t[0];e=e.substring(n.length)}return e},t0=function(e){var t=this,n=t.inputText=e,a=t[0]=Ue();for(t.length=1,n=e0(n);;){var i=jm(n);if(i.expr==null)return $e("The selector `"+e+"`is invalid"),!1;var o=i.match.slice(1),s=i.expr.populate(t,a,o);if(s===!1)return!1;if(s!=null&&(a=s),n=i.remaining,n.match(/^\s*$/))break}var u=t[t.length-1];t.currentSubject!=null&&(u.subject=t.currentSubject),u.edgeCount=t.edgeCount,u.compoundCount=t.compoundCount;for(var l=0;l<t.length;l++){var c=t[l];if(c.compoundCount>0&&c.edgeCount>0)return $e("The selector `"+e+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(c.edgeCount>1)return $e("The selector `"+e+"` is invalid because it uses multiple edge selectors"),!1;c.edgeCount===1&&$e("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},r0=function(){if(this.toStringCache!=null)return this.toStringCache;for(var e=function(c){return c??""},t=function(c){return he(c)?'"'+c+'"':e(c)},n=function(c){return" "+c+" "},a=function(c,f){var d=c.type,h=c.value;switch(d){case le.GROUP:{var v=e(h);return v.substring(0,v.length-1)}case le.DATA_COMPARE:{var y=c.field,g=c.operator;return"["+y+n(e(g))+t(h)+"]"}case le.DATA_BOOL:{var p=c.operator,m=c.field;return"["+e(p)+m+"]"}case le.DATA_EXIST:{var b=c.field;return"["+b+"]"}case le.META_COMPARE:{var x=c.operator,E=c.field;return"[["+E+n(e(x))+t(h)+"]]"}case le.STATE:return h;case le.ID:return"#"+h;case le.CLASS:return"."+h;case le.PARENT:case le.CHILD:return i(c.parent,f)+n(">")+i(c.child,f);case le.ANCESTOR:case le.DESCENDANT:return i(c.ancestor,f)+" "+i(c.descendant,f);case le.COMPOUND_SPLIT:{var S=i(c.left,f),w=i(c.subject,f),k=i(c.right,f);return S+(S.length>0?" ":"")+w+k}case le.TRUE:return""}},i=function(c,f){return c.checks.reduce(function(d,h,v){return d+(f===c&&v===0?"$":"")+a(h,f)},"")},o="",s=0;s<this.length;s++){var u=this[s];o+=i(u,u.subject),this.length>1&&s<this.length-1&&(o+=", ")}return this.toStringCache=o,o},n0={parse:t0,toString:r0},lv=function(e,t,n){var a,i=he(e),o=ae(e),s=he(n),u,l,c=!1,f=!1,d=!1;switch(t.indexOf("!")>=0&&(t=t.replace("!",""),f=!0),t.indexOf("@")>=0&&(t=t.replace("@",""),c=!0),(i||s||c)&&(u=!i&&!o?"":""+e,l=""+n),c&&(e=u=u.toLowerCase(),n=l=l.toLowerCase()),t){case"*=":a=u.indexOf(l)>=0;break;case"$=":a=u.indexOf(l,u.length-l.length)>=0;break;case"^=":a=u.indexOf(l)===0;break;case"=":a=e===n;break;case">":d=!0,a=e>n;break;case">=":d=!0,a=e>=n;break;case"<":d=!0,a=e<n;break;case"<=":d=!0,a=e<=n;break;default:a=!1;break}return f&&(e!=null||!d)&&(a=!a),a},a0=function(e,t){switch(t){case"?":return!!e;case"!":return!e;case"^":return e===void 0}},i0=function(e){return e!==void 0},Wu=function(e,t){return e.data(t)},o0=function(e,t){return e[t]()},at=[],Ze=function(e,t){return e.checks.every(function(n){return at[n.type](n,t)})};at[le.GROUP]=function(r,e){var t=r.value;return t==="*"||t===e.group()};at[le.STATE]=function(r,e){var t=r.value;return Qm(t,e)};at[le.ID]=function(r,e){var t=r.value;return e.id()===t};at[le.CLASS]=function(r,e){var t=r.value;return e.hasClass(t)};at[le.META_COMPARE]=function(r,e){var t=r.field,n=r.operator,a=r.value;return lv(o0(e,t),n,a)};at[le.DATA_COMPARE]=function(r,e){var t=r.field,n=r.operator,a=r.value;return lv(Wu(e,t),n,a)};at[le.DATA_BOOL]=function(r,e){var t=r.field,n=r.operator;return a0(Wu(e,t),n)};at[le.DATA_EXIST]=function(r,e){var t=r.field;return r.operator,i0(Wu(e,t))};at[le.UNDIRECTED_EDGE]=function(r,e){var t=r.nodes[0],n=r.nodes[1],a=e.source(),i=e.target();return Ze(t,a)&&Ze(n,i)||Ze(n,a)&&Ze(t,i)};at[le.NODE_NEIGHBOR]=function(r,e){return Ze(r.node,e)&&e.neighborhood().some(function(t){return t.isNode()&&Ze(r.neighbor,t)})};at[le.DIRECTED_EDGE]=function(r,e){return Ze(r.source,e.source())&&Ze(r.target,e.target())};at[le.NODE_SOURCE]=function(r,e){return Ze(r.source,e)&&e.outgoers().some(function(t){return t.isNode()&&Ze(r.target,t)})};at[le.NODE_TARGET]=function(r,e){return Ze(r.target,e)&&e.incomers().some(function(t){return t.isNode()&&Ze(r.source,t)})};at[le.CHILD]=function(r,e){return Ze(r.child,e)&&Ze(r.parent,e.parent())};at[le.PARENT]=function(r,e){return Ze(r.parent,e)&&e.children().some(function(t){return Ze(r.child,t)})};at[le.DESCENDANT]=function(r,e){return Ze(r.descendant,e)&&e.ancestors().some(function(t){return Ze(r.ancestor,t)})};at[le.ANCESTOR]=function(r,e){return Ze(r.ancestor,e)&&e.descendants().some(function(t){return Ze(r.descendant,t)})};at[le.COMPOUND_SPLIT]=function(r,e){return Ze(r.subject,e)&&Ze(r.left,e)&&Ze(r.right,e)};at[le.TRUE]=function(){return!0};at[le.COLLECTION]=function(r,e){var t=r.value;return t.has(e)};at[le.FILTER]=function(r,e){var t=r.value;return t(e)};var s0=function(e){var t=this;if(t.length===1&&t[0].checks.length===1&&t[0].checks[0].type===le.ID)return e.getElementById(t[0].checks[0].value).collection();var n=function(i){for(var o=0;o<t.length;o++){var s=t[o];if(Ze(s,i))return!0}return!1};return t.text()==null&&(n=function(){return!0}),e.filter(n)},u0=function(e){for(var t=this,n=0;n<t.length;n++){var a=t[n];if(Ze(a,e))return!0}return!1},l0={matches:u0,filter:s0},Jr=function(e){this.inputText=e,this.currentSubject=null,this.compoundCount=0,this.edgeCount=0,this.length=0,e==null||he(e)&&e.match(/^\s*$/)||(qt(e)?this.addQuery({checks:[{type:le.COLLECTION,value:e.collection()}]}):je(e)?this.addQuery({checks:[{type:le.FILTER,value:e}]}):he(e)?this.parse(e)||(this.invalid=!0):Qe("A selector must be created from a string; found "))},jr=Jr.prototype;[n0,l0].forEach(function(r){return be(jr,r)});jr.text=function(){return this.inputText};jr.size=function(){return this.length};jr.eq=function(r){return this[r]};jr.sameText=function(r){return!this.invalid&&!r.invalid&&this.text()===r.text()};jr.addQuery=function(r){this[this.length++]=r};jr.selector=jr.toString;var Xr={allAre:function(e){var t=new Jr(e);return this.every(function(n){return t.matches(n)})},is:function(e){var t=new Jr(e);return this.some(function(n){return t.matches(n)})},some:function(e,t){for(var n=0;n<this.length;n++){var a=t?e.apply(t,[this[n],n,this]):e(this[n],n,this);if(a)return!0}return!1},every:function(e,t){for(var n=0;n<this.length;n++){var a=t?e.apply(t,[this[n],n,this]):e(this[n],n,this);if(!a)return!1}return!0},same:function(e){if(this===e)return!0;e=this.cy().collection(e);var t=this.length,n=e.length;return t!==n?!1:t===1?this[0]===e[0]:this.every(function(a){return e.hasElementWithId(a.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(n){return t.hasElementWithId(n.id())})},contains:function(e){e=this.cy().collection(e);var t=this;return e.every(function(n){return t.hasElementWithId(n.id())})}};Xr.allAreNeighbours=Xr.allAreNeighbors;Xr.has=Xr.contains;Xr.equal=Xr.equals=Xr.same;var Qt=function(e,t){return function(a,i,o,s){var u=a,l=this,c;if(u==null?c="":qt(u)&&u.length===1&&(c=u.id()),l.length===1&&c){var f=l[0]._private,d=f.traversalCache=f.traversalCache||{},h=d[t]=d[t]||[],v=mn(c),y=h[v];return y||(h[v]=e.call(l,a,i,o,s))}else return e.call(l,a,i,o,s)}},Wn={parent:function(e){var t=[];if(this.length===1){var n=this[0]._private.parent;if(n)return n}for(var a=0;a<this.length;a++){var i=this[a],o=i._private.parent;o&&t.push(o)}return this.spawn(t,!0).filter(e)},parents:function(e){for(var t=[],n=this.parent();n.nonempty();){for(var a=0;a<n.length;a++){var i=n[a];t.push(i)}n=n.parent()}return this.spawn(t,!0).filter(e)},commonAncestors:function(e){for(var t,n=0;n<this.length;n++){var a=this[n],i=a.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:Qt(function(r){for(var e=[],t=0;t<this.length;t++)for(var n=this[t],a=n._private.children,i=0;i<a.length;i++)e.push(a[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 n(a){for(var i=0;i<a.length;i++){var o=a[i];t.push(o),o.children().nonempty()&&n(o.children())}}return n(this.children()),this.spawn(t,!0).filter(e)}};function Xu(r,e,t,n){for(var a=[],i=new Xn,o=r.cy(),s=o.hasCompoundNodes(),u=0;u<r.length;u++){var l=r[u];t?a.push(l):s&&n(a,i,l)}for(;a.length>0;){var c=a.shift();e(c),i.add(c.id()),s&&n(a,i,c)}return r}function cv(r,e,t){if(t.isParent())for(var n=t._private.children,a=0;a<n.length;a++){var i=n[a];e.has(i.id())||r.push(i)}}Wn.forEachDown=function(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return Xu(this,r,e,cv)};function fv(r,e,t){if(t.isChild()){var n=t._private.parent;e.has(n.id())||r.push(n)}}Wn.forEachUp=function(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return Xu(this,r,e,fv)};function c0(r,e,t){fv(r,e,t),cv(r,e,t)}Wn.forEachUpAndDown=function(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return Xu(this,r,e,c0)};Wn.ancestors=Wn.parents;var Da,dv;Da=dv={data:He.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:He.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:He.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:He.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:He.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:He.removeData({field:"rscratch",triggerEvent:!1}),id:function(){var e=this[0];if(e)return e._private.data.id}};Da.attr=Da.data;Da.removeAttr=Da.removeData;var f0=dv,eo={};function eu(r){return function(e){var t=this;if(e===void 0&&(e=!0),t.length!==0)if(t.isNode()&&!t.removed()){for(var n=0,a=t[0],i=a._private.edges,o=0;o<i.length;o++){var s=i[o];!e&&s.isLoop()||(n+=r(a,s))}return n}else return}}be(eo,{degree:eu(function(r,e){return e.source().same(e.target())?2:1}),indegree:eu(function(r,e){return e.target().same(r)?1:0}),outdegree:eu(function(r,e){return e.source().same(r)?1:0})});function An(r,e){return function(t){for(var n,a=this.nodes(),i=0;i<a.length;i++){var o=a[i],s=o[r](t);s!==void 0&&(n===void 0||e(s,n))&&(n=s)}return n}}be(eo,{minDegree:An("degree",function(r,e){return r<e}),maxDegree:An("degree",function(r,e){return r>e}),minIndegree:An("indegree",function(r,e){return r<e}),maxIndegree:An("indegree",function(r,e){return r>e}),minOutdegree:An("outdegree",function(r,e){return r<e}),maxOutdegree:An("outdegree",function(r,e){return r>e})});be(eo,{totalDegree:function(e){for(var t=0,n=this.nodes(),a=0;a<n.length;a++)t+=n[a].degree(e);return t}});var sr,vv,hv=function(e,t,n){for(var a=0;a<e.length;a++){var i=e[a];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,n),i.dirtyBoundingBoxCache()}}},Mf={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){hv(e,t,!1)},onSet:function(e){e.dirtyCompoundBoundsCache()},canSet:function(e){return!e.locked()}};sr=vv={position:He.data(Mf),silentPosition:He.data(be({},Mf,{allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!1,beforeSet:function(e,t){hv(e,t,!0)},onSet:function(e){e.dirtyCompoundBoundsCache()}})),positions:function(e,t){if(Ne(e))t?this.silentPosition(e):this.position(e);else if(je(e)){var n=e,a=this.cy();a.startBatch();for(var i=0;i<this.length;i++){var o=this[i],s=void 0;(s=n(o,i))&&(t?o.silentPosition(s):o.position(s))}a.endBatch()}return this},silentPositions:function(e){return this.positions(e,!0)},shift:function(e,t,n){var a;if(Ne(e)?(a={x:ae(e.x)?e.x:0,y:ae(e.y)?e.y:0},n=t):he(e)&&ae(t)&&(a={x:0,y:0},a[e]=t),a!=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 u=s.position(),l={x:u.x+a.x,y:u.y+a.y};n?s.silentPosition(l):s.position(l)}}i.endBatch()}return this},silentShift:function(e,t){return Ne(e)?this.shift(e,!0):he(e)&&ae(t)&&this.shift(e,t,!0),this},renderedPosition:function(e,t){var n=this[0],a=this.cy(),i=a.zoom(),o=a.pan(),s=Ne(e)?e:void 0,u=s!==void 0||t!==void 0&&he(e);if(n&&n.isNode())if(u)for(var l=0;l<this.length;l++){var c=this[l];t!==void 0?c.position(e,(t-o[e])/i):s!==void 0&&c.position(Gd(s,i,o))}else{var f=n.position();return s=Yi(f,i,o),e===void 0?s:s[e]}else if(!u)return;return this},relativePosition:function(e,t){var n=this[0],a=this.cy(),i=Ne(e)?e:void 0,o=i!==void 0||t!==void 0&&he(e),s=a.hasCompoundNodes();if(n&&n.isNode())if(o)for(var u=0;u<this.length;u++){var l=this[u],c=s?l.parent():null,f=c&&c.length>0,d=f;f&&(c=c[0]);var h=d?c.position():{x:0,y:0};t!==void 0?l.position(e,t+h[e]):i!==void 0&&l.position({x:i.x+h.x,y:i.y+h.y})}else{var v=n.position(),y=s?n.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:v.x-m.x,y:v.y-m.y},e===void 0?i:i[e]}else if(!o)return;return this}};sr.modelPosition=sr.point=sr.position;sr.modelPositions=sr.points=sr.positions;sr.renderedPoint=sr.renderedPosition;sr.relativePoint=sr.relativePosition;var d0=vv,Hn,nn;Hn=nn={};nn.renderedBoundingBox=function(r){var e=this.boundingBox(r),t=this.cy(),n=t.zoom(),a=t.pan(),i=e.x1*n+a.x,o=e.x2*n+a.x,s=e.y1*n+a.y,u=e.y2*n+a.y;return{x1:i,x2:o,y1:s,y2:u,w:o-i,h:u-s}};nn.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 n=t._private;n.compoundBoundsClean=!1,n.bbCache=null,r||t.emitAndNotify("bounds")}}),this)};nn.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,u=o.children(),l=o.pstyle("compound-sizing-wrt-labels").value==="include",c={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=u.boundingBox({includeLabels:l,includeOverlays:!1,useCache:!1}),d=s.position;(f.w===0||f.h===0)&&(f={w:o.pstyle("width").pfValue,h:o.pstyle("height").pfValue},f.x1=d.x-f.w/2,f.x2=d.x+f.w/2,f.y1=d.y-f.h/2,f.y2=d.y+f.h/2);function h(_,C,T){var D=0,A=0,R=C+T;return _>0&&R>0&&(D=C/R*_,A=T/R*_),{biasDiff:D,biasComplementDiff:A}}function v(_,C,T,D){if(T.units==="%")switch(D){case"width":return _>0?T.pfValue*_:0;case"height":return C>0?T.pfValue*C:0;case"average":return _>0&&C>0?T.pfValue*(_+C)/2:0;case"min":return _>0&&C>0?_>C?T.pfValue*C:T.pfValue*_:0;case"max":return _>0&&C>0?_>C?T.pfValue*_:T.pfValue*C:0;default:return 0}else return T.units==="px"?T.pfValue:0}var y=c.width.left.value;c.width.left.units==="px"&&c.width.val>0&&(y=y*100/c.width.val);var g=c.width.right.value;c.width.right.units==="px"&&c.width.val>0&&(g=g*100/c.width.val);var p=c.height.top.value;c.height.top.units==="px"&&c.height.val>0&&(p=p*100/c.height.val);var m=c.height.bottom.value;c.height.bottom.units==="px"&&c.height.val>0&&(m=m*100/c.height.val);var b=h(c.width.val-f.w,y,g),x=b.biasDiff,E=b.biasComplementDiff,S=h(c.height.val-f.h,p,m),w=S.biasDiff,k=S.biasComplementDiff;s.autoPadding=v(f.w,f.h,o.pstyle("padding"),o.pstyle("padding-relative-to").value),s.autoWidth=Math.max(f.w,c.width.val),d.x=(-x+f.x1+f.x2+E)/2,s.autoHeight=Math.max(f.h,c.height.val),d.y=(-w+f.y1+f.y2+k)/2}for(var n=0;n<this.length;n++){var a=this[n],i=a._private;(!i.compoundBoundsClean||r)&&(t(a),e.batching()||(i.compoundBoundsClean=!0))}return this};var Zt=function(e){return e===1/0||e===-1/0?0:e},or=function(e,t,n,a,i){a-t===0||i-n===0||t==null||n==null||a==null||i==null||(e.x1=t<e.x1?t:e.x1,e.x2=a>e.x2?a:e.x2,e.y1=n<e.y1?n:e.y1,e.y2=i>e.y2?i:e.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1)},Hr=function(e,t){return t==null?e:or(e,t.x1,t.y1,t.x2,t.y2)},da=function(e,t,n){return zt(e,t,n)},vi=function(e,t,n){if(!t.cy().headless()){var a=t._private,i=a.rstyle,o=i.arrowWidth/2,s=t.pstyle(n+"-arrow-shape").value,u,l;if(s!=="none"){n==="source"?(u=i.srcX,l=i.srcY):n==="target"?(u=i.tgtX,l=i.tgtY):(u=i.midX,l=i.midY);var c=a.arrowBounds=a.arrowBounds||{},f=c[n]=c[n]||{};f.x1=u-o,f.y1=l-o,f.x2=u+o,f.y2=l+o,f.w=f.x2-f.x1,f.h=f.y2-f.y1,wi(f,1),or(e,f.x1,f.y1,f.x2,f.y2)}}},tu=function(e,t,n){if(!t.cy().headless()){var a;n?a=n+"-":a="";var i=t._private,o=i.rstyle,s=t.pstyle(a+"label").strValue;if(s){var u=t.pstyle("text-halign"),l=t.pstyle("text-valign"),c=da(o,"labelWidth",n),f=da(o,"labelHeight",n),d=da(o,"labelX",n),h=da(o,"labelY",n),v=t.pstyle(a+"text-margin-x").pfValue,y=t.pstyle(a+"text-margin-y").pfValue,g=t.isEdge(),p=t.pstyle(a+"text-rotation"),m=t.pstyle("text-outline-width").pfValue,b=t.pstyle("text-border-width").pfValue,x=b/2,E=t.pstyle("text-background-padding").pfValue,S=2,w=f,k=c,_=k/2,C=w/2,T,D,A,R;if(g)T=d-_,D=d+_,A=h-C,R=h+C;else{switch(u.value){case"left":T=d-k,D=d;break;case"center":T=d-_,D=d+_;break;case"right":T=d,D=d+k;break}switch(l.value){case"top":A=h-w,R=h;break;case"center":A=h-C,R=h+C;break;case"bottom":A=h,R=h+w;break}}var M=v-Math.max(m,x)-E-S,L=v+Math.max(m,x)+E+S,B=y-Math.max(m,x)-E-S,I=y+Math.max(m,x)+E+S;T+=M,D+=L,A+=B,R+=I;var H=n||"main",q=i.labelBounds,N=q[H]=q[H]||{};N.x1=T,N.y1=A,N.x2=D,N.y2=R,N.w=D-T,N.h=R-A,N.leftPad=M,N.rightPad=L,N.topPad=B,N.botPad=I;var G=g&&p.strValue==="autorotate",X=p.pfValue!=null&&p.pfValue!==0;if(G||X){var j=G?da(i.rstyle,"labelAngle",n):p.pfValue,Q=Math.cos(j),Z=Math.sin(j),te=(T+D)/2,ne=(A+R)/2;if(!g){switch(u.value){case"left":te=D;break;case"right":te=T;break}switch(l.value){case"top":ne=R;break;case"bottom":ne=A;break}}var $=function(pe,ye){return pe=pe-te,ye=ye-ne,{x:pe*Q-ye*Z+te,y:pe*Z+ye*Q+ne}},O=$(T,A),z=$(T,R),V=$(D,A),W=$(D,R);T=Math.min(O.x,z.x,V.x,W.x),D=Math.max(O.x,z.x,V.x,W.x),A=Math.min(O.y,z.y,V.y,W.y),R=Math.max(O.y,z.y,V.y,W.y)}var re=H+"Rot",se=q[re]=q[re]||{};se.x1=T,se.y1=A,se.x2=D,se.y2=R,se.w=D-T,se.h=R-A,or(e,T,A,D,R),or(i.labelBounds.all,T,A,D,R)}return e}},Rf=function(e,t){if(!t.cy().headless()){var n=t.pstyle("outline-opacity").value,a=t.pstyle("outline-width").value,i=t.pstyle("outline-offset").value,o=a+i;pv(e,t,n,o,"outside",o/2)}},pv=function(e,t,n,a,i,o){if(!(n===0||a<=0||i==="inside")){var s=t.cy(),u=s.renderer(),l=u.nodeShapes[u.getNodeShape(t)];if(l){var c=t.position(),f=c.x,d=c.y,h=t.width(),v=t.height();if(l.hasMiterBounds){i==="center"&&(a/=2);var y=l.miterBounds(f,d,h,v,a);Hr(e,y)}else o!=null&&o>0&&Ei(e,[o,o,o,o])}}},v0=function(e,t){if(!t.cy().headless()){var n=t.pstyle("border-opacity").value,a=t.pstyle("border-width").pfValue,i=t.pstyle("border-position").value;pv(e,t,n,a,i)}},h0=function(e,t){var n=e._private.cy,a=n.styleEnabled(),i=n.headless(),o=Rt(),s=e._private,u=e.isNode(),l=e.isEdge(),c,f,d,h,v,y,g=s.rstyle,p=u&&a?e.pstyle("bounds-expansion").pfValue:[0],m=function(Ce){return Ce.pstyle("display").value!=="none"},b=!a||m(e)&&(!l||m(e.source())&&m(e.target()));if(b){var x=0,E=0;a&&t.includeOverlays&&(x=e.pstyle("overlay-opacity").value,x!==0&&(E=e.pstyle("overlay-padding").value));var S=0,w=0;a&&t.includeUnderlays&&(S=e.pstyle("underlay-opacity").value,S!==0&&(w=e.pstyle("underlay-padding").value));var k=Math.max(E,w),_=0,C=0;if(a&&(_=e.pstyle("width").pfValue,C=_/2),u&&t.includeNodes){var T=e.position();v=T.x,y=T.y;var D=e.outerWidth(),A=D/2,R=e.outerHeight(),M=R/2;c=v-A,f=v+A,d=y-M,h=y+M,or(o,c,d,f,h),a&&Rf(o,e),a&&t.includeOutlines&&!i&&Rf(o,e),a&&v0(o,e)}else if(l&&t.includeEdges)if(a&&!i){var L=e.pstyle("curve-style").strValue;if(c=Math.min(g.srcX,g.midX,g.tgtX),f=Math.max(g.srcX,g.midX,g.tgtX),d=Math.min(g.srcY,g.midY,g.tgtY),h=Math.max(g.srcY,g.midY,g.tgtY),c-=C,f+=C,d-=C,h+=C,or(o,c,d,f,h),L==="haystack"){var B=g.haystackPts;if(B&&B.length===2){if(c=B[0].x,d=B[0].y,f=B[1].x,h=B[1].y,c>f){var I=c;c=f,f=I}if(d>h){var H=d;d=h,h=H}or(o,c-C,d-C,f+C,h+C)}}else if(L==="bezier"||L==="unbundled-bezier"||$r(L,"segments")||$r(L,"taxi")){var q;switch(L){case"bezier":case"unbundled-bezier":q=g.bezierPts;break;case"segments":case"taxi":case"round-segments":case"round-taxi":q=g.linePts;break}if(q!=null)for(var N=0;N<q.length;N++){var G=q[N];c=G.x-C,f=G.x+C,d=G.y-C,h=G.y+C,or(o,c,d,f,h)}}}else{var X=e.source(),j=X.position(),Q=e.target(),Z=Q.position();if(c=j.x,f=Z.x,d=j.y,h=Z.y,c>f){var te=c;c=f,f=te}if(d>h){var ne=d;d=h,h=ne}c-=C,f+=C,d-=C,h+=C,or(o,c,d,f,h)}if(a&&t.includeEdges&&l&&(vi(o,e,"mid-source"),vi(o,e,"mid-target"),vi(o,e,"source"),vi(o,e,"target")),a){var $=e.pstyle("ghost").value==="yes";if($){var O=e.pstyle("ghost-offset-x").pfValue,z=e.pstyle("ghost-offset-y").pfValue;or(o,o.x1+O,o.y1+z,o.x2+O,o.y2+z)}}var V=s.bodyBounds=s.bodyBounds||{};gc(V,o),Ei(V,p),wi(V,1),a&&(c=o.x1,f=o.x2,d=o.y1,h=o.y2,or(o,c-k,d-k,f+k,h+k));var W=s.overlayBounds=s.overlayBounds||{};gc(W,o),Ei(W,p),wi(W,1);var re=s.labelBounds=s.labelBounds||{};re.all!=null?Kg(re.all):re.all=Rt(),a&&t.includeLabels&&(t.includeMainLabels&&tu(o,e,null),l&&(t.includeSourceLabels&&tu(o,e,"source"),t.includeTargetLabels&&tu(o,e,"target")))}return o.x1=Zt(o.x1),o.y1=Zt(o.y1),o.x2=Zt(o.x2),o.y2=Zt(o.y2),o.w=Zt(o.x2-o.x1),o.h=Zt(o.y2-o.y1),o.w>0&&o.h>0&&b&&(Ei(o,p),wi(o,1)),o},gv=function(e){var t=0,n=function(o){return(o?1:0)<<t++},a=0;return a+=n(e.incudeNodes),a+=n(e.includeEdges),a+=n(e.includeLabels),a+=n(e.includeMainLabels),a+=n(e.includeSourceLabels),a+=n(e.includeTargetLabels),a+=n(e.includeOverlays),a+=n(e.includeOutlines),a},yv=function(e){var t=function(s){return Math.round(s)};if(e.isEdge()){var n=e.source().position(),a=e.target().position();return cc([t(n.x),t(n.y),t(a.x),t(a.y)])}else{var i=e.position();return cc([t(i.x),t(i.y)])}},Bf=function(e,t){var n=e._private,a,i=e.isEdge(),o=t==null?Lf:gv(t),s=o===Lf;if(n.bbCache==null?(a=h0(e,Aa),n.bbCache=a,n.bbCachePosKey=yv(e)):a=n.bbCache,!s){var u=e.isNode();a=Rt(),(t.includeNodes&&u||t.includeEdges&&!u)&&(t.includeOverlays?Hr(a,n.overlayBounds):Hr(a,n.bodyBounds)),t.includeLabels&&(t.includeMainLabels&&(!i||t.includeSourceLabels&&t.includeTargetLabels)?Hr(a,n.labelBounds.all):(t.includeMainLabels&&Hr(a,n.labelBounds.mainRot),t.includeSourceLabels&&Hr(a,n.labelBounds.sourceRot),t.includeTargetLabels&&Hr(a,n.labelBounds.targetRot))),a.w=a.x2-a.x1,a.h=a.y2-a.y1}return a},Aa={includeNodes:!0,includeEdges:!0,includeLabels:!0,includeMainLabels:!0,includeSourceLabels:!0,includeTargetLabels:!0,includeOverlays:!0,includeUnderlays:!0,includeOutlines:!0,useCache:!0},Lf=gv(Aa),Of=Et(Aa);nn.boundingBox=function(r){var e,t=r===void 0||r.useCache===void 0||r.useCache===!0,n=$n(function(c){var f=c._private;return f.bbCache==null||f.styleDirty||f.bbCachePosKey!==yv(c)},function(c){return c.id()});if(t&&this.length===1&&!n(this[0]))r===void 0?r=Aa:r=Of(r),e=Bf(this[0],r);else{e=Rt(),r=r||Aa;var a=Of(r),i=this,o=i.cy(),s=o.styleEnabled();this.edges().forEach(n),this.nodes().forEach(n),s&&this.recalculateRenderedStyle(t),this.updateCompoundBounds(!t);for(var u=0;u<i.length;u++){var l=i[u];n(l)&&l.dirtyBoundingBoxCache(),Hr(e,Bf(l,a))}}return e.x1=Zt(e.x1),e.y1=Zt(e.y1),e.x2=Zt(e.x2),e.y2=Zt(e.y2),e.w=Zt(e.x2-e.x1),e.h=Zt(e.y2-e.y1),e};nn.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};nn.boundingBoxAt=function(r){var e=this.nodes(),t=this.cy(),n=t.hasCompoundNodes(),a=t.collection();if(n&&(a=e.filter(function(l){return l.isParent()}),e=e.not(a)),Ne(r)){var i=r;r=function(){return i}}var o=function(c,f){return c._private.bbAtOldPos=r(c,f)},s=function(c){return c._private.bbAtOldPos};t.startBatch(),e.forEach(o).silentPositions(r),n&&(a.dirtyCompoundBoundsCache(),a.dirtyBoundingBoxCache(),a.updateCompoundBounds(!0));var u=Yg(this.boundingBox({useCache:!1}));return e.silentPositions(s),n&&(a.dirtyCompoundBoundsCache(),a.dirtyBoundingBoxCache(),a.updateCompoundBounds(!0)),t.endBatch(),u};Hn.boundingbox=Hn.bb=Hn.boundingBox;Hn.renderedBoundingbox=Hn.renderedBoundingBox;var p0=nn,ba,qa;ba=qa={};var mv=function(e){e.uppercaseName=Kl(e.name),e.autoName="auto"+e.uppercaseName,e.labelName="label"+e.uppercaseName,e.outerName="outer"+e.uppercaseName,e.uppercaseOuterName=Kl(e.outerName),ba[e.name]=function(){var n=this[0],a=n._private,i=a.cy,o=i._private.styleEnabled;if(n)if(o){if(n.isParent())return n.updateCompoundBounds(),a[e.autoName]||0;var s=n.pstyle(e.name);return s.strValue==="label"?(n.recalculateRenderedStyle(),a.rstyle[e.labelName]||0):s.pfValue}else return 1},ba["outer"+e.uppercaseName]=function(){var n=this[0],a=n._private,i=a.cy,o=i._private.styleEnabled;if(n)if(o){var s=n[e.name](),u=n.pstyle("border-position").value,l;u==="center"?l=n.pstyle("border-width").pfValue:u==="outside"?l=2*n.pstyle("border-width").pfValue:l=0;var c=2*n.padding();return s+l+c}else return 1},ba["rendered"+e.uppercaseName]=function(){var n=this[0];if(n){var a=n[e.name]();return a*this.cy().zoom()}},ba["rendered"+e.uppercaseOuterName]=function(){var n=this[0];if(n){var a=n[e.outerName]();return a*this.cy().zoom()}}};mv({name:"width"});mv({name:"height"});qa.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};qa.paddedHeight=function(){var r=this[0];return r.height()+2*r.padding()};qa.paddedWidth=function(){var r=this[0];return r.width()+2*r.padding()};var g0=qa,y0=function(e,t){if(e.isEdge()&&e.takesUpSpace())return t(e)},m0=function(e,t){if(e.isEdge()&&e.takesUpSpace()){var n=e.cy();return Yi(t(e),n.zoom(),n.pan())}},b0=function(e,t){if(e.isEdge()&&e.takesUpSpace()){var n=e.cy(),a=n.pan(),i=n.zoom();return t(e).map(function(o){return Yi(o,i,a)})}},x0=function(e){return e.renderer().getControlPoints(e)},w0=function(e){return e.renderer().getSegmentPoints(e)},E0=function(e){return e.renderer().getSourceEndpoint(e)},C0=function(e){return e.renderer().getTargetEndpoint(e)},S0=function(e){return e.renderer().getEdgeMidpoint(e)},If={controlPoints:{get:x0,mult:!0},segmentPoints:{get:w0,mult:!0},sourceEndpoint:{get:E0},targetEndpoint:{get:C0},midpoint:{get:S0}},k0=function(e){return"rendered"+e[0].toUpperCase()+e.substr(1)},T0=Object.keys(If).reduce(function(r,e){var t=If[e],n=k0(e);return r[e]=function(){return y0(this,t.get)},t.mult?r[n]=function(){return b0(this,t.get)}:r[n]=function(){return m0(this,t.get)},r},{}),_0=be({},d0,p0,g0,T0);var bv=function(e,t){this.recycle(e,t)};function va(){return!1}function hi(){return!0}bv.prototype={instanceString:function(){return"event"},recycle:function(e,t){if(this.isImmediatePropagationStopped=this.isPropagationStopped=this.isDefaultPrevented=va,e!=null&&e.preventDefault?(this.type=e.type,this.isDefaultPrevented=e.defaultPrevented?hi:va):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 n=this.position,a=this.cy.zoom(),i=this.cy.pan();this.renderedPosition={x:n.x*a+i.x,y:n.y*a+i.y}}this.timeStamp=e&&e.timeStamp||Date.now()},preventDefault:function(){this.isDefaultPrevented=hi;var e=this.originalEvent;e&&e.preventDefault&&e.preventDefault()},stopPropagation:function(){this.isPropagationStopped=hi;var e=this.originalEvent;e&&e.stopPropagation&&e.stopPropagation()},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=hi,this.stopPropagation()},isDefaultPrevented:va,isPropagationStopped:va,isImmediatePropagationStopped:va};var xv=/^([^.]+)(\.(?:[^.]+))?$/,P0=".*",wv={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},Nf=Object.keys(wv),D0={};function to(){for(var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:D0,e=arguments.length>1?arguments[1]:void 0,t=0;t<Nf.length;t++){var n=Nf[t];this[n]=r[n]||wv[n]}this.context=e||this.context,this.listeners=[],this.emitting=0}var en=to.prototype,Ev=function(e,t,n,a,i,o,s){je(a)&&(i=a,a=null),s&&(o==null?o=s:o=be({},o,s));for(var u=We(n)?n:n.split(/\s+/),l=0;l<u.length;l++){var c=u[l];if(!Kr(c)){var f=c.match(xv);if(f){var d=f[1],h=f[2]?f[2]:null,v=t(e,c,d,h,a,i,o);if(v===!1)break}}}},zf=function(e,t){return e.addEventFields(e.context,t),new bv(t.type,t)},A0=function(e,t,n){if(Ip(n)){t(e,n);return}else if(Ne(n)){t(e,zf(e,n));return}for(var a=We(n)?n:n.split(/\s+/),i=0;i<a.length;i++){var o=a[i];if(!Kr(o)){var s=o.match(xv);if(s){var u=s[1],l=s[2]?s[2]:null,c=zf(e,{type:u,namespace:l,target:e.context});t(e,c)}}}};en.on=en.addListener=function(r,e,t,n,a){return Ev(this,function(i,o,s,u,l,c,f){je(c)&&i.listeners.push({event:o,callback:c,type:s,namespace:u,qualifier:l,conf:f})},r,e,t,n,a),this};en.one=function(r,e,t,n){return this.on(r,e,t,n,{one:!0})};en.removeListener=en.off=function(r,e,t,n){var a=this;this.emitting!==0&&(this.listeners=mg(this.listeners));for(var i=this.listeners,o=function(l){var c=i[l];Ev(a,function(f,d,h,v,y,g){if((c.type===h||r==="*")&&(!v&&c.namespace!==".*"||c.namespace===v)&&(!y||f.qualifierCompare(c.qualifier,y))&&(!g||c.callback===g))return i.splice(l,1),!1},r,e,t,n)},s=i.length-1;s>=0;s--)o(s);return this};en.removeAllListeners=function(){return this.removeListener("*")};en.emit=en.trigger=function(r,e,t){var n=this.listeners,a=n.length;return this.emitting++,We(e)||(e=[e]),A0(this,function(i,o){t!=null&&(n=[{event:o.event,type:o.type,namespace:o.namespace,callback:t}],a=n.length);for(var s=function(){var c=n[u];if(c.type===o.type&&(!c.namespace||c.namespace===o.namespace||c.namespace===P0)&&i.eventMatches(i.context,c,o)){var f=[o];e!=null&&xg(f,e),i.beforeEmit(i.context,c,o),c.conf&&c.conf.one&&(i.listeners=i.listeners.filter(function(v){return v!==c}));var d=i.callbackContext(i.context,c,o),h=c.callback.apply(d,f);i.afterEmit(i.context,c,o),h===!1&&(o.stopPropagation(),o.preventDefault())}},u=0;u<a;u++)s();i.bubble(i.context)&&!o.isPropagationStopped()&&i.parent(i.context).emit(o,e)},r),this.emitting--,this};var M0={qualifierCompare:function(e,t){return e==null||t==null?e==null&&t==null:e.sameText(t)},eventMatches:function(e,t,n){var a=t.qualifier;return a!=null?e!==n.target&&Oa(n.target)&&a.matches(n.target):!0},addEventFields:function(e,t){t.cy=e.cy(),t.target=e},callbackContext:function(e,t,n){return t.qualifier!=null?n.target:e},beforeEmit:function(e,t){t.conf&&t.conf.once&&t.conf.onceCollection.removeListener(t.event,t.qualifier,t.callback)},bubble:function(){return!0},parent:function(e){return e.isChild()?e.parent():e.cy()}},pi=function(e){return he(e)?new Jr(e):e},Cv={createEmitter:function(){for(var e=0;e<this.length;e++){var t=this[e],n=t._private;n.emitter||(n.emitter=new to(M0,t))}return this},emitter:function(){return this._private.emitter},on:function(e,t,n){for(var a=pi(t),i=0;i<this.length;i++){var o=this[i];o.emitter().on(e,a,n)}return this},removeListener:function(e,t,n){for(var a=pi(t),i=0;i<this.length;i++){var o=this[i];o.emitter().removeListener(e,a,n)}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,n){for(var a=pi(t),i=0;i<this.length;i++){var o=this[i];o.emitter().one(e,a,n)}return this},once:function(e,t,n){for(var a=pi(t),i=0;i<this.length;i++){var o=this[i];o.emitter().on(e,a,n,{once:!0,onceCollection:this})}},emit:function(e,t){for(var n=0;n<this.length;n++){var a=this[n];a.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}};He.eventAliasesOn(Cv);var Sv={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(),n=0;n<this.length;n++){var a=this[n];a.isNode()?e.push(a):t.push(a)}return{nodes:e,edges:t}},filter:function(e,t){if(e===void 0)return this;if(he(e)||qt(e))return new Jr(e).filter(this);if(je(e)){for(var n=this.spawn(),a=this,i=0;i<a.length;i++){var o=a[i],s=t?e.apply(t,[o,i,a]):e(o,i,a);s&&n.push(o)}return n}return this.spawn()},not:function(e){if(e){he(e)&&(e=this.filter(e));for(var t=this.spawn(),n=0;n<this.length;n++){var a=this[n],i=e.has(a);i||t.push(a)}return t}else return this},absoluteComplement:function(){var e=this.cy();return e.mutableElements().not(this)},intersect:function(e){if(he(e)){var t=e;return this.filter(t)}for(var n=this.spawn(),a=this,i=e,o=this.length<e.length,s=o?a:i,u=o?i:a,l=0;l<s.length;l++){var c=s[l];u.has(c)&&n.push(c)}return n},xor:function(e){var t=this._private.cy;he(e)&&(e=t.$(e));var n=this.spawn(),a=this,i=e,o=function(u,l){for(var c=0;c<u.length;c++){var f=u[c],d=f._private.data.id,h=l.hasElementWithId(d);h||n.push(f)}};return o(a,i),o(i,a),n},diff:function(e){var t=this._private.cy;he(e)&&(e=t.$(e));var n=this.spawn(),a=this.spawn(),i=this.spawn(),o=this,s=e,u=function(c,f,d){for(var h=0;h<c.length;h++){var v=c[h],y=v._private.data.id,g=f.hasElementWithId(y);g?i.merge(v):d.push(v)}};return u(o,s,n),u(s,o,a),{left:n,right:a,both:i}},add:function(e){var t=this._private.cy;if(!e)return this;if(he(e)){var n=e;e=t.mutableElements().filter(n)}for(var a=this.spawnSelf(),i=0;i<e.length;i++){var o=e[i],s=!this.has(o);s&&a.push(o)}return a},merge:function(e){var t=this._private,n=t.cy;if(!e)return this;if(e&&he(e)){var a=e;e=n.mutableElements().filter(a)}for(var i=t.map,o=0;o<e.length;o++){var s=e[o],u=s._private.data.id,l=!i.has(u);if(l){var c=this.length++;this[c]=s,i.set(u,{ele:s,index:c})}}return this},unmergeAt:function(e){var t=this[e],n=t.id(),a=this._private,i=a.map;this[e]=void 0,i.delete(n);var o=e===this.length-1;if(this.length>1&&!o){var s=this.length-1,u=this[s],l=u._private.data.id;this[s]=void 0,this[e]=u,i.set(l,{ele:u,index:e})}return this.length--,this},unmergeOne:function(e){e=e[0];var t=this._private,n=e._private.data.id,a=t.map,i=a.get(n);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&&he(e)){var n=e;e=t.mutableElements().filter(n)}for(var a=0;a<e.length;a++)this.unmergeOne(e[a]);return this},unmergeBy:function(e){for(var t=this.length-1;t>=0;t--){var n=this[t];e(n)&&this.unmergeAt(t)}return this},map:function(e,t){for(var n=[],a=this,i=0;i<a.length;i++){var o=a[i],s=t?e.apply(t,[o,i,a]):e(o,i,a);n.push(s)}return n},reduce:function(e,t){for(var n=t,a=this,i=0;i<a.length;i++)n=e(n,a[i],i,a);return n},max:function(e,t){for(var n=-1/0,a,i=this,o=0;o<i.length;o++){var s=i[o],u=t?e.apply(t,[s,o,i]):e(s,o,i);u>n&&(n=u,a=s)}return{value:n,ele:a}},min:function(e,t){for(var n=1/0,a,i=this,o=0;o<i.length;o++){var s=i[o],u=t?e.apply(t,[s,o,i]):e(s,o,i);u<n&&(n=u,a=s)}return{value:n,ele:a}}},Fe=Sv;Fe.u=Fe["|"]=Fe["+"]=Fe.union=Fe.or=Fe.add;Fe["\\"]=Fe["!"]=Fe["-"]=Fe.difference=Fe.relativeComplement=Fe.subtract=Fe.not;Fe.n=Fe["&"]=Fe["."]=Fe.and=Fe.intersection=Fe.intersect;Fe["^"]=Fe["(+)"]=Fe["(-)"]=Fe.symmetricDifference=Fe.symdiff=Fe.xor;Fe.fnFilter=Fe.filterFn=Fe.stdFilter=Fe.filter;Fe.complement=Fe.abscomp=Fe.absoluteComplement;var R0={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}},kv=function(e,t){var n=e.cy(),a=n.hasCompoundNodes();function i(c){var f=c.pstyle("z-compound-depth");return f.value==="auto"?a?c.zDepth():0:f.value==="bottom"?-1:f.value==="top"?Iu:0}var o=i(e)-i(t);if(o!==0)return o;function s(c){var f=c.pstyle("z-index-compare");return f.value==="auto"&&c.isNode()?1:0}var u=s(e)-s(t);if(u!==0)return u;var l=e.pstyle("z-index").value-t.pstyle("z-index").value;return l!==0?l:e.poolIndex()-t.poolIndex()},zi={forEach:function(e,t){if(je(e))for(var n=this.length,a=0;a<n;a++){var i=this[a],o=t?e.apply(t,[i,a,this]):e(i,a,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 n=[],a=this.length;t==null&&(t=a),e==null&&(e=0),e<0&&(e=a+e),t<0&&(t=a+t);for(var i=e;i>=0&&i<t&&i<a;i++)n.push(this[i]);return this.spawn(n)},size:function(){return this.length},eq:function(e){return this[e]||this.spawn()},first:function(){return this[0]||this.spawn()},last:function(){return this[this.length-1]||this.spawn()},empty:function(){return this.length===0},nonempty:function(){return!this.empty()},sort:function(e){if(!je(e))return this;var t=this.toArray().sort(e);return this.spawn(t)},sortByZIndex:function(){return this.sort(kv)},zDepth:function(){var e=this[0];if(e){var t=e._private,n=t.group;if(n==="nodes"){var a=t.data.parent?e.parents().size():0;return e.isParent()?a:Iu-1}else{var i=t.source,o=t.target,s=i.zDepth(),u=o.zDepth();return Math.max(s,u,0)}}}};zi.each=zi.forEach;var B0=function(){var e="undefined",t=(typeof Symbol>"u"?"undefined":dt(Symbol))!=e&&dt(Symbol.iterator)!=e;t&&(zi[Symbol.iterator]=function(){var n=this,a={value:void 0,done:!1},i=0,o=this.length;return Cd({next:function(){return i<o?a.value=n[i++]:(a.value=void 0,a.done=!0),a}},Symbol.iterator,function(){return this})})};B0();var L0=Et({nodeDimensionsIncludeLabels:!1}),Si={layoutDimensions:function(e){e=L0(e);var t;if(!this.takesUpSpace())t={w:0,h:0};else if(e.nodeDimensionsIncludeLabels){var n=this.boundingBox();t={w:n.w,h:n.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,n){var a=this.nodes().filter(function(E){return!E.isParent()}),i=this.cy(),o=t.eles,s=function(S){return S.id()},u=$n(n,s);e.emit({type:"layoutstart",layout:e}),e.animations=[];var l=function(S,w,k){var _={x:w.x1+w.w/2,y:w.y1+w.h/2},C={x:(k.x-_.x)*S,y:(k.y-_.y)*S};return{x:_.x+C.x,y:_.y+C.y}},c=t.spacingFactor&&t.spacingFactor!==1,f=function(){if(!c)return null;for(var S=Rt(),w=0;w<a.length;w++){var k=a[w],_=u(k,w);Hd(S,_.x,_.y)}return S},d=f(),h=$n(function(E,S){var w=u(E,S);if(c){var k=Math.abs(t.spacingFactor);w=l(k,d,w)}return t.transform!=null&&(w=t.transform(E,w)),w},s);if(t.animate){for(var v=0;v<a.length;v++){var y=a[v],g=h(y,v),p=t.animateFilter==null||t.animateFilter(y,v);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(h),padding:t.padding},duration:t.animationDuration,easing:t.animationEasing});e.animations.push(b)}else if(t.zoom!==void 0&&t.pan!==void 0){var x=i.animation({zoom:t.zoom,pan:t.pan,duration:t.animationDuration,easing:t.animationEasing});e.animations.push(x)}e.animations.forEach(function(E){return E.play()}),e.one("layoutready",t.ready),e.emit({type:"layoutready",layout:e}),Yn.all(e.animations.map(function(E){return E.promise()})).then(function(){e.one("layoutstop",t.stop),e.emit({type:"layoutstop",layout:e})})}else a.positions(h),t.fit&&i.fit(t.eles,t.padding),t.zoom!=null&&i.zoom(t.zoom),t.pan&&i.pan(t.pan),e.one("layoutready",t.ready),e.emit({type:"layoutready",layout:e}),e.one("layoutstop",t.stop),e.emit({type:"layoutstop",layout:e});return this},layout:function(e){var t=this.cy();return t.makeLayout(be({},e,{eles:this}))}};Si.createLayout=Si.makeLayout=Si.layout;function Tv(r,e,t){var n=t._private,a=n.styleCache=n.styleCache||[],i;return(i=a[r])!=null||(i=a[r]=e(t)),i}function ro(r,e){return r=mn(r),function(n){return Tv(r,e,n)}}function no(r,e){r=mn(r);var t=function(a){return e.call(a)};return function(){var a=this[0];if(a)return Tv(r,t,a)}}var xt={recalculateRenderedStyle:function(e){var t=this.cy(),n=t.renderer(),a=t.styleEnabled();return n&&a&&n.recalculateRenderedStyle(this,e),this},dirtyStyleCache:function(){var e=this.cy(),t=function(i){return i._private.styleCache=null};if(e.hasCompoundNodes()){var n;n=this.spawnSelf().merge(this.descendants()).merge(this.parents()),n.merge(n.connectedEdges()),n.forEach(t)}else this.forEach(function(a){t(a),a.connectedEdges().forEach(t)});return this},updateStyle:function(e){var t=this._private.cy;if(!t.styleEnabled())return this;if(t.batching()){var n=t._private.batchStyleEles;return n.merge(this),this}var a=t.hasCompoundNodes(),i=this;e=!!(e||e===void 0),a&&(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 n=this[t];n._private.styleDirty&&(n._private.styleDirty=!1,e.style().apply(n))}},parsedStyle:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=this[0],a=n.cy();if(a.styleEnabled()&&n){n._private.styleDirty&&(n._private.styleDirty=!1,a.style().apply(n));var i=n._private.style[e];return i??(t?a.style().getDefaultProperty(e):null)}},numericStyle:function(e){var t=this[0];if(t.cy().styleEnabled()&&t){var n=t.pstyle(e);return n.pfValue!==void 0?n.pfValue:n.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 n=this[0];if(n)return t.style().getRenderedStyle(n,e)},style:function(e,t){var n=this.cy();if(!n.styleEnabled())return this;var a=!1,i=n.style();if(Ne(e)){var o=e;i.applyBypass(this,o,a),this.emitAndNotify("style")}else if(he(e))if(t===void 0){var s=this[0];return s?i.getStylePropertyValue(s,e):void 0}else i.applyBypass(this,e,t,a),this.emitAndNotify("style");else if(e===void 0){var u=this[0];return u?i.getRawStyle(u):void 0}return this},removeStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var n=!1,a=t.style(),i=this;if(e===void 0)for(var o=0;o<i.length;o++){var s=i[o];a.removeAllBypasses(s,n)}else{e=e.split(/\s+/);for(var u=0;u<i.length;u++){var l=i[u];a.removeBypasses(l,e,n)}}return this.emitAndNotify("style"),this},show:function(){return this.css("display","element"),this},hide:function(){return this.css("display","none"),this},effectiveOpacity:function(){var e=this.cy();if(!e.styleEnabled())return 1;var t=e.hasCompoundNodes(),n=this[0];if(n){var a=n._private,i=n.pstyle("opacity").value;if(!t)return i;var o=a.data.parent?n.parents():null;if(o)for(var s=0;s<o.length;s++){var u=o[s],l=u.pstyle("opacity").value;i=l*i}return i}},transparent:function(){var e=this.cy();if(!e.styleEnabled())return!1;var t=this[0],n=t.cy().hasCompoundNodes();if(t)return n?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 ru(r,e){var t=r._private,n=t.data.parent?r.parents():null;if(n)for(var a=0;a<n.length;a++){var i=n[a];if(!e(i))return!1}return!0}function Yu(r){var e=r.ok,t=r.edgeOkViaNode||r.ok,n=r.parentOk||r.ok;return function(){var a=this.cy();if(!a.styleEnabled())return!0;var i=this[0],o=a.hasCompoundNodes();if(i){var s=i._private;if(!e(i))return!1;if(i.isNode())return!o||ru(i,n);var u=s.source,l=s.target;return t(u)&&(!o||ru(u,t))&&(u===l||t(l)&&(!o||ru(l,t)))}}}var Kn=ro("eleTakesUpSpace",function(r){return r.pstyle("display").value==="element"&&r.width()!==0&&(r.isNode()?r.height()!==0:!0)});xt.takesUpSpace=no("takesUpSpace",Yu({ok:Kn}));var O0=ro("eleInteractive",function(r){return r.pstyle("events").value==="yes"&&r.pstyle("visibility").value==="visible"&&Kn(r)}),I0=ro("parentInteractive",function(r){return r.pstyle("visibility").value==="visible"&&Kn(r)});xt.interactive=no("interactive",Yu({ok:O0,parentOk:I0,edgeOkViaNode:Kn}));xt.noninteractive=function(){var r=this[0];if(r)return!r.interactive()};var N0=ro("eleVisible",function(r){return r.pstyle("visibility").value==="visible"&&r.pstyle("opacity").pfValue!==0&&Kn(r)}),z0=Kn;xt.visible=no("visible",Yu({ok:N0,edgeOkViaNode:z0}));xt.hidden=function(){var r=this[0];if(r)return!r.visible()};xt.isBundledBezier=no("isBundledBezier",function(){return this.cy().styleEnabled()?!this.removed()&&this.pstyle("curve-style").value==="bezier"&&this.takesUpSpace():!1});xt.bypass=xt.css=xt.style;xt.renderedCss=xt.renderedStyle;xt.removeBypass=xt.removeCss=xt.removeStyle;xt.pstyle=xt.parsedStyle;var Yr={};function Ff(r){return function(){var e=arguments,t=[];if(e.length===2){var n=e[0],a=e[1];this.on(r.event,n,a)}else if(e.length===1&&je(e[0])){var i=e[0];this.on(r.event,i)}else if(e.length===0||e.length===1&&We(e[0])){for(var o=e.length===1?e[0]:null,s=0;s<this.length;s++){var u=this[s],l=!r.ableField||u._private[r.ableField],c=u._private[r.field]!=r.value;if(r.overrideAble){var f=r.overrideAble(u);if(f!==void 0&&(l=f,!f))return this}l&&(u._private[r.field]=r.value,c&&t.push(u))}var d=this.spawn(t);d.updateStyle(),d.emit(r.event),o&&d.emit(o)}return this}}function Zn(r){Yr[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]}},Yr[r.on]=Ff({event:r.on,field:r.field,ableField:r.ableField,overrideAble:r.overrideAble,value:!0}),Yr[r.off]=Ff({event:r.off,field:r.field,ableField:r.ableField,overrideAble:r.overrideAble,value:!1})}Zn({field:"locked",overrideField:function(e){return e.cy().autolock()?!0:void 0},on:"lock",off:"unlock"});Zn({field:"grabbable",overrideField:function(e){return e.cy().autoungrabify()||e.pannable()?!1:void 0},on:"grabify",off:"ungrabify"});Zn({field:"selected",ableField:"selectable",overrideAble:function(e){return e.cy().autounselectify()?!1:void 0},on:"select",off:"unselect"});Zn({field:"selectable",overrideField:function(e){return e.cy().autounselectify()?!1:void 0},on:"selectify",off:"unselectify"});Yr.deselect=Yr.unselect;Yr.grabbed=function(){var r=this[0];if(r)return r._private.grabbed};Zn({field:"active",on:"activate",off:"unactivate"});Zn({field:"pannable",on:"panify",off:"unpanify"});Yr.inactive=function(){var r=this[0];if(r)return!r._private.active};var Tt={},Vf=function(e){return function(n){for(var a=this,i=[],o=0;o<a.length;o++){var s=a[o];if(s.isNode()){for(var u=!1,l=s.connectedEdges(),c=0;c<l.length;c++){var f=l[c],d=f.source(),h=f.target();if(e.noIncomingEdges&&h===s&&d!==s||e.noOutgoingEdges&&d===s&&h!==s){u=!0;break}}u||i.push(s)}}return this.spawn(i,!0).filter(n)}},qf=function(e){return function(t){for(var n=this,a=[],i=0;i<n.length;i++){var o=n[i];if(o.isNode())for(var s=o.connectedEdges(),u=0;u<s.length;u++){var l=s[u],c=l.source(),f=l.target();e.outgoing&&c===o?(a.push(l),a.push(f)):e.incoming&&f===o&&(a.push(l),a.push(c))}}return this.spawn(a,!0).filter(t)}},Gf=function(e){return function(t){for(var n=this,a=[],i={};;){var o=e.outgoing?n.outgoers():n.incomers();if(o.length===0)break;for(var s=!1,u=0;u<o.length;u++){var l=o[u],c=l.id();i[c]||(i[c]=!0,a.push(l),s=!0)}if(!s)break;n=o}return this.spawn(a,!0).filter(t)}};Tt.clearTraversalCache=function(){for(var r=0;r<this.length;r++)this[r]._private.traversalCache=null};be(Tt,{roots:Vf({noIncomingEdges:!0}),leaves:Vf({noOutgoingEdges:!0}),outgoers:Qt(qf({outgoing:!0}),"outgoers"),successors:Gf({outgoing:!0}),incomers:Qt(qf({incoming:!0}),"incomers"),predecessors:Gf({})});be(Tt,{neighborhood:Qt(function(r){for(var e=[],t=this.nodes(),n=0;n<t.length;n++)for(var a=t[n],i=a.connectedEdges(),o=0;o<i.length;o++){var s=i[o],u=s.source(),l=s.target(),c=a===u?l:u;c.length>0&&e.push(c[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)}});Tt.neighbourhood=Tt.neighborhood;Tt.closedNeighbourhood=Tt.closedNeighborhood;Tt.openNeighbourhood=Tt.openNeighborhood;be(Tt,{source:Qt(function(e){var t=this[0],n;return t&&(n=t._private.source||t.cy().collection()),n&&e?n.filter(e):n},"source"),target:Qt(function(e){var t=this[0],n;return t&&(n=t._private.target||t.cy().collection()),n&&e?n.filter(e):n},"target"),sources:Hf({attr:"source"}),targets:Hf({attr:"target"})});function Hf(r){return function(t){for(var n=[],a=0;a<this.length;a++){var i=this[a],o=i._private[r.attr];o&&n.push(o)}return this.spawn(n,!0).filter(t)}}be(Tt,{edgesWith:Qt($f(),"edgesWith"),edgesTo:Qt($f({thisIsSrc:!0}),"edgesTo")});function $f(r){return function(t){var n=[],a=this._private.cy,i=r||{};he(t)&&(t=a.$(t));for(var o=0;o<t.length;o++)for(var s=t[o]._private.edges,u=0;u<s.length;u++){var l=s[u],c=l._private.data,f=this.hasElementWithId(c.source)&&t.hasElementWithId(c.target),d=t.hasElementWithId(c.source)&&this.hasElementWithId(c.target),h=f||d;h&&((i.thisIsSrc||i.thisIsTgt)&&(i.thisIsSrc&&!f||i.thisIsTgt&&!d)||n.push(l))}return this.spawn(n,!0)}}be(Tt,{connectedEdges:Qt(function(r){for(var e=[],t=this,n=0;n<t.length;n++){var a=t[n];if(a.isNode())for(var i=a._private.edges,o=0;o<i.length;o++){var s=i[o];e.push(s)}}return this.spawn(e,!0).filter(r)},"connectedEdges"),connectedNodes:Qt(function(r){for(var e=[],t=this,n=0;n<t.length;n++){var a=t[n];a.isEdge()&&(e.push(a.source()[0]),e.push(a.target()[0]))}return this.spawn(e,!0).filter(r)},"connectedNodes"),parallelEdges:Qt(Uf(),"parallelEdges"),codirectedEdges:Qt(Uf({codirected:!0}),"codirectedEdges")});function Uf(r){var e={codirected:!1};return r=be({},e,r),function(n){for(var a=[],i=this.edges(),o=r,s=0;s<i.length;s++)for(var u=i[s],l=u._private,c=l.source,f=c._private.data.id,d=l.data.target,h=c._private.edges,v=0;v<h.length;v++){var y=h[v],g=y._private.data,p=g.target,m=g.source,b=p===d&&m===f,x=f===p&&d===m;(o.codirected&&b||!o.codirected&&(b||x))&&a.push(y)}return this.spawn(a,!0).filter(n)}}be(Tt,{components:function(e){var t=this,n=t.cy(),a=n.collection(),i=e==null?t.nodes():e.nodes(),o=[];e!=null&&i.empty()&&(i=e.sources());var s=function(c,f){a.merge(c),i.unmerge(c),f.merge(c)};if(i.empty())return t.spawn();var u=function(){var c=n.collection();o.push(c);var f=i[0];s(f,c),t.bfs({directed:!1,roots:f,visit:function(h){return s(h,c)}}),c.forEach(function(d){d.connectedEdges().forEach(function(h){t.has(h)&&c.has(h.source())&&c.has(h.target())&&c.merge(h)})})};do u();while(i.length>0);return o},component:function(){var e=this[0];return e.cy().mutableElements().components(e)[0]}});Tt.componentsOf=Tt.components;var wt=function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(e===void 0){Qe("A collection must have a reference to the core");return}var i=new Pr,o=!1;if(!t)t=[];else if(t.length>0&&Ne(t[0])&&!Oa(t[0])){o=!0;for(var s=[],u=new Xn,l=0,c=t.length;l<c;l++){var f=t[l];f.data==null&&(f.data={});var d=f.data;if(d.id==null)d.id=Vd();else if(e.hasElementWithId(d.id)||u.has(d.id))continue;var h=new Xi(e,f,!1);s.push(h),u.add(d.id)}t=s}this.length=0;for(var v=0,y=t.length;v<y;v++){var g=t[v][0];if(g!=null){var p=g._private.data.id;(!n||!i.has(p))&&(n&&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 Pr,x=this.eles,E=0;E<x.length;E++){var S=x[E];b.set(S.id(),{index:E,ele:S})}}},n&&(this._private.map=i),o&&!a&&this.restore()},Ye=Xi.prototype=wt.prototype=Object.create(Array.prototype);Ye.instanceString=function(){return"collection"};Ye.spawn=function(r,e){return new wt(this.cy(),r,e)};Ye.spawnSelf=function(){return this.spawn(this)};Ye.cy=function(){return this._private.cy};Ye.renderer=function(){return this._private.cy.renderer()};Ye.element=function(){return this[0]};Ye.collection=function(){return Td(this)?this:new wt(this._private.cy,[this])};Ye.unique=function(){return new wt(this._private.cy,this,!0)};Ye.hasElementWithId=function(r){return r=""+r,this._private.map.has(r)};Ye.getElementById=function(r){r=""+r;var e=this._private.cy,t=this._private.map.get(r);return t?t.ele:new wt(e)};Ye.$id=Ye.getElementById;Ye.poolIndex=function(){var r=this._private.cy,e=r._private.elements,t=this[0]._private.data.id;return e._private.map.get(t).index};Ye.indexOf=function(r){var e=r[0]._private.data.id;return this._private.map.get(e).index};Ye.indexOfId=function(r){return r=""+r,this._private.map.get(r).index};Ye.json=function(r){var e=this.element(),t=this.cy();if(e==null&&r)return this;if(e!=null){var n=e._private;if(Ne(r)){if(t.startBatch(),r.data){e.data(r.data);var a=n.data;if(e.isEdge()){var i=!1,o={},s=r.data.source,u=r.data.target;s!=null&&s!=a.source&&(o.source=""+s,i=!0),u!=null&&u!=a.target&&(o.target=""+u,i=!0),i&&(e=e.move(o))}else{var l="parent"in r.data,c=r.data.parent;l&&(c!=null||a.parent!=null)&&c!=a.parent&&(c===void 0&&(c=null),c!=null&&(c=""+c),e=e.move({parent:c}))}}r.position&&e.position(r.position);var f=function(y,g,p){var m=r[y];m!=null&&m!==n[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 d={data:yr(n.data),position:yr(n.position),group:n.group,removed:n.removed,selected:n.selected,selectable:n.selectable,locked:n.locked,grabbable:n.grabbable,pannable:n.pannable,classes:null};d.classes="";var h=0;return n.classes.forEach(function(v){return d.classes+=h++===0?v:" "+v}),d}}};Ye.jsons=function(){for(var r=[],e=0;e<this.length;e++){var t=this[e],n=t.json();r.push(n)}return r};Ye.clone=function(){for(var r=this.cy(),e=[],t=0;t<this.length;t++){var n=this[t],a=n.json(),i=new Xi(r,a,!1);e.push(i)}return new wt(r,e)};Ye.copy=Ye.clone;Ye.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,n=t.cy(),a=n._private,i=[],o=[],s,u=0,l=t.length;u<l;u++){var c=t[u];e&&!c.removed()||(c.isNode()?i.push(c):o.push(c))}s=i.concat(o);var f,d=function(){s.splice(f,1),f--};for(f=0;f<s.length;f++){var h=s[f],v=h._private,y=v.data;if(h.clearTraversalCache(),!(!e&&!v.removed)){if(y.id===void 0)y.id=Vd();else if(ae(y.id))y.id=""+y.id;else if(Kr(y.id)||!he(y.id)){Qe("Can not create element with invalid string ID `"+y.id+"`"),d();continue}else if(n.hasElementWithId(y.id)){Qe("Can not create second element with ID `"+y.id+"`"),d();continue}}var g=y.id;if(h.isNode()){var p=v.position;p.x==null&&(p.x=0),p.y==null&&(p.y=0)}if(h.isEdge()){for(var m=h,b=["source","target"],x=b.length,E=!1,S=0;S<x;S++){var w=b[S],k=y[w];ae(k)&&(k=y[w]=""+y[w]),k==null||k===""?(Qe("Can not create edge `"+g+"` with unspecified "+w),E=!0):n.hasElementWithId(k)||(Qe("Can not create edge `"+g+"` with nonexistent "+w+" `"+k+"`"),E=!0)}if(E){d();continue}var _=n.getElementById(y.source),C=n.getElementById(y.target);_.same(C)?_._private.edges.push(m):(_._private.edges.push(m),C._private.edges.push(m)),m._private.source=_,m._private.target=C}v.map=new Pr,v.map.set(g,{ele:h,index:0}),v.removed=!1,e&&n.addToPool(h)}for(var T=0;T<i.length;T++){var D=i[T],A=D._private.data;ae(A.parent)&&(A.parent=""+A.parent);var R=A.parent,M=R!=null;if(M||D._private.parent){var L=D._private.parent?n.collection().merge(D._private.parent):n.getElementById(R);if(L.empty())A.parent=void 0;else if(L[0].removed())$e("Node added with missing parent, reference to parent removed"),A.parent=void 0,D._private.parent=null;else{for(var B=!1,I=L;!I.empty();){if(D.same(I)){B=!0,A.parent=void 0;break}I=I.parent()}B||(L[0]._private.children.push(D),D._private.parent=L[0],a.hasCompoundNodes=!0)}}}if(s.length>0){for(var H=s.length===t.length?t:new wt(n,s),q=0;q<H.length;q++){var N=H[q];N.isNode()||(N.parallelEdges().clearTraversalCache(),N.source().clearTraversalCache(),N.target().clearTraversalCache())}var G;a.hasCompoundNodes?G=n.collection().merge(H).merge(H.connectedNodes()).merge(H.parent()):G=H,G.dirtyCompoundBoundsCache().dirtyBoundingBoxCache().updateStyle(r),r?H.emitAndNotify("add"):e&&H.emit("add")}return t};Ye.removed=function(){var r=this[0];return r&&r._private.removed};Ye.inside=function(){var r=this[0];return r&&!r._private.removed};Ye.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,n=[],a={},i=t._private.cy;function o(R){for(var M=R._private.edges,L=0;L<M.length;L++)u(M[L])}function s(R){for(var M=R._private.children,L=0;L<M.length;L++)u(M[L])}function u(R){var M=a[R.id()];e&&R.removed()||M||(a[R.id()]=!0,R.isNode()?(n.push(R),o(R),s(R)):n.unshift(R))}for(var l=0,c=t.length;l<c;l++){var f=t[l];u(f)}function d(R,M){var L=R._private.edges;Zr(L,M),R.clearTraversalCache()}function h(R){R.clearTraversalCache()}var v=[];v.ids={};function y(R,M){M=M[0],R=R[0];var L=R._private.children,B=R.id();Zr(L,M),M._private.parent=null,v.ids[B]||(v.ids[B]=!0,v.push(R))}t.dirtyCompoundBoundsCache(),e&&i.removeFromPool(n);for(var g=0;g<n.length;g++){var p=n[g];if(p.isEdge()){var m=p.source()[0],b=p.target()[0];d(m,p),d(b,p);for(var x=p.parallelEdges(),E=0;E<x.length;E++){var S=x[E];h(S),S.isBundledBezier()&&S.dirtyBoundingBoxCache()}}else{var w=p.parent();w.length!==0&&y(w,p)}e&&(p._private.removed=!0)}var k=i._private.elements;i._private.hasCompoundNodes=!1;for(var _=0;_<k.length;_++){var C=k[_];if(C.isParent()){i._private.hasCompoundNodes=!0;break}}var T=new wt(this.cy(),n);T.size()>0&&(r?T.emitAndNotify("remove"):e&&T.emit("remove"));for(var D=0;D<v.length;D++){var A=v[D];(!e||!A.removed())&&A.updateStyle()}return T};Ye.move=function(r){var e=this._private.cy,t=this,n=!1,a=!1,i=function(v){return v==null?v:""+v};if(r.source!==void 0||r.target!==void 0){var o=i(r.source),s=i(r.target),u=o!=null&&e.hasElementWithId(o),l=s!=null&&e.hasElementWithId(s);(u||l)&&(e.batch(function(){t.remove(n,a),t.emitAndNotify("moveout");for(var h=0;h<t.length;h++){var v=t[h],y=v._private.data;v.isEdge()&&(u&&(y.source=o),l&&(y.target=s))}t.restore(n,a)}),t.emitAndNotify("move"))}else if(r.parent!==void 0){var c=i(r.parent),f=c===null||e.hasElementWithId(c);if(f){var d=c===null?void 0:c;e.batch(function(){var h=t.remove(n,a);h.emitAndNotify("moveout");for(var v=0;v<t.length;v++){var y=t[v],g=y._private.data;y.isNode()&&(g.parent=d)}h.restore(n,a)}),t.emitAndNotify("move")}}return this};[Jd,Km,Ci,Xr,Wn,f0,eo,_0,Cv,Sv,R0,zi,Si,xt,Yr,Tt].forEach(function(r){be(Ye,r)});var F0={add:function(e){var t,n=this;if(qt(e)){var a=e;if(a._private.cy===n)t=a.restore();else{for(var i=[],o=0;o<a.length;o++){var s=a[o];i.push(s.json())}t=new wt(n,i)}}else if(We(e)){var u=e;t=new wt(n,u)}else if(Ne(e)&&(We(e.nodes)||We(e.edges))){for(var l=e,c=[],f=["nodes","edges"],d=0,h=f.length;d<h;d++){var v=f[d],y=l[v];if(We(y))for(var g=0,p=y.length;g<p;g++){var m=be({group:v},y[g]);c.push(m)}}t=new wt(n,c)}else{var b=e;t=new Xi(n,b).collection()}return t},remove:function(e){if(!qt(e)){if(he(e)){var t=e;e=this.$(t)}}return e.remove()}};function V0(r,e,t,n){var a=4,i=.001,o=1e-7,s=10,u=11,l=1/(u-1),c=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 d=c?new Float32Array(u):new Array(u);function h(C,T){return 1-3*T+3*C}function v(C,T){return 3*T-6*C}function y(C){return 3*C}function g(C,T,D){return((h(T,D)*C+v(T,D))*C+y(T))*C}function p(C,T,D){return 3*h(T,D)*C*C+2*v(T,D)*C+y(T)}function m(C,T){for(var D=0;D<a;++D){var A=p(T,r,t);if(A===0)return T;var R=g(T,r,t)-C;T-=R/A}return T}function b(){for(var C=0;C<u;++C)d[C]=g(C*l,r,t)}function x(C,T,D){var A,R,M=0;do R=T+(D-T)/2,A=g(R,r,t)-C,A>0?D=R:T=R;while(Math.abs(A)>o&&++M<s);return R}function E(C){for(var T=0,D=1,A=u-1;D!==A&&d[D]<=C;++D)T+=l;--D;var R=(C-d[D])/(d[D+1]-d[D]),M=T+R*l,L=p(M,r,t);return L>=i?m(C,M):L===0?M:x(C,T,T+l)}var S=!1;function w(){S=!0,(r!==e||t!==n)&&b()}var k=function(T){return S||w(),r===e&&t===n?T:T===0?0:T===1?1:g(E(T),e,n)};k.getControlPoints=function(){return[{x:r,y:e},{x:t,y:n}]};var _="generateBezier("+[r,e,t,n]+")";return k.toString=function(){return _},k}var q0=(function(){function r(n){return-n.tension*n.x-n.friction*n.v}function e(n,a,i){var o={x:n.x+i.dx*a,v:n.v+i.dv*a,tension:n.tension,friction:n.friction};return{dx:o.v,dv:r(o)}}function t(n,a){var i={dx:n.v,dv:r(n)},o=e(n,a*.5,i),s=e(n,a*.5,o),u=e(n,a,s),l=1/6*(i.dx+2*(o.dx+s.dx)+u.dx),c=1/6*(i.dv+2*(o.dv+s.dv)+u.dv);return n.x=n.x+l*a,n.v=n.v+c*a,n}return function n(a,i,o){var s={x:-1,v:0,tension:null,friction:null},u=[0],l=0,c=1/1e4,f=16/1e3,d,h,v;for(a=parseFloat(a)||500,i=parseFloat(i)||20,o=o||null,s.tension=a,s.friction=i,d=o!==null,d?(l=n(a,i),h=l/o*f):h=f;v=t(v||s,h),u.push(1+v.x),l+=16,Math.abs(v.x)>c&&Math.abs(v.v)>c;);return d?function(y){return u[y*(u.length-1)|0]}:l}})(),Xe=function(e,t,n,a){var i=V0(e,t,n,a);return function(o,s,u){return o+(s-o)*i(u)}},ki={linear:function(e,t,n){return e+(t-e)*n},ease:Xe(.25,.1,.25,1),"ease-in":Xe(.42,0,1,1),"ease-out":Xe(0,0,.58,1),"ease-in-out":Xe(.42,0,.58,1),"ease-in-sine":Xe(.47,0,.745,.715),"ease-out-sine":Xe(.39,.575,.565,1),"ease-in-out-sine":Xe(.445,.05,.55,.95),"ease-in-quad":Xe(.55,.085,.68,.53),"ease-out-quad":Xe(.25,.46,.45,.94),"ease-in-out-quad":Xe(.455,.03,.515,.955),"ease-in-cubic":Xe(.55,.055,.675,.19),"ease-out-cubic":Xe(.215,.61,.355,1),"ease-in-out-cubic":Xe(.645,.045,.355,1),"ease-in-quart":Xe(.895,.03,.685,.22),"ease-out-quart":Xe(.165,.84,.44,1),"ease-in-out-quart":Xe(.77,0,.175,1),"ease-in-quint":Xe(.755,.05,.855,.06),"ease-out-quint":Xe(.23,1,.32,1),"ease-in-out-quint":Xe(.86,0,.07,1),"ease-in-expo":Xe(.95,.05,.795,.035),"ease-out-expo":Xe(.19,1,.22,1),"ease-in-out-expo":Xe(1,0,0,1),"ease-in-circ":Xe(.6,.04,.98,.335),"ease-out-circ":Xe(.075,.82,.165,1),"ease-in-out-circ":Xe(.785,.135,.15,.86),spring:function(e,t,n){if(n===0)return ki.linear;var a=q0(e,t,n);return function(i,o,s){return i+(o-i)*a(s)}},"cubic-bezier":Xe};function Wf(r,e,t,n,a){if(n===1||e===t)return t;var i=a(e,t,n);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 Xf(r,e){return r.pfValue!=null||r.value!=null?r.pfValue!=null&&(e==null||e.type.units!=="%")?r.pfValue:r.value:r}function Mn(r,e,t,n,a){var i=a!=null?a.type:null;t<0?t=0:t>1&&(t=1);var o=Xf(r,a),s=Xf(e,a);if(ae(o)&&ae(s))return Wf(i,o,s,t,n);if(We(o)&&We(s)){for(var u=[],l=0;l<s.length;l++){var c=o[l],f=s[l];if(c!=null&&f!=null){var d=Wf(i,c,f,t,n);u.push(d)}else u.push(f)}return u}}function G0(r,e,t,n){var a=!n,i=r._private,o=e._private,s=o.easing,u=o.startTime,l=n?r:r.cy(),c=l.style();if(!o.easingImpl)if(s==null)o.easingImpl=ki.linear;else{var f;if(he(s)){var d=c.parse("transition-timing-function",s);f=d.value}else f=s;var h,v;he(f)?(h=f,v=[]):(h=f[1],v=f.slice(2).map(function(H){return+H})),v.length>0?(h==="spring"&&v.push(o.duration),o.easingImpl=ki[h].apply(null,v)):o.easingImpl=ki[h]}var y=o.easingImpl,g;if(o.duration===0?g=1:g=(t-u)/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&&a&&!r.locked()){var b={};ha(p.x,m.x)&&(b.x=Mn(p.x,m.x,g,y)),ha(p.y,m.y)&&(b.y=Mn(p.y,m.y,g,y)),r.position(b)}var x=o.startPan,E=o.pan,S=i.pan,w=E!=null&&n;w&&(ha(x.x,E.x)&&(S.x=Mn(x.x,E.x,g,y)),ha(x.y,E.y)&&(S.y=Mn(x.y,E.y,g,y)),r.emit("pan"));var k=o.startZoom,_=o.zoom,C=_!=null&&n;C&&(ha(k,_)&&(i.zoom=_a(i.minZoom,Mn(k,_,g,y),i.maxZoom)),r.emit("zoom")),(w||C)&&r.emit("viewport");var T=o.style;if(T&&T.length>0&&a){for(var D=0;D<T.length;D++){var A=T[D],R=A.name,M=A,L=o.startStyle[R],B=c.properties[L.name],I=Mn(L,M,g,y,B);c.overrideBypass(r,R,I)}r.emit("style")}}return o.progress=g,g}function ha(r,e){return r==null||e==null?!1:ae(r)&&ae(e)?!0:!!(r&&e)}function H0(r,e,t,n){var a=e._private;a.started=!0,a.startTime=t-a.progress*a.duration}function Yf(r,e){var t=e._private.aniEles,n=[];function a(c,f){var d=c._private,h=d.animation.current,v=d.animation.queue,y=!1;if(h.length===0){var g=v.shift();g&&h.push(g)}for(var p=function(S){for(var w=S.length-1;w>=0;w--){var k=S[w];k()}S.splice(0,S.length)},m=h.length-1;m>=0;m--){var b=h[m],x=b._private;if(x.stopped){h.splice(m,1),x.hooked=!1,x.playing=!1,x.started=!1,p(x.frames);continue}!x.playing&&!x.applying||(x.playing&&x.applying&&(x.applying=!1),x.started||H0(c,b,r),G0(c,b,r,f),x.applying&&(x.applying=!1),p(x.frames),x.step!=null&&x.step(r),b.completed()&&(h.splice(m,1),x.hooked=!1,x.playing=!1,x.started=!1,p(x.completes)),y=!0)}return!f&&h.length===0&&v.length===0&&n.push(c),y}for(var i=!1,o=0;o<t.length;o++){var s=t[o],u=a(s);i=i||u}var l=a(e,!0);(i||l)&&(t.length>0?e.notify("draw",t):e.notify("draw")),t.unmerge(n),e.emit("step")}var $0={animate:He.animate(),animation:He.animation(),animated:He.animated(),clearQueue:He.clearQueue(),delay:He.delay(),delayAnimation:He.delayAnimation(),stop:He.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&&Bi(function(i){Yf(i,e),t()})}var n=e.renderer();n&&n.beforeRender?n.beforeRender(function(i,o){Yf(o,e)},n.beforeRenderPriorities.animations):t()}},U0={qualifierCompare:function(e,t){return e==null||t==null?e==null&&t==null:e.sameText(t)},eventMatches:function(e,t,n){var a=t.qualifier;return a!=null?e!==n.target&&Oa(n.target)&&a.matches(n.target):!0},addEventFields:function(e,t){t.cy=e,t.target=e},callbackContext:function(e,t,n){return t.qualifier!=null?n.target:e}},gi=function(e){return he(e)?new Jr(e):e},_v={createEmitter:function(){var e=this._private;return e.emitter||(e.emitter=new to(U0,this)),this},emitter:function(){return this._private.emitter},on:function(e,t,n){return this.emitter().on(e,gi(t),n),this},removeListener:function(e,t,n){return this.emitter().removeListener(e,gi(t),n),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},one:function(e,t,n){return this.emitter().one(e,gi(t),n),this},once:function(e,t,n){return this.emitter().one(e,gi(t),n),this},emit:function(e,t){return this.emitter().emit(e,t),this},emitAndNotify:function(e,t){return this.emit(e),this.notify(e,t),this}};He.eventAliasesOn(_v);var wu={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)}};wu.jpeg=wu.jpg;var Ti={layout:function(e){var t=this;if(e==null){Qe("Layout options must be specified to make a layout");return}if(e.name==null){Qe("A `name` must be specified to make a layout");return}var n=e.name,a=t.extension("layout",n);if(a==null){Qe("No such layout `"+n+"` found. Did you forget to import it and `cytoscape.use()` it?");return}var i;he(e.eles)?i=t.$(e.eles):i=e.eles!=null?e.eles:t.$();var o=new a(be({},e,{cy:t,eles:i}));return o}};Ti.createLayout=Ti.makeLayout=Ti.layout;var W0={notify:function(e,t){var n=this._private;if(this.batching()){n.batchNotifications=n.batchNotifications||{};var a=n.batchNotifications[e]=n.batchNotifications[e]||this.collection();t!=null&&a.merge(t);return}if(n.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(n){var a=e.batchNotifications[n];a.empty()?t.notify(n):t.notify(n,a)})}return this},batch:function(e){return this.startBatch(),e(),this.endBatch(),this},batchData:function(e){var t=this;return this.batch(function(){for(var n=Object.keys(e),a=0;a<n.length;a++){var i=n[a],o=e[i],s=t.getElementById(i);s.data(o)}})}},X0=Et({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]}),Eu={renderTo:function(e,t,n,a){var i=this._private.renderer;return i.renderTo(e,t,n,a),this},renderer:function(){return this._private.renderer},forceRender:function(){return this.notify("draw"),this},resize:function(){return this.invalidateSize(),this.emitAndNotify("resize"),this},initRenderer:function(e){var t=this,n=t.extension("renderer",e.name);if(n==null){Qe("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&&$e("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 a=X0(e);a.cy=t,t._private.renderer=new n(a),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(n){var a=n._private;a.rscratch={},a.rstyle={},a.animation.current=[],a.animation.queue=[]})},onRender:function(e){return this.on("render",e)},offRender:function(e){return this.off("render",e)}};Eu.invalidateDimensions=Eu.resize;var _i={collection:function(e,t){return he(e)?this.$(e):qt(e)?e.collection():We(e)?(t||(t={}),new wt(this,e,t.unique,t.removed)):new wt(this)},nodes:function(e){var t=this.$(function(n){return n.isNode()});return e?t.filter(e):t},edges:function(e){var t=this.$(function(n){return n.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}};_i.elements=_i.filter=_i.$;var mt={},wa="t",Y0="f";mt.apply=function(r){for(var e=this,t=e._private,n=t.cy,a=n.collection(),i=0;i<r.length;i++){var o=r[i],s=e.getContextMeta(o);if(!s.empty){var u=e.getContextStyle(s),l=e.applyContextStyle(s,u,o);o._private.appliedInitStyle?e.updateTransitions(o,l.diffProps):o._private.appliedInitStyle=!0;var c=e.updateStyleHints(o);c&&a.push(o)}}return a};mt.getPropertiesDiff=function(r,e){var t=this,n=t._private.propDiffs=t._private.propDiffs||{},a=r+"-"+e,i=n[a];if(i)return i;for(var o=[],s={},u=0;u<t.length;u++){var l=t[u],c=r[u]===wa,f=e[u]===wa,d=c!==f,h=l.mappedProperties.length>0;if(d||f&&h){var v=void 0;d&&h||d?v=l.properties:h&&(v=l.mappedProperties);for(var y=0;y<v.length;y++){for(var g=v[y],p=g.name,m=!1,b=u+1;b<t.length;b++){var x=t[b],E=e[b]===wa;if(E&&(m=x.properties[g.name]!=null,m))break}!s[p]&&!m&&(s[p]=!0,o.push(p))}}}return n[a]=o,o};mt.getContextMeta=function(r){for(var e=this,t="",n,a=r._private.styleCxtKey||"",i=0;i<e.length;i++){var o=e[i],s=o.selector&&o.selector.matches(r);s?t+=wa:t+=Y0}return n=e.getPropertiesDiff(a,t),r._private.styleCxtKey=t,{key:t,diffPropNames:n,empty:n.length===0}};mt.getContextStyle=function(r){var e=r.key,t=this,n=this._private.contextStyles=this._private.contextStyles||{};if(n[e])return n[e];for(var a={_private:{key:e}},i=0;i<t.length;i++){var o=t[i],s=e[i]===wa;if(s)for(var u=0;u<o.properties.length;u++){var l=o.properties[u];a[l.name]=l}}return n[e]=a,a};mt.applyContextStyle=function(r,e,t){for(var n=this,a=r.diffPropNames,i={},o=n.types,s=0;s<a.length;s++){var u=a[s],l=e[u],c=t.pstyle(u);if(!l)if(c)c.bypass?l={name:u,deleteBypassed:!0}:l={name:u,delete:!0};else continue;if(c!==l){if(l.mapped===o.fn&&c!=null&&c.mapping!=null&&c.mapping.value===l.value){var f=c.mapping,d=f.fnValue=l.value(t);if(d===f.prevFnValue)continue}var h=i[u]={prev:c};n.applyParsedProperty(t,l),h.next=t.pstyle(u),h.next&&h.next.bypass&&(h.next=h.next.bypassed)}}return{diffProps:i}};mt.updateStyleHints=function(r){var e=r._private,t=this,n=t.propertyGroupNames,a=t.propertyGroupKeys,i=function(V,W,re){return t.getPropertiesHash(V,W,re)},o=e.styleKey;if(r.removed())return!1;var s=e.group==="nodes",u=r._private.style;n=Object.keys(u);for(var l=0;l<a.length;l++){var c=a[l];e.styleKeys[c]=[pn,In]}for(var f=function(V,W){return e.styleKeys[W][0]=Sa(V,e.styleKeys[W][0])},d=function(V,W){return e.styleKeys[W][1]=ka(V,e.styleKeys[W][1])},h=function(V,W){f(V,W),d(V,W)},v=function(V,W){for(var re=0;re<V.length;re++){var se=V.charCodeAt(re);f(se,W),d(se,W)}},y=2e9,g=function(V){return-128<V&&V<128&&Math.floor(V)!==V?y-(V*1024|0):V},p=0;p<n.length;p++){var m=n[p],b=u[m];if(b!=null){var x=this.properties[m],E=x.type,S=x.groupKey,w=void 0;x.hashOverride!=null?w=x.hashOverride(r,b):b.pfValue!=null&&(w=b.pfValue);var k=x.enums==null?b.value:null,_=w!=null,C=k!=null,T=_||C,D=b.units;if(E.number&&T&&!E.multiple){var A=_?w:k;h(g(A),S),!_&&D!=null&&v(D,S)}else v(b.strValue,S)}}for(var R=[pn,In],M=0;M<a.length;M++){var L=a[M],B=e.styleKeys[L];R[0]=Sa(B[0],R[0]),R[1]=ka(B[1],R[1])}e.styleKey=cg(R[0],R[1]);var I=e.styleKeys;e.labelDimsKey=qr(I.labelDimensions);var H=i(r,["label"],I.labelDimensions);if(e.labelKey=qr(H),e.labelStyleKey=qr(ui(I.commonLabel,H)),!s){var q=i(r,["source-label"],I.labelDimensions);e.sourceLabelKey=qr(q),e.sourceLabelStyleKey=qr(ui(I.commonLabel,q));var N=i(r,["target-label"],I.labelDimensions);e.targetLabelKey=qr(N),e.targetLabelStyleKey=qr(ui(I.commonLabel,N))}if(s){var G=e.styleKeys,X=G.nodeBody,j=G.nodeBorder,Q=G.nodeOutline,Z=G.backgroundImage,te=G.compound,ne=G.pie,$=G.stripe,O=[X,j,Q,Z,te,ne,$].filter(function(z){return z!=null}).reduce(ui,[pn,In]);e.nodeKey=qr(O),e.hasPie=ne!=null&&ne[0]!==pn&&ne[1]!==In,e.hasStripe=$!=null&&$[0]!==pn&&$[1]!==In}return o!==e.styleKey};mt.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,e.hasStripe=null};mt.applyParsedProperty=function(r,e){var t=this,n=e,a=r._private.style,i,o=t.types,s=t.properties[n.name].type,u=n.bypass,l=a[n.name],c=l&&l.bypass,f=r._private,d="mapping",h=function(X){return X==null?null:X.pfValue!=null?X.pfValue:X.value},v=function(){var X=h(l),j=h(n);t.checkTriggers(r,n.name,X,j)};if(e.name==="curve-style"&&r.isEdge()&&(e.value!=="bezier"&&r.isLoop()||e.value==="haystack"&&(r.source().isParent()||r.target().isParent()))&&(n=e=this.parse(e.name,"bezier",u)),n.delete)return a[n.name]=void 0,v(),!0;if(n.deleteBypassed)return l?l.bypass?(l.bypassed=void 0,v(),!0):!1:(v(),!0);if(n.deleteBypass)return l?l.bypass?(a[n.name]=l.bypassed,v(),!0):!1:(v(),!0);var y=function(){$e("Do not assign mappings to elements without corresponding data (i.e. ele `"+r.id()+"` has no mapping for property `"+n.name+"` with data field `"+n.field+"`); try a `["+n.field+"]` selector to limit scope to elements with `"+n.field+"` defined")};switch(n.mapped){case o.mapData:{for(var g=n.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 x;if(ae(p)){var E=n.fieldMax-n.fieldMin;E===0?x=0:x=(p-n.fieldMin)/E}else return $e("Do not use continuous mappers without specifying numeric data (i.e. `"+n.field+": "+p+"` for `"+r.id()+"` is non-numeric)"),!1;if(x<0?x=0:x>1&&(x=1),s.color){var S=n.valueMin[0],w=n.valueMax[0],k=n.valueMin[1],_=n.valueMax[1],C=n.valueMin[2],T=n.valueMax[2],D=n.valueMin[3]==null?1:n.valueMin[3],A=n.valueMax[3]==null?1:n.valueMax[3],R=[Math.round(S+(w-S)*x),Math.round(k+(_-k)*x),Math.round(C+(T-C)*x),Math.round(D+(A-D)*x)];i={bypass:n.bypass,name:n.name,value:R,strValue:"rgb("+R[0]+", "+R[1]+", "+R[2]+")"}}else if(s.number){var M=n.valueMin+(n.valueMax-n.valueMin)*x;i=this.parse(n.name,M,n.bypass,d)}else return!1;if(!i)return y(),!1;i.mapping=n,n=i;break}case o.data:{for(var L=n.field.split("."),B=f.data,I=0;I<L.length&&B;I++){var H=L[I];B=B[H]}if(B!=null&&(i=this.parse(n.name,B,n.bypass,d)),!i)return y(),!1;i.mapping=n,n=i;break}case o.fn:{var q=n.value,N=n.fnValue!=null?n.fnValue:q(r);if(n.prevFnValue=N,N==null)return $e("Custom function mappers may not return null (i.e. `"+n.name+"` for ele `"+r.id()+"` is null)"),!1;if(i=this.parse(n.name,N,n.bypass,d),!i)return $e("Custom function mappers may not return invalid values for the property type (i.e. `"+n.name+"` for ele `"+r.id()+"` is invalid)"),!1;i.mapping=yr(n),n=i;break}case void 0:break;default:return!1}return u?(c?n.bypassed=l.bypassed:n.bypassed=l,a[n.name]=n):c?l.bypassed=n:a[n.name]=n,v(),!0};mt.cleanElements=function(r,e){for(var t=0;t<r.length;t++){var n=r[t];if(this.clearStyleHints(n),n.dirtyCompoundBoundsCache(),n.dirtyBoundingBoxCache(),!e)n._private.style={};else for(var a=n._private.style,i=Object.keys(a),o=0;o<i.length;o++){var s=i[o],u=a[s];u!=null&&(u.bypass?u.bypassed=null:a[s]=null)}}};mt.update=function(){var r=this._private.cy,e=r.mutableElements();e.updateStyle()};mt.updateTransitions=function(r,e){var t=this,n=r._private,a=r.pstyle("transition-property").value,i=r.pstyle("transition-duration").pfValue,o=r.pstyle("transition-delay").pfValue;if(a.length>0&&i>0){for(var s={},u=!1,l=0;l<a.length;l++){var c=a[l],f=r.pstyle(c),d=e[c];if(d){var h=d.prev,v=h,y=d.next!=null?d.next:f,g=!1,p=void 0,m=1e-6;v&&(ae(v.pfValue)&&ae(y.pfValue)?(g=y.pfValue-v.pfValue,p=v.pfValue+m*g):ae(v.value)&&ae(y.value)?(g=y.value-v.value,p=v.value+m*g):We(v.value)&&We(y.value)&&(g=v.value[0]!==y.value[0]||v.value[1]!==y.value[1]||v.value[2]!==y.value[2],p=v.strValue),g&&(s[c]=y.strValue,this.applyBypass(r,c,p),u=!0))}}if(!u)return;n.transitioning=!0,new Yn(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,a),r.emitAndNotify("style"),n.transitioning=!1})}else n.transitioning&&(this.removeBypasses(r,a),r.emitAndNotify("style"),n.transitioning=!1)};mt.checkTrigger=function(r,e,t,n,a,i){var o=this.properties[e],s=a(o);r.removed()||s!=null&&s(t,n,r)&&i(o)};mt.checkZOrderTrigger=function(r,e,t,n){var a=this;this.checkTrigger(r,e,t,n,function(i){return i.triggersZOrder},function(){a._private.cy.notify("zorder",r)})};mt.checkBoundsTrigger=function(r,e,t,n){this.checkTrigger(r,e,t,n,function(a){return a.triggersBounds},function(a){r.dirtyCompoundBoundsCache(),r.dirtyBoundingBoxCache()})};mt.checkConnectedEdgesBoundsTrigger=function(r,e,t,n){this.checkTrigger(r,e,t,n,function(a){return a.triggersBoundsOfConnectedEdges},function(a){r.connectedEdges().forEach(function(i){i.dirtyBoundingBoxCache()})})};mt.checkParallelEdgesBoundsTrigger=function(r,e,t,n){this.checkTrigger(r,e,t,n,function(a){return a.triggersBoundsOfParallelEdges},function(a){r.parallelEdges().forEach(function(i){i.dirtyBoundingBoxCache()})})};mt.checkTriggers=function(r,e,t,n){r.dirtyStyleCache(),this.checkZOrderTrigger(r,e,t,n),this.checkBoundsTrigger(r,e,t,n),this.checkConnectedEdgesBoundsTrigger(r,e,t,n),this.checkParallelEdgesBoundsTrigger(r,e,t,n)};var Ga={};Ga.applyBypass=function(r,e,t,n){var a=this,i=[],o=!0;if(e==="*"||e==="**"){if(t!==void 0)for(var s=0;s<a.properties.length;s++){var u=a.properties[s],l=u.name,c=this.parse(l,t,!0);c&&i.push(c)}}else if(he(e)){var f=this.parse(e,t,!0);f&&i.push(f)}else if(Ne(e)){var d=e;n=t;for(var h=Object.keys(d),v=0;v<h.length;v++){var y=h[v],g=d[y];if(g===void 0&&(g=d[Ui(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 x=r[b],E={},S=void 0,w=0;w<i.length;w++){var k=i[w];if(n){var _=x.pstyle(k.name);S=E[k.name]={prev:_}}m=this.applyParsedProperty(x,yr(k))||m,n&&(S.next=x.pstyle(k.name))}m&&this.updateStyleHints(x),n&&this.updateTransitions(x,E,o)}return m};Ga.overrideBypass=function(r,e,t){e=Lu(e);for(var n=0;n<r.length;n++){var a=r[n],i=a._private.style[e],o=this.properties[e].type,s=o.color,u=o.mutiple,l=i?i.pfValue!=null?i.pfValue:i.value:null;!i||!i.bypass?this.applyBypass(a,e,t):(i.value=t,i.pfValue!=null&&(i.pfValue=t),s?i.strValue="rgb("+t.join(",")+")":u?i.strValue=t.join(" "):i.strValue=""+t,this.updateStyleHints(a)),this.checkTriggers(a,e,l,t)}};Ga.removeAllBypasses=function(r,e){return this.removeBypasses(r,this.propertyNames,e)};Ga.removeBypasses=function(r,e,t){for(var n=!0,a=0;a<r.length;a++){for(var i=r[a],o={},s=0;s<e.length;s++){var u=e[s],l=this.properties[u],c=i.pstyle(l.name);if(!(!c||!c.bypass)){var f="",d=this.parse(u,f,!0),h=o[l.name]={prev:c};this.applyParsedProperty(i,d),h.next=i.pstyle(l.name)}}this.updateStyleHints(i),t&&this.updateTransitions(i,o,n)}};var Ku={};Ku.getEmSizeInPixels=function(){var r=this.containerCss("font-size");return r!=null?parseFloat(r):1};Ku.containerCss=function(r){var e=this._private.cy,t=e.container(),n=e.window();if(n&&t&&n.getComputedStyle)return n.getComputedStyle(t).getPropertyValue(r)};var mr={};mr.getRenderedStyle=function(r,e){return e?this.getStylePropertyValue(r,e,!0):this.getRawStyle(r,!0)};mr.getRawStyle=function(r,e){var t=this;if(r=r[0],r){for(var n={},a=0;a<t.properties.length;a++){var i=t.properties[a],o=t.getStylePropertyValue(r,i.name,e);o!=null&&(n[i.name]=o,n[Ui(i.name)]=o)}return n}};mr.getIndexedStyle=function(r,e,t,n){var a=r.pstyle(e)[t][n];return a??r.cy().style().getDefaultProperty(e)[t][0]};mr.getStylePropertyValue=function(r,e,t){var n=this;if(r=r[0],r){var a=n.properties[e];a.alias&&(a=a.pointsTo);var i=a.type,o=r.pstyle(a.name);if(o){var s=o.value,u=o.units,l=o.strValue;if(t&&i.number&&s!=null&&ae(s)){var c=r.cy().zoom(),f=function(g){return g*c},d=function(g,p){return f(g)+p},h=We(s),v=h?u.every(function(y){return y!=null}):u!=null;return v?h?s.map(function(y,g){return d(y,u[g])}).join(" "):d(s,u):h?s.map(function(y){return he(y)?y:""+f(y)}).join(" "):""+f(s)}else if(l!=null)return l}return null}};mr.getAnimationStartStyle=function(r,e){for(var t={},n=0;n<e.length;n++){var a=e[n],i=a.name,o=r.pstyle(i);o!==void 0&&(Ne(o)?o=this.parse(i,o.strValue):o=this.parse(i,o)),o&&(t[i]=o)}return t};mr.getPropsList=function(r){var e=this,t=[],n=r,a=e.properties;if(n)for(var i=Object.keys(n),o=0;o<i.length;o++){var s=i[o],u=n[s],l=a[s]||a[Lu(s)],c=this.parse(l.name,u);c&&t.push(c)}return t};mr.getNonDefaultPropertiesHash=function(r,e,t){var n=t.slice(),a,i,o,s,u,l;for(u=0;u<e.length;u++)if(a=e[u],i=r.pstyle(a,!1),i!=null)if(i.pfValue!=null)n[0]=Sa(s,n[0]),n[1]=ka(s,n[1]);else for(o=i.strValue,l=0;l<o.length;l++)s=o.charCodeAt(l),n[0]=Sa(s,n[0]),n[1]=ka(s,n[1]);return n};mr.getPropertiesHash=mr.getNonDefaultPropertiesHash;var ao={};ao.appendFromJson=function(r){for(var e=this,t=0;t<r.length;t++){var n=r[t],a=n.selector,i=n.style||n.css,o=Object.keys(i);e.selector(a);for(var s=0;s<o.length;s++){var u=o[s],l=i[u];e.css(u,l)}}return e};ao.fromJson=function(r){var e=this;return e.resetToDefault(),e.appendFromJson(r),e};ao.json=function(){for(var r=[],e=this.defaultLength;e<this.length;e++){for(var t=this[e],n=t.selector,a=t.properties,i={},o=0;o<a.length;o++){var s=a[o];i[s.name]=s.strValue}r.push({selector:n?n.toString():"core",style:i})}return r};var Zu={};Zu.appendFromString=function(r){var e=this,t=this,n=""+r,a,i,o;n=n.replace(/[/][*](\s|.)+?[*][/]/g,"");function s(){n.length>a.length?n=n.substr(a.length):n=""}function u(){i.length>o.length?i=i.substr(o.length):i=""}for(;;){var l=n.match(/^\s*$/);if(l)break;var c=n.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!c){$e("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+n);break}a=c[0];var f=c[1];if(f!=="core"){var d=new Jr(f);if(d.invalid){$e("Skipping parsing of block: Invalid selector found in string stylesheet: "+f),s();continue}}var h=c[2],v=!1;i=h;for(var y=[];;){var g=i.match(/^\s*$/);if(g)break;var p=i.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/);if(!p){$e("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+h),v=!0;break}o=p[0];var m=p[1],b=p[2],x=e.properties[m];if(!x){$e("Skipping property: Invalid property name in: "+o),u();continue}var E=t.parse(m,b);if(!E){$e("Skipping property: Invalid property definition in: "+o),u();continue}y.push({name:m,val:b}),u()}if(v){s();break}t.selector(f);for(var S=0;S<y.length;S++){var w=y[S];t.css(w.name,w.val)}s()}return t};Zu.fromString=function(r){var e=this;return e.resetToDefault(),e.appendFromString(r),e};var st={};(function(){var r=ft,e=Gp,t=$p,n=Up,a=Wp,i=function(z){return"^"+z+"\\s*\\(\\s*([\\w\\.]+)\\s*\\)$"},o=function(z){var V=r+"|\\w+|"+e+"|"+t+"|"+n+"|"+a;return"^"+z+"\\s*\\(([\\w\\.]+)\\s*\\,\\s*("+r+")\\s*\\,\\s*("+r+")\\s*,\\s*("+V+")\\s*\\,\\s*("+V+")\\)$"},s=[`^url\\s*\\(\\s*['"]?(.+?)['"]?\\s*\\)$`,"^(none)$","^(.+)$"];st.types={time:{number:!0,min:0,units:"s|ms",implicitUnits:"ms"},percent:{number:!0,min:0,max:100,units:"%",implicitUnits:"%"},percentages:{number:!0,min:0,max:100,units:"%",implicitUnits:"%",multiple:!0},zeroOneNumber:{number:!0,min:0,max:1,unitless:!0},zeroOneNumbers:{number:!0,min:0,max:1,unitless:!0,multiple:!0},nOneOneNumber:{number:!0,min:-1,max:1,unitless:!0},nonNegativeInt:{number:!0,min:0,integer:!0,unitless:!0},nonNegativeNumber:{number:!0,min:0,unitless:!0},position:{enums:["parent","origin"]},nodeSize:{number:!0,min:0,enums:["label"]},number:{number:!0,unitless:!0},numbers:{number:!0,unitless:!0,multiple:!0},positiveNumber:{number:!0,unitless:!0,min:0,strictMin:!0},size:{number:!0,min:0},bidirectionalSize:{number:!0},bidirectionalSizeMaybePercent:{number:!0,allowPercent:!0},bidirectionalSizes:{number:!0,multiple:!0},sizeMaybePercent:{number:!0,min:0,allowPercent:!0},axisDirection:{enums:["horizontal","leftward","rightward","vertical","upward","downward","auto"]},axisDirectionExplicit:{enums:["leftward","rightward","upward","downward"]},axisDirectionPrimary:{enums:["horizontal","vertical"]},paddingRelativeTo:{enums:["width","height","average","min","max"]},bgWH:{number:!0,min:0,allowPercent:!0,enums:["auto"],multiple:!0},bgPos:{number:!0,allowPercent:!0,multiple:!0},bgRelativeTo:{enums:["inner","include-padding"],multiple:!0},bgRepeat:{enums:["repeat","repeat-x","repeat-y","no-repeat"],multiple:!0},bgFit:{enums:["none","contain","cover"],multiple:!0},bgCrossOrigin:{enums:["anonymous","use-credentials","null"],multiple:!0},bgClip:{enums:["none","node"],multiple:!0},bgContainment:{enums:["inside","over"],multiple:!0},boxSelection:{enums:["contain","overlap","none"]},color:{color:!0},colors:{color:!0,multiple:!0},fill:{enums:["solid","linear-gradient","radial-gradient"]},bool:{enums:["yes","no"]},bools:{enums:["yes","no"],multiple:!0},lineStyle:{enums:["solid","dotted","dashed"]},lineCap:{enums:["butt","round","square"]},linePosition:{enums:["center","inside","outside"]},lineJoin:{enums:["round","bevel","miter"]},borderStyle:{enums:["solid","dotted","dashed","double"]},curveStyle:{enums:["bezier","unbundled-bezier","haystack","segments","straight","straight-triangle","taxi","round-segments","round-taxi"]},radiusType:{enums:["arc-radius","influence-radius"],multiple:!0},fontFamily:{regex:'^([\\w- \\"]+(?:\\s*,\\s*[\\w- \\"]+)*)$'},fontStyle:{enums:["italic","normal","oblique"]},fontWeight:{enums:["normal","bold","bolder","lighter","100","200","300","400","500","600","800","900",100,200,300,400,500,600,700,800,900]},textDecoration:{enums:["none","underline","overline","line-through"]},textTransform:{enums:["none","uppercase","lowercase"]},textWrap:{enums:["none","wrap","ellipsis"]},textOverflowWrap:{enums:["whitespace","anywhere"]},textBackgroundShape:{enums:["rectangle","roundrectangle","round-rectangle","circle"]},nodeShape:{enums:["rectangle","roundrectangle","round-rectangle","cutrectangle","cut-rectangle","bottomroundrectangle","bottom-round-rectangle","barrel","ellipse","triangle","round-triangle","square","pentagon","round-pentagon","hexagon","round-hexagon","concavehexagon","concave-hexagon","heptagon","round-heptagon","octagon","round-octagon","tag","round-tag","star","diamond","round-diamond","vee","rhomboid","right-rhomboid","polygon"]},overlayShape:{enums:["roundrectangle","round-rectangle","ellipse"]},cornerRadius:{number:!0,min:0,units:"px|em",implicitUnits:"px",enums:["auto"]},compoundIncludeLabels:{enums:["include","exclude"]},arrowShape:{enums:["tee","triangle","triangle-tee","circle-triangle","triangle-cross","triangle-backcurve","vee","square","circle","diamond","chevron","none"]},arrowFill:{enums:["filled","hollow"]},arrowWidth:{number:!0,units:"%|px|em",implicitUnits:"px",enums:["match-line"]},display:{enums:["element","none"]},visibility:{enums:["hidden","visible"]},zCompoundDepth:{enums:["bottom","orphan","auto","top"]},zIndexCompare:{enums:["auto","manual"]},valign:{enums:["top","center","bottom"]},halign:{enums:["left","center","right"]},justification:{enums:["left","center","right","auto"]},text:{string:!0},data:{mapping:!0,regex:i("data")},layoutData:{mapping:!0,regex:i("layoutData")},scratch:{mapping:!0,regex:i("scratch")},mapData:{mapping:!0,regex:o("mapData")},mapLayoutData:{mapping:!0,regex:o("mapLayoutData")},mapScratch:{mapping:!0,regex:o("mapScratch")},fn:{mapping:!0,fn:!0},url:{regexes:s,singleRegexMatchValue:!0},urls:{regexes:s,singleRegexMatchValue:!0,multiple:!0},propList:{propList:!0},angle:{number:!0,units:"deg|rad",implicitUnits:"rad"},textRotation:{number:!0,units:"deg|rad",implicitUnits:"rad",enums:["none","autorotate"]},polygonPointList:{number:!0,multiple:!0,evenMultiple:!0,min:-1,max:1,unitless:!0},edgeDistances:{enums:["intersection","node-position","endpoints"]},edgeEndpoint:{number:!0,multiple:!0,units:"%|px|em|deg|rad",implicitUnits:"px",enums:["inside-to-node","outside-to-node","outside-to-node-or-label","outside-to-line","outside-to-line-or-label"],singleEnum:!0,validate:function(z,V){switch(z.length){case 2:return V[0]!=="deg"&&V[0]!=="rad"&&V[1]!=="deg"&&V[1]!=="rad";case 1:return he(z[0])||V[0]==="deg"||V[0]==="rad";default:return!1}}},easing:{regexes:["^(spring)\\s*\\(\\s*("+r+")\\s*,\\s*("+r+")\\s*\\)$","^(cubic-bezier)\\s*\\(\\s*("+r+")\\s*,\\s*("+r+")\\s*,\\s*("+r+")\\s*,\\s*("+r+")\\s*\\)$"],enums:["linear","ease","ease-in","ease-out","ease-in-out","ease-in-sine","ease-out-sine","ease-in-out-sine","ease-in-quad","ease-out-quad","ease-in-out-quad","ease-in-cubic","ease-out-cubic","ease-in-out-cubic","ease-in-quart","ease-out-quart","ease-in-out-quart","ease-in-quint","ease-out-quint","ease-in-out-quint","ease-in-expo","ease-out-expo","ease-in-out-expo","ease-in-circ","ease-out-circ","ease-in-out-circ"]},gradientDirection:{enums:["to-bottom","to-top","to-left","to-right","to-bottom-right","to-bottom-left","to-top-right","to-top-left","to-right-bottom","to-left-bottom","to-right-top","to-left-top"]},boundsExpansion:{number:!0,multiple:!0,min:0,validate:function(z){var V=z.length;return V===1||V===2||V===4}}};var u={zeroNonZero:function(z,V){return(z==null||V==null)&&z!==V||z==0&&V!=0?!0:z!=0&&V==0},any:function(z,V){return z!=V},emptyNonEmpty:function(z,V){var W=Kr(z),re=Kr(V);return W&&!re||!W&&re}},l=st.types,c=[{name:"label",type:l.text,triggersBounds:u.any,triggersZOrder:u.emptyNonEmpty},{name:"text-rotation",type:l.textRotation,triggersBounds:u.any},{name:"text-margin-x",type:l.bidirectionalSize,triggersBounds:u.any},{name:"text-margin-y",type:l.bidirectionalSize,triggersBounds:u.any}],f=[{name:"source-label",type:l.text,triggersBounds:u.any},{name:"source-text-rotation",type:l.textRotation,triggersBounds:u.any},{name:"source-text-margin-x",type:l.bidirectionalSize,triggersBounds:u.any},{name:"source-text-margin-y",type:l.bidirectionalSize,triggersBounds:u.any},{name:"source-text-offset",type:l.size,triggersBounds:u.any}],d=[{name:"target-label",type:l.text,triggersBounds:u.any},{name:"target-text-rotation",type:l.textRotation,triggersBounds:u.any},{name:"target-text-margin-x",type:l.bidirectionalSize,triggersBounds:u.any},{name:"target-text-margin-y",type:l.bidirectionalSize,triggersBounds:u.any},{name:"target-text-offset",type:l.size,triggersBounds:u.any}],h=[{name:"font-family",type:l.fontFamily,triggersBounds:u.any},{name:"font-style",type:l.fontStyle,triggersBounds:u.any},{name:"font-weight",type:l.fontWeight,triggersBounds:u.any},{name:"font-size",type:l.size,triggersBounds:u.any},{name:"text-transform",type:l.textTransform,triggersBounds:u.any},{name:"text-wrap",type:l.textWrap,triggersBounds:u.any},{name:"text-overflow-wrap",type:l.textOverflowWrap,triggersBounds:u.any},{name:"text-max-width",type:l.size,triggersBounds:u.any},{name:"text-outline-width",type:l.size,triggersBounds:u.any},{name:"line-height",type:l.positiveNumber,triggersBounds:u.any}],v=[{name:"text-valign",type:l.valign,triggersBounds:u.any},{name:"text-halign",type:l.halign,triggersBounds:u.any},{name:"color",type:l.color},{name:"text-outline-color",type:l.color},{name:"text-outline-opacity",type:l.zeroOneNumber},{name:"text-background-color",type:l.color},{name:"text-background-opacity",type:l.zeroOneNumber},{name:"text-background-padding",type:l.size,triggersBounds:u.any},{name:"text-border-opacity",type:l.zeroOneNumber},{name:"text-border-color",type:l.color},{name:"text-border-width",type:l.size,triggersBounds:u.any},{name:"text-border-style",type:l.borderStyle,triggersBounds:u.any},{name:"text-background-shape",type:l.textBackgroundShape,triggersBounds:u.any},{name:"text-justification",type:l.justification},{name:"box-select-labels",type:l.bool,triggersBounds:u.any}],y=[{name:"events",type:l.bool,triggersZOrder:u.any},{name:"text-events",type:l.bool,triggersZOrder:u.any},{name:"box-selection",type:l.boxSelection,triggersZOrder:u.any}],g=[{name:"display",type:l.display,triggersZOrder:u.any,triggersBounds:u.any,triggersBoundsOfConnectedEdges:u.any,triggersBoundsOfParallelEdges:function(z,V,W){return z===V?!1:W.pstyle("curve-style").value==="bezier"}},{name:"visibility",type:l.visibility,triggersZOrder:u.any},{name:"opacity",type:l.zeroOneNumber,triggersZOrder:u.zeroNonZero},{name:"text-opacity",type:l.zeroOneNumber},{name:"min-zoomed-font-size",type:l.size},{name:"z-compound-depth",type:l.zCompoundDepth,triggersZOrder:u.any},{name:"z-index-compare",type:l.zIndexCompare,triggersZOrder:u.any},{name:"z-index",type:l.number,triggersZOrder:u.any}],p=[{name:"overlay-padding",type:l.size,triggersBounds:u.any},{name:"overlay-color",type:l.color},{name:"overlay-opacity",type:l.zeroOneNumber,triggersBounds:u.zeroNonZero},{name:"overlay-shape",type:l.overlayShape,triggersBounds:u.any},{name:"overlay-corner-radius",type:l.cornerRadius}],m=[{name:"underlay-padding",type:l.size,triggersBounds:u.any},{name:"underlay-color",type:l.color},{name:"underlay-opacity",type:l.zeroOneNumber,triggersBounds:u.zeroNonZero},{name:"underlay-shape",type:l.overlayShape,triggersBounds:u.any},{name:"underlay-corner-radius",type:l.cornerRadius}],b=[{name:"transition-property",type:l.propList},{name:"transition-duration",type:l.time},{name:"transition-delay",type:l.time},{name:"transition-timing-function",type:l.easing}],x=function(z,V){return V.value==="label"?-z.poolIndex():V.pfValue},E=[{name:"height",type:l.nodeSize,triggersBounds:u.any,hashOverride:x},{name:"width",type:l.nodeSize,triggersBounds:u.any,hashOverride:x},{name:"shape",type:l.nodeShape,triggersBounds:u.any},{name:"shape-polygon-points",type:l.polygonPointList,triggersBounds:u.any},{name:"corner-radius",type:l.cornerRadius},{name:"background-color",type:l.color},{name:"background-fill",type:l.fill},{name:"background-opacity",type:l.zeroOneNumber},{name:"background-blacken",type:l.nOneOneNumber},{name:"background-gradient-stop-colors",type:l.colors},{name:"background-gradient-stop-positions",type:l.percentages},{name:"background-gradient-direction",type:l.gradientDirection},{name:"padding",type:l.sizeMaybePercent,triggersBounds:u.any},{name:"padding-relative-to",type:l.paddingRelativeTo,triggersBounds:u.any},{name:"bounds-expansion",type:l.boundsExpansion,triggersBounds:u.any}],S=[{name:"border-color",type:l.color},{name:"border-opacity",type:l.zeroOneNumber},{name:"border-width",type:l.size,triggersBounds:u.any},{name:"border-style",type:l.borderStyle},{name:"border-cap",type:l.lineCap},{name:"border-join",type:l.lineJoin},{name:"border-dash-pattern",type:l.numbers},{name:"border-dash-offset",type:l.number},{name:"border-position",type:l.linePosition}],w=[{name:"outline-color",type:l.color},{name:"outline-opacity",type:l.zeroOneNumber},{name:"outline-width",type:l.size,triggersBounds:u.any},{name:"outline-style",type:l.borderStyle},{name:"outline-offset",type:l.size,triggersBounds:u.any}],k=[{name:"background-image",type:l.urls},{name:"background-image-crossorigin",type:l.bgCrossOrigin},{name:"background-image-opacity",type:l.zeroOneNumbers},{name:"background-image-containment",type:l.bgContainment},{name:"background-image-smoothing",type:l.bools},{name:"background-position-x",type:l.bgPos},{name:"background-position-y",type:l.bgPos},{name:"background-width-relative-to",type:l.bgRelativeTo},{name:"background-height-relative-to",type:l.bgRelativeTo},{name:"background-repeat",type:l.bgRepeat},{name:"background-fit",type:l.bgFit},{name:"background-clip",type:l.bgClip},{name:"background-width",type:l.bgWH},{name:"background-height",type:l.bgWH},{name:"background-offset-x",type:l.bgPos},{name:"background-offset-y",type:l.bgPos}],_=[{name:"position",type:l.position,triggersBounds:u.any},{name:"compound-sizing-wrt-labels",type:l.compoundIncludeLabels,triggersBounds:u.any},{name:"min-width",type:l.size,triggersBounds:u.any},{name:"min-width-bias-left",type:l.sizeMaybePercent,triggersBounds:u.any},{name:"min-width-bias-right",type:l.sizeMaybePercent,triggersBounds:u.any},{name:"min-height",type:l.size,triggersBounds:u.any},{name:"min-height-bias-top",type:l.sizeMaybePercent,triggersBounds:u.any},{name:"min-height-bias-bottom",type:l.sizeMaybePercent,triggersBounds:u.any}],C=[{name:"line-style",type:l.lineStyle},{name:"line-color",type:l.color},{name:"line-fill",type:l.fill},{name:"line-cap",type:l.lineCap},{name:"line-opacity",type:l.zeroOneNumber},{name:"line-dash-pattern",type:l.numbers},{name:"line-dash-offset",type:l.number},{name:"line-outline-width",type:l.size},{name:"line-outline-color",type:l.color},{name:"line-gradient-stop-colors",type:l.colors},{name:"line-gradient-stop-positions",type:l.percentages},{name:"curve-style",type:l.curveStyle,triggersBounds:u.any,triggersBoundsOfParallelEdges:function(z,V){return z===V?!1:z==="bezier"||V==="bezier"}},{name:"haystack-radius",type:l.zeroOneNumber,triggersBounds:u.any},{name:"source-endpoint",type:l.edgeEndpoint,triggersBounds:u.any},{name:"target-endpoint",type:l.edgeEndpoint,triggersBounds:u.any},{name:"control-point-step-size",type:l.size,triggersBounds:u.any},{name:"control-point-distances",type:l.bidirectionalSizes,triggersBounds:u.any},{name:"control-point-weights",type:l.numbers,triggersBounds:u.any},{name:"segment-distances",type:l.bidirectionalSizes,triggersBounds:u.any},{name:"segment-weights",type:l.numbers,triggersBounds:u.any},{name:"segment-radii",type:l.numbers,triggersBounds:u.any},{name:"radius-type",type:l.radiusType,triggersBounds:u.any},{name:"taxi-turn",type:l.bidirectionalSizeMaybePercent,triggersBounds:u.any},{name:"taxi-turn-min-distance",type:l.size,triggersBounds:u.any},{name:"taxi-direction",type:l.axisDirection,triggersBounds:u.any},{name:"taxi-radius",type:l.number,triggersBounds:u.any},{name:"edge-distances",type:l.edgeDistances,triggersBounds:u.any},{name:"arrow-scale",type:l.positiveNumber,triggersBounds:u.any},{name:"loop-direction",type:l.angle,triggersBounds:u.any},{name:"loop-sweep",type:l.angle,triggersBounds:u.any},{name:"source-distance-from-node",type:l.size,triggersBounds:u.any},{name:"target-distance-from-node",type:l.size,triggersBounds:u.any}],T=[{name:"ghost",type:l.bool,triggersBounds:u.any},{name:"ghost-offset-x",type:l.bidirectionalSize,triggersBounds:u.any},{name:"ghost-offset-y",type:l.bidirectionalSize,triggersBounds:u.any},{name:"ghost-opacity",type:l.zeroOneNumber}],D=[{name:"selection-box-color",type:l.color},{name:"selection-box-opacity",type:l.zeroOneNumber},{name:"selection-box-border-color",type:l.color},{name:"selection-box-border-width",type:l.size},{name:"active-bg-color",type:l.color},{name:"active-bg-opacity",type:l.zeroOneNumber},{name:"active-bg-size",type:l.size},{name:"outside-texture-bg-color",type:l.color},{name:"outside-texture-bg-opacity",type:l.zeroOneNumber}],A=[];st.pieBackgroundN=16,A.push({name:"pie-size",type:l.sizeMaybePercent}),A.push({name:"pie-hole",type:l.sizeMaybePercent}),A.push({name:"pie-start-angle",type:l.angle});for(var R=1;R<=st.pieBackgroundN;R++)A.push({name:"pie-"+R+"-background-color",type:l.color}),A.push({name:"pie-"+R+"-background-size",type:l.percent}),A.push({name:"pie-"+R+"-background-opacity",type:l.zeroOneNumber});var M=[];st.stripeBackgroundN=16,M.push({name:"stripe-size",type:l.sizeMaybePercent}),M.push({name:"stripe-direction",type:l.axisDirectionPrimary});for(var L=1;L<=st.stripeBackgroundN;L++)M.push({name:"stripe-"+L+"-background-color",type:l.color}),M.push({name:"stripe-"+L+"-background-size",type:l.percent}),M.push({name:"stripe-"+L+"-background-opacity",type:l.zeroOneNumber});var B=[],I=st.arrowPrefixes=["source","mid-source","target","mid-target"];[{name:"arrow-shape",type:l.arrowShape,triggersBounds:u.any},{name:"arrow-color",type:l.color},{name:"arrow-fill",type:l.arrowFill},{name:"arrow-width",type:l.arrowWidth}].forEach(function(O){I.forEach(function(z){var V=z+"-"+O.name,W=O.type,re=O.triggersBounds;B.push({name:V,type:W,triggersBounds:re})})},{});var H=st.properties=[].concat(y,b,g,p,m,T,v,h,c,f,d,E,S,w,k,A,M,_,C,B,D),q=st.propertyGroups={behavior:y,transition:b,visibility:g,overlay:p,underlay:m,ghost:T,commonLabel:v,labelDimensions:h,mainLabel:c,sourceLabel:f,targetLabel:d,nodeBody:E,nodeBorder:S,nodeOutline:w,backgroundImage:k,pie:A,stripe:M,compound:_,edgeLine:C,edgeArrow:B,core:D},N=st.propertyGroupNames={},G=st.propertyGroupKeys=Object.keys(q);G.forEach(function(O){N[O]=q[O].map(function(z){return z.name}),q[O].forEach(function(z){return z.groupKey=O})});var X=st.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"}];st.propertyNames=H.map(function(O){return O.name});for(var j=0;j<H.length;j++){var Q=H[j];H[Q.name]=Q}for(var Z=0;Z<X.length;Z++){var te=X[Z],ne=H[te.pointsTo],$={name:te.name,alias:!0,pointsTo:ne};H.push($),H[te.name]=$}})();st.getDefaultProperty=function(r){return this.getDefaultProperties()[r]};st.getDefaultProperties=function(){var r=this._private;if(r.defaultProperties!=null)return r.defaultProperties;for(var e=be({"selection-box-color":"#ddd","selection-box-opacity":.65,"selection-box-border-color":"#aaa","selection-box-border-width":1,"active-bg-color":"black","active-bg-opacity":.15,"active-bg-size":30,"outside-texture-bg-color":"#000","outside-texture-bg-opacity":.125,events:"yes","text-events":"no","text-valign":"top","text-halign":"center","text-justification":"auto","line-height":1,color:"#000","box-selection":"contain","text-outline-color":"#000","text-outline-width":0,"text-outline-opacity":1,"text-opacity":1,"text-decoration":"none","text-transform":"none","text-wrap":"none","text-overflow-wrap":"whitespace","text-max-width":9999,"text-background-color":"#000","text-background-opacity":0,"text-background-shape":"rectangle","text-background-padding":0,"text-border-opacity":0,"text-border-width":0,"text-border-style":"solid","text-border-color":"#000","font-family":"Helvetica Neue, Helvetica, sans-serif","font-style":"normal","font-weight":"normal","font-size":16,"min-zoomed-font-size":0,"text-rotation":"none","source-text-rotation":"none","target-text-rotation":"none",visibility:"visible",display:"element",opacity:1,"z-compound-depth":"auto","z-index-compare":"auto","z-index":0,label:"","text-margin-x":0,"text-margin-y":0,"source-label":"","source-text-offset":0,"source-text-margin-x":0,"source-text-margin-y":0,"target-label":"","target-text-offset":0,"target-text-margin-x":0,"target-text-margin-y":0,"overlay-opacity":0,"overlay-color":"#000","overlay-padding":10,"overlay-shape":"round-rectangle","overlay-corner-radius":"auto","underlay-opacity":0,"underlay-color":"#000","underlay-padding":10,"underlay-shape":"round-rectangle","underlay-corner-radius":"auto","transition-property":"none","transition-duration":0,"transition-delay":0,"transition-timing-function":"linear","box-select-labels":"no","background-blacken":0,"background-color":"#999","background-fill":"solid","background-opacity":1,"background-image":"none","background-image-crossorigin":"anonymous","background-image-opacity":1,"background-image-containment":"inside","background-image-smoothing":"yes","background-position-x":"50%","background-position-y":"50%","background-offset-x":0,"background-offset-y":0,"background-width-relative-to":"include-padding","background-height-relative-to":"include-padding","background-repeat":"no-repeat","background-fit":"none","background-clip":"node","background-width":"auto","background-height":"auto","border-color":"#000","border-opacity":1,"border-width":0,"border-style":"solid","border-dash-pattern":[4,2],"border-dash-offset":0,"border-cap":"butt","border-join":"miter","border-position":"center","outline-color":"#999","outline-opacity":1,"outline-width":0,"outline-offset":0,"outline-style":"solid",height:30,width:30,shape:"ellipse","shape-polygon-points":"-1, -1, 1, -1, 1, 1, -1, 1","corner-radius":"auto","bounds-expansion":0,"background-gradient-direction":"to-bottom","background-gradient-stop-colors":"#999","background-gradient-stop-positions":"0%",ghost:"no","ghost-offset-y":0,"ghost-offset-x":0,"ghost-opacity":0,padding:0,"padding-relative-to":"width",position:"origin","compound-sizing-wrt-labels":"include","min-width":0,"min-width-bias-left":0,"min-width-bias-right":0,"min-height":0,"min-height-bias-top":0,"min-height-bias-bottom":0},{"pie-size":"100%","pie-hole":0,"pie-start-angle":"0deg"},[{name:"pie-{{i}}-background-color",value:"black"},{name:"pie-{{i}}-background-size",value:"0%"},{name:"pie-{{i}}-background-opacity",value:1}].reduce(function(u,l){for(var c=1;c<=st.pieBackgroundN;c++){var f=l.name.replace("{{i}}",c),d=l.value;u[f]=d}return u},{}),{"stripe-size":"100%","stripe-direction":"horizontal"},[{name:"stripe-{{i}}-background-color",value:"black"},{name:"stripe-{{i}}-background-size",value:"0%"},{name:"stripe-{{i}}-background-opacity",value:1}].reduce(function(u,l){for(var c=1;c<=st.stripeBackgroundN;c++){var f=l.name.replace("{{i}}",c),d=l.value;u[f]=d}return u},{}),{"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(u,l){return st.arrowPrefixes.forEach(function(c){var f=c+"-"+l.name,d=l.value;u[f]=d}),u},{})),t={},n=0;n<this.properties.length;n++){var a=this.properties[n];if(!a.pointsTo){var i=a.name,o=e[i],s=this.parse(i,o);t[i]=s}}return r.defaultProperties=t,r.defaultProperties};st.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 io={};io.parse=function(r,e,t,n){var a=this;if(je(e))return a.parseImplWarn(r,e,t,n);var i=n==="mapping"||n===!0||n===!1||n==null?"dontcare":n,o=t?"t":"f",s=""+e,u=Nd(r,s,o,i),l=a.propCache=a.propCache||[],c;return(c=l[u])||(c=l[u]=a.parseImplWarn(r,e,t,n)),(t||n==="mapping")&&(c=yr(c),c&&(c.value=yr(c.value))),c};io.parseImplWarn=function(r,e,t,n){var a=this.parseImpl(r,e,t,n);return!a&&e!=null&&$e("The style property `".concat(r,": ").concat(e,"` is invalid")),a&&(a.name==="width"||a.name==="height")&&e==="label"&&$e("The style value of `label` is deprecated for `"+a.name+"`"),a};io.parseImpl=function(r,e,t,n){var a=this;r=Lu(r);var i=a.properties[r],o=e,s=a.types;if(!i||e===void 0)return null;i.alias&&(i=i.pointsTo,r=i.name);var u=he(e);u&&(e=e.trim());var l=i.type;if(!l)return null;if(t&&(e===""||e===null))return{name:r,value:e,bypass:!0,deleteBypass:!0};if(je(e))return{name:r,value:e,strValue:"fn",mapped:s.fn,bypass:t};var c,f;if(!(!u||n||e.length<7||e[1]!=="a")){if(e.length>=7&&e[0]==="d"&&(c=new RegExp(s.data.regex).exec(e))){if(t)return!1;var d=s.data;return{name:r,value:c,strValue:""+e,mapped:d,field:c[1],bypass:t}}else if(e.length>=10&&e[0]==="m"&&(f=new RegExp(s.mapData.regex).exec(e))){if(t||l.multiple)return!1;var h=s.mapData;if(!(l.color||l.number))return!1;var v=this.parse(r,f[4]);if(!v||v.mapped)return!1;var y=this.parse(r,f[5]);if(!y||y.mapped)return!1;if(v.pfValue===y.pfValue||v.strValue===y.strValue)return $e("`"+r+": "+e+"` is not a valid mapper because the output range is zero; converting to `"+r+": "+v.strValue+"`"),this.parse(r,v.strValue);if(l.color){var g=v.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:h,field:f[1],fieldMin:parseFloat(f[2]),fieldMax:parseFloat(f[3]),valueMin:v.value,valueMax:y.value,bypass:t}}}if(l.multiple&&n!=="multiple"){var b;if(u?b=e.split(/\s+/):We(e)?b=e:b=[e],l.evenMultiple&&b.length%2!==0)return null;for(var x=[],E=[],S=[],w="",k=!1,_=0;_<b.length;_++){var C=a.parse(r,b[_],t,"multiple");k=k||he(C.value),x.push(C.value),S.push(C.pfValue!=null?C.pfValue:C.value),E.push(C.units),w+=(_>0?" ":"")+C.strValue}return l.validate&&!l.validate(x,E)?null:l.singleEnum&&k?x.length===1&&he(x[0])?{name:r,value:x[0],strValue:x[0],bypass:t}:null:{name:r,value:x,pfValue:S,strValue:w,bypass:t,units:E}}var T=function(){for(var $=0;$<l.enums.length;$++){var O=l.enums[$];if(O===e)return{name:r,value:e,strValue:""+e,bypass:t}}return null};if(l.number){var D,A="px";if(l.units&&(D=l.units),l.implicitUnits&&(A=l.implicitUnits),!l.unitless)if(u){var R="px|em"+(l.allowPercent?"|\\%":"");D&&(R=D);var M=e.match("^("+ft+")("+R+")?$");M&&(e=M[1],D=M[2]||A)}else(!D||l.implicitUnits)&&(D=A);if(e=parseFloat(e),isNaN(e)&&l.enums===void 0)return null;if(isNaN(e)&&l.enums!==void 0)return e=o,T();if(l.integer&&!Op(e)||l.min!==void 0&&(e<l.min||l.strictMin&&e===l.min)||l.max!==void 0&&(e>l.max||l.strictMax&&e===l.max))return null;var L={name:r,value:e,strValue:""+e+(D||""),units:D,bypass:t};return l.unitless||D!=="px"&&D!=="em"?L.pfValue=e:L.pfValue=D==="px"||!D?e:this.getEmSizeInPixels()*e,(D==="ms"||D==="s")&&(L.pfValue=D==="ms"?e:1e3*e),(D==="deg"||D==="rad")&&(L.pfValue=D==="rad"?e:Ug(e)),D==="%"&&(L.pfValue=e/100),L}else if(l.propList){var B=[],I=""+e;if(I!=="none"){for(var H=I.split(/\s*,\s*|\s+/),q=0;q<H.length;q++){var N=H[q].trim();a.properties[N]?B.push(N):$e("`"+N+"` is not a valid property name")}if(B.length===0)return null}return{name:r,value:B,strValue:B.length===0?"none":B.join(" "),bypass:t}}else if(l.color){var G=Ad(e);return G?{name:r,value:G,pfValue:G,strValue:"rgb("+G[0]+","+G[1]+","+G[2]+")",bypass:t}:null}else if(l.regex||l.regexes){if(l.enums){var X=T();if(X)return X}for(var j=l.regexes?l.regexes:[l.regex],Q=0;Q<j.length;Q++){var Z=new RegExp(j[Q]),te=Z.exec(e);if(te)return{name:r,value:l.singleRegexMatchValue?te[1]:te,strValue:""+e,bypass:t}}return null}else return l.string?{name:r,value:""+e,strValue:""+e,bypass:t}:l.enums?T():null};var yt=function(e){if(!(this instanceof yt))return new yt(e);if(!Bu(e)){Qe("A style must have a core reference");return}this._private={cy:e,coreStyle:{}},this.length=0,this.resetToDefault()},_t=yt.prototype;_t.instanceString=function(){return"style"};_t.clear=function(){for(var r=this._private,e=r.cy,t=e.elements(),n=0;n<this.length;n++)this[n]=void 0;return this.length=0,r.contextStyles={},r.propDiffs={},this.cleanElements(t,!0),t.forEach(function(a){var i=a[0]._private;i.styleDirty=!0,i.appliedInitStyle=!1}),this};_t.resetToDefault=function(){return this.clear(),this.addDefaultStylesheet(),this};_t.core=function(r){return this._private.coreStyle[r]||this.getDefaultProperty(r)};_t.selector=function(r){var e=r==="core"?null:new Jr(r),t=this.length++;return this[t]={selector:e,properties:[],mappedProperties:[],index:t},this};_t.css=function(){var r=this,e=arguments;if(e.length===1)for(var t=e[0],n=0;n<r.properties.length;n++){var a=r.properties[n],i=t[a.name];i===void 0&&(i=t[Ui(a.name)]),i!==void 0&&this.cssRule(a.name,i)}else e.length===2&&this.cssRule(e[0],e[1]);return this};_t.style=_t.css;_t.cssRule=function(r,e){var t=this.parse(r,e);if(t){var n=this.length-1;this[n].properties.push(t),this[n].properties[t.name]=t,t.name.match(/pie-(\d+)-background-size/)&&t.value&&(this._private.hasPie=!0),t.name.match(/stripe-(\d+)-background-size/)&&t.value&&(this._private.hasStripe=!0),t.mapped&&this[n].mappedProperties.push(t);var a=!this[n].selector;a&&(this._private.coreStyle[t.name]=t)}return this};_t.append=function(r){return _d(r)?r.appendToStyle(this):We(r)?this.appendFromJson(r):he(r)&&this.appendFromString(r),this};yt.fromJson=function(r,e){var t=new yt(r);return t.fromJson(e),t};yt.fromString=function(r,e){return new yt(r).fromString(e)};[mt,Ga,Ku,mr,ao,Zu,st,io].forEach(function(r){be(_t,r)});yt.types=_t.types;yt.properties=_t.properties;yt.propertyGroups=_t.propertyGroups;yt.propertyGroupNames=_t.propertyGroupNames;yt.propertyGroupKeys=_t.propertyGroupKeys;var K0={style:function(e){if(e){var t=this.setStyle(e);t.update()}return this._private.style},setStyle:function(e){var t=this._private;return _d(e)?t.style=e.generateStyle(this):We(e)?t.style=yt.fromJson(this,e):he(e)?t.style=yt.fromString(this,e):t.style=yt(this),t.style},updateStyle:function(){this.mutableElements().updateStyle()}},Z0="single",wn={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=Z0),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,n,a,i,o,s;switch(e.length){case 0:return t;case 1:if(he(e[0]))return n=e[0],t[n];if(Ne(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;n=e[0],a=e[1],(n==="x"||n==="y")&&ae(a)&&(t[n]=a),this.emit("pan viewport");break}return this.notify("viewport"),this},panBy:function(e,t){var n=arguments,a=this._private.pan,i,o,s,u,l;if(!this._private.panningEnabled)return this;switch(n.length){case 1:Ne(e)&&(s=n[0],u=s.x,l=s.y,ae(u)&&(a.x+=u),ae(l)&&(a.y+=l),this.emit("pan viewport"));break;case 2:i=e,o=t,(i==="x"||i==="y")&&ae(o)&&(a[i]+=o),this.emit("pan viewport");break}return this.notify("viewport"),this},gc:function(){this.notify("gc")},fit:function(e,t){var n=this.getFitViewport(e,t);if(n){var a=this._private;a.zoom=n.zoom,a.pan=n.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 n;if(he(e)){var a=e;e=this.$(a)}else if(zp(e)){var i=e;n={x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2},n.w=n.x2-n.x1,n.h=n.y2-n.y1}else qt(e)||(e=this.mutableElements());if(!(qt(e)&&e.empty())){n=n||e.boundingBox();var o=this.width(),s=this.height(),u;if(t=ae(t)?t:0,!isNaN(o)&&!isNaN(s)&&o>0&&s>0&&!isNaN(n.w)&&!isNaN(n.h)&&n.w>0&&n.h>0){u=Math.min((o-2*t)/n.w,(s-2*t)/n.h),u=u>this._private.maxZoom?this._private.maxZoom:u,u=u<this._private.minZoom?this._private.minZoom:u;var l={x:(o-u*(n.x1+n.x2))/2,y:(s-u*(n.y1+n.y2))/2};return{zoom:u,pan:l}}}}},zoomRange:function(e,t){var n=this._private;if(t==null){var a=e;e=a.min,t=a.max}return ae(e)&&ae(t)&&e<=t?(n.minZoom=e,n.maxZoom=t):ae(e)&&t===void 0&&e<=n.maxZoom?n.minZoom=e:ae(t)&&e===void 0&&t>=n.minZoom&&(n.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,n=t.pan,a=t.zoom,i,o,s=!1;if(t.zoomingEnabled||(s=!0),ae(e)?o=e:Ne(e)&&(o=e.level,e.position!=null?i=Yi(e.position,a,n):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===a||i!=null&&(!ae(i.x)||!ae(i.y)))return null;if(i!=null){var u=n,l=a,c=o,f={x:-c/l*(i.x-u.x)+i.x,y:-c/l*(i.y-u.y)+i.y};return{zoomed:!0,panned:!0,zoom:c,pan:f}}else return{zoomed:!0,panned:!1,zoom:o,pan:n}},zoom:function(e){if(e===void 0)return this._private.zoom;var t=this.getZoomedViewport(e),n=this._private;return t==null||!t.zoomed?this:(n.zoom=t.zoom,t.panned&&(n.pan.x=t.pan.x,n.pan.y=t.pan.y),this.emit("zoom"+(t.panned?" pan":"")+" viewport"),this.notify("viewport"),this)},viewport:function(e){var t=this._private,n=!0,a=!0,i=[],o=!1,s=!1;if(!e)return this;if(ae(e.zoom)||(n=!1),Ne(e.pan)||(a=!1),!n&&!a)return this;if(n){var u=e.zoom;u<t.minZoom||u>t.maxZoom||!t.zoomingEnabled?o=!0:(t.zoom=u,i.push("zoom"))}if(a&&(!o||!e.cancelOnFailedZoom)&&t.panningEnabled){var l=e.pan;ae(l.x)&&(t.pan.x=l.x,s=!1),ae(l.y)&&(t.pan.y=l.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(he(e)){var n=e;e=this.mutableElements().filter(n)}else qt(e)||(e=this.mutableElements());if(e.length!==0){var a=e.boundingBox(),i=this.width(),o=this.height();t=t===void 0?this._private.zoom:t;var s={x:(i-t*(a.x1+a.x2))/2,y:(o-t*(a.y1+a.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,n=this;return e.sizeCache=e.sizeCache||(t?(function(){var a=n.window().getComputedStyle(t),i=function(s){return parseFloat(a.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,n=this.renderedExtent(),a={x1:(n.x1-e.x)/t,x2:(n.x2-e.x)/t,y1:(n.y1-e.y)/t,y2:(n.y2-e.y)/t};return a.w=a.x2-a.x1,a.h=a.y2-a.y1,a},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}};wn.centre=wn.center;wn.autolockNodes=wn.autolock;wn.autoungrabifyNodes=wn.autoungrabify;var Ma={data:He.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeData:He.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),scratch:He.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:He.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0})};Ma.attr=Ma.data;Ma.removeAttr=Ma.removeData;var Ra=function(e){var t=this;e=be({},e);var n=e.container;n&&!Ri(n)&&Ri(n[0])&&(n=n[0]);var a=n?n._cyreg:null;a=a||{},a&&a.cy&&(a.cy.destroy(),a={});var i=a.readies=a.readies||[];n&&(n._cyreg=a),a.cy=t;var o=ct!==void 0&&n!==void 0&&!e.headless,s=e;s.layout=be({name:o?"grid":"null"},s.layout),s.renderer=be({name:o?"canvas":"null"},s.renderer);var u=function(v,y,g){return y!==void 0?y:g!==void 0?g:v},l=this._private={container:n,ready:!1,options:s,elements:new wt(this),listeners:[],aniEles:new wt(this),data:s.data||{},scratch:{},layout:null,renderer:null,destroyed:!1,notificationsEnabled:!0,minZoom:1e-50,maxZoom:1e50,zoomingEnabled:u(!0,s.zoomingEnabled),userZoomingEnabled:u(!0,s.userZoomingEnabled),panningEnabled:u(!0,s.panningEnabled),userPanningEnabled:u(!0,s.userPanningEnabled),boxSelectionEnabled:u(!0,s.boxSelectionEnabled),autolock:u(!1,s.autolock,s.autolockNodes),autoungrabify:u(!1,s.autoungrabify,s.autoungrabifyNodes),autounselectify:u(!1,s.autounselectify),styleEnabled:s.styleEnabled===void 0?o:s.styleEnabled,zoom:ae(s.zoom)?s.zoom:1,pan:{x:Ne(s.pan)&&ae(s.pan.x)?s.pan.x:0,y:Ne(s.pan)&&ae(s.pan.y)?s.pan.y:0},animation:{current:[],queue:[]},hasCompoundNodes:!1,multiClickDebounceTime:u(250,s.multiClickDebounceTime)};this.createEmitter(),this.selectionType(s.selectionType),this.zoomRange({min:s.minZoom,max:s.maxZoom});var c=function(v,y){var g=v.some(Fp);if(g)return Yn.all(v).then(y);y(v)};l.styleEnabled&&t.setStyle([]);var f=be({},s,s.renderer);t.initRenderer(f);var d=function(v,y,g){t.notifications(!1);var p=t.mutableElements();p.length>0&&p.remove(),v!=null&&(Ne(v)||We(v))&&t.add(v),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=be({},t._private.options.layout);m.eles=t.elements(),t.layout(m).run()};c([s.style,s.elements],function(h){var v=h[0],y=h[1];l.styleEnabled&&t.style().append(v),d(y,function(){t.startAnimationLoop(),l.ready=!0,je(s.ready)&&t.on("ready",s.ready);for(var g=0;g<i.length;g++){var p=i[g];t.on("ready",p)}a&&(a.readies=[]),t.emit("ready")},s.done)})},Fi=Ra.prototype;be(Fi,{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 ct;var t=this._private.container.ownerDocument;return t===void 0||t==null?ct:t.defaultView||ct},mount:function(e){if(e!=null){var t=this,n=t._private,a=n.options;return!Ri(e)&&Ri(e[0])&&(e=e[0]),t.stopAnimationLoop(),t.destroyRenderer(),n.container=e,n.styleEnabled=!0,t.invalidateSize(),t.initRenderer(be({},a,a.renderer,{name:a.renderer.name==="null"?"canvas":a.renderer.name})),t.startAnimationLoop(),t.style(a.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 yr(this._private.options)},json:function(e){var t=this,n=t._private,a=t.mutableElements(),i=function(x){return t.getElementById(x.id())};if(Ne(e)){if(t.startBatch(),e.elements){var o={},s=function(x,E){for(var S=[],w=[],k=0;k<x.length;k++){var _=x[k];if(!_.data.id){$e("cy.json() cannot handle elements without an ID attribute");continue}var C=""+_.data.id,T=t.getElementById(C);o[C]=!0,T.length!==0?w.push({ele:T,json:_}):(E&&(_.group=E),S.push(_))}t.add(S);for(var D=0;D<w.length;D++){var A=w[D],R=A.ele,M=A.json;R.json(M)}};if(We(e.elements))s(e.elements);else for(var u=["nodes","edges"],l=0;l<u.length;l++){var c=u[l],f=e.elements[c];We(f)&&s(f,c)}var d=t.collection();a.filter(function(b){return!o[b.id()]}).forEach(function(b){b.isParent()?d.merge(b):b.remove()}),d.forEach(function(b){return b.children().move({parent:null})}),d.forEach(function(b){return i(b).remove()})}e.style&&t.style(e.style),e.zoom!=null&&e.zoom!==n.zoom&&t.zoom(e.zoom),e.pan&&(e.pan.x!==n.pan.x||e.pan.y!==n.pan.y)&&t.pan(e.pan),e.data&&t.data(e.data);for(var h=["minZoom","maxZoom","zoomingEnabled","userZoomingEnabled","panningEnabled","userPanningEnabled","boxSelectionEnabled","autolock","autoungrabify","autounselectify","multiClickDebounceTime"],v=0;v<h.length;v++){var y=h[v];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={},a.forEach(function(b){var x=b.group();p.elements[x]||(p.elements[x]=[]),p.elements[x].push(b.json())})),this._private.styleEnabled&&(p.style=t.style().json()),p.data=yr(t.data());var m=n.options;return p.zoomingEnabled=n.zoomingEnabled,p.userZoomingEnabled=n.userZoomingEnabled,p.zoom=n.zoom,p.minZoom=n.minZoom,p.maxZoom=n.maxZoom,p.panningEnabled=n.panningEnabled,p.userPanningEnabled=n.userPanningEnabled,p.pan=yr(n.pan),p.boxSelectionEnabled=n.boxSelectionEnabled,p.renderer=yr(m.renderer),p.hideEdgesOnViewport=m.hideEdgesOnViewport,p.textureOnViewport=m.textureOnViewport,p.wheelSensitivity=m.wheelSensitivity,p.motionBlur=m.motionBlur,p.multiClickDebounceTime=m.multiClickDebounceTime,p}}});Fi.$id=Fi.getElementById;[F0,$0,_v,wu,Ti,W0,Eu,_i,K0,wn,Ma].forEach(function(r){be(Fi,r)});var Q0={fit:!0,directed:!1,direction:"downward",padding:30,circle:!1,grid:!1,spacingFactor:1.75,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,roots:void 0,depthSort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}},J0={maximal:!1,acyclic:!1},Rn=function(e){return e.scratch("breadthfirst")},Kf=function(e,t){return e.scratch("breadthfirst",t)};function Pv(r){this.options=be({},Q0,J0,r)}Pv.prototype.run=function(){var r=this.options,e=r.cy,t=r.eles,n=t.nodes().filter(function(ge){return ge.isChildless()}),a=t,i=r.directed,o=r.acyclic||r.maximal||r.maximalAdjustments>0,s=!!r.boundingBox,u=Rt(s?r.boundingBox:structuredClone(e.extent())),l;if(qt(r.roots))l=r.roots;else if(We(r.roots)){for(var c=[],f=0;f<r.roots.length;f++){var d=r.roots[f],h=e.getElementById(d);c.push(h)}l=e.collection(c)}else if(he(r.roots))l=e.$(r.roots);else if(i)l=n.roots();else{var v=t.components();l=e.collection();for(var y=function(){var oe=v[g],ve=oe.maxDegree(!1),de=oe.filter(function(we){return we.degree(!1)===ve});l=l.add(de)},g=0;g<v.length;g++)y()}var p=[],m={},b=function(oe,ve){p[ve]==null&&(p[ve]=[]);var de=p[ve].length;p[ve].push(oe),Kf(oe,{index:de,depth:ve})},x=function(oe,ve){var de=Rn(oe),we=de.depth,xe=de.index;p[we][xe]=null,oe.isChildless()&&b(oe,ve)};a.bfs({roots:l,directed:r.directed,visit:function(oe,ve,de,we,xe){var Ae=oe[0],Be=Ae.id();Ae.isChildless()&&b(Ae,xe),m[Be]=!0}});for(var E=[],S=0;S<n.length;S++){var w=n[S];m[w.id()]||E.push(w)}var k=function(oe){for(var ve=p[oe],de=0;de<ve.length;de++){var we=ve[de];if(we==null){ve.splice(de,1),de--;continue}Kf(we,{depth:oe,index:de})}},_=function(oe,ve){for(var de=Rn(oe),we=oe.incomers().filter(function(J){return J.isNode()&&t.has(J)}),xe=-1,Ae=oe.id(),Be=0;Be<we.length;Be++){var Ve=we[Be],ze=Rn(Ve);xe=Math.max(xe,ze.depth)}if(de.depth<=xe){if(!r.acyclic&&ve[Ae])return null;var Oe=xe+1;return x(oe,Oe),ve[Ae]=Oe,!0}return!1};if(i&&o){var C=[],T={},D=function(oe){return C.push(oe)},A=function(){return C.shift()};for(n.forEach(function(ge){return C.push(ge)});C.length>0;){var R=A(),M=_(R,T);if(M)R.outgoers().filter(function(ge){return ge.isNode()&&t.has(ge)}).forEach(D);else if(M===null){$e("Detected double maximal shift for node `"+R.id()+"`. Bailing maximal adjustment due to cycle. Use `options.maximal: true` only on DAGs.");break}}}var L=0;if(r.avoidOverlap)for(var B=0;B<n.length;B++){var I=n[B],H=I.layoutDimensions(r),q=H.w,N=H.h;L=Math.max(L,q,N)}var G={},X=function(oe){if(G[oe.id()])return G[oe.id()];for(var ve=Rn(oe).depth,de=oe.neighborhood(),we=0,xe=0,Ae=0;Ae<de.length;Ae++){var Be=de[Ae];if(!(Be.isEdge()||Be.isParent()||!n.has(Be))){var Ve=Rn(Be);if(Ve!=null){var ze=Ve.index,Oe=Ve.depth;if(!(ze==null||Oe==null)){var J=p[Oe].length;Oe<ve&&(we+=ze/J,xe++)}}}}return xe=Math.max(1,xe),we=we/xe,xe===0&&(we=0),G[oe.id()]=we,we},j=function(oe,ve){var de=X(oe),we=X(ve),xe=de-we;return xe===0?Dd(oe.id(),ve.id()):xe};r.depthSort!==void 0&&(j=r.depthSort);for(var Q=p.length,Z=0;Z<Q;Z++)p[Z].sort(j),k(Z);for(var te=[],ne=0;ne<E.length;ne++)te.push(E[ne]);var $=function(){for(var oe=0;oe<Q;oe++)k(oe)};te.length&&(p.unshift(te),Q=p.length,$());for(var O=0,z=0;z<Q;z++)O=Math.max(p[z].length,O);var V={x:u.x1+u.w/2,y:u.y1+u.h/2},W=n.reduce(function(ge,oe){return(function(ve){return{w:ge.w===-1?ve.w:(ge.w+ve.w)/2,h:ge.h===-1?ve.h:(ge.h+ve.h)/2}})(oe.boundingBox({includeLabels:r.nodeDimensionsIncludeLabels}))},{w:-1,h:-1}),re=Math.max(Q===1?0:s?(u.h-r.padding*2-W.h)/(Q-1):(u.h-r.padding*2-W.h)/(Q+1),L),se=p.reduce(function(ge,oe){return Math.max(ge,oe.length)},0),Ce=function(oe){var ve=Rn(oe),de=ve.depth,we=ve.index;if(r.circle){var xe=Math.min(u.w/2/Q,u.h/2/Q);xe=Math.max(xe,L);var Ae=xe*de+xe-(Q>0&&p[0].length<=3?xe/2:0),Be=2*Math.PI/p[de].length*we;return de===0&&p[0].length===1&&(Ae=1),{x:V.x+Ae*Math.cos(Be),y:V.y+Ae*Math.sin(Be)}}else{var Ve=p[de].length,ze=Math.max(Ve===1?0:s?(u.w-r.padding*2-W.w)/((r.grid?se:Ve)-1):(u.w-r.padding*2-W.w)/((r.grid?se:Ve)+1),L),Oe={x:V.x+(we+1-(Ve+1)/2)*ze,y:V.y+(de+1-(Q+1)/2)*re};return Oe}},pe={downward:0,leftward:90,upward:180,rightward:-90};Object.keys(pe).indexOf(r.direction)===-1&&Qe("Invalid direction '".concat(r.direction,"' specified for breadthfirst layout. Valid values are: ").concat(Object.keys(pe).join(", ")));var ye=function(oe){return hg(Ce(oe),u,pe[r.direction])};return t.nodes().layoutPositions(this,r,ye),this};var j0={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 Dv(r){this.options=be({},j0,r)}Dv.prototype.run=function(){var r=this.options,e=r,t=r.cy,n=e.eles,a=e.counterclockwise!==void 0?!e.counterclockwise:e.clockwise,i=n.nodes().not(":parent");e.sort&&(i=i.sort(e.sort));for(var o=Rt(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},u=e.sweep===void 0?2*Math.PI-2*Math.PI/i.length:e.sweep,l=u/Math.max(1,i.length-1),c,f=0,d=0;d<i.length;d++){var h=i[d],v=h.layoutDimensions(e),y=v.w,g=v.h;f=Math.max(f,y,g)}if(ae(e.radius)?c=e.radius:i.length<=1?c=0:c=Math.min(o.h,o.w)/2-f,i.length>1&&e.avoidOverlap){f*=1.75;var p=Math.cos(l)-Math.cos(0),m=Math.sin(l)-Math.sin(0),b=Math.sqrt(f*f/(p*p+m*m));c=Math.max(b,c)}var x=function(S,w){var k=e.startAngle+w*l*(a?1:-1),_=c*Math.cos(k),C=c*Math.sin(k),T={x:s.x+_,y:s.y+C};return T};return n.nodes().layoutPositions(this,e,x),this};var eb={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 Av(r){this.options=be({},eb,r)}Av.prototype.run=function(){for(var r=this.options,e=r,t=e.counterclockwise!==void 0?!e.counterclockwise:e.clockwise,n=r.cy,a=e.eles,i=a.nodes().not(":parent"),o=Rt(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()}),s={x:o.x1+o.w/2,y:o.y1+o.h/2},u=[],l=0,c=0;c<i.length;c++){var f=i[c],d=void 0;d=e.concentric(f),u.push({value:d,node:f}),f._private.scratch.concentric=d}i.updateStyle();for(var h=0;h<i.length;h++){var v=i[h],y=v.layoutDimensions(e);l=Math.max(l,y.w,y.h)}u.sort(function(re,se){return se.value-re.value});for(var g=e.levelWidth(i),p=[[]],m=p[0],b=0;b<u.length;b++){var x=u[b];if(m.length>0){var E=Math.abs(m[0].value-x.value);E>=g&&(m=[],p.push(m))}m.push(x)}var S=l+e.minNodeSpacing;if(!e.avoidOverlap){var w=p.length>0&&p[0].length>1,k=Math.min(o.w,o.h)/2-S,_=k/(p.length+w?1:0);S=Math.min(S,_)}for(var C=0,T=0;T<p.length;T++){var D=p[T],A=e.sweep===void 0?2*Math.PI-2*Math.PI/D.length:e.sweep,R=D.dTheta=A/Math.max(1,D.length-1);if(D.length>1&&e.avoidOverlap){var M=Math.cos(R)-Math.cos(0),L=Math.sin(R)-Math.sin(0),B=Math.sqrt(S*S/(M*M+L*L));C=Math.max(B,C)}D.r=C,C+=S}if(e.equidistant){for(var I=0,H=0,q=0;q<p.length;q++){var N=p[q],G=N.r-H;I=Math.max(I,G)}H=0;for(var X=0;X<p.length;X++){var j=p[X];X===0&&(H=j.r),j.r=H,H+=I}}for(var Q={},Z=0;Z<p.length;Z++)for(var te=p[Z],ne=te.dTheta,$=te.r,O=0;O<te.length;O++){var z=te[O],V=e.startAngle+(t?1:-1)*ne*O,W={x:s.x+$*Math.cos(V),y:s.y+$*Math.sin(V)};Q[z.node.id()]=W}return a.nodes().layoutPositions(this,e,function(re){var se=re.id();return Q[se]}),this};var nu,tb={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 oo(r){this.options=be({},tb,r),this.options.layout=this;var e=this.options.eles.nodes(),t=this.options.eles.edges(),n=t.filter(function(a){var i=a.source().data("id"),o=a.target().data("id"),s=e.some(function(l){return l.data("id")===i}),u=e.some(function(l){return l.data("id")===o});return!s||!u});this.options.eles=this.options.eles.not(n)}oo.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?nu=!0:nu=!1;var n=rb(e,t,r);nu&&ab(n),r.randomize&&ib(n);var a=Dr(),i=function(){ob(n,e,r),r.fit===!0&&e.fit(r.padding)},o=function(d){return!(t.stopped||d>=r.numIter||(sb(n,r),n.temperature=n.temperature*r.coolingFactor,n.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 d=r.eles.nodes(),h=Rv(n,r,d);d.layoutPositions(t,r,h)}},u=0,l=!0;if(r.animate===!0){var c=function(){for(var d=0;l&&d<r.refresh;)l=o(u),u++,d++;if(!l)Qf(n,r),s();else{var h=Dr();h-a>=r.animationThreshold&&i(),Bi(c)}};c()}else{for(;l;)l=o(u),u++;Qf(n,r),s()}return this};oo.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit("layoutstop"),this};oo.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var rb=function(e,t,n){for(var a=n.eles.edges(),i=n.eles.nodes(),o=Rt(n.boundingBox?n.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),s={isCompound:e.hasCompoundNodes(),layoutNodes:[],idToIndex:{},nodeSize:i.size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:a.size(),temperature:n.initialTemp,clientWidth:o.w,clientHeight:o.h,boundingBox:o},u=n.eles.components(),l={},c=0;c<u.length;c++)for(var f=u[c],d=0;d<f.length;d++){var h=f[d];l[h.id()]=c}for(var c=0;c<s.nodeSize;c++){var v=i[c],y=v.layoutDimensions(n),g={};g.isLocked=v.locked(),g.id=v.data("id"),g.parentId=v.data("parent"),g.cmptId=l[v.id()],g.children=[],g.positionX=v.position("x"),g.positionY=v.position("y"),g.offsetX=0,g.offsetY=0,g.height=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(v.style("padding")),g.padRight=parseFloat(v.style("padding")),g.padTop=parseFloat(v.style("padding")),g.padBottom=parseFloat(v.style("padding")),g.nodeRepulsion=je(n.nodeRepulsion)?n.nodeRepulsion(v):n.nodeRepulsion,s.layoutNodes.push(g),s.idToIndex[g.id]=c}for(var p=[],m=0,b=-1,x=[],c=0;c<s.nodeSize;c++){var v=s.layoutNodes[c],E=v.parentId;E!=null?s.layoutNodes[s.idToIndex[E]].children.push(v.id):(p[++b]=v.id,x.push(v.id))}for(s.graphSet.push(x);m<=b;){var S=p[m++],w=s.idToIndex[S],h=s.layoutNodes[w],k=h.children;if(k.length>0){s.graphSet.push(k);for(var c=0;c<k.length;c++)p[++b]=k[c]}}for(var c=0;c<s.graphSet.length;c++)for(var _=s.graphSet[c],d=0;d<_.length;d++){var C=s.idToIndex[_[d]];s.indexToGraph[C]=c}for(var c=0;c<s.edgeSize;c++){var T=a[c],D={};D.id=T.data("id"),D.sourceId=T.data("source"),D.targetId=T.data("target");var A=je(n.idealEdgeLength)?n.idealEdgeLength(T):n.idealEdgeLength,R=je(n.edgeElasticity)?n.edgeElasticity(T):n.edgeElasticity,M=s.idToIndex[D.sourceId],L=s.idToIndex[D.targetId],B=s.indexToGraph[M],I=s.indexToGraph[L];if(B!=I){for(var H=nb(D.sourceId,D.targetId,s),q=s.graphSet[H],N=0,g=s.layoutNodes[M];q.indexOf(g.id)===-1;)g=s.layoutNodes[s.idToIndex[g.parentId]],N++;for(g=s.layoutNodes[L];q.indexOf(g.id)===-1;)g=s.layoutNodes[s.idToIndex[g.parentId]],N++;A*=N*n.nestingFactor}D.idealLength=A,D.elasticity=R,s.layoutEdges.push(D)}return s},nb=function(e,t,n){var a=Mv(e,t,0,n);return 2>a.count?0:a.graph},Mv=function(e,t,n,a){var i=a.graphSet[n];if(-1<i.indexOf(e)&&-1<i.indexOf(t))return{count:2,graph:n};for(var o=0,s=0;s<i.length;s++){var u=i[s],l=a.idToIndex[u],c=a.layoutNodes[l].children;if(c.length!==0){var f=a.indexToGraph[a.idToIndex[c[0]]],d=Mv(e,t,f,a);if(d.count!==0)if(d.count===1){if(o++,o===2)break}else return d}}return{count:o,graph:n}},ab,ib=function(e,t){for(var n=e.clientWidth,a=e.clientHeight,i=0;i<e.nodeSize;i++){var o=e.layoutNodes[i];o.children.length===0&&!o.isLocked&&(o.positionX=Math.random()*n,o.positionY=Math.random()*a)}},Rv=function(e,t,n){var a=e.boundingBox,i={x1:1/0,x2:-1/0,y1:1/0,y2:-1/0};return t.boundingBox&&(n.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 u=e.layoutNodes[e.idToIndex[o.data("id")]];if(t.boundingBox){var l=i.w===0?.5:(u.positionX-i.x1)/i.w,c=i.h===0?.5:(u.positionY-i.y1)/i.h;return{x:a.x1+l*a.w,y:a.y1+c*a.h}}else return{x:u.positionX,y:u.positionY}}},ob=function(e,t,n){var a=n.layout,i=n.eles.nodes(),o=Rv(e,n,i);i.positions(o),e.ready!==!0&&(e.ready=!0,a.one("layoutready",n.ready),a.emit({type:"layoutready",layout:this}))},sb=function(e,t,n){ub(e,t),fb(e),db(e,t),vb(e),hb(e)},ub=function(e,t){for(var n=0;n<e.graphSet.length;n++)for(var a=e.graphSet[n],i=a.length,o=0;o<i;o++)for(var s=e.layoutNodes[e.idToIndex[a[o]]],u=o+1;u<i;u++){var l=e.layoutNodes[e.idToIndex[a[u]]];lb(s,l,e,t)}},Zf=function(e){return-1+2*e*Math.random()},lb=function(e,t,n,a){var i=e.cmptId,o=t.cmptId;if(!(i!==o&&!n.isCompound)){var s=t.positionX-e.positionX,u=t.positionY-e.positionY,l=1;s===0&&u===0&&(s=Zf(l),u=Zf(l));var c=cb(e,t,s,u);if(c>0)var f=a.nodeOverlap*c,d=Math.sqrt(s*s+u*u),h=f*s/d,v=f*u/d;else var y=Vi(e,s,u),g=Vi(t,-1*s,-1*u),p=g.x-y.x,m=g.y-y.y,b=p*p+m*m,d=Math.sqrt(b),f=(e.nodeRepulsion+t.nodeRepulsion)/b,h=f*p/d,v=f*m/d;e.isLocked||(e.offsetX-=h,e.offsetY-=v),t.isLocked||(t.offsetX+=h,t.offsetY+=v)}},cb=function(e,t,n,a){if(n>0)var i=e.maxX-t.minX;else var i=t.maxX-e.minX;if(a>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},Vi=function(e,t,n){var a=e.positionX,i=e.positionY,o=e.height||1,s=e.width||1,u=n/t,l=o/s,c={};return t===0&&0<n||t===0&&0>n?(c.x=a,c.y=i+o/2,c):0<t&&-1*l<=u&&u<=l?(c.x=a+s/2,c.y=i+s*n/2/t,c):0>t&&-1*l<=u&&u<=l?(c.x=a-s/2,c.y=i-s*n/2/t,c):0<n&&(u<=-1*l||u>=l)?(c.x=a+o*t/2/n,c.y=i+o/2,c):(0>n&&(u<=-1*l||u>=l)&&(c.x=a-o*t/2/n,c.y=i-o/2),c)},fb=function(e,t){for(var n=0;n<e.edgeSize;n++){var a=e.layoutEdges[n],i=e.idToIndex[a.sourceId],o=e.layoutNodes[i],s=e.idToIndex[a.targetId],u=e.layoutNodes[s],l=u.positionX-o.positionX,c=u.positionY-o.positionY;if(!(l===0&&c===0)){var f=Vi(o,l,c),d=Vi(u,-1*l,-1*c),h=d.x-f.x,v=d.y-f.y,y=Math.sqrt(h*h+v*v),g=Math.pow(a.idealLength-y,2)/a.elasticity;if(y!==0)var p=g*h/y,m=g*v/y;else var p=0,m=0;o.isLocked||(o.offsetX+=p,o.offsetY+=m),u.isLocked||(u.offsetX-=p,u.offsetY-=m)}}},db=function(e,t){if(t.gravity!==0)for(var n=1,a=0;a<e.graphSet.length;a++){var i=e.graphSet[a],o=i.length;if(a===0)var s=e.clientHeight/2,u=e.clientWidth/2;else var l=e.layoutNodes[e.idToIndex[i[0]]],c=e.layoutNodes[e.idToIndex[l.parentId]],s=c.positionX,u=c.positionY;for(var f=0;f<o;f++){var d=e.layoutNodes[e.idToIndex[i[f]]];if(!d.isLocked){var h=s-d.positionX,v=u-d.positionY,y=Math.sqrt(h*h+v*v);if(y>n){var g=t.gravity*h/y,p=t.gravity*v/y;d.offsetX+=g,d.offsetY+=p}}}}},vb=function(e,t){var n=[],a=0,i=-1;for(n.push.apply(n,e.graphSet[0]),i+=e.graphSet[0].length;a<=i;){var o=n[a++],s=e.idToIndex[o],u=e.layoutNodes[s],l=u.children;if(0<l.length&&!u.isLocked){for(var c=u.offsetX,f=u.offsetY,d=0;d<l.length;d++){var h=e.layoutNodes[e.idToIndex[l[d]]];h.offsetX+=c,h.offsetY+=f,n[++i]=l[d]}u.offsetX=0,u.offsetY=0}}},hb=function(e,t){for(var n=0;n<e.nodeSize;n++){var a=e.layoutNodes[n];0<a.children.length&&(a.maxX=void 0,a.minX=void 0,a.maxY=void 0,a.minY=void 0)}for(var n=0;n<e.nodeSize;n++){var a=e.layoutNodes[n];if(!(0<a.children.length||a.isLocked)){var i=pb(a.offsetX,a.offsetY,e.temperature);a.positionX+=i.x,a.positionY+=i.y,a.offsetX=0,a.offsetY=0,a.minX=a.positionX-a.width,a.maxX=a.positionX+a.width,a.minY=a.positionY-a.height,a.maxY=a.positionY+a.height,Bv(a,e)}}for(var n=0;n<e.nodeSize;n++){var a=e.layoutNodes[n];0<a.children.length&&!a.isLocked&&(a.positionX=(a.maxX+a.minX)/2,a.positionY=(a.maxY+a.minY)/2,a.width=a.maxX-a.minX,a.height=a.maxY-a.minY)}},pb=function(e,t,n){var a=Math.sqrt(e*e+t*t);if(a>n)var i={x:n*e/a,y:n*t/a};else var i={x:e,y:t};return i},Bv=function(e,t){var n=e.parentId;if(n!=null){var a=t.layoutNodes[t.idToIndex[n]],i=!1;if((a.maxX==null||e.maxX+a.padRight>a.maxX)&&(a.maxX=e.maxX+a.padRight,i=!0),(a.minX==null||e.minX-a.padLeft<a.minX)&&(a.minX=e.minX-a.padLeft,i=!0),(a.maxY==null||e.maxY+a.padBottom>a.maxY)&&(a.maxY=e.maxY+a.padBottom,i=!0),(a.minY==null||e.minY-a.padTop<a.minY)&&(a.minY=e.minY-a.padTop,i=!0),i)return Bv(a,t)}},Qf=function(e,t){for(var n=e.layoutNodes,a=[],i=0;i<n.length;i++){var o=n[i],s=o.cmptId,u=a[s]=a[s]||[];u.push(o)}for(var l=0,i=0;i<a.length;i++){var c=a[i];if(c){c.x1=1/0,c.x2=-1/0,c.y1=1/0,c.y2=-1/0;for(var f=0;f<c.length;f++){var d=c[f];c.x1=Math.min(c.x1,d.positionX-d.width/2),c.x2=Math.max(c.x2,d.positionX+d.width/2),c.y1=Math.min(c.y1,d.positionY-d.height/2),c.y2=Math.max(c.y2,d.positionY+d.height/2)}c.w=c.x2-c.x1,c.h=c.y2-c.y1,l+=c.w*c.h}}a.sort(function(m,b){return b.w*b.h-m.w*m.h});for(var h=0,v=0,y=0,g=0,p=Math.sqrt(l)*e.clientWidth/e.clientHeight,i=0;i<a.length;i++){var c=a[i];if(c){for(var f=0;f<c.length;f++){var d=c[f];d.isLocked||(d.positionX+=h-c.x1,d.positionY+=v-c.y1)}h+=c.w+t.componentSpacing,y+=c.w+t.componentSpacing,g=Math.max(g,c.h),y>p&&(v+=g+t.componentSpacing,h=0,y=0,g=0)}}},gb={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 Lv(r){this.options=be({},gb,r)}Lv.prototype.run=function(){var r=this.options,e=r,t=r.cy,n=e.eles,a=n.nodes().not(":parent");e.sort&&(a=a.sort(e.sort));var i=Rt(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:t.width(),h:t.height()});if(i.h===0||i.w===0)n.nodes().layoutPositions(this,e,function(X){return{x:i.x1,y:i.y1}});else{var o=a.size(),s=Math.sqrt(o*i.h/i.w),u=Math.round(s),l=Math.round(i.w/i.h*s),c=function(j){if(j==null)return Math.min(u,l);var Q=Math.min(u,l);Q==u?u=j:l=j},f=function(j){if(j==null)return Math.max(u,l);var Q=Math.max(u,l);Q==u?u=j:l=j},d=e.rows,h=e.cols!=null?e.cols:e.columns;if(d!=null&&h!=null)u=d,l=h;else if(d!=null&&h==null)u=d,l=Math.ceil(o/u);else if(d==null&&h!=null)l=h,u=Math.ceil(o/l);else if(l*u>o){var v=c(),y=f();(v-1)*y>=o?c(v-1):(y-1)*v>=o&&f(y-1)}else for(;l*u<o;){var g=c(),p=f();(p+1)*g>=o?f(p+1):c(g+1)}var m=i.w/l,b=i.h/u;if(e.condense&&(m=0,b=0),e.avoidOverlap)for(var x=0;x<a.length;x++){var E=a[x],S=E._private.position;(S.x==null||S.y==null)&&(S.x=0,S.y=0);var w=E.layoutDimensions(e),k=e.avoidOverlapPadding,_=w.w+k,C=w.h+k;m=Math.max(m,_),b=Math.max(b,C)}for(var T={},D=function(j,Q){return!!T["c-"+j+"-"+Q]},A=function(j,Q){T["c-"+j+"-"+Q]=!0},R=0,M=0,L=function(){M++,M>=l&&(M=0,R++)},B={},I=0;I<a.length;I++){var H=a[I],q=e.position(H);if(q&&(q.row!==void 0||q.col!==void 0)){var N={row:q.row,col:q.col};if(N.col===void 0)for(N.col=0;D(N.row,N.col);)N.col++;else if(N.row===void 0)for(N.row=0;D(N.row,N.col);)N.row++;B[H.id()]=N,A(N.row,N.col)}}var G=function(j,Q){var Z,te;if(j.locked()||j.isParent())return!1;var ne=B[j.id()];if(ne)Z=ne.col*m+m/2+i.x1,te=ne.row*b+b/2+i.y1;else{for(;D(R,M);)L();Z=M*m+m/2+i.x1,te=R*b+b/2+i.y1,A(R,M),L()}return{x:Z,y:te}};a.layoutPositions(this,e,G)}return this};var yb={ready:function(){},stop:function(){}};function Qu(r){this.options=be({},yb,r)}Qu.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};Qu.prototype.stop=function(){return this};var mb={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 Ov(r){this.options=be({},mb,r)}Ov.prototype.run=function(){var r=this.options,e=r.eles,t=e.nodes(),n=je(r.positions);function a(i){if(r.positions==null)return Vg(i.position());if(n)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=a(i);return i.locked()||s==null?!1:s}),this};var bb={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 Iv(r){this.options=be({},bb,r)}Iv.prototype.run=function(){var r=this.options,e=r.cy,t=r.eles,n=Rt(r.boundingBox?r.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),a=function(o,s){return{x:n.x1+Math.round(Math.random()*n.w),y:n.y1+Math.round(Math.random()*n.h)}};return t.nodes().layoutPositions(this,r,a),this};var xb=[{name:"breadthfirst",impl:Pv},{name:"circle",impl:Dv},{name:"concentric",impl:Av},{name:"cose",impl:oo},{name:"grid",impl:Lv},{name:"null",impl:Qu},{name:"preset",impl:Ov},{name:"random",impl:Iv}];function Nv(r){this.options=r,this.notifications=0}var Jf=function(){},jf=function(){throw new Error("A headless instance can not render images")};Nv.prototype={recalculateRenderedStyle:Jf,notify:function(){this.notifications++},init:Jf,isHeadless:function(){return!0},png:jf,jpg:jf};var Ju={};Ju.arrowShapeWidth=.3;Ju.registerArrowShapes=function(){var r=this.arrowShapes={},e=this,t=function(l,c,f,d,h,v,y){var g=h.x-f/2-y,p=h.x+f/2+y,m=h.y-f/2-y,b=h.y+f/2+y,x=g<=l&&l<=p&&m<=c&&c<=b;return x},n=function(l,c,f,d,h){var v=l*Math.cos(d)-c*Math.sin(d),y=l*Math.sin(d)+c*Math.cos(d),g=v*f,p=y*f,m=g+h.x,b=p+h.y;return{x:m,y:b}},a=function(l,c,f,d){for(var h=[],v=0;v<l.length;v+=2){var y=l[v],g=l[v+1];h.push(n(y,g,c,f,d))}return h},i=function(l){for(var c=[],f=0;f<l.length;f++){var d=l[f];c.push(d.x,d.y)}return c},o=function(l){return l.pstyle("width").pfValue*l.pstyle("arrow-scale").pfValue*2},s=function(l,c){he(c)&&(c=r[c]),r[l]=be({name:l,points:[-.15,-.3,.15,-.3,.15,.3,-.15,.3],collide:function(d,h,v,y,g,p){var m=i(a(this.points,v+2*p,y,g)),b=Ft(d,h,m);return b},roughCollide:t,draw:function(d,h,v,y){var g=a(this.points,h,v,y);e.arrowShapeImpl("polygon")(d,g)},spacing:function(d){return 0},gap:o},c)};s("none",{collide:Li,roughCollide:Li,draw:Nu,spacing:dc,gap:dc}),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(l,c,f,d,h){var v=a(this.points,c,f,d),y=this.controlPoint,g=n(y[0],y[1],c,f,d);e.arrowShapeImpl(this.name)(l,v,g)},gap:function(l){return o(l)*.8}}),s("triangle-tee",{points:[0,0,.15,-.3,-.15,-.3,0,0],pointsTee:[-.15,-.4,-.15,-.5,.15,-.5,.15,-.4],collide:function(l,c,f,d,h,v,y){var g=i(a(this.points,f+2*y,d,h)),p=i(a(this.pointsTee,f+2*y,d,h)),m=Ft(l,c,g)||Ft(l,c,p);return m},draw:function(l,c,f,d,h){var v=a(this.points,c,f,d),y=a(this.pointsTee,c,f,d);e.arrowShapeImpl(this.name)(l,v,y)}}),s("circle-triangle",{radius:.15,pointsTr:[0,-.15,.15,-.45,-.15,-.45,0,-.15],collide:function(l,c,f,d,h,v,y){var g=h,p=Math.pow(g.x-l,2)+Math.pow(g.y-c,2)<=Math.pow((f+2*y)*this.radius,2),m=i(a(this.points,f+2*y,d,h));return Ft(l,c,m)||p},draw:function(l,c,f,d,h){var v=a(this.pointsTr,c,f,d);e.arrowShapeImpl(this.name)(l,v,d.x,d.y,this.radius*c)},spacing:function(l){return e.getArrowWidth(l.pstyle("width").pfValue,l.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(l,c){var f=this.baseCrossLinePts.slice(),d=c/l,h=3,v=5;return f[h]=f[h]-d,f[v]=f[v]-d,f},collide:function(l,c,f,d,h,v,y){var g=i(a(this.points,f+2*y,d,h)),p=i(a(this.crossLinePts(f,v),f+2*y,d,h)),m=Ft(l,c,g)||Ft(l,c,p);return m},draw:function(l,c,f,d,h){var v=a(this.points,c,f,d),y=a(this.crossLinePts(c,h),c,f,d);e.arrowShapeImpl(this.name)(l,v,y)}}),s("vee",{points:[-.15,-.3,0,0,.15,-.3,0,-.15],gap:function(l){return o(l)*.525}}),s("circle",{radius:.15,collide:function(l,c,f,d,h,v,y){var g=h,p=Math.pow(g.x-l,2)+Math.pow(g.y-c,2)<=Math.pow((f+2*y)*this.radius,2);return p},draw:function(l,c,f,d,h){e.arrowShapeImpl(this.name)(l,d.x,d.y,this.radius*c)},spacing:function(l){return e.getArrowWidth(l.pstyle("width").pfValue,l.pstyle("arrow-scale").value)*this.radius}}),s("tee",{points:[-.15,0,-.15,-.1,.15,-.1,.15,0],spacing:function(l){return 1},gap:function(l){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(l){return l.pstyle("width").pfValue*l.pstyle("arrow-scale").value}}),s("chevron",{points:[0,0,-.15,-.15,-.1,-.2,0,-.1,.1,-.2,.15,-.15],gap:function(l){return .95*l.pstyle("width").pfValue*l.pstyle("arrow-scale").value}})};var Cn={};Cn.projectIntoViewport=function(r,e){var t=this.cy,n=this.findContainerClientCoords(),a=n[0],i=n[1],o=n[4],s=t.pan(),u=t.zoom(),l=((r-a)/o-s.x)/u,c=((e-i)/o-s.y)/u;return[l,c]};Cn.findContainerClientCoords=function(){if(this.containerBB)return this.containerBB;var r=this.container,e=r.getBoundingClientRect(),t=this.cy.window().getComputedStyle(r),n=function(p){return parseFloat(t.getPropertyValue(p))},a={left:n("padding-left"),right:n("padding-right"),top:n("padding-top"),bottom:n("padding-bottom")},i={left:n("border-left-width"),right:n("border-right-width"),top:n("border-top-width"),bottom:n("border-bottom-width")},o=r.clientWidth,s=r.clientHeight,u=a.left+a.right,l=a.top+a.bottom,c=i.left+i.right,f=e.width/(o+c),d=o-u,h=s-l,v=e.left+a.left+i.left,y=e.top+a.top+i.top;return this.containerBB=[v,y,d,h,f]};Cn.invalidateContainerClientCoordsCache=function(){this.containerBB=null};Cn.findNearestElement=function(r,e,t,n){return this.findNearestElements(r,e,t,n)[0]};Cn.findNearestElements=function(r,e,t,n){var a=this,i=this,o=i.getCachedZSortedEles(),s=[],u=i.cy.zoom(),l=i.cy.hasCompoundNodes(),c=(n?24:8)/u,f=(n?8:2)/u,d=(n?8:2)/u,h=1/0,v,y;t&&(o=o.interactive);function g(w,k){if(w.isNode()){if(y)return;y=w,s.push(w)}if(w.isEdge()&&(k==null||k<h))if(v){if(v.pstyle("z-compound-depth").value===w.pstyle("z-compound-depth").value&&v.pstyle("z-compound-depth").value===w.pstyle("z-compound-depth").value){for(var _=0;_<s.length;_++)if(s[_].isEdge()){s[_]=w,v=w,h=k??h;break}}}else s.push(w),v=w,h=k??h}function p(w){var k=w.outerWidth()+2*f,_=w.outerHeight()+2*f,C=k/2,T=_/2,D=w.position(),A=w.pstyle("corner-radius").value==="auto"?"auto":w.pstyle("corner-radius").pfValue,R=w._private.rscratch;if(D.x-C<=r&&r<=D.x+C&&D.y-T<=e&&e<=D.y+T){var M=i.nodeShapes[a.getNodeShape(w)];if(M.checkPoint(r,e,0,k,_,D.x,D.y,A,R))return g(w,0),!0}}function m(w){var k=w._private,_=k.rscratch,C=w.pstyle("width").pfValue,T=w.pstyle("arrow-scale").value,D=C/2+c,A=D*D,R=D*2,I=k.source,H=k.target,M;if(_.edgeType==="segments"||_.edgeType==="straight"||_.edgeType==="haystack"){for(var L=_.allpts,B=0;B+3<L.length;B+=2)if(ey(r,e,L[B],L[B+1],L[B+2],L[B+3],R)&&A>(M=iy(r,e,L[B],L[B+1],L[B+2],L[B+3])))return g(w,M),!0}else if(_.edgeType==="bezier"||_.edgeType==="multibezier"||_.edgeType==="self"||_.edgeType==="compound"){for(var L=_.allpts,B=0;B+5<_.allpts.length;B+=4)if(ty(r,e,L[B],L[B+1],L[B+2],L[B+3],L[B+4],L[B+5],R)&&A>(M=ay(r,e,L[B],L[B+1],L[B+2],L[B+3],L[B+4],L[B+5])))return g(w,M),!0}for(var I=I||k.source,H=H||k.target,q=a.getArrowWidth(C,T),N=[{name:"source",x:_.arrowStartX,y:_.arrowStartY,angle:_.srcArrowAngle},{name:"target",x:_.arrowEndX,y:_.arrowEndY,angle:_.tgtArrowAngle},{name:"mid-source",x:_.midX,y:_.midY,angle:_.midsrcArrowAngle},{name:"mid-target",x:_.midX,y:_.midY,angle:_.midtgtArrowAngle}],B=0;B<N.length;B++){var G=N[B],X=i.arrowShapes[w.pstyle(G.name+"-arrow-shape").value],j=w.pstyle("width").pfValue;if(X.roughCollide(r,e,q,G.angle,{x:G.x,y:G.y},j,c)&&X.collide(r,e,q,G.angle,{x:G.x,y:G.y},j,c))return g(w),!0}l&&s.length>0&&(p(I),p(H))}function b(w,k,_){return zt(w,k,_)}function x(w,k){var _=w._private,C=d,T;k?T=k+"-":T="",w.boundingBox();var D=_.labelBounds[k||"main"],A=w.pstyle(T+"label").value,R=w.pstyle("text-events").strValue==="yes";if(!(!R||!A)){var M=b(_.rscratch,"labelX",k),L=b(_.rscratch,"labelY",k),B=b(_.rscratch,"labelAngle",k),I=w.pstyle(T+"text-margin-x").pfValue,H=w.pstyle(T+"text-margin-y").pfValue,q=D.x1-C-I,N=D.x2+C-I,G=D.y1-C-H,X=D.y2+C-H;if(B){var j=Math.cos(B),Q=Math.sin(B),Z=function(W,re){return W=W-M,re=re-L,{x:W*j-re*Q+M,y:W*Q+re*j+L}},te=Z(q,G),ne=Z(q,X),$=Z(N,G),O=Z(N,X),z=[te.x+I,te.y+H,$.x+I,$.y+H,O.x+I,O.y+H,ne.x+I,ne.y+H];if(Ft(r,e,z))return g(w),!0}else if(Ur(D,r,e))return g(w),!0}}for(var E=o.length-1;E>=0;E--){var S=o[E];S.isNode()?p(S)||x(S):m(S)||x(S)||x(S,"source")||x(S,"target")}return s};Cn.getAllInBox=function(r,e,t,n){var a=this.getCachedZSortedEles().interactive,i=this.cy.zoom(),o=2/i,s=[],u=Math.min(r,t),l=Math.max(r,t),c=Math.min(e,n),f=Math.max(e,n);r=u,t=l,e=c,n=f;var d=Rt({x1:r,y1:e,x2:t,y2:n}),h=[{x:d.x1,y:d.y1},{x:d.x2,y:d.y1},{x:d.x2,y:d.y2},{x:d.x1,y:d.y2}],v=[[h[0],h[1]],[h[1],h[2]],[h[2],h[3]],[h[3],h[0]]];function y(W,re,se){return zt(W,re,se)}function g(W,re){var se=W._private,Ce=o,pe="";W.boundingBox();var ye=se.labelBounds.main;if(!ye)return null;var ge=y(se.rscratch,"labelX",re),oe=y(se.rscratch,"labelY",re),ve=y(se.rscratch,"labelAngle",re),de=W.pstyle(pe+"text-margin-x").pfValue,we=W.pstyle(pe+"text-margin-y").pfValue,xe=ye.x1-Ce-de,Ae=ye.x2+Ce-de,Be=ye.y1-Ce-we,Ve=ye.y2+Ce-we;if(ve){var ze=Math.cos(ve),Oe=Math.sin(ve),J=function(F,U){return F=F-ge,U=U-oe,{x:F*ze-U*Oe+ge,y:F*Oe+U*ze+oe}};return[J(xe,Be),J(Ae,Be),J(Ae,Ve),J(xe,Ve)]}else return[{x:xe,y:Be},{x:Ae,y:Be},{x:Ae,y:Ve},{x:xe,y:Ve}]}function p(W,re,se,Ce){function pe(ye,ge,oe){return(oe.y-ye.y)*(ge.x-ye.x)>(ge.y-ye.y)*(oe.x-ye.x)}return pe(W,se,Ce)!==pe(re,se,Ce)&&pe(W,re,se)!==pe(W,re,Ce)}for(var m=0;m<a.length;m++){var b=a[m];if(b.isNode()){var x=b,E=x.pstyle("text-events").strValue==="yes",S=x.pstyle("box-selection").strValue,w=x.pstyle("box-select-labels").strValue==="yes";if(S==="none")continue;var k=(S==="overlap"||w)&&E,_=x.boundingBox({includeNodes:!0,includeEdges:!1,includeLabels:k});if(S==="contain"){var C=!1;if(w&&E){var T=g(x);T&&ts(T,h)&&(s.push(x),C=!0)}!C&&$d(d,_)&&s.push(x)}else if(S==="overlap"&&qu(d,_)){var D=x.boundingBox({includeNodes:!0,includeEdges:!0,includeLabels:!1,includeMainLabels:!1,includeSourceLabels:!1,includeTargetLabels:!1}),A=[{x:D.x1,y:D.y1},{x:D.x2,y:D.y1},{x:D.x2,y:D.y2},{x:D.x1,y:D.y2}];if(ts(A,h))s.push(x);else{var R=g(x);R&&ts(R,h)&&s.push(x)}}}else{var M=b,L=M._private,B=L.rscratch,I=M.pstyle("box-selection").strValue;if(I==="none")continue;if(I==="contain"){if(B.startX!=null&&B.startY!=null&&!Ur(d,B.startX,B.startY)||B.endX!=null&&B.endY!=null&&!Ur(d,B.endX,B.endY))continue;if(B.edgeType==="bezier"||B.edgeType==="multibezier"||B.edgeType==="self"||B.edgeType==="compound"||B.edgeType==="segments"||B.edgeType==="haystack"){for(var H=L.rstyle.bezierPts||L.rstyle.linePts||L.rstyle.haystackPts,q=!0,N=0;N<H.length;N++)if(!yc(d,H[N])){q=!1;break}q&&s.push(M)}else B.edgeType==="straight"&&s.push(M)}else if(I==="overlap"){var G=!1;if(B.startX!=null&&B.startY!=null&&B.endX!=null&&B.endY!=null&&(Ur(d,B.startX,B.startY)||Ur(d,B.endX,B.endY)))s.push(M),G=!0;else if(!G&&B.edgeType==="haystack"){for(var X=L.rstyle.haystackPts,j=0;j<X.length;j++)if(yc(d,X[j])){s.push(M),G=!0;break}}if(!G){var Q=L.rstyle.bezierPts||L.rstyle.linePts||L.rstyle.haystackPts;if((!Q||Q.length<2)&&B.edgeType==="straight"&&B.startX!=null&&B.startY!=null&&B.endX!=null&&B.endY!=null&&(Q=[{x:B.startX,y:B.startY},{x:B.endX,y:B.endY}]),!Q||Q.length<2)continue;for(var Z=0;Z<Q.length-1;Z++){for(var te=Q[Z],ne=Q[Z+1],$=0;$<v.length;$++){var O=ut(v[$],2),z=O[0],V=O[1];if(p(te,ne,z,V)){s.push(M),G=!0;break}}if(G)break}}}}}return s};var qi={};qi.calculateArrowAngles=function(r){var e=r._private.rscratch,t=e.edgeType==="haystack",n=e.edgeType==="bezier",a=e.edgeType==="multibezier",i=e.edgeType==="segments",o=e.edgeType==="compound",s=e.edgeType==="self",u,l,c,f,d,h,p,m;if(t?(c=e.haystackPts[0],f=e.haystackPts[1],d=e.haystackPts[2],h=e.haystackPts[3]):(c=e.arrowStartX,f=e.arrowStartY,d=e.arrowEndX,h=e.arrowEndY),p=e.midX,m=e.midY,i)u=c-e.segpts[0],l=f-e.segpts[1];else if(a||o||s||n){var v=e.allpts,y=gt(v[0],v[2],v[4],.1),g=gt(v[1],v[3],v[5],.1);u=c-y,l=f-g}else u=c-p,l=f-m;e.srcArrowAngle=li(u,l);var p=e.midX,m=e.midY;if(t&&(p=(c+d)/2,m=(f+h)/2),u=d-c,l=h-f,i){var v=e.allpts;if(v.length/2%2===0){var b=v.length/2,x=b-2;u=v[b]-v[x],l=v[b+1]-v[x+1]}else if(e.isRound)u=e.midVector[1],l=-e.midVector[0];else{var b=v.length/2-1,x=b-2;u=v[b]-v[x],l=v[b+1]-v[x+1]}}else if(a||o||s){var v=e.allpts,E=e.ctrlpts,S,w,k,_;if(E.length/2%2===0){var C=v.length/2-1,T=C+2,D=T+2;S=gt(v[C],v[T],v[D],0),w=gt(v[C+1],v[T+1],v[D+1],0),k=gt(v[C],v[T],v[D],1e-4),_=gt(v[C+1],v[T+1],v[D+1],1e-4)}else{var T=v.length/2-1,C=T-2,D=T+2;S=gt(v[C],v[T],v[D],.4999),w=gt(v[C+1],v[T+1],v[D+1],.4999),k=gt(v[C],v[T],v[D],.5),_=gt(v[C+1],v[T+1],v[D+1],.5)}u=k-S,l=_-w}if(e.midtgtArrowAngle=li(u,l),e.midDispX=u,e.midDispY=l,u*=-1,l*=-1,i){var v=e.allpts;if(v.length/2%2!==0){if(!e.isRound){var b=v.length/2-1,A=b+2;u=-(v[A]-v[b]),l=-(v[A+1]-v[b+1])}}}if(e.midsrcArrowAngle=li(u,l),i)u=d-e.segpts[e.segpts.length-2],l=h-e.segpts[e.segpts.length-1];else if(a||o||s||n){var v=e.allpts,R=v.length,y=gt(v[R-6],v[R-4],v[R-2],.9),g=gt(v[R-5],v[R-3],v[R-1],.9);u=d-y,l=h-g}else u=d-p,l=h-m;e.tgtArrowAngle=li(u,l)};qi.getArrowWidth=qi.getArrowHeight=function(r,e){var t=this.arrowWidthCache=this.arrowWidthCache||{},n=t[r+", "+e];return n||(n=Math.max(Math.pow(r*13.37,.9),29)*e,t[r+", "+e]=n,n)};var Cu,Su,gr={},Kt={},ed,td,gn,Pi,Tr,cn,hn,hr,Bn,yi,zv,Fv,ku,Tu,rd,nd=function(e,t,n){n.x=t.x-e.x,n.y=t.y-e.y,n.len=Math.sqrt(n.x*n.x+n.y*n.y),n.nx=n.x/n.len,n.ny=n.y/n.len,n.ang=Math.atan2(n.ny,n.nx)},wb=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},Eb=function(e,t,n,a,i){if(e!==rd?nd(t,e,gr):wb(Kt,gr),nd(t,n,Kt),ed=gr.nx*Kt.ny-gr.ny*Kt.nx,td=gr.nx*Kt.nx-gr.ny*-Kt.ny,Tr=Math.asin(Math.max(-1,Math.min(1,ed))),Math.abs(Tr)<1e-6){Cu=t.x,Su=t.y,hn=Bn=0;return}gn=1,Pi=!1,td<0?Tr<0?Tr=Math.PI+Tr:(Tr=Math.PI-Tr,gn=-1,Pi=!0):Tr>0&&(gn=-1,Pi=!0),t.radius!==void 0?Bn=t.radius:Bn=a,cn=Tr/2,yi=Math.min(gr.len/2,Kt.len/2),i?(hr=Math.abs(Math.cos(cn)*Bn/Math.sin(cn)),hr>yi?(hr=yi,hn=Math.abs(hr*Math.sin(cn)/Math.cos(cn))):hn=Bn):(hr=Math.min(yi,Bn),hn=Math.abs(hr*Math.sin(cn)/Math.cos(cn))),ku=t.x+Kt.nx*hr,Tu=t.y+Kt.ny*hr,Cu=ku-Kt.ny*hn*gn,Su=Tu+Kt.nx*hn*gn,zv=t.x+gr.nx*hr,Fv=t.y+gr.ny*hr,rd=t};function Vv(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 ju(r,e,t,n){var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0;return n===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}:(Eb(r,e,t,n,a),{cx:Cu,cy:Su,radius:hn,startX:zv,startY:Fv,stopX:ku,stopY:Tu,startAngle:gr.ang+Math.PI/2*gn,endAngle:Kt.ang-Math.PI/2*gn,counterClockwise:Pi})}var Ba=.01,Cb=Math.sqrt(2*Ba),Pt={};Pt.findMidptPtsEtc=function(r,e){var t=e.posPts,n=e.intersectionPts,a=e.vectorNormInverse,i,o=r.pstyle("source-endpoint"),s=r.pstyle("target-endpoint"),u=o.units!=null&&s.units!=null,l=function(E,S,w,k){var _=k-S,C=w-E,T=Math.sqrt(C*C+_*_);return{x:-_/T,y:C/T}},c=r.pstyle("edge-distances").value;switch(c){case"node-position":i=t;break;case"intersection":i=n;break;case"endpoints":{if(u){var f=this.manualEndptToPx(r.source()[0],o),d=ut(f,2),h=d[0],v=d[1],y=this.manualEndptToPx(r.target()[0],s),g=ut(y,2),p=g[0],m=g[1],b={x1:h,y1:v,x2:p,y2:m};a=l(h,v,p,m),i=b}else $e("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=n;break}}return{midptPts:i,vectorNormInverse:a}};Pt.findHaystackPoints=function(r){for(var e=0;e<r.length;e++){var t=r[e],n=t._private,a=n.rscratch;if(!a.haystack){var i=Math.random()*2*Math.PI;a.source={x:Math.cos(i),y:Math.sin(i)},i=Math.random()*2*Math.PI,a.target={x:Math.cos(i),y:Math.sin(i)}}var o=n.source,s=n.target,u=o.position(),l=s.position(),c=o.width(),f=s.width(),d=o.height(),h=s.height(),v=t.pstyle("haystack-radius").value,y=v/2;a.haystackPts=a.allpts=[a.source.x*c*y+u.x,a.source.y*d*y+u.y,a.target.x*f*y+l.x,a.target.y*h*y+l.y],a.midX=(a.allpts[0]+a.allpts[2])/2,a.midY=(a.allpts[1]+a.allpts[3])/2,a.edgeType="haystack",a.haystack=!0,this.storeEdgeProjections(t),this.calculateArrowAngles(t),this.recalculateEdgeLabelProjections(t),this.calculateLabelAngles(t)}};Pt.findSegmentsPoints=function(r,e){var t=r._private.rscratch,n=r.pstyle("segment-weights"),a=r.pstyle("segment-distances"),i=r.pstyle("segment-radii"),o=r.pstyle("radius-type"),s=Math.min(n.pfValue.length,a.pfValue.length),u=i.pfValue[i.pfValue.length-1],l=o.pfValue[o.pfValue.length-1];t.edgeType="segments",t.segpts=[],t.radii=[],t.isArcRadius=[];for(var c=0;c<s;c++){var f=n.pfValue[c],d=a.pfValue[c],h=1-f,v=f,y=this.findMidptPtsEtc(r,e),g=y.midptPts,p=y.vectorNormInverse,m={x:g.x1*h+g.x2*v,y:g.y1*h+g.y2*v};t.segpts.push(m.x+p.x*d,m.y+p.y*d),t.radii.push(i.pfValue[c]!==void 0?i.pfValue[c]:u),t.isArcRadius.push((o.pfValue[c]!==void 0?o.pfValue[c]:l)==="arc-radius")}};Pt.findLoopPoints=function(r,e,t,n){var a=r._private.rscratch,i=e.dirCounts,o=e.srcPos,s=r.pstyle("control-point-distances"),u=s?s.pfValue[0]:void 0,l=r.pstyle("loop-direction").pfValue,c=r.pstyle("loop-sweep").pfValue,f=r.pstyle("control-point-step-size").pfValue;a.edgeType="self";var d=t,h=f;n&&(d=0,h=u);var v=l-Math.PI/2,y=v-c/2,g=v+c/2,p=l+"_"+c;d=i[p]===void 0?i[p]=0:++i[p],a.ctrlpts=[o.x+Math.cos(y)*1.4*h*(d/3+1),o.y+Math.sin(y)*1.4*h*(d/3+1),o.x+Math.cos(g)*1.4*h*(d/3+1),o.y+Math.sin(g)*1.4*h*(d/3+1)]};Pt.findCompoundLoopPoints=function(r,e,t,n){var a=r._private.rscratch;a.edgeType="compound";var i=e.srcPos,o=e.tgtPos,s=e.srcW,u=e.srcH,l=e.tgtW,c=e.tgtH,f=r.pstyle("control-point-step-size").pfValue,d=r.pstyle("control-point-distances"),h=d?d.pfValue[0]:void 0,v=t,y=f;n&&(v=0,y=h);var g=50,p={x:i.x-s/2,y:i.y-u/2},m={x:o.x-l/2,y:o.y-c/2},b={x:Math.min(p.x,m.x),y:Math.min(p.y,m.y)},x=.5,E=Math.max(x,Math.log(s*Ba)),S=Math.max(x,Math.log(l*Ba));a.ctrlpts=[b.x,b.y-(1+Math.pow(g,1.12)/100)*y*(v/3+1)*E,b.x-(1+Math.pow(g,1.12)/100)*y*(v/3+1)*S,b.y]};Pt.findStraightEdgePoints=function(r){r._private.rscratch.edgeType="straight"};Pt.findBezierPoints=function(r,e,t,n,a){var i=r._private.rscratch,o=r.pstyle("control-point-step-size").pfValue,s=r.pstyle("control-point-distances"),u=r.pstyle("control-point-weights"),l=s&&u?Math.min(s.value.length,u.value.length):1,c=s?s.pfValue[0]:void 0,f=u.value[0],d=n;i.edgeType=d?"multibezier":"bezier",i.ctrlpts=[];for(var h=0;h<l;h++){var v=(.5-e.eles.length/2+t)*o*(a?-1:1),y=void 0,g=Vu(v);d&&(c=s?s.pfValue[h]:o,f=u.value[h]),n?y=c:y=c!==void 0?g*c:void 0;var p=y!==void 0?y:v,m=1-f,b=f,x=this.findMidptPtsEtc(r,e),E=x.midptPts,S=x.vectorNormInverse,w={x:E.x1*m+E.x2*b,y:E.y1*m+E.y2*b};i.ctrlpts.push(w.x+S.x*p,w.y+S.y*p)}};Pt.findTaxiPoints=function(r,e){var t=r._private.rscratch;t.edgeType="segments";var n="vertical",a="horizontal",i="leftward",o="rightward",s="downward",u="upward",l="auto",c=e.posPts,f=e.srcW,d=e.srcH,h=e.tgtW,v=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"),x=b.units==="%",E=b.pfValue,S=E<0,w=r.pstyle("taxi-turn-min-distance").pfValue,k=g?(f+h)/2:0,_=g?(d+v)/2:0,C=c.x2-c.x1,T=c.y2-c.y1,D=function(U,Y){return U>0?Math.max(U-Y,0):Math.min(U+Y,0)},A=D(C,k),R=D(T,_),M=!1;m===l?p=Math.abs(A)>Math.abs(R)?a:n:m===u||m===s?(p=n,M=!0):(m===i||m===o)&&(p=a,M=!0);var L=p===n,B=L?R:A,I=L?T:C,H=Vu(I),q=!1;!(M&&(x||S))&&(m===s&&I<0||m===u&&I>0||m===i&&I>0||m===o&&I<0)&&(H*=-1,B=H*Math.abs(B),q=!0);var N;if(x){var G=E<0?1+E:E;N=G*B}else{var X=E<0?B:0;N=X+E*H}var j=function(U){return Math.abs(U)<w||Math.abs(U)>=Math.abs(B)},Q=j(N),Z=j(Math.abs(B)-Math.abs(N)),te=Q||Z;if(te&&!q)if(L){var ne=Math.abs(I)<=d/2,$=Math.abs(C)<=h/2;if(ne){var O=(c.x1+c.x2)/2,z=c.y1,V=c.y2;t.segpts=[O,z,O,V]}else if($){var W=(c.y1+c.y2)/2,re=c.x1,se=c.x2;t.segpts=[re,W,se,W]}else t.segpts=[c.x1,c.y2]}else{var Ce=Math.abs(I)<=f/2,pe=Math.abs(T)<=v/2;if(Ce){var ye=(c.y1+c.y2)/2,ge=c.x1,oe=c.x2;t.segpts=[ge,ye,oe,ye]}else if(pe){var ve=(c.x1+c.x2)/2,de=c.y1,we=c.y2;t.segpts=[ve,de,ve,we]}else t.segpts=[c.x2,c.y1]}else if(L){var xe=c.y1+N+(g?d/2*H:0),Ae=c.x1,Be=c.x2;t.segpts=[Ae,xe,Be,xe]}else{var Ve=c.x1+N+(g?f/2*H:0),ze=c.y1,Oe=c.y2;t.segpts=[Ve,ze,Ve,Oe]}if(t.isRound){var J=r.pstyle("taxi-radius").value,P=r.pstyle("radius-type").value[0]==="arc-radius";t.radii=new Array(t.segpts.length/2).fill(J),t.isArcRadius=new Array(t.segpts.length/2).fill(P)}};Pt.tryToCorrectInvalidPoints=function(r,e){var t=r._private.rscratch;if(t.edgeType==="bezier"){var n=e.srcPos,a=e.tgtPos,i=e.srcW,o=e.srcH,s=e.tgtW,u=e.tgtH,l=e.srcShape,c=e.tgtShape,f=e.srcCornerRadius,d=e.tgtCornerRadius,h=e.srcRs,v=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,x=this.getArrowWidth(r.pstyle("width").pfValue,r.pstyle("arrow-scale").value)*this.arrowShapeWidth,E=b*x,S=bn({x:t.ctrlpts[0],y:t.ctrlpts[1]},{x:t.startX,y:t.startY}),w=S<E,k=bn({x:t.ctrlpts[0],y:t.ctrlpts[1]},{x:t.endX,y:t.endY}),_=k<E,C=!1;if(y||g||w){C=!0;var T={x:t.ctrlpts[0]-n.x,y:t.ctrlpts[1]-n.y},D=Math.sqrt(T.x*T.x+T.y*T.y),A={x:T.x/D,y:T.y/D},R=Math.max(i,o),M={x:t.ctrlpts[0]+A.x*2*R,y:t.ctrlpts[1]+A.y*2*R},L=l.intersectLine(n.x,n.y,i,o,M.x,M.y,0,f,h);w?(t.ctrlpts[0]=t.ctrlpts[0]+A.x*(E-S),t.ctrlpts[1]=t.ctrlpts[1]+A.y*(E-S)):(t.ctrlpts[0]=L[0]+A.x*E,t.ctrlpts[1]=L[1]+A.y*E)}if(p||m||_){C=!0;var B={x:t.ctrlpts[0]-a.x,y:t.ctrlpts[1]-a.y},I=Math.sqrt(B.x*B.x+B.y*B.y),H={x:B.x/I,y:B.y/I},q=Math.max(i,o),N={x:t.ctrlpts[0]+H.x*2*q,y:t.ctrlpts[1]+H.y*2*q},G=c.intersectLine(a.x,a.y,s,u,N.x,N.y,0,d,v);_?(t.ctrlpts[0]=t.ctrlpts[0]+H.x*(E-k),t.ctrlpts[1]=t.ctrlpts[1]+H.y*(E-k)):(t.ctrlpts[0]=G[0]+H.x*E,t.ctrlpts[1]=G[1]+H.y*E)}C&&this.findEndpoints(r)}};Pt.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 n,a;e.ctrlpts.length/2%2===0?(n=e.allpts.length/2-1,e.midX=e.allpts[n],e.midY=e.allpts[n+1]):(n=e.allpts.length/2-3,a=.5,e.midX=gt(e.allpts[n],e.allpts[n+2],e.allpts[n+4],a),e.midY=gt(e.allpts[n+1],e.allpts[n+3],e.allpts[n+5],a))}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(ju({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 u=e.segpts.length/2,l=u-2;e.midX=(e.segpts[l]+e.segpts[u])/2,e.midY=(e.segpts[l+1]+e.segpts[u+1])/2}else{var c=e.segpts.length/2-1;if(!e.isRound)e.midX=e.segpts[c],e.midY=e.segpts[c+1];else{var f={x:e.segpts[c],y:e.segpts[c+1]},d=e.roundCorners[c/2];if(d.radius===0){var h={x:e.segpts[c+2],y:e.segpts[c+3]};e.midX=f.x,e.midY=f.y,e.midVector=[f.y-h.y,h.x-f.x]}else{var v=[f.x-d.cx,f.y-d.cy],y=d.radius/Math.sqrt(Math.pow(v[0],2)+Math.pow(v[1],2));v=v.map(function(g){return g*y}),e.midX=d.cx+v[0],e.midY=d.cy+v[1],e.midVector=v}}}}};Pt.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,$e("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."))};Pt.findEdgeControlPoints=function(r){var e=this;if(!(!r||r.length===0)){for(var t=this,n=t.cy,a=n.hasCompoundNodes(),i=new Pr,o=function(_,C){return[].concat(Mi(_),[C?1:0]).join("-")},s=[],u=[],l=0;l<r.length;l++){var c=r[l],f=c._private,d=c.pstyle("curve-style").value;if(!(c.removed()||!c.takesUpSpace())){if(d==="haystack"){u.push(c);continue}var h=d==="unbundled-bezier"||$r(d,"segments")||d==="straight"||d==="straight-triangle"||$r(d,"taxi"),v=d==="unbundled-bezier"||d==="bezier",y=f.source,g=f.target,p=y.poolIndex(),m=g.poolIndex(),b=[p,m].sort(),x=o(b,h),E=i.get(x);E==null&&(E={eles:[]},s.push({pairId:b,edgeIsUnbundled:h}),i.set(x,E)),E.eles.push(c),h&&(E.hasUnbundled=!0),v&&(E.hasBezier=!0)}}for(var S=function(){var _=s[w],C=_.pairId,T=_.edgeIsUnbundled,D=o(C,T),A=i.get(D),R;if(!A.hasUnbundled){var M=A.eles[0].parallelEdges().filter(function(P){return P.isBundledBezier()});zu(A.eles),M.forEach(function(P){return A.eles.push(P)}),A.eles.sort(function(P,F){return P.poolIndex()-F.poolIndex()})}var L=A.eles[0],B=L.source(),I=L.target();if(B.poolIndex()>I.poolIndex()){var H=B;B=I,I=H}var q=A.srcPos=B.position(),N=A.tgtPos=I.position(),G=A.srcW=B.outerWidth(),X=A.srcH=B.outerHeight(),j=A.tgtW=I.outerWidth(),Q=A.tgtH=I.outerHeight(),Z=A.srcShape=t.nodeShapes[e.getNodeShape(B)],te=A.tgtShape=t.nodeShapes[e.getNodeShape(I)],ne=A.srcCornerRadius=B.pstyle("corner-radius").value==="auto"?"auto":B.pstyle("corner-radius").pfValue,$=A.tgtCornerRadius=I.pstyle("corner-radius").value==="auto"?"auto":I.pstyle("corner-radius").pfValue,O=A.tgtRs=I._private.rscratch,z=A.srcRs=B._private.rscratch;A.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var V=0;V<A.eles.length;V++){var W=A.eles[V],re=W[0]._private.rscratch,se=W.pstyle("curve-style").value,Ce=se==="unbundled-bezier"||$r(se,"segments")||$r(se,"taxi"),pe=!B.same(W.source());if(!A.calculatedIntersection&&B!==I&&(A.hasBezier||A.hasUnbundled)){A.calculatedIntersection=!0;var ye=Z.intersectLine(q.x,q.y,G,X,N.x,N.y,0,ne,z),ge=A.srcIntn=ye,oe=te.intersectLine(N.x,N.y,j,Q,q.x,q.y,0,$,O),ve=A.tgtIntn=oe,de=A.intersectionPts={x1:ye[0],x2:oe[0],y1:ye[1],y2:oe[1]},we=A.posPts={x1:q.x,x2:N.x,y1:q.y,y2:N.y},xe=oe[1]-ye[1],Ae=oe[0]-ye[0],Be=Math.sqrt(Ae*Ae+xe*xe);ae(Be)&&Be>=Cb||(Be=Math.sqrt(Math.max(Ae*Ae,Ba)+Math.max(xe*xe,Ba)));var Ve=A.vector={x:Ae,y:xe},ze=A.vectorNorm={x:Ve.x/Be,y:Ve.y/Be},Oe={x:-ze.y,y:ze.x};A.nodesOverlap=!ae(Be)||te.checkPoint(ye[0],ye[1],0,j,Q,N.x,N.y,$,O)||Z.checkPoint(oe[0],oe[1],0,G,X,q.x,q.y,ne,z),A.vectorNormInverse=Oe,R={nodesOverlap:A.nodesOverlap,dirCounts:A.dirCounts,calculatedIntersection:!0,hasBezier:A.hasBezier,hasUnbundled:A.hasUnbundled,eles:A.eles,srcPos:N,srcRs:O,tgtPos:q,tgtRs:z,srcW:j,srcH:Q,tgtW:G,tgtH:X,srcIntn:ve,tgtIntn:ge,srcShape:te,tgtShape:Z,posPts:{x1:we.x2,y1:we.y2,x2:we.x1,y2:we.y1},intersectionPts:{x1:de.x2,y1:de.y2,x2:de.x1,y2:de.y1},vector:{x:-Ve.x,y:-Ve.y},vectorNorm:{x:-ze.x,y:-ze.y},vectorNormInverse:{x:-Oe.x,y:-Oe.y}}}var J=pe?R:A;re.nodesOverlap=J.nodesOverlap,re.srcIntn=J.srcIntn,re.tgtIntn=J.tgtIntn,re.isRound=se.startsWith("round"),a&&(B.isParent()||B.isChild()||I.isParent()||I.isChild())&&(B.parents().anySame(I)||I.parents().anySame(B)||B.same(I)&&B.isParent())?e.findCompoundLoopPoints(W,J,V,Ce):B===I?e.findLoopPoints(W,J,V,Ce):se.endsWith("segments")?e.findSegmentsPoints(W,J):se.endsWith("taxi")?e.findTaxiPoints(W,J):se==="straight"||!Ce&&A.eles.length%2===1&&V===Math.floor(A.eles.length/2)?e.findStraightEdgePoints(W):e.findBezierPoints(W,J,V,Ce,pe),e.findEndpoints(W),e.tryToCorrectInvalidPoints(W,J),e.checkForInvalidEdgeWarning(W),e.storeAllpts(W),e.storeEdgeProjections(W),e.calculateArrowAngles(W),e.recalculateEdgeLabelProjections(W),e.calculateLabelAngles(W)}},w=0;w<s.length;w++)S();this.findHaystackPoints(u)}};function qv(r){var e=[];if(r!=null){for(var t=0;t<r.length;t+=2){var n=r[t],a=r[t+1];e.push({x:n,y:a})}return e}}Pt.getSegmentPoints=function(r){var e=r[0]._private.rscratch;this.recalculateRenderedStyle(r);var t=e.edgeType;if(t==="segments")return qv(e.segpts)};Pt.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 qv(e.ctrlpts)};Pt.getEdgeMidpoint=function(r){var e=r[0]._private.rscratch;return this.recalculateRenderedStyle(r),{x:e.midX,y:e.midY}};var Ha={};Ha.manualEndptToPx=function(r,e){var t=this,n=r.position(),a=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]*a),e.units[1]==="%"&&(s[1]=s[1]*i),s[0]+=n.x,s[1]+=n.y,s}else{var u=e.pfValue[0];u=-Math.PI/2+u;var l=2*Math.max(a,i),c=[n.x+Math.cos(u)*l,n.y+Math.sin(u)*l];return t.nodeShapes[this.getNodeShape(r)].intersectLine(n.x,n.y,a,i,c[0],c[1],0,r.pstyle("corner-radius").value==="auto"?"auto":r.pstyle("corner-radius").pfValue,o)}};Ha.findEndpoints=function(r){var e,t,n,a,i=this,o,s=r.source()[0],u=r.target()[0],l=s.position(),c=u.position(),f=r.pstyle("target-arrow-shape").value,d=r.pstyle("source-arrow-shape").value,h=r.pstyle("target-distance-from-node").pfValue,v=r.pstyle("source-distance-from-node").pfValue,y=s._private.rscratch,g=u._private.rscratch,p=r.pstyle("curve-style").value,m=r._private.rscratch,b=m.edgeType,x=$r(p,"taxi"),E=b==="self"||b==="compound",S=b==="bezier"||b==="multibezier"||E,w=b!=="bezier",k=b==="straight"||b==="segments",_=b==="segments",C=S||w||k,T=E||x,D=r.pstyle("source-endpoint"),A=T?"outside-to-node":D.value,R=s.pstyle("corner-radius").value==="auto"?"auto":s.pstyle("corner-radius").pfValue,M=r.pstyle("target-endpoint"),L=T?"outside-to-node":M.value,B=u.pstyle("corner-radius").value==="auto"?"auto":u.pstyle("corner-radius").pfValue;m.srcManEndpt=D,m.tgtManEndpt=M;var I,H,q,N,G=(e=(M==null||(t=M.pfValue)===null||t===void 0?void 0:t.length)===2?M.pfValue:null)!==null&&e!==void 0?e:[0,0],X=(n=(D==null||(a=D.pfValue)===null||a===void 0?void 0:a.length)===2?D.pfValue:null)!==null&&n!==void 0?n:[0,0];if(S){var j=[m.ctrlpts[0],m.ctrlpts[1]],Q=w?[m.ctrlpts[m.ctrlpts.length-2],m.ctrlpts[m.ctrlpts.length-1]]:j;I=Q,H=j}else if(k){var Z=_?m.segpts.slice(0,2):[c.x+G[0],c.y+G[1]],te=_?m.segpts.slice(m.segpts.length-2):[l.x+X[0],l.y+X[1]];I=te,H=Z}if(L==="inside-to-node")o=[c.x,c.y];else if(M.units)o=this.manualEndptToPx(u,M);else if(L==="outside-to-line")o=m.tgtIntn;else if(L==="outside-to-node"||L==="outside-to-node-or-label"?q=I:(L==="outside-to-line"||L==="outside-to-line-or-label")&&(q=[l.x,l.y]),o=i.nodeShapes[this.getNodeShape(u)].intersectLine(c.x,c.y,u.outerWidth(),u.outerHeight(),q[0],q[1],0,B,g),L==="outside-to-node-or-label"||L==="outside-to-line-or-label"){var ne=u._private.rscratch,$=ne.labelWidth,O=ne.labelHeight,z=ne.labelX,V=ne.labelY,W=$/2,re=O/2,se=u.pstyle("text-valign").value;se==="top"?V-=re:se==="bottom"&&(V+=re);var Ce=u.pstyle("text-halign").value;Ce==="left"?z-=W:Ce==="right"&&(z+=W);var pe=Pa(q[0],q[1],[z-W,V-re,z+W,V-re,z+W,V+re,z-W,V+re],c.x,c.y);if(pe.length>0){var ye=l,ge=vn(ye,Nn(o)),oe=vn(ye,Nn(pe)),ve=ge;if(oe<ge&&(o=pe,ve=oe),pe.length>2){var de=vn(ye,{x:pe[2],y:pe[3]});de<ve&&(o=[pe[2],pe[3]])}}}var we=ci(o,I,i.arrowShapes[f].spacing(r)+h),xe=ci(o,I,i.arrowShapes[f].gap(r)+h);if(m.endX=xe[0],m.endY=xe[1],m.arrowEndX=we[0],m.arrowEndY=we[1],A==="inside-to-node")o=[l.x,l.y];else if(D.units)o=this.manualEndptToPx(s,D);else if(A==="outside-to-line")o=m.srcIntn;else if(A==="outside-to-node"||A==="outside-to-node-or-label"?N=H:(A==="outside-to-line"||A==="outside-to-line-or-label")&&(N=[c.x,c.y]),o=i.nodeShapes[this.getNodeShape(s)].intersectLine(l.x,l.y,s.outerWidth(),s.outerHeight(),N[0],N[1],0,R,y),A==="outside-to-node-or-label"||A==="outside-to-line-or-label"){var Ae=s._private.rscratch,Be=Ae.labelWidth,Ve=Ae.labelHeight,ze=Ae.labelX,Oe=Ae.labelY,J=Be/2,P=Ve/2,F=s.pstyle("text-valign").value;F==="top"?Oe-=P:F==="bottom"&&(Oe+=P);var U=s.pstyle("text-halign").value;U==="left"?ze-=J:U==="right"&&(ze+=J);var Y=Pa(N[0],N[1],[ze-J,Oe-P,ze+J,Oe-P,ze+J,Oe+P,ze-J,Oe+P],l.x,l.y);if(Y.length>0){var K=c,ce=vn(K,Nn(o)),ee=vn(K,Nn(Y)),ie=ce;if(ee<ce&&(o=[Y[0],Y[1]],ie=ee),Y.length>2){var ue=vn(K,{x:Y[2],y:Y[3]});ue<ie&&(o=[Y[2],Y[3]])}}}var me=ci(o,H,i.arrowShapes[d].spacing(r)+v),Ee=ci(o,H,i.arrowShapes[d].gap(r)+v);m.startX=Ee[0],m.startY=Ee[1],m.arrowStartX=me[0],m.arrowStartY=me[1],C&&(!ae(m.startX)||!ae(m.startY)||!ae(m.endX)||!ae(m.endY)?m.badLine=!0:m.badLine=!1)};Ha.getSourceEndpoint=function(r){var e=r[0]._private.rscratch;return this.recalculateRenderedStyle(r),e.edgeType==="haystack"?{x:e.haystackPts[0],y:e.haystackPts[1]}:{x:e.arrowStartX,y:e.arrowStartY}};Ha.getTargetEndpoint=function(r){var e=r[0]._private.rscratch;return this.recalculateRenderedStyle(r),e.edgeType==="haystack"?{x:e.haystackPts[2],y:e.haystackPts[3]}:{x:e.arrowEndX,y:e.arrowEndY}};var el={};function Sb(r,e,t){for(var n=function(l,c,f,d){return gt(l,c,f,d)},a=e._private,i=a.rstyle.bezierPts,o=0;o<r.bezierProjPcts.length;o++){var s=r.bezierProjPcts[o];i.push({x:n(t[0],t[2],t[4],s),y:n(t[1],t[3],t[5],s)})}}el.storeEdgeProjections=function(r){var e=r._private,t=e.rscratch,n=t.edgeType;if(e.rstyle.bezierPts=null,e.rstyle.linePts=null,e.rstyle.haystackPts=null,n==="multibezier"||n==="bezier"||n==="self"||n==="compound"){e.rstyle.bezierPts=[];for(var a=0;a+5<t.allpts.length;a+=4)Sb(this,r,t.allpts.slice(a,a+6))}else if(n==="segments")for(var i=e.rstyle.linePts=[],a=0;a+1<t.allpts.length;a+=2)i.push({x:t.allpts[a],y:t.allpts[a+1]});else if(n==="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};el.recalculateEdgeProjections=function(r){this.findEdgeControlPoints(r)};var br={};br.recalculateNodeLabelProjection=function(r){var e=r.pstyle("label").strValue;if(!Kr(e)){var t,n,a=r._private,i=r.width(),o=r.height(),s=r.padding(),u=r.position(),l=r.pstyle("text-halign").strValue,c=r.pstyle("text-valign").strValue,f=a.rscratch,d=a.rstyle;switch(l){case"left":t=u.x-i/2-s;break;case"right":t=u.x+i/2+s;break;default:t=u.x}switch(c){case"top":n=u.y-o/2-s;break;case"bottom":n=u.y+o/2+s;break;default:n=u.y}f.labelX=t,f.labelY=n,d.labelX=t,d.labelY=n,this.calculateLabelAngles(r),this.applyLabelDimensions(r)}};var Gv=function(e,t){var n=Math.atan(t/e);return e===0&&n<0&&(n=n*-1),n},Hv=function(e,t){var n=t.x-e.x,a=t.y-e.y;return Gv(n,a)},kb=function(e,t,n,a){var i=_a(0,a-.001,1),o=_a(0,a+.001,1),s=Vn(e,t,n,i),u=Vn(e,t,n,o);return Hv(s,u)};br.recalculateEdgeLabelProjections=function(r){var e,t=r._private,n=t.rscratch,a=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:n.midX,y:n.midY};var o=function(f,d,h){_r(t.rscratch,f,d,h),_r(t.rstyle,f,d,h)};o("labelX",null,e.x),o("labelY",null,e.y);var s=Gv(n.midDispX,n.midDispY);o("labelAutoAngle",null,s);var u=function(){if(u.cache)return u.cache;for(var f=[],d=0;d+5<n.allpts.length;d+=4){var h={x:n.allpts[d],y:n.allpts[d+1]},v={x:n.allpts[d+2],y:n.allpts[d+3]},y={x:n.allpts[d+4],y:n.allpts[d+5]};f.push({p0:h,p1:v,p2:y,startDist:0,length:0,segments:[]})}var g=t.rstyle.bezierPts,p=a.bezierProjPcts.length;function m(w,k,_,C,T){var D=bn(k,_),A=w.segments[w.segments.length-1],R={p0:k,p1:_,t0:C,t1:T,startDist:A?A.startDist+A.length:0,length:D};w.segments.push(R),w.length+=D}for(var b=0;b<f.length;b++){var x=f[b],E=f[b-1];E&&(x.startDist=E.startDist+E.length),m(x,x.p0,g[b*p],0,a.bezierProjPcts[0]);for(var S=0;S<p-1;S++)m(x,g[b*p+S],g[b*p+S+1],a.bezierProjPcts[S],a.bezierProjPcts[S+1]);m(x,g[b*p+p-1],x.p2,a.bezierProjPcts[p-1],1)}return u.cache=f},l=function(f){var d,h=f==="source";if(i[f]){var v=r.pstyle(f+"-text-offset").pfValue;switch(n.edgeType){case"self":case"compound":case"bezier":case"multibezier":{for(var y=u(),g,p=0,m=0,b=0;b<y.length;b++){for(var x=y[h?b:y.length-1-b],E=0;E<x.segments.length;E++){var S=x.segments[h?E:x.segments.length-1-E],w=b===y.length-1&&E===x.segments.length-1;if(p=m,m+=S.length,m>=v||w){g={cp:x,segment:S};break}}if(g)break}var k=g.cp,_=g.segment,C=(v-p)/_.length,T=_.t1-_.t0,D=h?_.t0+T*C:_.t1-T*C;D=_a(0,D,1),e=Vn(k.p0,k.p1,k.p2,D),d=kb(k.p0,k.p1,k.p2,D);break}case"straight":case"segments":case"haystack":{for(var A=0,R,M,L,B,I=n.allpts.length,H=0;H+3<I&&(h?(L={x:n.allpts[H],y:n.allpts[H+1]},B={x:n.allpts[H+2],y:n.allpts[H+3]}):(L={x:n.allpts[I-2-H],y:n.allpts[I-1-H]},B={x:n.allpts[I-4-H],y:n.allpts[I-3-H]}),R=bn(L,B),M=A,A+=R,!(A>=v));H+=2);var q=v-M,N=q/R;N=_a(0,N,1),e=Xg(L,B,N),d=Hv(L,B);break}}o("labelX",f,e.x),o("labelY",f,e.y),o("labelAutoAngle",f,d)}};l("source"),l("target"),this.applyLabelDimensions(r)}};br.applyLabelDimensions=function(r){this.applyPrefixedLabelDimensions(r),r.isEdge()&&(this.applyPrefixedLabelDimensions(r,"source"),this.applyPrefixedLabelDimensions(r,"target"))};br.applyPrefixedLabelDimensions=function(r,e){var t=r._private,n=this.getLabelText(r,e),a=mn(n,r._private.labelDimsKey);if(zt(t.rscratch,"prefixedLabelDimsKey",e)!==a){_r(t.rscratch,"prefixedLabelDimsKey",e,a);var i=this.calculateLabelDimensions(r,n),o=r.pstyle("line-height").pfValue,s=r.pstyle("text-wrap").strValue,u=zt(t.rscratch,"labelWrapCachedLines",e)||[],l=s!=="wrap"?1:Math.max(u.length,1),c=i.height/l,f=c*o,d=i.width,h=i.height+(l-1)*(o-1)*c;_r(t.rstyle,"labelWidth",e,d),_r(t.rscratch,"labelWidth",e,d),_r(t.rstyle,"labelHeight",e,h),_r(t.rscratch,"labelHeight",e,h),_r(t.rscratch,"labelLineHeight",e,f)}};br.getLabelText=function(r,e){var t=r._private,n=e?e+"-":"",a=r.pstyle(n+"label").strValue,i=r.pstyle("text-transform").value,o=function(X,j){return j?(_r(t.rscratch,X,e,j),j):zt(t.rscratch,X,e)};if(!a)return"";i=="none"||(i=="uppercase"?a=a.toUpperCase():i=="lowercase"&&(a=a.toLowerCase()));var s=r.pstyle("text-wrap").value;if(s==="wrap"){var u=o("labelKey");if(u!=null&&o("labelWrapKey")===u)return o("labelWrapCachedText");for(var l="\u200B",c=a.split(`
5
+ `),f=r.pstyle("text-max-width").pfValue,d=r.pstyle("text-overflow-wrap").value,h=d==="anywhere",v=[],y=/[\s\u200b]+|$/g,g=0;g<c.length;g++){var p=c[g],m=this.calculateLabelDimensions(r,p),b=m.width;if(h){var x=p.split("").join(l);p=x}if(b>f){var E=p.matchAll(y),S="",w=0,k=Vt(E),_;try{for(k.s();!(_=k.n()).done;){var C=_.value,T=C[0],D=p.substring(w,C.index);w=C.index+T.length;var A=S.length===0?D:S+D+T,R=this.calculateLabelDimensions(r,A),M=R.width;M<=f?S+=D+T:(S&&v.push(S),S=D+T)}}catch(G){k.e(G)}finally{k.f()}S.match(/^[\s\u200b]+$/)||v.push(S)}else v.push(p)}o("labelWrapCachedLines",v),a=o("labelWrapCachedText",v.join(`
6
+ `)),o("labelWrapKey",u)}else if(s==="ellipsis"){var L=r.pstyle("text-max-width").pfValue,B="",I="\u2026",H=!1;if(this.calculateLabelDimensions(r,a).width<L)return a;for(var q=0;q<a.length;q++){var N=this.calculateLabelDimensions(r,B+a[q]+I).width;if(N>L)break;B+=a[q],q===a.length-1&&(H=!0)}return H||(B+=I),B}return a};br.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};br.calculateLabelDimensions=function(r,e){var t=this,n=t.cy.window(),a=n.document,i=0,o=r.pstyle("font-style").strValue,s=r.pstyle("font-size").pfValue,u=r.pstyle("font-family").strValue,l=r.pstyle("font-weight").strValue,c=this.labelCalcCanvas,f=this.labelCalcCanvasContext;if(!c){c=this.labelCalcCanvas=a.createElement("canvas"),f=this.labelCalcCanvasContext=c.getContext("2d");var d=c.style;d.position="absolute",d.left="-9999px",d.top="-9999px",d.zIndex="-1",d.visibility="hidden",d.pointerEvents="none"}f.font="".concat(o," ").concat(l," ").concat(s,"px ").concat(u);for(var h=0,v=0,y=e.split(`
7
+ `),g=0;g<y.length;g++){var p=y[g],m=f.measureText(p),b=Math.ceil(m.width),x=s;h=Math.max(b,h),v+=x}return h+=i,v+=i,{width:h,height:v}};br.calculateLabelAngle=function(r,e){var t=r._private,n=t.rscratch,a=r.isEdge(),i=e?e+"-":"",o=r.pstyle(i+"text-rotation"),s=o.strValue;return s==="none"?0:a&&s==="autorotate"?n.labelAutoAngle:s==="autorotate"?0:o.pfValue};br.calculateLabelAngles=function(r){var e=this,t=r.isEdge(),n=r._private,a=n.rscratch;a.labelAngle=e.calculateLabelAngle(r),t&&(a.sourceLabelAngle=e.calculateLabelAngle(r,"source"),a.targetLabelAngle=e.calculateLabelAngle(r,"target"))};var $v={},ad=28,id=!1;$v.getNodeShape=function(r){var e=this,t=r.pstyle("shape").value;if(t==="cutrectangle"&&(r.width()<ad||r.height()<ad))return id||($e("The `cutrectangle` node shape can not be used at small sizes so `rectangle` is used instead"),id=!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 n=r.pstyle("shape-polygon-points").value;return e.nodeShapes.makePolygon(n).name}return t};var so={};so.registerCalculationListeners=function(){var r=this.cy,e=r.collection(),t=this,n=function(o){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(e.merge(o),s)for(var u=0;u<o.length;u++){var l=o[u],c=l._private,f=c.rstyle;f.clean=!1,f.cleanConnected=!1}};t.binder(r).on("bounds.* dirty.*",function(o){var s=o.target;n(s)}).on("style.* background.*",function(o){var s=o.target;n(s,!1)});var a=function(o){if(o){var s=t.onUpdateEleCalcsFns;e.cleanStyle();for(var u=0;u<e.length;u++){var l=e[u],c=l._private.rstyle;l.isNode()&&!c.cleanConnected&&(n(l.connectedEdges()),c.cleanConnected=!0)}if(s)for(var f=0;f<s.length;f++){var d=s[f];d(o,e)}t.recalculateRenderedStyle(e),e=r.collection()}};t.flushRenderedStyleQueue=function(){a(!0)},t.beforeRender(a,t.beforeRenderPriorities.eleCalcs)};so.onUpdateEleCalcs=function(r){var e=this.onUpdateEleCalcsFns=this.onUpdateEleCalcsFns||[];e.push(r)};so.recalculateRenderedStyle=function(r,e){var t=function(x){return x._private.rstyle.cleanConnected};if(r.length!==0){var n=[],a=[];if(!this.destroyed){e===void 0&&(e=!0);for(var i=0;i<r.length;i++){var o=r[i],s=o._private,u=s.rstyle;o.isEdge()&&(!t(o.source())||!t(o.target()))&&(u.clean=!1),o.isEdge()&&o.isBundledBezier()&&o.parallelEdges().some(function(b){return!b._private.rstyle.clean&&b.isBundledBezier()})&&(u.clean=!1),!(e&&u.clean||o.removed())&&o.pstyle("display").value!=="none"&&(s.group==="nodes"?a.push(o):n.push(o),u.clean=!0)}for(var l=0;l<a.length;l++){var c=a[l],f=c._private,d=f.rstyle,h=c.position();this.recalculateNodeLabelProjection(c),d.nodeX=h.x,d.nodeY=h.y,d.nodeW=c.pstyle("width").pfValue,d.nodeH=c.pstyle("height").pfValue}this.recalculateEdgeProjections(n);for(var v=0;v<n.length;v++){var y=n[v],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 uo={};uo.updateCachedGrabbedEles=function(){var r=this.cachedZSortedEles;if(r){r.drag=[],r.nondrag=[];for(var e=[],t=0;t<r.length;t++){var n=r[t],a=n._private.rscratch;n.grabbed()&&!n.isParent()?e.push(n):a.inDragLayer?r.drag.push(n):r.nondrag.push(n)}for(var t=0;t<e.length;t++){var n=e[t];r.drag.push(n)}}};uo.invalidateCachedZSortedEles=function(){this.cachedZSortedEles=null};uo.getCachedZSortedEles=function(r){if(r||!this.cachedZSortedEles){var e=this.cy.mutableElements().toArray();e.sort(kv),e.interactive=e.filter(function(t){return t.interactive()}),this.cachedZSortedEles=e,this.updateCachedGrabbedEles()}else e=this.cachedZSortedEles;return e};var Uv={};[Cn,qi,Pt,Ha,el,br,$v,so,uo].forEach(function(r){be(Uv,r)});var Wv={};Wv.getCachedImage=function(r,e,t){var n=this,a=n.imageCache=n.imageCache||{},i=a[r];if(i)return i.image.complete||i.image.addEventListener("load",t),i.image;i=a[r]=a[r]||{};var o=i.image=new Image;o.addEventListener("load",t),o.addEventListener("error",function(){o.error=!0});var s="data:",u=r.substring(0,s.length).toLowerCase()===s;return u||(e=e==="null"?null:e,o.crossOrigin=e),o.src=r,o};var Xv=function(e,t){var n=e[0];!n||n._private.grabbed===t||(n._private.grabbed=t,e.updateStyle(!1))},Tb=function(e){Xv(e,!0)},_b=function(e){Xv(e,!1)},Qn={};Qn.registerBinding=function(r,e,t,n){var a=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 u=this.binder(s);i.push(u.on.apply(u,a))}}return i}var u=this.binder(r);return u.on.apply(u,a)};Qn.binder=function(r){var e=this,t=e.cy.window(),n=r===t||r===t.document||r===t.document.body||Np(r);if(e.supportsPassiveEvents==null){var a=!1;try{var i=Object.defineProperty({},"passive",{get:function(){return a=!0,!0}});t.addEventListener("test",null,i)}catch(s){}e.supportsPassiveEvents=a}var o=function(u,l,c){var f=Array.prototype.slice.call(arguments);return n&&e.supportsPassiveEvents&&(f[2]={capture:c??!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}};Qn.nodeIsDraggable=function(r){return r&&r.isNode()&&!r.locked()&&r.grabbable()};Qn.nodeIsGrabbable=function(r){return this.nodeIsDraggable(r)&&r.interactive()};Qn.load=function(){var r=this,e=r.cy.window(),t=function(P){return P.selected()},n=function(P){var F=P.getRootNode();if(F&&F.nodeType===11&&F.host!==void 0)return F},a=function(P,F,U,Y){P==null&&(P=r.cy);for(var K=0;K<F.length;K++){var ce=F[K];P.emit({originalEvent:U,type:ce,position:Y})}},i=function(P){return P.shiftKey||P.metaKey||P.ctrlKey},o=function(P,F){var U=!0;if(r.cy.hasCompoundNodes()&&P&&P.pannable())for(var Y=0;F&&Y<F.length;Y++){var P=F[Y];if(P.isNode()&&P.isParent()&&!P.pannable()){U=!1;break}}else U=!0;return U},s=function(P){P[0]._private.rscratch.inDragLayer=!0},u=function(P){P[0]._private.rscratch.inDragLayer=!1},l=function(P){P[0]._private.rscratch.isGrabTarget=!0},c=function(P){P[0]._private.rscratch.isGrabTarget=!1},f=function(P,F){var U=F.addToList,Y=U.has(P);!Y&&P.grabbable()&&!P.locked()&&(U.merge(P),Tb(P))},d=function(P,F){if(P.cy().hasCompoundNodes()&&!(F.inDragLayer==null&&F.addToList==null)){var U=P.descendants();F.inDragLayer&&(U.forEach(s),U.connectedEdges().forEach(s)),F.addToList&&f(U,F)}},h=function(P,F){F=F||{};var U=P.cy().hasCompoundNodes();F.inDragLayer&&(P.forEach(s),P.neighborhood().stdFilter(function(Y){return!U||Y.isEdge()}).forEach(s)),F.addToList&&P.forEach(function(Y){f(Y,F)}),d(P,F),g(P,{inDragLayer:F.inDragLayer}),r.updateCachedGrabbedEles()},v=h,y=function(P){P&&(r.getCachedZSortedEles().forEach(function(F){_b(F),u(F),c(F)}),r.updateCachedGrabbedEles())},g=function(P,F){if(!(F.inDragLayer==null&&F.addToList==null)&&P.cy().hasCompoundNodes()){var U=P.ancestors().orphans();if(!U.same(P)){var Y=U.descendants().spawnSelf().merge(U).unmerge(P).unmerge(P.descendants()),K=Y.connectedEdges();F.inDragLayer&&(K.forEach(s),Y.forEach(s)),F.addToList&&Y.forEach(function(ce){f(ce,F)})}}},p=function(){document.activeElement!=null&&document.activeElement.blur!=null&&document.activeElement.blur()},m=typeof MutationObserver<"u",b=typeof ResizeObserver<"u";m?(r.removeObserver=new MutationObserver(function(J){for(var P=0;P<J.length;P++){var F=J[P],U=F.removedNodes;if(U)for(var Y=0;Y<U.length;Y++){var K=U[Y];if(K===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 x=Fa(function(){r.cy.resize()},100);m&&(r.styleObserver=new MutationObserver(x),r.styleObserver.observe(r.container,{attributes:!0})),r.registerBinding(e,"resize",x),b&&(r.resizeObserver=new ResizeObserver(x),r.resizeObserver.observe(r.container));var E=function(P,F){for(;P!=null;)F(P),P=P.parentNode},S=function(){r.invalidateContainerClientCoordsCache()};E(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 w=function(){return r.selection[4]!==0},k=function(P){for(var F=r.findContainerClientCoords(),U=F[0],Y=F[1],K=F[2],ce=F[3],ee=P.touches?P.touches:[P],ie=!1,ue=0;ue<ee.length;ue++){var me=ee[ue];if(U<=me.clientX&&me.clientX<=U+K&&Y<=me.clientY&&me.clientY<=Y+ce){ie=!0;break}}if(!ie)return!1;for(var Ee=r.container,Se=P.target,fe=Se.parentNode,Me=!1;fe;){if(fe===Ee){Me=!0;break}fe=fe.parentNode}return!!Me};r.registerBinding(r.container,"mousedown",function(P){if(k(P)&&!(r.hoverData.which===1&&P.which!==1)){P.preventDefault(),p(),r.hoverData.capture=!0,r.hoverData.which=P.which;var F=r.cy,U=[P.clientX,P.clientY],Y=r.projectIntoViewport(U[0],U[1]),K=r.selection,ce=r.findNearestElements(Y[0],Y[1],!0,!1),ee=ce[0],ie=r.dragData.possibleDragElements;r.hoverData.mdownPos=Y,r.hoverData.mdownGPos=U;var ue=function(Le){return{originalEvent:P,type:Le,position:{x:Y[0],y:Y[1]}}},me=function(){r.hoverData.tapholdCancelled=!1,clearTimeout(r.hoverData.tapholdTimeout),r.hoverData.tapholdTimeout=setTimeout(function(){if(!r.hoverData.tapholdCancelled){var Le=r.hoverData.down;Le?Le.emit(ue("taphold")):F.emit(ue("taphold"))}},r.tapholdDuration)};if(P.which==3){r.hoverData.cxtStarted=!0;var Ee={originalEvent:P,type:"cxttapstart",position:{x:Y[0],y:Y[1]}};ee?(ee.activate(),ee.emit(Ee),r.hoverData.down=ee):F.emit(Ee),r.hoverData.downTime=new Date().getTime(),r.hoverData.cxtDragged=!1}else if(P.which==1){ee&&ee.activate();{if(ee!=null&&r.nodeIsGrabbable(ee)){var Se=function(Le){Le.emit(ue("grab"))};if(l(ee),!ee.selected())ie=r.dragData.possibleDragElements=F.collection(),v(ee,{addToList:ie}),ee.emit(ue("grabon")).emit(ue("grab"));else{ie=r.dragData.possibleDragElements=F.collection();var fe=F.$(function(Me){return Me.isNode()&&Me.selected()&&r.nodeIsGrabbable(Me)});h(fe,{addToList:ie}),ee.emit(ue("grabon")),fe.forEach(Se)}r.redrawHint("eles",!0),r.redrawHint("drag",!0)}r.hoverData.down=ee,r.hoverData.downs=ce,r.hoverData.downTime=new Date().getTime()}a(ee,["mousedown","tapstart","vmousedown"],P,{x:Y[0],y:Y[1]}),ee==null?(K[4]=1,r.data.bgActivePosistion={x:Y[0],y:Y[1]},r.redrawHint("select",!0),r.redraw()):ee.pannable()&&(K[4]=1),me()}K[0]=K[2]=Y[0],K[1]=K[3]=Y[1]}},!1);var _=n(r.container);r.registerBinding([e,_],"mousemove",function(P){var F=r.hoverData.capture;if(!(!F&&!k(P))){var U=!1,Y=r.cy,K=Y.zoom(),ce=[P.clientX,P.clientY],ee=r.projectIntoViewport(ce[0],ce[1]),ie=r.hoverData.mdownPos,ue=r.hoverData.mdownGPos,me=r.selection,Ee=null;!r.hoverData.draggingEles&&!r.hoverData.dragging&&!r.hoverData.selecting&&(Ee=r.findNearestElement(ee[0],ee[1],!0,!1));var Se=r.hoverData.last,fe=r.hoverData.down,Me=[ee[0]-me[2],ee[1]-me[3]],Le=r.dragData.possibleDragElements,ht;if(ue){var tt=ce[0]-ue[0],er=tt*tt,rt=ce[1]-ue[1],it=rt*rt,lt=er+it;r.hoverData.isOverThresholdDrag=ht=lt>=r.desktopTapThreshold2}var bt=i(P);ht&&(r.hoverData.tapholdCancelled=!0);var fr=function(){var Ut=r.hoverData.dragDelta=r.hoverData.dragDelta||[];Ut.length===0?(Ut.push(Me[0]),Ut.push(Me[1])):(Ut[0]+=Me[0],Ut[1]+=Me[1])};U=!0,a(Ee,["mousemove","vmousemove","tapdrag"],P,{x:ee[0],y:ee[1]});var Je=function(Ut){return{originalEvent:P,type:Ut,position:{x:ee[0],y:ee[1]}}},wr=function(){r.data.bgActivePosistion=void 0,r.hoverData.selecting||Y.emit(Je("boxstart")),me[4]=1,r.hoverData.selecting=!0,r.redrawHint("select",!0),r.redraw()};if(r.hoverData.which===3){if(ht){var tr=Je("cxtdrag");fe?fe.emit(tr):Y.emit(tr),r.hoverData.cxtDragged=!0,(!r.hoverData.cxtOver||Ee!==r.hoverData.cxtOver)&&(r.hoverData.cxtOver&&r.hoverData.cxtOver.emit(Je("cxtdragout")),r.hoverData.cxtOver=Ee,Ee&&Ee.emit(Je("cxtdragover")))}}else if(r.hoverData.dragging){if(U=!0,Y.panningEnabled()&&Y.userPanningEnabled()){var Ir;if(r.hoverData.justStartedPan){var ni=r.hoverData.mdownPos;Ir={x:(ee[0]-ni[0])*K,y:(ee[1]-ni[1])*K},r.hoverData.justStartedPan=!1}else Ir={x:Me[0]*K,y:Me[1]*K};Y.panBy(Ir),Y.emit(Je("dragpan")),r.hoverData.dragged=!0}ee=r.projectIntoViewport(P.clientX,P.clientY)}else if(me[4]==1&&(fe==null||fe.pannable())){if(ht){if(!r.hoverData.dragging&&Y.boxSelectionEnabled()&&(bt||!Y.panningEnabled()||!Y.userPanningEnabled()))wr();else if(!r.hoverData.selecting&&Y.panningEnabled()&&Y.userPanningEnabled()){var ln=o(fe,r.hoverData.downs);ln&&(r.hoverData.dragging=!0,r.hoverData.justStartedPan=!0,me[4]=0,r.data.bgActivePosistion=Nn(ie),r.redrawHint("select",!0),r.redraw())}fe&&fe.pannable()&&fe.active()&&fe.unactivate()}}else{if(fe&&fe.pannable()&&fe.active()&&fe.unactivate(),(!fe||!fe.grabbed())&&Ee!=Se&&(Se&&a(Se,["mouseout","tapdragout"],P,{x:ee[0],y:ee[1]}),Ee&&a(Ee,["mouseover","tapdragover"],P,{x:ee[0],y:ee[1]}),r.hoverData.last=Ee),fe)if(ht){if(Y.boxSelectionEnabled()&&bt)fe&&fe.grabbed()&&(y(Le),fe.emit(Je("freeon")),Le.emit(Je("free")),r.dragData.didDrag&&(fe.emit(Je("dragfreeon")),Le.emit(Je("dragfree")))),wr();else if(fe&&fe.grabbed()&&r.nodeIsDraggable(fe)){var Ot=!r.dragData.didDrag;Ot&&r.redrawHint("eles",!0),r.dragData.didDrag=!0,r.hoverData.draggingEles||h(Le,{inDragLayer:!0});var St={x:0,y:0};if(ae(Me[0])&&ae(Me[1])&&(St.x+=Me[0],St.y+=Me[1],Ot)){var It=r.hoverData.dragDelta;It&&ae(It[0])&&ae(It[1])&&(St.x+=It[0],St.y+=It[1])}r.hoverData.draggingEles=!0,Le.silentShift(St).emit(Je("position")).emit(Je("drag")),r.redrawHint("drag",!0),r.redraw()}}else fr();U=!0}if(me[2]=ee[0],me[3]=ee[1],U)return P.stopPropagation&&P.stopPropagation(),P.preventDefault&&P.preventDefault(),!1}},!1);var C,T,D;r.registerBinding(e,"mouseup",function(P){if(!(r.hoverData.which===1&&P.which!==1&&r.hoverData.capture)){var F=r.hoverData.capture;if(F){r.hoverData.capture=!1;var U=r.cy,Y=r.projectIntoViewport(P.clientX,P.clientY),K=r.selection,ce=r.findNearestElement(Y[0],Y[1],!0,!1),ee=r.dragData.possibleDragElements,ie=r.hoverData.down,ue=i(P);r.data.bgActivePosistion&&(r.redrawHint("select",!0),r.redraw()),r.hoverData.tapholdCancelled=!0,r.data.bgActivePosistion=void 0,ie&&ie.unactivate();var me=function(tt){return{originalEvent:P,type:tt,position:{x:Y[0],y:Y[1]}}};if(r.hoverData.which===3){var Ee=me("cxttapend");if(ie?ie.emit(Ee):U.emit(Ee),!r.hoverData.cxtDragged){var Se=me("cxttap");ie?ie.emit(Se):U.emit(Se)}r.hoverData.cxtDragged=!1,r.hoverData.which=null}else if(r.hoverData.which===1){if(a(ce,["mouseup","tapend","vmouseup"],P,{x:Y[0],y:Y[1]}),!r.dragData.didDrag&&!r.hoverData.dragged&&!r.hoverData.selecting&&!r.hoverData.isOverThresholdDrag&&(a(ie,["click","tap","vclick"],P,{x:Y[0],y:Y[1]}),T=!1,P.timeStamp-D<=U.multiClickDebounceTime()?(C&&clearTimeout(C),T=!0,D=null,a(ie,["dblclick","dbltap","vdblclick"],P,{x:Y[0],y:Y[1]})):(C=setTimeout(function(){T||a(ie,["oneclick","onetap","voneclick"],P,{x:Y[0],y:Y[1]})},U.multiClickDebounceTime()),D=P.timeStamp)),ie==null&&!r.dragData.didDrag&&!r.hoverData.selecting&&!r.hoverData.dragged&&!i(P)&&(U.$(t).unselect(["tapunselect"]),ee.length>0&&r.redrawHint("eles",!0),r.dragData.possibleDragElements=ee=U.collection()),ce==ie&&!r.dragData.didDrag&&!r.hoverData.selecting&&ce!=null&&ce._private.selectable&&(r.hoverData.dragging||(U.selectionType()==="additive"||ue?ce.selected()?ce.unselect(["tapunselect"]):ce.select(["tapselect"]):ue||(U.$(t).unmerge(ce).unselect(["tapunselect"]),ce.select(["tapselect"]))),r.redrawHint("eles",!0)),r.hoverData.selecting){var fe=U.collection(r.getAllInBox(K[0],K[1],K[2],K[3]));r.redrawHint("select",!0),fe.length>0&&r.redrawHint("eles",!0),U.emit(me("boxend"));var Me=function(tt){return tt.selectable()&&!tt.selected()};U.selectionType()==="additive"||ue||U.$(t).unmerge(fe).unselect(),fe.emit(me("box")).stdFilter(Me).select().emit(me("boxselect")),r.redraw()}if(r.hoverData.dragging&&(r.hoverData.dragging=!1,r.redrawHint("select",!0),r.redrawHint("eles",!0),r.redraw()),!K[4]){r.redrawHint("drag",!0),r.redrawHint("eles",!0);var Le=ie&&ie.grabbed();y(ee),Le&&(ie.emit(me("freeon")),ee.emit(me("free")),r.dragData.didDrag&&(ie.emit(me("dragfreeon")),ee.emit(me("dragfree"))))}}K[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 A=[],R=4,M,L=1e5,B=function(P,F){for(var U=0;U<P.length;U++)if(P[U]%F!==0)return!1;return!0},I=function(P){for(var F=Math.abs(P[0]),U=1;U<P.length;U++)if(Math.abs(P[U])!==F)return!1;return!0},H=function(P){var F=!1,U=P.deltaY;if(U==null&&(P.wheelDeltaY!=null?U=P.wheelDeltaY/4:P.wheelDelta!=null&&(U=P.wheelDelta/4)),U!==0){if(M==null)if(A.length>=R){var Y=A;if(M=B(Y,5),!M){var K=Math.abs(Y[0]);M=I(Y)&&K>5}if(M)for(var ce=0;ce<Y.length;ce++)L=Math.min(Math.abs(Y[ce]),L)}else A.push(U),F=!0;else M&&(L=Math.min(Math.abs(U),L));if(!r.scrollingPage){var ee=r.cy,ie=ee.zoom(),ue=ee.pan(),me=r.projectIntoViewport(P.clientX,P.clientY),Ee=[me[0]*ie+ue.x,me[1]*ie+ue.y];if(r.hoverData.draggingEles||r.hoverData.dragging||r.hoverData.cxtStarted||w()){P.preventDefault();return}if(ee.panningEnabled()&&ee.userPanningEnabled()&&ee.zoomingEnabled()&&ee.userZoomingEnabled()){P.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 Se;F&&Math.abs(U)>5&&(U=Vu(U)*5),Se=U/-250,M&&(Se/=L,Se*=3),Se=Se*r.wheelSensitivity;var fe=P.deltaMode===1;fe&&(Se*=33);var Me=ee.zoom()*Math.pow(10,Se);P.type==="gesturechange"&&(Me=r.gestureStartZoom*P.scale),ee.zoom({level:Me,renderedPosition:{x:Ee[0],y:Ee[1]}}),ee.emit({type:P.type==="gesturechange"?"pinchzoom":"scrollzoom",originalEvent:P,position:{x:me[0],y:me[1]}})}}}};r.registerBinding(r.container,"wheel",H,!0),r.registerBinding(e,"scroll",function(P){r.scrollingPage=!0,clearTimeout(r.scrollingPageTimeout),r.scrollingPageTimeout=setTimeout(function(){r.scrollingPage=!1},250)},!0),r.registerBinding(r.container,"gesturestart",function(P){r.gestureStartZoom=r.cy.zoom(),r.hasTouchStarted||P.preventDefault()},!0),r.registerBinding(r.container,"gesturechange",function(J){r.hasTouchStarted||H(J)},!0),r.registerBinding(r.container,"mouseout",function(P){var F=r.projectIntoViewport(P.clientX,P.clientY);r.cy.emit({originalEvent:P,type:"mouseout",position:{x:F[0],y:F[1]}})},!1),r.registerBinding(r.container,"mouseover",function(P){var F=r.projectIntoViewport(P.clientX,P.clientY);r.cy.emit({originalEvent:P,type:"mouseover",position:{x:F[0],y:F[1]}})},!1);var q,N,G,X,j,Q,Z,te,ne,$,O,z,V,W=function(P,F,U,Y){return Math.sqrt((U-P)*(U-P)+(Y-F)*(Y-F))},re=function(P,F,U,Y){return(U-P)*(U-P)+(Y-F)*(Y-F)},se;r.registerBinding(r.container,"touchstart",se=function(P){if(r.hasTouchStarted=!0,!!k(P)){p(),r.touchData.capture=!0,r.data.bgActivePosistion=void 0;var F=r.cy,U=r.touchData.now,Y=r.touchData.earlier;if(P.touches[0]){var K=r.projectIntoViewport(P.touches[0].clientX,P.touches[0].clientY);U[0]=K[0],U[1]=K[1]}if(P.touches[1]){var K=r.projectIntoViewport(P.touches[1].clientX,P.touches[1].clientY);U[2]=K[0],U[3]=K[1]}if(P.touches[2]){var K=r.projectIntoViewport(P.touches[2].clientX,P.touches[2].clientY);U[4]=K[0],U[5]=K[1]}var ce=function(bt){return{originalEvent:P,type:bt,position:{x:U[0],y:U[1]}}};if(P.touches[1]){r.touchData.singleTouchMoved=!0,y(r.dragData.touchDragEles);var ee=r.findContainerClientCoords();ne=ee[0],$=ee[1],O=ee[2],z=ee[3],q=P.touches[0].clientX-ne,N=P.touches[0].clientY-$,G=P.touches[1].clientX-ne,X=P.touches[1].clientY-$,V=0<=q&&q<=O&&0<=G&&G<=O&&0<=N&&N<=z&&0<=X&&X<=z;var ie=F.pan(),ue=F.zoom();j=W(q,N,G,X),Q=re(q,N,G,X),Z=[(q+G)/2,(N+X)/2],te=[(Z[0]-ie.x)/ue,(Z[1]-ie.y)/ue];var me=200,Ee=me*me;if(Q<Ee&&!P.touches[2]){var Se=r.findNearestElement(U[0],U[1],!0,!0),fe=r.findNearestElement(U[2],U[3],!0,!0);Se&&Se.isNode()?(Se.activate().emit(ce("cxttapstart")),r.touchData.start=Se):fe&&fe.isNode()?(fe.activate().emit(ce("cxttapstart")),r.touchData.start=fe):F.emit(ce("cxttapstart")),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(P.touches[2])F.boxSelectionEnabled()&&P.preventDefault();else if(!P.touches[1]){if(P.touches[0]){var Me=r.findNearestElements(U[0],U[1],!0,!0),Le=Me[0];if(Le!=null&&(Le.activate(),r.touchData.start=Le,r.touchData.starts=Me,r.nodeIsGrabbable(Le))){var ht=r.dragData.touchDragEles=F.collection(),tt=null;r.redrawHint("eles",!0),r.redrawHint("drag",!0),Le.selected()?(tt=F.$(function(lt){return lt.selected()&&r.nodeIsGrabbable(lt)}),h(tt,{addToList:ht})):v(Le,{addToList:ht}),l(Le),Le.emit(ce("grabon")),tt?tt.forEach(function(lt){lt.emit(ce("grab"))}):Le.emit(ce("grab"))}a(Le,["touchstart","tapstart","vmousedown"],P,{x:U[0],y:U[1]}),Le==null&&(r.data.bgActivePosistion={x:K[0],y:K[1]},r.redrawHint("select",!0),r.redraw()),r.touchData.singleTouchMoved=!1,r.touchData.singleTouchStartTime=+new Date,clearTimeout(r.touchData.tapholdTimeout),r.touchData.tapholdTimeout=setTimeout(function(){r.touchData.singleTouchMoved===!1&&!r.pinching&&!r.touchData.selecting&&a(r.touchData.start,["taphold"],P,{x:U[0],y:U[1]})},r.tapholdDuration)}}if(P.touches.length>=1){for(var er=r.touchData.startPosition=[null,null,null,null,null,null],rt=0;rt<U.length;rt++)er[rt]=Y[rt]=U[rt];var it=P.touches[0];r.touchData.startGPosition=[it.clientX,it.clientY]}}},!1);var Ce;r.registerBinding(e,"touchmove",Ce=function(P){var F=r.touchData.capture;if(!(!F&&!k(P))){var U=r.selection,Y=r.cy,K=r.touchData.now,ce=r.touchData.earlier,ee=Y.zoom();if(P.touches[0]){var ie=r.projectIntoViewport(P.touches[0].clientX,P.touches[0].clientY);K[0]=ie[0],K[1]=ie[1]}if(P.touches[1]){var ie=r.projectIntoViewport(P.touches[1].clientX,P.touches[1].clientY);K[2]=ie[0],K[3]=ie[1]}if(P.touches[2]){var ie=r.projectIntoViewport(P.touches[2].clientX,P.touches[2].clientY);K[4]=ie[0],K[5]=ie[1]}var ue=function(wp){return{originalEvent:P,type:wp,position:{x:K[0],y:K[1]}}},me=r.touchData.startGPosition,Ee;if(F&&P.touches[0]&&me){for(var Se=[],fe=0;fe<K.length;fe++)Se[fe]=K[fe]-ce[fe];var Me=P.touches[0].clientX-me[0],Le=Me*Me,ht=P.touches[0].clientY-me[1],tt=ht*ht,er=Le+tt;Ee=er>=r.touchTapThreshold2}if(F&&r.touchData.cxt){P.preventDefault();var rt=P.touches[0].clientX-ne,it=P.touches[0].clientY-$,lt=P.touches[1].clientX-ne,bt=P.touches[1].clientY-$,fr=re(rt,it,lt,bt),Je=fr/Q,wr=150,tr=wr*wr,Ir=1.5,ni=Ir*Ir;if(Je>=ni||fr>=tr){r.touchData.cxt=!1,r.data.bgActivePosistion=void 0,r.redrawHint("select",!0);var ln=ue("cxttapend");r.touchData.start?(r.touchData.start.unactivate().emit(ln),r.touchData.start=null):Y.emit(ln)}}if(F&&r.touchData.cxt){var ln=ue("cxtdrag");r.data.bgActivePosistion=void 0,r.redrawHint("select",!0),r.touchData.start?r.touchData.start.emit(ln):Y.emit(ln),r.touchData.start&&(r.touchData.start._private.grabbed=!1),r.touchData.cxtDragged=!0;var Ot=r.findNearestElement(K[0],K[1],!0,!0);(!r.touchData.cxtOver||Ot!==r.touchData.cxtOver)&&(r.touchData.cxtOver&&r.touchData.cxtOver.emit(ue("cxtdragout")),r.touchData.cxtOver=Ot,Ot&&Ot.emit(ue("cxtdragover")))}else if(F&&P.touches[2]&&Y.boxSelectionEnabled())P.preventDefault(),r.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,r.touchData.selecting||Y.emit(ue("boxstart")),r.touchData.selecting=!0,r.touchData.didSelect=!0,U[4]=1,!U||U.length===0||U[0]===void 0?(U[0]=(K[0]+K[2]+K[4])/3,U[1]=(K[1]+K[3]+K[5])/3,U[2]=(K[0]+K[2]+K[4])/3+1,U[3]=(K[1]+K[3]+K[5])/3+1):(U[2]=(K[0]+K[2]+K[4])/3,U[3]=(K[1]+K[3]+K[5])/3),r.redrawHint("select",!0),r.redraw();else if(F&&P.touches[1]&&!r.touchData.didSelect&&Y.zoomingEnabled()&&Y.panningEnabled()&&Y.userZoomingEnabled()&&Y.userPanningEnabled()){P.preventDefault(),r.data.bgActivePosistion=void 0,r.redrawHint("select",!0);var St=r.dragData.touchDragEles;if(St){r.redrawHint("drag",!0);for(var It=0;It<St.length;It++){var sa=St[It]._private;sa.grabbed=!1,sa.rscratch.inDragLayer=!1}}var Ut=r.touchData.start,rt=P.touches[0].clientX-ne,it=P.touches[0].clientY-$,lt=P.touches[1].clientX-ne,bt=P.touches[1].clientY-$,Ll=W(rt,it,lt,bt),dp=Ll/j;if(V){var vp=rt-q,hp=it-N,pp=lt-G,gp=bt-X,yp=(vp+pp)/2,mp=(hp+gp)/2,ua=Y.zoom(),Lo=ua*dp,ai=Y.pan(),Ol=te[0]*ua+ai.x,Il=te[1]*ua+ai.y,bp={x:-Lo/ua*(Ol-ai.x-yp)+Ol,y:-Lo/ua*(Il-ai.y-mp)+Il};if(Ut&&Ut.active()){var St=r.dragData.touchDragEles;y(St),r.redrawHint("drag",!0),r.redrawHint("eles",!0),Ut.unactivate().emit(ue("freeon")),St.emit(ue("free")),r.dragData.didDrag&&(Ut.emit(ue("dragfreeon")),St.emit(ue("dragfree")))}Y.viewport({zoom:Lo,pan:bp,cancelOnFailedZoom:!0}),Y.emit(ue("pinchzoom")),j=Ll,q=rt,N=it,G=lt,X=bt,r.pinching=!0}if(P.touches[0]){var ie=r.projectIntoViewport(P.touches[0].clientX,P.touches[0].clientY);K[0]=ie[0],K[1]=ie[1]}if(P.touches[1]){var ie=r.projectIntoViewport(P.touches[1].clientX,P.touches[1].clientY);K[2]=ie[0],K[3]=ie[1]}if(P.touches[2]){var ie=r.projectIntoViewport(P.touches[2].clientX,P.touches[2].clientY);K[4]=ie[0],K[5]=ie[1]}}else if(P.touches[0]&&!r.touchData.didSelect){var rr=r.touchData.start,Oo=r.touchData.last,Ot;if(!r.hoverData.draggingEles&&!r.swipePanning&&(Ot=r.findNearestElement(K[0],K[1],!0,!0)),F&&rr!=null&&P.preventDefault(),F&&rr!=null&&r.nodeIsDraggable(rr))if(Ee){var St=r.dragData.touchDragEles,Nl=!r.dragData.didDrag;Nl&&h(St,{inDragLayer:!0}),r.dragData.didDrag=!0;var la={x:0,y:0};if(ae(Se[0])&&ae(Se[1])&&(la.x+=Se[0],la.y+=Se[1],Nl)){r.redrawHint("eles",!0);var nr=r.touchData.dragDelta;nr&&ae(nr[0])&&ae(nr[1])&&(la.x+=nr[0],la.y+=nr[1])}r.hoverData.draggingEles=!0,St.silentShift(la).emit(ue("position")).emit(ue("drag")),r.redrawHint("drag",!0),r.touchData.startPosition[0]==ce[0]&&r.touchData.startPosition[1]==ce[1]&&r.redrawHint("eles",!0),r.redraw()}else{var nr=r.touchData.dragDelta=r.touchData.dragDelta||[];nr.length===0?(nr.push(Se[0]),nr.push(Se[1])):(nr[0]+=Se[0],nr[1]+=Se[1])}if(a(rr||Ot,["touchmove","tapdrag","vmousemove"],P,{x:K[0],y:K[1]}),(!rr||!rr.grabbed())&&Ot!=Oo&&(Oo&&Oo.emit(ue("tapdragout")),Ot&&Ot.emit(ue("tapdragover"))),r.touchData.last=Ot,F)for(var It=0;It<K.length;It++)K[It]&&r.touchData.startPosition[It]&&Ee&&(r.touchData.singleTouchMoved=!0);if(F&&(rr==null||rr.pannable())&&Y.panningEnabled()&&Y.userPanningEnabled()){var xp=o(rr,r.touchData.starts);xp&&(P.preventDefault(),r.data.bgActivePosistion||(r.data.bgActivePosistion=Nn(r.touchData.startPosition)),r.swipePanning?(Y.panBy({x:Se[0]*ee,y:Se[1]*ee}),Y.emit(ue("dragpan"))):Ee&&(r.swipePanning=!0,Y.panBy({x:Me*ee,y:ht*ee}),Y.emit(ue("dragpan")),rr&&(rr.unactivate(),r.redrawHint("select",!0),r.touchData.start=null)));var ie=r.projectIntoViewport(P.touches[0].clientX,P.touches[0].clientY);K[0]=ie[0],K[1]=ie[1]}}for(var fe=0;fe<K.length;fe++)ce[fe]=K[fe];F&&P.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 pe;r.registerBinding(e,"touchcancel",pe=function(P){var F=r.touchData.start;r.touchData.capture=!1,F&&F.unactivate()});var ye,ge,oe,ve;if(r.registerBinding(e,"touchend",ye=function(P){var F=r.touchData.start,U=r.touchData.capture;if(U)P.touches.length===0&&(r.touchData.capture=!1),P.preventDefault();else return;var Y=r.selection;r.swipePanning=!1,r.hoverData.draggingEles=!1;var K=r.cy,ce=K.zoom(),ee=r.touchData.now,ie=r.touchData.earlier;if(P.touches[0]){var ue=r.projectIntoViewport(P.touches[0].clientX,P.touches[0].clientY);ee[0]=ue[0],ee[1]=ue[1]}if(P.touches[1]){var ue=r.projectIntoViewport(P.touches[1].clientX,P.touches[1].clientY);ee[2]=ue[0],ee[3]=ue[1]}if(P.touches[2]){var ue=r.projectIntoViewport(P.touches[2].clientX,P.touches[2].clientY);ee[4]=ue[0],ee[5]=ue[1]}var me=function(tr){return{originalEvent:P,type:tr,position:{x:ee[0],y:ee[1]}}};F&&F.unactivate();var Ee;if(r.touchData.cxt){if(Ee=me("cxttapend"),F?F.emit(Ee):K.emit(Ee),!r.touchData.cxtDragged){var Se=me("cxttap");F?F.emit(Se):K.emit(Se)}r.touchData.start&&(r.touchData.start._private.grabbed=!1),r.touchData.cxt=!1,r.touchData.start=null,r.redraw();return}if(!P.touches[2]&&K.boxSelectionEnabled()&&r.touchData.selecting){r.touchData.selecting=!1;var fe=K.collection(r.getAllInBox(Y[0],Y[1],Y[2],Y[3]));Y[0]=void 0,Y[1]=void 0,Y[2]=void 0,Y[3]=void 0,Y[4]=0,r.redrawHint("select",!0),K.emit(me("boxend"));var Me=function(tr){return tr.selectable()&&!tr.selected()};fe.emit(me("box")).stdFilter(Me).select().emit(me("boxselect")),fe.nonempty()&&r.redrawHint("eles",!0),r.redraw()}if(F?.unactivate(),P.touches[2])r.data.bgActivePosistion=void 0,r.redrawHint("select",!0);else if(!P.touches[1]){if(!P.touches[0]){if(!P.touches[0]){r.data.bgActivePosistion=void 0,r.redrawHint("select",!0);var Le=r.dragData.touchDragEles;if(F!=null){var ht=F._private.grabbed;y(Le),r.redrawHint("drag",!0),r.redrawHint("eles",!0),ht&&(F.emit(me("freeon")),Le.emit(me("free")),r.dragData.didDrag&&(F.emit(me("dragfreeon")),Le.emit(me("dragfree")))),a(F,["touchend","tapend","vmouseup","tapdragout"],P,{x:ee[0],y:ee[1]}),F.unactivate(),r.touchData.start=null}else{var tt=r.findNearestElement(ee[0],ee[1],!0,!0);a(tt,["touchend","tapend","vmouseup","tapdragout"],P,{x:ee[0],y:ee[1]})}var er=r.touchData.startPosition[0]-ee[0],rt=er*er,it=r.touchData.startPosition[1]-ee[1],lt=it*it,bt=rt+lt,fr=bt*ce*ce;r.touchData.singleTouchMoved||(F||K.$(":selected").unselect(["tapunselect"]),a(F,["tap","vclick"],P,{x:ee[0],y:ee[1]}),ge=!1,P.timeStamp-ve<=K.multiClickDebounceTime()?(oe&&clearTimeout(oe),ge=!0,ve=null,a(F,["dbltap","vdblclick"],P,{x:ee[0],y:ee[1]})):(oe=setTimeout(function(){ge||a(F,["onetap","voneclick"],P,{x:ee[0],y:ee[1]})},K.multiClickDebounceTime()),ve=P.timeStamp)),F!=null&&!r.dragData.didDrag&&F._private.selectable&&fr<r.touchTapThreshold2&&!r.pinching&&(K.selectionType()==="single"?(K.$(t).unmerge(F).unselect(["tapunselect"]),F.select(["tapselect"])):F.selected()?F.unselect(["tapunselect"]):F.select(["tapselect"]),r.redrawHint("eles",!0)),r.touchData.singleTouchMoved=!0}}}for(var Je=0;Je<ee.length;Je++)ie[Je]=ee[Je];r.dragData.didDrag=!1,P.touches.length===0&&(r.touchData.dragDelta=[],r.touchData.startPosition=[null,null,null,null,null,null],r.touchData.startGPosition=null,r.touchData.didSelect=!1),P.touches.length<2&&(P.touches.length===1&&(r.touchData.startGPosition=[P.touches[0].clientX,P.touches[0].clientY]),r.pinching=!1,r.redrawHint("eles",!0),r.redraw())},!1),typeof TouchEvent>"u"){var de=[],we=function(P){return{clientX:P.clientX,clientY:P.clientY,force:1,identifier:P.pointerId,pageX:P.pageX,pageY:P.pageY,radiusX:P.width/2,radiusY:P.height/2,screenX:P.screenX,screenY:P.screenY,target:P.target}},xe=function(P){return{event:P,touch:we(P)}},Ae=function(P){de.push(xe(P))},Be=function(P){for(var F=0;F<de.length;F++){var U=de[F];if(U.event.pointerId===P.pointerId){de.splice(F,1);return}}},Ve=function(P){var F=de.filter(function(U){return U.event.pointerId===P.pointerId})[0];F.event=P,F.touch=we(P)},ze=function(P){P.touches=de.map(function(F){return F.touch})},Oe=function(P){return P.pointerType==="mouse"||P.pointerType===4};r.registerBinding(r.container,"pointerdown",function(J){Oe(J)||(J.preventDefault(),Ae(J),ze(J),se(J))}),r.registerBinding(r.container,"pointerup",function(J){Oe(J)||(Be(J),ze(J),ye(J))}),r.registerBinding(r.container,"pointercancel",function(J){Oe(J)||(Be(J),ze(J),pe(J))}),r.registerBinding(r.container,"pointermove",function(J){Oe(J)||(J.preventDefault(),Ve(J),ze(J),Ce(J))})}};var Rr={};Rr.generatePolygon=function(r,e){return this.nodeShapes[r]={renderer:this,name:r,points:e,draw:function(n,a,i,o,s,u){this.renderer.nodeShapeImpl("polygon",n,a,i,o,s,this.points)},intersectLine:function(n,a,i,o,s,u,l,c){return Pa(s,u,this.points,n,a,i/2,o/2,l)},checkPoint:function(n,a,i,o,s,u,l,c){return Ar(n,a,this.points,u,l,o,s,[0,-1],i)},hasMiterBounds:r!=="rectangle",miterBounds:function(n,a,i,o,s,u){return jg(this.points,n,a,i,o,s)}}};Rr.generateEllipse=function(){return this.nodeShapes.ellipse={renderer:this,name:"ellipse",draw:function(e,t,n,a,i,o){this.renderer.nodeShapeImpl(this.name,e,t,n,a,i)},intersectLine:function(e,t,n,a,i,o,s,u){return sy(i,o,e,t,n/2+s,a/2+s)},checkPoint:function(e,t,n,a,i,o,s,u){return yn(e,t,a,i,o,s,n)}}};Rr.generateRoundPolygon=function(r,e){return this.nodeShapes[r]={renderer:this,name:r,points:e,getOrCreateCorners:function(n,a,i,o,s,u,l){if(u[l]!==void 0&&u[l+"-cx"]===n&&u[l+"-cy"]===a)return u[l];u[l]=new Array(e.length/2),u[l+"-cx"]=n,u[l+"-cy"]=a;var c=i/2,f=o/2;s=s==="auto"?Xd(i,o):s;for(var d=new Array(e.length/2),h=0;h<e.length/2;h++)d[h]={x:n+c*e[h*2],y:a+f*e[h*2+1]};var v,y,g,p,m=d.length;for(y=d[m-1],v=0;v<m;v++)g=d[v%m],p=d[(v+1)%m],u[l][v]=ju(y,g,p,s),y=g,g=p;return u[l]},draw:function(n,a,i,o,s,u,l){this.renderer.nodeShapeImpl("round-polygon",n,a,i,o,s,this.points,this.getOrCreateCorners(a,i,o,s,u,l,"drawCorners"))},intersectLine:function(n,a,i,o,s,u,l,c,f){return ly(s,u,this.points,n,a,i,o,l,this.getOrCreateCorners(n,a,i,o,c,f,"corners"))},checkPoint:function(n,a,i,o,s,u,l,c,f){return oy(n,a,this.points,u,l,o,s,this.getOrCreateCorners(u,l,o,s,c,f,"corners"))}}};Rr.generateRoundRectangle=function(){return this.nodeShapes["round-rectangle"]=this.nodeShapes.roundrectangle={renderer:this,name:"round-rectangle",points:Mt(4,0),draw:function(e,t,n,a,i,o){this.renderer.nodeShapeImpl(this.name,e,t,n,a,i,this.points,o)},intersectLine:function(e,t,n,a,i,o,s,u){return Ud(i,o,e,t,n,a,s,u)},checkPoint:function(e,t,n,a,i,o,s,u){var l=a/2,c=i/2;u=u==="auto"?Qr(a,i):u,u=Math.min(l,c,u);var f=u*2;return!!(Ar(e,t,this.points,o,s,a,i-f,[0,-1],n)||Ar(e,t,this.points,o,s,a-f,i,[0,-1],n)||yn(e,t,f,f,o-l+u,s-c+u,n)||yn(e,t,f,f,o+l-u,s-c+u,n)||yn(e,t,f,f,o+l-u,s+c-u,n)||yn(e,t,f,f,o-l+u,s+c-u,n))}}};Rr.generateCutRectangle=function(){return this.nodeShapes["cut-rectangle"]=this.nodeShapes.cutrectangle={renderer:this,name:"cut-rectangle",cornerLength:Gu(),points:Mt(4,0),draw:function(e,t,n,a,i,o){this.renderer.nodeShapeImpl(this.name,e,t,n,a,i,null,o)},generateCutTrianglePts:function(e,t,n,a,i){var o=i==="auto"?this.cornerLength:i,s=t/2,u=e/2,l=n-u,c=n+u,f=a-s,d=a+s;return{topLeft:[l,f+o,l+o,f,l+o,f+o],topRight:[c-o,f,c,f+o,c-o,f+o],bottomRight:[c,d-o,c-o,d,c-o,d-o],bottomLeft:[l+o,d,l,d-o,l+o,d-o]}},intersectLine:function(e,t,n,a,i,o,s,u){var l=this.generateCutTrianglePts(n+2*s,a+2*s,e,t,u),c=[].concat.apply([],[l.topLeft.splice(0,4),l.topRight.splice(0,4),l.bottomRight.splice(0,4),l.bottomLeft.splice(0,4)]);return Pa(i,o,c,e,t)},checkPoint:function(e,t,n,a,i,o,s,u){var l=u==="auto"?this.cornerLength:u;if(Ar(e,t,this.points,o,s,a,i-2*l,[0,-1],n)||Ar(e,t,this.points,o,s,a-2*l,i,[0,-1],n))return!0;var c=this.generateCutTrianglePts(a,i,o,s);return Ft(e,t,c.topLeft)||Ft(e,t,c.topRight)||Ft(e,t,c.bottomRight)||Ft(e,t,c.bottomLeft)}}};Rr.generateBarrel=function(){return this.nodeShapes.barrel={renderer:this,name:"barrel",points:Mt(4,0),draw:function(e,t,n,a,i,o){this.renderer.nodeShapeImpl(this.name,e,t,n,a,i)},intersectLine:function(e,t,n,a,i,o,s,u){var l=.15,c=.5,f=.85,d=this.generateBarrelBezierPts(n+2*s,a+2*s,e,t),h=function(g){var p=Vn({x:g[0],y:g[1]},{x:g[2],y:g[3]},{x:g[4],y:g[5]},l),m=Vn({x:g[0],y:g[1]},{x:g[2],y:g[3]},{x:g[4],y:g[5]},c),b=Vn({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]]},v=[].concat(h(d.topLeft),h(d.topRight),h(d.bottomRight),h(d.bottomLeft));return Pa(i,o,v,e,t)},generateBarrelBezierPts:function(e,t,n,a){var i=t/2,o=e/2,s=n-o,u=n+o,l=a-i,c=a+i,f=hu(e,t),d=f.heightOffset,h=f.widthOffset,v=f.ctrlPtOffsetPct*e,y={topLeft:[s,l+d,s+v,l,s+h,l],topRight:[u-h,l,u-v,l,u,l+d],bottomRight:[u,c-d,u-v,c,u-h,c],bottomLeft:[s+h,c,s+v,c,s,c-d]};return y.topLeft.isTop=!0,y.topRight.isTop=!0,y.bottomLeft.isBottom=!0,y.bottomRight.isBottom=!0,y},checkPoint:function(e,t,n,a,i,o,s,u){var l=hu(a,i),c=l.heightOffset,f=l.widthOffset;if(Ar(e,t,this.points,o,s,a,i-2*c,[0,-1],n)||Ar(e,t,this.points,o,s,a-2*f,i,[0,-1],n))return!0;for(var d=this.generateBarrelBezierPts(a,i,o,s),h=function(k,_,C){var T=C[4],D=C[2],A=C[0],R=C[5],M=C[1],L=Math.min(T,A),B=Math.max(T,A),I=Math.min(R,M),H=Math.max(R,M);if(L<=k&&k<=B&&I<=_&&_<=H){var q=cy(T,D,A),N=ry(q[0],q[1],q[2],k),G=N.filter(function(X){return 0<=X&&X<=1});if(G.length>0)return G[0]}return null},v=Object.keys(d),y=0;y<v.length;y++){var g=v[y],p=d[g],m=h(e,t,p);if(m!=null){var b=p[5],x=p[3],E=p[1],S=gt(b,x,E,m);if(p.isTop&&S<=t||p.isBottom&&t<=S)return!0}}return!1}}};Rr.generateBottomRoundrectangle=function(){return this.nodeShapes["bottom-round-rectangle"]=this.nodeShapes.bottomroundrectangle={renderer:this,name:"bottom-round-rectangle",points:Mt(4,0),draw:function(e,t,n,a,i,o){this.renderer.nodeShapeImpl(this.name,e,t,n,a,i,this.points,o)},intersectLine:function(e,t,n,a,i,o,s,u){var l=e-(n/2+s),c=t-(a/2+s),f=c,d=e+(n/2+s),h=Wr(i,o,e,t,l,c,d,f,!1);return h.length>0?h:Ud(i,o,e,t,n,a,s,u)},checkPoint:function(e,t,n,a,i,o,s,u){u=u==="auto"?Qr(a,i):u;var l=2*u;if(Ar(e,t,this.points,o,s,a,i-l,[0,-1],n)||Ar(e,t,this.points,o,s,a-l,i,[0,-1],n))return!0;var c=a/2+2*n,f=i/2+2*n,d=[o-c,s-f,o-c,s,o+c,s,o+c,s-f];return!!(Ft(e,t,d)||yn(e,t,l,l,o+a/2-u,s+i/2-u,n)||yn(e,t,l,l,o-a/2+u,s+i/2-u,n))}}};Rr.registerNodeShapes=function(){var r=this.nodeShapes={},e=this;this.generateEllipse(),this.generatePolygon("triangle",Mt(3,0)),this.generateRoundPolygon("round-triangle",Mt(3,0)),this.generatePolygon("rectangle",Mt(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",Mt(5,0)),this.generateRoundPolygon("round-pentagon",Mt(5,0)),this.generatePolygon("hexagon",Mt(6,0)),this.generateRoundPolygon("round-hexagon",Mt(6,0)),this.generatePolygon("heptagon",Mt(7,0)),this.generateRoundPolygon("round-heptagon",Mt(7,0)),this.generatePolygon("octagon",Mt(8,0)),this.generateRoundPolygon("round-octagon",Mt(8,0));var n=new Array(20);{var a=vu(5,0),i=vu(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++)n[s*4]=a[s*2],n[s*4+1]=a[s*2+1],n[s*4+2]=i[s*2],n[s*4+3]=i[s*2+1]}n=Wd(n),this.generatePolygon("star",n),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 u=[-1,-1,.25,-1,1,0,.25,1,-1,1];this.generatePolygon("tag",u),this.generateRoundPolygon("round-tag",u)}r.makePolygon=function(l){var c=l.join("$"),f="polygon-"+c,d;return(d=this[f])?d:e.generatePolygon(f,l)}};var $a={};$a.timeToRender=function(){return this.redrawTotalTime/this.redrawCount};$a.redraw=function(r){r=r||qd();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};$a.beforeRender=function(r,e){if(!this.destroyed){e==null&&Qe("Priority is not optional for beforeRender");var t=this.beforeRenderCallbacks;t.push({fn:r,priority:e}),t.sort(function(n,a){return a.priority-n.priority})}};var od=function(e,t,n){for(var a=e.beforeRenderCallbacks,i=0;i<a.length;i++)a[i].fn(t,n)};$a.startRenderLoop=function(){var r=this,e=r.cy;if(!r.renderLoopStarted){r.renderLoopStarted=!0;var t=function(a){if(!r.destroyed){if(!e.batching())if(r.requestedFrame&&!r.skipFrame){od(r,!0,a);var i=Dr();r.render(r.renderOptions);var o=r.lastDrawTime=Dr();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 od(r,!1,a);r.skipFrame=!1,Bi(t)}};Bi(t)}};var Pb=function(e){this.init(e)},Yv=Pb,Jn=Yv.prototype;Jn.clientFunctions=["redrawHint","render","renderTo","matchCanvasSize","nodeShapeImpl","arrowShapeImpl"];Jn.init=function(r){var e=this;e.options=r,e.cy=r.cy;var t=e.container=r.cy.container(),n=e.cy.window();if(n){var a=n.document,i=a.head,o="__________cytoscape_stylesheet",s="__________cytoscape_container",u=a.getElementById(o)!=null;if(t.className.indexOf(s)<0&&(t.className=(t.className||"")+" "+s),!u){var l=a.createElement("style");l.id=o,l.textContent="."+s+" { position: relative; }",i.insertBefore(l,i.children[0])}var c=n.getComputedStyle(t),f=c.getPropertyValue("position");f==="static"&&$e("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()};Jn.notify=function(r,e){var t=this,n=t.cy;if(!this.destroyed){if(r==="init"){t.load();return}if(r==="destroy"){t.destroy();return}(r==="add"||r==="remove"||r==="move"&&n.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()}};Jn.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],n=t,a=n.target;(a.off||a.removeEventListener).apply(a,n.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(i){}};Jn.isHeadless=function(){return!1};[Ju,Uv,Wv,Qn,Rr,$a].forEach(function(r){be(Jn,r)});var au=1e3/60,Kv={setupDequeueing:function(e){return function(){var n=this,a=this.renderer;if(!n.dequeueingSetup){n.dequeueingSetup=!0;var i=Fa(function(){a.redrawHint("eles",!0),a.redrawHint("drag",!0),a.redraw()},e.deqRedrawThreshold),o=function(l,c){var f=Dr(),d=a.averageRedrawTime,h=a.lastRedrawTime,v=[],y=a.cy.extent(),g=a.getPixelRatio();for(l||a.flushRenderedStyleQueue();;){var p=Dr(),m=p-f,b=p-c;if(h<au){var x=au-(l?d:0);if(b>=e.deqFastCost*x)break}else if(l){if(m>=e.deqCost*h||m>=e.deqAvgCost*d)break}else if(b>=e.deqNoDrawCost*au)break;var E=e.deq(n,g,y);if(E.length>0)for(var S=0;S<E.length;S++)v.push(E[S]);else break}v.length>0&&(e.onDeqd(n,v),!l&&e.shouldRedraw(n,v,g,y)&&i())},s=e.priority||Nu;a.beforeRender(o,s(n))}}}},Db=(function(){function r(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Li;tn(this,r),this.idsByKey=new Pr,this.keyForId=new Pr,this.cachesByLvl=new Pr,this.lvls=[],this.getKey=e,this.doesEleInvalidateKey=t}return rn(r,[{key:"getIdsFor",value:function(t){t==null&&Qe("Can not get id list for null key");var n=this.idsByKey,a=this.idsByKey.get(t);return a||(a=new Xn,n.set(t,a)),a}},{key:"addIdForKey",value:function(t,n){t!=null&&this.getIdsFor(t).add(n)}},{key:"deleteIdForKey",value:function(t,n){t!=null&&this.getIdsFor(t).delete(n)}},{key:"getNumberOfIdsForKey",value:function(t){return t==null?0:this.getIdsFor(t).size}},{key:"updateKeyMappingFor",value:function(t){var n=t.id(),a=this.keyForId.get(n),i=this.getKey(t);this.deleteIdForKey(a,n),this.addIdForKey(i,n),this.keyForId.set(n,i)}},{key:"deleteKeyMappingFor",value:function(t){var n=t.id(),a=this.keyForId.get(n);this.deleteIdForKey(a,n),this.keyForId.delete(n)}},{key:"keyHasChangedFor",value:function(t){var n=t.id(),a=this.keyForId.get(n),i=this.getKey(t);return a!==i}},{key:"isInvalid",value:function(t){return this.keyHasChangedFor(t)||this.doesEleInvalidateKey(t)}},{key:"getCachesAt",value:function(t){var n=this.cachesByLvl,a=this.lvls,i=n.get(t);return i||(i=new Pr,n.set(t,i),a.push(t)),i}},{key:"getCache",value:function(t,n){return this.getCachesAt(n).get(t)}},{key:"get",value:function(t,n){var a=this.getKey(t),i=this.getCache(a,n);return i!=null&&this.updateKeyMappingFor(t),i}},{key:"getForCachedKey",value:function(t,n){var a=this.keyForId.get(t.id()),i=this.getCache(a,n);return i}},{key:"hasCache",value:function(t,n){return this.getCachesAt(n).has(t)}},{key:"has",value:function(t,n){var a=this.getKey(t);return this.hasCache(a,n)}},{key:"setCache",value:function(t,n,a){a.key=t,this.getCachesAt(n).set(t,a)}},{key:"set",value:function(t,n,a){var i=this.getKey(t);this.setCache(i,n,a),this.updateKeyMappingFor(t)}},{key:"deleteCache",value:function(t,n){this.getCachesAt(n).delete(t)}},{key:"delete",value:function(t,n){var a=this.getKey(t);this.deleteCache(a,n)}},{key:"invalidateKey",value:function(t){var n=this;this.lvls.forEach(function(a){return n.deleteCache(t,a)})}},{key:"invalidate",value:function(t){var n=t.id(),a=this.keyForId.get(n);this.deleteKeyMappingFor(t);var i=this.doesEleInvalidateKey(t);return i&&this.invalidateKey(a),i||this.getNumberOfIdsForKey(a)===0}}])})(),sd=25,mi=50,Di=-4,_u=3,Zv=7.99,Ab=8,Mb=1024,Rb=1024,Bb=1024,Lb=.2,Ob=.8,Ib=10,Nb=.15,zb=.1,Fb=.9,Vb=.9,qb=100,Gb=1,Fn={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"},Hb=Et({getKey:null,doesEleInvalidateKey:Li,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:zd,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),xa=function(e,t){var n=this;n.renderer=e,n.onDequeues=[];var a=Hb(t);be(n,a),n.lookup=new Db(a.getKey,a.doesEleInvalidateKey),n.setupDequeueing()},vt=xa.prototype;vt.reasons=Fn;vt.getTextureQueue=function(r){var e=this;return e.eleImgCaches=e.eleImgCaches||{},e.eleImgCaches[r]=e.eleImgCaches[r]||[]};vt.getRetiredTextureQueue=function(r){var e=this,t=e.eleImgCaches.retired=e.eleImgCaches.retired||{},n=t[r]=t[r]||[];return n};vt.getElementQueue=function(){var r=this,e=r.eleCacheQueue=r.eleCacheQueue||new Va(function(t,n){return n.reqs-t.reqs});return e};vt.getElementKeyToQueue=function(){var r=this,e=r.eleKeyToCacheQueue=r.eleKeyToCacheQueue||{};return e};vt.getElement=function(r,e,t,n,a){var i=this,o=this.renderer,s=o.cy.zoom(),u=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(n==null&&(n=Math.ceil(Fu(s*t))),n<Di)n=Di;else if(s>=Zv||n>_u)return null;var l=Math.pow(2,n),c=e.h*l,f=e.w*l,d=o.eleTextBiggerThanMin(r,l);if(!this.isVisible(r,d))return null;var h=u.get(r,n);if(h&&h.invalidated&&(h.invalidated=!1,h.texture.invalidatedWidth-=h.width),h)return h;var v;if(c<=sd?v=sd:c<=mi?v=mi:v=Math.ceil(c/mi)*mi,c>Bb||f>Rb)return null;var y=i.getTextureQueue(v),g=y[y.length-2],p=function(){return i.recycleTexture(v,f)||i.addTexture(v,f)};g||(g=y[y.length-1]),g||(g=p()),g.width-g.usedWidth<f&&(g=p());for(var m=function(L){return L&&L.scaledLabelShown===d},b=a&&a===Fn.dequeue,x=a&&a===Fn.highQuality,E=a&&a===Fn.downscale,S,w=n+1;w<=_u;w++){var k=u.get(r,w);if(k){S=k;break}}var _=S&&S.level===n+1?S:null,C=function(){g.context.drawImage(_.texture.canvas,_.x,0,_.width,_.height,g.usedWidth,0,f,c)};if(g.context.setTransform(1,0,0,1,0,0),g.context.clearRect(g.usedWidth,0,f,v),m(_))C();else if(m(S))if(x){for(var T=S.level;T>n;T--)_=i.getElement(r,e,t,T,Fn.downscale);C()}else return i.queueElement(r,S.level-1),S;else{var D;if(!b&&!x&&!E)for(var A=n-1;A>=Di;A--){var R=u.get(r,A);if(R){D=R;break}}if(m(D))return i.queueElement(r,n),D;g.context.translate(g.usedWidth,0),g.context.scale(l,l),this.drawElement(g.context,r,e,d,!1),g.context.scale(1/l,1/l),g.context.translate(-g.usedWidth,0)}return h={x:g.usedWidth,texture:g,level:n,scale:l,width:f,height:c,scaledLabelShown:d},g.usedWidth+=Math.ceil(f+Ab),g.eleCaches.push(h),u.set(r,n,h),i.checkTextureFullness(g),h};vt.invalidateElements=function(r){for(var e=0;e<r.length;e++)this.invalidateElement(r[e])};vt.invalidateElement=function(r){var e=this,t=e.lookup,n=[],a=t.isInvalid(r);if(a){for(var i=Di;i<=_u;i++){var o=t.getForCachedKey(r,i);o&&n.push(o)}var s=t.invalidate(r);if(s)for(var u=0;u<n.length;u++){var l=n[u],c=l.texture;c.invalidatedWidth+=l.width,l.invalidated=!0,e.checkTextureUtility(c)}e.removeFromQueue(r)}};vt.checkTextureUtility=function(r){r.invalidatedWidth>=Lb*r.width&&this.retireTexture(r)};vt.checkTextureFullness=function(r){var e=this,t=e.getTextureQueue(r.height);r.usedWidth/r.width>Ob&&r.fullnessChecks>=Ib?Zr(t,r):r.fullnessChecks++};vt.retireTexture=function(r){var e=this,t=r.height,n=e.getTextureQueue(t),a=this.lookup;Zr(n,r),r.retired=!0;for(var i=r.eleCaches,o=0;o<i.length;o++){var s=i[o];a.deleteCache(s.key,s.level)}zu(i);var u=e.getRetiredTextureQueue(t);u.push(r)};vt.addTexture=function(r,e){var t=this,n=t.getTextureQueue(r),a={};return n.push(a),a.eleCaches=[],a.height=r,a.width=Math.max(Mb,e),a.usedWidth=0,a.invalidatedWidth=0,a.fullnessChecks=0,a.canvas=t.renderer.makeOffscreenCanvas(a.width,a.height),a.context=a.canvas.getContext("2d"),a};vt.recycleTexture=function(r,e){for(var t=this,n=t.getTextureQueue(r),a=t.getRetiredTextureQueue(r),i=0;i<a.length;i++){var o=a[i];if(o.width>=e)return o.retired=!1,o.usedWidth=0,o.invalidatedWidth=0,o.fullnessChecks=0,zu(o.eleCaches),o.context.setTransform(1,0,0,1,0,0),o.context.clearRect(0,0,o.width,o.height),Zr(a,o),n.push(o),o}};vt.queueElement=function(r,e){var t=this,n=t.getElementQueue(),a=t.getElementKeyToQueue(),i=this.getKey(r),o=a[i];if(o)o.level=Math.max(o.level,e),o.eles.merge(r),o.reqs++,n.updateItem(o);else{var s={eles:r.spawn().merge(r),level:e,reqs:1,key:i};n.push(s),a[i]=s}};vt.dequeue=function(r){for(var e=this,t=e.getElementQueue(),n=e.getElementKeyToQueue(),a=[],i=e.lookup,o=0;o<Gb&&t.size()>0;o++){var s=t.pop(),u=s.key,l=s.eles[0],c=i.hasCache(l,s.level);if(n[u]=null,c)continue;a.push(s);var f=e.getBoundingBox(l);e.getElement(l,f,r,s.level,Fn.dequeue)}return a};vt.removeFromQueue=function(r){var e=this,t=e.getElementQueue(),n=e.getElementKeyToQueue(),a=this.getKey(r),i=n[a];i!=null&&(i.eles.length===1?(i.reqs=Iu,t.updateItem(i),t.pop(),n[a]=null):i.eles.unmerge(r))};vt.onDequeue=function(r){this.onDequeues.push(r)};vt.offDequeue=function(r){Zr(this.onDequeues,r)};vt.setupDequeueing=Kv.setupDequeueing({deqRedrawThreshold:qb,deqCost:Nb,deqAvgCost:zb,deqNoDrawCost:Fb,deqFastCost:Vb,deq:function(e,t,n){return e.dequeue(t,n)},onDeqd:function(e,t){for(var n=0;n<e.onDequeues.length;n++){var a=e.onDequeues[n];a(t)}},shouldRedraw:function(e,t,n,a){for(var i=0;i<t.length;i++)for(var o=t[i].eles,s=0;s<o.length;s++){var u=o[s].boundingBox();if(qu(u,a))return!0}return!1},priority:function(e){return e.renderer.beforeRenderPriorities.eleTxrDeq}});var $b=1,Ea=-4,Gi=2,Ub=3.99,Wb=50,Xb=50,Yb=.15,Kb=.1,Zb=.9,Qb=.9,Jb=1,ud=250,jb=4e3*4e3,ld=32767,e1=!0,Qv=function(e){var t=this,n=t.renderer=e,a=n.cy;t.layersByLevel={},t.firstGet=!0,t.lastInvalidationTime=Dr()-2*ud,t.skipping=!1,t.eleTxrDeqs=a.collection(),t.scheduleElementRefinement=Fa(function(){t.refineElementTextures(t.eleTxrDeqs),t.eleTxrDeqs.unmerge(t.eleTxrDeqs)},Xb),n.beforeRender(function(o,s){s-t.lastInvalidationTime<=ud?t.skipping=!0:t.skipping=!1},n.beforeRenderPriorities.lyrTxrSkip);var i=function(s,u){return u.reqs-s.reqs};t.layersQueue=new Va(i),t.setupDequeueing()},Ct=Qv.prototype,cd=0,t1=Math.pow(2,53)-1;Ct.makeLayer=function(r,e){var t=Math.pow(2,e),n=Math.ceil(r.w*t),a=Math.ceil(r.h*t),i=this.renderer.makeOffscreenCanvas(n,a),o={id:cd=++cd%t1,bb:r,level:e,width:n,height:a,canvas:i,context:i.getContext("2d"),eles:[],elesQueue:[],reqs:0},s=o.context,u=-o.bb.x1,l=-o.bb.y1;return s.scale(t,t),s.translate(u,l),o};Ct.getLayers=function(r,e,t){var n=this,a=n.renderer,i=a.cy,o=i.zoom(),s=n.firstGet;if(n.firstGet=!1,t==null){if(t=Math.ceil(Fu(o*e)),t<Ea)t=Ea;else if(o>=Ub||t>Gi)return null}n.validateLayersElesOrdering(t,r);var u=n.layersByLevel,l=Math.pow(2,t),c=u[t]=u[t]||[],f,d=n.levelIsComplete(t,r),h,v=function(){var C=function(M){if(n.validateLayersElesOrdering(M,r),n.levelIsComplete(M,r))return h=u[M],!0},T=function(M){if(!h)for(var L=t+M;Ea<=L&&L<=Gi&&!C(L);L+=M);};T(1),T(-1);for(var D=c.length-1;D>=0;D--){var A=c[D];A.invalid&&Zr(c,A)}};if(!d)v();else return c;var y=function(){if(!f){f=Rt();for(var C=0;C<r.length;C++)Zg(f,r[C].boundingBox())}return f},g=function(C){C=C||{};var T=C.after;y();var D=Math.ceil(f.w*l),A=Math.ceil(f.h*l);if(D>ld||A>ld)return null;var R=D*A;if(R>jb)return null;var M=n.makeLayer(f,t);if(T!=null){var L=c.indexOf(T)+1;c.splice(L,0,M)}else(C.insert===void 0||C.insert)&&c.unshift(M);return M};if(n.skipping&&!s)return null;for(var p=null,m=r.length/$b,b=!s,x=0;x<r.length;x++){var E=r[x],S=E._private.rscratch,w=S.imgLayerCaches=S.imgLayerCaches||{},k=w[t];if(k){p=k;continue}if((!p||p.eles.length>=m||!$d(p.bb,E.boundingBox()))&&(p=g({insert:!0,after:p}),!p))return null;h||b?n.queueLayer(p,E):n.drawEleInLayer(p,E,t,e),p.eles.push(E),w[t]=p}return h||(b?null:c)};Ct.getEleLevelForLayerLevel=function(r,e){return r};Ct.drawEleInLayer=function(r,e,t,n){var a=this,i=this.renderer,o=r.context,s=e.boundingBox();s.w===0||s.h===0||!e.visible()||(t=a.getEleLevelForLayerLevel(t,n),i.setImgSmoothing(o,!1),i.drawCachedElement(o,e,null,null,t,e1),i.setImgSmoothing(o,!0))};Ct.levelIsComplete=function(r,e){var t=this,n=t.layersByLevel[r];if(!n||n.length===0)return!1;for(var a=0,i=0;i<n.length;i++){var o=n[i];if(o.reqs>0||o.invalid)return!1;a+=o.eles.length}return a===e.length};Ct.validateLayersElesOrdering=function(r,e){var t=this.layersByLevel[r];if(t)for(var n=0;n<t.length;n++){for(var a=t[n],i=-1,o=0;o<e.length;o++)if(a.eles[0]===e[o]){i=o;break}if(i<0){this.invalidateLayer(a);continue}for(var s=i,o=0;o<a.eles.length;o++)if(a.eles[o]!==e[s+o]){this.invalidateLayer(a);break}}};Ct.updateElementsInLayers=function(r,e){for(var t=this,n=Oa(r[0]),a=0;a<r.length;a++)for(var i=n?null:r[a],o=n?r[a]:r[a].ele,s=o._private.rscratch,u=s.imgLayerCaches=s.imgLayerCaches||{},l=Ea;l<=Gi;l++){var c=u[l];c&&(i&&t.getEleLevelForLayerLevel(c.level)!==i.level||e(c,o,i))}};Ct.haveLayers=function(){for(var r=this,e=!1,t=Ea;t<=Gi;t++){var n=r.layersByLevel[t];if(n&&n.length>0){e=!0;break}}return e};Ct.invalidateElements=function(r){var e=this;r.length!==0&&(e.lastInvalidationTime=Dr(),!(r.length===0||!e.haveLayers())&&e.updateElementsInLayers(r,function(n,a,i){e.invalidateLayer(n)}))};Ct.invalidateLayer=function(r){if(this.lastInvalidationTime=Dr(),!r.invalid){var e=r.level,t=r.eles,n=this.layersByLevel[e];Zr(n,r),r.elesQueue=[],r.invalid=!0,r.replacement&&(r.replacement.invalid=!0);for(var a=0;a<t.length;a++){var i=t[a]._private.rscratch.imgLayerCaches;i&&(i[e]=null)}}};Ct.refineElementTextures=function(r){var e=this;e.updateElementsInLayers(r,function(n,a,i){var o=n.replacement;if(o||(o=n.replacement=e.makeLayer(n.bb,n.level),o.replaces=n,o.eles=n.eles),!o.reqs)for(var s=0;s<o.eles.length;s++)e.queueLayer(o,o.eles[s])})};Ct.enqueueElementRefinement=function(r){this.eleTxrDeqs.merge(r),this.scheduleElementRefinement()};Ct.queueLayer=function(r,e){var t=this,n=t.layersQueue,a=r.elesQueue,i=a.hasId=a.hasId||{};if(!r.replacement){if(e){if(i[e.id()])return;a.push(e),i[e.id()]=!0}r.reqs?(r.reqs++,n.updateItem(r)):(r.reqs=1,n.push(r))}};Ct.dequeue=function(r){for(var e=this,t=e.layersQueue,n=[],a=0;a<Jb&&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),a++),n.length===0&&n.push(!0),i.elesQueue.length===0&&(t.pop(),i.reqs=0,i.replaces&&e.applyLayerReplacement(i),e.requestRedraw())}return n};Ct.applyLayerReplacement=function(r){var e=this,t=e.layersByLevel[r.level],n=r.replaces,a=t.indexOf(n);if(!(a<0||n.invalid)){t[a]=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()}};Ct.requestRedraw=Fa(function(){var r=this.renderer;r.redrawHint("eles",!0),r.redrawHint("drag",!0),r.redraw()},100);Ct.setupDequeueing=Kv.setupDequeueing({deqRedrawThreshold:Wb,deqCost:Yb,deqAvgCost:Kb,deqNoDrawCost:Zb,deqFastCost:Qb,deq:function(e,t){return e.dequeue(t)},onDeqd:Nu,shouldRedraw:zd,priority:function(e){return e.renderer.beforeRenderPriorities.lyrTxrDeq}});var Jv={},fd;function r1(r,e){for(var t=0;t<e.length;t++){var n=e[t];r.lineTo(n.x,n.y)}}function n1(r,e,t){for(var n,a=0;a<e.length;a++){var i=e[a];a===0&&(n=i),r.lineTo(i.x,i.y)}r.quadraticCurveTo(t.x,t.y,n.x,n.y)}function dd(r,e,t){r.beginPath&&r.beginPath();for(var n=e,a=0;a<n.length;a++){var i=n[a];r.lineTo(i.x,i.y)}var o=t,s=t[0];r.moveTo(s.x,s.y);for(var a=1;a<o.length;a++){var i=o[a];r.lineTo(i.x,i.y)}r.closePath&&r.closePath()}function a1(r,e,t,n,a){r.beginPath&&r.beginPath(),r.arc(t,n,a,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 u=i[s];r.lineTo(u.x,u.y)}r.closePath&&r.closePath()}function i1(r,e,t,n){r.arc(e,t,n,0,Math.PI*2,!1)}Jv.arrowShapeImpl=function(r){return(fd||(fd={polygon:r1,"triangle-backcurve":n1,"triangle-tee":dd,"circle-triangle":a1,"triangle-cross":dd,circle:i1}))[r]};var xr={};xr.drawElement=function(r,e,t,n,a,i){var o=this;e.isNode()?o.drawNode(r,e,t,n,a,i):o.drawEdge(r,e,t,n,a,i)};xr.drawElementOverlay=function(r,e){var t=this;e.isNode()?t.drawNodeOverlay(r,e):t.drawEdgeOverlay(r,e)};xr.drawElementUnderlay=function(r,e){var t=this;e.isNode()?t.drawNodeUnderlay(r,e):t.drawEdgeUnderlay(r,e)};xr.drawCachedElementPortion=function(r,e,t,n,a,i,o,s){var u=this,l=t.getBoundingBox(e);if(!(l.w===0||l.h===0)){var c=t.getElement(e,l,n,a,i);if(c!=null){var f=s(u,e);if(f===0)return;var d=o(u,e),h=l.x1,v=l.y1,y=l.w,g=l.h,p,m,b,x,E;if(d!==0){var S=t.getRotationPoint(e);b=S.x,x=S.y,r.translate(b,x),r.rotate(d),E=u.getImgSmoothing(r),E||u.setImgSmoothing(r,!0);var w=t.getRotationOffset(e);p=w.x,m=w.y}else p=h,m=v;var k;f!==1&&(k=r.globalAlpha,r.globalAlpha=k*f),r.drawImage(c.texture.canvas,c.x,0,c.width,c.height,p,m,y,g),f!==1&&(r.globalAlpha=k),d!==0&&(r.rotate(-d),r.translate(-b,-x),E||u.setImgSmoothing(r,!1))}else t.drawElement(r,e)}};var o1=function(){return 0},s1=function(e,t){return e.getTextAngle(t,null)},u1=function(e,t){return e.getTextAngle(t,"source")},l1=function(e,t){return e.getTextAngle(t,"target")},c1=function(e,t){return t.effectiveOpacity()},iu=function(e,t){return t.pstyle("text-opacity").pfValue*t.effectiveOpacity()};xr.drawCachedElement=function(r,e,t,n,a,i){var o=this,s=o.data,u=s.eleTxrCache,l=s.lblTxrCache,c=s.slbTxrCache,f=s.tlbTxrCache,d=e.boundingBox(),h=i===!0?u.reasons.highQuality:null;if(!(d.w===0||d.h===0||!e.visible())&&(!n||qu(d,n))){var v=e.isEdge(),y=e.element()._private.rscratch.badLine;o.drawElementUnderlay(r,e),o.drawCachedElementPortion(r,e,u,t,a,h,o1,c1),(!v||!y)&&o.drawCachedElementPortion(r,e,l,t,a,h,s1,iu),v&&!y&&(o.drawCachedElementPortion(r,e,c,t,a,h,u1,iu),o.drawCachedElementPortion(r,e,f,t,a,h,l1,iu)),o.drawElementOverlay(r,e)}};xr.drawElements=function(r,e){for(var t=this,n=0;n<e.length;n++){var a=e[n];t.drawElement(r,a)}};xr.drawCachedElements=function(r,e,t,n){for(var a=this,i=0;i<e.length;i++){var o=e[i];a.drawCachedElement(r,o,t,n)}};xr.drawCachedNodes=function(r,e,t,n){for(var a=this,i=0;i<e.length;i++){var o=e[i];o.isNode()&&a.drawCachedElement(r,o,t,n)}};xr.drawLayeredElements=function(r,e,t,n){var a=this,i=a.data.lyrTxrCache.getLayers(e,t);if(i)for(var o=0;o<i.length;o++){var s=i[o],u=s.bb;u.w===0||u.h===0||r.drawImage(s.canvas,u.x1,u.y1,u.w,u.h)}else a.drawCachedElements(r,e,t,n)};var Br={};Br.drawEdge=function(r,e,t){var n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,a=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 u;t&&(u=t,r.translate(-u.x1,-u.y1));var l=i?e.pstyle("opacity").value:1,c=i?e.pstyle("line-opacity").value:1,f=e.pstyle("curve-style").value,d=e.pstyle("line-style").value,h=e.pstyle("width").pfValue,v=e.pstyle("line-cap").value,y=e.pstyle("line-outline-width").value,g=e.pstyle("line-outline-color").value,p=l*c,m=l*c,b=function(){var M=arguments.length>0&&arguments[0]!==void 0?arguments[0]:p;f==="straight-triangle"?(o.eleStrokeStyle(r,e,M),o.drawEdgeTrianglePath(e,r,s.allpts)):(r.lineWidth=h,r.lineCap=v,o.eleStrokeStyle(r,e,M),o.drawEdgePath(e,r,s.allpts,d),r.lineCap="butt")},x=function(){var M=arguments.length>0&&arguments[0]!==void 0?arguments[0]:p;if(r.lineWidth=h+y,r.lineCap=v,y>0)o.colorStrokeStyle(r,g[0],g[1],g[2],M);else{r.lineCap="butt";return}f==="straight-triangle"?o.drawEdgeTrianglePath(e,r,s.allpts):(o.drawEdgePath(e,r,s.allpts,d),r.lineCap="butt")},E=function(){a&&o.drawEdgeOverlay(r,e)},S=function(){a&&o.drawEdgeUnderlay(r,e)},w=function(){var M=arguments.length>0&&arguments[0]!==void 0?arguments[0]:m;o.drawArrowheads(r,e,M)},k=function(){o.drawElementText(r,e,null,n)};r.lineJoin="round";var _=e.pstyle("ghost").value==="yes";if(_){var C=e.pstyle("ghost-offset-x").pfValue,T=e.pstyle("ghost-offset-y").pfValue,D=e.pstyle("ghost-opacity").value,A=p*D;r.translate(C,T),b(A),w(A),r.translate(-C,-T)}else x();S(),b(),w(),E(),k(),t&&r.translate(u.x1,u.y1)}};var jv=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(t,n){if(n.visible()){var a=n.pstyle("".concat(e,"-opacity")).value;if(a!==0){var i=this,o=i.usePaths(),s=n._private.rscratch,u=n.pstyle("".concat(e,"-padding")).pfValue,l=2*u,c=n.pstyle("".concat(e,"-color")).value;t.lineWidth=l,s.edgeType==="self"&&!o?t.lineCap="butt":t.lineCap="round",i.colorStrokeStyle(t,c[0],c[1],c[2],a),i.drawEdgePath(n,t,s.allpts,"solid")}}}};Br.drawEdgeOverlay=jv("overlay");Br.drawEdgeUnderlay=jv("underlay");Br.drawEdgePath=function(r,e,t,n){var a=r._private.rscratch,i=e,o,s=!1,u=this.usePaths(),l=r.pstyle("line-dash-pattern").pfValue,c=r.pstyle("line-dash-offset").pfValue;if(u){var f=t.join("$"),d=a.pathCacheKey&&a.pathCacheKey===f;d?(o=e=a.pathCache,s=!0):(o=e=new Path2D,a.pathCacheKey=f,a.pathCache=o)}if(i.setLineDash)switch(n){case"dotted":i.setLineDash([1,1]);break;case"dashed":i.setLineDash(l),i.lineDashOffset=c;break;case"solid":i.setLineDash([]);break}if(!s&&!a.badLine)switch(e.beginPath&&e.beginPath(),e.moveTo(t[0],t[1]),a.edgeType){case"bezier":case"self":case"compound":case"multibezier":for(var h=2;h+3<t.length;h+=4)e.quadraticCurveTo(t[h],t[h+1],t[h+2],t[h+3]);break;case"straight":case"haystack":for(var v=2;v+1<t.length;v+=2)e.lineTo(t[v],t[v+1]);break;case"segments":if(a.isRound){var y=Vt(a.roundCorners),g;try{for(y.s();!(g=y.n()).done;){var p=g.value;Vv(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,u?e.stroke(o):e.stroke(),e.setLineDash&&e.setLineDash([])};Br.drawEdgeTrianglePath=function(r,e,t){e.fillStyle=e.strokeStyle;for(var n=r.pstyle("width").pfValue,a=0;a+1<t.length;a+=2){var i=[t[a+2]-t[a],t[a+3]-t[a+1]],o=Math.sqrt(i[0]*i[0]+i[1]*i[1]),s=[i[1]/o,-i[0]/o],u=[s[0]*n/2,s[1]*n/2];e.beginPath(),e.moveTo(t[a]-u[0],t[a+1]-u[1]),e.lineTo(t[a]+u[0],t[a+1]+u[1]),e.lineTo(t[a+2],t[a+3]),e.closePath(),e.fill()}};Br.drawArrowheads=function(r,e,t){var n=e._private.rscratch,a=n.edgeType==="haystack";a||this.drawArrowhead(r,e,"source",n.arrowStartX,n.arrowStartY,n.srcArrowAngle,t),this.drawArrowhead(r,e,"mid-target",n.midX,n.midY,n.midtgtArrowAngle,t),this.drawArrowhead(r,e,"mid-source",n.midX,n.midY,n.midsrcArrowAngle,t),a||this.drawArrowhead(r,e,"target",n.arrowEndX,n.arrowEndY,n.tgtArrowAngle,t)};Br.drawArrowhead=function(r,e,t,n,a,i,o){if(!(isNaN(n)||n==null||isNaN(a)||a==null||isNaN(i)||i==null)){var s=this,u=e.pstyle(t+"-arrow-shape").value;if(u!=="none"){var l=e.pstyle(t+"-arrow-fill").value==="hollow"?"both":"filled",c=e.pstyle(t+"-arrow-fill").value,f=e.pstyle("width").pfValue,d=e.pstyle(t+"-arrow-width"),h=d.value==="match-line"?f:d.pfValue;d.units==="%"&&(h*=f);var v=e.pstyle("opacity").value;o===void 0&&(o=v);var y=r.globalCompositeOperation;(o!==1||c==="hollow")&&(r.globalCompositeOperation="destination-out",s.colorFillStyle(r,255,255,255,1),s.colorStrokeStyle(r,255,255,255,1),s.drawArrowShape(e,r,l,f,u,h,n,a,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,c,f,u,h,n,a,i)}}};Br.drawArrowShape=function(r,e,t,n,a,i,o,s,u){var l=this,c=this.usePaths()&&a!=="triangle-cross",f=!1,d,h=e,v={x:o,y:s},y=r.pstyle("arrow-scale").value,g=this.getArrowWidth(n,y),p=l.arrowShapes[a];if(c){var m=l.arrowPathCache=l.arrowPathCache||[],b=mn(a),x=m[b];x!=null?(d=e=x,f=!0):(d=e=new Path2D,m[b]=d)}f||(e.beginPath&&e.beginPath(),c?p.draw(e,1,0,{x:0,y:0},1):p.draw(e,g,u,v,n),e.closePath&&e.closePath()),e=h,c&&(e.translate(o,s),e.rotate(u),e.scale(g,g)),(t==="filled"||t==="both")&&(c?e.fill(d):e.fill()),(t==="hollow"||t==="both")&&(e.lineWidth=i/(c?g:1),e.lineJoin="miter",c?e.stroke(d):e.stroke()),c&&(e.scale(1/g,1/g),e.rotate(-u),e.translate(-o,-s))};var tl={};tl.safeDrawImage=function(r,e,t,n,a,i,o,s,u,l){if(!(a<=0||i<=0||u<=0||l<=0))try{r.drawImage(e,t,n,a,i,o,s,u,l)}catch(c){$e(c)}};tl.drawInscribedImage=function(r,e,t,n,a){var i=this,o=t.position(),s=o.x,u=o.y,l=t.cy().style(),c=l.getIndexedStyle.bind(l),f=c(t,"background-fit","value",n),d=c(t,"background-repeat","value",n),h=t.width(),v=t.height(),y=t.padding()*2,g=h+(c(t,"background-width-relative-to","value",n)==="inner"?0:y),p=v+(c(t,"background-height-relative-to","value",n)==="inner"?0:y),m=t._private.rscratch,b=c(t,"background-clip","value",n),x=b==="node",E=c(t,"background-image-opacity","value",n)*a,S=c(t,"background-image-smoothing","value",n),w=t.pstyle("corner-radius").value;w!=="auto"&&(w=t.pstyle("corner-radius").pfValue);var k=e.width||e.cachedW,_=e.height||e.cachedH;(k==null||_==null)&&(document.body.appendChild(e),k=e.cachedW=e.width||e.offsetWidth,_=e.cachedH=e.height||e.offsetHeight,document.body.removeChild(e));var C=k,T=_;if(c(t,"background-width","value",n)!=="auto"&&(c(t,"background-width","units",n)==="%"?C=c(t,"background-width","pfValue",n)*g:C=c(t,"background-width","pfValue",n)),c(t,"background-height","value",n)!=="auto"&&(c(t,"background-height","units",n)==="%"?T=c(t,"background-height","pfValue",n)*p:T=c(t,"background-height","pfValue",n)),!(C===0||T===0)){if(f==="contain"){var D=Math.min(g/C,p/T);C*=D,T*=D}else if(f==="cover"){var D=Math.max(g/C,p/T);C*=D,T*=D}var A=s-g/2,R=c(t,"background-position-x","units",n),M=c(t,"background-position-x","pfValue",n);R==="%"?A+=(g-C)*M:A+=M;var L=c(t,"background-offset-x","units",n),B=c(t,"background-offset-x","pfValue",n);L==="%"?A+=(g-C)*B:A+=B;var I=u-p/2,H=c(t,"background-position-y","units",n),q=c(t,"background-position-y","pfValue",n);H==="%"?I+=(p-T)*q:I+=q;var N=c(t,"background-offset-y","units",n),G=c(t,"background-offset-y","pfValue",n);N==="%"?I+=(p-T)*G:I+=G,m.pathCache&&(A-=s,I-=u,s=0,u=0);var X=r.globalAlpha;r.globalAlpha=E;var j=i.getImgSmoothing(r),Q=!1;if(S==="no"&&j?(i.setImgSmoothing(r,!1),Q=!0):S==="yes"&&!j&&(i.setImgSmoothing(r,!0),Q=!0),d==="no-repeat")x&&(r.save(),m.pathCache?r.clip(m.pathCache):(i.nodeShapes[i.getNodeShape(t)].draw(r,s,u,g,p,w,m),r.clip())),i.safeDrawImage(r,e,0,0,k,_,A,I,C,T),x&&r.restore();else{var Z=r.createPattern(e,d);r.fillStyle=Z,i.nodeShapes[i.getNodeShape(t)].draw(r,s,u,g,p,w,m),r.translate(A,I),r.fill(),r.translate(-A,-I)}r.globalAlpha=X,Q&&i.setImgSmoothing(r,j)}};var Sn={};Sn.eleTextBiggerThanMin=function(r,e){if(!e){var t=r.cy().zoom(),n=this.getPixelRatio(),a=Math.ceil(Fu(t*n));e=Math.pow(2,a)}var i=r.pstyle("font-size").pfValue*e,o=r.pstyle("min-zoomed-font-size").pfValue;return!(i<o)};Sn.drawElementText=function(r,e,t,n,a){var i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,o=this;if(n==null){if(i&&!o.eleTextBiggerThanMin(e))return}else if(n===!1)return;if(e.isNode()){var s=e.pstyle("label");if(!s||!s.value)return;var u=o.getLabelJustification(e);r.textAlign=u,r.textBaseline="bottom"}else{var l=e.element()._private.rscratch.badLine,c=e.pstyle("label"),f=e.pstyle("source-label"),d=e.pstyle("target-label");if(l||(!c||!c.value)&&(!f||!f.value)&&(!d||!d.value))return;r.textAlign="center",r.textBaseline="bottom"}var h=!t,v;t&&(v=t,r.translate(-v.x1,-v.y1)),a==null?(o.drawText(r,e,null,h,i),e.isEdge()&&(o.drawText(r,e,"source",h,i),o.drawText(r,e,"target",h,i))):o.drawText(r,e,a,h,i),t&&r.translate(v.x1,v.y1)};Sn.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};Sn.setupTextStyle=function(r,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,n=e.pstyle("font-style").strValue,a=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,u=e.pstyle("text-outline-opacity").value*s,l=e.pstyle("color").value,c=e.pstyle("text-outline-color").value;r.font=n+" "+o+" "+a+" "+i,r.lineJoin="round",this.colorFillStyle(r,l[0],l[1],l[2],s),this.colorStrokeStyle(r,c[0],c[1],c[2],u)};function f1(r,e,t,n,a){var i=Math.min(n,a),o=i/2,s=e+n/2,u=t+a/2;r.beginPath(),r.arc(s,u,o,0,Math.PI*2),r.closePath()}function vd(r,e,t,n,a){var i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:5,o=Math.min(i,n/2,a/2);r.beginPath(),r.moveTo(e+o,t),r.lineTo(e+n-o,t),r.quadraticCurveTo(e+n,t,e+n,t+o),r.lineTo(e+n,t+a-o),r.quadraticCurveTo(e+n,t+a,e+n-o,t+a),r.lineTo(e+o,t+a),r.quadraticCurveTo(e,t+a,e,t+a-o),r.lineTo(e,t+o),r.quadraticCurveTo(e,t,e+o,t),r.closePath()}Sn.getTextAngle=function(r,e){var t,n=r._private,a=n.rscratch,i=e?e+"-":"",o=r.pstyle(i+"text-rotation");if(o.strValue==="autorotate"){var s=zt(a,"labelAngle",e);t=r.isEdge()?s:0}else o.strValue==="none"?t=0:t=o.pfValue;return t};Sn.drawText=function(r,e,t){var n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=e._private,o=i.rscratch,s=a?e.effectiveOpacity():1;if(!(a&&(s===0||e.pstyle("text-opacity").value===0))){t==="main"&&(t=null);var u=zt(o,"labelX",t),l=zt(o,"labelY",t),c,f,d=this.getLabelText(e,t);if(d!=null&&d!==""&&!isNaN(u)&&!isNaN(l)){this.setupTextStyle(r,e,a);var h=t?t+"-":"",v=zt(o,"labelWidth",t),y=zt(o,"labelHeight",t),g=e.pstyle(h+"text-margin-x").pfValue,p=e.pstyle(h+"text-margin-y").pfValue,m=e.isEdge(),b=e.pstyle("text-halign").value,x=e.pstyle("text-valign").value;m&&(b="center",x="center"),u+=g,l+=p;var E;switch(n?E=this.getTextAngle(e,t):E=0,E!==0&&(c=u,f=l,r.translate(c,f),r.rotate(E),u=0,l=0),x){case"top":break;case"center":l+=y/2;break;case"bottom":l+=y;break}var S=e.pstyle("text-background-opacity").value,w=e.pstyle("text-border-opacity").value,k=e.pstyle("text-border-width").pfValue,_=e.pstyle("text-background-padding").pfValue,C=e.pstyle("text-background-shape").strValue,T=C==="round-rectangle"||C==="roundrectangle",D=C==="circle",A=2;if(S>0||k>0&&w>0){var R=r.fillStyle,M=r.strokeStyle,L=r.lineWidth,B=e.pstyle("text-background-color").value,I=e.pstyle("text-border-color").value,H=e.pstyle("text-border-style").value,q=S>0,N=k>0&&w>0,G=u-_;switch(b){case"left":G-=v;break;case"center":G-=v/2;break}var X=l-y-_,j=v+2*_,Q=y+2*_;if(q&&(r.fillStyle="rgba(".concat(B[0],",").concat(B[1],",").concat(B[2],",").concat(S*s,")")),N&&(r.strokeStyle="rgba(".concat(I[0],",").concat(I[1],",").concat(I[2],",").concat(w*s,")"),r.lineWidth=k,r.setLineDash))switch(H){case"dotted":r.setLineDash([1,1]);break;case"dashed":r.setLineDash([4,2]);break;case"double":r.lineWidth=k/4,r.setLineDash([]);break;default:r.setLineDash([]);break}if(T?(r.beginPath(),vd(r,G,X,j,Q,A)):D?(r.beginPath(),f1(r,G,X,j,Q)):(r.beginPath(),r.rect(G,X,j,Q)),q&&r.fill(),N&&r.stroke(),N&&H==="double"){var Z=k/2;r.beginPath(),T?vd(r,G+Z,X+Z,j-2*Z,Q-2*Z,A):r.rect(G+Z,X+Z,j-2*Z,Q-2*Z),r.stroke()}r.fillStyle=R,r.strokeStyle=M,r.lineWidth=L,r.setLineDash&&r.setLineDash([])}var te=2*e.pstyle("text-outline-width").pfValue;if(te>0&&(r.lineWidth=te),e.pstyle("text-wrap").value==="wrap"){var ne=zt(o,"labelWrapCachedLines",t),$=zt(o,"labelLineHeight",t),O=v/2,z=this.getLabelJustification(e);switch(z==="auto"||(b==="left"?z==="left"?u+=-v:z==="center"&&(u+=-O):b==="center"?z==="left"?u+=-O:z==="right"&&(u+=O):b==="right"&&(z==="center"?u+=O:z==="right"&&(u+=v))),x){case"top":l-=(ne.length-1)*$;break;case"center":case"bottom":l-=(ne.length-1)*$;break}for(var V=0;V<ne.length;V++)te>0&&r.strokeText(ne[V],u,l),r.fillText(ne[V],u,l),l+=$}else te>0&&r.strokeText(d,u,l),r.fillText(d,u,l);E!==0&&(r.rotate(-E),r.translate(-c,-f))}}};var an={};an.drawNode=function(r,e,t){var n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,o=this,s,u,l=e._private,c=l.rscratch,f=e.position();if(!(!ae(f.x)||!ae(f.y))&&!(i&&!e.visible())){var d=i?e.effectiveOpacity():1,h=o.usePaths(),v,y=!1,g=e.padding();s=e.width()+2*g,u=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,x=new Array(b.length),E=new Array(b.length),S=0,w=0;w<b.length;w++){var k=b[w],_=x[w]=k!=null&&k!=="none";if(_){var C=e.cy().style().getIndexedStyle(e,"background-image-crossorigin","value",w);S++,E[w]=o.getCachedImage(k,C,function(){l.backgroundTimestamp=Date.now(),e.emitAndNotify("background")})}}var T=e.pstyle("background-blacken").value,D=e.pstyle("border-width").pfValue,A=e.pstyle("background-opacity").value*d,R=e.pstyle("border-color").value,M=e.pstyle("border-style").value,L=e.pstyle("border-join").value,B=e.pstyle("border-cap").value,I=e.pstyle("border-position").value,H=e.pstyle("border-dash-pattern").pfValue,q=e.pstyle("border-dash-offset").pfValue,N=e.pstyle("border-opacity").value*d,G=e.pstyle("outline-width").pfValue,X=e.pstyle("outline-color").value,j=e.pstyle("outline-style").value,Q=e.pstyle("outline-opacity").value*d,Z=e.pstyle("outline-offset").value,te=e.pstyle("corner-radius").value;te!=="auto"&&(te=e.pstyle("corner-radius").pfValue);var ne=function(){var P=arguments.length>0&&arguments[0]!==void 0?arguments[0]:A;o.eleFillStyle(r,e,P)},$=function(){var P=arguments.length>0&&arguments[0]!==void 0?arguments[0]:N;o.colorStrokeStyle(r,R[0],R[1],R[2],P)},O=function(){var P=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Q;o.colorStrokeStyle(r,X[0],X[1],X[2],P)},z=function(P,F,U,Y){var K=o.nodePathCache=o.nodePathCache||[],ce=Nd(U==="polygon"?U+","+Y.join(","):U,""+F,""+P,""+te),ee=K[ce],ie,ue=!1;return ee!=null?(ie=ee,ue=!0,c.pathCache=ie):(ie=new Path2D,K[ce]=c.pathCache=ie),{path:ie,cacheHit:ue}},V=e.pstyle("shape").strValue,W=e.pstyle("shape-polygon-points").pfValue;if(h){r.translate(f.x,f.y);var re=z(s,u,V,W);v=re.path,y=re.cacheHit}var se=function(){if(!y){var P=f;h&&(P={x:0,y:0}),o.nodeShapes[o.getNodeShape(e)].draw(v||r,P.x,P.y,s,u,te,c)}h?r.fill(v):r.fill()},Ce=function(){for(var P=arguments.length>0&&arguments[0]!==void 0?arguments[0]:d,F=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,U=l.backgrounding,Y=0,K=0;K<E.length;K++){var ce=e.cy().style().getIndexedStyle(e,"background-image-containment","value",K);if(F&&ce==="over"||!F&&ce==="inside"){Y++;continue}x[K]&&E[K].complete&&!E[K].error&&(Y++,o.drawInscribedImage(r,E[K],e,K,P))}l.backgrounding=Y!==S,U!==l.backgrounding&&e.updateStyle(!1)},pe=function(){var P=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,F=arguments.length>1&&arguments[1]!==void 0?arguments[1]:d;o.hasPie(e)&&(o.drawPie(r,e,F),P&&(h||o.nodeShapes[o.getNodeShape(e)].draw(r,f.x,f.y,s,u,te,c)))},ye=function(){var P=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,F=arguments.length>1&&arguments[1]!==void 0?arguments[1]:d;o.hasStripe(e)&&(r.save(),h?r.clip(c.pathCache):(o.nodeShapes[o.getNodeShape(e)].draw(r,f.x,f.y,s,u,te,c),r.clip()),o.drawStripe(r,e,F),r.restore(),P&&(h||o.nodeShapes[o.getNodeShape(e)].draw(r,f.x,f.y,s,u,te,c)))},ge=function(){var P=arguments.length>0&&arguments[0]!==void 0?arguments[0]:d,F=(T>0?T:-T)*P,U=T>0?0:255;T!==0&&(o.colorFillStyle(r,U,U,U,F),h?r.fill(v):r.fill())},oe=function(){if(D>0){if(r.lineWidth=D,r.lineCap=B,r.lineJoin=L,r.setLineDash)switch(M){case"dotted":r.setLineDash([1,1]);break;case"dashed":r.setLineDash(H),r.lineDashOffset=q;break;case"solid":case"double":r.setLineDash([]);break}if(I!=="center"){if(r.save(),r.lineWidth*=2,I==="inside")h?r.clip(v):r.clip();else{var P=new Path2D;P.rect(-s/2-D,-u/2-D,s+2*D,u+2*D),P.addPath(v),r.clip(P,"evenodd")}h?r.stroke(v):r.stroke(),r.restore()}else h?r.stroke(v):r.stroke();if(M==="double"){r.lineWidth=D/3;var F=r.globalCompositeOperation;r.globalCompositeOperation="destination-out",h?r.stroke(v):r.stroke(),r.globalCompositeOperation=F}r.setLineDash&&r.setLineDash([])}},ve=function(){if(G>0){if(r.lineWidth=G,r.lineCap="butt",r.setLineDash)switch(j){case"dotted":r.setLineDash([1,1]);break;case"dashed":r.setLineDash([4,2]);break;case"solid":case"double":r.setLineDash([]);break}var P=f;h&&(P={x:0,y:0});var F=o.getNodeShape(e),U=D;I==="inside"&&(U=0),I==="outside"&&(U*=2);var Y=(s+U+(G+Z))/s,K=(u+U+(G+Z))/u,ce=s*Y,ee=u*K,ie=o.nodeShapes[F].points,ue;if(h){var me=z(ce,ee,F,ie);ue=me.path}if(F==="ellipse")o.drawEllipsePath(ue||r,P.x,P.y,ce,ee);else if(["round-diamond","round-heptagon","round-hexagon","round-octagon","round-pentagon","round-polygon","round-triangle","round-tag"].includes(F)){var Ee=0,Se=0,fe=0;F==="round-diamond"?Ee=(U+Z+G)*1.4:F==="round-heptagon"?(Ee=(U+Z+G)*1.075,fe=-(U/2+Z+G)/35):F==="round-hexagon"?Ee=(U+Z+G)*1.12:F==="round-pentagon"?(Ee=(U+Z+G)*1.13,fe=-(U/2+Z+G)/15):F==="round-tag"?(Ee=(U+Z+G)*1.12,Se=(U/2+G+Z)*.07):F==="round-triangle"&&(Ee=(U+Z+G)*(Math.PI/2),fe=-(U+Z/2+G)/Math.PI),Ee!==0&&(Y=(s+Ee)/s,ce=s*Y,["round-hexagon","round-tag"].includes(F)||(K=(u+Ee)/u,ee=u*K)),te=te==="auto"?Xd(ce,ee):te;for(var Me=ce/2,Le=ee/2,ht=te+(U+G+Z)/2,tt=new Array(ie.length/2),er=new Array(ie.length/2),rt=0;rt<ie.length/2;rt++)tt[rt]={x:P.x+Se+Me*ie[rt*2],y:P.y+fe+Le*ie[rt*2+1]};var it,lt,bt,fr,Je=tt.length;for(lt=tt[Je-1],it=0;it<Je;it++)bt=tt[it%Je],fr=tt[(it+1)%Je],er[it]=ju(lt,bt,fr,ht),lt=bt,bt=fr;o.drawRoundPolygonPath(ue||r,P.x+Se,P.y+fe,s*Y,u*K,ie,er)}else if(["roundrectangle","round-rectangle"].includes(F))te=te==="auto"?Qr(ce,ee):te,o.drawRoundRectanglePath(ue||r,P.x,P.y,ce,ee,te+(U+G+Z)/2);else if(["cutrectangle","cut-rectangle"].includes(F))te=te==="auto"?Gu():te,o.drawCutRectanglePath(ue||r,P.x,P.y,ce,ee,null,te+(U+G+Z)/4);else if(["bottomroundrectangle","bottom-round-rectangle"].includes(F))te=te==="auto"?Qr(ce,ee):te,o.drawBottomRoundRectanglePath(ue||r,P.x,P.y,ce,ee,te+(U+G+Z)/2);else if(F==="barrel")o.drawBarrelPath(ue||r,P.x,P.y,ce,ee);else if(F.startsWith("polygon")||["rhomboid","right-rhomboid","round-tag","tag","vee"].includes(F)){var wr=(U+G+Z)/s;ie=Oi(Ii(ie,wr)),o.drawPolygonPath(ue||r,P.x,P.y,s,u,ie)}else{var tr=(U+G+Z)/s;ie=Oi(Ii(ie,-tr)),o.drawPolygonPath(ue||r,P.x,P.y,s,u,ie)}if(h?r.stroke(ue):r.stroke(),j==="double"){r.lineWidth=U/3;var Ir=r.globalCompositeOperation;r.globalCompositeOperation="destination-out",h?r.stroke(ue):r.stroke(),r.globalCompositeOperation=Ir}r.setLineDash&&r.setLineDash([])}},de=function(){a&&o.drawNodeOverlay(r,e,f,s,u)},we=function(){a&&o.drawNodeUnderlay(r,e,f,s,u)},xe=function(){o.drawElementText(r,e,null,n)},Ae=e.pstyle("ghost").value==="yes";if(Ae){var Be=e.pstyle("ghost-offset-x").pfValue,Ve=e.pstyle("ghost-offset-y").pfValue,ze=e.pstyle("ghost-opacity").value,Oe=ze*d;r.translate(Be,Ve),O(),ve(),ne(ze*A),se(),Ce(Oe,!0),$(ze*N),oe(),pe(T!==0||D!==0),ye(T!==0||D!==0),Ce(Oe,!1),ge(Oe),r.translate(-Be,-Ve)}h&&r.translate(-f.x,-f.y),we(),h&&r.translate(f.x,f.y),O(),ve(),ne(),se(),Ce(d,!0),$(),oe(),pe(T!==0||D!==0),ye(T!==0||D!==0),Ce(d,!1),ge(),h&&r.translate(-f.x,-f.y),xe(),de(),t&&r.translate(p.x1,p.y1)}};var eh=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(t,n,a,i,o){var s=this;if(n.visible()){var u=n.pstyle("".concat(e,"-padding")).pfValue,l=n.pstyle("".concat(e,"-opacity")).value,c=n.pstyle("".concat(e,"-color")).value,f=n.pstyle("".concat(e,"-shape")).value,d=n.pstyle("".concat(e,"-corner-radius")).value;if(l>0){if(a=a||n.position(),i==null||o==null){var h=n.padding();i=n.width()+2*h,o=n.height()+2*h}s.colorFillStyle(t,c[0],c[1],c[2],l),s.nodeShapes[f].draw(t,a.x,a.y,i+u*2,o+u*2,d),t.fill()}}}};an.drawNodeOverlay=eh("overlay");an.drawNodeUnderlay=eh("underlay");an.hasPie=function(r){return r=r[0],r._private.hasPie};an.hasStripe=function(r){return r=r[0],r._private.hasStripe};an.drawPie=function(r,e,t,n){e=e[0],n=n||e.position();var a=e.cy().style(),i=e.pstyle("pie-size"),o=e.pstyle("pie-hole"),s=e.pstyle("pie-start-angle").pfValue,u=n.x,l=n.y,c=e.width(),f=e.height(),d=Math.min(c,f)/2,h,v=0,y=this.usePaths();if(y&&(u=0,l=0),i.units==="%"?d=d*i.pfValue:i.pfValue!==void 0&&(d=i.pfValue/2),o.units==="%"?h=d*o.pfValue:o.pfValue!==void 0&&(h=o.pfValue/2),!(h>=d))for(var g=1;g<=a.pieBackgroundN;g++){var p=e.pstyle("pie-"+g+"-background-size").value,m=e.pstyle("pie-"+g+"-background-color").value,b=e.pstyle("pie-"+g+"-background-opacity").value*t,x=p/100;x+v>1&&(x=1-v);var E=1.5*Math.PI+2*Math.PI*v;E+=s;var S=2*Math.PI*x,w=E+S;p===0||v>=1||v+x>1||(h===0?(r.beginPath(),r.moveTo(u,l),r.arc(u,l,d,E,w),r.closePath()):(r.beginPath(),r.arc(u,l,d,E,w),r.arc(u,l,h,w,E,!0),r.closePath()),this.colorFillStyle(r,m[0],m[1],m[2],b),r.fill(),v+=x)}};an.drawStripe=function(r,e,t,n){e=e[0],n=n||e.position();var a=e.cy().style(),i=n.x,o=n.y,s=e.width(),u=e.height(),l=0,c=this.usePaths();r.save();var f=e.pstyle("stripe-direction").value,d=e.pstyle("stripe-size");switch(f){case"vertical":break;case"righward":r.rotate(-Math.PI/2);break}var h=s,v=u;d.units==="%"?(h=h*d.pfValue,v=v*d.pfValue):d.pfValue!==void 0&&(h=d.pfValue,v=d.pfValue),c&&(i=0,o=0),o-=h/2,i-=v/2;for(var y=1;y<=a.stripeBackgroundN;y++){var g=e.pstyle("stripe-"+y+"-background-size").value,p=e.pstyle("stripe-"+y+"-background-color").value,m=e.pstyle("stripe-"+y+"-background-opacity").value*t,b=g/100;b+l>1&&(b=1-l),!(g===0||l>=1||l+b>1)&&(r.beginPath(),r.rect(i,o+v*l,h,v*b),r.closePath(),this.colorFillStyle(r,p[0],p[1],p[2],m),r.fill(),l+=b)}r.restore()};var Bt={},d1=100;Bt.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};Bt.paintCache=function(r){for(var e=this.paintCaches=this.paintCaches||[],t=!0,n,a=0;a<e.length;a++)if(n=e[a],n.context===r){t=!1;break}return t&&(n={context:r},e.push(n)),n};Bt.createGradientStyleFor=function(r,e,t,n,a){var i,o=this.usePaths(),s=t.pstyle(e+"-gradient-stop-colors").value,u=t.pstyle(e+"-gradient-stop-positions").pfValue;if(n==="radial-gradient")if(t.isEdge()){var l=t.sourceEndpoint(),c=t.targetEndpoint(),f=t.midpoint(),d=bn(l,f),h=bn(c,f);i=r.createRadialGradient(f.x,f.y,0,f.x,f.y,Math.max(d,h))}else{var v=o?{x:0,y:0}:t.position(),y=t.paddedWidth(),g=t.paddedHeight();i=r.createRadialGradient(v.x,v.y,0,v.x,v.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(),x=t.paddedWidth(),E=t.paddedHeight(),S=x/2,w=E/2,k=t.pstyle("background-gradient-direction").value;switch(k){case"to-bottom":i=r.createLinearGradient(b.x,b.y-w,b.x,b.y+w);break;case"to-top":i=r.createLinearGradient(b.x,b.y+w,b.x,b.y-w);break;case"to-left":i=r.createLinearGradient(b.x+S,b.y,b.x-S,b.y);break;case"to-right":i=r.createLinearGradient(b.x-S,b.y,b.x+S,b.y);break;case"to-bottom-right":case"to-right-bottom":i=r.createLinearGradient(b.x-S,b.y-w,b.x+S,b.y+w);break;case"to-top-right":case"to-right-top":i=r.createLinearGradient(b.x-S,b.y+w,b.x+S,b.y-w);break;case"to-bottom-left":case"to-left-bottom":i=r.createLinearGradient(b.x+S,b.y-w,b.x-S,b.y+w);break;case"to-top-left":case"to-left-top":i=r.createLinearGradient(b.x+S,b.y+w,b.x-S,b.y-w);break}}if(!i)return null;for(var _=u.length===s.length,C=s.length,T=0;T<C;T++)i.addColorStop(_?u[T]:T/(C-1),"rgba("+s[T][0]+","+s[T][1]+","+s[T][2]+","+a+")");return i};Bt.gradientFillStyle=function(r,e,t,n){var a=this.createGradientStyleFor(r,"background",e,t,n);if(!a)return null;r.fillStyle=a};Bt.colorFillStyle=function(r,e,t,n,a){r.fillStyle="rgba("+e+","+t+","+n+","+a+")"};Bt.eleFillStyle=function(r,e,t){var n=e.pstyle("background-fill").value;if(n==="linear-gradient"||n==="radial-gradient")this.gradientFillStyle(r,e,n,t);else{var a=e.pstyle("background-color").value;this.colorFillStyle(r,a[0],a[1],a[2],t)}};Bt.gradientStrokeStyle=function(r,e,t,n){var a=this.createGradientStyleFor(r,"line",e,t,n);if(!a)return null;r.strokeStyle=a};Bt.colorStrokeStyle=function(r,e,t,n,a){r.strokeStyle="rgba("+e+","+t+","+n+","+a+")"};Bt.eleStrokeStyle=function(r,e,t){var n=e.pstyle("line-fill").value;if(n==="linear-gradient"||n==="radial-gradient")this.gradientStrokeStyle(r,e,n,t);else{var a=e.pstyle("line-color").value;this.colorStrokeStyle(r,a[0],a[1],a[2],t)}};Bt.matchCanvasSize=function(r){var e=this,t=e.data,n=e.findContainerClientCoords(),a=n[2],i=n[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 u=a*o,l=i*o,c;if(!(u===e.canvasWidth&&l===e.canvasHeight)){e.fontCaches=null;var f=t.canvasContainer;f.style.width=a+"px",f.style.height=i+"px";for(var d=0;d<e.CANVAS_LAYERS;d++)c=t.canvases[d],c.width=u,c.height=l,c.style.width=a+"px",c.style.height=i+"px";for(var d=0;d<e.BUFFER_COUNT;d++)c=t.bufferCanvases[d],c.width=u,c.height=l,c.style.width=a+"px",c.style.height=i+"px";e.textureMult=1,o<=1&&(c=t.bufferCanvases[e.TEXTURE_BUFFER],e.textureMult=2,c.width=u*e.textureMult,c.height=l*e.textureMult),e.canvasWidth=u,e.canvasHeight=l,e.pixelRatio=o}};Bt.renderTo=function(r,e,t,n){this.render({forcedContext:r,forcedZoom:e,forcedPan:t,drawAllLayers:!0,forcedPxRatio:n})};Bt.clearCanvas=function(){var r=this,e=r.data;function t(n){n.clearRect(0,0,r.canvasWidth,r.canvasHeight)}t(e.contexts[r.NODE]),t(e.contexts[r.DRAG])};Bt.render=function(r){var e=this;r=r||qd();var t=e.cy,n=r.forcedContext,a=r.drawAllLayers,i=r.drawOnlyNodeLayer,o=r.forcedZoom,s=r.forcedPan,u=r.forcedPxRatio===void 0?this.getPixelRatio():r.forcedPxRatio,l=e.data,c=l.canvasNeedsRedraw,f=e.textureOnViewport&&!n&&(e.pinching||e.hoverData.dragging||e.swipePanning||e.data.wheelZooming),d=r.motionBlur!==void 0?r.motionBlur:e.motionBlur,h=e.motionBlurPxRatio,v=t.hasCompoundNodes(),y=e.hoverData.draggingEles,g=!!(e.hoverData.selecting||e.touchData.selecting);d=d&&!n&&e.motionBlurEnabled&&!g;var p=d;n||(e.prevPxRatio!==u&&(e.invalidateContainerClientCoordsCache(),e.matchCanvasSize(e.container),e.redrawHint("eles",!0),e.redrawHint("drag",!0)),e.prevPxRatio=u),!n&&e.motionBlurTimeout&&clearTimeout(e.motionBlurTimeout),d&&(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&&(c[e.NODE]=!0,c[e.SELECT_BOX]=!0);var m=t.style(),b=t.zoom(),x=o!==void 0?o:b,E=t.pan(),S={x:E.x,y:E.y},w={zoom:b,pan:{x:E.x,y:E.y}},k=e.prevViewport,_=k===void 0||w.zoom!==k.zoom||w.pan.x!==k.pan.x||w.pan.y!==k.pan.y;!_&&!(y&&!v)&&(e.motionBlurPxRatio=1),s&&(S=s),x*=u,S.x*=u,S.y*=u;var C=e.getCachedZSortedEles();function T($,O,z,V,W){var re=$.globalCompositeOperation;$.globalCompositeOperation="destination-out",e.colorFillStyle($,255,255,255,e.motionBlurTransparency),$.fillRect(O,z,V,W),$.globalCompositeOperation=re}function D($,O){var z,V,W,re;!e.clearingMotionBlur&&($===l.bufferContexts[e.MOTIONBLUR_BUFFER_NODE]||$===l.bufferContexts[e.MOTIONBLUR_BUFFER_DRAG])?(z={x:E.x*h,y:E.y*h},V=b*h,W=e.canvasWidth*h,re=e.canvasHeight*h):(z=S,V=x,W=e.canvasWidth,re=e.canvasHeight),$.setTransform(1,0,0,1,0,0),O==="motionBlur"?T($,0,0,W,re):!n&&(O===void 0||O)&&$.clearRect(0,0,W,re),a||($.translate(z.x,z.y),$.scale(V,V)),s&&$.translate(s.x,s.y),o&&$.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 A=e.data.bufferContexts[e.TEXTURE_BUFFER];A.setTransform(1,0,0,1,0,0),A.clearRect(0,0,e.canvasWidth*e.textureMult,e.canvasHeight*e.textureMult),e.render({forcedContext:A,drawOnlyNodeLayer:!0,forcedPxRatio:u*e.textureMult});var w=e.textureCache.viewport={zoom:t.zoom(),pan:t.pan(),width:e.canvasWidth,height:e.canvasHeight};w.mpan={x:(0-w.pan.x)/w.zoom,y:(0-w.pan.y)/w.zoom}}c[e.DRAG]=!1,c[e.NODE]=!1;var R=l.contexts[e.NODE],M=e.textureCache.texture,w=e.textureCache.viewport;R.setTransform(1,0,0,1,0,0),d?T(R,0,0,w.width,w.height):R.clearRect(0,0,w.width,w.height);var L=m.core("outside-texture-bg-color").value,B=m.core("outside-texture-bg-opacity").value;e.colorFillStyle(R,L[0],L[1],L[2],B),R.fillRect(0,0,w.width,w.height);var b=t.zoom();D(R,!1),R.clearRect(w.mpan.x,w.mpan.y,w.width/w.zoom/u,w.height/w.zoom/u),R.drawImage(M,w.mpan.x,w.mpan.y,w.width/w.zoom/u,w.height/w.zoom/u)}else e.textureOnViewport&&!n&&(e.textureCache=null);var I=t.extent(),H=e.pinching||e.hoverData.dragging||e.swipePanning||e.data.wheelZooming||e.hoverData.draggingEles||e.cy.animated(),q=e.hideEdgesOnViewport&&H,N=[];if(N[e.NODE]=!c[e.NODE]&&d&&!e.clearedForMotionBlur[e.NODE]||e.clearingMotionBlur,N[e.NODE]&&(e.clearedForMotionBlur[e.NODE]=!0),N[e.DRAG]=!c[e.DRAG]&&d&&!e.clearedForMotionBlur[e.DRAG]||e.clearingMotionBlur,N[e.DRAG]&&(e.clearedForMotionBlur[e.DRAG]=!0),c[e.NODE]||a||i||N[e.NODE]){var G=d&&!N[e.NODE]&&h!==1,R=n||(G?e.data.bufferContexts[e.MOTIONBLUR_BUFFER_NODE]:l.contexts[e.NODE]),X=d&&!G?"motionBlur":void 0;D(R,X),q?e.drawCachedNodes(R,C.nondrag,u,I):e.drawLayeredElements(R,C.nondrag,u,I),e.debug&&e.drawDebugPoints(R,C.nondrag),!a&&!d&&(c[e.NODE]=!1)}if(!i&&(c[e.DRAG]||a||N[e.DRAG])){var G=d&&!N[e.DRAG]&&h!==1,R=n||(G?e.data.bufferContexts[e.MOTIONBLUR_BUFFER_DRAG]:l.contexts[e.DRAG]);D(R,d&&!G?"motionBlur":void 0),q?e.drawCachedNodes(R,C.drag,u,I):e.drawCachedElements(R,C.drag,u,I),e.debug&&e.drawDebugPoints(R,C.drag),!a&&!d&&(c[e.DRAG]=!1)}if(this.drawSelectionRectangle(r,D),d&&h!==1){var j=l.contexts[e.NODE],Q=e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_NODE],Z=l.contexts[e.DRAG],te=e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_DRAG],ne=function(O,z,V){O.setTransform(1,0,0,1,0,0),V||!p?O.clearRect(0,0,e.canvasWidth,e.canvasHeight):T(O,0,0,e.canvasWidth,e.canvasHeight);var W=h;O.drawImage(z,0,0,e.canvasWidth*W,e.canvasHeight*W,0,0,e.canvasWidth,e.canvasHeight)};(c[e.NODE]||N[e.NODE])&&(ne(j,Q,N[e.NODE]),c[e.NODE]=!1),(c[e.DRAG]||N[e.DRAG])&&(ne(Z,te,N[e.DRAG]),c[e.DRAG]=!1)}e.prevViewport=w,e.clearingMotionBlur&&(e.clearingMotionBlur=!1,e.motionBlurCleared=!0,e.motionBlur=!0),d&&(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,c[e.NODE]=!0,c[e.DRAG]=!0,e.redraw()},d1)),n||t.emit("render")};var pa;Bt.drawSelectionRectangle=function(r,e){var t=this,n=t.cy,a=t.data,i=n.style(),o=r.drawOnlyNodeLayer,s=r.drawAllLayers,u=a.canvasNeedsRedraw,l=r.forcedContext;if(t.showFps||!o&&u[t.SELECT_BOX]&&!s){var c=l||a.contexts[t.SELECT_BOX];if(e(c),t.selection[4]==1&&(t.hoverData.selecting||t.touchData.selecting)){var f=t.cy.zoom(),d=i.core("selection-box-border-width").value/f;c.lineWidth=d,c.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+")",c.fillRect(t.selection[0],t.selection[1],t.selection[2]-t.selection[0],t.selection[3]-t.selection[1]),d>0&&(c.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+")",c.strokeRect(t.selection[0],t.selection[1],t.selection[2]-t.selection[0],t.selection[3]-t.selection[1]))}if(a.bgActivePosistion&&!t.hoverData.selecting){var f=t.cy.zoom(),h=a.bgActivePosistion;c.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+")",c.beginPath(),c.arc(h.x,h.y,i.core("active-bg-size").pfValue/f,0,2*Math.PI),c.fill()}var v=t.lastRedrawTime;if(t.showFps&&v){v=Math.round(v);var y=Math.round(1e3/v),g="1 frame = "+v+" ms = "+y+" fps";if(c.setTransform(1,0,0,1,0,0),c.fillStyle="rgba(255, 0, 0, 0.75)",c.strokeStyle="rgba(255, 0, 0, 0.75)",c.font="30px Arial",!pa){var p=c.measureText(g);pa=p.actualBoundingBoxAscent}c.fillText(g,0,pa);var m=60;c.strokeRect(0,pa+10,250,20),c.fillRect(0,pa+10,250*Math.min(y/m,1),20)}s||(u[t.SELECT_BOX]=!1)}};function hd(r,e,t){var n=r.createShader(e);if(r.shaderSource(n,t),r.compileShader(n),!r.getShaderParameter(n,r.COMPILE_STATUS))throw new Error(r.getShaderInfoLog(n));return n}function v1(r,e,t){var n=hd(r,r.VERTEX_SHADER,e),a=hd(r,r.FRAGMENT_SHADER,t),i=r.createProgram();if(r.attachShader(i,n),r.attachShader(i,a),r.linkProgram(i),!r.getProgramParameter(i,r.LINK_STATUS))throw new Error("Could not initialize shaders");return i}function h1(r,e,t){t===void 0&&(t=e);var n=r.makeOffscreenCanvas(e,t),a=n.context=n.getContext("2d");return n.clear=function(){return a.clearRect(0,0,n.width,n.height)},n.clear(),n}function rl(r){var e=r.pixelRatio,t=r.cy.zoom(),n=r.cy.pan();return{zoom:t*e,pan:{x:n.x*e,y:n.y*e}}}function p1(r){var e=r.pixelRatio,t=r.cy.zoom();return t*e}function g1(r,e,t,n,a){var i=n*t+e.x,o=a*t+e.y;return o=Math.round(r.canvasHeight-o),[i,o]}function y1(r,e){return e.picking?!0:r.pstyle("background-fill").value!=="solid"||r.pstyle("background-image").strValue!=="none"?!1:r.pstyle("border-width").value===0||r.pstyle("border-opacity").value===0?!0:r.pstyle("border-style").value==="solid"}function m1(r,e){if(r.length!==e.length)return!1;for(var t=0;t<r.length;t++)if(r[t]!==e[t])return!1;return!0}function fn(r,e,t){var n=r[0]/255,a=r[1]/255,i=r[2]/255,o=e,s=t||new Array(4);return s[0]=n*o,s[1]=a*o,s[2]=i*o,s[3]=o,s}function Ln(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 b1(r){return r[0]+(r[1]<<8)+(r[2]<<16)+(r[3]<<24)}function x1(r,e){var t=r.createTexture();return t.buffer=function(n){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,n),r.generateMipmap(r.TEXTURE_2D),r.bindTexture(r.TEXTURE_2D,null)},t.deleteTexture=function(){r.deleteTexture(t)},t}function th(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 rh(r,e,t){switch(e){case r.FLOAT:return new Float32Array(t);case r.INT:return new Int32Array(t)}}function w1(r,e,t,n,a,i){switch(e){case r.FLOAT:return new Float32Array(t.buffer,i*n,a);case r.INT:return new Int32Array(t.buffer,i*n,a)}}function E1(r,e,t,n){var a=th(r,e),i=ut(a,2),o=i[0],s=i[1],u=rh(r,s,n),l=r.createBuffer();return r.bindBuffer(r.ARRAY_BUFFER,l),r.bufferData(r.ARRAY_BUFFER,u,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),l}function pr(r,e,t,n){var a=th(r,t),i=ut(a,3),o=i[0],s=i[1],u=i[2],l=rh(r,s,e*o),c=o*u,f=r.createBuffer();r.bindBuffer(r.ARRAY_BUFFER,f),r.bufferData(r.ARRAY_BUFFER,e*c,r.DYNAMIC_DRAW),r.enableVertexAttribArray(n),s===r.FLOAT?r.vertexAttribPointer(n,o,s,!1,c,0):s===r.INT&&r.vertexAttribIPointer(n,o,s,c,0),r.vertexAttribDivisor(n,1),r.bindBuffer(r.ARRAY_BUFFER,null);for(var d=new Array(e),h=0;h<e;h++)d[h]=w1(r,s,l,c,o,h);return f.dataArray=l,f.stride=c,f.size=o,f.getView=function(v){return d[v]},f.setPoint=function(v,y,g){var p=d[v];p[0]=y,p[1]=g},f.bufferSubData=function(v){r.bindBuffer(r.ARRAY_BUFFER,f),v?r.bufferSubData(r.ARRAY_BUFFER,0,l,0,v*o):r.bufferSubData(r.ARRAY_BUFFER,0,l)},f}function C1(r,e,t){for(var n=9,a=new Float32Array(e*n),i=new Array(e),o=0;o<e;o++){var s=o*n*4;i[o]=new Float32Array(a.buffer,s,n)}var u=r.createBuffer();r.bindBuffer(r.ARRAY_BUFFER,u),r.bufferData(r.ARRAY_BUFFER,a.byteLength,r.DYNAMIC_DRAW);for(var l=0;l<3;l++){var c=t+l;r.enableVertexAttribArray(c),r.vertexAttribPointer(c,3,r.FLOAT,!1,36,l*12),r.vertexAttribDivisor(c,1)}return r.bindBuffer(r.ARRAY_BUFFER,null),u.getMatrixView=function(f){return i[f]},u.setData=function(f,d){i[d].set(f,0)},u.bufferSubData=function(){r.bindBuffer(r.ARRAY_BUFFER,u),r.bufferSubData(r.ARRAY_BUFFER,0,a)},u}function S1(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(n,a){r.bindTexture(r.TEXTURE_2D,t),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,n,a,0,r.RGBA,r.UNSIGNED_BYTE,null)},e}var pd=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 ou(){var r=new pd(9);return pd!=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 gd(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 k1(r,e,t){var n=e[0],a=e[1],i=e[2],o=e[3],s=e[4],u=e[5],l=e[6],c=e[7],f=e[8],d=t[0],h=t[1],v=t[2],y=t[3],g=t[4],p=t[5],m=t[6],b=t[7],x=t[8];return r[0]=d*n+h*o+v*l,r[1]=d*a+h*s+v*c,r[2]=d*i+h*u+v*f,r[3]=y*n+g*o+p*l,r[4]=y*a+g*s+p*c,r[5]=y*i+g*u+p*f,r[6]=m*n+b*o+x*l,r[7]=m*a+b*s+x*c,r[8]=m*i+b*u+x*f,r}function Ai(r,e,t){var n=e[0],a=e[1],i=e[2],o=e[3],s=e[4],u=e[5],l=e[6],c=e[7],f=e[8],d=t[0],h=t[1];return r[0]=n,r[1]=a,r[2]=i,r[3]=o,r[4]=s,r[5]=u,r[6]=d*n+h*o+l,r[7]=d*a+h*s+c,r[8]=d*i+h*u+f,r}function yd(r,e,t){var n=e[0],a=e[1],i=e[2],o=e[3],s=e[4],u=e[5],l=e[6],c=e[7],f=e[8],d=Math.sin(t),h=Math.cos(t);return r[0]=h*n+d*o,r[1]=h*a+d*s,r[2]=h*i+d*u,r[3]=h*o-d*n,r[4]=h*s-d*a,r[5]=h*u-d*i,r[6]=l,r[7]=c,r[8]=f,r}function Pu(r,e,t){var n=t[0],a=t[1];return r[0]=n*e[0],r[1]=n*e[1],r[2]=n*e[2],r[3]=a*e[3],r[4]=a*e[4],r[5]=a*e[5],r[6]=e[6],r[7]=e[7],r[8]=e[8],r}function T1(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 _1=(function(){function r(e,t,n,a){tn(this,r),this.debugID=Math.floor(Math.random()*1e4),this.r=e,this.texSize=t,this.texRows=n,this.texHeight=Math.floor(t/n),this.enableWrapping=!0,this.locked=!1,this.texture=null,this.needsBuffer=!0,this.freePointer={x:0,row:0},this.keyToLocation=new Map,this.canvas=a(e,t,t),this.scratch=a(e,t,this.texHeight,"scratch")}return rn(r,[{key:"lock",value:function(){this.locked=!0}},{key:"getKeys",value:function(){return new Set(this.keyToLocation.keys())}},{key:"getScale",value:function(t){var n=t.w,a=t.h,i=this.texHeight,o=this.texSize,s=i/a,u=n*s,l=a*s;return u>o&&(s=o/n,u=n*s,l=a*s),{scale:s,texW:u,texH:l}}},{key:"draw",value:function(t,n,a){var i=this;if(this.locked)throw new Error("can't draw, atlas is locked");var o=this.texSize,s=this.texRows,u=this.texHeight,l=this.getScale(n),c=l.scale,f=l.texW,d=l.texH,h=function(b,x){if(a&&x){var E=x.context,S=b.x,w=b.row,k=S,_=u*w;E.save(),E.translate(k,_),E.scale(c,c),a(E,n),E.restore()}},v=[null,null],y=function(){h(i.freePointer,i.canvas),v[0]={x:i.freePointer.x,y:i.freePointer.row*u,w:f,h:d},v[1]={x:i.freePointer.x+f,y:i.freePointer.row*u,w:0,h:d},i.freePointer.x+=f,i.freePointer.x==o&&(i.freePointer.x=0,i.freePointer.row++)},g=function(){var b=i.scratch,x=i.canvas;b.clear(),h({x:0,row:0},b);var E=o-i.freePointer.x,S=f-E,w=u;{var k=i.freePointer.x,_=i.freePointer.row*u,C=E;x.context.drawImage(b,0,0,C,w,k,_,C,w),v[0]={x:k,y:_,w:C,h:d}}{var T=E,D=(i.freePointer.row+1)*u,A=S;x&&x.context.drawImage(b,T,0,A,w,0,D,A,w),v[1]={x:0,y:D,w:A,h:d}}i.freePointer.x=S,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,v),this.needsBuffer=!0,v}},{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 n=this.texSize,a=this.texRows,i=this.getScale(t),o=i.texW;return this.freePointer.x+o>n?this.freePointer.row<a-1:!0}},{key:"bufferIfNeeded",value:function(t){this.texture||(this.texture=x1(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}}])})(),P1=(function(){function r(e,t,n,a){tn(this,r),this.r=e,this.texSize=t,this.texRows=n,this.createTextureCanvas=a,this.atlases=[],this.styleKeyToAtlas=new Map,this.markedKeys=new Set}return rn(r,[{key:"getKeys",value:function(){return new Set(this.styleKeyToAtlas.keys())}},{key:"_createAtlas",value:function(){var t=this.r,n=this.texSize,a=this.texRows,i=this.createTextureCanvas;return new _1(t,n,a,i)}},{key:"_getScratchCanvas",value:function(){if(!this.scratch){var t=this.r,n=this.texSize,a=this.texRows,i=this.createTextureCanvas,o=Math.floor(n/a);this.scratch=i(t,n,o,"scratch")}return this.scratch}},{key:"draw",value:function(t,n,a){var i=this.styleKeyToAtlas.get(t);return i||(i=this.atlases[this.atlases.length-1],(!i||!i.canFit(n))&&(i&&i.lock(),i=this._createAtlas(),this.atlases.push(i)),i.draw(t,n,a),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,n=this.markedKeys;if(n.size===0){console.log("nothing to garbage collect");return}var a=[],i=new Map,o=null,s=Vt(this.atlases),u;try{var l=function(){var f=u.value,d=f.getKeys(),h=D1(n,d);if(h.size===0)return a.push(f),d.forEach(function(E){return i.set(E,f)}),1;o||(o=t._createAtlas(),a.push(o));var v=Vt(d),y;try{for(v.s();!(y=v.n()).done;){var g=y.value;if(!h.has(g)){var p=f.getOffsets(g),m=ut(p,2),b=m[0],x=m[1];o.canFit({w:b.w+x.w,h:b.h})||(o.lock(),o=t._createAtlas(),a.push(o)),f.canvas&&(t._copyTextureToNewAtlas(g,f,o),i.set(g,o))}}}catch(E){v.e(E)}finally{v.f()}f.dispose()};for(s.s();!(u=s.n()).done;)l()}catch(c){s.e(c)}finally{s.f()}this.atlases=a,this.styleKeyToAtlas=i,this.markedKeys=new Set}},{key:"_copyTextureToNewAtlas",value:function(t,n,a){var i=n.getOffsets(t),o=ut(i,2),s=o[0],u=o[1];if(u.w===0)a.draw(t,s,function(d){d.drawImage(n.canvas,s.x,s.y,s.w,s.h,0,0,s.w,s.h)});else{var l=this._getScratchCanvas();l.clear(),l.context.drawImage(n.canvas,s.x,s.y,s.w,s.h,0,0,s.w,s.h),l.context.drawImage(n.canvas,u.x,u.y,u.w,u.h,s.w,0,u.w,u.h);var c=s.w+u.w,f=s.h;a.draw(t,{w:c,h:f},function(d){d.drawImage(l,0,0,c,f,0,0,c,f)})}}},{key:"getCounts",value:function(){return{keyCount:this.styleKeyToAtlas.size,atlasCount:new Set(this.styleKeyToAtlas.values()).size}}}])})();function D1(r,e){return r.intersection?r.intersection(e):new Set(Mi(r).filter(function(t){return e.has(t)}))}var A1=(function(){function r(e,t){tn(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}return rn(r,[{key:"getAtlasSize",value:function(){return this.atlasSize}},{key:"addAtlasCollection",value:function(t,n){var a=this.globalOptions,i=a.webglTexSize,o=a.createTextureCanvas,s=n.texRows,u=this._cacheScratchCanvas(o),l=new P1(this.r,i,s,u);this.collections.set(t,l)}},{key:"addRenderType",value:function(t,n){var a=n.collection;if(!this.collections.has(a))throw new Error("invalid atlas collection name '".concat(a,"'"));var i=this.collections.get(a),o=be({type:t,atlasCollection:i},n);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 n=-1,a=-1,i=null;return function(o,s,u,l){return l?((!i||s!=n||u!=a)&&(n=s,a=u,i=t(o,s,u)),i):t(o,s,u)}}},{key:"_key",value:function(t,n){return"".concat(t,"-").concat(n)}},{key:"invalidate",value:function(t){var n=this,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=a.forceRedraw,o=i===void 0?!1:i,s=a.filterEle,u=s===void 0?function(){return!0}:s,l=a.filterType,c=l===void 0?function(){return!0}:l,f=!1,d=!1,h=Vt(t),v;try{for(h.s();!(v=h.n()).done;){var y=v.value;if(u(y)){var g=Vt(this.renderTypes.values()),p;try{var m=function(){var x=p.value,E=x.type;if(c(E)){var S=n.collections.get(x.collection),w=x.getKey(y),k=Array.isArray(w)?w:[w];if(o)k.forEach(function(D){return S.markKeyForGC(D)}),d=!0;else{var _=x.getID?x.getID(y):y.id(),C=n._key(E,_),T=n.typeAndIdToKey.get(C);T!==void 0&&!m1(k,T)&&(f=!0,n.typeAndIdToKey.delete(C),T.forEach(function(D){return S.markKeyForGC(D)}))}}};for(g.s();!(p=g.n()).done;)m()}catch(b){g.e(b)}finally{g.f()}}}}catch(b){h.e(b)}finally{h.f()}return d&&(this.gc(),f=!1),f}},{key:"gc",value:function(){var t=Vt(this.collections.values()),n;try{for(t.s();!(n=t.n()).done;){var a=n.value;a.gc()}}catch(i){t.e(i)}finally{t.f()}}},{key:"getOrCreateAtlas",value:function(t,n,a,i){var o=this.renderTypes.get(n),s=this.collections.get(o.collection),u=!1,l=s.draw(i,a,function(d){o.drawClipped?(d.save(),d.beginPath(),d.rect(0,0,a.w,a.h),d.clip(),o.drawElement(d,t,a,!0,!0),d.restore()):o.drawElement(d,t,a,!0,!0),u=!0});if(u){var c=o.getID?o.getID(t):t.id(),f=this._key(n,c);this.typeAndIdToKey.has(f)?this.typeAndIdToKey.get(f).push(i):this.typeAndIdToKey.set(f,[i])}return l}},{key:"getAtlasInfo",value:function(t,n){var a=this,i=this.renderTypes.get(n),o=i.getKey(t),s=Array.isArray(o)?o:[o];return s.map(function(u){var l=i.getBoundingBox(t,u),c=a.getOrCreateAtlas(t,n,l,u),f=c.getOffsets(u),d=ut(f,2),h=d[0],v=d[1];return{atlas:c,tex:h,tex1:h,tex2:v,bb:l}})}},{key:"getDebugInfo",value:function(){var t=[],n=Vt(this.collections),a;try{for(n.s();!(a=n.n()).done;){var i=ut(a.value,2),o=i[0],s=i[1],u=s.getCounts(),l=u.keyCount,c=u.atlasCount;t.push({type:o,keyCount:l,atlasCount:c})}}catch(f){n.e(f)}finally{n.f()}return t}}])})(),M1=(function(){function r(e){tn(this,r),this.globalOptions=e,this.atlasSize=e.webglTexSize,this.maxAtlasesPerBatch=e.webglTexPerBatch,this.batchAtlases=[]}return rn(r,[{key:"getMaxAtlasesPerBatch",value:function(){return this.maxAtlasesPerBatch}},{key:"getAtlasSize",value:function(){return this.atlasSize}},{key:"getIndexArray",value:function(){return Array.from({length:this.maxAtlasesPerBatch},function(t,n){return n})}},{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){return this.batchAtlases.length===this.maxAtlasesPerBatch?this.batchAtlases.includes(t):!0}},{key:"getAtlasIndexForBatch",value:function(t){var n=this.batchAtlases.indexOf(t);if(n<0){if(this.batchAtlases.length===this.maxAtlasesPerBatch)throw new Error("cannot add more atlases to batch");this.batchAtlases.push(t),n=this.batchAtlases.length-1}return n}}])})(),R1=`
8
+ float circleSD(vec2 p, float r) {
9
+ return distance(vec2(0), p) - r; // signed distance
10
+ }
11
+ `,B1=`
12
+ float rectangleSD(vec2 p, vec2 b) {
13
+ vec2 d = abs(p)-b;
14
+ return distance(vec2(0),max(d,0.0)) + min(max(d.x,d.y),0.0);
15
+ }
16
+ `,L1=`
17
+ float roundRectangleSD(vec2 p, vec2 b, vec4 cr) {
18
+ cr.xy = (p.x > 0.0) ? cr.xy : cr.zw;
19
+ cr.x = (p.y > 0.0) ? cr.x : cr.y;
20
+ vec2 q = abs(p) - b + cr.x;
21
+ return min(max(q.x, q.y), 0.0) + distance(vec2(0), max(q, 0.0)) - cr.x;
22
+ }
23
+ `,O1=`
24
+ float ellipseSD(vec2 p, vec2 ab) {
25
+ p = abs( p ); // symmetry
26
+
27
+ // find root with Newton solver
28
+ vec2 q = ab*(p-ab);
29
+ float w = (q.x<q.y)? 1.570796327 : 0.0;
30
+ for( int i=0; i<5; i++ ) {
31
+ vec2 cs = vec2(cos(w),sin(w));
32
+ vec2 u = ab*vec2( cs.x,cs.y);
33
+ vec2 v = ab*vec2(-cs.y,cs.x);
34
+ w = w + dot(p-u,v)/(dot(p-u,u)+dot(v,v));
35
+ }
36
+
37
+ // compute final point and distance
38
+ float d = length(p-ab*vec2(cos(w),sin(w)));
39
+
40
+ // return signed distance
41
+ return (dot(p/ab,p/ab)>1.0) ? d : -d;
42
+ }
43
+ `,Ca={SCREEN:{name:"screen",screen:!0},PICKING:{name:"picking",picking:!0}},Hi={IGNORE:1,USE_BB:2},su=0,md=1,bd=2,uu=3,On=4,bi=5,ga=6,ya=7,I1=(function(){function r(e,t,n){tn(this,r),this.r=e,this.gl=t,this.maxInstances=n.webglBatchSize,this.atlasSize=n.webglTexSize,this.bgColor=n.bgColor,this.debug=n.webglDebug,this.batchDebugInfo=[],n.enableWrapping=!0,n.createTextureCanvas=h1,this.atlasManager=new A1(e,n),this.batchManager=new M1(n),this.simpleShapeOptions=new Map,this.program=this._createShaderProgram(Ca.SCREEN),this.pickingProgram=this._createShaderProgram(Ca.PICKING),this.vao=this._createVAO()}return rn(r,[{key:"addAtlasCollection",value:function(t,n){this.atlasManager.addAtlasCollection(t,n)}},{key:"addTextureAtlasRenderType",value:function(t,n){this.atlasManager.addRenderType(t,n)}},{key:"addSimpleShapeRenderType",value:function(t,n){this.simpleShapeOptions.set(t,n)}},{key:"invalidate",value:function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=n.type,i=this.atlasManager;return a?i.invalidate(t,{filterType:function(s){return s===a},forceRedraw:!0}):i.invalidate(t)}},{key:"gc",value:function(){this.atlasManager.gc()}},{key:"_createShaderProgram",value:function(t){var n=this.gl,a=`#version 300 es
44
+ precision highp float;
45
+
46
+ uniform mat3 uPanZoomMatrix;
47
+ uniform int uAtlasSize;
48
+
49
+ // instanced
50
+ in vec2 aPosition; // a vertex from the unit square
51
+
52
+ in mat3 aTransform; // used to transform verticies, eg into a bounding box
53
+ in int aVertType; // the type of thing we are rendering
54
+
55
+ // the z-index that is output when using picking mode
56
+ in vec4 aIndex;
57
+
58
+ // For textures
59
+ in int aAtlasId; // which shader unit/atlas to use
60
+ in vec4 aTex; // x/y/w/h of texture in atlas
61
+
62
+ // for edges
63
+ in vec4 aPointAPointB;
64
+ in vec4 aPointCPointD;
65
+ in vec2 aLineWidth; // also used for node border width
66
+
67
+ // simple shapes
68
+ in vec4 aCornerRadius; // for round-rectangle [top-right, bottom-right, top-left, bottom-left]
69
+ in vec4 aColor; // also used for edges
70
+ in vec4 aBorderColor; // aLineWidth is used for border width
71
+
72
+ // output values passed to the fragment shader
73
+ out vec2 vTexCoord;
74
+ out vec4 vColor;
75
+ out vec2 vPosition;
76
+ // flat values are not interpolated
77
+ flat out int vAtlasId;
78
+ flat out int vVertType;
79
+ flat out vec2 vTopRight;
80
+ flat out vec2 vBotLeft;
81
+ flat out vec4 vCornerRadius;
82
+ flat out vec4 vBorderColor;
83
+ flat out vec2 vBorderWidth;
84
+ flat out vec4 vIndex;
85
+
86
+ void main(void) {
87
+ int vid = gl_VertexID;
88
+ vec2 position = aPosition; // TODO make this a vec3, simplifies some code below
89
+
90
+ if(aVertType == `.concat(su,`) {
91
+ float texX = aTex.x; // texture coordinates
92
+ float texY = aTex.y;
93
+ float texW = aTex.z;
94
+ float texH = aTex.w;
95
+
96
+ if(vid == 1 || vid == 2 || vid == 4) {
97
+ texX += texW;
98
+ }
99
+ if(vid == 2 || vid == 4 || vid == 5) {
100
+ texY += texH;
101
+ }
102
+
103
+ float d = float(uAtlasSize);
104
+ vTexCoord = vec2(texX / d, texY / d); // tex coords must be between 0 and 1
105
+
106
+ gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);
107
+ }
108
+ else if(aVertType == `).concat(On," || aVertType == ").concat(ya,`
109
+ || aVertType == `).concat(bi," || aVertType == ").concat(ga,`) { // simple shapes
110
+
111
+ // the bounding box is needed by the fragment shader
112
+ vBotLeft = (aTransform * vec3(0, 0, 1)).xy; // flat
113
+ vTopRight = (aTransform * vec3(1, 1, 1)).xy; // flat
114
+ vPosition = (aTransform * vec3(position, 1)).xy; // will be interpolated
115
+
116
+ // calculations are done in the fragment shader, just pass these along
117
+ vColor = aColor;
118
+ vCornerRadius = aCornerRadius;
119
+ vBorderColor = aBorderColor;
120
+ vBorderWidth = aLineWidth;
121
+
122
+ gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);
123
+ }
124
+ else if(aVertType == `).concat(md,`) {
125
+ vec2 source = aPointAPointB.xy;
126
+ vec2 target = aPointAPointB.zw;
127
+
128
+ // adjust the geometry so that the line is centered on the edge
129
+ position.y = position.y - 0.5;
130
+
131
+ // stretch the unit square into a long skinny rectangle
132
+ vec2 xBasis = target - source;
133
+ vec2 yBasis = normalize(vec2(-xBasis.y, xBasis.x));
134
+ vec2 point = source + xBasis * position.x + yBasis * aLineWidth[0] * position.y;
135
+
136
+ gl_Position = vec4(uPanZoomMatrix * vec3(point, 1.0), 1.0);
137
+ vColor = aColor;
138
+ }
139
+ else if(aVertType == `).concat(bd,`) {
140
+ vec2 pointA = aPointAPointB.xy;
141
+ vec2 pointB = aPointAPointB.zw;
142
+ vec2 pointC = aPointCPointD.xy;
143
+ vec2 pointD = aPointCPointD.zw;
144
+
145
+ // adjust the geometry so that the line is centered on the edge
146
+ position.y = position.y - 0.5;
147
+
148
+ vec2 p0, p1, p2, pos;
149
+ if(position.x == 0.0) { // The left side of the unit square
150
+ p0 = pointA;
151
+ p1 = pointB;
152
+ p2 = pointC;
153
+ pos = position;
154
+ } else { // The right side of the unit square, use same approach but flip the geometry upside down
155
+ p0 = pointD;
156
+ p1 = pointC;
157
+ p2 = pointB;
158
+ pos = vec2(0.0, -position.y);
159
+ }
160
+
161
+ vec2 p01 = p1 - p0;
162
+ vec2 p12 = p2 - p1;
163
+ vec2 p21 = p1 - p2;
164
+
165
+ // Find the normal vector.
166
+ vec2 tangent = normalize(normalize(p12) + normalize(p01));
167
+ vec2 normal = vec2(-tangent.y, tangent.x);
168
+
169
+ // Find the vector perpendicular to p0 -> p1.
170
+ vec2 p01Norm = normalize(vec2(-p01.y, p01.x));
171
+
172
+ // Determine the bend direction.
173
+ float sigma = sign(dot(p01 + p21, normal));
174
+ float width = aLineWidth[0];
175
+
176
+ if(sign(pos.y) == -sigma) {
177
+ // This is an intersecting vertex. Adjust the position so that there's no overlap.
178
+ vec2 point = 0.5 * width * normal * -sigma / dot(normal, p01Norm);
179
+ gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0);
180
+ } else {
181
+ // This is a non-intersecting vertex. Treat it like a mitre join.
182
+ vec2 point = 0.5 * width * normal * sigma * dot(normal, p01Norm);
183
+ gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0);
184
+ }
185
+
186
+ vColor = aColor;
187
+ }
188
+ else if(aVertType == `).concat(uu,` && vid < 3) {
189
+ // massage the first triangle into an edge arrow
190
+ if(vid == 0)
191
+ position = vec2(-0.15, -0.3);
192
+ if(vid == 1)
193
+ position = vec2( 0.0, 0.0);
194
+ if(vid == 2)
195
+ position = vec2( 0.15, -0.3);
196
+
197
+ gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);
198
+ vColor = aColor;
199
+ }
200
+ else {
201
+ gl_Position = vec4(2.0, 0.0, 0.0, 1.0); // discard vertex by putting it outside webgl clip space
202
+ }
203
+
204
+ vAtlasId = aAtlasId;
205
+ vVertType = aVertType;
206
+ vIndex = aIndex;
207
+ }
208
+ `),i=this.batchManager.getIndexArray(),o=`#version 300 es
209
+ precision highp float;
210
+
211
+ // declare texture unit for each texture atlas in the batch
212
+ `.concat(i.map(function(l){return"uniform sampler2D uTexture".concat(l,";")}).join(`
213
+ `),`
214
+
215
+ uniform vec4 uBGColor;
216
+ uniform float uZoom;
217
+
218
+ in vec2 vTexCoord;
219
+ in vec4 vColor;
220
+ in vec2 vPosition; // model coordinates
221
+
222
+ flat in int vAtlasId;
223
+ flat in vec4 vIndex;
224
+ flat in int vVertType;
225
+ flat in vec2 vTopRight;
226
+ flat in vec2 vBotLeft;
227
+ flat in vec4 vCornerRadius;
228
+ flat in vec4 vBorderColor;
229
+ flat in vec2 vBorderWidth;
230
+
231
+ out vec4 outColor;
232
+
233
+ `).concat(R1,`
234
+ `).concat(B1,`
235
+ `).concat(L1,`
236
+ `).concat(O1,`
237
+
238
+ vec4 blend(vec4 top, vec4 bot) { // blend colors with premultiplied alpha
239
+ return vec4(
240
+ top.rgb + (bot.rgb * (1.0 - top.a)),
241
+ top.a + (bot.a * (1.0 - top.a))
242
+ );
243
+ }
244
+
245
+ vec4 distInterp(vec4 cA, vec4 cB, float d) { // interpolate color using Signed Distance
246
+ // scale to the zoom level so that borders don't look blurry when zoomed in
247
+ // note 1.5 is an aribitrary value chosen because it looks good
248
+ return mix(cA, cB, 1.0 - smoothstep(0.0, 1.5 / uZoom, abs(d)));
249
+ }
250
+
251
+ void main(void) {
252
+ if(vVertType == `).concat(su,`) {
253
+ // look up the texel from the texture unit
254
+ `).concat(i.map(function(l){return"if(vAtlasId == ".concat(l,") outColor = texture(uTexture").concat(l,", vTexCoord);")}).join(`
255
+ else `),`
256
+ }
257
+ else if(vVertType == `).concat(uu,`) {
258
+ // mimics how canvas renderer uses context.globalCompositeOperation = 'destination-out';
259
+ outColor = blend(vColor, uBGColor);
260
+ outColor.a = 1.0; // make opaque, masks out line under arrow
261
+ }
262
+ else if(vVertType == `).concat(On,` && vBorderWidth == vec2(0.0)) { // simple rectangle with no border
263
+ outColor = vColor; // unit square is already transformed to the rectangle, nothing else needs to be done
264
+ }
265
+ else if(vVertType == `).concat(On," || vVertType == ").concat(ya,`
266
+ || vVertType == `).concat(bi," || vVertType == ").concat(ga,`) { // use SDF
267
+
268
+ float outerBorder = vBorderWidth[0];
269
+ float innerBorder = vBorderWidth[1];
270
+ float borderPadding = outerBorder * 2.0;
271
+ float w = vTopRight.x - vBotLeft.x - borderPadding;
272
+ float h = vTopRight.y - vBotLeft.y - borderPadding;
273
+ vec2 b = vec2(w/2.0, h/2.0); // half width, half height
274
+ vec2 p = vPosition - vec2(vTopRight.x - b[0] - outerBorder, vTopRight.y - b[1] - outerBorder); // translate to center
275
+
276
+ float d; // signed distance
277
+ if(vVertType == `).concat(On,`) {
278
+ d = rectangleSD(p, b);
279
+ } else if(vVertType == `).concat(ya,` && w == h) {
280
+ d = circleSD(p, b.x); // faster than ellipse
281
+ } else if(vVertType == `).concat(ya,`) {
282
+ d = ellipseSD(p, b);
283
+ } else {
284
+ d = roundRectangleSD(p, b, vCornerRadius.wzyx);
285
+ }
286
+
287
+ // use the distance to interpolate a color to smooth the edges of the shape, doesn't need multisampling
288
+ // we must smooth colors inwards, because we can't change pixels outside the shape's bounding box
289
+ if(d > 0.0) {
290
+ if(d > outerBorder) {
291
+ discard;
292
+ } else {
293
+ outColor = distInterp(vBorderColor, vec4(0), d - outerBorder);
294
+ }
295
+ } else {
296
+ if(d > innerBorder) {
297
+ vec4 outerColor = outerBorder == 0.0 ? vec4(0) : vBorderColor;
298
+ vec4 innerBorderColor = blend(vBorderColor, vColor);
299
+ outColor = distInterp(innerBorderColor, outerColor, d);
300
+ }
301
+ else {
302
+ vec4 outerColor;
303
+ if(innerBorder == 0.0 && outerBorder == 0.0) {
304
+ outerColor = vec4(0);
305
+ } else if(innerBorder == 0.0) {
306
+ outerColor = vBorderColor;
307
+ } else {
308
+ outerColor = blend(vBorderColor, vColor);
309
+ }
310
+ outColor = distInterp(vColor, outerColor, d - innerBorder);
311
+ }
312
+ }
313
+ }
314
+ else {
315
+ outColor = vColor;
316
+ }
317
+
318
+ `).concat(t.picking?`if(outColor.a == 0.0) discard;
319
+ else outColor = vIndex;`:"",`
320
+ }
321
+ `),s=v1(n,a,o);s.aPosition=n.getAttribLocation(s,"aPosition"),s.aIndex=n.getAttribLocation(s,"aIndex"),s.aVertType=n.getAttribLocation(s,"aVertType"),s.aTransform=n.getAttribLocation(s,"aTransform"),s.aAtlasId=n.getAttribLocation(s,"aAtlasId"),s.aTex=n.getAttribLocation(s,"aTex"),s.aPointAPointB=n.getAttribLocation(s,"aPointAPointB"),s.aPointCPointD=n.getAttribLocation(s,"aPointCPointD"),s.aLineWidth=n.getAttribLocation(s,"aLineWidth"),s.aColor=n.getAttribLocation(s,"aColor"),s.aCornerRadius=n.getAttribLocation(s,"aCornerRadius"),s.aBorderColor=n.getAttribLocation(s,"aBorderColor"),s.uPanZoomMatrix=n.getUniformLocation(s,"uPanZoomMatrix"),s.uAtlasSize=n.getUniformLocation(s,"uAtlasSize"),s.uBGColor=n.getUniformLocation(s,"uBGColor"),s.uZoom=n.getUniformLocation(s,"uZoom"),s.uTextures=[];for(var u=0;u<this.batchManager.getMaxAtlasesPerBatch();u++)s.uTextures.push(n.getUniformLocation(s,"uTexture".concat(u)));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 n=this.maxInstances,a=this.gl,i=this.program,o=a.createVertexArray();return a.bindVertexArray(o),E1(a,"vec2",i.aPosition,t),this.transformBuffer=C1(a,n,i.aTransform),this.indexBuffer=pr(a,n,"vec4",i.aIndex),this.vertTypeBuffer=pr(a,n,"int",i.aVertType),this.atlasIdBuffer=pr(a,n,"int",i.aAtlasId),this.texBuffer=pr(a,n,"vec4",i.aTex),this.pointAPointBBuffer=pr(a,n,"vec4",i.aPointAPointB),this.pointCPointDBuffer=pr(a,n,"vec4",i.aPointCPointD),this.lineWidthBuffer=pr(a,n,"vec2",i.aLineWidth),this.colorBuffer=pr(a,n,"vec4",i.aColor),this.cornerRadiusBuffer=pr(a,n,"vec4",i.aCornerRadius),this.borderColorBuffer=pr(a,n,"vec4",i.aBorderColor),a.bindVertexArray(null),o}},{key:"buffers",get:function(){var t=this;return this._buffers||(this._buffers=Object.keys(this).filter(function(n){return $r(n,"Buffer")}).map(function(n){return t[n]})),this._buffers}},{key:"startFrame",value:function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Ca.SCREEN;this.panZoomMatrix=t,this.renderTarget=n,this.batchDebugInfo=[],this.wrappedCount=0,this.simpleCount=0,this.startBatch()}},{key:"startBatch",value:function(){this.instanceCount=0,this.batchManager.startBatch()}},{key:"endFrame",value:function(){this.endBatch()}},{key:"_isVisible",value:function(t,n){return t.visible()?n&&n.isVisible?n.isVisible(t):!0:!1}},{key:"drawTexture",value:function(t,n,a){var i=this.atlasManager,o=this.batchManager,s=i.getRenderTypeOpts(a);if(this._isVisible(t,s)&&!(t.isEdge()&&!this._isValidEdge(t))){if(this.renderTarget.picking&&s.getTexPickingMode){var u=s.getTexPickingMode(t);if(u===Hi.IGNORE)return;if(u==Hi.USE_BB){this.drawPickingRectangle(t,n,a);return}}var l=i.getAtlasInfo(t,a),c=Vt(l),f;try{for(c.s();!(f=c.n()).done;){var d=f.value,h=d.atlas,v=d.tex1,y=d.tex2;o.canAddToCurrentBatch(h)||this.endBatch();for(var g=o.getAtlasIndexForBatch(h),p=0,m=[[v,!0],[y,!1]];p<m.length;p++){var b=ut(m[p],2),x=b[0],E=b[1];if(x.w!=0){var S=this.instanceCount;this.vertTypeBuffer.getView(S)[0]=su;var w=this.indexBuffer.getView(S);Ln(n,w);var k=this.atlasIdBuffer.getView(S);k[0]=g;var _=this.texBuffer.getView(S);_[0]=x.x,_[1]=x.y,_[2]=x.w,_[3]=x.h;var C=this.transformBuffer.getMatrixView(S);this.setTransformMatrix(t,C,s,d,E),this.instanceCount++,E||this.wrappedCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}catch(T){c.e(T)}finally{c.f()}}}},{key:"setTransformMatrix",value:function(t,n,a,i){var o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,s=0;if(a.shapeProps&&a.shapeProps.padding&&(s=t.pstyle(a.shapeProps.padding).pfValue),i){var u=i.bb,l=i.tex1,c=i.tex2,f=l.w/(l.w+c.w);o||(f=1-f);var d=this._getAdjustedBB(u,s,o,f);this._applyTransformMatrix(n,d,a,t)}else{var h=a.getBoundingBox(t),v=this._getAdjustedBB(h,s,!0,1);this._applyTransformMatrix(n,v,a,t)}}},{key:"_applyTransformMatrix",value:function(t,n,a,i){var o,s;gd(t);var u=a.getRotation?a.getRotation(i):0;if(u!==0){var l=a.getRotationPoint(i),c=l.x,f=l.y;Ai(t,t,[c,f]),yd(t,t,u);var d=a.getRotationOffset(i);o=d.x+(n.xOffset||0),s=d.y+(n.yOffset||0)}else o=n.x1,s=n.y1;Ai(t,t,[o,s]),Pu(t,t,[n.w,n.h])}},{key:"_getAdjustedBB",value:function(t,n,a,i){var o=t.x1,s=t.y1,u=t.w,l=t.h,c=t.yOffset;n&&(o-=n,s-=n,u+=2*n,l+=2*n);var f=0,d=u*i;return a&&i<1?u=d:!a&&i<1&&(f=u-d,o+=f,u=d),{x1:o,y1:s,w:u,h:l,xOffset:f,yOffset:c}}},{key:"drawPickingRectangle",value:function(t,n,a){var i=this.atlasManager.getRenderTypeOpts(a),o=this.instanceCount;this.vertTypeBuffer.getView(o)[0]=On;var s=this.indexBuffer.getView(o);Ln(n,s);var u=this.colorBuffer.getView(o);fn([0,0,0],1,u);var l=this.transformBuffer.getMatrixView(o);this.setTransformMatrix(t,l,i),this.simpleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}},{key:"drawNode",value:function(t,n,a){var i=this.simpleShapeOptions.get(a);if(this._isVisible(t,i)){var o=i.shapeProps,s=this._getVertTypeForShape(t,o.shape);if(s===void 0||i.isSimple&&!i.isSimple(t,this.renderTarget)){this.drawTexture(t,n,a);return}var u=this.instanceCount;if(this.vertTypeBuffer.getView(u)[0]=s,s===bi||s===ga){var l=i.getBoundingBox(t),c=this._getCornerRadius(t,o.radius,l),f=this.cornerRadiusBuffer.getView(u);f[0]=c,f[1]=c,f[2]=c,f[3]=c,s===ga&&(f[0]=0,f[2]=0)}var d=this.indexBuffer.getView(u);Ln(n,d);var h=this.renderTarget.picking?1:a==="node-body"?t.effectiveOpacity():1,v=this.renderTarget.picking?1:t.pstyle(o.opacity).value*h,y=t.pstyle(o.color).value,g=this.colorBuffer.getView(u);fn(y,v,g);var p=this.lineWidthBuffer.getView(u);if(p[0]=0,p[1]=0,o.border){var m=t.pstyle("border-width").value;if(m>0){var b=t.pstyle("border-color").value,x=h*t.pstyle("border-opacity").value,E=this.borderColorBuffer.getView(u);fn(b,x,E);var S=t.pstyle("border-position").value;if(S==="inside")p[0]=0,p[1]=-m;else if(S==="outside")p[0]=m,p[1]=0;else{var w=m/2;p[0]=w,p[1]=-w}}}var k=this.transformBuffer.getMatrixView(u);this.setTransformMatrix(t,k,i),this.simpleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}},{key:"_getVertTypeForShape",value:function(t,n){var a=t.pstyle(n).value;switch(a){case"rectangle":return On;case"ellipse":return ya;case"roundrectangle":case"round-rectangle":return bi;case"bottom-round-rectangle":return ga;default:return}}},{key:"_getCornerRadius",value:function(t,n,a){var i=a.w,o=a.h;if(t.pstyle(n).value==="auto")return Qr(i,o);var s=t.pstyle(n).pfValue,u=i/2,l=o/2;return Math.min(s,l,u)}},{key:"drawEdgeArrow",value:function(t,n,a){if(t.visible()){var i=t._private.rscratch,o,s,u;if(a==="source"?(o=i.arrowStartX,s=i.arrowStartY,u=i.srcArrowAngle):(o=i.arrowEndX,s=i.arrowEndY,u=i.tgtArrowAngle),!(isNaN(o)||o==null||isNaN(s)||s==null||isNaN(u)||u==null)){var l=t.pstyle(a+"-arrow-shape").value;if(l!=="none"){var c=t.pstyle(a+"-arrow-color").value,f=t.pstyle("opacity").value,d=t.pstyle("line-opacity").value,h=f*d,v=t.pstyle("width").pfValue,y=t.pstyle("arrow-scale").value,g=this.r.getArrowWidth(v,y),p=this.instanceCount,m=this.transformBuffer.getMatrixView(p);gd(m),Ai(m,m,[o,s]),Pu(m,m,[g,g]),yd(m,m,u),this.vertTypeBuffer.getView(p)[0]=uu;var b=this.indexBuffer.getView(p);Ln(n,b);var x=this.colorBuffer.getView(p);fn(c,h,x),this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}},{key:"drawEdgeLine",value:function(t,n){if(t.visible()){var a=this._getEdgePoints(t);if(a){var i=t.pstyle("opacity").value,o=t.pstyle("line-opacity").value,s=t.pstyle("width").pfValue,u=t.pstyle("line-color").value,l=i*o;if(a.length/2+this.instanceCount>this.maxInstances&&this.endBatch(),a.length==4){var c=this.instanceCount;this.vertTypeBuffer.getView(c)[0]=md;var f=this.indexBuffer.getView(c);Ln(n,f);var d=this.colorBuffer.getView(c);fn(u,l,d);var h=this.lineWidthBuffer.getView(c);h[0]=s;var v=this.pointAPointBBuffer.getView(c);v[0]=a[0],v[1]=a[1],v[2]=a[2],v[3]=a[3],this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}else for(var y=0;y<a.length-2;y+=2){var g=this.instanceCount;this.vertTypeBuffer.getView(g)[0]=bd;var p=this.indexBuffer.getView(g);Ln(n,p);var m=this.colorBuffer.getView(g);fn(u,l,m);var b=this.lineWidthBuffer.getView(g);b[0]=s;var x=a[y-2],E=a[y-1],S=a[y],w=a[y+1],k=a[y+2],_=a[y+3],C=a[y+4],T=a[y+5];y==0&&(x=2*S-k+.001,E=2*w-_+.001),y==a.length-4&&(C=2*k-S+.001,T=2*_-w+.001);var D=this.pointAPointBBuffer.getView(g);D[0]=x,D[1]=E,D[2]=S,D[3]=w;var A=this.pointCPointDBuffer.getView(g);A[0]=k,A[1]=_,A[2]=C,A[3]=T,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}},{key:"_isValidEdge",value:function(t){var n=t._private.rscratch;return!(n.badLine||n.allpts==null||isNaN(n.allpts[0]))}},{key:"_getEdgePoints",value:function(t){var n=t._private.rscratch;if(this._isValidEdge(t)){var a=n.allpts;if(a.length==4)return a;var i=this._getNumSegments(t);return this._getCurveSegmentPoints(a,i)}}},{key:"_getNumSegments",value:function(t){var n=15;return Math.min(Math.max(n,5),this.maxInstances)}},{key:"_getCurveSegmentPoints",value:function(t,n){if(t.length==4)return t;for(var a=Array((n+1)*2),i=0;i<=n;i++)if(i==0)a[0]=t[0],a[1]=t[1];else if(i==n)a[i*2]=t[t.length-2],a[i*2+1]=t[t.length-1];else{var o=i/n;this._setCurvePoint(t,o,a,i*2)}return a}},{key:"_setCurvePoint",value:function(t,n,a,i){if(t.length<=2)a[i]=t[0],a[i+1]=t[1];else{for(var o=Array(t.length-2),s=0;s<o.length;s+=2){var u=(1-n)*t[s]+n*t[s+2],l=(1-n)*t[s+1]+n*t[s+3];o[s]=u,o[s+1]=l}return this._setCurvePoint(o,n,a,i)}}},{key:"endBatch",value:function(){var t=this.gl,n=this.vao,a=this.vertexCount,i=this.instanceCount;if(i!==0){var o=this.renderTarget.picking?this.pickingProgram:this.program;t.useProgram(o),t.bindVertexArray(n);var s=Vt(this.buffers),u;try{for(s.s();!(u=s.n()).done;){var l=u.value;l.bufferSubData(i)}}catch(v){s.e(v)}finally{s.f()}for(var c=this.batchManager.getAtlases(),f=0;f<c.length;f++)c[f].bufferIfNeeded(t);for(var d=0;d<c.length;d++)t.activeTexture(t.TEXTURE0+d),t.bindTexture(t.TEXTURE_2D,c[d].texture),t.uniform1i(o.uTextures[d],d);t.uniform1f(o.uZoom,p1(this.r)),t.uniformMatrix3fv(o.uPanZoomMatrix,!1,this.panZoomMatrix),t.uniform1i(o.uAtlasSize,this.batchManager.getAtlasSize());var h=fn(this.bgColor,1);t.uniform4fv(o.uBGColor,h),t.drawArraysInstanced(t.TRIANGLES,0,a,i),t.bindVertexArray(null),t.bindTexture(t.TEXTURE_2D,null),this.debug&&this.batchDebugInfo.push({count:i,atlasCount:c.length}),this.startBatch()}}},{key:"getDebugInfo",value:function(){var t=this.atlasManager.getDebugInfo(),n=t.reduce(function(o,s){return o+s.atlasCount},0),a=this.batchDebugInfo,i=a.reduce(function(o,s){return o+s.count},0);return{atlasInfo:t,totalAtlases:n,wrappedCount:this.wrappedCount,simpleCount:this.simpleCount,batchCount:a.length,batchInfo:a,totalInstances:i}}}])})(),nh={};nh.initWebgl=function(r,e){var t=this,n=t.data.contexts[t.WEBGL];r.bgColor=N1(t),r.webglTexSize=Math.min(r.webglTexSize,n.getParameter(n.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,n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS)),t.webglDebug=r.webglDebug,t.webglDebugShowAtlases=r.webglDebugShowAtlases,t.pickingFrameBuffer=S1(n),t.pickingFrameBuffer.needsDraw=!0,t.drawing=new I1(t,n,r);var a=function(f){return function(d){return t.getTextAngle(d,f)}},i=function(f){return function(d){var h=d.pstyle(f);return h&&h.value}},o=function(f){return function(d){return d.pstyle("".concat(f,"-opacity")).value>0}},s=function(f){var d=f.pstyle("text-events").strValue==="yes";return d?Hi.USE_BB:Hi.IGNORE},u=function(f){var d=f.position(),h=d.x,v=d.y,y=f.outerWidth(),g=f.outerHeight();return{w:y,h:g,x1:h-y/2,y1:v-g/2}};t.drawing.addAtlasCollection("node",{texRows:r.webglTexRowsNodes}),t.drawing.addAtlasCollection("label",{texRows:r.webglTexRows}),t.drawing.addTextureAtlasRenderType("node-body",{collection:"node",getKey:e.getStyleKey,getBoundingBox:e.getElementBox,drawElement:e.drawElement}),t.drawing.addSimpleShapeRenderType("node-body",{getBoundingBox:u,isSimple:y1,shapeProps:{shape:"shape",color:"background-color",opacity:"background-opacity",radius:"corner-radius",border:!0}}),t.drawing.addSimpleShapeRenderType("node-overlay",{getBoundingBox:u,isVisible:o("overlay"),shapeProps:{shape:"overlay-shape",color:"overlay-color",opacity:"overlay-opacity",padding:"overlay-padding",radius:"overlay-corner-radius"}}),t.drawing.addSimpleShapeRenderType("node-underlay",{getBoundingBox:u,isVisible:o("underlay"),shapeProps:{shape:"underlay-shape",color:"underlay-color",opacity:"underlay-opacity",padding:"underlay-padding",radius:"underlay-corner-radius"}}),t.drawing.addTextureAtlasRenderType("label",{collection:"label",getTexPickingMode:s,getKey:lu(e.getLabelKey,null),getBoundingBox:cu(e.getLabelBox,null),drawClipped:!0,drawElement:e.drawLabel,getRotation:a(null),getRotationPoint:e.getLabelRotationPoint,getRotationOffset:e.getLabelRotationOffset,isVisible:i("label")}),t.drawing.addTextureAtlasRenderType("edge-source-label",{collection:"label",getTexPickingMode:s,getKey:lu(e.getSourceLabelKey,"source"),getBoundingBox:cu(e.getSourceLabelBox,"source"),drawClipped:!0,drawElement:e.drawSourceLabel,getRotation:a("source"),getRotationPoint:e.getSourceLabelRotationPoint,getRotationOffset:e.getSourceLabelRotationOffset,isVisible:i("source-label")}),t.drawing.addTextureAtlasRenderType("edge-target-label",{collection:"label",getTexPickingMode:s,getKey:lu(e.getTargetLabelKey,"target"),getBoundingBox:cu(e.getTargetLabelBox,"target"),drawClipped:!0,drawElement:e.drawTargetLabel,getRotation:a("target"),getRotationPoint:e.getTargetLabelRotationPoint,getRotationOffset:e.getTargetLabelRotationOffset,isVisible:i("target-label")});var l=Fa(function(){console.log("garbage collect flag set"),t.data.gc=!0},1e4);t.onUpdateEleCalcs(function(c,f){var d=!1;f&&f.length>0&&(d|=t.drawing.invalidate(f)),d&&l()}),z1(t)};function N1(r){var e=r.cy.container(),t=e&&e.style&&e.style.backgroundColor||"white";return Ad(t)}function ah(r,e){var t=r._private.rscratch;return zt(t,"labelWrapCachedLines",e)||[]}var lu=function(e,t){return function(n){var a=e(n),i=ah(n,t);return i.length>1?i.map(function(o,s){return"".concat(a,"_").concat(s)}):a}},cu=function(e,t){return function(n,a){var i=e(n);if(typeof a=="string"){var o=a.indexOf("_");if(o>0){var s=Number(a.substring(o+1)),u=ah(n,t),l=i.h/u.length,c=l*s,f=i.y1+c;return{x1:i.x1,w:i.w,y1:f,h:l,yOffset:c}}}return i}};function z1(r){{var e=r.render;r.render=function(i){i=i||{};var o=r.cy;r.webgl&&(o.zoom()>Zv?(F1(r),e.call(r,i)):(V1(r),oh(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,u){return W1(r,i,o)};{var n=r.invalidateCachedZSortedEles;r.invalidateCachedZSortedEles=function(){n.call(r),r.pickingFrameBuffer.needsDraw=!0}}{var a=r.notify;r.notify=function(i,o){a.call(r,i,o),i==="viewport"||i==="bounds"?r.pickingFrameBuffer.needsDraw=!0:i==="background"&&r.drawing.invalidate(o,{type:"node-body"})}}}function F1(r){var e=r.data.contexts[r.WEBGL];e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT)}function V1(r){var e=function(n){n.save(),n.setTransform(1,0,0,1,0,0),n.clearRect(0,0,r.canvasWidth,r.canvasHeight),n.restore()};e(r.data.contexts[r.NODE]),e(r.data.contexts[r.DRAG])}function q1(r){var e=r.canvasWidth,t=r.canvasHeight,n=rl(r),a=n.pan,i=n.zoom,o=ou();Ai(o,o,[a.x,a.y]),Pu(o,o,[i,i]);var s=ou();T1(s,e,t);var u=ou();return k1(u,s,o),u}function ih(r,e){var t=r.canvasWidth,n=r.canvasHeight,a=rl(r),i=a.pan,o=a.zoom;e.setTransform(1,0,0,1,0,0),e.clearRect(0,0,t,n),e.translate(i.x,i.y),e.scale(o,o)}function G1(r,e){r.drawSelectionRectangle(e,function(t){return ih(r,t)})}function H1(r){var e=r.data.contexts[r.NODE];e.save(),ih(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 $1(r){var e=function(a,i,o){for(var s=a.atlasManager.getAtlasCollection(i),u=r.data.contexts[r.NODE],l=s.atlases,c=0;c<l.length;c++){var f=l[c],d=f.canvas;if(d){var h=d.width,v=d.height,y=h*c,g=d.height*o,p=.4;u.save(),u.scale(p,p),u.drawImage(d,y,g),u.strokeStyle="black",u.rect(y,g,h,v),u.stroke(),u.restore()}}},t=0;e(r.drawing,"node",t++),e(r.drawing,"label",t++)}function U1(r,e,t,n,a){var i,o,s,u,l=rl(r),c=l.pan,f=l.zoom;{var d=g1(r,c,f,e,t),h=ut(d,2),v=h[0],y=h[1],g=6;i=v-g/2,o=y-g/2,s=g,u=g}if(s===0||u===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),oh(r,null,Ca.PICKING),r.pickingFrameBuffer.needsDraw=!1);var m=s*u,b=new Uint8Array(m*4);p.readPixels(i,o,s,u,p.RGBA,p.UNSIGNED_BYTE,b),p.bindFramebuffer(p.FRAMEBUFFER,null);for(var x=new Set,E=0;E<m;E++){var S=b.slice(E*4,E*4+4),w=b1(S)-1;w>=0&&x.add(w)}return x}function W1(r,e,t){var n=U1(r,e,t),a=r.getCachedZSortedEles(),i,o,s=Vt(n),u;try{for(s.s();!(u=s.n()).done;){var l=u.value,c=a[l];if(!i&&c.isNode()&&(i=c),!o&&c.isEdge()&&(o=c),i&&o)break}}catch(f){s.e(f)}finally{s.f()}return[i,o].filter(Boolean)}function fu(r,e,t){var n=r.drawing;e+=1,t.isNode()?(n.drawNode(t,e,"node-underlay"),n.drawNode(t,e,"node-body"),n.drawTexture(t,e,"label"),n.drawNode(t,e,"node-overlay")):(n.drawEdgeLine(t,e),n.drawEdgeArrow(t,e,"source"),n.drawEdgeArrow(t,e,"target"),n.drawTexture(t,e,"label"),n.drawTexture(t,e,"edge-source-label"),n.drawTexture(t,e,"edge-target-label"))}function oh(r,e,t){var n;r.webglDebug&&(n=performance.now());var a=r.drawing,i=0;if(t.screen&&r.data.canvasNeedsRedraw[r.SELECT_BOX]&&G1(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=q1(r),u=r.getCachedZSortedEles();if(i=u.length,a.startFrame(s,t),t.screen){for(var l=0;l<u.nondrag.length;l++)fu(r,l,u.nondrag[l]);for(var c=0;c<u.drag.length;c++)fu(r,c,u.drag[c])}else if(t.picking)for(var f=0;f<u.length;f++)fu(r,f,u[f]);a.endFrame(),t.screen&&r.webglDebugShowAtlases&&(H1(r),$1(r)),r.data.canvasNeedsRedraw[r.NODE]=!1,r.data.canvasNeedsRedraw[r.DRAG]=!1}if(r.webglDebug){var d=performance.now(),h=!1,v=Math.ceil(d-n),y=a.getDebugInfo(),g=["".concat(i," elements"),"".concat(y.totalInstances," instances"),"".concat(y.batchCount," batches"),"".concat(y.totalAtlases," atlases"),"".concat(y.wrappedCount," wrapped textures"),"".concat(y.simpleCount," simple shapes")].join(", ");if(h)console.log("WebGL (".concat(t.name,") - time ").concat(v,"ms, ").concat(g));else{console.log("WebGL (".concat(t.name,") - frame time ").concat(v,"ms")),console.log("Totals:"),console.log(" ".concat(g)),console.log("Texture Atlases Used:");var p=y.atlasInfo,m=Vt(p),b;try{for(m.s();!(b=m.n()).done;){var x=b.value;console.log(" ".concat(x.type,": ").concat(x.keyCount," keys, ").concat(x.atlasCount," atlases"))}}catch(E){m.e(E)}finally{m.f()}console.log("")}}r.data.gc&&(console.log("Garbage Collect!"),r.data.gc=!1,a.gc())}var on={};on.drawPolygonPath=function(r,e,t,n,a,i){var o=n/2,s=a/2;r.beginPath&&r.beginPath(),r.moveTo(e+o*i[0],t+s*i[1]);for(var u=1;u<i.length/2;u++)r.lineTo(e+o*i[u*2],t+s*i[u*2+1]);r.closePath()};on.drawRoundPolygonPath=function(r,e,t,n,a,i,o){o.forEach(function(s){return Vv(r,s)}),r.closePath()};on.drawRoundRectanglePath=function(r,e,t,n,a,i){var o=n/2,s=a/2,u=i==="auto"?Qr(n,a):Math.min(i,s,o);r.beginPath&&r.beginPath(),r.moveTo(e,t-s),r.arcTo(e+o,t-s,e+o,t,u),r.arcTo(e+o,t+s,e,t+s,u),r.arcTo(e-o,t+s,e-o,t,u),r.arcTo(e-o,t-s,e,t-s,u),r.lineTo(e,t-s),r.closePath()};on.drawBottomRoundRectanglePath=function(r,e,t,n,a,i){var o=n/2,s=a/2,u=i==="auto"?Qr(n,a):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,u),r.arcTo(e-o,t+s,e-o,t,u),r.lineTo(e-o,t-s),r.lineTo(e,t-s),r.closePath()};on.drawCutRectanglePath=function(r,e,t,n,a,i,o){var s=n/2,u=a/2,l=o==="auto"?Gu():o;r.beginPath&&r.beginPath(),r.moveTo(e-s+l,t-u),r.lineTo(e+s-l,t-u),r.lineTo(e+s,t-u+l),r.lineTo(e+s,t+u-l),r.lineTo(e+s-l,t+u),r.lineTo(e-s+l,t+u),r.lineTo(e-s,t+u-l),r.lineTo(e-s,t-u+l),r.closePath()};on.drawBarrelPath=function(r,e,t,n,a){var i=n/2,o=a/2,s=e-i,u=e+i,l=t-o,c=t+o,f=hu(n,a),d=f.widthOffset,h=f.heightOffset,v=f.ctrlPtOffsetPct*d;r.beginPath&&r.beginPath(),r.moveTo(s,l+h),r.lineTo(s,c-h),r.quadraticCurveTo(s+v,c,s+d,c),r.lineTo(u-d,c),r.quadraticCurveTo(u-v,c,u,c-h),r.lineTo(u,l+h),r.quadraticCurveTo(u-v,l,u-d,l),r.lineTo(s+d,l),r.quadraticCurveTo(s+v,l,s,l+h),r.closePath()};var xd=Math.sin(0),wd=Math.cos(0),Du={},Au={},sh=Math.PI/40;for(dn=0*Math.PI;dn<2*Math.PI;dn+=sh)Du[dn]=Math.sin(dn),Au[dn]=Math.cos(dn);var dn;on.drawEllipsePath=function(r,e,t,n,a){if(r.beginPath&&r.beginPath(),r.ellipse)r.ellipse(e,t,n/2,a/2,0,0,2*Math.PI);else for(var i,o,s=n/2,u=a/2,l=0*Math.PI;l<2*Math.PI;l+=sh)i=e-s*Du[l]*xd+s*Au[l]*wd,o=t+u*Au[l]*xd+u*Du[l]*wd,l===0?r.moveTo(i,o):r.lineTo(i,o);r.closePath()};var Ua={};Ua.createBuffer=function(r,e){var t=document.createElement("canvas");return t.width=r,t.height=e,[t,t.getContext("2d")]};Ua.bufferCanvasImage=function(r){var e=this.cy,t=e.mutableElements(),n=t.boundingBox(),a=this.findContainerClientCoords(),i=r.full?Math.ceil(n.w):a[2],o=r.full?Math.ceil(n.h):a[3],s=ae(r.maxWidth)||ae(r.maxHeight),u=this.getPixelRatio(),l=1;if(r.scale!==void 0)i*=r.scale,o*=r.scale,l=r.scale;else if(s){var c=1/0,f=1/0;ae(r.maxWidth)&&(c=l*r.maxWidth/i),ae(r.maxHeight)&&(f=l*r.maxHeight/o),l=Math.min(c,f),i*=l,o*=l}s||(i*=u,o*=u,l*=u);var d=document.createElement("canvas");d.width=i,d.height=o,d.style.width=i+"px",d.style.height=o+"px";var h=d.getContext("2d");if(i>0&&o>0){h.clearRect(0,0,i,o),h.globalCompositeOperation="source-over";var v=this.getCachedZSortedEles();if(r.full)h.translate(-n.x1*l,-n.y1*l),h.scale(l,l),this.drawElements(h,v),h.scale(1/l,1/l),h.translate(n.x1*l,n.y1*l);else{var y=e.pan(),g={x:y.x*l,y:y.y*l};l*=e.zoom(),h.translate(g.x,g.y),h.scale(l,l),this.drawElements(h,v),h.scale(1/l,1/l),h.translate(-g.x,-g.y)}r.bg&&(h.globalCompositeOperation="destination-over",h.fillStyle=r.bg,h.rect(0,0,i,o),h.fill())}return d};function X1(r,e){for(var t=atob(r),n=new ArrayBuffer(t.length),a=new Uint8Array(n),i=0;i<t.length;i++)a[i]=t.charCodeAt(i);return new Blob([n],{type:e})}function Ed(r){var e=r.indexOf(",");return r.substr(e+1)}function uh(r,e,t){var n=function(){return e.toDataURL(t,r.quality)};switch(r.output){case"blob-promise":return new Yn(function(a,i){try{e.toBlob(function(o){o!=null?a(o):i(new Error("`canvas.toBlob()` sent a null value in its callback"))},t,r.quality)}catch(o){i(o)}});case"blob":return X1(Ed(n()),t);case"base64":return Ed(n());default:return n()}}Ua.png=function(r){return uh(r,this.bufferCanvasImage(r),"image/png")};Ua.jpg=function(r){return uh(r,this.bufferCanvasImage(r),"image/jpeg")};var lh={};lh.nodeShapeImpl=function(r,e,t,n,a,i,o,s){switch(r){case"ellipse":return this.drawEllipsePath(e,t,n,a,i);case"polygon":return this.drawPolygonPath(e,t,n,a,i,o);case"round-polygon":return this.drawRoundPolygonPath(e,t,n,a,i,o,s);case"roundrectangle":case"round-rectangle":return this.drawRoundRectanglePath(e,t,n,a,i,s);case"cutrectangle":case"cut-rectangle":return this.drawCutRectanglePath(e,t,n,a,i,o,s);case"bottomroundrectangle":case"bottom-round-rectangle":return this.drawBottomRoundRectanglePath(e,t,n,a,i,s);case"barrel":return this.drawBarrelPath(e,t,n,a,i)}};var Y1=ch,De=ch.prototype;De.CANVAS_LAYERS=3;De.SELECT_BOX=0;De.DRAG=1;De.NODE=2;De.WEBGL=3;De.CANVAS_TYPES=["2d","2d","2d","webgl2"];De.BUFFER_COUNT=3;De.TEXTURE_BUFFER=0;De.MOTIONBLUR_BUFFER_NODE=1;De.MOTIONBLUR_BUFFER_DRAG=2;function ch(r){var e=this,t=e.cy.window(),n=t.document;r.webgl&&(De.CANVAS_LAYERS=e.CANVAS_LAYERS=4,console.log("webgl rendering enabled")),e.data={canvases:new Array(De.CANVAS_LAYERS),contexts:new Array(De.CANVAS_LAYERS),canvasNeedsRedraw:new Array(De.CANVAS_LAYERS),bufferCanvases:new Array(De.BUFFER_COUNT),bufferContexts:new Array(De.CANVAS_LAYERS)};var a="-webkit-tap-highlight-color",i="rgba(0,0,0,0)";e.data.canvasContainer=n.createElement("div");var o=e.data.canvasContainer.style;e.data.canvasContainer.style[a]=i,o.position="relative",o.zIndex="0",o.overflow="hidden";var s=r.cy.container();s.appendChild(e.data.canvasContainer),s.style[a]=i;var u={"-webkit-user-select":"none","-moz-user-select":"-moz-none","user-select":"none","-webkit-tap-highlight-color":"rgba(0,0,0,0)","outline-style":"none"};Vp()&&(u["-ms-touch-action"]="none",u["touch-action"]="none");for(var l=0;l<De.CANVAS_LAYERS;l++){var c=e.data.canvases[l]=n.createElement("canvas"),f=De.CANVAS_TYPES[l];e.data.contexts[l]=c.getContext(f),e.data.contexts[l]||Qe("Could not create canvas of type "+f),Object.keys(u).forEach(function($){c.style[$]=u[$]}),c.style.position="absolute",c.setAttribute("data-id","layer"+l),c.style.zIndex=String(De.CANVAS_LAYERS-l),e.data.canvasContainer.appendChild(c),e.data.canvasNeedsRedraw[l]=!1}e.data.topCanvas=e.data.canvases[0],e.data.canvases[De.NODE].setAttribute("data-id","layer"+De.NODE+"-node"),e.data.canvases[De.SELECT_BOX].setAttribute("data-id","layer"+De.SELECT_BOX+"-selectbox"),e.data.canvases[De.DRAG].setAttribute("data-id","layer"+De.DRAG+"-drag"),e.data.canvases[De.WEBGL]&&e.data.canvases[De.WEBGL].setAttribute("data-id","layer"+De.WEBGL+"-webgl");for(var l=0;l<De.BUFFER_COUNT;l++)e.data.bufferCanvases[l]=n.createElement("canvas"),e.data.bufferContexts[l]=e.data.bufferCanvases[l].getContext("2d"),e.data.bufferCanvases[l].style.position="absolute",e.data.bufferCanvases[l].setAttribute("data-id","buffer"+l),e.data.bufferCanvases[l].style.zIndex=String(-l-1),e.data.bufferCanvases[l].style.visibility="hidden";e.pathsEnabled=!0;var d=Rt(),h=function(O){return{x:(O.x1+O.x2)/2,y:(O.y1+O.y2)/2}},v=function(O){return{x:-O.w/2,y:-O.h/2}},y=function(O){var z=O[0]._private,V=z.oldBackgroundTimestamp===z.backgroundTimestamp;return!V},g=function(O){return O[0]._private.nodeKey},p=function(O){return O[0]._private.labelStyleKey},m=function(O){return O[0]._private.sourceLabelStyleKey},b=function(O){return O[0]._private.targetLabelStyleKey},x=function(O,z,V,W,re){return e.drawElement(O,z,V,!1,!1,re)},E=function(O,z,V,W,re){return e.drawElementText(O,z,V,W,"main",re)},S=function(O,z,V,W,re){return e.drawElementText(O,z,V,W,"source",re)},w=function(O,z,V,W,re){return e.drawElementText(O,z,V,W,"target",re)},k=function(O){return O.boundingBox(),O[0]._private.bodyBounds},_=function(O){return O.boundingBox(),O[0]._private.labelBounds.main||d},C=function(O){return O.boundingBox(),O[0]._private.labelBounds.source||d},T=function(O){return O.boundingBox(),O[0]._private.labelBounds.target||d},D=function(O,z){return z},A=function(O){return h(k(O))},R=function(O,z,V){var W=O?O+"-":"";return{x:z.x+V.pstyle(W+"text-margin-x").pfValue,y:z.y+V.pstyle(W+"text-margin-y").pfValue}},M=function(O,z,V){var W=O[0]._private.rscratch;return{x:W[z],y:W[V]}},L=function(O){return R("",M(O,"labelX","labelY"),O)},B=function(O){return R("source",M(O,"sourceLabelX","sourceLabelY"),O)},I=function(O){return R("target",M(O,"targetLabelX","targetLabelY"),O)},H=function(O){return v(k(O))},q=function(O){return v(C(O))},N=function(O){return v(T(O))},G=function(O){var z=_(O),V=v(_(O));if(O.isNode()){switch(O.pstyle("text-halign").value){case"left":V.x=-z.w-(z.leftPad||0);break;case"right":V.x=-(z.rightPad||0);break}switch(O.pstyle("text-valign").value){case"top":V.y=-z.h-(z.topPad||0);break;case"bottom":V.y=-(z.botPad||0);break}}return V},X=e.data.eleTxrCache=new xa(e,{getKey:g,doesEleInvalidateKey:y,drawElement:x,getBoundingBox:k,getRotationPoint:A,getRotationOffset:H,allowEdgeTxrCaching:!1,allowParentTxrCaching:!1}),j=e.data.lblTxrCache=new xa(e,{getKey:p,drawElement:E,getBoundingBox:_,getRotationPoint:L,getRotationOffset:G,isVisible:D}),Q=e.data.slbTxrCache=new xa(e,{getKey:m,drawElement:S,getBoundingBox:C,getRotationPoint:B,getRotationOffset:q,isVisible:D}),Z=e.data.tlbTxrCache=new xa(e,{getKey:b,drawElement:w,getBoundingBox:T,getRotationPoint:I,getRotationOffset:N,isVisible:D}),te=e.data.lyrTxrCache=new Qv(e);e.onUpdateEleCalcs(function(O,z){X.invalidateElements(z),j.invalidateElements(z),Q.invalidateElements(z),Z.invalidateElements(z),te.invalidateElements(z);for(var V=0;V<z.length;V++){var W=z[V]._private;W.oldBackgroundTimestamp=W.backgroundTimestamp}});var ne=function(O){for(var z=0;z<O.length;z++)te.enqueueElementRefinement(O[z].ele)};X.onDequeue(ne),j.onDequeue(ne),Q.onDequeue(ne),Z.onDequeue(ne),r.webgl&&e.initWebgl(r,{getStyleKey:g,getLabelKey:p,getSourceLabelKey:m,getTargetLabelKey:b,drawElement:x,drawLabel:E,drawSourceLabel:S,drawTargetLabel:w,getElementBox:k,getLabelBox:_,getSourceLabelBox:C,getTargetLabelBox:T,getElementRotationPoint:A,getElementRotationOffset:H,getLabelRotationPoint:L,getSourceLabelRotationPoint:B,getTargetLabelRotationPoint:I,getLabelRotationOffset:G,getSourceLabelRotationOffset:q,getTargetLabelRotationOffset:N})}De.redrawHint=function(r,e){var t=this;switch(r){case"eles":t.data.canvasNeedsRedraw[De.NODE]=e;break;case"drag":t.data.canvasNeedsRedraw[De.DRAG]=e;break;case"select":t.data.canvasNeedsRedraw[De.SELECT_BOX]=e;break;case"gc":t.data.gc=!0;break}};var K1=typeof Path2D<"u";De.path2dEnabled=function(r){if(r===void 0)return this.pathsEnabled;this.pathsEnabled=!!r};De.usePaths=function(){return K1&&this.pathsEnabled};De.setImgSmoothing=function(r,e){r.imageSmoothingEnabled!=null?r.imageSmoothingEnabled=e:(r.webkitImageSmoothingEnabled=e,r.mozImageSmoothingEnabled=e,r.msImageSmoothingEnabled=e)};De.getImgSmoothing=function(r){return r.imageSmoothingEnabled!=null?r.imageSmoothingEnabled:r.webkitImageSmoothingEnabled||r.mozImageSmoothingEnabled||r.msImageSmoothingEnabled};De.makeOffscreenCanvas=function(r,e){var t;if((typeof OffscreenCanvas>"u"?"undefined":dt(OffscreenCanvas))!=="undefined")t=new OffscreenCanvas(r,e);else{var n=this.cy.window(),a=n.document;t=a.createElement("canvas"),t.width=r,t.height=e}return t};[Jv,xr,Br,tl,Sn,an,Bt,nh,on,Ua,lh].forEach(function(r){be(De,r)});var Z1=[{name:"null",impl:Nv},{name:"base",impl:Yv},{name:"canvas",impl:Y1}],Q1=[{type:"layout",extensions:xb},{type:"renderer",extensions:Z1}],fh={},dh={};function vh(r,e,t){var n=t,a=function(k){$e("Can not register `"+e+"` for `"+r+"` since `"+k+"` already exists in the prototype and can not be overridden")};if(r==="core"){if(Ra.prototype[e])return a(e);Ra.prototype[e]=t}else if(r==="collection"){if(wt.prototype[e])return a(e);wt.prototype[e]=t}else if(r==="layout"){for(var i=function(k){this.options=k,t.call(this,k),Ne(this._private)||(this._private={}),this._private.cy=k.cy,this._private.listeners=[],this.createEmitter()},o=i.prototype=Object.create(t.prototype),s=[],u=0;u<s.length;u++){var l=s[u];o[l]=o[l]||function(){return this}}o.start&&!o.run?o.run=function(){return this.start(),this}:!o.start&&o.run&&(o.start=function(){return this.run(),this});var c=t.prototype.stop;o.stop=function(){var w=this.options;if(w&&w.animate){var k=this.animations;if(k)for(var _=0;_<k.length;_++)k[_].stop()}return c?c.call(this):this.emit("layoutstop"),this},o.destroy||(o.destroy=function(){return this}),o.cy=function(){return this._private.cy};var f=function(k){return k._private.cy},d={addEventFields:function(k,_){_.layout=k,_.cy=f(k),_.target=k},bubble:function(){return!0},parent:function(k){return f(k)}};be(o,{createEmitter:function(){return this._private.emitter=new to(d,this),this},emitter:function(){return this._private.emitter},on:function(k,_){return this.emitter().on(k,_),this},one:function(k,_){return this.emitter().one(k,_),this},once:function(k,_){return this.emitter().one(k,_),this},removeListener:function(k,_){return this.emitter().removeListener(k,_),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},emit:function(k,_){return this.emitter().emit(k,_),this}}),He.eventAliasesOn(o),n=i}else if(r==="renderer"&&e!=="null"&&e!=="base"){var h=hh("renderer","base"),v=h.prototype,y=t,g=t.prototype,p=function(){h.apply(this,arguments),y.apply(this,arguments)},m=p.prototype;for(var b in v){var x=v[b],E=g[b]!=null;if(E)return a(b);m[b]=x}for(var S in g)m[S]=g[S];v.clientFunctions.forEach(function(w){m[w]=m[w]||function(){Qe("Renderer does not implement `renderer."+w+"()` on its prototype")}}),n=p}else if(r==="__proto__"||r==="constructor"||r==="prototype")return Qe(r+" is an illegal type to be registered, possibly lead to prototype pollutions");return Md({map:fh,keys:[r,e],value:n})}function hh(r,e){return Rd({map:fh,keys:[r,e]})}function J1(r,e,t,n,a){return Md({map:dh,keys:[r,e,t,n],value:a})}function j1(r,e,t,n){return Rd({map:dh,keys:[r,e,t,n]})}var Mu=function(){if(arguments.length===2)return hh.apply(null,arguments);if(arguments.length===3)return vh.apply(null,arguments);if(arguments.length===4)return j1.apply(null,arguments);if(arguments.length===5)return J1.apply(null,arguments);Qe("Invalid extension access syntax")};Ra.prototype.extension=Mu;Q1.forEach(function(r){r.extensions.forEach(function(e){vh(r.type,e.name,e.impl)})});var $i=function(){if(!(this instanceof $i))return new $i;this.length=0},En=$i.prototype;En.instanceString=function(){return"stylesheet"};En.selector=function(r){var e=this.length++;return this[e]={selector:r,properties:[]},this};En.css=function(r,e){var t=this.length-1;if(he(r))this[t].properties.push({name:r,value:e});else if(Ne(r))for(var n=r,a=Object.keys(n),i=0;i<a.length;i++){var o=a[i],s=n[o];if(s!=null){var u=yt.properties[o]||yt.properties[Ui(o)];if(u!=null){var l=u.name,c=s;this[t].properties.push({name:l,value:c})}}}return this};En.style=En.css;En.generateStyle=function(r){var e=new yt(r);return this.appendToStyle(e)};En.appendToStyle=function(r){for(var e=0;e<this.length;e++){var t=this[e],n=t.selector,a=t.properties;r.selector(n);for(var i=0;i<a.length;i++){var o=a[i];r.css(o.name,o.value)}}return r};var ex="3.33.3",Mr=function(e){if(e===void 0&&(e={}),Ne(e))return new Ra(e);if(he(e))return Mu.apply(Mu,arguments)};Mr.use=function(r){var e=Array.prototype.slice.call(arguments,1);return e.unshift(Mr),r.apply(null,e),this};Mr.warnings=function(r){return Fd(r)};Mr.version=ex;Mr.stylesheet=Mr.Stylesheet=$i;var np=zl(tp());var cw=["host"],rp=!1;function fw(){rp||(Mr.use(np.default),rp=!0)}var dw=Object.freeze({nodes:[],edges:[]}),vw=[],ap=1800,hw=1e3,pw=200;function Ml(r){let e=r>0?r/ap:1;return{name:"cose",animate:"end",animationDuration:600,fit:!1,randomize:!0,componentSpacing:80,nodeRepulsion:2e5,idealEdgeLength:90,edgeElasticity:80,gravity:60,numIter:Math.max(pw,Math.round(hw*e)),coolingFactor:.95}}var gw=Ml(ap),Po=class r{elements=Yt(dw);styleRules=Yt(vw,{alias:"style"});layout=Yt(gw);interactive=Yt(!0);tap=kr();selection=kr();cyReady=kr();hostRef=Ul.required("host");cy=null;resizeObserver=null;currentLayout=null;constructor(){fw(),ar(()=>{let e=this.elements(),t=this.cy;t&&(t.json({elements:e}),this.restartLayout())}),ar(()=>{let e=this.styleRules(),t=this.cy;t&&t.style(e)}),ar(()=>{let e=this.layout();this.cy&&this.runLayout(e)}),ar(()=>{let e=this.interactive(),t=this.cy;t&&this.applyInteractivity(t,e)})}ngAfterViewInit(){let e=this.hostRef().nativeElement,t=Mr(Nt({container:e,elements:this.elements(),style:this.styleRules()},this.interactivityFlags(this.interactive())));this.cy=t,this.runLayout(this.layout()),this.applyInteractivity(t,this.interactive()),t.on("tap","node",n=>{let a=n.target.id();this.tap.emit({id:a})}),t.on("select unselect",()=>{let n=t.$(":selected").map(a=>a.id());this.selection.emit(n)}),this.resizeObserver=new ResizeObserver(()=>t.resize()),this.resizeObserver.observe(e),window.__dxCy=t,this.cyReady.emit(t)}ngOnDestroy(){this.resizeObserver?.disconnect(),this.resizeObserver=null,this.currentLayout?.stop(),this.currentLayout=null,this.cy?.destroy(),this.cy=null}runLayout(e){let t=this.cy;if(!t)return;this.currentLayout?.stop();let n=t.layout(e);this.currentLayout=n,n.one("layoutstop",()=>t.fit(void 0,40)),n.run()}restartLayout(){this.runLayout(this.layout())}interactivityFlags(e){return e?{userZoomingEnabled:!0,userPanningEnabled:!0,boxSelectionEnabled:!0,autoungrabify:!1}:{userZoomingEnabled:!1,userPanningEnabled:!1,boxSelectionEnabled:!1,autoungrabify:!0}}applyInteractivity(e,t){let n=this.interactivityFlags(t);e.userZoomingEnabled(n.userZoomingEnabled??!0),e.userPanningEnabled(n.userPanningEnabled??!0),e.boxSelectionEnabled(n.boxSelectionEnabled??!0),e.autoungrabify(n.autoungrabify??!1)}static \u0275fac=function(t){return new(t||r)};static \u0275cmp=Nr({type:r,selectors:[["dx-cytoscape"]],viewQuery:function(t,n){t&1&&Vl(n.hostRef,cw,5),t&2&&ql()},inputs:{elements:[1,"elements"],styleRules:[1,"style","styleRules"],layout:[1,"layout"],interactive:[1,"interactive"]},outputs:{tap:"tap",selection:"selection",cyReady:"cyReady"},decls:2,vars:0,consts:[["host",""],[1,"cy-host"]],template:function(t,n){t&1&&Cr(0,"div",1,0)},styles:["[_nghost-%COMP%]{display:block;width:100%;height:100%;position:relative}.cy-host[_ngcontent-%COMP%]{width:100%;height:100%}"],changeDetection:0})};function ip(r){return r.map(e=>({selector:e.selector,style:e.properties}))}var cr="/assets/icons",Rl=[{id:"node-base",selector:"node",properties:{width:36,height:36,"background-color":"#141414",label:"data(displayLabel)","font-size":9,"font-family":'-apple-system, "Segoe UI", Roboto, sans-serif',color:"rgba(229,229,229,0.9)","text-opacity":0,"text-margin-y":-4,"text-valign":"bottom","text-halign":"center","text-outline-color":"#0a0a0a","text-outline-width":2,shape:"ellipse","outline-color":"data(outlineColor)","outline-width":"data(outlineWidth)","outline-opacity":.85,"outline-offset":1,"border-color":"data(borderColor)","border-width":"data(borderWidth)"}},{id:"type-host",selector:'node[typeLower = "host"]',properties:{shape:"bottom-round-rectangle","background-image":`url(${cr}/type-host.svg)`,"background-fit":"none","background-clip":"none","background-width":18,"background-height":18,"background-position-x":"50%","background-position-y":"50%","background-image-opacity":.9}},{id:"type-agent",selector:'node[typeLower = "agent"]',properties:{shape:"round-triangle"}},{id:"type-database",selector:'node[typeLower *= "database"]',properties:{shape:"barrel"}},{id:"type-service",selector:'node[type = "SERVICE"]',properties:{shape:"round-hexagon","background-image":`url(${cr}/type-service.svg)`,"background-fit":"none","background-clip":"none","background-width":18,"background-height":18,"background-position-x":"50%","background-position-y":"50%","background-image-opacity":.9}},{id:"type-business-transaction",selector:'node[type = "BUSINESSTRANSACTION"]',properties:{shape:"diamond","background-image":`url(${cr}/type-service.svg)`,"background-fit":"none","background-clip":"none","background-width":18,"background-height":18,"background-position-x":"50%","background-position-y":"50%","background-image-opacity":.9}},{id:"type-metric",selector:'node[type = "METRIC"]',properties:{shape:"ellipse","background-image":`url(${cr}/type-metric.svg)`,"background-fit":"none","background-clip":"none","background-width":16,"background-height":16,"background-position-x":"50%","background-position-y":"50%","background-image-opacity":.9}},{id:"type-dxo2-service",selector:'node[type = "DXO2_SERVICE"]',properties:{shape:"octagon",width:44,height:44,"background-image":`url(${cr}/type-service.svg)`,"background-fit":"none","background-clip":"none","background-width":22,"background-height":22,"background-position-x":"50%","background-position-y":"50%","background-image-opacity":.95,"font-size":11}},{id:"source-apm",selector:'node[primarySource = "APM"]',properties:{"background-image":[`url(${cr}/type-service.svg)`,`url(${cr}/src-apm.svg)`],"background-fit":["none","none"],"background-clip":["none","none"],"background-width":[18,10],"background-height":[18,10],"background-position-x":["50%","85%"],"background-position-y":["50%","85%"],"background-image-opacity":.9}},{id:"source-dxim",selector:'node[primarySource = "DXIM"]',properties:{"background-image":[`url(${cr}/type-host.svg)`,`url(${cr}/src-dxim.svg)`],"background-fit":["none","none"],"background-clip":["none","none"],"background-width":[18,10],"background-height":[18,10],"background-position-x":["50%","85%"],"background-position-y":["50%","85%"],"background-image-opacity":.9}},{id:"source-axa",selector:'node[primarySource = "AXA"]',properties:{"background-image":[`url(${cr}/type-service.svg)`,`url(${cr}/src-axa.svg)`],"background-fit":["none","none"],"background-clip":["none","none"],"background-width":[18,10],"background-height":[18,10],"background-position-x":["50%","85%"],"background-position-y":["50%","85%"],"background-image-opacity":.9}},{id:"edge-contains",selector:'edge[semantic = "contains"]',properties:{"line-color":"rgba(134,239,172,0.4)","line-style":"dashed",width:1.2,opacity:.85}},{id:"edge-subservice",selector:'edge[semantic = "subservice"]',properties:{"line-color":"rgba(134,239,172,0.85)","line-style":"solid",width:2,opacity:.95,"target-arrow-shape":"triangle","target-arrow-color":"rgba(134,239,172,0.85)","arrow-scale":.8,"curve-style":"bezier"}},{id:"edge-monitored-by",selector:'edge[semantic = "monitored-by"]',properties:{"line-color":"rgba(167,139,250,0.5)","line-style":"dotted",width:1,opacity:.7,"target-arrow-shape":"tee","target-arrow-color":"rgba(167,139,250,0.7)","arrow-scale":.7,"curve-style":"bezier"}},{id:"edge-base",selector:"edge",properties:{width:1,"line-color":"rgba(229,229,229,0.16)","curve-style":"bezier","target-arrow-shape":"none",opacity:.7}},{id:"edge-active",selector:"edge:active",properties:{width:2,"line-color":"rgba(134,239,172,0.85)","overlay-color":"#86efac","overlay-opacity":.18}},{id:"node-selected",selector:"node:selected",properties:{"border-width":3,"border-color":"#f0abfc","text-opacity":1}}];var yw=500,oa=class r{api=dr(Pn);rules=Ke(Rl);compiled=kt(()=>ip(this.rules()));saveState=Ke("idle");hydrated=Ke(!1);errorMessage=Ke(null);saveTimer=null;suppressSave=!1;lastSavedJson=null;constructor(){this.hydrate(),ar(()=>{let e=this.rules();this.suppressSave||!this.hydrated()||JSON.stringify(e)===this.lastSavedJson||this.scheduleSave(e)})}setRules(e){this.rules.set(e)}updateRule(e,t){this.rules.update(n=>n.map(a=>a.id===e?Nt(Nt({},a),t):a))}addRule(e){let n={id:e?.id??`rule-${Date.now().toString(36)}`,selector:e?.selector??"node",properties:e?.properties??{}};return this.rules.update(a=>[...a,n]),n}removeRule(e){this.rules.update(t=>t.filter(n=>n.id!==e))}moveRule(e,t){this.rules.update(n=>{let a=n.findIndex(u=>u.id===e);if(a<0)return n;let i=a+t;if(i<0||i>=n.length)return n;let o=n.slice(),[s]=o.splice(a,1);return o.splice(i,0,s),o})}resetToDefaults(){this.rules.set(Rl)}compiledSignal(){return this.compiled}hydrate(){return Er(this,null,function*(){try{let e=yield this.api.getHomeGraphStyles();e.rules&&e.rules.length>0?(this.suppressSave=!0,this.rules.set(e.rules),this.lastSavedJson=JSON.stringify(e.rules),this.suppressSave=!1):this.lastSavedJson=JSON.stringify(this.rules())}catch(e){this.errorMessage.set(e.message??"Failed to load saved style rules"),this.lastSavedJson=JSON.stringify(this.rules())}finally{this.hydrated.set(!0)}})}scheduleSave(e){this.saveTimer&&clearTimeout(this.saveTimer),this.saveState.set("saving"),this.saveTimer=setTimeout(()=>{this.saveTimer=null,this.flushSave(e)},yw)}flushSave(e){return Er(this,null,function*(){try{yield this.api.saveHomeGraphStyles(e),this.lastSavedJson=JSON.stringify(e),this.saveState.set("saved"),this.errorMessage.set(null),setTimeout(()=>{this.saveState()==="saved"&&this.saveState.set("idle")},1500)}catch(t){this.saveState.set("error"),this.errorMessage.set(t.message??"Failed to save style rules")}})}static \u0275fac=function(t){return new(t||r)};static \u0275prov=Fl({token:r,factory:r.\u0275fac,providedIn:"root"})};var op="DXO2_SERVICE",Ao="DXO2_SERVICE",Bl="dxo2svc:",mw="contains",bw="subservice",xw="monitored-by",ww="AGENT",Ew=new Set(["AGENT_STATUS","AGENT_CONNECTION"]);function lp(r,e){let t=new Set,n=[],a=new Map,i=[];for(let l of r.vertices){let c=String(l.id);t.add(c);let f=l.attributes??{},d=typeof l.externalId=="string"?l.externalId:"",h=Cw(d,f),v=typeof f.type=="string"?f.type:"",y=f.SourceProduct,g=Array.isArray(y)?typeof y[0]=="string"?y[0]:"":typeof y=="string"?y:"",p=typeof f.name=="string"&&f.name||d||c,m=v.toLowerCase(),b=up(m||"_default");if(n.push({data:{id:c,externalId:d,name:p,type:v,typeLower:m,layer:h,primarySource:g,displayLabel:sp(v,p),outlineWidth:4+b%3,borderWidth:1+(b>>>4)%3,outlineColor:Mo(b>>>7),borderColor:Mo(b>>>13)}}),v===ww)p&&a.set(p.toLowerCase(),c);else if(Ew.has(v))p&&i.push({sourceId:c,agentNames:[p]});else{let x=Sw(f.agent);x.length>0&&i.push({sourceId:c,agentNames:x})}}let o=new Set;if(e?.services?.length)for(let l of e.services){let c=`${Bl}${l.id}`;o.add(c),t.add(c);let f=up(Ao.toLowerCase());n.push({data:{id:c,externalId:`${op}:${l.name}`,name:l.name,type:Ao,typeLower:Ao.toLowerCase(),layer:op,primarySource:"DXO2",displayLabel:sp(Ao,l.name),outlineWidth:4+f%3,borderWidth:1+(f>>>4)%3,outlineColor:Mo(f>>>7),borderColor:Mo(f>>>13),synthetic:!0}})}let s=[],u=new Set;for(let l=0;l<r.edges.length;l++){let c=r.edges[l],f=String(c.sourceId),d=String(c.targetId);if(!t.has(f)||!t.has(d))continue;let h=String(c.flowId??""),v=String(c.wireId??""),y=`${f}-${d}-${h}-${v}`;u.has(y)&&(y=`${y}-${l}`),u.add(y);let g=typeof c.attributes?.semantic=="string"?c.attributes.semantic:"";s.push({data:{id:y,source:f,target:d,semantic:g}})}for(let l of i)for(let c of l.agentNames){let f=a.get(c.toLowerCase());if(!f||f===l.sourceId)continue;let d=`${l.sourceId}->${f}-MONITORED_BY`;u.has(d)||(u.add(d),s.push({data:{id:d,source:l.sourceId,target:f,semantic:xw,synthetic:!0}}))}if(e?.services?.length){let l=new Map;for(let c of e.services)l.set(c.name.toLowerCase(),c.id);for(let c of e.services){let f=`${Bl}${c.id}`;if(o.has(f)){for(let d of c.memberVertexIds){let h=String(d);if(!t.has(h))continue;let v=`${f}->${h}-CONTAINS`;u.has(v)||(u.add(v),s.push({data:{id:v,source:f,target:h,semantic:mw,synthetic:!0}}))}for(let d of c.childServiceNames??[]){let h=l.get(d.toLowerCase());if(!h)continue;let v=`${Bl}${h}`;if(v===f||!o.has(v))continue;let y=`${f}->${v}-SUBSERVICE`;u.has(y)||(u.add(y),s.push({data:{id:y,source:f,target:v,semantic:bw,synthetic:!0}}))}}}}return{nodes:n,edges:s}}function Cw(r,e){let t=e.layer;return typeof t=="string"&&t.length>0?t:r.includes(":")?r.split(":")[0]??"":""}function sp(r,e){return r?`${r}:${e}`:e}function Sw(r){return typeof r=="string"?r?[r]:[]:Array.isArray(r)?r.filter(e=>typeof e=="string"&&e.length>0):[]}function up(r){let e=2166136261;for(let t=0;t<r.length;t++)e=((e^r.charCodeAt(t))>>>0)*16777619,e>>>=0;return e>>>0}function Mo(r){let e=r%360,t=70+(r>>>9)%30,n=50+(r>>>16)%25;return`hsl(${e}, ${t}%, ${n}%)`}var cp=zl(Ep());var kw=(r,e)=>e.id;function Tw(r,e){r&1&&(Pe(0,"p",18),Te(1),ke()),r&2&&(_e(),ir(e))}function _w(r,e){if(r&1){let t=Sr();Pe(0,"article",6)(1,"div",11)(2,"input",12),nt("input",function(a){let i=qe(t).$implicit,o=Re(2);return Ge(o.onSelectorChange(i.id,a.target.value))}),ke(),Pe(3,"div",13)(4,"button",14),nt("click",function(){let a=qe(t).$implicit,i=Re(2);return Ge(i.store.moveRule(a.id,-1))}),Te(5,"\u2191"),ke(),Pe(6,"button",15),nt("click",function(){let a=qe(t).$implicit,i=Re(2);return Ge(i.store.moveRule(a.id,1))}),Te(7,"\u2193"),ke(),Pe(8,"button",16),nt("click",function(){let a=qe(t).$implicit,i=Re(2);return Ge(i.onDelete(a.id))}),Te(9,"\xD7"),ke()()(),Pe(10,"textarea",17),nt("input",function(a){let i=qe(t).$implicit,o=Re(2);return Ge(o.onPropsChange(i.id,a.target.value))}),ke(),Wt(11,Tw,2,1,"p",18),ke()}if(r&2){let t,n=e.$implicit,a=e.$index,i=Re(2);_e(2),vr("value",n.selector),_e(2),vr("disabled",a===0),_e(2),vr("disabled",a===i.rows().length-1),_e(4),vr("value",n.propsText),_e(),Xt((t=n.error)?11:-1,t)}}function Pw(r,e){if(r&1){let t=Sr();Pe(0,"aside",0)(1,"header",1)(2,"span",2),Te(3,"Style rules"),ke(),Pe(4,"span",3),Te(5),ke(),Pe(6,"button",4),nt("click",function(){qe(t);let a=Re();return Ge(a.close.emit())}),Te(7," \xD7 "),ke()(),Pe(8,"div",5),ii(9,_w,12,5,"article",6,kw),ke(),Pe(11,"footer",7)(12,"button",8),nt("click",function(){qe(t);let a=Re();return Ge(a.onAdd())}),Te(13," + Add rule "),ke(),Cr(14,"span",9),Pe(15,"button",10),nt("click",function(){qe(t);let a=Re();return Ge(a.onReset())}),Te(16," Reset to defaults "),ke()()()}if(r&2){let t=Re();_e(4),ca("dx-save-state--saving",t.store.saveState()==="saving")("dx-save-state--saved",t.store.saveState()==="saved")("dx-save-state--error",t.store.saveState()==="error"),_e(),ir(t.saveLabel()),_e(4),oi(t.rows())}}var Ro=class r{open=Yt(!1);close=kr();store=dr(oa);drafts=Ke([]);storeJsonSnapshot="";rows=this.drafts.asReadonly();constructor(){ar(()=>{let e=this.store.rules(),t=JSON.stringify(e);$l(()=>{t!==this.storeJsonSnapshot&&(this.storeJsonSnapshot=t,this.drafts.set(e.map(n=>({id:n.id,selector:n.selector,propsText:Dw(n.properties),error:null}))))})})}saveLabel=kt(()=>{let e=this.store.saveState();return e==="saving"?"Saving\u2026":e==="saved"?"Saved":e==="error"?"Error":""});onSelectorChange(e,t){this.patchDraft(e,{selector:t}),this.store.updateRule(e,{selector:t}),this.refreshSnapshotAfterPush()}onPropsChange(e,t){let n=null,a=null;if(t.trim().length===0)n={};else try{let i=cp.default.parse(t);!i||typeof i!="object"||Array.isArray(i)?a="Properties must be a JSON object":n=i}catch(i){a=i.message}this.patchDraft(e,{propsText:t,error:a}),n&&(this.store.updateRule(e,{properties:n}),this.refreshSnapshotAfterPush())}onDelete(e){this.store.removeRule(e)}onAdd(){this.store.addRule({selector:"node",properties:{}})}onReset(){this.store.resetToDefaults()}patchDraft(e,t){this.drafts.update(n=>n.map(a=>a.id===e?Nt(Nt({},a),t):a))}refreshSnapshotAfterPush(){this.storeJsonSnapshot=JSON.stringify(this.store.rules())}static \u0275fac=function(t){return new(t||r)};static \u0275cmp=Nr({type:r,selectors:[["dx-style-drawer"]],inputs:{open:[1,"open"]},outputs:{close:"close"},decls:1,vars:1,consts:[[1,"dx-style-drawer"],[1,"dx-drawer-h"],[1,"dx-drawer-title"],[1,"dx-save-state"],["type","button","title","Close",1,"dx-x",3,"click"],[1,"dx-rules"],[1,"dx-rule"],[1,"dx-drawer-f"],["type","button",1,"dx-secondary",3,"click"],[1,"dx-spacer"],["type","button",1,"dx-reset",3,"click"],[1,"dx-rule-h"],["type","text","spellcheck","false","autocomplete","off","placeholder",'selector e.g. node[layer = "ATC"]',1,"dx-rule-selector",3,"input","value"],[1,"dx-rule-actions"],["type","button","title","Move up",1,"dx-mini",3,"click","disabled"],["type","button","title","Move down",1,"dx-mini",3,"click","disabled"],["type","button","title","Delete rule",1,"dx-mini","dx-mini--danger",3,"click"],["spellcheck","false","autocomplete","off","rows","6","placeholder",'{ "background-color": "#10b981" }',1,"dx-rule-props",3,"input","value"],[1,"dx-rule-err"]],template:function(t,n){t&1&&Wt(0,Pw,17,7,"aside",0),t&2&&Xt(n.open()?0:-1)},styles:[".dx-style-drawer[_ngcontent-%COMP%]{position:absolute;top:1rem;bottom:1rem;right:1rem;width:24rem;background:#121214f5;border:1px solid rgba(134,239,172,.3);border-radius:.5rem;box-shadow:0 0 24px #86efac2e;color:var(--dx-text);font-size:.85rem;display:flex;flex-direction:column;z-index:10;-webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px);overflow:hidden}.dx-drawer-h[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;padding:.6rem .75rem;border-bottom:1px solid rgba(255,255,255,.06)}.dx-drawer-title[_ngcontent-%COMP%]{font-weight:600;text-transform:uppercase;letter-spacing:.04em;font-size:.7rem;color:var(--dx-text-muted);flex:1}.dx-save-state[_ngcontent-%COMP%]{font-size:.65rem;color:var(--dx-text-subtle);text-transform:uppercase;letter-spacing:.04em;min-width:4rem;text-align:right}.dx-save-state--saving[_ngcontent-%COMP%]{color:var(--dx-accent-amber)}.dx-save-state--saved[_ngcontent-%COMP%]{color:var(--dx-accent-strong)}.dx-save-state--error[_ngcontent-%COMP%]{color:#fca5a5f2}.dx-x[_ngcontent-%COMP%]{background:transparent;border:0;color:inherit;cursor:pointer;font-size:1.1rem;line-height:1;padding:0 .25rem}.dx-rules[_ngcontent-%COMP%]{flex:1;overflow-y:auto;padding:.5rem .5rem .25rem;display:flex;flex-direction:column;gap:.35rem}.dx-rule[_ngcontent-%COMP%]{background:#ffffff06;border:1px solid rgba(255,255,255,.08);border-radius:.4rem;padding:.4rem}.dx-rule-h[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.35rem}.dx-rule-selector[_ngcontent-%COMP%]{flex:1;background:#0000004d;color:var(--dx-text);border:1px solid rgba(255,255,255,.1);border-radius:.3rem;padding:.3rem .45rem;font:500 .75rem SF Mono,Menlo,monospace;outline:none}.dx-rule-selector[_ngcontent-%COMP%]:focus{border-color:var(--dx-accent-strong);box-shadow:0 0 0 2px #34d3992e}.dx-rule-actions[_ngcontent-%COMP%]{display:flex;gap:.15rem}.dx-mini[_ngcontent-%COMP%]{background:transparent;border:1px solid rgba(255,255,255,.08);color:var(--dx-text-muted);border-radius:.25rem;width:1.4rem;height:1.4rem;font-size:.75rem;line-height:1;cursor:pointer}.dx-mini[_ngcontent-%COMP%]:hover:not(:disabled){background:#ffffff0d;color:var(--dx-text)}.dx-mini[_ngcontent-%COMP%]:disabled{opacity:.35;cursor:not-allowed}.dx-mini--danger[_ngcontent-%COMP%]:hover:not(:disabled){border-color:#fca5a580;color:#fca5a5e6}.dx-rule-props[_ngcontent-%COMP%]{margin-top:.4rem;width:100%;box-sizing:border-box;background:#0006;color:var(--dx-text);border:1px solid rgba(255,255,255,.08);border-radius:.3rem;padding:.4rem .5rem;font:400 .72rem SF Mono,Menlo,monospace;line-height:1.4;resize:vertical;outline:none}.dx-rule-props[_ngcontent-%COMP%]:focus{border-color:var(--dx-accent-strong);box-shadow:0 0 0 2px #34d3992e}.dx-rule-err[_ngcontent-%COMP%]{margin:.35rem 0 0;padding:.25rem .4rem;font-size:.7rem;color:#fca5a5f2;background:#fca5a50f;border:1px solid rgba(252,165,165,.25);border-radius:.25rem}.dx-drawer-f[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;padding:.5rem .75rem;border-top:1px solid rgba(255,255,255,.06)}.dx-secondary[_ngcontent-%COMP%]{background:transparent;border:1px solid rgba(134,239,172,.4);color:var(--dx-accent-strong);padding:.3rem .55rem;border-radius:.3rem;cursor:pointer;font-size:.75rem}.dx-secondary[_ngcontent-%COMP%]:hover{background:#34d39914}.dx-spacer[_ngcontent-%COMP%]{flex:1}.dx-reset[_ngcontent-%COMP%]{background:transparent;border:1px solid rgba(251,191,36,.4);color:#fbbf24e6;padding:.3rem .55rem;border-radius:.3rem;cursor:pointer;font-size:.75rem}.dx-reset[_ngcontent-%COMP%]:hover{background:#fbbf2414}"],changeDetection:0})};function Dw(r){return Object.keys(r).length===0?"{}":JSON.stringify(r,null,2)}var Aw=(r,e)=>e.id;function Mw(r,e){r&1&&(Pe(0,"p",16),Cr(1,"i",24),Te(2," Loading service catalog\u2026 "),ke())}function Rw(r,e){r&1&&(Pe(0,"p",17),Cr(1,"i",25),Te(2),ke()),r&2&&(_e(2),Vr(" ",e," "))}function Bw(r,e){if(r&1&&(Pe(0,"span",31),Te(1),ke()),r&2){let t=Re().$implicit;_e(),Vr(" \u21B3 ",t.childServiceNames.length," ")}}function Lw(r,e){if(r&1){let t=Sr();Pe(0,"label",27)(1,"input",28),nt("change",function(){let a=qe(t).$implicit,i=Re(3);return Ge(i.toggle(a.name))}),ke(),Pe(2,"span",29),Te(3),ke(),Pe(4,"span",30),Te(5),ke(),Wt(6,Bw,2,1,"span",31),ke()}if(r&2){let t=e.$implicit;ca("dx-picker-row--selected",t.selected)("dx-picker-row--zero",t.count===0),_e(),vr("checked",t.selected),_e(2),ir(t.name),_e(2),ir(t.count.toLocaleString()),_e(),Xt(t.childServiceNames.length>0?6:-1)}}function Ow(r,e){r&1&&(Pe(0,"p",16),Te(1,"No services match."),ke())}function Iw(r,e){if(r&1&&(ii(0,Lw,7,8,"label",26,Aw),Wt(2,Ow,2,0,"p",16)),r&2){let t=Re(2);oi(t.visibleRows()),_e(2),Xt(t.visibleRows().length===0?2:-1)}}function Nw(r,e){if(r&1){let t=Sr();Pe(0,"div",1),nt("click",function(){qe(t);let a=Re();return Ge(a.onCancel())}),Pe(1,"div",2),nt("click",function(a){return a.stopPropagation()}),Pe(2,"header",3)(3,"span",4),Te(4,"Choose services"),ke(),Pe(5,"span",5),Te(6),ke(),Pe(7,"button",6),nt("click",function(){qe(t);let a=Re();return Ge(a.onCancel())}),Te(8," \xD7 "),ke()(),Pe(9,"div",7)(10,"input",8),nt("input",function(a){qe(t);let i=Re();return Ge(i.setSearch(a.target.value))}),ke(),Pe(11,"label",9)(12,"span"),Te(13,"budget"),ke(),Pe(14,"input",10),nt("input",function(a){qe(t);let i=Re();return Ge(i.setThreshold(+a.target.value))}),ke(),Pe(15,"span",11),Te(16,"entities"),ke()()(),Pe(17,"div",12)(18,"span")(19,"strong"),Te(20),ke(),Te(21," services \xB7 "),Pe(22,"strong"),Te(23),ke(),Te(24),ke(),Pe(25,"div",13),Cr(26,"div",14),ke()(),Pe(27,"div",15),Wt(28,Mw,3,0,"p",16)(29,Rw,3,1,"p",17)(30,Iw,3,1),ke(),Pe(31,"footer",18)(32,"button",19),nt("click",function(){qe(t);let a=Re();return Ge(a.autoPickLargest())}),Te(33," Auto-pick largest "),ke(),Pe(34,"button",19),nt("click",function(){qe(t);let a=Re();return Ge(a.selectAll())}),Te(35," Select all "),ke(),Pe(36,"button",19),nt("click",function(){qe(t);let a=Re();return Ge(a.clear())}),Te(37," Clear "),ke(),Cr(38,"span",20),Pe(39,"button",21),nt("click",function(){qe(t);let a=Re();return Ge(a.onUseAllEntities())}),Te(40," Use all entities "),ke(),Pe(41,"button",22),nt("click",function(){qe(t);let a=Re();return Ge(a.onCancel())}),Te(42," Cancel "),ke(),Pe(43,"button",23),nt("click",function(){qe(t);let a=Re();return Ge(a.onApply())}),Te(44," Apply "),ke()()()()}if(r&2){let t,n=Re();_e(6),Vr(" tenant has ",n.entityTotal().toLocaleString()," entities total "),_e(4),vr("value",n.searchTerm()),_e(4),vr("value",n.threshold()),_e(3),ca("dx-picker-summary--over",n.overBudget()),_e(3),ir(n.selectedCount()),_e(3),ir(n.selectedEntities().toLocaleString()),_e(),Vr(" / ",n.threshold().toLocaleString()," entities "),_e(2),Gl("width",n.overBudget()?100:n.selectedEntities()/n.threshold()*100,"%"),_e(2),Xt(n.loading()?28:(t=n.error())?29:30,t),_e(15),vr("disabled",n.loading())}}var Bo=class r{open=Yt(!1);initialSelectedNames=Yt(null);initialThreshold=Yt(5e3);entityTotal=Yt(0);cancel=kr();apply=kr();api=dr(Pn);loading=Ke(!1);error=Ke(null);threshold=Ke(5e3);searchTerm=Ke("");rows=Ke([]);visibleRows=kt(()=>{let e=this.searchTerm().trim().toLowerCase();return[...e?this.rows().filter(n=>n.name.toLowerCase().includes(e)):this.rows()].sort((n,a)=>a.count!==n.count?a.count-n.count:n.name.localeCompare(a.name))});selectedCount=kt(()=>this.rows().filter(e=>e.selected).length);selectedEntities=kt(()=>this.rows().filter(e=>e.selected).reduce((e,t)=>e+t.count,0));overBudget=kt(()=>this.selectedEntities()>this.threshold());lastOpenSnapshot=!1;constructor(){setInterval(()=>this.maybeRehydrate(),250)}maybeRehydrate(){let e=this.open();e&&!this.lastOpenSnapshot?(this.lastOpenSnapshot=!0,this.threshold.set(this.initialThreshold()),this.load()):e||(this.lastOpenSnapshot=!1)}load(){return Er(this,null,function*(){this.loading.set(!0),this.error.set(null);try{let e=yield this.api.getHomeGraphServiceCounts(),t=this.initialSelectedNames()===null?null:new Set((this.initialSelectedNames()??[]).map(a=>a.toLowerCase())),n=e.services.map(a=>Tn(Nt({},a),{selected:t?t.has(a.name.toLowerCase()):!0}));this.rows.set(n)}catch(e){this.error.set(e.message??"Failed to load service catalog")}finally{this.loading.set(!1)}})}toggle(e){this.rows.update(t=>t.map(n=>n.name===e?Tn(Nt({},n),{selected:!n.selected}):n))}setThreshold(e){Number.isFinite(e)&&e>0&&this.threshold.set(Math.floor(e))}setSearch(e){this.searchTerm.set(e)}autoPickLargest(){this.rows.update(e=>{let t=e.map(n=>Tn(Nt({},n),{selected:!1}));return this.applyAutoPickToRows(t,this.threshold()),t})}clear(){this.rows.update(e=>e.map(t=>Tn(Nt({},t),{selected:!1})))}selectAll(){this.rows.update(e=>e.map(t=>Tn(Nt({},t),{selected:!0})))}onCancel(){this.cancel.emit()}onApply(){let e=this.rows().filter(t=>t.selected).map(t=>t.name);this.apply.emit({selectedServiceNames:e,entityThreshold:this.threshold()})}onUseAllEntities(){this.apply.emit({selectedServiceNames:null,entityThreshold:this.threshold()})}applyAutoPickToRows(e,t){let n=e.map((i,o)=>({r:i,i:o})).filter(({r:i})=>i.count>0&&i.count<=t).sort((i,o)=>o.r.count-i.r.count),a=0;for(let{i}of n){let o=a+e[i].count;o>t||(e[i].selected=!0,a=o)}}static \u0275fac=function(t){return new(t||r)};static \u0275cmp=Nr({type:r,selectors:[["dx-service-picker"]],inputs:{open:[1,"open"],initialSelectedNames:[1,"initialSelectedNames"],initialThreshold:[1,"initialThreshold"],entityTotal:[1,"entityTotal"]},outputs:{cancel:"cancel",apply:"apply"},decls:1,vars:1,consts:[[1,"dx-picker-overlay"],[1,"dx-picker-overlay",3,"click"],[1,"dx-picker-card",3,"click"],[1,"dx-picker-h"],[1,"dx-picker-title"],[1,"dx-picker-tenant-total"],["type","button","title","Cancel",1,"dx-x",3,"click"],[1,"dx-picker-controls"],["type","text","spellcheck","false","autocomplete","off","placeholder","filter by name\u2026",1,"dx-search",3,"input","value"],[1,"dx-threshold"],["type","number","min","100","step","100",3,"input","value"],[1,"dx-threshold-suffix"],[1,"dx-picker-summary"],[1,"dx-budget-bar"],[1,"dx-budget-bar-fill"],[1,"dx-picker-list"],[1,"dx-picker-status"],[1,"dx-picker-error"],[1,"dx-picker-f"],["type","button",1,"dx-secondary",3,"click"],[1,"dx-spacer"],["type","button","title","Skip service filter \u2014 load every TAS entity in the tenant",1,"dx-secondary",3,"click"],["type","button",1,"dx-cancel",3,"click"],["type","button",1,"dx-apply",3,"click","disabled"],[1,"pi","pi-spin","pi-spinner"],[1,"pi","pi-exclamation-triangle"],[1,"dx-picker-row",3,"dx-picker-row--selected","dx-picker-row--zero"],[1,"dx-picker-row"],["type","checkbox",3,"change","checked"],[1,"dx-row-name"],[1,"dx-row-count"],["title","immediate child services",1,"dx-row-children"]],template:function(t,n){t&1&&Wt(0,Nw,45,12,"div",0),t&2&&Xt(n.open()?0:-1)},dependencies:[Xl],styles:[".dx-picker-overlay[_ngcontent-%COMP%]{position:absolute;inset:0;background:#0000008c;-webkit-backdrop-filter:blur(6px);backdrop-filter:blur(6px);display:flex;align-items:center;justify-content:center;z-index:20}.dx-picker-card[_ngcontent-%COMP%]{width:min(560px,90%);max-height:85vh;display:flex;flex-direction:column;background:#0f0f12f7;border:1px solid rgba(134,239,172,.3);border-radius:.6rem;box-shadow:0 0 32px #86efac2e;color:var(--dx-text);font-size:.85rem;overflow:hidden}.dx-picker-h[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.6rem;padding:.7rem .9rem;border-bottom:1px solid rgba(255,255,255,.08)}.dx-picker-title[_ngcontent-%COMP%]{font-weight:600;letter-spacing:.04em;text-transform:uppercase;font-size:.75rem;color:var(--dx-text)}.dx-picker-tenant-total[_ngcontent-%COMP%]{font-size:.7rem;color:var(--dx-text-subtle);flex:1;font-family:SF Mono,Menlo,monospace}.dx-x[_ngcontent-%COMP%]{background:transparent;border:0;color:inherit;cursor:pointer;font-size:1.3rem;line-height:1;padding:0 .3rem}.dx-picker-controls[_ngcontent-%COMP%]{display:flex;gap:.6rem;padding:.6rem .9rem;border-bottom:1px solid rgba(255,255,255,.04)}.dx-search[_ngcontent-%COMP%]{flex:1;background:#00000059;color:var(--dx-text);border:1px solid rgba(255,255,255,.1);border-radius:.35rem;padding:.35rem .55rem;font-size:.8rem;outline:none}.dx-search[_ngcontent-%COMP%]:focus{border-color:var(--dx-accent-strong)}.dx-threshold[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.3rem;font-size:.75rem;color:var(--dx-text-muted)}.dx-threshold[_ngcontent-%COMP%] input[_ngcontent-%COMP%]{width:5.5rem;background:#00000059;color:var(--dx-text);border:1px solid rgba(255,255,255,.1);border-radius:.3rem;padding:.3rem .4rem;font-size:.78rem;outline:none}.dx-threshold[_ngcontent-%COMP%] input[_ngcontent-%COMP%]:focus{border-color:var(--dx-accent-strong)}.dx-threshold-suffix[_ngcontent-%COMP%]{font-size:.7rem;color:var(--dx-text-subtle)}.dx-picker-summary[_ngcontent-%COMP%]{padding:.55rem .9rem;border-bottom:1px solid rgba(255,255,255,.04);font-size:.78rem;color:var(--dx-text-muted);display:flex;flex-direction:column;gap:.35rem}.dx-picker-summary[_ngcontent-%COMP%] strong[_ngcontent-%COMP%]{color:var(--dx-accent-strong);font-weight:600}.dx-picker-summary--over[_ngcontent-%COMP%], .dx-picker-summary--over[_ngcontent-%COMP%] strong[_ngcontent-%COMP%]{color:#fca5a5f2}.dx-budget-bar[_ngcontent-%COMP%]{height:4px;background:#ffffff14;border-radius:999px;overflow:hidden}.dx-budget-bar-fill[_ngcontent-%COMP%]{height:100%;background:var(--dx-accent-strong);transition:width .2s ease}.dx-picker-summary--over[_ngcontent-%COMP%] .dx-budget-bar-fill[_ngcontent-%COMP%]{background:#fca5a5d9}.dx-picker-list[_ngcontent-%COMP%]{flex:1;overflow-y:auto;padding:.4rem;display:flex;flex-direction:column;gap:.15rem;min-height:14rem}.dx-picker-status[_ngcontent-%COMP%], .dx-picker-error[_ngcontent-%COMP%]{padding:.6rem .5rem;font-size:.8rem;color:var(--dx-text-muted)}.dx-picker-error[_ngcontent-%COMP%]{color:#fca5a5f2}.dx-picker-row[_ngcontent-%COMP%]{display:grid;grid-template-columns:auto 1fr auto auto;align-items:center;gap:.5rem;padding:.35rem .5rem;border-radius:.3rem;cursor:pointer;-webkit-user-select:none;user-select:none}.dx-picker-row[_ngcontent-%COMP%] input[type=checkbox][_ngcontent-%COMP%]{accent-color:var(--dx-accent-strong);cursor:pointer}.dx-picker-row[_ngcontent-%COMP%]:hover{background:#ffffff0a}.dx-picker-row--selected[_ngcontent-%COMP%]{background:#86efac0f}.dx-picker-row--zero[_ngcontent-%COMP%]{opacity:.55}.dx-row-name[_ngcontent-%COMP%]{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dx-row-count[_ngcontent-%COMP%]{font-family:SF Mono,Menlo,monospace;font-size:.78rem;color:var(--dx-text-muted);min-width:3.5rem;text-align:right}.dx-row-children[_ngcontent-%COMP%]{font-size:.7rem;color:var(--dx-text-subtle);font-family:SF Mono,Menlo,monospace}.dx-picker-f[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.4rem;padding:.6rem .9rem;border-top:1px solid rgba(255,255,255,.08)}.dx-spacer[_ngcontent-%COMP%]{flex:1}.dx-secondary[_ngcontent-%COMP%]{background:transparent;border:1px solid rgba(255,255,255,.1);color:var(--dx-text-muted);padding:.3rem .55rem;border-radius:.3rem;cursor:pointer;font-size:.75rem}.dx-secondary[_ngcontent-%COMP%]:hover{background:#ffffff0a;color:var(--dx-text);border-color:#ffffff2e}.dx-cancel[_ngcontent-%COMP%]{background:transparent;border:1px solid rgba(255,255,255,.12);color:var(--dx-text-muted);padding:.4rem .7rem;border-radius:.35rem;cursor:pointer;font-size:.78rem}.dx-cancel[_ngcontent-%COMP%]:hover{background:#ffffff0d}.dx-apply[_ngcontent-%COMP%]{background:#86efac2e;border:1px solid rgba(134,239,172,.55);color:var(--dx-accent);padding:.4rem .85rem;border-radius:.35rem;cursor:pointer;font-size:.78rem;font-weight:600}.dx-apply[_ngcontent-%COMP%]:hover:not(:disabled){background:#86efac47;box-shadow:var(--dx-glow)}.dx-apply[_ngcontent-%COMP%]:disabled{opacity:.5;cursor:not-allowed}"],changeDetection:0})};function zw(r,e){r&1&&(pt(0,"span",4),zr(1,"i",16),Te(2," Loading topology\u2026 "),At())}function Fw(r,e){if(r&1){let t=Sr();pt(0,"span",5),zr(1,"i",17),Te(2),pt(3,"button",18),Fr("click",function(){qe(t);let a=Re(2);return Ge(a.retry())}),Te(4,"retry"),At()()}r&2&&(_e(2),Vr(" ",e," "))}function Vw(r,e){if(r&1&&(pt(0,"span",6),Te(1),At()),r&2){let t=Re(2);_e(),ir(t.statusLine())}}function qw(r,e){r&1&&(pt(0,"div",14),zr(1,"i",17),Te(2),At()),r&2&&(_e(2),Vr(" ",e," "))}function Gw(r,e){if(r&1){let t=Sr();pt(0,"dx-cytoscape",2),Fr("cyReady",function(a){qe(t);let i=Re();return Ge(i.onCyReady(a))}),At(),pt(1,"div",3),Wt(2,zw,3,0,"span",4)(3,Fw,5,1,"span",5)(4,Vw,2,1,"span",6),At(),pt(5,"button",7),Fr("click",function(){qe(t);let a=Re();return Ge(a.toggleDrawer())}),zr(6,"i",8),At(),pt(7,"button",9),Fr("click",function(){qe(t);let a=Re();return Ge(a.openPicker())}),zr(8,"i",10),pt(9,"span"),Te(10),At()(),pt(11,"dx-service-picker",11),Fr("cancel",function(){qe(t);let a=Re();return Ge(a.closePicker())})("apply",function(a){qe(t);let i=Re();return Ge(i.onPickerApply(a))}),At(),pt(12,"button",12),Fr("click",function(){qe(t);let a=Re();return Ge(a.downloadCanvas())}),zr(13,"i",13),At(),Wt(14,qw,3,1,"div",14),pt(15,"dx-style-drawer",15),Fr("close",function(){qe(t);let a=Re();return Ge(a.closeDrawer())}),At()}if(r&2){let t,n,a=Re();Hl(a.style()),_n("elements",a.elements())("layout",a.layout()),_e(2),Xt(a.loading()?2:(t=a.errorMessage())?3:a.hasGraph()?4:-1,t),_e(5),_n("title","Choose services \u2014 currently showing "+a.scopeLabel()),_e(3),ir(a.scopeLabel()),_e(),_n("open",a.pickerOpen())("initialSelectedNames",a.settings().selectedServiceNames)("initialThreshold",a.settings().entityThreshold)("entityTotal",a.entityCount()),_e(),_n("disabled",!a.hasGraph()),_e(2),Xt((n=a.downloadError())?14:-1,n),_e(),_n("open",a.drawerOpen())}}function Hw(r,e){r&1&&(pt(0,"div",1)(1,"div",19),zr(2,"i",20),pt(3,"h2"),Te(4,"Bind a tenant to see your graph"),At(),pt(5,"p"),Te(6," Pick a configuration in the sidebar to fetch the full TAS topology. "),At()()())}var $w=Object.freeze({nodes:[],edges:[]}),fp=class r{api=dr(Pn);styleStore=dr(oa);sessionStore=dr(Wl);session=this.sessionStore.session;loading=Ke(!1);errorMessage=Ke(null);drawerOpen=Ke(!1);pickerOpen=Ke(!1);graph=Ke(null);servicesOverlay=Ke(null);entityCount=Ke(0);settings=Ke({entityThreshold:5e3,selectedServiceNames:null});activeServiceNames=Ke(null);nodeCount=Ke(0);elements=kt(()=>{let e=this.graph();return e?lp(e,this.servicesOverlay()):$w});layout=kt(()=>Ml(this.nodeCount()));style=kt(()=>this.styleStore.compiled());hasGraph=kt(()=>{let e=this.graph();return!!e&&e.vertices.length>0});statusLine=kt(()=>{let e=this.graph();if(!e)return"";let t=[`${e.vertices.length.toLocaleString()} nodes`,`${e.edges.length.toLocaleString()} edges`],n=this.servicesOverlay();n?.services?.length&&t.push(`${n.services.length.toLocaleString()} services`);let a=this.entityCount();return this.activeServiceNames()&&a>0&&t.push(`of ${a.toLocaleString()} total entities`),e.truncated.vertices&&t.push("vertices truncated"),e.truncated.edges&&t.push("edges truncated"),n?.truncated&&t.push("services truncated"),t.join(" \xB7 ")});scopeLabel=kt(()=>{let e=this.activeServiceNames();return e===null?"all entities":`${e.length} services`});constructor(){this.sessionStore.ensureLoaded(),ar(()=>{this.session()?.configAlias??null?this.loadGraph():this.graph.set(null)})}cy=null;toggleDrawer(){this.drawerOpen.update(e=>!e)}closeDrawer(){this.drawerOpen.set(!1)}openPicker(){this.pickerOpen.set(!0)}closePicker(){this.pickerOpen.set(!1)}retry(){this.loadGraph()}onPickerApply(e){return Er(this,null,function*(){let t={entityThreshold:e.entityThreshold,selectedServiceNames:e.selectedServiceNames};this.settings.set(t),this.pickerOpen.set(!1);try{yield this.api.saveHomeGraphSettings(t)}catch(n){}this.loadGraph()})}onCyReady(e){this.cy=e}downloadError=Ke(null);downloadCanvas(){return Er(this,null,function*(){let e=this.cy;if(!e)return;this.downloadError.set(null);let t=2,n=40,a=64*1024*1024,i=8192,o=e.elements().boundingBox(),s=Math.max(1,o.w+n*2),u=Math.max(1,o.h+n*2),l=Math.sqrt(a/(s*u)),c=Math.min(i/s,i/u),f=Math.max(.25,Math.min(t,l,c)),d;try{d=yield e.png({output:"blob-promise",scale:f,full:!0,bg:"#0a0a0a"})}catch(y){this.downloadError.set(`Export failed at ${f.toFixed(2)}x (graph ${Math.round(s)}\xD7${Math.round(u)} px): ${y.message??"unknown"}`);return}if(!d||d.size===0){this.downloadError.set(`Export produced an empty image at ${f.toFixed(2)}x.`);return}let h=URL.createObjectURL(d),v=document.createElement("a");v.download=this.buildFilename(),v.rel="noopener",v.href=h,setTimeout(()=>{v.dispatchEvent(new MouseEvent("click"))},0),setTimeout(()=>URL.revokeObjectURL(h),40*1e3)})}buildFilename(){let n=(this.session()?.configAlias??"no-tenant").replace(/[^A-Za-z0-9_.-]/g,"_"),a=new Date,i=s=>String(s).padStart(2,"0"),o=`${i(a.getDate())}-${i(a.getMonth()+1)}-${a.getFullYear()}-${i(a.getHours())}-${i(a.getMinutes())}`;return`dx-do-graph.${n}.${o}.png`}loadGraph(){return Er(this,null,function*(){this.loading.set(!0),this.errorMessage.set(null);try{let[e,t]=yield Promise.all([this.api.getHomeGraphEntityCount(),this.api.getHomeGraphSettings()]);this.entityCount.set(e.count),this.settings.set(t);let n=e.count,a=t.entityThreshold,i=t.selectedServiceNames,o=null;if(Array.isArray(i))o=i;else if(n>a){let f=yield this.api.getHomeGraphServiceCounts();o=Uw(f.services,a);let d={entityThreshold:a,selectedServiceNames:o};this.settings.set(d);try{yield this.api.saveHomeGraphSettings(d)}catch(h){}}else o=null;this.activeServiceNames.set(o);let[s,u]=yield Promise.allSettled([this.api.getTasGraph(o?{serviceNames:o}:{}),this.api.getHomeGraphServices(o??void 0)]);if(s.status==="rejected")throw s.reason;this.graph.set(s.value),u.status==="fulfilled"?this.servicesOverlay.set(u.value):this.servicesOverlay.set(null);let l=s.value.vertices.length,c=u.status==="fulfilled"?u.value.services.length:0;this.nodeCount.set(l+c)}catch(e){this.errorMessage.set(e.message??"Failed to load TAS graph"),this.graph.set(null),this.servicesOverlay.set(null),this.nodeCount.set(0)}finally{this.loading.set(!1)}})}static \u0275fac=function(t){return new(t||r)};static \u0275cmp=Nr({type:r,selectors:[["dx-home-page"]],decls:3,vars:1,consts:[[1,"dx-home"],[1,"dx-empty"],[1,"dx-canvas",3,"cyReady","elements","layout"],[1,"dx-status-line"],[1,"dx-status-loading"],[1,"dx-status-error"],[1,"dx-status-ok"],["type","button","title","Style rules",1,"dx-style-toggle",3,"click"],[1,"pi","pi-palette"],["type","button",1,"dx-scope-pill",3,"click","title"],[1,"pi","pi-filter"],[3,"cancel","apply","open","initialSelectedNames","initialThreshold","entityTotal"],["type","button","title","Download canvas as PNG (2x)",1,"dx-download-btn",3,"click","disabled"],[1,"pi","pi-download"],[1,"dx-download-err"],[3,"close","open"],[1,"pi","pi-spin","pi-spinner"],[1,"pi","pi-exclamation-triangle"],["type","button",3,"click"],[1,"dx-empty-card"],[1,"pi","pi-server","dx-empty-icon"]],template:function(t,n){t&1&&(pt(0,"div",0),Wt(1,Gw,16,14)(2,Hw,7,0,"div",1),At()),t&2&&(_e(),Xt(n.session()?1:2))},dependencies:[Po,Ro,Bo],styles:["[_nghost-%COMP%]{display:flex;flex:1;min-height:0}.dx-home[_ngcontent-%COMP%]{position:relative;flex:1;min-height:0;display:flex;background:var(--dx-bg-canvas-vignette)}.dx-canvas[_ngcontent-%COMP%]{display:block;width:100%;height:100%}.dx-empty[_ngcontent-%COMP%]{flex:1;display:flex;align-items:center;justify-content:center;padding:2rem;background:var(--dx-bg-canvas-vignette)}.dx-empty-card[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:center;gap:.6rem;padding:2rem 2.5rem;border:1px solid rgba(134,239,172,.25);border-radius:.75rem;background:#0f0f12d9;box-shadow:var(--dx-glow);color:var(--dx-text);max-width:28rem;text-align:center;-webkit-backdrop-filter:blur(6px);backdrop-filter:blur(6px)}.dx-empty-card[_ngcontent-%COMP%] h2[_ngcontent-%COMP%]{margin:0;font-size:1.1rem;font-weight:500;letter-spacing:.02em}.dx-empty-card[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{margin:0;font-size:.85rem;color:var(--dx-text-muted)}.dx-empty-icon[_ngcontent-%COMP%]{font-size:2rem;color:var(--dx-accent-strong);text-shadow:var(--dx-glow);margin-bottom:.25rem}.dx-status-line[_ngcontent-%COMP%]{position:absolute;bottom:1rem;left:1rem;font-size:.75rem;color:var(--dx-text-muted);font-family:SF Mono,Menlo,monospace;display:flex;gap:1rem;pointer-events:none;z-index:5}.dx-status-line[_ngcontent-%COMP%] > *[_ngcontent-%COMP%]{pointer-events:auto}.dx-status-loading[_ngcontent-%COMP%], .dx-status-error[_ngcontent-%COMP%], .dx-status-ok[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.4rem;padding:.3rem .6rem;border-radius:.4rem;background:#0f0f12b3;border:1px solid rgba(255,255,255,.08);-webkit-backdrop-filter:blur(6px);backdrop-filter:blur(6px)}.dx-status-error[_ngcontent-%COMP%]{color:#fca5a5f2;border-color:#fca5a559}.dx-status-error[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{margin-left:.4rem;background:transparent;border:1px solid rgba(252,165,165,.5);color:inherit;border-radius:.3rem;padding:.05rem .4rem;cursor:pointer;font-size:.7rem;font-family:inherit}.dx-status-ok[_ngcontent-%COMP%] i[_ngcontent-%COMP%]{color:var(--dx-accent-strong)}.dx-scope-pill[_ngcontent-%COMP%]{position:absolute;top:1rem;right:4rem;display:inline-flex;align-items:center;gap:.4rem;padding:.35rem .65rem;border-radius:.4rem;background:#0f0f12d9;border:1px solid rgba(134,239,172,.25);color:var(--dx-text);font-size:.78rem;cursor:pointer;z-index:6;transition:background .12s ease,border-color .12s ease,box-shadow .12s ease}.dx-scope-pill[_ngcontent-%COMP%] i[_ngcontent-%COMP%]{color:var(--dx-accent-strong);font-size:.85rem}.dx-scope-pill[_ngcontent-%COMP%]:hover{border-color:#86efac8c;box-shadow:var(--dx-glow)}.dx-style-toggle[_ngcontent-%COMP%]{position:absolute;top:1rem;right:1rem;width:2rem;height:2rem;border-radius:.4rem;background:#0f0f12d9;border:1px solid rgba(134,239,172,.25);color:var(--dx-accent-strong);cursor:pointer;display:inline-flex;align-items:center;justify-content:center;z-index:6}.dx-style-toggle[_ngcontent-%COMP%]:hover{border-color:#86efac8c;box-shadow:var(--dx-glow)}.dx-download-err[_ngcontent-%COMP%]{position:absolute;bottom:1rem;right:4rem;display:inline-flex;align-items:center;gap:.4rem;padding:.3rem .6rem;border-radius:.4rem;background:#0f0f12d9;border:1px solid rgba(252,165,165,.4);color:#fca5a5f2;font-size:.75rem;z-index:6;pointer-events:none}.dx-download-btn[_ngcontent-%COMP%]{position:absolute;bottom:1rem;right:1rem;width:2.25rem;height:2.25rem;border-radius:.4rem;background:#0f0f12d9;border:1px solid rgba(134,239,172,.25);color:var(--dx-accent-strong);cursor:pointer;display:inline-flex;align-items:center;justify-content:center;font-size:1rem;z-index:6;transition:background .12s ease,border-color .12s ease,box-shadow .12s ease}.dx-download-btn[_ngcontent-%COMP%]:hover:not(:disabled){border-color:#86efac8c;background:#0f0f12f2;box-shadow:var(--dx-glow)}.dx-download-btn[_ngcontent-%COMP%]:disabled{opacity:.4;cursor:not-allowed}"],changeDetection:0})};function Uw(r,e){let t=r.filter(i=>i.count>0&&i.count<=e).slice().sort((i,o)=>o.count-i.count),n=[],a=0;for(let i of t)a+i.count>e||(n.push(i.name),a+=i.count);return n}export{fp as HomePageComponent};