@antv/layout 1.2.14-beta.9 → 2.0.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +26 -301
- package/dist/index.js +32816 -0
- package/dist/index.js.map +1 -0
- package/dist/index.min.js +7 -2
- package/dist/index.min.js.map +1 -1
- package/dist/worker.js +8 -0
- package/dist/worker.js.map +1 -0
- package/lib/_virtual/_cloneBuffer.js +4 -0
- package/lib/_virtual/_cloneBuffer.js.map +1 -0
- package/lib/_virtual/_commonjs-dynamic-modules.js +6 -0
- package/lib/_virtual/_commonjs-dynamic-modules.js.map +1 -0
- package/lib/_virtual/_commonjsHelpers.js +37 -0
- package/lib/_virtual/_commonjsHelpers.js.map +1 -0
- package/lib/_virtual/_nodeUtil.js +4 -0
- package/lib/_virtual/_nodeUtil.js.map +1 -0
- package/lib/_virtual/index.js +8 -0
- package/lib/_virtual/index.js.map +1 -0
- package/lib/_virtual/index2.js +7 -0
- package/lib/_virtual/index2.js.map +1 -0
- package/lib/_virtual/index3.js +7 -0
- package/lib/_virtual/index3.js.map +1 -0
- package/lib/_virtual/isBuffer.js +4 -0
- package/lib/_virtual/isBuffer.js.map +1 -0
- package/lib/_virtual/matrix.js +8 -0
- package/lib/_virtual/matrix.js.map +1 -0
- package/lib/_virtual/matrix2.js +4 -0
- package/lib/_virtual/matrix2.js.map +1 -0
- package/lib/algorithm/antv-dagre/acyclic.js +40 -0
- package/lib/algorithm/antv-dagre/acyclic.js.map +1 -0
- package/lib/algorithm/antv-dagre/add-border-segments.js +42 -0
- package/lib/algorithm/antv-dagre/add-border-segments.js.map +1 -0
- package/lib/algorithm/antv-dagre/coordinate-system.js +66 -0
- package/lib/algorithm/antv-dagre/coordinate-system.js.map +1 -0
- package/lib/algorithm/antv-dagre/data/list.js +50 -0
- package/lib/algorithm/antv-dagre/data/list.js.map +1 -0
- package/lib/algorithm/antv-dagre/graph.js +429 -0
- package/lib/algorithm/antv-dagre/graph.js.map +1 -0
- package/lib/algorithm/antv-dagre/greedy-fas.js +139 -0
- package/lib/algorithm/antv-dagre/greedy-fas.js.map +1 -0
- package/lib/algorithm/antv-dagre/index.d.ts +15 -0
- package/lib/algorithm/antv-dagre/index.js +337 -0
- package/lib/algorithm/antv-dagre/index.js.map +1 -0
- package/lib/algorithm/antv-dagre/layout.js +471 -0
- package/lib/algorithm/antv-dagre/layout.js.map +1 -0
- package/lib/algorithm/antv-dagre/nesting-graph.js +154 -0
- package/lib/algorithm/antv-dagre/nesting-graph.js.map +1 -0
- package/lib/algorithm/antv-dagre/normalize.js +100 -0
- package/lib/algorithm/antv-dagre/normalize.js.map +1 -0
- package/lib/algorithm/antv-dagre/order/add-subgraph-constraints.js +47 -0
- package/lib/algorithm/antv-dagre/order/add-subgraph-constraints.js.map +1 -0
- package/lib/algorithm/antv-dagre/order/barycenter.js +25 -0
- package/lib/algorithm/antv-dagre/order/barycenter.js.map +1 -0
- package/lib/algorithm/antv-dagre/order/build-layer-graph.js +89 -0
- package/lib/algorithm/antv-dagre/order/build-layer-graph.js.map +1 -0
- package/lib/algorithm/antv-dagre/order/cross-count.js +66 -0
- package/lib/algorithm/antv-dagre/order/cross-count.js.map +1 -0
- package/lib/algorithm/antv-dagre/order/index.js +94 -0
- package/lib/algorithm/antv-dagre/order/index.js.map +1 -0
- package/lib/algorithm/antv-dagre/order/init-data-order.js +29 -0
- package/lib/algorithm/antv-dagre/order/init-data-order.js.map +1 -0
- package/lib/algorithm/antv-dagre/order/init-order.js +49 -0
- package/lib/algorithm/antv-dagre/order/init-order.js.map +1 -0
- package/lib/algorithm/antv-dagre/order/resolve-conflicts.js +119 -0
- package/lib/algorithm/antv-dagre/order/resolve-conflicts.js.map +1 -0
- package/lib/algorithm/antv-dagre/order/sort-subgraph.js +87 -0
- package/lib/algorithm/antv-dagre/order/sort-subgraph.js.map +1 -0
- package/lib/algorithm/antv-dagre/order/sort.js +77 -0
- package/lib/algorithm/antv-dagre/order/sort.js.map +1 -0
- package/lib/algorithm/antv-dagre/parent-dummy-chains.js +82 -0
- package/lib/algorithm/antv-dagre/parent-dummy-chains.js.map +1 -0
- package/lib/algorithm/antv-dagre/position/bk.js +366 -0
- package/lib/algorithm/antv-dagre/position/bk.js.map +1 -0
- package/lib/algorithm/antv-dagre/position/index.js +54 -0
- package/lib/algorithm/antv-dagre/position/index.js.map +1 -0
- package/lib/algorithm/antv-dagre/rank/feasible-tree.js +166 -0
- package/lib/algorithm/antv-dagre/rank/feasible-tree.js.map +1 -0
- package/lib/algorithm/antv-dagre/rank/index.js +51 -0
- package/lib/algorithm/antv-dagre/rank/index.js.map +1 -0
- package/lib/algorithm/antv-dagre/rank/network-simplex.js +234 -0
- package/lib/algorithm/antv-dagre/rank/network-simplex.js.map +1 -0
- package/lib/algorithm/antv-dagre/rank/util.js +139 -0
- package/lib/algorithm/antv-dagre/rank/util.js.map +1 -0
- package/lib/algorithm/antv-dagre/types.d.ts +170 -0
- package/lib/algorithm/antv-dagre/util.js +265 -0
- package/lib/algorithm/antv-dagre/util.js.map +1 -0
- package/lib/algorithm/base-layout.d.ts +48 -0
- package/lib/algorithm/base-layout.js +87 -0
- package/lib/algorithm/base-layout.js.map +1 -0
- package/lib/algorithm/base-simulation.d.ts +20 -0
- package/lib/algorithm/base-simulation.js +75 -0
- package/lib/algorithm/base-simulation.js.map +1 -0
- package/lib/algorithm/circular/index.d.ts +15 -0
- package/lib/algorithm/circular/index.js +108 -0
- package/lib/algorithm/circular/index.js.map +1 -0
- package/lib/algorithm/circular/types.d.ts +105 -0
- package/lib/algorithm/combo-combined/index.d.ts +33 -0
- package/lib/algorithm/combo-combined/index.js +303 -0
- package/lib/algorithm/combo-combined/index.js.map +1 -0
- package/lib/algorithm/combo-combined/types.d.ts +37 -0
- package/lib/algorithm/concentric/index.d.ts +15 -0
- package/lib/algorithm/concentric/index.js +192 -0
- package/lib/algorithm/concentric/index.js.map +1 -0
- package/lib/algorithm/concentric/types.d.ts +92 -0
- package/lib/algorithm/d3-force/force-in-a-box.js +343 -0
- package/lib/algorithm/d3-force/force-in-a-box.js.map +1 -0
- package/lib/algorithm/d3-force/index.d.ts +53 -0
- package/lib/algorithm/d3-force/index.js +552 -0
- package/lib/algorithm/d3-force/index.js.map +1 -0
- package/lib/algorithm/d3-force/types.d.ts +336 -0
- package/lib/algorithm/d3-force-3d/index.d.ts +26 -0
- package/lib/algorithm/d3-force-3d/index.js +73 -0
- package/lib/algorithm/d3-force-3d/index.js.map +1 -0
- package/lib/algorithm/d3-force-3d/types.d.ts +50 -0
- package/lib/algorithm/dagre/index.d.ts +22 -0
- package/lib/algorithm/dagre/index.js +142 -0
- package/lib/algorithm/dagre/index.js.map +1 -0
- package/lib/algorithm/dagre/types.d.ts +79 -0
- package/lib/algorithm/force/attractive.js +60 -0
- package/lib/algorithm/force/attractive.js.map +1 -0
- package/lib/algorithm/force/centripetal.js +87 -0
- package/lib/algorithm/force/centripetal.js.map +1 -0
- package/lib/algorithm/force/collide.js +172 -0
- package/lib/algorithm/force/collide.js.map +1 -0
- package/lib/algorithm/force/gravity.js +50 -0
- package/lib/algorithm/force/gravity.js.map +1 -0
- package/lib/algorithm/force/index.d.ts +87 -0
- package/lib/algorithm/force/index.js +450 -0
- package/lib/algorithm/force/index.js.map +1 -0
- package/lib/algorithm/force/repulsive.js +142 -0
- package/lib/algorithm/force/repulsive.js.map +1 -0
- package/lib/algorithm/force/simulation.d.ts +23 -0
- package/lib/algorithm/force/simulation.js +137 -0
- package/lib/algorithm/force/simulation.js.map +1 -0
- package/lib/algorithm/force/types.d.ts +252 -0
- package/lib/algorithm/force-atlas2/body.js +91 -0
- package/lib/algorithm/force-atlas2/body.js.map +1 -0
- package/lib/algorithm/force-atlas2/index.d.ts +22 -0
- package/lib/algorithm/force-atlas2/index.js +155 -0
- package/lib/algorithm/force-atlas2/index.js.map +1 -0
- package/lib/algorithm/force-atlas2/quad-tree.js +106 -0
- package/lib/algorithm/force-atlas2/quad-tree.js.map +1 -0
- package/lib/algorithm/force-atlas2/quad.js +98 -0
- package/lib/algorithm/force-atlas2/quad.js.map +1 -0
- package/lib/algorithm/force-atlas2/simulation.d.ts +39 -0
- package/lib/algorithm/force-atlas2/simulation.js +388 -0
- package/lib/algorithm/force-atlas2/simulation.js.map +1 -0
- package/lib/algorithm/force-atlas2/types.d.ts +109 -0
- package/lib/algorithm/fruchterman/index.d.ts +20 -0
- package/lib/algorithm/fruchterman/index.js +93 -0
- package/lib/algorithm/fruchterman/index.js.map +1 -0
- package/lib/algorithm/fruchterman/simulation.js +356 -0
- package/lib/algorithm/fruchterman/simulation.js.map +1 -0
- package/lib/algorithm/fruchterman/types.d.ts +48 -0
- package/lib/algorithm/grid/index.d.ts +16 -0
- package/lib/algorithm/grid/index.js +243 -0
- package/lib/algorithm/grid/index.js.map +1 -0
- package/lib/algorithm/grid/types.d.ts +85 -0
- package/lib/algorithm/mds/index.d.ts +15 -0
- package/lib/algorithm/mds/index.js +127 -0
- package/lib/algorithm/mds/index.js.map +1 -0
- package/lib/algorithm/mds/types.d.ts +25 -0
- package/lib/algorithm/radial/index.d.ts +16 -0
- package/lib/algorithm/radial/index.js +275 -0
- package/lib/algorithm/radial/index.js.map +1 -0
- package/lib/algorithm/radial/radial-nonoverlap-force.js +129 -0
- package/lib/algorithm/radial/radial-nonoverlap-force.js.map +1 -0
- package/lib/algorithm/radial/types.d.ts +103 -0
- package/lib/algorithm/random/index.d.ts +15 -0
- package/lib/algorithm/random/index.js +41 -0
- package/lib/algorithm/random/index.js.map +1 -0
- package/lib/algorithm/random/types.d.ts +11 -0
- package/lib/algorithm/types.d.ts +142 -0
- package/lib/index.d.ts +50 -2
- package/lib/index.js +28 -3
- package/lib/index.js.map +1 -1
- package/lib/model/data.d.ts +46 -0
- package/lib/model/data.js +281 -0
- package/lib/model/data.js.map +1 -0
- package/lib/node_modules/@antv/event-emitter/esm/index.js +107 -0
- package/lib/node_modules/@antv/event-emitter/esm/index.js.map +1 -0
- package/lib/node_modules/@antv/util/esm/lodash/clone.js +34 -0
- package/lib/node_modules/@antv/util/esm/lodash/clone.js.map +1 -0
- package/lib/node_modules/@antv/util/esm/lodash/deep-mix.js +54 -0
- package/lib/node_modules/@antv/util/esm/lodash/deep-mix.js.map +1 -0
- package/lib/node_modules/@antv/util/esm/lodash/each.js +30 -0
- package/lib/node_modules/@antv/util/esm/lodash/each.js.map +1 -0
- package/lib/node_modules/@antv/util/esm/lodash/get-type.js +10 -0
- package/lib/node_modules/@antv/util/esm/lodash/get-type.js.map +1 -0
- package/lib/node_modules/@antv/util/esm/lodash/get.js +19 -0
- package/lib/node_modules/@antv/util/esm/lodash/get.js.map +1 -0
- package/lib/node_modules/@antv/util/esm/lodash/is-array-like.js +12 -0
- package/lib/node_modules/@antv/util/esm/lodash/is-array-like.js.map +1 -0
- package/lib/node_modules/@antv/util/esm/lodash/is-array.js +10 -0
- package/lib/node_modules/@antv/util/esm/lodash/is-array.js.map +1 -0
- package/lib/node_modules/@antv/util/esm/lodash/is-boolean.js +14 -0
- package/lib/node_modules/@antv/util/esm/lodash/is-boolean.js.map +1 -0
- package/lib/node_modules/@antv/util/esm/lodash/is-empty.js +39 -0
- package/lib/node_modules/@antv/util/esm/lodash/is-empty.js.map +1 -0
- package/lib/node_modules/@antv/util/esm/lodash/is-function.js +10 -0
- package/lib/node_modules/@antv/util/esm/lodash/is-function.js.map +1 -0
- package/lib/node_modules/@antv/util/esm/lodash/is-nil.js +10 -0
- package/lib/node_modules/@antv/util/esm/lodash/is-nil.js.map +1 -0
- package/lib/node_modules/@antv/util/esm/lodash/is-number.js +10 -0
- package/lib/node_modules/@antv/util/esm/lodash/is-number.js.map +1 -0
- package/lib/node_modules/@antv/util/esm/lodash/is-object-like.js +12 -0
- package/lib/node_modules/@antv/util/esm/lodash/is-object-like.js.map +1 -0
- package/lib/node_modules/@antv/util/esm/lodash/is-object.js +13 -0
- package/lib/node_modules/@antv/util/esm/lodash/is-object.js.map +1 -0
- package/lib/node_modules/@antv/util/esm/lodash/is-plain-object.js +25 -0
- package/lib/node_modules/@antv/util/esm/lodash/is-plain-object.js.map +1 -0
- package/lib/node_modules/@antv/util/esm/lodash/is-prototype.js +9 -0
- package/lib/node_modules/@antv/util/esm/lodash/is-prototype.js.map +1 -0
- package/lib/node_modules/@antv/util/esm/lodash/is-string.js +10 -0
- package/lib/node_modules/@antv/util/esm/lodash/is-string.js.map +1 -0
- package/lib/node_modules/@antv/util/esm/lodash/is-type.js +5 -0
- package/lib/node_modules/@antv/util/esm/lodash/is-type.js.map +1 -0
- package/lib/node_modules/@antv/util/esm/lodash/pick.js +19 -0
- package/lib/node_modules/@antv/util/esm/lodash/pick.js.map +1 -0
- package/lib/node_modules/@antv/util/esm/lodash/set.js +30 -0
- package/lib/node_modules/@antv/util/esm/lodash/set.js.map +1 -0
- package/lib/node_modules/comlink/dist/esm/comlink.js +351 -0
- package/lib/node_modules/comlink/dist/esm/comlink.js.map +1 -0
- package/lib/node_modules/d3-binarytree/src/add.js +71 -0
- package/lib/node_modules/d3-binarytree/src/add.js.map +1 -0
- package/lib/node_modules/d3-binarytree/src/binarytree.js +71 -0
- package/lib/node_modules/d3-binarytree/src/binarytree.js.map +1 -0
- package/lib/node_modules/d3-binarytree/src/cover.js +39 -0
- package/lib/node_modules/d3-binarytree/src/cover.js.map +1 -0
- package/lib/node_modules/d3-binarytree/src/data.js +10 -0
- package/lib/node_modules/d3-binarytree/src/data.js.map +1 -0
- package/lib/node_modules/d3-binarytree/src/extent.js +8 -0
- package/lib/node_modules/d3-binarytree/src/extent.js.map +1 -0
- package/lib/node_modules/d3-binarytree/src/find.js +61 -0
- package/lib/node_modules/d3-binarytree/src/find.js.map +1 -0
- package/lib/node_modules/d3-binarytree/src/half.js +8 -0
- package/lib/node_modules/d3-binarytree/src/half.js.map +1 -0
- package/lib/node_modules/d3-binarytree/src/remove.js +59 -0
- package/lib/node_modules/d3-binarytree/src/remove.js.map +1 -0
- package/lib/node_modules/d3-binarytree/src/root.js +6 -0
- package/lib/node_modules/d3-binarytree/src/root.js.map +1 -0
- package/lib/node_modules/d3-binarytree/src/size.js +10 -0
- package/lib/node_modules/d3-binarytree/src/size.js.map +1 -0
- package/lib/node_modules/d3-binarytree/src/visit.js +17 -0
- package/lib/node_modules/d3-binarytree/src/visit.js.map +1 -0
- package/lib/node_modules/d3-binarytree/src/visitAfter.js +22 -0
- package/lib/node_modules/d3-binarytree/src/visitAfter.js.map +1 -0
- package/lib/node_modules/d3-binarytree/src/x.js +10 -0
- package/lib/node_modules/d3-binarytree/src/x.js.map +1 -0
- package/lib/node_modules/d3-dispatch/src/dispatch.js +85 -0
- package/lib/node_modules/d3-dispatch/src/dispatch.js.map +1 -0
- package/lib/node_modules/d3-force/src/center.js +43 -0
- package/lib/node_modules/d3-force/src/center.js.map +1 -0
- package/lib/node_modules/d3-force/src/collide.js +103 -0
- package/lib/node_modules/d3-force/src/collide.js.map +1 -0
- package/lib/node_modules/d3-force/src/constant.js +8 -0
- package/lib/node_modules/d3-force/src/constant.js.map +1 -0
- package/lib/node_modules/d3-force/src/jiggle.js +6 -0
- package/lib/node_modules/d3-force/src/jiggle.js.map +1 -0
- package/lib/node_modules/d3-force/src/lcg.js +12 -0
- package/lib/node_modules/d3-force/src/lcg.js.map +1 -0
- package/lib/node_modules/d3-force/src/link.js +120 -0
- package/lib/node_modules/d3-force/src/link.js.map +1 -0
- package/lib/node_modules/d3-force/src/manyBody.js +119 -0
- package/lib/node_modules/d3-force/src/manyBody.js.map +1 -0
- package/lib/node_modules/d3-force/src/radial.js +60 -0
- package/lib/node_modules/d3-force/src/radial.js.map +1 -0
- package/lib/node_modules/d3-force/src/simulation.js +159 -0
- package/lib/node_modules/d3-force/src/simulation.js.map +1 -0
- package/lib/node_modules/d3-force/src/x.js +44 -0
- package/lib/node_modules/d3-force/src/x.js.map +1 -0
- package/lib/node_modules/d3-force/src/y.js +44 -0
- package/lib/node_modules/d3-force/src/y.js.map +1 -0
- package/lib/node_modules/d3-force-3d/src/center.js +52 -0
- package/lib/node_modules/d3-force-3d/src/center.js.map +1 -0
- package/lib/node_modules/d3-force-3d/src/collide.js +135 -0
- package/lib/node_modules/d3-force-3d/src/collide.js.map +1 -0
- package/lib/node_modules/d3-force-3d/src/constant.js +8 -0
- package/lib/node_modules/d3-force-3d/src/constant.js.map +1 -0
- package/lib/node_modules/d3-force-3d/src/jiggle.js +6 -0
- package/lib/node_modules/d3-force-3d/src/jiggle.js.map +1 -0
- package/lib/node_modules/d3-force-3d/src/lcg.js +12 -0
- package/lib/node_modules/d3-force-3d/src/lcg.js.map +1 -0
- package/lib/node_modules/d3-force-3d/src/link.js +127 -0
- package/lib/node_modules/d3-force-3d/src/link.js.map +1 -0
- package/lib/node_modules/d3-force-3d/src/manyBody.js +142 -0
- package/lib/node_modules/d3-force-3d/src/manyBody.js.map +1 -0
- package/lib/node_modules/d3-force-3d/src/radial.js +70 -0
- package/lib/node_modules/d3-force-3d/src/radial.js.map +1 -0
- package/lib/node_modules/d3-force-3d/src/simulation.js +202 -0
- package/lib/node_modules/d3-force-3d/src/simulation.js.map +1 -0
- package/lib/node_modules/d3-force-3d/src/x.js +44 -0
- package/lib/node_modules/d3-force-3d/src/x.js.map +1 -0
- package/lib/node_modules/d3-force-3d/src/y.js +44 -0
- package/lib/node_modules/d3-force-3d/src/y.js.map +1 -0
- package/lib/node_modules/d3-force-3d/src/z.js +44 -0
- package/lib/node_modules/d3-force-3d/src/z.js.map +1 -0
- package/lib/node_modules/d3-octree/src/add.js +101 -0
- package/lib/node_modules/d3-octree/src/add.js.map +1 -0
- package/lib/node_modules/d3-octree/src/cover.js +55 -0
- package/lib/node_modules/d3-octree/src/cover.js.map +1 -0
- package/lib/node_modules/d3-octree/src/data.js +10 -0
- package/lib/node_modules/d3-octree/src/data.js.map +1 -0
- package/lib/node_modules/d3-octree/src/extent.js +8 -0
- package/lib/node_modules/d3-octree/src/extent.js.map +1 -0
- package/lib/node_modules/d3-octree/src/find.js +85 -0
- package/lib/node_modules/d3-octree/src/find.js.map +1 -0
- package/lib/node_modules/d3-octree/src/findAll.js +29 -0
- package/lib/node_modules/d3-octree/src/findAll.js.map +1 -0
- package/lib/node_modules/d3-octree/src/octant.js +12 -0
- package/lib/node_modules/d3-octree/src/octant.js.map +1 -0
- package/lib/node_modules/d3-octree/src/octree.js +83 -0
- package/lib/node_modules/d3-octree/src/octree.js.map +1 -0
- package/lib/node_modules/d3-octree/src/remove.js +71 -0
- package/lib/node_modules/d3-octree/src/remove.js.map +1 -0
- package/lib/node_modules/d3-octree/src/root.js +6 -0
- package/lib/node_modules/d3-octree/src/root.js.map +1 -0
- package/lib/node_modules/d3-octree/src/size.js +10 -0
- package/lib/node_modules/d3-octree/src/size.js.map +1 -0
- package/lib/node_modules/d3-octree/src/visit.js +23 -0
- package/lib/node_modules/d3-octree/src/visit.js.map +1 -0
- package/lib/node_modules/d3-octree/src/visitAfter.js +28 -0
- package/lib/node_modules/d3-octree/src/visitAfter.js.map +1 -0
- package/lib/node_modules/d3-octree/src/x.js +10 -0
- package/lib/node_modules/d3-octree/src/x.js.map +1 -0
- package/lib/node_modules/d3-octree/src/y.js +10 -0
- package/lib/node_modules/d3-octree/src/y.js.map +1 -0
- package/lib/node_modules/d3-octree/src/z.js +10 -0
- package/lib/node_modules/d3-octree/src/z.js.map +1 -0
- package/lib/node_modules/d3-quadtree/src/add.js +87 -0
- package/lib/node_modules/d3-quadtree/src/add.js.map +1 -0
- package/lib/node_modules/d3-quadtree/src/cover.js +46 -0
- package/lib/node_modules/d3-quadtree/src/cover.js.map +1 -0
- package/lib/node_modules/d3-quadtree/src/data.js +10 -0
- package/lib/node_modules/d3-quadtree/src/data.js.map +1 -0
- package/lib/node_modules/d3-quadtree/src/extent.js +8 -0
- package/lib/node_modules/d3-quadtree/src/extent.js.map +1 -0
- package/lib/node_modules/d3-quadtree/src/find.js +73 -0
- package/lib/node_modules/d3-quadtree/src/find.js.map +1 -0
- package/lib/node_modules/d3-quadtree/src/quad.js +10 -0
- package/lib/node_modules/d3-quadtree/src/quad.js.map +1 -0
- package/lib/node_modules/d3-quadtree/src/quadtree.js +76 -0
- package/lib/node_modules/d3-quadtree/src/quadtree.js.map +1 -0
- package/lib/node_modules/d3-quadtree/src/remove.js +65 -0
- package/lib/node_modules/d3-quadtree/src/remove.js.map +1 -0
- package/lib/node_modules/d3-quadtree/src/root.js +6 -0
- package/lib/node_modules/d3-quadtree/src/root.js.map +1 -0
- package/lib/node_modules/d3-quadtree/src/size.js +10 -0
- package/lib/node_modules/d3-quadtree/src/size.js.map +1 -0
- package/lib/node_modules/d3-quadtree/src/visit.js +19 -0
- package/lib/node_modules/d3-quadtree/src/visit.js.map +1 -0
- package/lib/node_modules/d3-quadtree/src/visitAfter.js +24 -0
- package/lib/node_modules/d3-quadtree/src/visitAfter.js.map +1 -0
- package/lib/node_modules/d3-quadtree/src/x.js +10 -0
- package/lib/node_modules/d3-quadtree/src/x.js.map +1 -0
- package/lib/node_modules/d3-quadtree/src/y.js +10 -0
- package/lib/node_modules/d3-quadtree/src/y.js.map +1 -0
- package/lib/node_modules/d3-timer/src/timer.js +113 -0
- package/lib/node_modules/d3-timer/src/timer.js.map +1 -0
- package/lib/node_modules/dagre/index.js +50 -0
- package/lib/node_modules/dagre/index.js.map +1 -0
- package/lib/node_modules/dagre/lib/acyclic.js +80 -0
- package/lib/node_modules/dagre/lib/acyclic.js.map +1 -0
- package/lib/node_modules/dagre/lib/add-border-segments.js +52 -0
- package/lib/node_modules/dagre/lib/add-border-segments.js.map +1 -0
- package/lib/node_modules/dagre/lib/coordinate-system.js +84 -0
- package/lib/node_modules/dagre/lib/coordinate-system.js.map +1 -0
- package/lib/node_modules/dagre/lib/data/list.js +67 -0
- package/lib/node_modules/dagre/lib/data/list.js.map +1 -0
- package/lib/node_modules/dagre/lib/debug.js +49 -0
- package/lib/node_modules/dagre/lib/debug.js.map +1 -0
- package/lib/node_modules/dagre/lib/graphlib.js +31 -0
- package/lib/node_modules/dagre/lib/graphlib.js.map +1 -0
- package/lib/node_modules/dagre/lib/greedy-fas.js +133 -0
- package/lib/node_modules/dagre/lib/greedy-fas.js.map +1 -0
- package/lib/node_modules/dagre/lib/layout.js +415 -0
- package/lib/node_modules/dagre/lib/layout.js.map +1 -0
- package/lib/node_modules/dagre/lib/lodash.js +83 -0
- package/lib/node_modules/dagre/lib/lodash.js.map +1 -0
- package/lib/node_modules/dagre/lib/nesting-graph.js +146 -0
- package/lib/node_modules/dagre/lib/nesting-graph.js.map +1 -0
- package/lib/node_modules/dagre/lib/normalize.js +103 -0
- package/lib/node_modules/dagre/lib/normalize.js.map +1 -0
- package/lib/node_modules/dagre/lib/order/add-subgraph-constraints.js +66 -0
- package/lib/node_modules/dagre/lib/order/add-subgraph-constraints.js.map +1 -0
- package/lib/node_modules/dagre/lib/order/barycenter.js +40 -0
- package/lib/node_modules/dagre/lib/order/barycenter.js.map +1 -0
- package/lib/node_modules/dagre/lib/order/build-layer-graph.js +87 -0
- package/lib/node_modules/dagre/lib/order/build-layer-graph.js.map +1 -0
- package/lib/node_modules/dagre/lib/order/cross-count.js +79 -0
- package/lib/node_modules/dagre/lib/order/cross-count.js.map +1 -0
- package/lib/node_modules/dagre/lib/order/index.js +98 -0
- package/lib/node_modules/dagre/lib/order/index.js.map +1 -0
- package/lib/node_modules/dagre/lib/order/init-order.js +50 -0
- package/lib/node_modules/dagre/lib/order/init-order.js.map +1 -0
- package/lib/node_modules/dagre/lib/order/resolve-conflicts.js +134 -0
- package/lib/node_modules/dagre/lib/order/resolve-conflicts.js.map +1 -0
- package/lib/node_modules/dagre/lib/order/sort-subgraph.js +92 -0
- package/lib/node_modules/dagre/lib/order/sort-subgraph.js.map +1 -0
- package/lib/node_modules/dagre/lib/order/sort.js +71 -0
- package/lib/node_modules/dagre/lib/order/sort.js.map +1 -0
- package/lib/node_modules/dagre/lib/parent-dummy-chains.js +99 -0
- package/lib/node_modules/dagre/lib/parent-dummy-chains.js.map +1 -0
- package/lib/node_modules/dagre/lib/position/bk.js +433 -0
- package/lib/node_modules/dagre/lib/position/bk.js.map +1 -0
- package/lib/node_modules/dagre/lib/position/index.js +43 -0
- package/lib/node_modules/dagre/lib/position/index.js.map +1 -0
- package/lib/node_modules/dagre/lib/rank/feasible-tree.js +103 -0
- package/lib/node_modules/dagre/lib/rank/feasible-tree.js.map +1 -0
- package/lib/node_modules/dagre/lib/rank/index.js +62 -0
- package/lib/node_modules/dagre/lib/rank/index.js.map +1 -0
- package/lib/node_modules/dagre/lib/rank/network-simplex.js +250 -0
- package/lib/node_modules/dagre/lib/rank/network-simplex.js.map +1 -0
- package/lib/node_modules/dagre/lib/rank/util.js +75 -0
- package/lib/node_modules/dagre/lib/rank/util.js.map +1 -0
- package/lib/node_modules/dagre/lib/util.js +251 -0
- package/lib/node_modules/dagre/lib/util.js.map +1 -0
- package/lib/node_modules/dagre/lib/version.js +12 -0
- package/lib/node_modules/dagre/lib/version.js.map +1 -0
- package/lib/node_modules/graphlib/index.js +53 -0
- package/lib/node_modules/graphlib/index.js.map +1 -0
- package/lib/node_modules/graphlib/lib/alg/components.js +40 -0
- package/lib/node_modules/graphlib/lib/alg/components.js.map +1 -0
- package/lib/node_modules/graphlib/lib/alg/dfs.js +55 -0
- package/lib/node_modules/graphlib/lib/alg/dfs.js.map +1 -0
- package/lib/node_modules/graphlib/lib/alg/dijkstra-all.js +24 -0
- package/lib/node_modules/graphlib/lib/alg/dijkstra-all.js.map +1 -0
- package/lib/node_modules/graphlib/lib/alg/dijkstra.js +68 -0
- package/lib/node_modules/graphlib/lib/alg/dijkstra.js.map +1 -0
- package/lib/node_modules/graphlib/lib/alg/find-cycles.js +24 -0
- package/lib/node_modules/graphlib/lib/alg/find-cycles.js.map +1 -0
- package/lib/node_modules/graphlib/lib/alg/floyd-warshall.js +63 -0
- package/lib/node_modules/graphlib/lib/alg/floyd-warshall.js.map +1 -0
- package/lib/node_modules/graphlib/lib/alg/index.js +36 -0
- package/lib/node_modules/graphlib/lib/alg/index.js.map +1 -0
- package/lib/node_modules/graphlib/lib/alg/is-acyclic.js +28 -0
- package/lib/node_modules/graphlib/lib/alg/is-acyclic.js.map +1 -0
- package/lib/node_modules/graphlib/lib/alg/postorder.js +20 -0
- package/lib/node_modules/graphlib/lib/alg/postorder.js.map +1 -0
- package/lib/node_modules/graphlib/lib/alg/preorder.js +20 -0
- package/lib/node_modules/graphlib/lib/alg/preorder.js.map +1 -0
- package/lib/node_modules/graphlib/lib/alg/prim.js +67 -0
- package/lib/node_modules/graphlib/lib/alg/prim.js.map +1 -0
- package/lib/node_modules/graphlib/lib/alg/tarjan.js +60 -0
- package/lib/node_modules/graphlib/lib/alg/tarjan.js.map +1 -0
- package/lib/node_modules/graphlib/lib/alg/topsort.js +48 -0
- package/lib/node_modules/graphlib/lib/alg/topsort.js.map +1 -0
- package/lib/node_modules/graphlib/lib/data/priority-queue.js +165 -0
- package/lib/node_modules/graphlib/lib/data/priority-queue.js.map +1 -0
- package/lib/node_modules/graphlib/lib/graph.js +544 -0
- package/lib/node_modules/graphlib/lib/graph.js.map +1 -0
- package/lib/node_modules/graphlib/lib/index.js +19 -0
- package/lib/node_modules/graphlib/lib/index.js.map +1 -0
- package/lib/node_modules/graphlib/lib/json.js +80 -0
- package/lib/node_modules/graphlib/lib/json.js.map +1 -0
- package/lib/node_modules/graphlib/lib/lodash.js +63 -0
- package/lib/node_modules/graphlib/lib/lodash.js.map +1 -0
- package/lib/node_modules/graphlib/lib/version.js +12 -0
- package/lib/node_modules/graphlib/lib/version.js.map +1 -0
- package/lib/node_modules/is-any-array/lib-esm/index.js +15 -0
- package/lib/node_modules/is-any-array/lib-esm/index.js.map +1 -0
- package/lib/node_modules/lodash/_DataView.js +21 -0
- package/lib/node_modules/lodash/_DataView.js.map +1 -0
- package/lib/node_modules/lodash/_Hash.js +49 -0
- package/lib/node_modules/lodash/_Hash.js.map +1 -0
- package/lib/node_modules/lodash/_ListCache.js +49 -0
- package/lib/node_modules/lodash/_ListCache.js.map +1 -0
- package/lib/node_modules/lodash/_Map.js +21 -0
- package/lib/node_modules/lodash/_Map.js.map +1 -0
- package/lib/node_modules/lodash/_MapCache.js +49 -0
- package/lib/node_modules/lodash/_MapCache.js.map +1 -0
- package/lib/node_modules/lodash/_Promise.js +21 -0
- package/lib/node_modules/lodash/_Promise.js.map +1 -0
- package/lib/node_modules/lodash/_Set.js +21 -0
- package/lib/node_modules/lodash/_Set.js.map +1 -0
- package/lib/node_modules/lodash/_SetCache.js +42 -0
- package/lib/node_modules/lodash/_SetCache.js.map +1 -0
- package/lib/node_modules/lodash/_Stack.js +45 -0
- package/lib/node_modules/lodash/_Stack.js.map +1 -0
- package/lib/node_modules/lodash/_Symbol.js +19 -0
- package/lib/node_modules/lodash/_Symbol.js.map +1 -0
- package/lib/node_modules/lodash/_Uint8Array.js +19 -0
- package/lib/node_modules/lodash/_Uint8Array.js.map +1 -0
- package/lib/node_modules/lodash/_WeakMap.js +21 -0
- package/lib/node_modules/lodash/_WeakMap.js.map +1 -0
- package/lib/node_modules/lodash/_apply.js +33 -0
- package/lib/node_modules/lodash/_apply.js.map +1 -0
- package/lib/node_modules/lodash/_arrayEach.js +34 -0
- package/lib/node_modules/lodash/_arrayEach.js.map +1 -0
- package/lib/node_modules/lodash/_arrayFilter.js +37 -0
- package/lib/node_modules/lodash/_arrayFilter.js.map +1 -0
- package/lib/node_modules/lodash/_arrayIncludes.js +30 -0
- package/lib/node_modules/lodash/_arrayIncludes.js.map +1 -0
- package/lib/node_modules/lodash/_arrayIncludesWith.js +34 -0
- package/lib/node_modules/lodash/_arrayIncludesWith.js.map +1 -0
- package/lib/node_modules/lodash/_arrayLikeKeys.js +67 -0
- package/lib/node_modules/lodash/_arrayLikeKeys.js.map +1 -0
- package/lib/node_modules/lodash/_arrayMap.js +33 -0
- package/lib/node_modules/lodash/_arrayMap.js.map +1 -0
- package/lib/node_modules/lodash/_arrayPush.js +32 -0
- package/lib/node_modules/lodash/_arrayPush.js.map +1 -0
- package/lib/node_modules/lodash/_arrayReduce.js +38 -0
- package/lib/node_modules/lodash/_arrayReduce.js.map +1 -0
- package/lib/node_modules/lodash/_arraySome.js +35 -0
- package/lib/node_modules/lodash/_arraySome.js.map +1 -0
- package/lib/node_modules/lodash/_asciiSize.js +25 -0
- package/lib/node_modules/lodash/_asciiSize.js.map +1 -0
- package/lib/node_modules/lodash/_assignMergeValue.js +34 -0
- package/lib/node_modules/lodash/_assignMergeValue.js.map +1 -0
- package/lib/node_modules/lodash/_assignValue.js +42 -0
- package/lib/node_modules/lodash/_assignValue.js.map +1 -0
- package/lib/node_modules/lodash/_assocIndexOf.js +34 -0
- package/lib/node_modules/lodash/_assocIndexOf.js.map +1 -0
- package/lib/node_modules/lodash/_baseAssign.js +31 -0
- package/lib/node_modules/lodash/_baseAssign.js.map +1 -0
- package/lib/node_modules/lodash/_baseAssignIn.js +31 -0
- package/lib/node_modules/lodash/_baseAssignIn.js.map +1 -0
- package/lib/node_modules/lodash/_baseAssignValue.js +38 -0
- package/lib/node_modules/lodash/_baseAssignValue.js.map +1 -0
- package/lib/node_modules/lodash/_baseClone.js +200 -0
- package/lib/node_modules/lodash/_baseClone.js.map +1 -0
- package/lib/node_modules/lodash/_baseCreate.js +43 -0
- package/lib/node_modules/lodash/_baseCreate.js.map +1 -0
- package/lib/node_modules/lodash/_baseEach.js +28 -0
- package/lib/node_modules/lodash/_baseEach.js.map +1 -0
- package/lib/node_modules/lodash/_baseExtremum.js +45 -0
- package/lib/node_modules/lodash/_baseExtremum.js.map +1 -0
- package/lib/node_modules/lodash/_baseFilter.js +34 -0
- package/lib/node_modules/lodash/_baseFilter.js.map +1 -0
- package/lib/node_modules/lodash/_baseFindIndex.js +36 -0
- package/lib/node_modules/lodash/_baseFindIndex.js.map +1 -0
- package/lib/node_modules/lodash/_baseFlatten.js +52 -0
- package/lib/node_modules/lodash/_baseFlatten.js.map +1 -0
- package/lib/node_modules/lodash/_baseFor.js +29 -0
- package/lib/node_modules/lodash/_baseFor.js.map +1 -0
- package/lib/node_modules/lodash/_baseForOwn.js +30 -0
- package/lib/node_modules/lodash/_baseForOwn.js.map +1 -0
- package/lib/node_modules/lodash/_baseGet.js +38 -0
- package/lib/node_modules/lodash/_baseGet.js.map +1 -0
- package/lib/node_modules/lodash/_baseGetAllKeys.js +34 -0
- package/lib/node_modules/lodash/_baseGetAllKeys.js.map +1 -0
- package/lib/node_modules/lodash/_baseGetTag.js +43 -0
- package/lib/node_modules/lodash/_baseGetTag.js.map +1 -0
- package/lib/node_modules/lodash/_baseGt.js +26 -0
- package/lib/node_modules/lodash/_baseGt.js.map +1 -0
- package/lib/node_modules/lodash/_baseHas.js +31 -0
- package/lib/node_modules/lodash/_baseHas.js.map +1 -0
- package/lib/node_modules/lodash/_baseHasIn.js +25 -0
- package/lib/node_modules/lodash/_baseHasIn.js.map +1 -0
- package/lib/node_modules/lodash/_baseIndexOf.js +35 -0
- package/lib/node_modules/lodash/_baseIndexOf.js.map +1 -0
- package/lib/node_modules/lodash/_baseIsArguments.js +32 -0
- package/lib/node_modules/lodash/_baseIsArguments.js.map +1 -0
- package/lib/node_modules/lodash/_baseIsEqual.js +42 -0
- package/lib/node_modules/lodash/_baseIsEqual.js.map +1 -0
- package/lib/node_modules/lodash/_baseIsEqualDeep.js +103 -0
- package/lib/node_modules/lodash/_baseIsEqualDeep.js.map +1 -0
- package/lib/node_modules/lodash/_baseIsMap.js +32 -0
- package/lib/node_modules/lodash/_baseIsMap.js.map +1 -0
- package/lib/node_modules/lodash/_baseIsMatch.js +76 -0
- package/lib/node_modules/lodash/_baseIsMatch.js.map +1 -0
- package/lib/node_modules/lodash/_baseIsNaN.js +24 -0
- package/lib/node_modules/lodash/_baseIsNaN.js.map +1 -0
- package/lib/node_modules/lodash/_baseIsNative.js +63 -0
- package/lib/node_modules/lodash/_baseIsNative.js.map +1 -0
- package/lib/node_modules/lodash/_baseIsSet.js +32 -0
- package/lib/node_modules/lodash/_baseIsSet.js.map +1 -0
- package/lib/node_modules/lodash/_baseIsTypedArray.js +75 -0
- package/lib/node_modules/lodash/_baseIsTypedArray.js.map +1 -0
- package/lib/node_modules/lodash/_baseIteratee.js +48 -0
- package/lib/node_modules/lodash/_baseIteratee.js.map +1 -0
- package/lib/node_modules/lodash/_baseKeys.js +44 -0
- package/lib/node_modules/lodash/_baseKeys.js.map +1 -0
- package/lib/node_modules/lodash/_baseKeysIn.js +48 -0
- package/lib/node_modules/lodash/_baseKeysIn.js.map +1 -0
- package/lib/node_modules/lodash/_baseLt.js +26 -0
- package/lib/node_modules/lodash/_baseLt.js.map +1 -0
- package/lib/node_modules/lodash/_baseMap.js +36 -0
- package/lib/node_modules/lodash/_baseMap.js.map +1 -0
- package/lib/node_modules/lodash/_baseMatches.js +37 -0
- package/lib/node_modules/lodash/_baseMatches.js.map +1 -0
- package/lib/node_modules/lodash/_baseMatchesProperty.js +52 -0
- package/lib/node_modules/lodash/_baseMatchesProperty.js.map +1 -0
- package/lib/node_modules/lodash/_baseMerge.js +61 -0
- package/lib/node_modules/lodash/_baseMerge.js.map +1 -0
- package/lib/node_modules/lodash/_baseMergeDeep.js +121 -0
- package/lib/node_modules/lodash/_baseMergeDeep.js.map +1 -0
- package/lib/node_modules/lodash/_baseOrderBy.js +70 -0
- package/lib/node_modules/lodash/_baseOrderBy.js.map +1 -0
- package/lib/node_modules/lodash/_basePick.js +33 -0
- package/lib/node_modules/lodash/_basePick.js.map +1 -0
- package/lib/node_modules/lodash/_basePickBy.js +45 -0
- package/lib/node_modules/lodash/_basePickBy.js.map +1 -0
- package/lib/node_modules/lodash/_baseProperty.js +26 -0
- package/lib/node_modules/lodash/_baseProperty.js.map +1 -0
- package/lib/node_modules/lodash/_basePropertyDeep.js +29 -0
- package/lib/node_modules/lodash/_basePropertyDeep.js.map +1 -0
- package/lib/node_modules/lodash/_baseRange.js +40 -0
- package/lib/node_modules/lodash/_baseRange.js.map +1 -0
- package/lib/node_modules/lodash/_baseReduce.js +35 -0
- package/lib/node_modules/lodash/_baseReduce.js.map +1 -0
- package/lib/node_modules/lodash/_baseRest.js +32 -0
- package/lib/node_modules/lodash/_baseRest.js.map +1 -0
- package/lib/node_modules/lodash/_baseSet.js +68 -0
- package/lib/node_modules/lodash/_baseSet.js.map +1 -0
- package/lib/node_modules/lodash/_baseSetToString.js +37 -0
- package/lib/node_modules/lodash/_baseSetToString.js.map +1 -0
- package/lib/node_modules/lodash/_baseSortBy.js +33 -0
- package/lib/node_modules/lodash/_baseSortBy.js.map +1 -0
- package/lib/node_modules/lodash/_baseTimes.js +32 -0
- package/lib/node_modules/lodash/_baseTimes.js.map +1 -0
- package/lib/node_modules/lodash/_baseToString.js +50 -0
- package/lib/node_modules/lodash/_baseToString.js.map +1 -0
- package/lib/node_modules/lodash/_baseTrim.js +32 -0
- package/lib/node_modules/lodash/_baseTrim.js.map +1 -0
- package/lib/node_modules/lodash/_baseUnary.js +26 -0
- package/lib/node_modules/lodash/_baseUnary.js.map +1 -0
- package/lib/node_modules/lodash/_baseUniq.js +90 -0
- package/lib/node_modules/lodash/_baseUniq.js.map +1 -0
- package/lib/node_modules/lodash/_baseValues.js +32 -0
- package/lib/node_modules/lodash/_baseValues.js.map +1 -0
- package/lib/node_modules/lodash/_baseZipObject.js +35 -0
- package/lib/node_modules/lodash/_baseZipObject.js.map +1 -0
- package/lib/node_modules/lodash/_cacheHas.js +25 -0
- package/lib/node_modules/lodash/_cacheHas.js.map +1 -0
- package/lib/node_modules/lodash/_castFunction.js +27 -0
- package/lib/node_modules/lodash/_castFunction.js.map +1 -0
- package/lib/node_modules/lodash/_castPath.js +37 -0
- package/lib/node_modules/lodash/_castPath.js.map +1 -0
- package/lib/node_modules/lodash/_cloneArrayBuffer.js +29 -0
- package/lib/node_modules/lodash/_cloneArrayBuffer.js.map +1 -0
- package/lib/node_modules/lodash/_cloneBuffer.js +52 -0
- package/lib/node_modules/lodash/_cloneBuffer.js.map +1 -0
- package/lib/node_modules/lodash/_cloneDataView.js +29 -0
- package/lib/node_modules/lodash/_cloneDataView.js.map +1 -0
- package/lib/node_modules/lodash/_cloneRegExp.js +29 -0
- package/lib/node_modules/lodash/_cloneRegExp.js.map +1 -0
- package/lib/node_modules/lodash/_cloneSymbol.js +31 -0
- package/lib/node_modules/lodash/_cloneSymbol.js.map +1 -0
- package/lib/node_modules/lodash/_cloneTypedArray.js +29 -0
- package/lib/node_modules/lodash/_cloneTypedArray.js.map +1 -0
- package/lib/node_modules/lodash/_compareAscending.js +54 -0
- package/lib/node_modules/lodash/_compareAscending.js.map +1 -0
- package/lib/node_modules/lodash/_compareMultiple.js +57 -0
- package/lib/node_modules/lodash/_compareMultiple.js.map +1 -0
- package/lib/node_modules/lodash/_copyArray.js +32 -0
- package/lib/node_modules/lodash/_copyArray.js.map +1 -0
- package/lib/node_modules/lodash/_copyObject.js +54 -0
- package/lib/node_modules/lodash/_copyObject.js.map +1 -0
- package/lib/node_modules/lodash/_copySymbols.js +30 -0
- package/lib/node_modules/lodash/_copySymbols.js.map +1 -0
- package/lib/node_modules/lodash/_copySymbolsIn.js +30 -0
- package/lib/node_modules/lodash/_copySymbolsIn.js.map +1 -0
- package/lib/node_modules/lodash/_coreJsData.js +19 -0
- package/lib/node_modules/lodash/_coreJsData.js.map +1 -0
- package/lib/node_modules/lodash/_createAssigner.js +51 -0
- package/lib/node_modules/lodash/_createAssigner.js.map +1 -0
- package/lib/node_modules/lodash/_createBaseEach.js +45 -0
- package/lib/node_modules/lodash/_createBaseEach.js.map +1 -0
- package/lib/node_modules/lodash/_createBaseFor.js +37 -0
- package/lib/node_modules/lodash/_createBaseFor.js.map +1 -0
- package/lib/node_modules/lodash/_createFind.js +40 -0
- package/lib/node_modules/lodash/_createFind.js.map +1 -0
- package/lib/node_modules/lodash/_createRange.js +45 -0
- package/lib/node_modules/lodash/_createRange.js.map +1 -0
- package/lib/node_modules/lodash/_createSet.js +34 -0
- package/lib/node_modules/lodash/_createSet.js.map +1 -0
- package/lib/node_modules/lodash/_defineProperty.js +24 -0
- package/lib/node_modules/lodash/_defineProperty.js.map +1 -0
- package/lib/node_modules/lodash/_equalArrays.js +99 -0
- package/lib/node_modules/lodash/_equalArrays.js.map +1 -0
- package/lib/node_modules/lodash/_equalByTag.js +130 -0
- package/lib/node_modules/lodash/_equalByTag.js.map +1 -0
- package/lib/node_modules/lodash/_equalObjects.js +103 -0
- package/lib/node_modules/lodash/_equalObjects.js.map +1 -0
- package/lib/node_modules/lodash/_flatRest.js +31 -0
- package/lib/node_modules/lodash/_flatRest.js.map +1 -0
- package/lib/node_modules/lodash/_freeGlobal.js +18 -0
- package/lib/node_modules/lodash/_freeGlobal.js.map +1 -0
- package/lib/node_modules/lodash/_getAllKeys.js +31 -0
- package/lib/node_modules/lodash/_getAllKeys.js.map +1 -0
- package/lib/node_modules/lodash/_getAllKeysIn.js +32 -0
- package/lib/node_modules/lodash/_getAllKeysIn.js.map +1 -0
- package/lib/node_modules/lodash/_getMapData.js +31 -0
- package/lib/node_modules/lodash/_getMapData.js.map +1 -0
- package/lib/node_modules/lodash/_getMatchData.js +38 -0
- package/lib/node_modules/lodash/_getMatchData.js.map +1 -0
- package/lib/node_modules/lodash/_getNative.js +31 -0
- package/lib/node_modules/lodash/_getNative.js.map +1 -0
- package/lib/node_modules/lodash/_getPrototype.js +19 -0
- package/lib/node_modules/lodash/_getPrototype.js.map +1 -0
- package/lib/node_modules/lodash/_getRawTag.js +59 -0
- package/lib/node_modules/lodash/_getRawTag.js.map +1 -0
- package/lib/node_modules/lodash/_getSymbols.js +44 -0
- package/lib/node_modules/lodash/_getSymbols.js.map +1 -0
- package/lib/node_modules/lodash/_getSymbolsIn.js +41 -0
- package/lib/node_modules/lodash/_getSymbolsIn.js.map +1 -0
- package/lib/node_modules/lodash/_getTag.js +77 -0
- package/lib/node_modules/lodash/_getTag.js.map +1 -0
- package/lib/node_modules/lodash/_getValue.js +25 -0
- package/lib/node_modules/lodash/_getValue.js.map +1 -0
- package/lib/node_modules/lodash/_hasPath.js +57 -0
- package/lib/node_modules/lodash/_hasPath.js.map +1 -0
- package/lib/node_modules/lodash/_hasUnicode.js +38 -0
- package/lib/node_modules/lodash/_hasUnicode.js.map +1 -0
- package/lib/node_modules/lodash/_hashClear.js +28 -0
- package/lib/node_modules/lodash/_hashClear.js.map +1 -0
- package/lib/node_modules/lodash/_hashDelete.js +29 -0
- package/lib/node_modules/lodash/_hashDelete.js.map +1 -0
- package/lib/node_modules/lodash/_hashGet.js +43 -0
- package/lib/node_modules/lodash/_hashGet.js.map +1 -0
- package/lib/node_modules/lodash/_hashHas.js +36 -0
- package/lib/node_modules/lodash/_hashHas.js.map +1 -0
- package/lib/node_modules/lodash/_hashSet.js +36 -0
- package/lib/node_modules/lodash/_hashSet.js.map +1 -0
- package/lib/node_modules/lodash/_initCloneArray.js +38 -0
- package/lib/node_modules/lodash/_initCloneArray.js.map +1 -0
- package/lib/node_modules/lodash/_initCloneByTag.js +94 -0
- package/lib/node_modules/lodash/_initCloneByTag.js.map +1 -0
- package/lib/node_modules/lodash/_initCloneObject.js +33 -0
- package/lib/node_modules/lodash/_initCloneObject.js.map +1 -0
- package/lib/node_modules/lodash/_isFlattenable.js +35 -0
- package/lib/node_modules/lodash/_isFlattenable.js.map +1 -0
- package/lib/node_modules/lodash/_isIndex.js +37 -0
- package/lib/node_modules/lodash/_isIndex.js.map +1 -0
- package/lib/node_modules/lodash/_isIterateeCall.js +46 -0
- package/lib/node_modules/lodash/_isIterateeCall.js.map +1 -0
- package/lib/node_modules/lodash/_isKey.js +43 -0
- package/lib/node_modules/lodash/_isKey.js.map +1 -0
- package/lib/node_modules/lodash/_isKeyable.js +27 -0
- package/lib/node_modules/lodash/_isKeyable.js.map +1 -0
- package/lib/node_modules/lodash/_isMasked.js +33 -0
- package/lib/node_modules/lodash/_isMasked.js.map +1 -0
- package/lib/node_modules/lodash/_isPrototype.js +30 -0
- package/lib/node_modules/lodash/_isPrototype.js.map +1 -0
- package/lib/node_modules/lodash/_isStrictComparable.js +28 -0
- package/lib/node_modules/lodash/_isStrictComparable.js.map +1 -0
- package/lib/node_modules/lodash/_listCacheClear.js +25 -0
- package/lib/node_modules/lodash/_listCacheClear.js.map +1 -0
- package/lib/node_modules/lodash/_listCacheDelete.js +48 -0
- package/lib/node_modules/lodash/_listCacheDelete.js.map +1 -0
- package/lib/node_modules/lodash/_listCacheGet.js +32 -0
- package/lib/node_modules/lodash/_listCacheGet.js.map +1 -0
- package/lib/node_modules/lodash/_listCacheHas.js +29 -0
- package/lib/node_modules/lodash/_listCacheHas.js.map +1 -0
- package/lib/node_modules/lodash/_listCacheSet.js +39 -0
- package/lib/node_modules/lodash/_listCacheSet.js.map +1 -0
- package/lib/node_modules/lodash/_mapCacheClear.js +36 -0
- package/lib/node_modules/lodash/_mapCacheClear.js.map +1 -0
- package/lib/node_modules/lodash/_mapCacheDelete.js +31 -0
- package/lib/node_modules/lodash/_mapCacheDelete.js.map +1 -0
- package/lib/node_modules/lodash/_mapCacheGet.js +29 -0
- package/lib/node_modules/lodash/_mapCacheGet.js.map +1 -0
- package/lib/node_modules/lodash/_mapCacheHas.js +29 -0
- package/lib/node_modules/lodash/_mapCacheHas.js.map +1 -0
- package/lib/node_modules/lodash/_mapCacheSet.js +35 -0
- package/lib/node_modules/lodash/_mapCacheSet.js.map +1 -0
- package/lib/node_modules/lodash/_mapToArray.js +30 -0
- package/lib/node_modules/lodash/_mapToArray.js.map +1 -0
- package/lib/node_modules/lodash/_matchesStrictComparable.js +32 -0
- package/lib/node_modules/lodash/_matchesStrictComparable.js.map +1 -0
- package/lib/node_modules/lodash/_memoizeCapped.js +39 -0
- package/lib/node_modules/lodash/_memoizeCapped.js.map +1 -0
- package/lib/node_modules/lodash/_nativeCreate.js +19 -0
- package/lib/node_modules/lodash/_nativeCreate.js.map +1 -0
- package/lib/node_modules/lodash/_nativeKeys.js +19 -0
- package/lib/node_modules/lodash/_nativeKeys.js.map +1 -0
- package/lib/node_modules/lodash/_nativeKeysIn.js +32 -0
- package/lib/node_modules/lodash/_nativeKeysIn.js.map +1 -0
- package/lib/node_modules/lodash/_nodeUtil.js +47 -0
- package/lib/node_modules/lodash/_nodeUtil.js.map +1 -0
- package/lib/node_modules/lodash/_objectToString.js +34 -0
- package/lib/node_modules/lodash/_objectToString.js.map +1 -0
- package/lib/node_modules/lodash/_overArg.js +27 -0
- package/lib/node_modules/lodash/_overArg.js.map +1 -0
- package/lib/node_modules/lodash/_overRest.js +49 -0
- package/lib/node_modules/lodash/_overRest.js.map +1 -0
- package/lib/node_modules/lodash/_root.js +22 -0
- package/lib/node_modules/lodash/_root.js.map +1 -0
- package/lib/node_modules/lodash/_safeGet.js +33 -0
- package/lib/node_modules/lodash/_safeGet.js.map +1 -0
- package/lib/node_modules/lodash/_setCacheAdd.js +31 -0
- package/lib/node_modules/lodash/_setCacheAdd.js.map +1 -0
- package/lib/node_modules/lodash/_setCacheHas.js +26 -0
- package/lib/node_modules/lodash/_setCacheHas.js.map +1 -0
- package/lib/node_modules/lodash/_setToArray.js +30 -0
- package/lib/node_modules/lodash/_setToArray.js.map +1 -0
- package/lib/node_modules/lodash/_setToString.js +28 -0
- package/lib/node_modules/lodash/_setToString.js.map +1 -0
- package/lib/node_modules/lodash/_shortOut.js +49 -0
- package/lib/node_modules/lodash/_shortOut.js.map +1 -0
- package/lib/node_modules/lodash/_stackClear.js +28 -0
- package/lib/node_modules/lodash/_stackClear.js.map +1 -0
- package/lib/node_modules/lodash/_stackDelete.js +30 -0
- package/lib/node_modules/lodash/_stackDelete.js.map +1 -0
- package/lib/node_modules/lodash/_stackGet.js +26 -0
- package/lib/node_modules/lodash/_stackGet.js.map +1 -0
- package/lib/node_modules/lodash/_stackHas.js +26 -0
- package/lib/node_modules/lodash/_stackHas.js.map +1 -0
- package/lib/node_modules/lodash/_stackSet.js +49 -0
- package/lib/node_modules/lodash/_stackSet.js.map +1 -0
- package/lib/node_modules/lodash/_strictIndexOf.js +35 -0
- package/lib/node_modules/lodash/_strictIndexOf.js.map +1 -0
- package/lib/node_modules/lodash/_stringSize.js +33 -0
- package/lib/node_modules/lodash/_stringSize.js.map +1 -0
- package/lib/node_modules/lodash/_stringToPath.js +40 -0
- package/lib/node_modules/lodash/_stringToPath.js.map +1 -0
- package/lib/node_modules/lodash/_toKey.js +31 -0
- package/lib/node_modules/lodash/_toKey.js.map +1 -0
- package/lib/node_modules/lodash/_toSource.js +38 -0
- package/lib/node_modules/lodash/_toSource.js.map +1 -0
- package/lib/node_modules/lodash/_trimmedEndIndex.js +31 -0
- package/lib/node_modules/lodash/_trimmedEndIndex.js.map +1 -0
- package/lib/node_modules/lodash/_unicodeSize.js +56 -0
- package/lib/node_modules/lodash/_unicodeSize.js.map +1 -0
- package/lib/node_modules/lodash/clone.js +49 -0
- package/lib/node_modules/lodash/clone.js.map +1 -0
- package/lib/node_modules/lodash/cloneDeep.js +42 -0
- package/lib/node_modules/lodash/cloneDeep.js.map +1 -0
- package/lib/node_modules/lodash/constant.js +38 -0
- package/lib/node_modules/lodash/constant.js.map +1 -0
- package/lib/node_modules/lodash/defaults.js +80 -0
- package/lib/node_modules/lodash/defaults.js.map +1 -0
- package/lib/node_modules/lodash/each.js +14 -0
- package/lib/node_modules/lodash/each.js.map +1 -0
- package/lib/node_modules/lodash/eq.js +49 -0
- package/lib/node_modules/lodash/eq.js.map +1 -0
- package/lib/node_modules/lodash/filter.js +68 -0
- package/lib/node_modules/lodash/filter.js.map +1 -0
- package/lib/node_modules/lodash/find.js +56 -0
- package/lib/node_modules/lodash/find.js.map +1 -0
- package/lib/node_modules/lodash/findIndex.js +70 -0
- package/lib/node_modules/lodash/findIndex.js.map +1 -0
- package/lib/node_modules/lodash/flatten.js +35 -0
- package/lib/node_modules/lodash/flatten.js.map +1 -0
- package/lib/node_modules/lodash/forEach.js +57 -0
- package/lib/node_modules/lodash/forEach.js.map +1 -0
- package/lib/node_modules/lodash/forIn.js +54 -0
- package/lib/node_modules/lodash/forIn.js.map +1 -0
- package/lib/node_modules/lodash/get.js +46 -0
- package/lib/node_modules/lodash/get.js.map +1 -0
- package/lib/node_modules/lodash/has.js +49 -0
- package/lib/node_modules/lodash/has.js.map +1 -0
- package/lib/node_modules/lodash/hasIn.js +48 -0
- package/lib/node_modules/lodash/hasIn.js.map +1 -0
- package/lib/node_modules/lodash/identity.js +33 -0
- package/lib/node_modules/lodash/identity.js.map +1 -0
- package/lib/node_modules/lodash/isArguments.js +50 -0
- package/lib/node_modules/lodash/isArguments.js.map +1 -0
- package/lib/node_modules/lodash/isArray.js +38 -0
- package/lib/node_modules/lodash/isArray.js.map +1 -0
- package/lib/node_modules/lodash/isArrayLike.js +47 -0
- package/lib/node_modules/lodash/isArrayLike.js.map +1 -0
- package/lib/node_modules/lodash/isArrayLikeObject.js +47 -0
- package/lib/node_modules/lodash/isArrayLikeObject.js.map +1 -0
- package/lib/node_modules/lodash/isBuffer.js +56 -0
- package/lib/node_modules/lodash/isBuffer.js.map +1 -0
- package/lib/node_modules/lodash/isEmpty.js +97 -0
- package/lib/node_modules/lodash/isEmpty.js.map +1 -0
- package/lib/node_modules/lodash/isFunction.js +51 -0
- package/lib/node_modules/lodash/isFunction.js.map +1 -0
- package/lib/node_modules/lodash/isLength.js +47 -0
- package/lib/node_modules/lodash/isLength.js.map +1 -0
- package/lib/node_modules/lodash/isMap.js +42 -0
- package/lib/node_modules/lodash/isMap.js.map +1 -0
- package/lib/node_modules/lodash/isObject.js +43 -0
- package/lib/node_modules/lodash/isObject.js.map +1 -0
- package/lib/node_modules/lodash/isObjectLike.js +41 -0
- package/lib/node_modules/lodash/isObjectLike.js.map +1 -0
- package/lib/node_modules/lodash/isPlainObject.js +77 -0
- package/lib/node_modules/lodash/isPlainObject.js.map +1 -0
- package/lib/node_modules/lodash/isSet.js +42 -0
- package/lib/node_modules/lodash/isSet.js.map +1 -0
- package/lib/node_modules/lodash/isString.js +45 -0
- package/lib/node_modules/lodash/isString.js.map +1 -0
- package/lib/node_modules/lodash/isSymbol.js +43 -0
- package/lib/node_modules/lodash/isSymbol.js.map +1 -0
- package/lib/node_modules/lodash/isTypedArray.js +42 -0
- package/lib/node_modules/lodash/isTypedArray.js.map +1 -0
- package/lib/node_modules/lodash/isUndefined.js +34 -0
- package/lib/node_modules/lodash/isUndefined.js.map +1 -0
- package/lib/node_modules/lodash/keys.js +52 -0
- package/lib/node_modules/lodash/keys.js.map +1 -0
- package/lib/node_modules/lodash/keysIn.js +47 -0
- package/lib/node_modules/lodash/keysIn.js.map +1 -0
- package/lib/node_modules/lodash/last.js +32 -0
- package/lib/node_modules/lodash/last.js.map +1 -0
- package/lib/node_modules/lodash/map.js +69 -0
- package/lib/node_modules/lodash/map.js.map +1 -0
- package/lib/node_modules/lodash/mapValues.js +58 -0
- package/lib/node_modules/lodash/mapValues.js.map +1 -0
- package/lib/node_modules/lodash/max.js +44 -0
- package/lib/node_modules/lodash/max.js.map +1 -0
- package/lib/node_modules/lodash/memoize.js +86 -0
- package/lib/node_modules/lodash/memoize.js.map +1 -0
- package/lib/node_modules/lodash/merge.js +53 -0
- package/lib/node_modules/lodash/merge.js.map +1 -0
- package/lib/node_modules/lodash/min.js +44 -0
- package/lib/node_modules/lodash/min.js.map +1 -0
- package/lib/node_modules/lodash/minBy.js +49 -0
- package/lib/node_modules/lodash/minBy.js.map +1 -0
- package/lib/node_modules/lodash/noop.js +29 -0
- package/lib/node_modules/lodash/noop.js.map +1 -0
- package/lib/node_modules/lodash/now.js +36 -0
- package/lib/node_modules/lodash/now.js.map +1 -0
- package/lib/node_modules/lodash/pick.js +39 -0
- package/lib/node_modules/lodash/pick.js.map +1 -0
- package/lib/node_modules/lodash/property.js +48 -0
- package/lib/node_modules/lodash/property.js.map +1 -0
- package/lib/node_modules/lodash/range.js +59 -0
- package/lib/node_modules/lodash/range.js.map +1 -0
- package/lib/node_modules/lodash/reduce.js +68 -0
- package/lib/node_modules/lodash/reduce.js.map +1 -0
- package/lib/node_modules/lodash/size.js +63 -0
- package/lib/node_modules/lodash/size.js.map +1 -0
- package/lib/node_modules/lodash/sortBy.js +64 -0
- package/lib/node_modules/lodash/sortBy.js.map +1 -0
- package/lib/node_modules/lodash/stubArray.js +35 -0
- package/lib/node_modules/lodash/stubArray.js.map +1 -0
- package/lib/node_modules/lodash/stubFalse.js +30 -0
- package/lib/node_modules/lodash/stubFalse.js.map +1 -0
- package/lib/node_modules/lodash/toFinite.js +55 -0
- package/lib/node_modules/lodash/toFinite.js.map +1 -0
- package/lib/node_modules/lodash/toInteger.js +49 -0
- package/lib/node_modules/lodash/toInteger.js.map +1 -0
- package/lib/node_modules/lodash/toNumber.js +79 -0
- package/lib/node_modules/lodash/toNumber.js.map +1 -0
- package/lib/node_modules/lodash/toPlainObject.js +46 -0
- package/lib/node_modules/lodash/toPlainObject.js.map +1 -0
- package/lib/node_modules/lodash/toString.js +41 -0
- package/lib/node_modules/lodash/toString.js.map +1 -0
- package/lib/node_modules/lodash/transform.js +87 -0
- package/lib/node_modules/lodash/transform.js.map +1 -0
- package/lib/node_modules/lodash/union.js +42 -0
- package/lib/node_modules/lodash/union.js.map +1 -0
- package/lib/node_modules/lodash/uniqueId.js +41 -0
- package/lib/node_modules/lodash/uniqueId.js.map +1 -0
- package/lib/node_modules/lodash/values.js +48 -0
- package/lib/node_modules/lodash/values.js.map +1 -0
- package/lib/node_modules/lodash/zipObject.js +38 -0
- package/lib/node_modules/lodash/zipObject.js.map +1 -0
- package/lib/node_modules/ml-array-max/lib-es6/index.js +37 -0
- package/lib/node_modules/ml-array-max/lib-es6/index.js.map +1 -0
- package/lib/node_modules/ml-array-min/lib-es6/index.js +37 -0
- package/lib/node_modules/ml-array-min/lib-es6/index.js.map +1 -0
- package/lib/node_modules/ml-array-rescale/lib-es6/index.js +52 -0
- package/lib/node_modules/ml-array-rescale/lib-es6/index.js.map +1 -0
- package/lib/node_modules/ml-matrix/matrix.js +8 -0
- package/lib/node_modules/ml-matrix/matrix.js.map +1 -0
- package/lib/node_modules/ml-matrix/matrix2.js +5660 -0
- package/lib/node_modules/ml-matrix/matrix2.js.map +1 -0
- package/lib/node_modules/tslib/tslib.es6.js +46 -0
- package/lib/node_modules/tslib/tslib.es6.js.map +1 -0
- package/lib/registry.d.ts +3 -2
- package/lib/registry.js +27 -26
- package/lib/registry.js.map +1 -1
- package/lib/runtime/context.d.ts +15 -0
- package/lib/runtime/context.js +29 -0
- package/lib/runtime/context.js.map +1 -0
- package/lib/runtime/supervisor.d.ts +25 -0
- package/lib/runtime/supervisor.js +75 -0
- package/lib/runtime/supervisor.js.map +1 -0
- package/lib/types/common.d.ts +4 -0
- package/lib/types/data.d.ts +59 -0
- package/lib/types/edge-label.d.ts +6 -0
- package/lib/types/force.d.ts +46 -0
- package/lib/types/id.d.ts +3 -0
- package/lib/types/point.d.ts +9 -0
- package/lib/types/position.d.ts +10 -0
- package/lib/types/size.d.ts +4 -0
- package/lib/util/array.d.ts +3 -1
- package/lib/util/array.js +4 -2
- package/lib/util/array.js.map +1 -1
- package/lib/util/common.d.ts +8 -8
- package/lib/util/common.js +14 -25
- package/lib/util/common.js.map +1 -1
- package/lib/util/format.js +72 -0
- package/lib/util/format.js.map +1 -0
- package/lib/util/math.d.ts +30 -12
- package/lib/util/math.js +178 -55
- package/lib/util/math.js.map +1 -1
- package/lib/util/object.d.ts +22 -7
- package/lib/util/object.js +46 -40
- package/lib/util/object.js.map +1 -1
- package/lib/util/order.d.ts +20 -0
- package/lib/util/order.js +106 -0
- package/lib/util/order.js.map +1 -0
- package/lib/util/point.d.ts +6 -0
- package/lib/util/point.js +11 -0
- package/lib/util/point.js.map +1 -0
- package/lib/util/size.d.ts +5 -3
- package/lib/util/size.js +7 -4
- package/lib/util/size.js.map +1 -1
- package/lib/util/viewport.d.ts +16 -0
- package/lib/util/viewport.js +17 -0
- package/lib/util/viewport.js.map +1 -0
- package/lib/worker.js +32302 -33
- package/lib/worker.js.map +1 -1
- package/package.json +78 -19
- package/src/algorithm/antv-dagre/acyclic.ts +70 -0
- package/src/algorithm/antv-dagre/add-border-segments.ts +55 -0
- package/src/algorithm/antv-dagre/coordinate-system.ts +77 -0
- package/src/algorithm/antv-dagre/data/list.ts +60 -0
- package/src/algorithm/antv-dagre/graph.ts +533 -0
- package/src/algorithm/antv-dagre/greedy-fas.ts +185 -0
- package/src/algorithm/antv-dagre/index.ts +620 -0
- package/src/algorithm/antv-dagre/layout.ts +622 -0
- package/src/algorithm/antv-dagre/nesting-graph.ts +184 -0
- package/src/algorithm/antv-dagre/normalize.ts +125 -0
- package/src/algorithm/antv-dagre/order/add-subgraph-constraints.ts +51 -0
- package/src/algorithm/antv-dagre/order/barycenter.ts +26 -0
- package/src/algorithm/antv-dagre/order/build-layer-graph.ts +109 -0
- package/src/algorithm/antv-dagre/order/cross-count.ts +76 -0
- package/src/algorithm/antv-dagre/order/index.ts +123 -0
- package/src/algorithm/antv-dagre/order/init-data-order.ts +29 -0
- package/src/algorithm/antv-dagre/order/init-order.ts +59 -0
- package/src/algorithm/antv-dagre/order/resolve-conflicts.ts +153 -0
- package/src/algorithm/antv-dagre/order/sort-subgraph.ts +111 -0
- package/src/algorithm/antv-dagre/order/sort.ts +94 -0
- package/src/algorithm/antv-dagre/parent-dummy-chains.ts +111 -0
- package/src/algorithm/antv-dagre/position/bk.ts +560 -0
- package/src/algorithm/antv-dagre/position/index.ts +109 -0
- package/src/algorithm/antv-dagre/rank/feasible-tree.ts +179 -0
- package/src/algorithm/antv-dagre/rank/index.ts +55 -0
- package/src/algorithm/antv-dagre/rank/network-simplex.ts +282 -0
- package/src/algorithm/antv-dagre/rank/util.ts +157 -0
- package/src/algorithm/antv-dagre/types.ts +175 -0
- package/src/algorithm/antv-dagre/util.ts +359 -0
- package/src/algorithm/base-layout.ts +132 -0
- package/src/algorithm/base-simulation.ts +94 -0
- package/src/algorithm/circular/index.ts +123 -0
- package/src/algorithm/circular/types.ts +105 -0
- package/src/algorithm/combo-combined/index.ts +412 -0
- package/src/algorithm/combo-combined/types.ts +39 -0
- package/src/algorithm/concentric/index.ts +234 -0
- package/src/algorithm/concentric/types.ts +89 -0
- package/src/algorithm/d3-force/force-in-a-box.ts +404 -0
- package/src/algorithm/d3-force/index.ts +642 -0
- package/src/algorithm/d3-force/types.ts +378 -0
- package/src/algorithm/d3-force-3d/index.ts +88 -0
- package/src/algorithm/d3-force-3d/types.ts +68 -0
- package/src/algorithm/d3-force-3d/typing.d.ts +301 -0
- package/src/algorithm/dagre/index.ts +172 -0
- package/src/algorithm/dagre/types.ts +84 -0
- package/src/algorithm/force/attractive.ts +71 -0
- package/src/algorithm/force/centripetal.ts +133 -0
- package/src/algorithm/force/collide.ts +219 -0
- package/src/algorithm/force/gravity.ts +61 -0
- package/src/algorithm/force/index.ts +541 -0
- package/src/algorithm/force/repulsive.ts +200 -0
- package/src/algorithm/force/simulation.ts +172 -0
- package/src/algorithm/force/types.ts +265 -0
- package/src/algorithm/force/typing.d.ts +76 -0
- package/src/algorithm/force-atlas2/body.ts +115 -0
- package/src/algorithm/force-atlas2/index.ts +189 -0
- package/src/algorithm/force-atlas2/quad-tree.ts +109 -0
- package/src/algorithm/force-atlas2/quad.ts +117 -0
- package/src/algorithm/force-atlas2/simulation.ts +445 -0
- package/src/algorithm/force-atlas2/types.ts +106 -0
- package/src/algorithm/fruchterman/index.ts +116 -0
- package/src/algorithm/fruchterman/simulation.ts +447 -0
- package/src/algorithm/fruchterman/types.ts +47 -0
- package/src/algorithm/grid/index.ts +305 -0
- package/src/algorithm/grid/types.ts +120 -0
- package/src/algorithm/index.ts +29 -0
- package/src/algorithm/mds/index.ts +143 -0
- package/src/algorithm/mds/types.ts +23 -0
- package/src/algorithm/radial/index.ts +346 -0
- package/src/algorithm/radial/radial-nonoverlap-force.ts +210 -0
- package/src/algorithm/radial/types.ts +100 -0
- package/src/algorithm/random/index.ts +41 -0
- package/src/algorithm/random/types.ts +8 -0
- package/src/algorithm/types.ts +172 -0
- package/src/index.ts +6 -0
- package/src/model/data.ts +381 -0
- package/src/model/index.ts +1 -0
- package/src/registry.ts +29 -0
- package/src/runtime/context.ts +49 -0
- package/src/runtime/index.ts +2 -0
- package/src/runtime/supervisor.ts +80 -0
- package/src/types/common.ts +3 -0
- package/src/types/data.ts +79 -0
- package/src/types/edge-label.ts +5 -0
- package/src/types/force.ts +49 -0
- package/src/types/id.ts +1 -0
- package/src/types/index.ts +8 -0
- package/src/types/point.ts +9 -0
- package/src/types/position.ts +11 -0
- package/src/types/size.ts +3 -0
- package/src/util/array.ts +1 -0
- package/src/util/common.ts +25 -0
- package/src/util/format.ts +92 -0
- package/src/util/index.ts +8 -0
- package/src/util/math.ts +312 -0
- package/src/util/object.ts +54 -0
- package/src/util/order.ts +143 -0
- package/src/util/point.ts +9 -0
- package/src/util/size.ts +10 -0
- package/src/util/viewport.ts +27 -0
- package/src/worker.ts +50 -0
- package/dist/e2b4e534ff10c7df8b27.worker.js +0 -2
- package/dist/e2b4e534ff10c7df8b27.worker.js.map +0 -1
- package/lib/antv-dagre/acyclic.d.ts +0 -4
- package/lib/antv-dagre/acyclic.js +0 -61
- package/lib/antv-dagre/acyclic.js.map +0 -1
- package/lib/antv-dagre/add-border-segments.d.ts +0 -2
- package/lib/antv-dagre/add-border-segments.js +0 -37
- package/lib/antv-dagre/add-border-segments.js.map +0 -1
- package/lib/antv-dagre/coordinate-system.d.ts +0 -5
- package/lib/antv-dagre/coordinate-system.js +0 -65
- package/lib/antv-dagre/coordinate-system.js.map +0 -1
- package/lib/antv-dagre/data/list.d.ts +0 -12
- package/lib/antv-dagre/data/list.js +0 -48
- package/lib/antv-dagre/data/list.js.map +0 -1
- package/lib/antv-dagre/greedy-fas.d.ts +0 -3
- package/lib/antv-dagre/greedy-fas.js +0 -136
- package/lib/antv-dagre/greedy-fas.js.map +0 -1
- package/lib/antv-dagre/layout.d.ts +0 -19
- package/lib/antv-dagre/layout.js +0 -468
- package/lib/antv-dagre/layout.js.map +0 -1
- package/lib/antv-dagre/nesting-graph.d.ts +0 -8
- package/lib/antv-dagre/nesting-graph.js +0 -152
- package/lib/antv-dagre/nesting-graph.js.map +0 -1
- package/lib/antv-dagre/normalize.d.ts +0 -5
- package/lib/antv-dagre/normalize.js +0 -98
- package/lib/antv-dagre/normalize.js.map +0 -1
- package/lib/antv-dagre/order/add-subgraph-constraints.d.ts +0 -3
- package/lib/antv-dagre/order/add-subgraph-constraints.js +0 -45
- package/lib/antv-dagre/order/add-subgraph-constraints.js.map +0 -1
- package/lib/antv-dagre/order/barycenter.d.ts +0 -14
- package/lib/antv-dagre/order/barycenter.js +0 -23
- package/lib/antv-dagre/order/barycenter.js.map +0 -1
- package/lib/antv-dagre/order/build-layer-graph.d.ts +0 -3
- package/lib/antv-dagre/order/build-layer-graph.js +0 -92
- package/lib/antv-dagre/order/build-layer-graph.js.map +0 -1
- package/lib/antv-dagre/order/cross-count.d.ts +0 -3
- package/lib/antv-dagre/order/cross-count.js +0 -63
- package/lib/antv-dagre/order/cross-count.js.map +0 -1
- package/lib/antv-dagre/order/index.d.ts +0 -2
- package/lib/antv-dagre/order/index.js +0 -91
- package/lib/antv-dagre/order/index.js.map +0 -1
- package/lib/antv-dagre/order/init-data-order.d.ts +0 -6
- package/lib/antv-dagre/order/init-data-order.js +0 -27
- package/lib/antv-dagre/order/init-data-order.js.map +0 -1
- package/lib/antv-dagre/order/init-order.d.ts +0 -3
- package/lib/antv-dagre/order/init-order.js +0 -47
- package/lib/antv-dagre/order/init-order.js.map +0 -1
- package/lib/antv-dagre/order/resolve-conflicts.d.ts +0 -20
- package/lib/antv-dagre/order/resolve-conflicts.js +0 -118
- package/lib/antv-dagre/order/resolve-conflicts.js.map +0 -1
- package/lib/antv-dagre/order/sort-subgraph.d.ts +0 -7
- package/lib/antv-dagre/order/sort-subgraph.js +0 -84
- package/lib/antv-dagre/order/sort-subgraph.js.map +0 -1
- package/lib/antv-dagre/order/sort.d.ts +0 -7
- package/lib/antv-dagre/order/sort.js +0 -74
- package/lib/antv-dagre/order/sort.js.map +0 -1
- package/lib/antv-dagre/parent-dummy-chains.d.ts +0 -3
- package/lib/antv-dagre/parent-dummy-chains.js +0 -80
- package/lib/antv-dagre/parent-dummy-chains.js.map +0 -1
- package/lib/antv-dagre/position/bk.d.ts +0 -26
- package/lib/antv-dagre/position/bk.js +0 -395
- package/lib/antv-dagre/position/bk.js.map +0 -1
- package/lib/antv-dagre/position/index.d.ts +0 -8
- package/lib/antv-dagre/position/index.js +0 -51
- package/lib/antv-dagre/position/index.js.map +0 -1
- package/lib/antv-dagre/rank/feasible-tree.d.ts +0 -5
- package/lib/antv-dagre/rank/feasible-tree.js +0 -164
- package/lib/antv-dagre/rank/feasible-tree.js.map +0 -1
- package/lib/antv-dagre/rank/index.d.ts +0 -2
- package/lib/antv-dagre/rank/index.js +0 -48
- package/lib/antv-dagre/rank/index.js.map +0 -1
- package/lib/antv-dagre/rank/network-simplex.d.ts +0 -16
- package/lib/antv-dagre/rank/network-simplex.js +0 -231
- package/lib/antv-dagre/rank/network-simplex.js.map +0 -1
- package/lib/antv-dagre/rank/util.d.ts +0 -6
- package/lib/antv-dagre/rank/util.js +0 -138
- package/lib/antv-dagre/rank/util.js.map +0 -1
- package/lib/antv-dagre/types.d.ts +0 -2
- package/lib/antv-dagre/types.js +0 -2
- package/lib/antv-dagre/types.js.map +0 -1
- package/lib/antv-dagre/util.d.ts +0 -35
- package/lib/antv-dagre/util.js +0 -281
- package/lib/antv-dagre/util.js.map +0 -1
- package/lib/antv-dagre.d.ts +0 -205
- package/lib/antv-dagre.js +0 -526
- package/lib/antv-dagre.js.map +0 -1
- package/lib/bundle-entry.d.ts +0 -2
- package/lib/bundle-entry.js +0 -3
- package/lib/bundle-entry.js.map +0 -1
- package/lib/bundle-supervisor.d.ts +0 -33
- package/lib/bundle-supervisor.js +0 -95
- package/lib/bundle-supervisor.js.map +0 -1
- package/lib/bundle-worker.d.ts +0 -3
- package/lib/bundle-worker.js +0 -51
- package/lib/bundle-worker.js.map +0 -1
- package/lib/circular.d.ts +0 -20
- package/lib/circular.js +0 -232
- package/lib/circular.js.map +0 -1
- package/lib/combo-combined.d.ts +0 -22
- package/lib/combo-combined.js +0 -415
- package/lib/combo-combined.js.map +0 -1
- package/lib/concentric.d.ts +0 -20
- package/lib/concentric.js +0 -210
- package/lib/concentric.js.map +0 -1
- package/lib/d3-force/index.d.ts +0 -35
- package/lib/d3-force/index.js +0 -173
- package/lib/d3-force/index.js.map +0 -1
- package/lib/d3-force/types.d.ts +0 -147
- package/lib/d3-force/types.js +0 -2
- package/lib/d3-force/types.js.map +0 -1
- package/lib/d3-force-3d/index.d.ts +0 -25
- package/lib/d3-force-3d/index.js +0 -47
- package/lib/d3-force-3d/index.js.map +0 -1
- package/lib/d3-force-3d/types.d.ts +0 -43
- package/lib/d3-force-3d/types.js +0 -2
- package/lib/d3-force-3d/types.js.map +0 -1
- package/lib/dagre.d.ts +0 -20
- package/lib/dagre.js +0 -69
- package/lib/dagre.js.map +0 -1
- package/lib/exports.d.ts +0 -20
- package/lib/exports.js +0 -18
- package/lib/exports.js.map +0 -1
- package/lib/force/force-n-body.d.ts +0 -7
- package/lib/force/force-n-body.js +0 -120
- package/lib/force/force-n-body.js.map +0 -1
- package/lib/force/index.d.ts +0 -128
- package/lib/force/index.js +0 -739
- package/lib/force/index.js.map +0 -1
- package/lib/force/types.d.ts +0 -43
- package/lib/force/types.js +0 -2
- package/lib/force/types.js.map +0 -1
- package/lib/force-atlas2/body.d.ts +0 -33
- package/lib/force-atlas2/body.js +0 -89
- package/lib/force-atlas2/body.js.map +0 -1
- package/lib/force-atlas2/index.d.ts +0 -95
- package/lib/force-atlas2/index.js +0 -510
- package/lib/force-atlas2/index.js.map +0 -1
- package/lib/force-atlas2/quad-tree.d.ts +0 -20
- package/lib/force-atlas2/quad-tree.js +0 -104
- package/lib/force-atlas2/quad-tree.js.map +0 -1
- package/lib/force-atlas2/quad.d.ts +0 -27
- package/lib/force-atlas2/quad.js +0 -96
- package/lib/force-atlas2/quad.js.map +0 -1
- package/lib/fruchterman.d.ts +0 -43
- package/lib/fruchterman.js +0 -346
- package/lib/fruchterman.js.map +0 -1
- package/lib/grid.d.ts +0 -20
- package/lib/grid.js +0 -279
- package/lib/grid.js.map +0 -1
- package/lib/mds.d.ts +0 -20
- package/lib/mds.js +0 -117
- package/lib/mds.js.map +0 -1
- package/lib/radial/index.d.ts +0 -22
- package/lib/radial/index.js +0 -338
- package/lib/radial/index.js.map +0 -1
- package/lib/radial/mds.d.ts +0 -2
- package/lib/radial/mds.js +0 -31
- package/lib/radial/mds.js.map +0 -1
- package/lib/radial/radial-nonoverlap-force.d.ts +0 -16
- package/lib/radial/radial-nonoverlap-force.js +0 -99
- package/lib/radial/radial-nonoverlap-force.js.map +0 -1
- package/lib/random.d.ts +0 -20
- package/lib/random.js +0 -75
- package/lib/random.js.map +0 -1
- package/lib/supervisor.d.ts +0 -50
- package/lib/supervisor.js +0 -91
- package/lib/supervisor.js.map +0 -1
- package/lib/types.d.ts +0 -1284
- package/lib/types.js +0 -4
- package/lib/types.js.map +0 -1
- package/lib/util/function.d.ts +0 -27
- package/lib/util/function.js +0 -111
- package/lib/util/function.js.map +0 -1
- package/lib/util/index.d.ts +0 -4
- package/lib/util/index.js +0 -5
- package/lib/util/index.js.map +0 -1
- package/lib/worker.d.ts +0 -1
package/dist/index.min.js
CHANGED
|
@@ -1,2 +1,7 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.Layout=e():t.Layout=e()}(this,(function(){return(()=>{var t={5439:(t,e,r)=>{t.exports={graphlib:r(1943),layout:r(5499),debug:r(5856),util:{time:r(345).time,notime:r(345).notime},version:r(3404)}},5205:(t,e,r)=>{"use strict";var n=r(2692),o=r(824);t.exports={run:function(t){var e="greedy"===t.graph().acyclicer?o(t,function(t){return function(e){return t.edge(e).weight}}(t)):function(t){var e=[],r={},o={};return n.forEach(t.nodes(),(function i(s){n.has(o,s)||(o[s]=!0,r[s]=!0,n.forEach(t.outEdges(s),(function(t){n.has(r,t.w)?e.push(t):i(t.w)})),delete r[s])})),e}(t);n.forEach(e,(function(e){var r=t.edge(e);t.removeEdge(e),r.forwardName=e.name,r.reversed=!0,t.setEdge(e.w,e.v,r,n.uniqueId("rev"))}))},undo:function(t){n.forEach(t.edges(),(function(e){var r=t.edge(e);if(r.reversed){t.removeEdge(e);var n=r.forwardName;delete r.reversed,delete r.forwardName,t.setEdge(e.w,e.v,r,n)}}))}}},1555:(t,e,r)=>{var n=r(2692),o=r(345);function i(t,e,r,n,i,s){var a={width:0,height:0,rank:s,borderType:e},u=i[e][s-1],d=o.addDummyNode(t,"border",a,r);i[e][s]=d,t.setParent(d,n),u&&t.setEdge(u,d,{weight:1})}t.exports=function(t){n.forEach(t.children(),(function e(r){var o=t.children(r),s=t.node(r);if(o.length&&n.forEach(o,e),n.has(s,"minRank")){s.borderLeft=[],s.borderRight=[];for(var a=s.minRank,u=s.maxRank+1;a<u;++a)i(t,"borderLeft","_bl",r,s,a),i(t,"borderRight","_br",r,s,a)}}))}},4688:(t,e,r)=>{"use strict";var n=r(2692);function o(t){n.forEach(t.nodes(),(function(e){i(t.node(e))})),n.forEach(t.edges(),(function(e){i(t.edge(e))}))}function i(t){var e=t.width;t.width=t.height,t.height=e}function s(t){t.y=-t.y}function a(t){var e=t.x;t.x=t.y,t.y=e}t.exports={adjust:function(t){var e=t.graph().rankdir.toLowerCase();"lr"!==e&&"rl"!==e||o(t)},undo:function(t){var e=t.graph().rankdir.toLowerCase();"bt"!==e&&"rl"!==e||function(t){n.forEach(t.nodes(),(function(e){s(t.node(e))})),n.forEach(t.edges(),(function(e){var r=t.edge(e);n.forEach(r.points,s),n.has(r,"y")&&s(r)}))}(t),"lr"!==e&&"rl"!==e||(function(t){n.forEach(t.nodes(),(function(e){a(t.node(e))})),n.forEach(t.edges(),(function(e){var r=t.edge(e);n.forEach(r.points,a),n.has(r,"x")&&a(r)}))}(t),o(t))}}},2278:t=>{function e(){var t={};t._next=t._prev=t,this._sentinel=t}function r(t){t._prev._next=t._next,t._next._prev=t._prev,delete t._next,delete t._prev}function n(t,e){if("_next"!==t&&"_prev"!==t)return e}t.exports=e,e.prototype.dequeue=function(){var t=this._sentinel,e=t._prev;if(e!==t)return r(e),e},e.prototype.enqueue=function(t){var e=this._sentinel;t._prev&&t._next&&r(t),t._next=e._next,e._next._prev=t,e._next=t,t._prev=e},e.prototype.toString=function(){for(var t=[],e=this._sentinel,r=e._prev;r!==e;)t.push(JSON.stringify(r,n)),r=r._prev;return"["+t.join(", ")+"]"}},5856:(t,e,r)=>{var n=r(2692),o=r(345),i=r(1943).Graph;t.exports={debugOrdering:function(t){var e=o.buildLayerMatrix(t),r=new i({compound:!0,multigraph:!0}).setGraph({});return n.forEach(t.nodes(),(function(e){r.setNode(e,{label:e}),r.setParent(e,"layer"+t.node(e).rank)})),n.forEach(t.edges(),(function(t){r.setEdge(t.v,t.w,{},t.name)})),n.forEach(e,(function(t,e){var o="layer"+e;r.setNode(o,{rank:"same"}),n.reduce(t,(function(t,e){return r.setEdge(t,e,{style:"invis"}),e}))})),r}}},1943:(t,e,r)=>{var n;try{n=r(6960)}catch(t){}n||(n=window.graphlib),t.exports=n},824:(t,e,r)=>{var n=r(2692),o=r(1943).Graph,i=r(2278);t.exports=function(t,e){if(t.nodeCount()<=1)return[];var r=function(t,e){var r=new o,s=0,a=0;n.forEach(t.nodes(),(function(t){r.setNode(t,{v:t,in:0,out:0})})),n.forEach(t.edges(),(function(t){var n=r.edge(t.v,t.w)||0,o=e(t),i=n+o;r.setEdge(t.v,t.w,i),a=Math.max(a,r.node(t.v).out+=o),s=Math.max(s,r.node(t.w).in+=o)}));var d=n.range(a+s+3).map((function(){return new i})),h=s+1;return n.forEach(r.nodes(),(function(t){u(d,h,r.node(t))})),{graph:r,buckets:d,zeroIdx:h}}(t,e||s),d=function(t,e,r){for(var n,o=[],i=e[e.length-1],s=e[0];t.nodeCount();){for(;n=s.dequeue();)a(t,e,r,n);for(;n=i.dequeue();)a(t,e,r,n);if(t.nodeCount())for(var u=e.length-2;u>0;--u)if(n=e[u].dequeue()){o=o.concat(a(t,e,r,n,!0));break}}return o}(r.graph,r.buckets,r.zeroIdx);return n.flatten(n.map(d,(function(e){return t.outEdges(e.v,e.w)})),!0)};var s=n.constant(1);function a(t,e,r,o,i){var s=i?[]:void 0;return n.forEach(t.inEdges(o.v),(function(n){var o=t.edge(n),a=t.node(n.v);i&&s.push({v:n.v,w:n.w}),a.out-=o,u(e,r,a)})),n.forEach(t.outEdges(o.v),(function(n){var o=t.edge(n),i=n.w,s=t.node(i);s.in-=o,u(e,r,s)})),t.removeNode(o.v),s}function u(t,e,r){r.out?r.in?t[r.out-r.in+e].enqueue(r):t[t.length-1].enqueue(r):t[0].enqueue(r)}},5499:(t,e,r)=>{"use strict";var n=r(2692),o=r(5205),i=r(4125),s=r(8264),a=r(345).normalizeRanks,u=r(2555),d=r(345).removeEmptyRanks,h=r(838),c=r(1555),l=r(4688),f=r(6571),g=r(9533),p=r(345),v=r(1943).Graph;t.exports=function(t,e){var r=e&&e.debugTiming?p.time:p.notime;r("layout",(function(){var e=r(" buildLayoutGraph",(function(){return function(t){var e=new v({multigraph:!0,compound:!0}),r=k(t.graph());return e.setGraph(n.merge({},m,M(r,y),n.pick(r,w))),n.forEach(t.nodes(),(function(r){var o=k(t.node(r));e.setNode(r,n.defaults(M(o,x),b)),e.setParent(r,t.parent(r))})),n.forEach(t.edges(),(function(r){var o=k(t.edge(r));e.setEdge(r,n.merge({},N,M(o,E),n.pick(o,_)))})),e}(t)}));r(" runLayout",(function(){!function(t,e){e(" makeSpaceForEdgeLabels",(function(){!function(t){var e=t.graph();e.ranksep/=2,n.forEach(t.edges(),(function(r){var n=t.edge(r);n.minlen*=2,"c"!==n.labelpos.toLowerCase()&&("TB"===e.rankdir||"BT"===e.rankdir?n.width+=n.labeloffset:n.height+=n.labeloffset)}))}(t)})),e(" removeSelfEdges",(function(){!function(t){n.forEach(t.edges(),(function(e){if(e.v===e.w){var r=t.node(e.v);r.selfEdges||(r.selfEdges=[]),r.selfEdges.push({e,label:t.edge(e)}),t.removeEdge(e)}}))}(t)})),e(" acyclic",(function(){o.run(t)})),e(" nestingGraph.run",(function(){h.run(t)})),e(" rank",(function(){s(p.asNonCompoundGraph(t))})),e(" injectEdgeLabelProxies",(function(){!function(t){n.forEach(t.edges(),(function(e){var r=t.edge(e);if(r.width&&r.height){var n=t.node(e.v),o={rank:(t.node(e.w).rank-n.rank)/2+n.rank,e};p.addDummyNode(t,"edge-proxy",o,"_ep")}}))}(t)})),e(" removeEmptyRanks",(function(){d(t)})),e(" nestingGraph.cleanup",(function(){h.cleanup(t)})),e(" normalizeRanks",(function(){a(t)})),e(" assignRankMinMax",(function(){!function(t){var e=0;n.forEach(t.nodes(),(function(r){var o=t.node(r);o.borderTop&&(o.minRank=t.node(o.borderTop).rank,o.maxRank=t.node(o.borderBottom).rank,e=n.max(e,o.maxRank))})),t.graph().maxRank=e}(t)})),e(" removeEdgeLabelProxies",(function(){!function(t){n.forEach(t.nodes(),(function(e){var r=t.node(e);"edge-proxy"===r.dummy&&(t.edge(r.e).labelRank=r.rank,t.removeNode(e))}))}(t)})),e(" normalize.run",(function(){i.run(t)})),e(" parentDummyChains",(function(){u(t)})),e(" addBorderSegments",(function(){c(t)})),e(" order",(function(){f(t)})),e(" insertSelfEdges",(function(){!function(t){var e=p.buildLayerMatrix(t);n.forEach(e,(function(e){var r=0;n.forEach(e,(function(e,o){var i=t.node(e);i.order=o+r,n.forEach(i.selfEdges,(function(e){p.addDummyNode(t,"selfedge",{width:e.label.width,height:e.label.height,rank:i.rank,order:o+ ++r,e:e.e,label:e.label},"_se")})),delete i.selfEdges}))}))}(t)})),e(" adjustCoordinateSystem",(function(){l.adjust(t)})),e(" position",(function(){g(t)})),e(" positionSelfEdges",(function(){!function(t){n.forEach(t.nodes(),(function(e){var r=t.node(e);if("selfedge"===r.dummy){var n=t.node(r.e.v),o=n.x+n.width/2,i=n.y,s=r.x-o,a=n.height/2;t.setEdge(r.e,r.label),t.removeNode(e),r.label.points=[{x:o+2*s/3,y:i-a},{x:o+5*s/6,y:i-a},{x:o+s,y:i},{x:o+5*s/6,y:i+a},{x:o+2*s/3,y:i+a}],r.label.x=r.x,r.label.y=r.y}}))}(t)})),e(" removeBorderNodes",(function(){!function(t){n.forEach(t.nodes(),(function(e){if(t.children(e).length){var r=t.node(e),o=t.node(r.borderTop),i=t.node(r.borderBottom),s=t.node(n.last(r.borderLeft)),a=t.node(n.last(r.borderRight));r.width=Math.abs(a.x-s.x),r.height=Math.abs(i.y-o.y),r.x=s.x+r.width/2,r.y=o.y+r.height/2}})),n.forEach(t.nodes(),(function(e){"border"===t.node(e).dummy&&t.removeNode(e)}))}(t)})),e(" normalize.undo",(function(){i.undo(t)})),e(" fixupEdgeLabelCoords",(function(){!function(t){n.forEach(t.edges(),(function(e){var r=t.edge(e);if(n.has(r,"x"))switch("l"!==r.labelpos&&"r"!==r.labelpos||(r.width-=r.labeloffset),r.labelpos){case"l":r.x-=r.width/2+r.labeloffset;break;case"r":r.x+=r.width/2+r.labeloffset}}))}(t)})),e(" undoCoordinateSystem",(function(){l.undo(t)})),e(" translateGraph",(function(){!function(t){var e=Number.POSITIVE_INFINITY,r=0,o=Number.POSITIVE_INFINITY,i=0,s=t.graph(),a=s.marginx||0,u=s.marginy||0;function d(t){var n=t.x,s=t.y,a=t.width,u=t.height;e=Math.min(e,n-a/2),r=Math.max(r,n+a/2),o=Math.min(o,s-u/2),i=Math.max(i,s+u/2)}n.forEach(t.nodes(),(function(e){d(t.node(e))})),n.forEach(t.edges(),(function(e){var r=t.edge(e);n.has(r,"x")&&d(r)})),e-=a,o-=u,n.forEach(t.nodes(),(function(r){var n=t.node(r);n.x-=e,n.y-=o})),n.forEach(t.edges(),(function(r){var i=t.edge(r);n.forEach(i.points,(function(t){t.x-=e,t.y-=o})),n.has(i,"x")&&(i.x-=e),n.has(i,"y")&&(i.y-=o)})),s.width=r-e+a,s.height=i-o+u}(t)})),e(" assignNodeIntersects",(function(){!function(t){n.forEach(t.edges(),(function(e){var r,n,o=t.edge(e),i=t.node(e.v),s=t.node(e.w);o.points?(r=o.points[0],n=o.points[o.points.length-1]):(o.points=[],r=s,n=i),o.points.unshift(p.intersectRect(i,r)),o.points.push(p.intersectRect(s,n))}))}(t)})),e(" reversePoints",(function(){!function(t){n.forEach(t.edges(),(function(e){var r=t.edge(e);r.reversed&&r.points.reverse()}))}(t)})),e(" acyclic.undo",(function(){o.undo(t)}))}(e,r)})),r(" updateInputGraph",(function(){!function(t,e){n.forEach(t.nodes(),(function(r){var n=t.node(r),o=e.node(r);n&&(n.x=o.x,n.y=o.y,e.children(r).length&&(n.width=o.width,n.height=o.height))})),n.forEach(t.edges(),(function(r){var o=t.edge(r),i=e.edge(r);o.points=i.points,n.has(i,"x")&&(o.x=i.x,o.y=i.y)})),t.graph().width=e.graph().width,t.graph().height=e.graph().height}(t,e)}))}))};var y=["nodesep","edgesep","ranksep","marginx","marginy"],m={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},w=["acyclicer","ranker","rankdir","align"],x=["width","height"],b={width:0,height:0},E=["minlen","weight","width","height","labeloffset"],N={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},_=["labelpos"];function M(t,e){return n.mapValues(n.pick(t,e),Number)}function k(t){var e={};return n.forEach(t,(function(t,r){e[r.toLowerCase()]=t})),e}},2692:(t,e,r)=>{var n;try{n={cloneDeep:r(7179),constant:r(9203),defaults:r(3821),each:r(678),filter:r(4663),find:r(6969),flatten:r(2923),forEach:r(7734),forIn:r(7514),has:r(5346),isUndefined:r(6474),last:r(7875),map:r(9107),mapValues:r(1230),max:r(6492),merge:r(8469),min:r(5071),minBy:r(6838),now:r(231),pick:r(9335),range:r(8569),reduce:r(7682),sortBy:r(1635),uniqueId:r(1422),values:r(1682),zipObject:r(4142)}}catch(t){}n||(n=window._),t.exports=n},838:(t,e,r)=>{var n=r(2692),o=r(345);function i(t,e,r,s,a,u,d){var h=t.children(d);if(h.length){var c=o.addBorderNode(t,"_bt"),l=o.addBorderNode(t,"_bb"),f=t.node(d);t.setParent(c,d),f.borderTop=c,t.setParent(l,d),f.borderBottom=l,n.forEach(h,(function(n){i(t,e,r,s,a,u,n);var o=t.node(n),h=o.borderTop?o.borderTop:n,f=o.borderBottom?o.borderBottom:n,g=o.borderTop?s:2*s,p=h!==f?1:a-u[d]+1;t.setEdge(c,h,{weight:g,minlen:p,nestingEdge:!0}),t.setEdge(f,l,{weight:g,minlen:p,nestingEdge:!0})})),t.parent(d)||t.setEdge(e,c,{weight:0,minlen:a+u[d]})}else d!==e&&t.setEdge(e,d,{weight:0,minlen:r})}t.exports={run:function(t){var e=o.addDummyNode(t,"root",{},"_root"),r=function(t){var e={};function r(o,i){var s=t.children(o);s&&s.length&&n.forEach(s,(function(t){r(t,i+1)})),e[o]=i}return n.forEach(t.children(),(function(t){r(t,1)})),e}(t),s=n.max(n.values(r))-1,a=2*s+1;t.graph().nestingRoot=e,n.forEach(t.edges(),(function(e){t.edge(e).minlen*=a}));var u=function(t){return n.reduce(t.edges(),(function(e,r){return e+t.edge(r).weight}),0)}(t)+1;n.forEach(t.children(),(function(n){i(t,e,a,u,s,r,n)})),t.graph().nodeRankFactor=a},cleanup:function(t){var e=t.graph();t.removeNode(e.nestingRoot),delete e.nestingRoot,n.forEach(t.edges(),(function(e){t.edge(e).nestingEdge&&t.removeEdge(e)}))}}},4125:(t,e,r)=>{"use strict";var n=r(2692),o=r(345);t.exports={run:function(t){t.graph().dummyChains=[],n.forEach(t.edges(),(function(e){!function(t,e){var r,n,i,s=e.v,a=t.node(s).rank,u=e.w,d=t.node(u).rank,h=e.name,c=t.edge(e),l=c.labelRank;if(d!==a+1){for(t.removeEdge(e),i=0,++a;a<d;++i,++a)c.points=[],n={width:0,height:0,edgeLabel:c,edgeObj:e,rank:a},r=o.addDummyNode(t,"edge",n,"_d"),a===l&&(n.width=c.width,n.height=c.height,n.dummy="edge-label",n.labelpos=c.labelpos),t.setEdge(s,r,{weight:c.weight},h),0===i&&t.graph().dummyChains.push(r),s=r;t.setEdge(s,u,{weight:c.weight},h)}}(t,e)}))},undo:function(t){n.forEach(t.graph().dummyChains,(function(e){var r,n=t.node(e),o=n.edgeLabel;for(t.setEdge(n.edgeObj,o);n.dummy;)r=t.successors(e)[0],t.removeNode(e),o.points.push({x:n.x,y:n.y}),"edge-label"===n.dummy&&(o.x=n.x,o.y=n.y,o.width=n.width,o.height=n.height),e=r,n=t.node(e)}))}}},4333:(t,e,r)=>{var n=r(2692);t.exports=function(t,e,r){var o,i={};n.forEach(r,(function(r){for(var n,s,a=t.parent(r);a;){if((n=t.parent(a))?(s=i[n],i[n]=a):(s=o,o=a),s&&s!==a)return void e.setEdge(s,a);a=n}}))}},5374:(t,e,r)=>{var n=r(2692);t.exports=function(t,e){return n.map(e,(function(e){var r=t.inEdges(e);if(r.length){var o=n.reduce(r,(function(e,r){var n=t.edge(r),o=t.node(r.v);return{sum:e.sum+n.weight*o.order,weight:e.weight+n.weight}}),{sum:0,weight:0});return{v:e,barycenter:o.sum/o.weight,weight:o.weight}}return{v:e}}))}},3037:(t,e,r)=>{var n=r(2692),o=r(1943).Graph;t.exports=function(t,e,r){var i=function(t){for(var e;t.hasNode(e=n.uniqueId("_root")););return e}(t),s=new o({compound:!0}).setGraph({root:i}).setDefaultNodeLabel((function(e){return t.node(e)}));return n.forEach(t.nodes(),(function(o){var a=t.node(o),u=t.parent(o);(a.rank===e||a.minRank<=e&&e<=a.maxRank)&&(s.setNode(o),s.setParent(o,u||i),n.forEach(t[r](o),(function(e){var r=e.v===o?e.w:e.v,i=s.edge(r,o),a=n.isUndefined(i)?0:i.weight;s.setEdge(r,o,{weight:t.edge(e).weight+a})})),n.has(a,"minRank")&&s.setNode(o,{borderLeft:a.borderLeft[e],borderRight:a.borderRight[e]}))})),s}},9420:(t,e,r)=>{"use strict";var n=r(2692);function o(t,e,r){for(var o=n.zipObject(r,n.map(r,(function(t,e){return e}))),i=n.flatten(n.map(e,(function(e){return n.sortBy(n.map(t.outEdges(e),(function(e){return{pos:o[e.w],weight:t.edge(e).weight}})),"pos")})),!0),s=1;s<r.length;)s<<=1;var a=2*s-1;s-=1;var u=n.map(new Array(a),(function(){return 0})),d=0;return n.forEach(i.forEach((function(t){var e=t.pos+s;u[e]+=t.weight;for(var r=0;e>0;)e%2&&(r+=u[e+1]),u[e=e-1>>1]+=t.weight;d+=t.weight*r}))),d}t.exports=function(t,e){for(var r=0,n=1;n<e.length;++n)r+=o(t,e[n-1],e[n]);return r}},6571:(t,e,r)=>{"use strict";var n=r(2692),o=r(1001),i=r(9420),s=r(7407),a=r(3037),u=r(4333),d=r(1943).Graph,h=r(345);function c(t,e,r){return n.map(e,(function(e){return a(t,e,r)}))}function l(t,e){var r=new d;n.forEach(t,(function(t){var o=t.graph().root,i=s(t,o,r,e);n.forEach(i.vs,(function(e,r){t.node(e).order=r})),u(t,r,i.vs)}))}function f(t,e){n.forEach(e,(function(e){n.forEach(e,(function(e,r){t.node(e).order=r}))}))}t.exports=function(t){var e=h.maxRank(t),r=c(t,n.range(1,e+1),"inEdges"),s=c(t,n.range(e-1,-1,-1),"outEdges"),a=o(t);f(t,a);for(var u,d=Number.POSITIVE_INFINITY,g=0,p=0;p<4;++g,++p){l(g%2?r:s,g%4>=2),a=h.buildLayerMatrix(t);var v=i(t,a);v<d&&(p=0,u=n.cloneDeep(a),d=v)}f(t,u)}},1001:(t,e,r)=>{"use strict";var n=r(2692);t.exports=function(t){var e={},r=n.filter(t.nodes(),(function(e){return!t.children(e).length})),o=n.max(n.map(r,(function(e){return t.node(e).rank}))),i=n.map(n.range(o+1),(function(){return[]})),s=n.sortBy(r,(function(e){return t.node(e).rank}));return n.forEach(s,(function r(o){if(!n.has(e,o)){e[o]=!0;var s=t.node(o);i[s.rank].push(o),n.forEach(t.successors(o),r)}})),i}},8522:(t,e,r)=>{"use strict";var n=r(2692);t.exports=function(t,e){var r={};return n.forEach(t,(function(t,e){var o=r[t.v]={indegree:0,in:[],out:[],vs:[t.v],i:e};n.isUndefined(t.barycenter)||(o.barycenter=t.barycenter,o.weight=t.weight)})),n.forEach(e.edges(),(function(t){var e=r[t.v],o=r[t.w];n.isUndefined(e)||n.isUndefined(o)||(o.indegree++,e.out.push(r[t.w]))})),function(t){var e=[];function r(t){return function(e){var r,o,i,s;e.merged||(n.isUndefined(e.barycenter)||n.isUndefined(t.barycenter)||e.barycenter>=t.barycenter)&&(o=e,i=0,s=0,(r=t).weight&&(i+=r.barycenter*r.weight,s+=r.weight),o.weight&&(i+=o.barycenter*o.weight,s+=o.weight),r.vs=o.vs.concat(r.vs),r.barycenter=i/s,r.weight=s,r.i=Math.min(o.i,r.i),o.merged=!0)}}function o(e){return function(r){r.in.push(e),0==--r.indegree&&t.push(r)}}for(;t.length;){var i=t.pop();e.push(i),n.forEach(i.in.reverse(),r(i)),n.forEach(i.out,o(i))}return n.map(n.filter(e,(function(t){return!t.merged})),(function(t){return n.pick(t,["vs","i","barycenter","weight"])}))}(n.filter(r,(function(t){return!t.indegree})))}},7407:(t,e,r)=>{var n=r(2692),o=r(5374),i=r(8522),s=r(2711);t.exports=function t(e,r,a,u){var d=e.children(r),h=e.node(r),c=h?h.borderLeft:void 0,l=h?h.borderRight:void 0,f={};c&&(d=n.filter(d,(function(t){return t!==c&&t!==l})));var g=o(e,d);n.forEach(g,(function(r){if(e.children(r.v).length){var o=t(e,r.v,a,u);f[r.v]=o,n.has(o,"barycenter")&&(i=r,s=o,n.isUndefined(i.barycenter)?(i.barycenter=s.barycenter,i.weight=s.weight):(i.barycenter=(i.barycenter*i.weight+s.barycenter*s.weight)/(i.weight+s.weight),i.weight+=s.weight))}var i,s}));var p=i(g,a);!function(t,e){n.forEach(t,(function(t){t.vs=n.flatten(t.vs.map((function(t){return e[t]?e[t].vs:t})),!0)}))}(p,f);var v=s(p,u);if(c&&(v.vs=n.flatten([c,v.vs,l],!0),e.predecessors(c).length)){var y=e.node(e.predecessors(c)[0]),m=e.node(e.predecessors(l)[0]);n.has(v,"barycenter")||(v.barycenter=0,v.weight=0),v.barycenter=(v.barycenter*v.weight+y.order+m.order)/(v.weight+2),v.weight+=2}return v}},2711:(t,e,r)=>{var n=r(2692),o=r(345);function i(t,e,r){for(var o;e.length&&(o=n.last(e)).i<=r;)e.pop(),t.push(o.vs),r++;return r}t.exports=function(t,e){var r,s=o.partition(t,(function(t){return n.has(t,"barycenter")})),a=s.lhs,u=n.sortBy(s.rhs,(function(t){return-t.i})),d=[],h=0,c=0,l=0;a.sort((r=!!e,function(t,e){return t.barycenter<e.barycenter?-1:t.barycenter>e.barycenter?1:r?e.i-t.i:t.i-e.i})),l=i(d,u,l),n.forEach(a,(function(t){l+=t.vs.length,d.push(t.vs),h+=t.barycenter*t.weight,c+=t.weight,l=i(d,u,l)}));var f={vs:n.flatten(d,!0)};return c&&(f.barycenter=h/c,f.weight=c),f}},2555:(t,e,r)=>{var n=r(2692);t.exports=function(t){var e=function(t){var e={},r=0;return n.forEach(t.children(),(function o(i){var s=r;n.forEach(t.children(i),o),e[i]={low:s,lim:r++}})),e}(t);n.forEach(t.graph().dummyChains,(function(r){for(var n=t.node(r),o=n.edgeObj,i=function(t,e,r,n){var o,i,s=[],a=[],u=Math.min(e[r].low,e[n].low),d=Math.max(e[r].lim,e[n].lim);o=r;do{o=t.parent(o),s.push(o)}while(o&&(e[o].low>u||d>e[o].lim));for(i=o,o=n;(o=t.parent(o))!==i;)a.push(o);return{path:s.concat(a.reverse()),lca:i}}(t,e,o.v,o.w),s=i.path,a=i.lca,u=0,d=s[u],h=!0;r!==o.w;){if(n=t.node(r),h){for(;(d=s[u])!==a&&t.node(d).maxRank<n.rank;)u++;d===a&&(h=!1)}if(!h){for(;u<s.length-1&&t.node(d=s[u+1]).minRank<=n.rank;)u++;d=s[u]}t.setParent(r,d),r=t.successors(r)[0]}}))}},7828:(t,e,r)=>{"use strict";var n=r(2692),o=r(1943).Graph,i=r(345);function s(t,e){var r={};return n.reduce(e,(function(e,o){var i=0,s=0,a=e.length,d=n.last(o);return n.forEach(o,(function(e,h){var c=function(t,e){if(t.node(e).dummy)return n.find(t.predecessors(e),(function(e){return t.node(e).dummy}))}(t,e),l=c?t.node(c).order:a;(c||e===d)&&(n.forEach(o.slice(s,h+1),(function(e){n.forEach(t.predecessors(e),(function(n){var o=t.node(n),s=o.order;!(s<i||l<s)||o.dummy&&t.node(e).dummy||u(r,n,e)}))})),s=h+1,i=l)})),o})),r}function a(t,e){var r={};function o(e,o,i,s,a){var d;n.forEach(n.range(o,i),(function(o){d=e[o],t.node(d).dummy&&n.forEach(t.predecessors(d),(function(e){var n=t.node(e);n.dummy&&(n.order<s||n.order>a)&&u(r,e,d)}))}))}return n.reduce(e,(function(e,r){var i,s=-1,a=0;return n.forEach(r,(function(n,u){if("border"===t.node(n).dummy){var d=t.predecessors(n);d.length&&(i=t.node(d[0]).order,o(r,a,u,s,i),a=u,s=i)}o(r,a,r.length,i,e.length)})),r})),r}function u(t,e,r){if(e>r){var n=e;e=r,r=n}var o=t[e];o||(t[e]=o={}),o[r]=!0}function d(t,e,r){if(e>r){var o=e;e=r,r=o}return n.has(t[e],r)}function h(t,e,r,o){var i={},s={},a={};return n.forEach(e,(function(t){n.forEach(t,(function(t,e){i[t]=t,s[t]=t,a[t]=e}))})),n.forEach(e,(function(t){var e=-1;n.forEach(t,(function(t){var u=o(t);if(u.length){u=n.sortBy(u,(function(t){return a[t]}));for(var h=(u.length-1)/2,c=Math.floor(h),l=Math.ceil(h);c<=l;++c){var f=u[c];s[t]===t&&e<a[f]&&!d(r,t,f)&&(s[f]=t,s[t]=i[t]=i[f],e=a[f])}}}))})),{root:i,align:s}}function c(t,e,r,i,s){var a={},u=function(t,e,r,i){var s=new o,a=t.graph(),u=function(t,e,r){return function(o,i,s){var a,u=o.node(i),d=o.node(s),h=0;if(h+=u.width/2,n.has(u,"labelpos"))switch(u.labelpos.toLowerCase()){case"l":a=-u.width/2;break;case"r":a=u.width/2}if(a&&(h+=r?a:-a),a=0,h+=(u.dummy?e:t)/2,h+=(d.dummy?e:t)/2,h+=d.width/2,n.has(d,"labelpos"))switch(d.labelpos.toLowerCase()){case"l":a=d.width/2;break;case"r":a=-d.width/2}return a&&(h+=r?a:-a),a=0,h}}(a.nodesep,a.edgesep,i);return n.forEach(e,(function(e){var o;n.forEach(e,(function(e){var n=r[e];if(s.setNode(n),o){var i=r[o],a=s.edge(i,n);s.setEdge(i,n,Math.max(u(t,e,o),a||0))}o=e}))})),s}(t,e,r,s),d=s?"borderLeft":"borderRight";function h(t,e){for(var r=u.nodes(),n=r.pop(),o={};n;)o[n]?t(n):(o[n]=!0,r.push(n),r=r.concat(e(n))),n=r.pop()}return h((function(t){a[t]=u.inEdges(t).reduce((function(t,e){return Math.max(t,a[e.v]+u.edge(e))}),0)}),u.predecessors.bind(u)),h((function(e){var r=u.outEdges(e).reduce((function(t,e){return Math.min(t,a[e.w]-u.edge(e))}),Number.POSITIVE_INFINITY),n=t.node(e);r!==Number.POSITIVE_INFINITY&&n.borderType!==d&&(a[e]=Math.max(a[e],r))}),u.successors.bind(u)),n.forEach(i,(function(t){a[t]=a[r[t]]})),a}function l(t,e){return n.minBy(n.values(e),(function(e){var r=Number.NEGATIVE_INFINITY,o=Number.POSITIVE_INFINITY;return n.forIn(e,(function(e,n){var i=function(t,e){return t.node(e).width}(t,n)/2;r=Math.max(e+i,r),o=Math.min(e-i,o)})),r-o}))}function f(t,e){var r=n.values(e),o=n.min(r),i=n.max(r);n.forEach(["u","d"],(function(r){n.forEach(["l","r"],(function(s){var a,u=r+s,d=t[u];if(d!==e){var h=n.values(d);(a="l"===s?o-n.min(h):i-n.max(h))&&(t[u]=n.mapValues(d,(function(t){return t+a})))}}))}))}function g(t,e){return n.mapValues(t.ul,(function(r,o){if(e)return t[e.toLowerCase()][o];var i=n.sortBy(n.map(t,o));return(i[1]+i[2])/2}))}t.exports={positionX:function(t){var e,r=i.buildLayerMatrix(t),o=n.merge(s(t,r),a(t,r)),u={};n.forEach(["u","d"],(function(i){e="u"===i?r:n.values(r).reverse(),n.forEach(["l","r"],(function(r){"r"===r&&(e=n.map(e,(function(t){return n.values(t).reverse()})));var s=("u"===i?t.predecessors:t.successors).bind(t),a=h(0,e,o,s),d=c(t,e,a.root,a.align,"r"===r);"r"===r&&(d=n.mapValues(d,(function(t){return-t}))),u[i+r]=d}))}));var d=l(t,u);return f(u,d),g(u,t.graph().align)},findType1Conflicts:s,findType2Conflicts:a,addConflict:u,hasConflict:d,verticalAlignment:h,horizontalCompaction:c,alignCoordinates:f,findSmallestWidthAlignment:l,balance:g}},9533:(t,e,r)=>{"use strict";var n=r(2692),o=r(345),i=r(7828).positionX;t.exports=function(t){(function(t){var e=o.buildLayerMatrix(t),r=t.graph().ranksep,i=0;n.forEach(e,(function(e){var o=n.max(n.map(e,(function(e){return t.node(e).height})));n.forEach(e,(function(e){t.node(e).y=i+o/2})),i+=o+r}))})(t=o.asNonCompoundGraph(t)),n.forEach(i(t),(function(e,r){t.node(r).x=e}))}},6771:(t,e,r)=>{"use strict";var n=r(2692),o=r(1943).Graph,i=r(3834).slack;function s(t,e){return n.forEach(t.nodes(),(function r(o){n.forEach(e.nodeEdges(o),(function(n){var s=n.v,a=o===s?n.w:s;t.hasNode(a)||i(e,n)||(t.setNode(a,{}),t.setEdge(o,a,{}),r(a))}))})),t.nodeCount()}function a(t,e){return n.minBy(e.edges(),(function(r){if(t.hasNode(r.v)!==t.hasNode(r.w))return i(e,r)}))}function u(t,e,r){n.forEach(t.nodes(),(function(t){e.node(t).rank+=r}))}t.exports=function(t){var e,r,n=new o({directed:!1}),d=t.nodes()[0],h=t.nodeCount();for(n.setNode(d,{});s(n,t)<h;)e=a(n,t),r=n.hasNode(e.v)?i(t,e):-i(t,e),u(n,t,r);return n}},8264:(t,e,r)=>{"use strict";var n=r(3834).longestPath,o=r(6771),i=r(3284);t.exports=function(t){switch(t.graph().ranker){case"network-simplex":default:!function(t){i(t)}(t);break;case"tight-tree":!function(t){n(t),o(t)}(t);break;case"longest-path":s(t)}};var s=n},3284:(t,e,r)=>{"use strict";var n=r(2692),o=r(6771),i=r(3834).slack,s=r(3834).longestPath,a=r(1943).alg.preorder,u=r(1943).alg.postorder,d=r(345).simplify;function h(t){t=d(t),s(t);var e,r=o(t);for(f(r),c(r,t);e=p(r);)y(r,t,e,v(r,t,e))}function c(t,e){var r=u(t,t.nodes());r=r.slice(0,r.length-1),n.forEach(r,(function(r){!function(t,e,r){var n=t.node(r).parent;t.edge(r,n).cutvalue=l(t,e,r)}(t,e,r)}))}function l(t,e,r){var o=t.node(r).parent,i=!0,s=e.edge(r,o),a=0;return s||(i=!1,s=e.edge(o,r)),a=s.weight,n.forEach(e.nodeEdges(r),(function(n){var s,u,d=n.v===r,h=d?n.w:n.v;if(h!==o){var c=d===i,l=e.edge(n).weight;if(a+=c?l:-l,s=r,u=h,t.hasEdge(s,u)){var f=t.edge(r,h).cutvalue;a+=c?-f:f}}})),a}function f(t,e){arguments.length<2&&(e=t.nodes()[0]),g(t,{},1,e)}function g(t,e,r,o,i){var s=r,a=t.node(o);return e[o]=!0,n.forEach(t.neighbors(o),(function(i){n.has(e,i)||(r=g(t,e,r,i,o))})),a.low=s,a.lim=r++,i?a.parent=i:delete a.parent,r}function p(t){return n.find(t.edges(),(function(e){return t.edge(e).cutvalue<0}))}function v(t,e,r){var o=r.v,s=r.w;e.hasEdge(o,s)||(o=r.w,s=r.v);var a=t.node(o),u=t.node(s),d=a,h=!1;a.lim>u.lim&&(d=u,h=!0);var c=n.filter(e.edges(),(function(e){return h===m(0,t.node(e.v),d)&&h!==m(0,t.node(e.w),d)}));return n.minBy(c,(function(t){return i(e,t)}))}function y(t,e,r,o){var i=r.v,s=r.w;t.removeEdge(i,s),t.setEdge(o.v,o.w,{}),f(t),c(t,e),function(t,e){var r=n.find(t.nodes(),(function(t){return!e.node(t).parent})),o=a(t,r);o=o.slice(1),n.forEach(o,(function(r){var n=t.node(r).parent,o=e.edge(r,n),i=!1;o||(o=e.edge(n,r),i=!0),e.node(r).rank=e.node(n).rank+(i?o.minlen:-o.minlen)}))}(t,e)}function m(t,e,r){return r.low<=e.lim&&e.lim<=r.lim}t.exports=h,h.initLowLimValues=f,h.initCutValues=c,h.calcCutValue=l,h.leaveEdge=p,h.enterEdge=v,h.exchangeEdges=y},3834:(t,e,r)=>{"use strict";var n=r(2692);t.exports={longestPath:function(t){var e={};n.forEach(t.sources(),(function r(o){var i=t.node(o);if(n.has(e,o))return i.rank;e[o]=!0;var s=n.min(n.map(t.outEdges(o),(function(e){return r(e.w)-t.edge(e).minlen})));return s!==Number.POSITIVE_INFINITY&&null!=s||(s=0),i.rank=s}))},slack:function(t,e){return t.node(e.w).rank-t.node(e.v).rank-t.edge(e).minlen}}},345:(t,e,r)=>{"use strict";var n=r(2692),o=r(1943).Graph;function i(t,e,r,o){var i;do{i=n.uniqueId(o)}while(t.hasNode(i));return r.dummy=e,t.setNode(i,r),i}function s(t){return n.max(n.map(t.nodes(),(function(e){var r=t.node(e).rank;if(!n.isUndefined(r))return r})))}t.exports={addDummyNode:i,simplify:function(t){var e=(new o).setGraph(t.graph());return n.forEach(t.nodes(),(function(r){e.setNode(r,t.node(r))})),n.forEach(t.edges(),(function(r){var n=e.edge(r.v,r.w)||{weight:0,minlen:1},o=t.edge(r);e.setEdge(r.v,r.w,{weight:n.weight+o.weight,minlen:Math.max(n.minlen,o.minlen)})})),e},asNonCompoundGraph:function(t){var e=new o({multigraph:t.isMultigraph()}).setGraph(t.graph());return n.forEach(t.nodes(),(function(r){t.children(r).length||e.setNode(r,t.node(r))})),n.forEach(t.edges(),(function(r){e.setEdge(r,t.edge(r))})),e},successorWeights:function(t){var e=n.map(t.nodes(),(function(e){var r={};return n.forEach(t.outEdges(e),(function(e){r[e.w]=(r[e.w]||0)+t.edge(e).weight})),r}));return n.zipObject(t.nodes(),e)},predecessorWeights:function(t){var e=n.map(t.nodes(),(function(e){var r={};return n.forEach(t.inEdges(e),(function(e){r[e.v]=(r[e.v]||0)+t.edge(e).weight})),r}));return n.zipObject(t.nodes(),e)},intersectRect:function(t,e){var r,n,o=t.x,i=t.y,s=e.x-o,a=e.y-i,u=t.width/2,d=t.height/2;if(!s&&!a)throw new Error("Not possible to find intersection inside of the rectangle");return Math.abs(a)*u>Math.abs(s)*d?(a<0&&(d=-d),r=d*s/a,n=d):(s<0&&(u=-u),r=u,n=u*a/s),{x:o+r,y:i+n}},buildLayerMatrix:function(t){var e=n.map(n.range(s(t)+1),(function(){return[]}));return n.forEach(t.nodes(),(function(r){var o=t.node(r),i=o.rank;n.isUndefined(i)||(e[i][o.order]=r)})),e},normalizeRanks:function(t){var e=n.min(n.map(t.nodes(),(function(e){return t.node(e).rank})));n.forEach(t.nodes(),(function(r){var o=t.node(r);n.has(o,"rank")&&(o.rank-=e)}))},removeEmptyRanks:function(t){var e=n.min(n.map(t.nodes(),(function(e){return t.node(e).rank}))),r=[];n.forEach(t.nodes(),(function(n){var o=t.node(n).rank-e;r[o]||(r[o]=[]),r[o].push(n)}));var o=0,i=t.graph().nodeRankFactor;n.forEach(r,(function(e,r){n.isUndefined(e)&&r%i!=0?--o:o&&n.forEach(e,(function(e){t.node(e).rank+=o}))}))},addBorderNode:function(t,e,r,n){var o={width:0,height:0};return arguments.length>=4&&(o.rank=r,o.order=n),i(t,"border",o,e)},maxRank:s,partition:function(t,e){var r={lhs:[],rhs:[]};return n.forEach(t,(function(t){e(t)?r.lhs.push(t):r.rhs.push(t)})),r},time:function(t,e){var r=n.now();try{return e()}finally{console.log(t+" time: "+(n.now()-r)+"ms")}},notime:function(t,e){return e()}}},3404:t=>{t.exports="0.8.5"},6960:(t,e,r)=>{var n=r(3150);t.exports={Graph:n.Graph,json:r(1430),alg:r(9757),version:n.version}},9535:(t,e,r)=>{var n=r(4434);t.exports=function(t){var e,r={},o=[];function i(o){n.has(r,o)||(r[o]=!0,e.push(o),n.each(t.successors(o),i),n.each(t.predecessors(o),i))}return n.each(t.nodes(),(function(t){e=[],i(t),e.length&&o.push(e)})),o}},7819:(t,e,r)=>{var n=r(4434);function o(t,e,r,i,s,a){n.has(i,e)||(i[e]=!0,r||a.push(e),n.each(s(e),(function(e){o(t,e,r,i,s,a)})),r&&a.push(e))}t.exports=function(t,e,r){n.isArray(e)||(e=[e]);var i=(t.isDirected()?t.successors:t.neighbors).bind(t),s=[],a={};return n.each(e,(function(e){if(!t.hasNode(e))throw new Error("Graph does not have node: "+e);o(t,e,"post"===r,a,i,s)})),s}},1353:(t,e,r)=>{var n=r(4245),o=r(4434);t.exports=function(t,e,r){return o.transform(t.nodes(),(function(o,i){o[i]=n(t,i,e,r)}),{})}},4245:(t,e,r)=>{var n=r(4434),o=r(1011);t.exports=function(t,e,r,n){return function(t,e,r,n){var i,s,a={},u=new o,d=function(t){var e=t.v!==i?t.v:t.w,n=a[e],o=r(t),d=s.distance+o;if(o<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+t+" Weight: "+o);d<n.distance&&(n.distance=d,n.predecessor=i,u.decrease(e,d))};for(t.nodes().forEach((function(t){var r=t===e?0:Number.POSITIVE_INFINITY;a[t]={distance:r},u.add(t,r)}));u.size()>0&&(i=u.removeMin(),(s=a[i]).distance!==Number.POSITIVE_INFINITY);)n(i).forEach(d);return a}(t,String(e),r||i,n||function(e){return t.outEdges(e)})};var i=n.constant(1)},937:(t,e,r)=>{var n=r(4434),o=r(9177);t.exports=function(t){return n.filter(o(t),(function(e){return e.length>1||1===e.length&&t.hasEdge(e[0],e[0])}))}},86:(t,e,r)=>{var n=r(4434);t.exports=function(t,e,r){return function(t,e,r){var n={},o=t.nodes();return o.forEach((function(t){n[t]={},n[t][t]={distance:0},o.forEach((function(e){t!==e&&(n[t][e]={distance:Number.POSITIVE_INFINITY})})),r(t).forEach((function(r){var o=r.v===t?r.w:r.v,i=e(r);n[t][o]={distance:i,predecessor:t}}))})),o.forEach((function(t){var e=n[t];o.forEach((function(r){var i=n[r];o.forEach((function(r){var n=i[t],o=e[r],s=i[r],a=n.distance+o.distance;a<s.distance&&(s.distance=a,s.predecessor=o.predecessor)}))}))})),n}(t,e||o,r||function(e){return t.outEdges(e)})};var o=n.constant(1)},9757:(t,e,r)=>{t.exports={components:r(9535),dijkstra:r(4245),dijkstraAll:r(1353),findCycles:r(937),floydWarshall:r(86),isAcyclic:r(7772),postorder:r(8494),preorder:r(101),prim:r(3816),tarjan:r(9177),topsort:r(750)}},7772:(t,e,r)=>{var n=r(750);t.exports=function(t){try{n(t)}catch(t){if(t instanceof n.CycleException)return!1;throw t}return!0}},8494:(t,e,r)=>{var n=r(7819);t.exports=function(t,e){return n(t,e,"post")}},101:(t,e,r)=>{var n=r(7819);t.exports=function(t,e){return n(t,e,"pre")}},3816:(t,e,r)=>{var n=r(4434),o=r(9955),i=r(1011);t.exports=function(t,e){var r,s=new o,a={},u=new i;function d(t){var n=t.v===r?t.w:t.v,o=u.priority(n);if(void 0!==o){var i=e(t);i<o&&(a[n]=r,u.decrease(n,i))}}if(0===t.nodeCount())return s;n.each(t.nodes(),(function(t){u.add(t,Number.POSITIVE_INFINITY),s.setNode(t)})),u.decrease(t.nodes()[0],0);for(var h=!1;u.size()>0;){if(r=u.removeMin(),n.has(a,r))s.setEdge(r,a[r]);else{if(h)throw new Error("Input graph is not connected: "+t);h=!0}t.nodeEdges(r).forEach(d)}return s}},9177:(t,e,r)=>{var n=r(4434);t.exports=function(t){var e=0,r=[],o={},i=[];function s(a){var u=o[a]={onStack:!0,lowlink:e,index:e++};if(r.push(a),t.successors(a).forEach((function(t){n.has(o,t)?o[t].onStack&&(u.lowlink=Math.min(u.lowlink,o[t].index)):(s(t),u.lowlink=Math.min(u.lowlink,o[t].lowlink))})),u.lowlink===u.index){var d,h=[];do{d=r.pop(),o[d].onStack=!1,h.push(d)}while(a!==d);i.push(h)}}return t.nodes().forEach((function(t){n.has(o,t)||s(t)})),i}},750:(t,e,r)=>{var n=r(4434);function o(t){var e={},r={},o=[];if(n.each(t.sinks(),(function s(a){if(n.has(r,a))throw new i;n.has(e,a)||(r[a]=!0,e[a]=!0,n.each(t.predecessors(a),s),delete r[a],o.push(a))})),n.size(e)!==t.nodeCount())throw new i;return o}function i(){}t.exports=o,o.CycleException=i,i.prototype=new Error},1011:(t,e,r)=>{var n=r(4434);function o(){this._arr=[],this._keyIndices={}}t.exports=o,o.prototype.size=function(){return this._arr.length},o.prototype.keys=function(){return this._arr.map((function(t){return t.key}))},o.prototype.has=function(t){return n.has(this._keyIndices,t)},o.prototype.priority=function(t){var e=this._keyIndices[t];if(void 0!==e)return this._arr[e].priority},o.prototype.min=function(){if(0===this.size())throw new Error("Queue underflow");return this._arr[0].key},o.prototype.add=function(t,e){var r=this._keyIndices;if(t=String(t),!n.has(r,t)){var o=this._arr,i=o.length;return r[t]=i,o.push({key:t,priority:e}),this._decrease(i),!0}return!1},o.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var t=this._arr.pop();return delete this._keyIndices[t.key],this._heapify(0),t.key},o.prototype.decrease=function(t,e){var r=this._keyIndices[t];if(e>this._arr[r].priority)throw new Error("New priority is greater than current priority. Key: "+t+" Old: "+this._arr[r].priority+" New: "+e);this._arr[r].priority=e,this._decrease(r)},o.prototype._heapify=function(t){var e=this._arr,r=2*t,n=r+1,o=t;r<e.length&&(o=e[r].priority<e[o].priority?r:o,n<e.length&&(o=e[n].priority<e[o].priority?n:o),o!==t&&(this._swap(t,o),this._heapify(o)))},o.prototype._decrease=function(t){for(var e,r=this._arr,n=r[t].priority;0!==t&&!(r[e=t>>1].priority<n);)this._swap(t,e),t=e},o.prototype._swap=function(t,e){var r=this._arr,n=this._keyIndices,o=r[t],i=r[e];r[t]=i,r[e]=o,n[i.key]=t,n[o.key]=e}},9955:(t,e,r)=>{"use strict";var n=r(4434);t.exports=i;var o="\0";function i(t){this._isDirected=!n.has(t,"directed")||t.directed,this._isMultigraph=!!n.has(t,"multigraph")&&t.multigraph,this._isCompound=!!n.has(t,"compound")&&t.compound,this._label=void 0,this._defaultNodeLabelFn=n.constant(void 0),this._defaultEdgeLabelFn=n.constant(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[o]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}function s(t,e){t[e]?t[e]++:t[e]=1}function a(t,e){--t[e]||delete t[e]}function u(t,e,r,o){var i=""+e,s=""+r;if(!t&&i>s){var a=i;i=s,s=a}return i+""+s+""+(n.isUndefined(o)?"\0":o)}function d(t,e){return u(t,e.v,e.w,e.name)}i.prototype._nodeCount=0,i.prototype._edgeCount=0,i.prototype.isDirected=function(){return this._isDirected},i.prototype.isMultigraph=function(){return this._isMultigraph},i.prototype.isCompound=function(){return this._isCompound},i.prototype.setGraph=function(t){return this._label=t,this},i.prototype.graph=function(){return this._label},i.prototype.setDefaultNodeLabel=function(t){return n.isFunction(t)||(t=n.constant(t)),this._defaultNodeLabelFn=t,this},i.prototype.nodeCount=function(){return this._nodeCount},i.prototype.nodes=function(){return n.keys(this._nodes)},i.prototype.sources=function(){var t=this;return n.filter(this.nodes(),(function(e){return n.isEmpty(t._in[e])}))},i.prototype.sinks=function(){var t=this;return n.filter(this.nodes(),(function(e){return n.isEmpty(t._out[e])}))},i.prototype.setNodes=function(t,e){var r=arguments,o=this;return n.each(t,(function(t){r.length>1?o.setNode(t,e):o.setNode(t)})),this},i.prototype.setNode=function(t,e){return n.has(this._nodes,t)?(arguments.length>1&&(this._nodes[t]=e),this):(this._nodes[t]=arguments.length>1?e:this._defaultNodeLabelFn(t),this._isCompound&&(this._parent[t]=o,this._children[t]={},this._children[o][t]=!0),this._in[t]={},this._preds[t]={},this._out[t]={},this._sucs[t]={},++this._nodeCount,this)},i.prototype.node=function(t){return this._nodes[t]},i.prototype.hasNode=function(t){return n.has(this._nodes,t)},i.prototype.removeNode=function(t){var e=this;if(n.has(this._nodes,t)){var r=function(t){e.removeEdge(e._edgeObjs[t])};delete this._nodes[t],this._isCompound&&(this._removeFromParentsChildList(t),delete this._parent[t],n.each(this.children(t),(function(t){e.setParent(t)})),delete this._children[t]),n.each(n.keys(this._in[t]),r),delete this._in[t],delete this._preds[t],n.each(n.keys(this._out[t]),r),delete this._out[t],delete this._sucs[t],--this._nodeCount}return this},i.prototype.setParent=function(t,e){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(n.isUndefined(e))e=o;else{for(var r=e+="";!n.isUndefined(r);r=this.parent(r))if(r===t)throw new Error("Setting "+e+" as parent of "+t+" would create a cycle");this.setNode(e)}return this.setNode(t),this._removeFromParentsChildList(t),this._parent[t]=e,this._children[e][t]=!0,this},i.prototype._removeFromParentsChildList=function(t){delete this._children[this._parent[t]][t]},i.prototype.parent=function(t){if(this._isCompound){var e=this._parent[t];if(e!==o)return e}},i.prototype.children=function(t){if(n.isUndefined(t)&&(t=o),this._isCompound){var e=this._children[t];if(e)return n.keys(e)}else{if(t===o)return this.nodes();if(this.hasNode(t))return[]}},i.prototype.predecessors=function(t){var e=this._preds[t];if(e)return n.keys(e)},i.prototype.successors=function(t){var e=this._sucs[t];if(e)return n.keys(e)},i.prototype.neighbors=function(t){var e=this.predecessors(t);if(e)return n.union(e,this.successors(t))},i.prototype.isLeaf=function(t){return 0===(this.isDirected()?this.successors(t):this.neighbors(t)).length},i.prototype.filterNodes=function(t){var e=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});e.setGraph(this.graph());var r=this;n.each(this._nodes,(function(r,n){t(n)&&e.setNode(n,r)})),n.each(this._edgeObjs,(function(t){e.hasNode(t.v)&&e.hasNode(t.w)&&e.setEdge(t,r.edge(t))}));var o={};function i(t){var n=r.parent(t);return void 0===n||e.hasNode(n)?(o[t]=n,n):n in o?o[n]:i(n)}return this._isCompound&&n.each(e.nodes(),(function(t){e.setParent(t,i(t))})),e},i.prototype.setDefaultEdgeLabel=function(t){return n.isFunction(t)||(t=n.constant(t)),this._defaultEdgeLabelFn=t,this},i.prototype.edgeCount=function(){return this._edgeCount},i.prototype.edges=function(){return n.values(this._edgeObjs)},i.prototype.setPath=function(t,e){var r=this,o=arguments;return n.reduce(t,(function(t,n){return o.length>1?r.setEdge(t,n,e):r.setEdge(t,n),n})),this},i.prototype.setEdge=function(){var t,e,r,o,i=!1,a=arguments[0];"object"==typeof a&&null!==a&&"v"in a?(t=a.v,e=a.w,r=a.name,2===arguments.length&&(o=arguments[1],i=!0)):(t=a,e=arguments[1],r=arguments[3],arguments.length>2&&(o=arguments[2],i=!0)),t=""+t,e=""+e,n.isUndefined(r)||(r=""+r);var d=u(this._isDirected,t,e,r);if(n.has(this._edgeLabels,d))return i&&(this._edgeLabels[d]=o),this;if(!n.isUndefined(r)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(t),this.setNode(e),this._edgeLabels[d]=i?o:this._defaultEdgeLabelFn(t,e,r);var h=function(t,e,r,n){var o=""+e,i=""+r;if(!t&&o>i){var s=o;o=i,i=s}var a={v:o,w:i};return n&&(a.name=n),a}(this._isDirected,t,e,r);return t=h.v,e=h.w,Object.freeze(h),this._edgeObjs[d]=h,s(this._preds[e],t),s(this._sucs[t],e),this._in[e][d]=h,this._out[t][d]=h,this._edgeCount++,this},i.prototype.edge=function(t,e,r){var n=1===arguments.length?d(this._isDirected,arguments[0]):u(this._isDirected,t,e,r);return this._edgeLabels[n]},i.prototype.hasEdge=function(t,e,r){var o=1===arguments.length?d(this._isDirected,arguments[0]):u(this._isDirected,t,e,r);return n.has(this._edgeLabels,o)},i.prototype.removeEdge=function(t,e,r){var n=1===arguments.length?d(this._isDirected,arguments[0]):u(this._isDirected,t,e,r),o=this._edgeObjs[n];return o&&(t=o.v,e=o.w,delete this._edgeLabels[n],delete this._edgeObjs[n],a(this._preds[e],t),a(this._sucs[t],e),delete this._in[e][n],delete this._out[t][n],this._edgeCount--),this},i.prototype.inEdges=function(t,e){var r=this._in[t];if(r){var o=n.values(r);return e?n.filter(o,(function(t){return t.v===e})):o}},i.prototype.outEdges=function(t,e){var r=this._out[t];if(r){var o=n.values(r);return e?n.filter(o,(function(t){return t.w===e})):o}},i.prototype.nodeEdges=function(t,e){var r=this.inEdges(t,e);if(r)return r.concat(this.outEdges(t,e))}},3150:(t,e,r)=>{t.exports={Graph:r(9955),version:r(9127)}},1430:(t,e,r)=>{var n=r(4434),o=r(9955);function i(t){return n.map(t.nodes(),(function(e){var r=t.node(e),o=t.parent(e),i={v:e};return n.isUndefined(r)||(i.value=r),n.isUndefined(o)||(i.parent=o),i}))}function s(t){return n.map(t.edges(),(function(e){var r=t.edge(e),o={v:e.v,w:e.w};return n.isUndefined(e.name)||(o.name=e.name),n.isUndefined(r)||(o.value=r),o}))}t.exports={write:function(t){var e={options:{directed:t.isDirected(),multigraph:t.isMultigraph(),compound:t.isCompound()},nodes:i(t),edges:s(t)};return n.isUndefined(t.graph())||(e.value=n.clone(t.graph())),e},read:function(t){var e=new o(t.options).setGraph(t.value);return n.each(t.nodes,(function(t){e.setNode(t.v,t.value),t.parent&&e.setParent(t.v,t.parent)})),n.each(t.edges,(function(t){e.setEdge({v:t.v,w:t.w,name:t.name},t.value)})),e}}},4434:(t,e,r)=>{var n;try{n={clone:r(7953),constant:r(9203),each:r(678),filter:r(4663),has:r(5346),isArray:r(5589),isEmpty:r(9787),isFunction:r(5563),isUndefined:r(6474),keys:r(2096),map:r(9107),reduce:r(7682),size:r(1039),transform:r(3604),union:r(7767),values:r(1682)}}catch(t){}n||(n=window._),t.exports=n},9127:t=>{t.exports="2.1.8"},4466:(t,e,r)=>{var n=r(5234)(r(3250),"DataView");t.exports=n},5208:(t,e,r)=>{var n=r(4440),o=r(4108),i=r(1085),s=r(7706),a=r(8636);function u(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}u.prototype.clear=n,u.prototype.delete=o,u.prototype.get=i,u.prototype.has=s,u.prototype.set=a,t.exports=u},1998:(t,e,r)=>{var n=r(266),o=r(2875),i=r(5828),s=r(4115),a=r(7690);function u(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}u.prototype.clear=n,u.prototype.delete=o,u.prototype.get=i,u.prototype.has=s,u.prototype.set=a,t.exports=u},2887:(t,e,r)=>{var n=r(5234)(r(3250),"Map");t.exports=n},5678:(t,e,r)=>{var n=r(9016),o=r(2363),i=r(4348),s=r(3062),a=r(262);function u(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}u.prototype.clear=n,u.prototype.delete=o,u.prototype.get=i,u.prototype.has=s,u.prototype.set=a,t.exports=u},5747:(t,e,r)=>{var n=r(5234)(r(3250),"Promise");t.exports=n},6616:(t,e,r)=>{var n=r(5234)(r(3250),"Set");t.exports=n},4546:(t,e,r)=>{var n=r(5678),o=r(3937),i=r(5009);function s(t){var e=-1,r=null==t?0:t.length;for(this.__data__=new n;++e<r;)this.add(t[e])}s.prototype.add=s.prototype.push=o,s.prototype.has=i,t.exports=s},9549:(t,e,r)=>{var n=r(1998),o=r(3210),i=r(8603),s=r(8947),a=r(885),u=r(8938);function d(t){var e=this.__data__=new n(t);this.size=e.size}d.prototype.clear=o,d.prototype.delete=i,d.prototype.get=s,d.prototype.has=a,d.prototype.set=u,t.exports=d},861:(t,e,r)=>{var n=r(3250).Symbol;t.exports=n},3526:(t,e,r)=>{var n=r(3250).Uint8Array;t.exports=n},8001:(t,e,r)=>{var n=r(5234)(r(3250),"WeakMap");t.exports=n},2274:t=>{t.exports=function(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}},4004:t=>{t.exports=function(t,e){for(var r=-1,n=null==t?0:t.length;++r<n&&!1!==e(t[r],r,t););return t}},2493:t=>{t.exports=function(t,e){for(var r=-1,n=null==t?0:t.length,o=0,i=[];++r<n;){var s=t[r];e(s,r,t)&&(i[o++]=s)}return i}},5436:(t,e,r)=>{var n=r(4365);t.exports=function(t,e){return!(null==t||!t.length)&&n(t,e,0)>-1}},9105:t=>{t.exports=function(t,e,r){for(var n=-1,o=null==t?0:t.length;++n<o;)if(r(e,t[n]))return!0;return!1}},5825:(t,e,r)=>{var n=r(8509),o=r(9312),i=r(5589),s=r(5778),a=r(5023),u=r(922),d=Object.prototype.hasOwnProperty;t.exports=function(t,e){var r=i(t),h=!r&&o(t),c=!r&&!h&&s(t),l=!r&&!h&&!c&&u(t),f=r||h||c||l,g=f?n(t.length,String):[],p=g.length;for(var v in t)!e&&!d.call(t,v)||f&&("length"==v||c&&("offset"==v||"parent"==v)||l&&("buffer"==v||"byteLength"==v||"byteOffset"==v)||a(v,p))||g.push(v);return g}},9233:t=>{t.exports=function(t,e){for(var r=-1,n=null==t?0:t.length,o=Array(n);++r<n;)o[r]=e(t[r],r,t);return o}},111:t=>{t.exports=function(t,e){for(var r=-1,n=e.length,o=t.length;++r<n;)t[o+r]=e[r];return t}},5115:t=>{t.exports=function(t,e,r,n){var o=-1,i=null==t?0:t.length;for(n&&i&&(r=t[++o]);++o<i;)r=e(r,t[o],o,t);return r}},1831:t=>{t.exports=function(t,e){for(var r=-1,n=null==t?0:t.length;++r<n;)if(e(t[r],r,t))return!0;return!1}},7088:(t,e,r)=>{var n=r(6174)("length");t.exports=n},3532:(t,e,r)=>{var n=r(7500),o=r(8260);t.exports=function(t,e,r){(void 0!==r&&!o(t[e],r)||void 0===r&&!(e in t))&&n(t,e,r)}},3192:(t,e,r)=>{var n=r(7500),o=r(8260),i=Object.prototype.hasOwnProperty;t.exports=function(t,e,r){var s=t[e];i.call(t,e)&&o(s,r)&&(void 0!==r||e in t)||n(t,e,r)}},8498:(t,e,r)=>{var n=r(8260);t.exports=function(t,e){for(var r=t.length;r--;)if(n(t[r][0],e))return r;return-1}},4265:(t,e,r)=>{var n=r(8618),o=r(2096);t.exports=function(t,e){return t&&n(e,o(e),t)}},1629:(t,e,r)=>{var n=r(8618),o=r(9882);t.exports=function(t,e){return t&&n(e,o(e),t)}},7500:(t,e,r)=>{var n=r(5595);t.exports=function(t,e,r){"__proto__"==e&&n?n(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}},8361:(t,e,r)=>{var n=r(9549),o=r(4004),i=r(3192),s=r(4265),a=r(1629),u=r(6502),d=r(2166),h=r(7272),c=r(2066),l=r(4357),f=r(5713),g=r(7493),p=r(2865),v=r(1908),y=r(4046),m=r(5589),w=r(5778),x=r(7613),b=r(3702),E=r(693),N=r(2096),_=r(9882),M="[object Arguments]",k="[object Function]",A="[object Object]",j={};j[M]=j["[object Array]"]=j["[object ArrayBuffer]"]=j["[object DataView]"]=j["[object Boolean]"]=j["[object Date]"]=j["[object Float32Array]"]=j["[object Float64Array]"]=j["[object Int8Array]"]=j["[object Int16Array]"]=j["[object Int32Array]"]=j["[object Map]"]=j["[object Number]"]=j[A]=j["[object RegExp]"]=j["[object Set]"]=j["[object String]"]=j["[object Symbol]"]=j["[object Uint8Array]"]=j["[object Uint8ClampedArray]"]=j["[object Uint16Array]"]=j["[object Uint32Array]"]=!0,j["[object Error]"]=j[k]=j["[object WeakMap]"]=!1,t.exports=function t(e,r,O,S,z,R){var I,P=1&r,C=2&r,D=4&r;if(O&&(I=z?O(e,S,z,R):O(e)),void 0!==I)return I;if(!b(e))return e;var T=m(e);if(T){if(I=p(e),!P)return d(e,I)}else{var L=g(e),F=L==k||"[object GeneratorFunction]"==L;if(w(e))return u(e,P);if(L==A||L==M||F&&!z){if(I=C||F?{}:y(e),!P)return C?c(e,a(I,e)):h(e,s(I,e))}else{if(!j[L])return z?e:{};I=v(e,L,P)}}R||(R=new n);var q=R.get(e);if(q)return q;R.set(e,I),E(e)?e.forEach((function(n){I.add(t(n,r,O,n,e,R))})):x(e)&&e.forEach((function(n,o){I.set(o,t(n,r,O,o,e,R))}));var V=T?void 0:(D?C?f:l:C?_:N)(e);return o(V||e,(function(n,o){V&&(n=e[o=n]),i(I,o,t(n,r,O,o,e,R))})),I}},7890:(t,e,r)=>{var n=r(3702),o=Object.create,i=function(){function t(){}return function(e){if(!n(e))return{};if(o)return o(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}();t.exports=i},1701:(t,e,r)=>{var n=r(4003),o=r(6313)(n);t.exports=o},5117:(t,e,r)=>{var n=r(2624);t.exports=function(t,e,r){for(var o=-1,i=t.length;++o<i;){var s=t[o],a=e(s);if(null!=a&&(void 0===u?a==a&&!n(a):r(a,u)))var u=a,d=s}return d}},8146:(t,e,r)=>{var n=r(1701);t.exports=function(t,e){var r=[];return n(t,(function(t,n,o){e(t,n,o)&&r.push(t)})),r}},4770:t=>{t.exports=function(t,e,r,n){for(var o=t.length,i=r+(n?1:-1);n?i--:++i<o;)if(e(t[i],i,t))return i;return-1}},6640:(t,e,r)=>{var n=r(111),o=r(7123);t.exports=function t(e,r,i,s,a){var u=-1,d=e.length;for(i||(i=o),a||(a=[]);++u<d;){var h=e[u];r>0&&i(h)?r>1?t(h,r-1,i,s,a):n(a,h):s||(a[a.length]=h)}return a}},9943:(t,e,r)=>{var n=r(2545)();t.exports=n},4003:(t,e,r)=>{var n=r(9943),o=r(2096);t.exports=function(t,e){return t&&n(t,e,o)}},548:(t,e,r)=>{var n=r(4007),o=r(6040);t.exports=function(t,e){for(var r=0,i=(e=n(e,t)).length;null!=t&&r<i;)t=t[o(e[r++])];return r&&r==i?t:void 0}},4468:(t,e,r)=>{var n=r(111),o=r(5589);t.exports=function(t,e,r){var i=e(t);return o(t)?i:n(i,r(t))}},9823:(t,e,r)=>{var n=r(861),o=r(1339),i=r(5151),s=n?n.toStringTag:void 0;t.exports=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":s&&s in Object(t)?o(t):i(t)}},1669:t=>{t.exports=function(t,e){return t>e}},2586:t=>{var e=Object.prototype.hasOwnProperty;t.exports=function(t,r){return null!=t&&e.call(t,r)}},2902:t=>{t.exports=function(t,e){return null!=t&&e in Object(t)}},4365:(t,e,r)=>{var n=r(4770),o=r(6963),i=r(5898);t.exports=function(t,e,r){return e==e?i(t,e,r):n(t,o,r)}},3016:(t,e,r)=>{var n=r(9823),o=r(440);t.exports=function(t){return o(t)&&"[object Arguments]"==n(t)}},4662:(t,e,r)=>{var n=r(8968),o=r(440);t.exports=function t(e,r,i,s,a){return e===r||(null==e||null==r||!o(e)&&!o(r)?e!=e&&r!=r:n(e,r,i,s,t,a))}},8968:(t,e,r)=>{var n=r(9549),o=r(4952),i=r(1080),s=r(6524),a=r(7493),u=r(5589),d=r(5778),h=r(922),c="[object Arguments]",l="[object Array]",f="[object Object]",g=Object.prototype.hasOwnProperty;t.exports=function(t,e,r,p,v,y){var m=u(t),w=u(e),x=m?l:a(t),b=w?l:a(e),E=(x=x==c?f:x)==f,N=(b=b==c?f:b)==f,_=x==b;if(_&&d(t)){if(!d(e))return!1;m=!0,E=!1}if(_&&!E)return y||(y=new n),m||h(t)?o(t,e,r,p,v,y):i(t,e,x,r,p,v,y);if(!(1&r)){var M=E&&g.call(t,"__wrapped__"),k=N&&g.call(e,"__wrapped__");if(M||k){var A=M?t.value():t,j=k?e.value():e;return y||(y=new n),v(A,j,r,p,y)}}return!!_&&(y||(y=new n),s(t,e,r,p,v,y))}},2275:(t,e,r)=>{var n=r(7493),o=r(440);t.exports=function(t){return o(t)&&"[object Map]"==n(t)}},2972:(t,e,r)=>{var n=r(9549),o=r(4662);t.exports=function(t,e,r,i){var s=r.length,a=s,u=!i;if(null==t)return!a;for(t=Object(t);s--;){var d=r[s];if(u&&d[2]?d[1]!==t[d[0]]:!(d[0]in t))return!1}for(;++s<a;){var h=(d=r[s])[0],c=t[h],l=d[1];if(u&&d[2]){if(void 0===c&&!(h in t))return!1}else{var f=new n;if(i)var g=i(c,l,h,t,e,f);if(!(void 0===g?o(l,c,3,i,f):g))return!1}}return!0}},6963:t=>{t.exports=function(t){return t!=t}},9817:(t,e,r)=>{var n=r(5563),o=r(8597),i=r(3702),s=r(5784),a=/^\[object .+?Constructor\]$/,u=Function.prototype,d=Object.prototype,h=u.toString,c=d.hasOwnProperty,l=RegExp("^"+h.call(c).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");t.exports=function(t){return!(!i(t)||o(t))&&(n(t)?l:a).test(s(t))}},7170:(t,e,r)=>{var n=r(7493),o=r(440);t.exports=function(t){return o(t)&&"[object Set]"==n(t)}},2448:(t,e,r)=>{var n=r(9823),o=r(6052),i=r(440),s={};s["[object Float32Array]"]=s["[object Float64Array]"]=s["[object Int8Array]"]=s["[object Int16Array]"]=s["[object Int32Array]"]=s["[object Uint8Array]"]=s["[object Uint8ClampedArray]"]=s["[object Uint16Array]"]=s["[object Uint32Array]"]=!0,s["[object Arguments]"]=s["[object Array]"]=s["[object ArrayBuffer]"]=s["[object Boolean]"]=s["[object DataView]"]=s["[object Date]"]=s["[object Error]"]=s["[object Function]"]=s["[object Map]"]=s["[object Number]"]=s["[object Object]"]=s["[object RegExp]"]=s["[object Set]"]=s["[object String]"]=s["[object WeakMap]"]=!1,t.exports=function(t){return i(t)&&o(t.length)&&!!s[n(t)]}},5833:(t,e,r)=>{var n=r(5640),o=r(9906),i=r(229),s=r(5589),a=r(4437);t.exports=function(t){return"function"==typeof t?t:null==t?i:"object"==typeof t?s(t)?o(t[0],t[1]):n(t):a(t)}},1351:(t,e,r)=>{var n=r(2840),o=r(2825),i=Object.prototype.hasOwnProperty;t.exports=function(t){if(!n(t))return o(t);var e=[];for(var r in Object(t))i.call(t,r)&&"constructor"!=r&&e.push(r);return e}},1309:(t,e,r)=>{var n=r(3702),o=r(2840),i=r(4866),s=Object.prototype.hasOwnProperty;t.exports=function(t){if(!n(t))return i(t);var e=o(t),r=[];for(var a in t)("constructor"!=a||!e&&s.call(t,a))&&r.push(a);return r}},6718:t=>{t.exports=function(t,e){return t<e}},8068:(t,e,r)=>{var n=r(1701),o=r(568);t.exports=function(t,e){var r=-1,i=o(t)?Array(t.length):[];return n(t,(function(t,n,o){i[++r]=e(t,n,o)})),i}},5640:(t,e,r)=>{var n=r(2972),o=r(2198),i=r(4656);t.exports=function(t){var e=o(t);return 1==e.length&&e[0][2]?i(e[0][0],e[0][1]):function(r){return r===t||n(r,t,e)}}},9906:(t,e,r)=>{var n=r(4662),o=r(3546),i=r(6708),s=r(5130),a=r(8802),u=r(4656),d=r(6040);t.exports=function(t,e){return s(t)&&a(e)?u(d(t),e):function(r){var s=o(r,t);return void 0===s&&s===e?i(r,t):n(e,s,3)}}},2133:(t,e,r)=>{var n=r(9549),o=r(3532),i=r(9943),s=r(1241),a=r(3702),u=r(9882),d=r(1933);t.exports=function t(e,r,h,c,l){e!==r&&i(r,(function(i,u){if(l||(l=new n),a(i))s(e,r,u,h,t,c,l);else{var f=c?c(d(e,u),i,u+"",e,r,l):void 0;void 0===f&&(f=i),o(e,u,f)}}),u)}},1241:(t,e,r)=>{var n=r(3532),o=r(6502),i=r(1327),s=r(2166),a=r(4046),u=r(9312),d=r(5589),h=r(8268),c=r(5778),l=r(5563),f=r(3702),g=r(4256),p=r(922),v=r(1933),y=r(6222);t.exports=function(t,e,r,m,w,x,b){var E=v(t,r),N=v(e,r),_=b.get(N);if(_)n(t,r,_);else{var M=x?x(E,N,r+"",t,e,b):void 0,k=void 0===M;if(k){var A=d(N),j=!A&&c(N),O=!A&&!j&&p(N);M=N,A||j||O?d(E)?M=E:h(E)?M=s(E):j?(k=!1,M=o(N,!0)):O?(k=!1,M=i(N,!0)):M=[]:g(N)||u(N)?(M=E,u(E)?M=y(E):f(E)&&!l(E)||(M=a(N))):k=!1}k&&(b.set(N,M),w(M,N,m,x,b),b.delete(N)),n(t,r,M)}}},3980:(t,e,r)=>{var n=r(9233),o=r(548),i=r(5833),s=r(8068),a=r(3340),u=r(1525),d=r(315),h=r(229),c=r(5589);t.exports=function(t,e,r){e=e.length?n(e,(function(t){return c(t)?function(e){return o(e,1===t.length?t[0]:t)}:t})):[h];var l=-1;e=n(e,u(i));var f=s(t,(function(t,r,o){return{criteria:n(e,(function(e){return e(t)})),index:++l,value:t}}));return a(f,(function(t,e){return d(t,e,r)}))}},1785:(t,e,r)=>{var n=r(7121),o=r(6708);t.exports=function(t,e){return n(t,e,(function(e,r){return o(t,r)}))}},7121:(t,e,r)=>{var n=r(548),o=r(2619),i=r(4007);t.exports=function(t,e,r){for(var s=-1,a=e.length,u={};++s<a;){var d=e[s],h=n(t,d);r(h,d)&&o(u,i(d,t),h)}return u}},6174:t=>{t.exports=function(t){return function(e){return null==e?void 0:e[t]}}},3293:(t,e,r)=>{var n=r(548);t.exports=function(t){return function(e){return n(e,t)}}},4930:t=>{var e=Math.ceil,r=Math.max;t.exports=function(t,n,o,i){for(var s=-1,a=r(e((n-t)/(o||1)),0),u=Array(a);a--;)u[i?a:++s]=t,t+=o;return u}},4306:t=>{t.exports=function(t,e,r,n,o){return o(t,(function(t,o,i){r=n?(n=!1,t):e(r,t,o,i)})),r}},9735:(t,e,r)=>{var n=r(229),o=r(340),i=r(4173);t.exports=function(t,e){return i(o(t,e,n),t+"")}},2619:(t,e,r)=>{var n=r(3192),o=r(4007),i=r(5023),s=r(3702),a=r(6040);t.exports=function(t,e,r,u){if(!s(t))return t;for(var d=-1,h=(e=o(e,t)).length,c=h-1,l=t;null!=l&&++d<h;){var f=a(e[d]),g=r;if("__proto__"===f||"constructor"===f||"prototype"===f)return t;if(d!=c){var p=l[f];void 0===(g=u?u(p,f,l):void 0)&&(g=s(p)?p:i(e[d+1])?[]:{})}n(l,f,g),l=l[f]}return t}},6739:(t,e,r)=>{var n=r(9203),o=r(5595),i=r(229),s=o?function(t,e){return o(t,"toString",{configurable:!0,enumerable:!1,value:n(e),writable:!0})}:i;t.exports=s},3340:t=>{t.exports=function(t,e){var r=t.length;for(t.sort(e);r--;)t[r]=t[r].value;return t}},8509:t=>{t.exports=function(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}},6245:(t,e,r)=>{var n=r(861),o=r(9233),i=r(5589),s=r(2624),a=n?n.prototype:void 0,u=a?a.toString:void 0;t.exports=function t(e){if("string"==typeof e)return e;if(i(e))return o(e,t)+"";if(s(e))return u?u.call(e):"";var r=e+"";return"0"==r&&1/e==-1/0?"-0":r}},1656:(t,e,r)=>{var n=r(2438),o=/^\s+/;t.exports=function(t){return t?t.slice(0,n(t)+1).replace(o,""):t}},1525:t=>{t.exports=function(t){return function(e){return t(e)}}},135:(t,e,r)=>{var n=r(4546),o=r(5436),i=r(9105),s=r(7026),a=r(6262),u=r(7969);t.exports=function(t,e,r){var d=-1,h=o,c=t.length,l=!0,f=[],g=f;if(r)l=!1,h=i;else if(c>=200){var p=e?null:a(t);if(p)return u(p);l=!1,h=s,g=new n}else g=e?[]:f;t:for(;++d<c;){var v=t[d],y=e?e(v):v;if(v=r||0!==v?v:0,l&&y==y){for(var m=g.length;m--;)if(g[m]===y)continue t;e&&g.push(y),f.push(v)}else h(g,y,r)||(g!==f&&g.push(y),f.push(v))}return f}},71:(t,e,r)=>{var n=r(9233);t.exports=function(t,e){return n(e,(function(e){return t[e]}))}},6302:t=>{t.exports=function(t,e,r){for(var n=-1,o=t.length,i=e.length,s={};++n<o;){var a=n<i?e[n]:void 0;r(s,t[n],a)}return s}},7026:t=>{t.exports=function(t,e){return t.has(e)}},4781:(t,e,r)=>{var n=r(229);t.exports=function(t){return"function"==typeof t?t:n}},4007:(t,e,r)=>{var n=r(5589),o=r(5130),i=r(4041),s=r(9835);t.exports=function(t,e){return n(t)?t:o(t,e)?[t]:i(s(t))}},2962:(t,e,r)=>{var n=r(3526);t.exports=function(t){var e=new t.constructor(t.byteLength);return new n(e).set(new n(t)),e}},6502:(t,e,r)=>{t=r.nmd(t);var n=r(3250),o=e&&!e.nodeType&&e,i=o&&t&&!t.nodeType&&t,s=i&&i.exports===o?n.Buffer:void 0,a=s?s.allocUnsafe:void 0;t.exports=function(t,e){if(e)return t.slice();var r=t.length,n=a?a(r):new t.constructor(r);return t.copy(n),n}},7037:(t,e,r)=>{var n=r(2962);t.exports=function(t,e){var r=e?n(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}},3429:t=>{var e=/\w*$/;t.exports=function(t){var r=new t.constructor(t.source,e.exec(t));return r.lastIndex=t.lastIndex,r}},9349:(t,e,r)=>{var n=r(861),o=n?n.prototype:void 0,i=o?o.valueOf:void 0;t.exports=function(t){return i?Object(i.call(t)):{}}},1327:(t,e,r)=>{var n=r(2962);t.exports=function(t,e){var r=e?n(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}},8899:(t,e,r)=>{var n=r(2624);t.exports=function(t,e){if(t!==e){var r=void 0!==t,o=null===t,i=t==t,s=n(t),a=void 0!==e,u=null===e,d=e==e,h=n(e);if(!u&&!h&&!s&&t>e||s&&a&&d&&!u&&!h||o&&a&&d||!r&&d||!i)return 1;if(!o&&!s&&!h&&t<e||h&&r&&i&&!o&&!s||u&&r&&i||!a&&i||!d)return-1}return 0}},315:(t,e,r)=>{var n=r(8899);t.exports=function(t,e,r){for(var o=-1,i=t.criteria,s=e.criteria,a=i.length,u=r.length;++o<a;){var d=n(i[o],s[o]);if(d)return o>=u?d:d*("desc"==r[o]?-1:1)}return t.index-e.index}},2166:t=>{t.exports=function(t,e){var r=-1,n=t.length;for(e||(e=Array(n));++r<n;)e[r]=t[r];return e}},8618:(t,e,r)=>{var n=r(3192),o=r(7500);t.exports=function(t,e,r,i){var s=!r;r||(r={});for(var a=-1,u=e.length;++a<u;){var d=e[a],h=i?i(r[d],t[d],d,r,t):void 0;void 0===h&&(h=t[d]),s?o(r,d,h):n(r,d,h)}return r}},7272:(t,e,r)=>{var n=r(8618),o=r(4450);t.exports=function(t,e){return n(t,o(t),e)}},2066:(t,e,r)=>{var n=r(8618),o=r(4969);t.exports=function(t,e){return n(t,o(t),e)}},1622:(t,e,r)=>{var n=r(3250)["__core-js_shared__"];t.exports=n},6948:(t,e,r)=>{var n=r(9735),o=r(8132);t.exports=function(t){return n((function(e,r){var n=-1,i=r.length,s=i>1?r[i-1]:void 0,a=i>2?r[2]:void 0;for(s=t.length>3&&"function"==typeof s?(i--,s):void 0,a&&o(r[0],r[1],a)&&(s=i<3?void 0:s,i=1),e=Object(e);++n<i;){var u=r[n];u&&t(e,u,n,s)}return e}))}},6313:(t,e,r)=>{var n=r(568);t.exports=function(t,e){return function(r,o){if(null==r)return r;if(!n(r))return t(r,o);for(var i=r.length,s=e?i:-1,a=Object(r);(e?s--:++s<i)&&!1!==o(a[s],s,a););return r}}},2545:t=>{t.exports=function(t){return function(e,r,n){for(var o=-1,i=Object(e),s=n(e),a=s.length;a--;){var u=s[t?a:++o];if(!1===r(i[u],u,i))break}return e}}},9301:(t,e,r)=>{var n=r(5833),o=r(568),i=r(2096);t.exports=function(t){return function(e,r,s){var a=Object(e);if(!o(e)){var u=n(r,3);e=i(e),r=function(t){return u(a[t],t,a)}}var d=t(e,r,s);return d>-1?a[u?e[d]:d]:void 0}}},1523:(t,e,r)=>{var n=r(4930),o=r(8132),i=r(9558);t.exports=function(t){return function(e,r,s){return s&&"number"!=typeof s&&o(e,r,s)&&(r=s=void 0),e=i(e),void 0===r?(r=e,e=0):r=i(r),s=void 0===s?e<r?1:-1:i(s),n(e,r,s,t)}}},6262:(t,e,r)=>{var n=r(6616),o=r(1607),i=r(7969),s=n&&1/i(new n([,-0]))[1]==1/0?function(t){return new n(t)}:o;t.exports=s},5595:(t,e,r)=>{var n=r(5234),o=function(){try{var t=n(Object,"defineProperty");return t({},"",{}),t}catch(t){}}();t.exports=o},4952:(t,e,r)=>{var n=r(4546),o=r(1831),i=r(7026);t.exports=function(t,e,r,s,a,u){var d=1&r,h=t.length,c=e.length;if(h!=c&&!(d&&c>h))return!1;var l=u.get(t),f=u.get(e);if(l&&f)return l==e&&f==t;var g=-1,p=!0,v=2&r?new n:void 0;for(u.set(t,e),u.set(e,t);++g<h;){var y=t[g],m=e[g];if(s)var w=d?s(m,y,g,e,t,u):s(y,m,g,t,e,u);if(void 0!==w){if(w)continue;p=!1;break}if(v){if(!o(e,(function(t,e){if(!i(v,e)&&(y===t||a(y,t,r,s,u)))return v.push(e)}))){p=!1;break}}else if(y!==m&&!a(y,m,r,s,u)){p=!1;break}}return u.delete(t),u.delete(e),p}},1080:(t,e,r)=>{var n=r(861),o=r(3526),i=r(8260),s=r(4952),a=r(1140),u=r(7969),d=n?n.prototype:void 0,h=d?d.valueOf:void 0;t.exports=function(t,e,r,n,d,c,l){switch(r){case"[object DataView]":if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case"[object ArrayBuffer]":return!(t.byteLength!=e.byteLength||!c(new o(t),new o(e)));case"[object Boolean]":case"[object Date]":case"[object Number]":return i(+t,+e);case"[object Error]":return t.name==e.name&&t.message==e.message;case"[object RegExp]":case"[object String]":return t==e+"";case"[object Map]":var f=a;case"[object Set]":var g=1&n;if(f||(f=u),t.size!=e.size&&!g)return!1;var p=l.get(t);if(p)return p==e;n|=2,l.set(t,e);var v=s(f(t),f(e),n,d,c,l);return l.delete(t),v;case"[object Symbol]":if(h)return h.call(t)==h.call(e)}return!1}},6524:(t,e,r)=>{var n=r(4357),o=Object.prototype.hasOwnProperty;t.exports=function(t,e,r,i,s,a){var u=1&r,d=n(t),h=d.length;if(h!=n(e).length&&!u)return!1;for(var c=h;c--;){var l=d[c];if(!(u?l in e:o.call(e,l)))return!1}var f=a.get(t),g=a.get(e);if(f&&g)return f==e&&g==t;var p=!0;a.set(t,e),a.set(e,t);for(var v=u;++c<h;){var y=t[l=d[c]],m=e[l];if(i)var w=u?i(m,y,l,e,t,a):i(y,m,l,t,e,a);if(!(void 0===w?y===m||s(y,m,r,i,a):w)){p=!1;break}v||(v="constructor"==l)}if(p&&!v){var x=t.constructor,b=e.constructor;x==b||!("constructor"in t)||!("constructor"in e)||"function"==typeof x&&x instanceof x&&"function"==typeof b&&b instanceof b||(p=!1)}return a.delete(t),a.delete(e),p}},3273:(t,e,r)=>{var n=r(2923),o=r(340),i=r(4173);t.exports=function(t){return i(o(t,void 0,n),t+"")}},302:(t,e,r)=>{var n="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g;t.exports=n},4357:(t,e,r)=>{var n=r(4468),o=r(4450),i=r(2096);t.exports=function(t){return n(t,i,o)}},5713:(t,e,r)=>{var n=r(4468),o=r(4969),i=r(9882);t.exports=function(t){return n(t,i,o)}},7570:(t,e,r)=>{var n=r(8949);t.exports=function(t,e){var r=t.__data__;return n(e)?r["string"==typeof e?"string":"hash"]:r.map}},2198:(t,e,r)=>{var n=r(8802),o=r(2096);t.exports=function(t){for(var e=o(t),r=e.length;r--;){var i=e[r],s=t[i];e[r]=[i,s,n(s)]}return e}},5234:(t,e,r)=>{var n=r(9817),o=r(7736);t.exports=function(t,e){var r=o(t,e);return n(r)?r:void 0}},8490:(t,e,r)=>{var n=r(3540)(Object.getPrototypeOf,Object);t.exports=n},1339:(t,e,r)=>{var n=r(861),o=Object.prototype,i=o.hasOwnProperty,s=o.toString,a=n?n.toStringTag:void 0;t.exports=function(t){var e=i.call(t,a),r=t[a];try{t[a]=void 0;var n=!0}catch(t){}var o=s.call(t);return n&&(e?t[a]=r:delete t[a]),o}},4450:(t,e,r)=>{var n=r(2493),o=r(4506),i=Object.prototype.propertyIsEnumerable,s=Object.getOwnPropertySymbols,a=s?function(t){return null==t?[]:(t=Object(t),n(s(t),(function(e){return i.call(t,e)})))}:o;t.exports=a},4969:(t,e,r)=>{var n=r(111),o=r(8490),i=r(4450),s=r(4506),a=Object.getOwnPropertySymbols?function(t){for(var e=[];t;)n(e,i(t)),t=o(t);return e}:s;t.exports=a},7493:(t,e,r)=>{var n=r(4466),o=r(2887),i=r(5747),s=r(6616),a=r(8001),u=r(9823),d=r(5784),h="[object Map]",c="[object Promise]",l="[object Set]",f="[object WeakMap]",g="[object DataView]",p=d(n),v=d(o),y=d(i),m=d(s),w=d(a),x=u;(n&&x(new n(new ArrayBuffer(1)))!=g||o&&x(new o)!=h||i&&x(i.resolve())!=c||s&&x(new s)!=l||a&&x(new a)!=f)&&(x=function(t){var e=u(t),r="[object Object]"==e?t.constructor:void 0,n=r?d(r):"";if(n)switch(n){case p:return g;case v:return h;case y:return c;case m:return l;case w:return f}return e}),t.exports=x},7736:t=>{t.exports=function(t,e){return null==t?void 0:t[e]}},3544:(t,e,r)=>{var n=r(4007),o=r(9312),i=r(5589),s=r(5023),a=r(6052),u=r(6040);t.exports=function(t,e,r){for(var d=-1,h=(e=n(e,t)).length,c=!1;++d<h;){var l=u(e[d]);if(!(c=null!=t&&r(t,l)))break;t=t[l]}return c||++d!=h?c:!!(h=null==t?0:t.length)&&a(h)&&s(l,h)&&(i(t)||o(t))}},3932:t=>{var e=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");t.exports=function(t){return e.test(t)}},4440:(t,e,r)=>{var n=r(4545);t.exports=function(){this.__data__=n?n(null):{},this.size=0}},4108:t=>{t.exports=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}},1085:(t,e,r)=>{var n=r(4545),o=Object.prototype.hasOwnProperty;t.exports=function(t){var e=this.__data__;if(n){var r=e[t];return"__lodash_hash_undefined__"===r?void 0:r}return o.call(e,t)?e[t]:void 0}},7706:(t,e,r)=>{var n=r(4545),o=Object.prototype.hasOwnProperty;t.exports=function(t){var e=this.__data__;return n?void 0!==e[t]:o.call(e,t)}},8636:(t,e,r)=>{var n=r(4545);t.exports=function(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=n&&void 0===e?"__lodash_hash_undefined__":e,this}},2865:t=>{var e=Object.prototype.hasOwnProperty;t.exports=function(t){var r=t.length,n=new t.constructor(r);return r&&"string"==typeof t[0]&&e.call(t,"index")&&(n.index=t.index,n.input=t.input),n}},1908:(t,e,r)=>{var n=r(2962),o=r(7037),i=r(3429),s=r(9349),a=r(1327);t.exports=function(t,e,r){var u=t.constructor;switch(e){case"[object ArrayBuffer]":return n(t);case"[object Boolean]":case"[object Date]":return new u(+t);case"[object DataView]":return o(t,r);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return a(t,r);case"[object Map]":case"[object Set]":return new u;case"[object Number]":case"[object String]":return new u(t);case"[object RegExp]":return i(t);case"[object Symbol]":return s(t)}}},4046:(t,e,r)=>{var n=r(7890),o=r(8490),i=r(2840);t.exports=function(t){return"function"!=typeof t.constructor||i(t)?{}:n(o(t))}},7123:(t,e,r)=>{var n=r(861),o=r(9312),i=r(5589),s=n?n.isConcatSpreadable:void 0;t.exports=function(t){return i(t)||o(t)||!!(s&&t&&t[s])}},5023:t=>{var e=/^(?:0|[1-9]\d*)$/;t.exports=function(t,r){var n=typeof t;return!!(r=null==r?9007199254740991:r)&&("number"==n||"symbol"!=n&&e.test(t))&&t>-1&&t%1==0&&t<r}},8132:(t,e,r)=>{var n=r(8260),o=r(568),i=r(5023),s=r(3702);t.exports=function(t,e,r){if(!s(r))return!1;var a=typeof e;return!!("number"==a?o(r)&&i(e,r.length):"string"==a&&e in r)&&n(r[e],t)}},5130:(t,e,r)=>{var n=r(5589),o=r(2624),i=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,s=/^\w*$/;t.exports=function(t,e){if(n(t))return!1;var r=typeof t;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=t&&!o(t))||s.test(t)||!i.test(t)||null!=e&&t in Object(e)}},8949:t=>{t.exports=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t}},8597:(t,e,r)=>{var n,o=r(1622),i=(n=/[^.]+$/.exec(o&&o.keys&&o.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"";t.exports=function(t){return!!i&&i in t}},2840:t=>{var e=Object.prototype;t.exports=function(t){var r=t&&t.constructor;return t===("function"==typeof r&&r.prototype||e)}},8802:(t,e,r)=>{var n=r(3702);t.exports=function(t){return t==t&&!n(t)}},266:t=>{t.exports=function(){this.__data__=[],this.size=0}},2875:(t,e,r)=>{var n=r(8498),o=Array.prototype.splice;t.exports=function(t){var e=this.__data__,r=n(e,t);return!(r<0||(r==e.length-1?e.pop():o.call(e,r,1),--this.size,0))}},5828:(t,e,r)=>{var n=r(8498);t.exports=function(t){var e=this.__data__,r=n(e,t);return r<0?void 0:e[r][1]}},4115:(t,e,r)=>{var n=r(8498);t.exports=function(t){return n(this.__data__,t)>-1}},7690:(t,e,r)=>{var n=r(8498);t.exports=function(t,e){var r=this.__data__,o=n(r,t);return o<0?(++this.size,r.push([t,e])):r[o][1]=e,this}},9016:(t,e,r)=>{var n=r(5208),o=r(1998),i=r(2887);t.exports=function(){this.size=0,this.__data__={hash:new n,map:new(i||o),string:new n}}},2363:(t,e,r)=>{var n=r(7570);t.exports=function(t){var e=n(this,t).delete(t);return this.size-=e?1:0,e}},4348:(t,e,r)=>{var n=r(7570);t.exports=function(t){return n(this,t).get(t)}},3062:(t,e,r)=>{var n=r(7570);t.exports=function(t){return n(this,t).has(t)}},262:(t,e,r)=>{var n=r(7570);t.exports=function(t,e){var r=n(this,t),o=r.size;return r.set(t,e),this.size+=r.size==o?0:1,this}},1140:t=>{t.exports=function(t){var e=-1,r=Array(t.size);return t.forEach((function(t,n){r[++e]=[n,t]})),r}},4656:t=>{t.exports=function(t,e){return function(r){return null!=r&&r[t]===e&&(void 0!==e||t in Object(r))}}},2924:(t,e,r)=>{var n=r(7997);t.exports=function(t){var e=n(t,(function(t){return 500===r.size&&r.clear(),t})),r=e.cache;return e}},4545:(t,e,r)=>{var n=r(5234)(Object,"create");t.exports=n},2825:(t,e,r)=>{var n=r(3540)(Object.keys,Object);t.exports=n},4866:t=>{t.exports=function(t){var e=[];if(null!=t)for(var r in Object(t))e.push(r);return e}},8690:(t,e,r)=>{t=r.nmd(t);var n=r(302),o=e&&!e.nodeType&&e,i=o&&t&&!t.nodeType&&t,s=i&&i.exports===o&&n.process,a=function(){try{return i&&i.require&&i.require("util").types||s&&s.binding&&s.binding("util")}catch(t){}}();t.exports=a},5151:t=>{var e=Object.prototype.toString;t.exports=function(t){return e.call(t)}},3540:t=>{t.exports=function(t,e){return function(r){return t(e(r))}}},340:(t,e,r)=>{var n=r(2274),o=Math.max;t.exports=function(t,e,r){return e=o(void 0===e?t.length-1:e,0),function(){for(var i=arguments,s=-1,a=o(i.length-e,0),u=Array(a);++s<a;)u[s]=i[e+s];s=-1;for(var d=Array(e+1);++s<e;)d[s]=i[s];return d[e]=r(u),n(t,this,d)}}},3250:(t,e,r)=>{var n=r(302),o="object"==typeof self&&self&&self.Object===Object&&self,i=n||o||Function("return this")();t.exports=i},1933:t=>{t.exports=function(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}},3937:t=>{t.exports=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this}},5009:t=>{t.exports=function(t){return this.__data__.has(t)}},7969:t=>{t.exports=function(t){var e=-1,r=Array(t.size);return t.forEach((function(t){r[++e]=t})),r}},4173:(t,e,r)=>{var n=r(6739),o=r(7357)(n);t.exports=o},7357:t=>{var e=Date.now;t.exports=function(t){var r=0,n=0;return function(){var o=e(),i=16-(o-n);if(n=o,i>0){if(++r>=800)return arguments[0]}else r=0;return t.apply(void 0,arguments)}}},3210:(t,e,r)=>{var n=r(1998);t.exports=function(){this.__data__=new n,this.size=0}},8603:t=>{t.exports=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}},8947:t=>{t.exports=function(t){return this.__data__.get(t)}},885:t=>{t.exports=function(t){return this.__data__.has(t)}},8938:(t,e,r)=>{var n=r(1998),o=r(2887),i=r(5678);t.exports=function(t,e){var r=this.__data__;if(r instanceof n){var s=r.__data__;if(!o||s.length<199)return s.push([t,e]),this.size=++r.size,this;r=this.__data__=new i(s)}return r.set(t,e),this.size=r.size,this}},5898:t=>{t.exports=function(t,e,r){for(var n=r-1,o=t.length;++n<o;)if(t[n]===e)return n;return-1}},1324:(t,e,r)=>{var n=r(7088),o=r(3932),i=r(445);t.exports=function(t){return o(t)?i(t):n(t)}},4041:(t,e,r)=>{var n=r(2924),o=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,i=/\\(\\)?/g,s=n((function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(o,(function(t,r,n,o){e.push(n?o.replace(i,"$1"):r||t)})),e}));t.exports=s},6040:(t,e,r)=>{var n=r(2624);t.exports=function(t){if("string"==typeof t||n(t))return t;var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}},5784:t=>{var e=Function.prototype.toString;t.exports=function(t){if(null!=t){try{return e.call(t)}catch(t){}try{return t+""}catch(t){}}return""}},2438:t=>{var e=/\s/;t.exports=function(t){for(var r=t.length;r--&&e.test(t.charAt(r)););return r}},445:t=>{var e="\\ud800-\\udfff",r="["+e+"]",n="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",o="\\ud83c[\\udffb-\\udfff]",i="[^"+e+"]",s="(?:\\ud83c[\\udde6-\\uddff]){2}",a="[\\ud800-\\udbff][\\udc00-\\udfff]",u="(?:"+n+"|"+o+")?",d="[\\ufe0e\\ufe0f]?",h=d+u+"(?:\\u200d(?:"+[i,s,a].join("|")+")"+d+u+")*",c="(?:"+[i+n+"?",n,s,a,r].join("|")+")",l=RegExp(o+"(?="+o+")|"+c+h,"g");t.exports=function(t){for(var e=l.lastIndex=0;l.test(t);)++e;return e}},7953:(t,e,r)=>{var n=r(8361);t.exports=function(t){return n(t,4)}},7179:(t,e,r)=>{var n=r(8361);t.exports=function(t){return n(t,5)}},9203:t=>{t.exports=function(t){return function(){return t}}},3821:(t,e,r)=>{var n=r(9735),o=r(8260),i=r(8132),s=r(9882),a=Object.prototype,u=a.hasOwnProperty,d=n((function(t,e){t=Object(t);var r=-1,n=e.length,d=n>2?e[2]:void 0;for(d&&i(e[0],e[1],d)&&(n=1);++r<n;)for(var h=e[r],c=s(h),l=-1,f=c.length;++l<f;){var g=c[l],p=t[g];(void 0===p||o(p,a[g])&&!u.call(t,g))&&(t[g]=h[g])}return t}));t.exports=d},678:(t,e,r)=>{t.exports=r(7734)},8260:t=>{t.exports=function(t,e){return t===e||t!=t&&e!=e}},4663:(t,e,r)=>{var n=r(2493),o=r(8146),i=r(5833),s=r(5589);t.exports=function(t,e){return(s(t)?n:o)(t,i(e,3))}},6969:(t,e,r)=>{var n=r(9301)(r(564));t.exports=n},564:(t,e,r)=>{var n=r(4770),o=r(5833),i=r(6843),s=Math.max;t.exports=function(t,e,r){var a=null==t?0:t.length;if(!a)return-1;var u=null==r?0:i(r);return u<0&&(u=s(a+u,0)),n(t,o(e,3),u)}},2923:(t,e,r)=>{var n=r(6640);t.exports=function(t){return null!=t&&t.length?n(t,1):[]}},7734:(t,e,r)=>{var n=r(4004),o=r(1701),i=r(4781),s=r(5589);t.exports=function(t,e){return(s(t)?n:o)(t,i(e))}},7514:(t,e,r)=>{var n=r(9943),o=r(4781),i=r(9882);t.exports=function(t,e){return null==t?t:n(t,o(e),i)}},3546:(t,e,r)=>{var n=r(548);t.exports=function(t,e,r){var o=null==t?void 0:n(t,e);return void 0===o?r:o}},5346:(t,e,r)=>{var n=r(2586),o=r(3544);t.exports=function(t,e){return null!=t&&o(t,e,n)}},6708:(t,e,r)=>{var n=r(2902),o=r(3544);t.exports=function(t,e){return null!=t&&o(t,e,n)}},229:t=>{t.exports=function(t){return t}},9312:(t,e,r)=>{var n=r(3016),o=r(440),i=Object.prototype,s=i.hasOwnProperty,a=i.propertyIsEnumerable,u=n(function(){return arguments}())?n:function(t){return o(t)&&s.call(t,"callee")&&!a.call(t,"callee")};t.exports=u},5589:t=>{var e=Array.isArray;t.exports=e},568:(t,e,r)=>{var n=r(5563),o=r(6052);t.exports=function(t){return null!=t&&o(t.length)&&!n(t)}},8268:(t,e,r)=>{var n=r(568),o=r(440);t.exports=function(t){return o(t)&&n(t)}},5778:(t,e,r)=>{t=r.nmd(t);var n=r(3250),o=r(7999),i=e&&!e.nodeType&&e,s=i&&t&&!t.nodeType&&t,a=s&&s.exports===i?n.Buffer:void 0,u=(a?a.isBuffer:void 0)||o;t.exports=u},9787:(t,e,r)=>{var n=r(1351),o=r(7493),i=r(9312),s=r(5589),a=r(568),u=r(5778),d=r(2840),h=r(922),c=Object.prototype.hasOwnProperty;t.exports=function(t){if(null==t)return!0;if(a(t)&&(s(t)||"string"==typeof t||"function"==typeof t.splice||u(t)||h(t)||i(t)))return!t.length;var e=o(t);if("[object Map]"==e||"[object Set]"==e)return!t.size;if(d(t))return!n(t).length;for(var r in t)if(c.call(t,r))return!1;return!0}},5563:(t,e,r)=>{var n=r(9823),o=r(3702);t.exports=function(t){if(!o(t))return!1;var e=n(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e}},6052:t=>{t.exports=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}},7613:(t,e,r)=>{var n=r(2275),o=r(1525),i=r(8690),s=i&&i.isMap,a=s?o(s):n;t.exports=a},3702:t=>{t.exports=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}},440:t=>{t.exports=function(t){return null!=t&&"object"==typeof t}},4256:(t,e,r)=>{var n=r(9823),o=r(8490),i=r(440),s=Function.prototype,a=Object.prototype,u=s.toString,d=a.hasOwnProperty,h=u.call(Object);t.exports=function(t){if(!i(t)||"[object Object]"!=n(t))return!1;var e=o(t);if(null===e)return!0;var r=d.call(e,"constructor")&&e.constructor;return"function"==typeof r&&r instanceof r&&u.call(r)==h}},693:(t,e,r)=>{var n=r(7170),o=r(1525),i=r(8690),s=i&&i.isSet,a=s?o(s):n;t.exports=a},6705:(t,e,r)=>{var n=r(9823),o=r(5589),i=r(440);t.exports=function(t){return"string"==typeof t||!o(t)&&i(t)&&"[object String]"==n(t)}},2624:(t,e,r)=>{var n=r(9823),o=r(440);t.exports=function(t){return"symbol"==typeof t||o(t)&&"[object Symbol]"==n(t)}},922:(t,e,r)=>{var n=r(2448),o=r(1525),i=r(8690),s=i&&i.isTypedArray,a=s?o(s):n;t.exports=a},6474:t=>{t.exports=function(t){return void 0===t}},2096:(t,e,r)=>{var n=r(5825),o=r(1351),i=r(568);t.exports=function(t){return i(t)?n(t):o(t)}},9882:(t,e,r)=>{var n=r(5825),o=r(1309),i=r(568);t.exports=function(t){return i(t)?n(t,!0):o(t)}},7875:t=>{t.exports=function(t){var e=null==t?0:t.length;return e?t[e-1]:void 0}},9107:(t,e,r)=>{var n=r(9233),o=r(5833),i=r(8068),s=r(5589);t.exports=function(t,e){return(s(t)?n:i)(t,o(e,3))}},1230:(t,e,r)=>{var n=r(7500),o=r(4003),i=r(5833);t.exports=function(t,e){var r={};return e=i(e,3),o(t,(function(t,o,i){n(r,o,e(t,o,i))})),r}},6492:(t,e,r)=>{var n=r(5117),o=r(1669),i=r(229);t.exports=function(t){return t&&t.length?n(t,i,o):void 0}},7997:(t,e,r)=>{var n=r(5678);function o(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new TypeError("Expected a function");var r=function(){var n=arguments,o=e?e.apply(this,n):n[0],i=r.cache;if(i.has(o))return i.get(o);var s=t.apply(this,n);return r.cache=i.set(o,s)||i,s};return r.cache=new(o.Cache||n),r}o.Cache=n,t.exports=o},8469:(t,e,r)=>{var n=r(2133),o=r(6948)((function(t,e,r){n(t,e,r)}));t.exports=o},5071:(t,e,r)=>{var n=r(5117),o=r(6718),i=r(229);t.exports=function(t){return t&&t.length?n(t,i,o):void 0}},6838:(t,e,r)=>{var n=r(5117),o=r(5833),i=r(6718);t.exports=function(t,e){return t&&t.length?n(t,o(e,2),i):void 0}},1607:t=>{t.exports=function(){}},231:(t,e,r)=>{var n=r(3250);t.exports=function(){return n.Date.now()}},9335:(t,e,r)=>{var n=r(1785),o=r(3273)((function(t,e){return null==t?{}:n(t,e)}));t.exports=o},4437:(t,e,r)=>{var n=r(6174),o=r(3293),i=r(5130),s=r(6040);t.exports=function(t){return i(t)?n(s(t)):o(t)}},8569:(t,e,r)=>{var n=r(1523)();t.exports=n},7682:(t,e,r)=>{var n=r(5115),o=r(1701),i=r(5833),s=r(4306),a=r(5589);t.exports=function(t,e,r){var u=a(t)?n:s,d=arguments.length<3;return u(t,i(e,4),r,d,o)}},1039:(t,e,r)=>{var n=r(1351),o=r(7493),i=r(568),s=r(6705),a=r(1324);t.exports=function(t){if(null==t)return 0;if(i(t))return s(t)?a(t):t.length;var e=o(t);return"[object Map]"==e||"[object Set]"==e?t.size:n(t).length}},1635:(t,e,r)=>{var n=r(6640),o=r(3980),i=r(9735),s=r(8132),a=i((function(t,e){if(null==t)return[];var r=e.length;return r>1&&s(t,e[0],e[1])?e=[]:r>2&&s(e[0],e[1],e[2])&&(e=[e[0]]),o(t,n(e,1),[])}));t.exports=a},4506:t=>{t.exports=function(){return[]}},7999:t=>{t.exports=function(){return!1}},9558:(t,e,r)=>{var n=r(9153),o=1/0;t.exports=function(t){return t?(t=n(t))===o||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0}},6843:(t,e,r)=>{var n=r(9558);t.exports=function(t){var e=n(t),r=e%1;return e==e?r?e-r:e:0}},9153:(t,e,r)=>{var n=r(1656),o=r(3702),i=r(2624),s=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,u=/^0o[0-7]+$/i,d=parseInt;t.exports=function(t){if("number"==typeof t)return t;if(i(t))return NaN;if(o(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=o(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=n(t);var r=a.test(t);return r||u.test(t)?d(t.slice(2),r?2:8):s.test(t)?NaN:+t}},6222:(t,e,r)=>{var n=r(8618),o=r(9882);t.exports=function(t){return n(t,o(t))}},9835:(t,e,r)=>{var n=r(6245);t.exports=function(t){return null==t?"":n(t)}},3604:(t,e,r)=>{var n=r(4004),o=r(7890),i=r(4003),s=r(5833),a=r(8490),u=r(5589),d=r(5778),h=r(5563),c=r(3702),l=r(922);t.exports=function(t,e,r){var f=u(t),g=f||d(t)||l(t);if(e=s(e,4),null==r){var p=t&&t.constructor;r=g?f?new p:[]:c(t)&&h(p)?o(a(t)):{}}return(g?n:i)(t,(function(t,n,o){return e(r,t,n,o)})),r}},7767:(t,e,r)=>{var n=r(6640),o=r(9735),i=r(135),s=r(8268),a=o((function(t){return i(n(t,1,s,!0))}));t.exports=a},1422:(t,e,r)=>{var n=r(9835),o=0;t.exports=function(t){var e=++o;return n(t)+e}},1682:(t,e,r)=>{var n=r(71),o=r(2096);t.exports=function(t){return null==t?[]:n(t,o(t))}},4142:(t,e,r)=>{var n=r(3192),o=r(6302);t.exports=function(t,e){return o(t||[],e||[],n)}},3795:(t,e,r)=>{var n=r(8331),o=["stopLayout","calculateLayout"];t.exports=function(){var t=new Worker(URL.createObjectURL(new Blob(['(()=>{var t={5439:(t,e,r)=>{t.exports={graphlib:r(1943),layout:r(5499),debug:r(5856),util:{time:r(345).time,notime:r(345).notime},version:r(3404)}},5205:(t,e,r)=>{"use strict";var n=r(2692),o=r(824);t.exports={run:function(t){var e="greedy"===t.graph().acyclicer?o(t,function(t){return function(e){return t.edge(e).weight}}(t)):function(t){var e=[],r={},o={};return n.forEach(t.nodes(),(function i(s){n.has(o,s)||(o[s]=!0,r[s]=!0,n.forEach(t.outEdges(s),(function(t){n.has(r,t.w)?e.push(t):i(t.w)})),delete r[s])})),e}(t);n.forEach(e,(function(e){var r=t.edge(e);t.removeEdge(e),r.forwardName=e.name,r.reversed=!0,t.setEdge(e.w,e.v,r,n.uniqueId("rev"))}))},undo:function(t){n.forEach(t.edges(),(function(e){var r=t.edge(e);if(r.reversed){t.removeEdge(e);var n=r.forwardName;delete r.reversed,delete r.forwardName,t.setEdge(e.w,e.v,r,n)}}))}}},1555:(t,e,r)=>{var n=r(2692),o=r(345);function i(t,e,r,n,i,s){var a={width:0,height:0,rank:s,borderType:e},u=i[e][s-1],d=o.addDummyNode(t,"border",a,r);i[e][s]=d,t.setParent(d,n),u&&t.setEdge(u,d,{weight:1})}t.exports=function(t){n.forEach(t.children(),(function e(r){var o=t.children(r),s=t.node(r);if(o.length&&n.forEach(o,e),n.has(s,"minRank")){s.borderLeft=[],s.borderRight=[];for(var a=s.minRank,u=s.maxRank+1;a<u;++a)i(t,"borderLeft","_bl",r,s,a),i(t,"borderRight","_br",r,s,a)}}))}},4688:(t,e,r)=>{"use strict";var n=r(2692);function o(t){n.forEach(t.nodes(),(function(e){i(t.node(e))})),n.forEach(t.edges(),(function(e){i(t.edge(e))}))}function i(t){var e=t.width;t.width=t.height,t.height=e}function s(t){t.y=-t.y}function a(t){var e=t.x;t.x=t.y,t.y=e}t.exports={adjust:function(t){var e=t.graph().rankdir.toLowerCase();"lr"!==e&&"rl"!==e||o(t)},undo:function(t){var e=t.graph().rankdir.toLowerCase();"bt"!==e&&"rl"!==e||function(t){n.forEach(t.nodes(),(function(e){s(t.node(e))})),n.forEach(t.edges(),(function(e){var r=t.edge(e);n.forEach(r.points,s),n.has(r,"y")&&s(r)}))}(t),"lr"!==e&&"rl"!==e||(function(t){n.forEach(t.nodes(),(function(e){a(t.node(e))})),n.forEach(t.edges(),(function(e){var r=t.edge(e);n.forEach(r.points,a),n.has(r,"x")&&a(r)}))}(t),o(t))}}},2278:t=>{function e(){var t={};t._next=t._prev=t,this._sentinel=t}function r(t){t._prev._next=t._next,t._next._prev=t._prev,delete t._next,delete t._prev}function n(t,e){if("_next"!==t&&"_prev"!==t)return e}t.exports=e,e.prototype.dequeue=function(){var t=this._sentinel,e=t._prev;if(e!==t)return r(e),e},e.prototype.enqueue=function(t){var e=this._sentinel;t._prev&&t._next&&r(t),t._next=e._next,e._next._prev=t,e._next=t,t._prev=e},e.prototype.toString=function(){for(var t=[],e=this._sentinel,r=e._prev;r!==e;)t.push(JSON.stringify(r,n)),r=r._prev;return"["+t.join(", ")+"]"}},5856:(t,e,r)=>{var n=r(2692),o=r(345),i=r(1943).Graph;t.exports={debugOrdering:function(t){var e=o.buildLayerMatrix(t),r=new i({compound:!0,multigraph:!0}).setGraph({});return n.forEach(t.nodes(),(function(e){r.setNode(e,{label:e}),r.setParent(e,"layer"+t.node(e).rank)})),n.forEach(t.edges(),(function(t){r.setEdge(t.v,t.w,{},t.name)})),n.forEach(e,(function(t,e){var o="layer"+e;r.setNode(o,{rank:"same"}),n.reduce(t,(function(t,e){return r.setEdge(t,e,{style:"invis"}),e}))})),r}}},1943:(t,e,r)=>{var n;try{n=r(6960)}catch(t){}n||(n=window.graphlib),t.exports=n},824:(t,e,r)=>{var n=r(2692),o=r(1943).Graph,i=r(2278);t.exports=function(t,e){if(t.nodeCount()<=1)return[];var r=function(t,e){var r=new o,s=0,a=0;n.forEach(t.nodes(),(function(t){r.setNode(t,{v:t,in:0,out:0})})),n.forEach(t.edges(),(function(t){var n=r.edge(t.v,t.w)||0,o=e(t),i=n+o;r.setEdge(t.v,t.w,i),a=Math.max(a,r.node(t.v).out+=o),s=Math.max(s,r.node(t.w).in+=o)}));var d=n.range(a+s+3).map((function(){return new i})),h=s+1;return n.forEach(r.nodes(),(function(t){u(d,h,r.node(t))})),{graph:r,buckets:d,zeroIdx:h}}(t,e||s),d=function(t,e,r){for(var n,o=[],i=e[e.length-1],s=e[0];t.nodeCount();){for(;n=s.dequeue();)a(t,e,r,n);for(;n=i.dequeue();)a(t,e,r,n);if(t.nodeCount())for(var u=e.length-2;u>0;--u)if(n=e[u].dequeue()){o=o.concat(a(t,e,r,n,!0));break}}return o}(r.graph,r.buckets,r.zeroIdx);return n.flatten(n.map(d,(function(e){return t.outEdges(e.v,e.w)})),!0)};var s=n.constant(1);function a(t,e,r,o,i){var s=i?[]:void 0;return n.forEach(t.inEdges(o.v),(function(n){var o=t.edge(n),a=t.node(n.v);i&&s.push({v:n.v,w:n.w}),a.out-=o,u(e,r,a)})),n.forEach(t.outEdges(o.v),(function(n){var o=t.edge(n),i=n.w,s=t.node(i);s.in-=o,u(e,r,s)})),t.removeNode(o.v),s}function u(t,e,r){r.out?r.in?t[r.out-r.in+e].enqueue(r):t[t.length-1].enqueue(r):t[0].enqueue(r)}},5499:(t,e,r)=>{"use strict";var n=r(2692),o=r(5205),i=r(4125),s=r(8264),a=r(345).normalizeRanks,u=r(2555),d=r(345).removeEmptyRanks,h=r(838),c=r(1555),l=r(4688),f=r(6571),g=r(9533),p=r(345),v=r(1943).Graph;t.exports=function(t,e){var r=e&&e.debugTiming?p.time:p.notime;r("layout",(function(){var e=r(" buildLayoutGraph",(function(){return function(t){var e=new v({multigraph:!0,compound:!0}),r=k(t.graph());return e.setGraph(n.merge({},m,M(r,y),n.pick(r,w))),n.forEach(t.nodes(),(function(r){var o=k(t.node(r));e.setNode(r,n.defaults(M(o,x),b)),e.setParent(r,t.parent(r))})),n.forEach(t.edges(),(function(r){var o=k(t.edge(r));e.setEdge(r,n.merge({},N,M(o,E),n.pick(o,_)))})),e}(t)}));r(" runLayout",(function(){!function(t,e){e(" makeSpaceForEdgeLabels",(function(){!function(t){var e=t.graph();e.ranksep/=2,n.forEach(t.edges(),(function(r){var n=t.edge(r);n.minlen*=2,"c"!==n.labelpos.toLowerCase()&&("TB"===e.rankdir||"BT"===e.rankdir?n.width+=n.labeloffset:n.height+=n.labeloffset)}))}(t)})),e(" removeSelfEdges",(function(){!function(t){n.forEach(t.edges(),(function(e){if(e.v===e.w){var r=t.node(e.v);r.selfEdges||(r.selfEdges=[]),r.selfEdges.push({e,label:t.edge(e)}),t.removeEdge(e)}}))}(t)})),e(" acyclic",(function(){o.run(t)})),e(" nestingGraph.run",(function(){h.run(t)})),e(" rank",(function(){s(p.asNonCompoundGraph(t))})),e(" injectEdgeLabelProxies",(function(){!function(t){n.forEach(t.edges(),(function(e){var r=t.edge(e);if(r.width&&r.height){var n=t.node(e.v),o={rank:(t.node(e.w).rank-n.rank)/2+n.rank,e};p.addDummyNode(t,"edge-proxy",o,"_ep")}}))}(t)})),e(" removeEmptyRanks",(function(){d(t)})),e(" nestingGraph.cleanup",(function(){h.cleanup(t)})),e(" normalizeRanks",(function(){a(t)})),e(" assignRankMinMax",(function(){!function(t){var e=0;n.forEach(t.nodes(),(function(r){var o=t.node(r);o.borderTop&&(o.minRank=t.node(o.borderTop).rank,o.maxRank=t.node(o.borderBottom).rank,e=n.max(e,o.maxRank))})),t.graph().maxRank=e}(t)})),e(" removeEdgeLabelProxies",(function(){!function(t){n.forEach(t.nodes(),(function(e){var r=t.node(e);"edge-proxy"===r.dummy&&(t.edge(r.e).labelRank=r.rank,t.removeNode(e))}))}(t)})),e(" normalize.run",(function(){i.run(t)})),e(" parentDummyChains",(function(){u(t)})),e(" addBorderSegments",(function(){c(t)})),e(" order",(function(){f(t)})),e(" insertSelfEdges",(function(){!function(t){var e=p.buildLayerMatrix(t);n.forEach(e,(function(e){var r=0;n.forEach(e,(function(e,o){var i=t.node(e);i.order=o+r,n.forEach(i.selfEdges,(function(e){p.addDummyNode(t,"selfedge",{width:e.label.width,height:e.label.height,rank:i.rank,order:o+ ++r,e:e.e,label:e.label},"_se")})),delete i.selfEdges}))}))}(t)})),e(" adjustCoordinateSystem",(function(){l.adjust(t)})),e(" position",(function(){g(t)})),e(" positionSelfEdges",(function(){!function(t){n.forEach(t.nodes(),(function(e){var r=t.node(e);if("selfedge"===r.dummy){var n=t.node(r.e.v),o=n.x+n.width/2,i=n.y,s=r.x-o,a=n.height/2;t.setEdge(r.e,r.label),t.removeNode(e),r.label.points=[{x:o+2*s/3,y:i-a},{x:o+5*s/6,y:i-a},{x:o+s,y:i},{x:o+5*s/6,y:i+a},{x:o+2*s/3,y:i+a}],r.label.x=r.x,r.label.y=r.y}}))}(t)})),e(" removeBorderNodes",(function(){!function(t){n.forEach(t.nodes(),(function(e){if(t.children(e).length){var r=t.node(e),o=t.node(r.borderTop),i=t.node(r.borderBottom),s=t.node(n.last(r.borderLeft)),a=t.node(n.last(r.borderRight));r.width=Math.abs(a.x-s.x),r.height=Math.abs(i.y-o.y),r.x=s.x+r.width/2,r.y=o.y+r.height/2}})),n.forEach(t.nodes(),(function(e){"border"===t.node(e).dummy&&t.removeNode(e)}))}(t)})),e(" normalize.undo",(function(){i.undo(t)})),e(" fixupEdgeLabelCoords",(function(){!function(t){n.forEach(t.edges(),(function(e){var r=t.edge(e);if(n.has(r,"x"))switch("l"!==r.labelpos&&"r"!==r.labelpos||(r.width-=r.labeloffset),r.labelpos){case"l":r.x-=r.width/2+r.labeloffset;break;case"r":r.x+=r.width/2+r.labeloffset}}))}(t)})),e(" undoCoordinateSystem",(function(){l.undo(t)})),e(" translateGraph",(function(){!function(t){var e=Number.POSITIVE_INFINITY,r=0,o=Number.POSITIVE_INFINITY,i=0,s=t.graph(),a=s.marginx||0,u=s.marginy||0;function d(t){var n=t.x,s=t.y,a=t.width,u=t.height;e=Math.min(e,n-a/2),r=Math.max(r,n+a/2),o=Math.min(o,s-u/2),i=Math.max(i,s+u/2)}n.forEach(t.nodes(),(function(e){d(t.node(e))})),n.forEach(t.edges(),(function(e){var r=t.edge(e);n.has(r,"x")&&d(r)})),e-=a,o-=u,n.forEach(t.nodes(),(function(r){var n=t.node(r);n.x-=e,n.y-=o})),n.forEach(t.edges(),(function(r){var i=t.edge(r);n.forEach(i.points,(function(t){t.x-=e,t.y-=o})),n.has(i,"x")&&(i.x-=e),n.has(i,"y")&&(i.y-=o)})),s.width=r-e+a,s.height=i-o+u}(t)})),e(" assignNodeIntersects",(function(){!function(t){n.forEach(t.edges(),(function(e){var r,n,o=t.edge(e),i=t.node(e.v),s=t.node(e.w);o.points?(r=o.points[0],n=o.points[o.points.length-1]):(o.points=[],r=s,n=i),o.points.unshift(p.intersectRect(i,r)),o.points.push(p.intersectRect(s,n))}))}(t)})),e(" reversePoints",(function(){!function(t){n.forEach(t.edges(),(function(e){var r=t.edge(e);r.reversed&&r.points.reverse()}))}(t)})),e(" acyclic.undo",(function(){o.undo(t)}))}(e,r)})),r(" updateInputGraph",(function(){!function(t,e){n.forEach(t.nodes(),(function(r){var n=t.node(r),o=e.node(r);n&&(n.x=o.x,n.y=o.y,e.children(r).length&&(n.width=o.width,n.height=o.height))})),n.forEach(t.edges(),(function(r){var o=t.edge(r),i=e.edge(r);o.points=i.points,n.has(i,"x")&&(o.x=i.x,o.y=i.y)})),t.graph().width=e.graph().width,t.graph().height=e.graph().height}(t,e)}))}))};var y=["nodesep","edgesep","ranksep","marginx","marginy"],m={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},w=["acyclicer","ranker","rankdir","align"],x=["width","height"],b={width:0,height:0},E=["minlen","weight","width","height","labeloffset"],N={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},_=["labelpos"];function M(t,e){return n.mapValues(n.pick(t,e),Number)}function k(t){var e={};return n.forEach(t,(function(t,r){e[r.toLowerCase()]=t})),e}},2692:(t,e,r)=>{var n;try{n={cloneDeep:r(7179),constant:r(9203),defaults:r(3821),each:r(678),filter:r(4663),find:r(6969),flatten:r(2923),forEach:r(7734),forIn:r(7514),has:r(5346),isUndefined:r(6474),last:r(7875),map:r(9107),mapValues:r(1230),max:r(6492),merge:r(8469),min:r(5071),minBy:r(6838),now:r(231),pick:r(9335),range:r(8569),reduce:r(7682),sortBy:r(1635),uniqueId:r(1422),values:r(1682),zipObject:r(4142)}}catch(t){}n||(n=window._),t.exports=n},838:(t,e,r)=>{var n=r(2692),o=r(345);function i(t,e,r,s,a,u,d){var h=t.children(d);if(h.length){var c=o.addBorderNode(t,"_bt"),l=o.addBorderNode(t,"_bb"),f=t.node(d);t.setParent(c,d),f.borderTop=c,t.setParent(l,d),f.borderBottom=l,n.forEach(h,(function(n){i(t,e,r,s,a,u,n);var o=t.node(n),h=o.borderTop?o.borderTop:n,f=o.borderBottom?o.borderBottom:n,g=o.borderTop?s:2*s,p=h!==f?1:a-u[d]+1;t.setEdge(c,h,{weight:g,minlen:p,nestingEdge:!0}),t.setEdge(f,l,{weight:g,minlen:p,nestingEdge:!0})})),t.parent(d)||t.setEdge(e,c,{weight:0,minlen:a+u[d]})}else d!==e&&t.setEdge(e,d,{weight:0,minlen:r})}t.exports={run:function(t){var e=o.addDummyNode(t,"root",{},"_root"),r=function(t){var e={};function r(o,i){var s=t.children(o);s&&s.length&&n.forEach(s,(function(t){r(t,i+1)})),e[o]=i}return n.forEach(t.children(),(function(t){r(t,1)})),e}(t),s=n.max(n.values(r))-1,a=2*s+1;t.graph().nestingRoot=e,n.forEach(t.edges(),(function(e){t.edge(e).minlen*=a}));var u=function(t){return n.reduce(t.edges(),(function(e,r){return e+t.edge(r).weight}),0)}(t)+1;n.forEach(t.children(),(function(n){i(t,e,a,u,s,r,n)})),t.graph().nodeRankFactor=a},cleanup:function(t){var e=t.graph();t.removeNode(e.nestingRoot),delete e.nestingRoot,n.forEach(t.edges(),(function(e){t.edge(e).nestingEdge&&t.removeEdge(e)}))}}},4125:(t,e,r)=>{"use strict";var n=r(2692),o=r(345);t.exports={run:function(t){t.graph().dummyChains=[],n.forEach(t.edges(),(function(e){!function(t,e){var r,n,i,s=e.v,a=t.node(s).rank,u=e.w,d=t.node(u).rank,h=e.name,c=t.edge(e),l=c.labelRank;if(d!==a+1){for(t.removeEdge(e),i=0,++a;a<d;++i,++a)c.points=[],n={width:0,height:0,edgeLabel:c,edgeObj:e,rank:a},r=o.addDummyNode(t,"edge",n,"_d"),a===l&&(n.width=c.width,n.height=c.height,n.dummy="edge-label",n.labelpos=c.labelpos),t.setEdge(s,r,{weight:c.weight},h),0===i&&t.graph().dummyChains.push(r),s=r;t.setEdge(s,u,{weight:c.weight},h)}}(t,e)}))},undo:function(t){n.forEach(t.graph().dummyChains,(function(e){var r,n=t.node(e),o=n.edgeLabel;for(t.setEdge(n.edgeObj,o);n.dummy;)r=t.successors(e)[0],t.removeNode(e),o.points.push({x:n.x,y:n.y}),"edge-label"===n.dummy&&(o.x=n.x,o.y=n.y,o.width=n.width,o.height=n.height),e=r,n=t.node(e)}))}}},4333:(t,e,r)=>{var n=r(2692);t.exports=function(t,e,r){var o,i={};n.forEach(r,(function(r){for(var n,s,a=t.parent(r);a;){if((n=t.parent(a))?(s=i[n],i[n]=a):(s=o,o=a),s&&s!==a)return void e.setEdge(s,a);a=n}}))}},5374:(t,e,r)=>{var n=r(2692);t.exports=function(t,e){return n.map(e,(function(e){var r=t.inEdges(e);if(r.length){var o=n.reduce(r,(function(e,r){var n=t.edge(r),o=t.node(r.v);return{sum:e.sum+n.weight*o.order,weight:e.weight+n.weight}}),{sum:0,weight:0});return{v:e,barycenter:o.sum/o.weight,weight:o.weight}}return{v:e}}))}},3037:(t,e,r)=>{var n=r(2692),o=r(1943).Graph;t.exports=function(t,e,r){var i=function(t){for(var e;t.hasNode(e=n.uniqueId("_root")););return e}(t),s=new o({compound:!0}).setGraph({root:i}).setDefaultNodeLabel((function(e){return t.node(e)}));return n.forEach(t.nodes(),(function(o){var a=t.node(o),u=t.parent(o);(a.rank===e||a.minRank<=e&&e<=a.maxRank)&&(s.setNode(o),s.setParent(o,u||i),n.forEach(t[r](o),(function(e){var r=e.v===o?e.w:e.v,i=s.edge(r,o),a=n.isUndefined(i)?0:i.weight;s.setEdge(r,o,{weight:t.edge(e).weight+a})})),n.has(a,"minRank")&&s.setNode(o,{borderLeft:a.borderLeft[e],borderRight:a.borderRight[e]}))})),s}},9420:(t,e,r)=>{"use strict";var n=r(2692);function o(t,e,r){for(var o=n.zipObject(r,n.map(r,(function(t,e){return e}))),i=n.flatten(n.map(e,(function(e){return n.sortBy(n.map(t.outEdges(e),(function(e){return{pos:o[e.w],weight:t.edge(e).weight}})),"pos")})),!0),s=1;s<r.length;)s<<=1;var a=2*s-1;s-=1;var u=n.map(new Array(a),(function(){return 0})),d=0;return n.forEach(i.forEach((function(t){var e=t.pos+s;u[e]+=t.weight;for(var r=0;e>0;)e%2&&(r+=u[e+1]),u[e=e-1>>1]+=t.weight;d+=t.weight*r}))),d}t.exports=function(t,e){for(var r=0,n=1;n<e.length;++n)r+=o(t,e[n-1],e[n]);return r}},6571:(t,e,r)=>{"use strict";var n=r(2692),o=r(1001),i=r(9420),s=r(7407),a=r(3037),u=r(4333),d=r(1943).Graph,h=r(345);function c(t,e,r){return n.map(e,(function(e){return a(t,e,r)}))}function l(t,e){var r=new d;n.forEach(t,(function(t){var o=t.graph().root,i=s(t,o,r,e);n.forEach(i.vs,(function(e,r){t.node(e).order=r})),u(t,r,i.vs)}))}function f(t,e){n.forEach(e,(function(e){n.forEach(e,(function(e,r){t.node(e).order=r}))}))}t.exports=function(t){var e=h.maxRank(t),r=c(t,n.range(1,e+1),"inEdges"),s=c(t,n.range(e-1,-1,-1),"outEdges"),a=o(t);f(t,a);for(var u,d=Number.POSITIVE_INFINITY,g=0,p=0;p<4;++g,++p){l(g%2?r:s,g%4>=2),a=h.buildLayerMatrix(t);var v=i(t,a);v<d&&(p=0,u=n.cloneDeep(a),d=v)}f(t,u)}},1001:(t,e,r)=>{"use strict";var n=r(2692);t.exports=function(t){var e={},r=n.filter(t.nodes(),(function(e){return!t.children(e).length})),o=n.max(n.map(r,(function(e){return t.node(e).rank}))),i=n.map(n.range(o+1),(function(){return[]})),s=n.sortBy(r,(function(e){return t.node(e).rank}));return n.forEach(s,(function r(o){if(!n.has(e,o)){e[o]=!0;var s=t.node(o);i[s.rank].push(o),n.forEach(t.successors(o),r)}})),i}},8522:(t,e,r)=>{"use strict";var n=r(2692);t.exports=function(t,e){var r={};return n.forEach(t,(function(t,e){var o=r[t.v]={indegree:0,in:[],out:[],vs:[t.v],i:e};n.isUndefined(t.barycenter)||(o.barycenter=t.barycenter,o.weight=t.weight)})),n.forEach(e.edges(),(function(t){var e=r[t.v],o=r[t.w];n.isUndefined(e)||n.isUndefined(o)||(o.indegree++,e.out.push(r[t.w]))})),function(t){var e=[];function r(t){return function(e){var r,o,i,s;e.merged||(n.isUndefined(e.barycenter)||n.isUndefined(t.barycenter)||e.barycenter>=t.barycenter)&&(o=e,i=0,s=0,(r=t).weight&&(i+=r.barycenter*r.weight,s+=r.weight),o.weight&&(i+=o.barycenter*o.weight,s+=o.weight),r.vs=o.vs.concat(r.vs),r.barycenter=i/s,r.weight=s,r.i=Math.min(o.i,r.i),o.merged=!0)}}function o(e){return function(r){r.in.push(e),0==--r.indegree&&t.push(r)}}for(;t.length;){var i=t.pop();e.push(i),n.forEach(i.in.reverse(),r(i)),n.forEach(i.out,o(i))}return n.map(n.filter(e,(function(t){return!t.merged})),(function(t){return n.pick(t,["vs","i","barycenter","weight"])}))}(n.filter(r,(function(t){return!t.indegree})))}},7407:(t,e,r)=>{var n=r(2692),o=r(5374),i=r(8522),s=r(2711);t.exports=function t(e,r,a,u){var d=e.children(r),h=e.node(r),c=h?h.borderLeft:void 0,l=h?h.borderRight:void 0,f={};c&&(d=n.filter(d,(function(t){return t!==c&&t!==l})));var g=o(e,d);n.forEach(g,(function(r){if(e.children(r.v).length){var o=t(e,r.v,a,u);f[r.v]=o,n.has(o,"barycenter")&&(i=r,s=o,n.isUndefined(i.barycenter)?(i.barycenter=s.barycenter,i.weight=s.weight):(i.barycenter=(i.barycenter*i.weight+s.barycenter*s.weight)/(i.weight+s.weight),i.weight+=s.weight))}var i,s}));var p=i(g,a);!function(t,e){n.forEach(t,(function(t){t.vs=n.flatten(t.vs.map((function(t){return e[t]?e[t].vs:t})),!0)}))}(p,f);var v=s(p,u);if(c&&(v.vs=n.flatten([c,v.vs,l],!0),e.predecessors(c).length)){var y=e.node(e.predecessors(c)[0]),m=e.node(e.predecessors(l)[0]);n.has(v,"barycenter")||(v.barycenter=0,v.weight=0),v.barycenter=(v.barycenter*v.weight+y.order+m.order)/(v.weight+2),v.weight+=2}return v}},2711:(t,e,r)=>{var n=r(2692),o=r(345);function i(t,e,r){for(var o;e.length&&(o=n.last(e)).i<=r;)e.pop(),t.push(o.vs),r++;return r}t.exports=function(t,e){var r,s=o.partition(t,(function(t){return n.has(t,"barycenter")})),a=s.lhs,u=n.sortBy(s.rhs,(function(t){return-t.i})),d=[],h=0,c=0,l=0;a.sort((r=!!e,function(t,e){return t.barycenter<e.barycenter?-1:t.barycenter>e.barycenter?1:r?e.i-t.i:t.i-e.i})),l=i(d,u,l),n.forEach(a,(function(t){l+=t.vs.length,d.push(t.vs),h+=t.barycenter*t.weight,c+=t.weight,l=i(d,u,l)}));var f={vs:n.flatten(d,!0)};return c&&(f.barycenter=h/c,f.weight=c),f}},2555:(t,e,r)=>{var n=r(2692);t.exports=function(t){var e=function(t){var e={},r=0;return n.forEach(t.children(),(function o(i){var s=r;n.forEach(t.children(i),o),e[i]={low:s,lim:r++}})),e}(t);n.forEach(t.graph().dummyChains,(function(r){for(var n=t.node(r),o=n.edgeObj,i=function(t,e,r,n){var o,i,s=[],a=[],u=Math.min(e[r].low,e[n].low),d=Math.max(e[r].lim,e[n].lim);o=r;do{o=t.parent(o),s.push(o)}while(o&&(e[o].low>u||d>e[o].lim));for(i=o,o=n;(o=t.parent(o))!==i;)a.push(o);return{path:s.concat(a.reverse()),lca:i}}(t,e,o.v,o.w),s=i.path,a=i.lca,u=0,d=s[u],h=!0;r!==o.w;){if(n=t.node(r),h){for(;(d=s[u])!==a&&t.node(d).maxRank<n.rank;)u++;d===a&&(h=!1)}if(!h){for(;u<s.length-1&&t.node(d=s[u+1]).minRank<=n.rank;)u++;d=s[u]}t.setParent(r,d),r=t.successors(r)[0]}}))}},7828:(t,e,r)=>{"use strict";var n=r(2692),o=r(1943).Graph,i=r(345);function s(t,e){var r={};return n.reduce(e,(function(e,o){var i=0,s=0,a=e.length,d=n.last(o);return n.forEach(o,(function(e,h){var c=function(t,e){if(t.node(e).dummy)return n.find(t.predecessors(e),(function(e){return t.node(e).dummy}))}(t,e),l=c?t.node(c).order:a;(c||e===d)&&(n.forEach(o.slice(s,h+1),(function(e){n.forEach(t.predecessors(e),(function(n){var o=t.node(n),s=o.order;!(s<i||l<s)||o.dummy&&t.node(e).dummy||u(r,n,e)}))})),s=h+1,i=l)})),o})),r}function a(t,e){var r={};function o(e,o,i,s,a){var d;n.forEach(n.range(o,i),(function(o){d=e[o],t.node(d).dummy&&n.forEach(t.predecessors(d),(function(e){var n=t.node(e);n.dummy&&(n.order<s||n.order>a)&&u(r,e,d)}))}))}return n.reduce(e,(function(e,r){var i,s=-1,a=0;return n.forEach(r,(function(n,u){if("border"===t.node(n).dummy){var d=t.predecessors(n);d.length&&(i=t.node(d[0]).order,o(r,a,u,s,i),a=u,s=i)}o(r,a,r.length,i,e.length)})),r})),r}function u(t,e,r){if(e>r){var n=e;e=r,r=n}var o=t[e];o||(t[e]=o={}),o[r]=!0}function d(t,e,r){if(e>r){var o=e;e=r,r=o}return n.has(t[e],r)}function h(t,e,r,o){var i={},s={},a={};return n.forEach(e,(function(t){n.forEach(t,(function(t,e){i[t]=t,s[t]=t,a[t]=e}))})),n.forEach(e,(function(t){var e=-1;n.forEach(t,(function(t){var u=o(t);if(u.length){u=n.sortBy(u,(function(t){return a[t]}));for(var h=(u.length-1)/2,c=Math.floor(h),l=Math.ceil(h);c<=l;++c){var f=u[c];s[t]===t&&e<a[f]&&!d(r,t,f)&&(s[f]=t,s[t]=i[t]=i[f],e=a[f])}}}))})),{root:i,align:s}}function c(t,e,r,i,s){var a={},u=function(t,e,r,i){var s=new o,a=t.graph(),u=function(t,e,r){return function(o,i,s){var a,u=o.node(i),d=o.node(s),h=0;if(h+=u.width/2,n.has(u,"labelpos"))switch(u.labelpos.toLowerCase()){case"l":a=-u.width/2;break;case"r":a=u.width/2}if(a&&(h+=r?a:-a),a=0,h+=(u.dummy?e:t)/2,h+=(d.dummy?e:t)/2,h+=d.width/2,n.has(d,"labelpos"))switch(d.labelpos.toLowerCase()){case"l":a=d.width/2;break;case"r":a=-d.width/2}return a&&(h+=r?a:-a),a=0,h}}(a.nodesep,a.edgesep,i);return n.forEach(e,(function(e){var o;n.forEach(e,(function(e){var n=r[e];if(s.setNode(n),o){var i=r[o],a=s.edge(i,n);s.setEdge(i,n,Math.max(u(t,e,o),a||0))}o=e}))})),s}(t,e,r,s),d=s?"borderLeft":"borderRight";function h(t,e){for(var r=u.nodes(),n=r.pop(),o={};n;)o[n]?t(n):(o[n]=!0,r.push(n),r=r.concat(e(n))),n=r.pop()}return h((function(t){a[t]=u.inEdges(t).reduce((function(t,e){return Math.max(t,a[e.v]+u.edge(e))}),0)}),u.predecessors.bind(u)),h((function(e){var r=u.outEdges(e).reduce((function(t,e){return Math.min(t,a[e.w]-u.edge(e))}),Number.POSITIVE_INFINITY),n=t.node(e);r!==Number.POSITIVE_INFINITY&&n.borderType!==d&&(a[e]=Math.max(a[e],r))}),u.successors.bind(u)),n.forEach(i,(function(t){a[t]=a[r[t]]})),a}function l(t,e){return n.minBy(n.values(e),(function(e){var r=Number.NEGATIVE_INFINITY,o=Number.POSITIVE_INFINITY;return n.forIn(e,(function(e,n){var i=function(t,e){return t.node(e).width}(t,n)/2;r=Math.max(e+i,r),o=Math.min(e-i,o)})),r-o}))}function f(t,e){var r=n.values(e),o=n.min(r),i=n.max(r);n.forEach(["u","d"],(function(r){n.forEach(["l","r"],(function(s){var a,u=r+s,d=t[u];if(d!==e){var h=n.values(d);(a="l"===s?o-n.min(h):i-n.max(h))&&(t[u]=n.mapValues(d,(function(t){return t+a})))}}))}))}function g(t,e){return n.mapValues(t.ul,(function(r,o){if(e)return t[e.toLowerCase()][o];var i=n.sortBy(n.map(t,o));return(i[1]+i[2])/2}))}t.exports={positionX:function(t){var e,r=i.buildLayerMatrix(t),o=n.merge(s(t,r),a(t,r)),u={};n.forEach(["u","d"],(function(i){e="u"===i?r:n.values(r).reverse(),n.forEach(["l","r"],(function(r){"r"===r&&(e=n.map(e,(function(t){return n.values(t).reverse()})));var s=("u"===i?t.predecessors:t.successors).bind(t),a=h(0,e,o,s),d=c(t,e,a.root,a.align,"r"===r);"r"===r&&(d=n.mapValues(d,(function(t){return-t}))),u[i+r]=d}))}));var d=l(t,u);return f(u,d),g(u,t.graph().align)},findType1Conflicts:s,findType2Conflicts:a,addConflict:u,hasConflict:d,verticalAlignment:h,horizontalCompaction:c,alignCoordinates:f,findSmallestWidthAlignment:l,balance:g}},9533:(t,e,r)=>{"use strict";var n=r(2692),o=r(345),i=r(7828).positionX;t.exports=function(t){(function(t){var e=o.buildLayerMatrix(t),r=t.graph().ranksep,i=0;n.forEach(e,(function(e){var o=n.max(n.map(e,(function(e){return t.node(e).height})));n.forEach(e,(function(e){t.node(e).y=i+o/2})),i+=o+r}))})(t=o.asNonCompoundGraph(t)),n.forEach(i(t),(function(e,r){t.node(r).x=e}))}},6771:(t,e,r)=>{"use strict";var n=r(2692),o=r(1943).Graph,i=r(3834).slack;function s(t,e){return n.forEach(t.nodes(),(function r(o){n.forEach(e.nodeEdges(o),(function(n){var s=n.v,a=o===s?n.w:s;t.hasNode(a)||i(e,n)||(t.setNode(a,{}),t.setEdge(o,a,{}),r(a))}))})),t.nodeCount()}function a(t,e){return n.minBy(e.edges(),(function(r){if(t.hasNode(r.v)!==t.hasNode(r.w))return i(e,r)}))}function u(t,e,r){n.forEach(t.nodes(),(function(t){e.node(t).rank+=r}))}t.exports=function(t){var e,r,n=new o({directed:!1}),d=t.nodes()[0],h=t.nodeCount();for(n.setNode(d,{});s(n,t)<h;)e=a(n,t),r=n.hasNode(e.v)?i(t,e):-i(t,e),u(n,t,r);return n}},8264:(t,e,r)=>{"use strict";var n=r(3834).longestPath,o=r(6771),i=r(3284);t.exports=function(t){switch(t.graph().ranker){case"network-simplex":default:!function(t){i(t)}(t);break;case"tight-tree":!function(t){n(t),o(t)}(t);break;case"longest-path":s(t)}};var s=n},3284:(t,e,r)=>{"use strict";var n=r(2692),o=r(6771),i=r(3834).slack,s=r(3834).longestPath,a=r(1943).alg.preorder,u=r(1943).alg.postorder,d=r(345).simplify;function h(t){t=d(t),s(t);var e,r=o(t);for(f(r),c(r,t);e=p(r);)y(r,t,e,v(r,t,e))}function c(t,e){var r=u(t,t.nodes());r=r.slice(0,r.length-1),n.forEach(r,(function(r){!function(t,e,r){var n=t.node(r).parent;t.edge(r,n).cutvalue=l(t,e,r)}(t,e,r)}))}function l(t,e,r){var o=t.node(r).parent,i=!0,s=e.edge(r,o),a=0;return s||(i=!1,s=e.edge(o,r)),a=s.weight,n.forEach(e.nodeEdges(r),(function(n){var s,u,d=n.v===r,h=d?n.w:n.v;if(h!==o){var c=d===i,l=e.edge(n).weight;if(a+=c?l:-l,s=r,u=h,t.hasEdge(s,u)){var f=t.edge(r,h).cutvalue;a+=c?-f:f}}})),a}function f(t,e){arguments.length<2&&(e=t.nodes()[0]),g(t,{},1,e)}function g(t,e,r,o,i){var s=r,a=t.node(o);return e[o]=!0,n.forEach(t.neighbors(o),(function(i){n.has(e,i)||(r=g(t,e,r,i,o))})),a.low=s,a.lim=r++,i?a.parent=i:delete a.parent,r}function p(t){return n.find(t.edges(),(function(e){return t.edge(e).cutvalue<0}))}function v(t,e,r){var o=r.v,s=r.w;e.hasEdge(o,s)||(o=r.w,s=r.v);var a=t.node(o),u=t.node(s),d=a,h=!1;a.lim>u.lim&&(d=u,h=!0);var c=n.filter(e.edges(),(function(e){return h===m(0,t.node(e.v),d)&&h!==m(0,t.node(e.w),d)}));return n.minBy(c,(function(t){return i(e,t)}))}function y(t,e,r,o){var i=r.v,s=r.w;t.removeEdge(i,s),t.setEdge(o.v,o.w,{}),f(t),c(t,e),function(t,e){var r=n.find(t.nodes(),(function(t){return!e.node(t).parent})),o=a(t,r);o=o.slice(1),n.forEach(o,(function(r){var n=t.node(r).parent,o=e.edge(r,n),i=!1;o||(o=e.edge(n,r),i=!0),e.node(r).rank=e.node(n).rank+(i?o.minlen:-o.minlen)}))}(t,e)}function m(t,e,r){return r.low<=e.lim&&e.lim<=r.lim}t.exports=h,h.initLowLimValues=f,h.initCutValues=c,h.calcCutValue=l,h.leaveEdge=p,h.enterEdge=v,h.exchangeEdges=y},3834:(t,e,r)=>{"use strict";var n=r(2692);t.exports={longestPath:function(t){var e={};n.forEach(t.sources(),(function r(o){var i=t.node(o);if(n.has(e,o))return i.rank;e[o]=!0;var s=n.min(n.map(t.outEdges(o),(function(e){return r(e.w)-t.edge(e).minlen})));return s!==Number.POSITIVE_INFINITY&&null!=s||(s=0),i.rank=s}))},slack:function(t,e){return t.node(e.w).rank-t.node(e.v).rank-t.edge(e).minlen}}},345:(t,e,r)=>{"use strict";var n=r(2692),o=r(1943).Graph;function i(t,e,r,o){var i;do{i=n.uniqueId(o)}while(t.hasNode(i));return r.dummy=e,t.setNode(i,r),i}function s(t){return n.max(n.map(t.nodes(),(function(e){var r=t.node(e).rank;if(!n.isUndefined(r))return r})))}t.exports={addDummyNode:i,simplify:function(t){var e=(new o).setGraph(t.graph());return n.forEach(t.nodes(),(function(r){e.setNode(r,t.node(r))})),n.forEach(t.edges(),(function(r){var n=e.edge(r.v,r.w)||{weight:0,minlen:1},o=t.edge(r);e.setEdge(r.v,r.w,{weight:n.weight+o.weight,minlen:Math.max(n.minlen,o.minlen)})})),e},asNonCompoundGraph:function(t){var e=new o({multigraph:t.isMultigraph()}).setGraph(t.graph());return n.forEach(t.nodes(),(function(r){t.children(r).length||e.setNode(r,t.node(r))})),n.forEach(t.edges(),(function(r){e.setEdge(r,t.edge(r))})),e},successorWeights:function(t){var e=n.map(t.nodes(),(function(e){var r={};return n.forEach(t.outEdges(e),(function(e){r[e.w]=(r[e.w]||0)+t.edge(e).weight})),r}));return n.zipObject(t.nodes(),e)},predecessorWeights:function(t){var e=n.map(t.nodes(),(function(e){var r={};return n.forEach(t.inEdges(e),(function(e){r[e.v]=(r[e.v]||0)+t.edge(e).weight})),r}));return n.zipObject(t.nodes(),e)},intersectRect:function(t,e){var r,n,o=t.x,i=t.y,s=e.x-o,a=e.y-i,u=t.width/2,d=t.height/2;if(!s&&!a)throw new Error("Not possible to find intersection inside of the rectangle");return Math.abs(a)*u>Math.abs(s)*d?(a<0&&(d=-d),r=d*s/a,n=d):(s<0&&(u=-u),r=u,n=u*a/s),{x:o+r,y:i+n}},buildLayerMatrix:function(t){var e=n.map(n.range(s(t)+1),(function(){return[]}));return n.forEach(t.nodes(),(function(r){var o=t.node(r),i=o.rank;n.isUndefined(i)||(e[i][o.order]=r)})),e},normalizeRanks:function(t){var e=n.min(n.map(t.nodes(),(function(e){return t.node(e).rank})));n.forEach(t.nodes(),(function(r){var o=t.node(r);n.has(o,"rank")&&(o.rank-=e)}))},removeEmptyRanks:function(t){var e=n.min(n.map(t.nodes(),(function(e){return t.node(e).rank}))),r=[];n.forEach(t.nodes(),(function(n){var o=t.node(n).rank-e;r[o]||(r[o]=[]),r[o].push(n)}));var o=0,i=t.graph().nodeRankFactor;n.forEach(r,(function(e,r){n.isUndefined(e)&&r%i!=0?--o:o&&n.forEach(e,(function(e){t.node(e).rank+=o}))}))},addBorderNode:function(t,e,r,n){var o={width:0,height:0};return arguments.length>=4&&(o.rank=r,o.order=n),i(t,"border",o,e)},maxRank:s,partition:function(t,e){var r={lhs:[],rhs:[]};return n.forEach(t,(function(t){e(t)?r.lhs.push(t):r.rhs.push(t)})),r},time:function(t,e){var r=n.now();try{return e()}finally{console.log(t+" time: "+(n.now()-r)+"ms")}},notime:function(t,e){return e()}}},3404:t=>{t.exports="0.8.5"},6960:(t,e,r)=>{var n=r(3150);t.exports={Graph:n.Graph,json:r(1430),alg:r(9757),version:n.version}},9535:(t,e,r)=>{var n=r(4434);t.exports=function(t){var e,r={},o=[];function i(o){n.has(r,o)||(r[o]=!0,e.push(o),n.each(t.successors(o),i),n.each(t.predecessors(o),i))}return n.each(t.nodes(),(function(t){e=[],i(t),e.length&&o.push(e)})),o}},7819:(t,e,r)=>{var n=r(4434);function o(t,e,r,i,s,a){n.has(i,e)||(i[e]=!0,r||a.push(e),n.each(s(e),(function(e){o(t,e,r,i,s,a)})),r&&a.push(e))}t.exports=function(t,e,r){n.isArray(e)||(e=[e]);var i=(t.isDirected()?t.successors:t.neighbors).bind(t),s=[],a={};return n.each(e,(function(e){if(!t.hasNode(e))throw new Error("Graph does not have node: "+e);o(t,e,"post"===r,a,i,s)})),s}},1353:(t,e,r)=>{var n=r(4245),o=r(4434);t.exports=function(t,e,r){return o.transform(t.nodes(),(function(o,i){o[i]=n(t,i,e,r)}),{})}},4245:(t,e,r)=>{var n=r(4434),o=r(1011);t.exports=function(t,e,r,n){return function(t,e,r,n){var i,s,a={},u=new o,d=function(t){var e=t.v!==i?t.v:t.w,n=a[e],o=r(t),d=s.distance+o;if(o<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+t+" Weight: "+o);d<n.distance&&(n.distance=d,n.predecessor=i,u.decrease(e,d))};for(t.nodes().forEach((function(t){var r=t===e?0:Number.POSITIVE_INFINITY;a[t]={distance:r},u.add(t,r)}));u.size()>0&&(i=u.removeMin(),(s=a[i]).distance!==Number.POSITIVE_INFINITY);)n(i).forEach(d);return a}(t,String(e),r||i,n||function(e){return t.outEdges(e)})};var i=n.constant(1)},937:(t,e,r)=>{var n=r(4434),o=r(9177);t.exports=function(t){return n.filter(o(t),(function(e){return e.length>1||1===e.length&&t.hasEdge(e[0],e[0])}))}},86:(t,e,r)=>{var n=r(4434);t.exports=function(t,e,r){return function(t,e,r){var n={},o=t.nodes();return o.forEach((function(t){n[t]={},n[t][t]={distance:0},o.forEach((function(e){t!==e&&(n[t][e]={distance:Number.POSITIVE_INFINITY})})),r(t).forEach((function(r){var o=r.v===t?r.w:r.v,i=e(r);n[t][o]={distance:i,predecessor:t}}))})),o.forEach((function(t){var e=n[t];o.forEach((function(r){var i=n[r];o.forEach((function(r){var n=i[t],o=e[r],s=i[r],a=n.distance+o.distance;a<s.distance&&(s.distance=a,s.predecessor=o.predecessor)}))}))})),n}(t,e||o,r||function(e){return t.outEdges(e)})};var o=n.constant(1)},9757:(t,e,r)=>{t.exports={components:r(9535),dijkstra:r(4245),dijkstraAll:r(1353),findCycles:r(937),floydWarshall:r(86),isAcyclic:r(7772),postorder:r(8494),preorder:r(101),prim:r(3816),tarjan:r(9177),topsort:r(750)}},7772:(t,e,r)=>{var n=r(750);t.exports=function(t){try{n(t)}catch(t){if(t instanceof n.CycleException)return!1;throw t}return!0}},8494:(t,e,r)=>{var n=r(7819);t.exports=function(t,e){return n(t,e,"post")}},101:(t,e,r)=>{var n=r(7819);t.exports=function(t,e){return n(t,e,"pre")}},3816:(t,e,r)=>{var n=r(4434),o=r(9955),i=r(1011);t.exports=function(t,e){var r,s=new o,a={},u=new i;function d(t){var n=t.v===r?t.w:t.v,o=u.priority(n);if(void 0!==o){var i=e(t);i<o&&(a[n]=r,u.decrease(n,i))}}if(0===t.nodeCount())return s;n.each(t.nodes(),(function(t){u.add(t,Number.POSITIVE_INFINITY),s.setNode(t)})),u.decrease(t.nodes()[0],0);for(var h=!1;u.size()>0;){if(r=u.removeMin(),n.has(a,r))s.setEdge(r,a[r]);else{if(h)throw new Error("Input graph is not connected: "+t);h=!0}t.nodeEdges(r).forEach(d)}return s}},9177:(t,e,r)=>{var n=r(4434);t.exports=function(t){var e=0,r=[],o={},i=[];function s(a){var u=o[a]={onStack:!0,lowlink:e,index:e++};if(r.push(a),t.successors(a).forEach((function(t){n.has(o,t)?o[t].onStack&&(u.lowlink=Math.min(u.lowlink,o[t].index)):(s(t),u.lowlink=Math.min(u.lowlink,o[t].lowlink))})),u.lowlink===u.index){var d,h=[];do{d=r.pop(),o[d].onStack=!1,h.push(d)}while(a!==d);i.push(h)}}return t.nodes().forEach((function(t){n.has(o,t)||s(t)})),i}},750:(t,e,r)=>{var n=r(4434);function o(t){var e={},r={},o=[];if(n.each(t.sinks(),(function s(a){if(n.has(r,a))throw new i;n.has(e,a)||(r[a]=!0,e[a]=!0,n.each(t.predecessors(a),s),delete r[a],o.push(a))})),n.size(e)!==t.nodeCount())throw new i;return o}function i(){}t.exports=o,o.CycleException=i,i.prototype=new Error},1011:(t,e,r)=>{var n=r(4434);function o(){this._arr=[],this._keyIndices={}}t.exports=o,o.prototype.size=function(){return this._arr.length},o.prototype.keys=function(){return this._arr.map((function(t){return t.key}))},o.prototype.has=function(t){return n.has(this._keyIndices,t)},o.prototype.priority=function(t){var e=this._keyIndices[t];if(void 0!==e)return this._arr[e].priority},o.prototype.min=function(){if(0===this.size())throw new Error("Queue underflow");return this._arr[0].key},o.prototype.add=function(t,e){var r=this._keyIndices;if(t=String(t),!n.has(r,t)){var o=this._arr,i=o.length;return r[t]=i,o.push({key:t,priority:e}),this._decrease(i),!0}return!1},o.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var t=this._arr.pop();return delete this._keyIndices[t.key],this._heapify(0),t.key},o.prototype.decrease=function(t,e){var r=this._keyIndices[t];if(e>this._arr[r].priority)throw new Error("New priority is greater than current priority. Key: "+t+" Old: "+this._arr[r].priority+" New: "+e);this._arr[r].priority=e,this._decrease(r)},o.prototype._heapify=function(t){var e=this._arr,r=2*t,n=r+1,o=t;r<e.length&&(o=e[r].priority<e[o].priority?r:o,n<e.length&&(o=e[n].priority<e[o].priority?n:o),o!==t&&(this._swap(t,o),this._heapify(o)))},o.prototype._decrease=function(t){for(var e,r=this._arr,n=r[t].priority;0!==t&&!(r[e=t>>1].priority<n);)this._swap(t,e),t=e},o.prototype._swap=function(t,e){var r=this._arr,n=this._keyIndices,o=r[t],i=r[e];r[t]=i,r[e]=o,n[i.key]=t,n[o.key]=e}},9955:(t,e,r)=>{"use strict";var n=r(4434);t.exports=i;var o="\\0";function i(t){this._isDirected=!n.has(t,"directed")||t.directed,this._isMultigraph=!!n.has(t,"multigraph")&&t.multigraph,this._isCompound=!!n.has(t,"compound")&&t.compound,this._label=void 0,this._defaultNodeLabelFn=n.constant(void 0),this._defaultEdgeLabelFn=n.constant(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[o]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}function s(t,e){t[e]?t[e]++:t[e]=1}function a(t,e){--t[e]||delete t[e]}function u(t,e,r,o){var i=""+e,s=""+r;if(!t&&i>s){var a=i;i=s,s=a}return i+""+s+""+(n.isUndefined(o)?"\\0":o)}function d(t,e){return u(t,e.v,e.w,e.name)}i.prototype._nodeCount=0,i.prototype._edgeCount=0,i.prototype.isDirected=function(){return this._isDirected},i.prototype.isMultigraph=function(){return this._isMultigraph},i.prototype.isCompound=function(){return this._isCompound},i.prototype.setGraph=function(t){return this._label=t,this},i.prototype.graph=function(){return this._label},i.prototype.setDefaultNodeLabel=function(t){return n.isFunction(t)||(t=n.constant(t)),this._defaultNodeLabelFn=t,this},i.prototype.nodeCount=function(){return this._nodeCount},i.prototype.nodes=function(){return n.keys(this._nodes)},i.prototype.sources=function(){var t=this;return n.filter(this.nodes(),(function(e){return n.isEmpty(t._in[e])}))},i.prototype.sinks=function(){var t=this;return n.filter(this.nodes(),(function(e){return n.isEmpty(t._out[e])}))},i.prototype.setNodes=function(t,e){var r=arguments,o=this;return n.each(t,(function(t){r.length>1?o.setNode(t,e):o.setNode(t)})),this},i.prototype.setNode=function(t,e){return n.has(this._nodes,t)?(arguments.length>1&&(this._nodes[t]=e),this):(this._nodes[t]=arguments.length>1?e:this._defaultNodeLabelFn(t),this._isCompound&&(this._parent[t]=o,this._children[t]={},this._children[o][t]=!0),this._in[t]={},this._preds[t]={},this._out[t]={},this._sucs[t]={},++this._nodeCount,this)},i.prototype.node=function(t){return this._nodes[t]},i.prototype.hasNode=function(t){return n.has(this._nodes,t)},i.prototype.removeNode=function(t){var e=this;if(n.has(this._nodes,t)){var r=function(t){e.removeEdge(e._edgeObjs[t])};delete this._nodes[t],this._isCompound&&(this._removeFromParentsChildList(t),delete this._parent[t],n.each(this.children(t),(function(t){e.setParent(t)})),delete this._children[t]),n.each(n.keys(this._in[t]),r),delete this._in[t],delete this._preds[t],n.each(n.keys(this._out[t]),r),delete this._out[t],delete this._sucs[t],--this._nodeCount}return this},i.prototype.setParent=function(t,e){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(n.isUndefined(e))e=o;else{for(var r=e+="";!n.isUndefined(r);r=this.parent(r))if(r===t)throw new Error("Setting "+e+" as parent of "+t+" would create a cycle");this.setNode(e)}return this.setNode(t),this._removeFromParentsChildList(t),this._parent[t]=e,this._children[e][t]=!0,this},i.prototype._removeFromParentsChildList=function(t){delete this._children[this._parent[t]][t]},i.prototype.parent=function(t){if(this._isCompound){var e=this._parent[t];if(e!==o)return e}},i.prototype.children=function(t){if(n.isUndefined(t)&&(t=o),this._isCompound){var e=this._children[t];if(e)return n.keys(e)}else{if(t===o)return this.nodes();if(this.hasNode(t))return[]}},i.prototype.predecessors=function(t){var e=this._preds[t];if(e)return n.keys(e)},i.prototype.successors=function(t){var e=this._sucs[t];if(e)return n.keys(e)},i.prototype.neighbors=function(t){var e=this.predecessors(t);if(e)return n.union(e,this.successors(t))},i.prototype.isLeaf=function(t){return 0===(this.isDirected()?this.successors(t):this.neighbors(t)).length},i.prototype.filterNodes=function(t){var e=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});e.setGraph(this.graph());var r=this;n.each(this._nodes,(function(r,n){t(n)&&e.setNode(n,r)})),n.each(this._edgeObjs,(function(t){e.hasNode(t.v)&&e.hasNode(t.w)&&e.setEdge(t,r.edge(t))}));var o={};function i(t){var n=r.parent(t);return void 0===n||e.hasNode(n)?(o[t]=n,n):n in o?o[n]:i(n)}return this._isCompound&&n.each(e.nodes(),(function(t){e.setParent(t,i(t))})),e},i.prototype.setDefaultEdgeLabel=function(t){return n.isFunction(t)||(t=n.constant(t)),this._defaultEdgeLabelFn=t,this},i.prototype.edgeCount=function(){return this._edgeCount},i.prototype.edges=function(){return n.values(this._edgeObjs)},i.prototype.setPath=function(t,e){var r=this,o=arguments;return n.reduce(t,(function(t,n){return o.length>1?r.setEdge(t,n,e):r.setEdge(t,n),n})),this},i.prototype.setEdge=function(){var t,e,r,o,i=!1,a=arguments[0];"object"==typeof a&&null!==a&&"v"in a?(t=a.v,e=a.w,r=a.name,2===arguments.length&&(o=arguments[1],i=!0)):(t=a,e=arguments[1],r=arguments[3],arguments.length>2&&(o=arguments[2],i=!0)),t=""+t,e=""+e,n.isUndefined(r)||(r=""+r);var d=u(this._isDirected,t,e,r);if(n.has(this._edgeLabels,d))return i&&(this._edgeLabels[d]=o),this;if(!n.isUndefined(r)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(t),this.setNode(e),this._edgeLabels[d]=i?o:this._defaultEdgeLabelFn(t,e,r);var h=function(t,e,r,n){var o=""+e,i=""+r;if(!t&&o>i){var s=o;o=i,i=s}var a={v:o,w:i};return n&&(a.name=n),a}(this._isDirected,t,e,r);return t=h.v,e=h.w,Object.freeze(h),this._edgeObjs[d]=h,s(this._preds[e],t),s(this._sucs[t],e),this._in[e][d]=h,this._out[t][d]=h,this._edgeCount++,this},i.prototype.edge=function(t,e,r){var n=1===arguments.length?d(this._isDirected,arguments[0]):u(this._isDirected,t,e,r);return this._edgeLabels[n]},i.prototype.hasEdge=function(t,e,r){var o=1===arguments.length?d(this._isDirected,arguments[0]):u(this._isDirected,t,e,r);return n.has(this._edgeLabels,o)},i.prototype.removeEdge=function(t,e,r){var n=1===arguments.length?d(this._isDirected,arguments[0]):u(this._isDirected,t,e,r),o=this._edgeObjs[n];return o&&(t=o.v,e=o.w,delete this._edgeLabels[n],delete this._edgeObjs[n],a(this._preds[e],t),a(this._sucs[t],e),delete this._in[e][n],delete this._out[t][n],this._edgeCount--),this},i.prototype.inEdges=function(t,e){var r=this._in[t];if(r){var o=n.values(r);return e?n.filter(o,(function(t){return t.v===e})):o}},i.prototype.outEdges=function(t,e){var r=this._out[t];if(r){var o=n.values(r);return e?n.filter(o,(function(t){return t.w===e})):o}},i.prototype.nodeEdges=function(t,e){var r=this.inEdges(t,e);if(r)return r.concat(this.outEdges(t,e))}},3150:(t,e,r)=>{t.exports={Graph:r(9955),version:r(9127)}},1430:(t,e,r)=>{var n=r(4434),o=r(9955);function i(t){return n.map(t.nodes(),(function(e){var r=t.node(e),o=t.parent(e),i={v:e};return n.isUndefined(r)||(i.value=r),n.isUndefined(o)||(i.parent=o),i}))}function s(t){return n.map(t.edges(),(function(e){var r=t.edge(e),o={v:e.v,w:e.w};return n.isUndefined(e.name)||(o.name=e.name),n.isUndefined(r)||(o.value=r),o}))}t.exports={write:function(t){var e={options:{directed:t.isDirected(),multigraph:t.isMultigraph(),compound:t.isCompound()},nodes:i(t),edges:s(t)};return n.isUndefined(t.graph())||(e.value=n.clone(t.graph())),e},read:function(t){var e=new o(t.options).setGraph(t.value);return n.each(t.nodes,(function(t){e.setNode(t.v,t.value),t.parent&&e.setParent(t.v,t.parent)})),n.each(t.edges,(function(t){e.setEdge({v:t.v,w:t.w,name:t.name},t.value)})),e}}},4434:(t,e,r)=>{var n;try{n={clone:r(7953),constant:r(9203),each:r(678),filter:r(4663),has:r(5346),isArray:r(5589),isEmpty:r(9787),isFunction:r(5563),isUndefined:r(6474),keys:r(2096),map:r(9107),reduce:r(7682),size:r(1039),transform:r(3604),union:r(7767),values:r(1682)}}catch(t){}n||(n=window._),t.exports=n},9127:t=>{t.exports="2.1.8"},4466:(t,e,r)=>{var n=r(5234)(r(3250),"DataView");t.exports=n},5208:(t,e,r)=>{var n=r(4440),o=r(4108),i=r(1085),s=r(7706),a=r(8636);function u(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}u.prototype.clear=n,u.prototype.delete=o,u.prototype.get=i,u.prototype.has=s,u.prototype.set=a,t.exports=u},1998:(t,e,r)=>{var n=r(266),o=r(2875),i=r(5828),s=r(4115),a=r(7690);function u(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}u.prototype.clear=n,u.prototype.delete=o,u.prototype.get=i,u.prototype.has=s,u.prototype.set=a,t.exports=u},2887:(t,e,r)=>{var n=r(5234)(r(3250),"Map");t.exports=n},5678:(t,e,r)=>{var n=r(9016),o=r(2363),i=r(4348),s=r(3062),a=r(262);function u(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}u.prototype.clear=n,u.prototype.delete=o,u.prototype.get=i,u.prototype.has=s,u.prototype.set=a,t.exports=u},5747:(t,e,r)=>{var n=r(5234)(r(3250),"Promise");t.exports=n},6616:(t,e,r)=>{var n=r(5234)(r(3250),"Set");t.exports=n},4546:(t,e,r)=>{var n=r(5678),o=r(3937),i=r(5009);function s(t){var e=-1,r=null==t?0:t.length;for(this.__data__=new n;++e<r;)this.add(t[e])}s.prototype.add=s.prototype.push=o,s.prototype.has=i,t.exports=s},9549:(t,e,r)=>{var n=r(1998),o=r(3210),i=r(8603),s=r(8947),a=r(885),u=r(8938);function d(t){var e=this.__data__=new n(t);this.size=e.size}d.prototype.clear=o,d.prototype.delete=i,d.prototype.get=s,d.prototype.has=a,d.prototype.set=u,t.exports=d},861:(t,e,r)=>{var n=r(3250).Symbol;t.exports=n},3526:(t,e,r)=>{var n=r(3250).Uint8Array;t.exports=n},8001:(t,e,r)=>{var n=r(5234)(r(3250),"WeakMap");t.exports=n},2274:t=>{t.exports=function(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}},4004:t=>{t.exports=function(t,e){for(var r=-1,n=null==t?0:t.length;++r<n&&!1!==e(t[r],r,t););return t}},2493:t=>{t.exports=function(t,e){for(var r=-1,n=null==t?0:t.length,o=0,i=[];++r<n;){var s=t[r];e(s,r,t)&&(i[o++]=s)}return i}},5436:(t,e,r)=>{var n=r(4365);t.exports=function(t,e){return!(null==t||!t.length)&&n(t,e,0)>-1}},9105:t=>{t.exports=function(t,e,r){for(var n=-1,o=null==t?0:t.length;++n<o;)if(r(e,t[n]))return!0;return!1}},5825:(t,e,r)=>{var n=r(8509),o=r(9312),i=r(5589),s=r(5778),a=r(5023),u=r(922),d=Object.prototype.hasOwnProperty;t.exports=function(t,e){var r=i(t),h=!r&&o(t),c=!r&&!h&&s(t),l=!r&&!h&&!c&&u(t),f=r||h||c||l,g=f?n(t.length,String):[],p=g.length;for(var v in t)!e&&!d.call(t,v)||f&&("length"==v||c&&("offset"==v||"parent"==v)||l&&("buffer"==v||"byteLength"==v||"byteOffset"==v)||a(v,p))||g.push(v);return g}},9233:t=>{t.exports=function(t,e){for(var r=-1,n=null==t?0:t.length,o=Array(n);++r<n;)o[r]=e(t[r],r,t);return o}},111:t=>{t.exports=function(t,e){for(var r=-1,n=e.length,o=t.length;++r<n;)t[o+r]=e[r];return t}},5115:t=>{t.exports=function(t,e,r,n){var o=-1,i=null==t?0:t.length;for(n&&i&&(r=t[++o]);++o<i;)r=e(r,t[o],o,t);return r}},1831:t=>{t.exports=function(t,e){for(var r=-1,n=null==t?0:t.length;++r<n;)if(e(t[r],r,t))return!0;return!1}},7088:(t,e,r)=>{var n=r(6174)("length");t.exports=n},3532:(t,e,r)=>{var n=r(7500),o=r(8260);t.exports=function(t,e,r){(void 0!==r&&!o(t[e],r)||void 0===r&&!(e in t))&&n(t,e,r)}},3192:(t,e,r)=>{var n=r(7500),o=r(8260),i=Object.prototype.hasOwnProperty;t.exports=function(t,e,r){var s=t[e];i.call(t,e)&&o(s,r)&&(void 0!==r||e in t)||n(t,e,r)}},8498:(t,e,r)=>{var n=r(8260);t.exports=function(t,e){for(var r=t.length;r--;)if(n(t[r][0],e))return r;return-1}},4265:(t,e,r)=>{var n=r(8618),o=r(2096);t.exports=function(t,e){return t&&n(e,o(e),t)}},1629:(t,e,r)=>{var n=r(8618),o=r(9882);t.exports=function(t,e){return t&&n(e,o(e),t)}},7500:(t,e,r)=>{var n=r(5595);t.exports=function(t,e,r){"__proto__"==e&&n?n(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}},8361:(t,e,r)=>{var n=r(9549),o=r(4004),i=r(3192),s=r(4265),a=r(1629),u=r(6502),d=r(2166),h=r(7272),c=r(2066),l=r(4357),f=r(5713),g=r(7493),p=r(2865),v=r(1908),y=r(4046),m=r(5589),w=r(5778),x=r(7613),b=r(3702),E=r(693),N=r(2096),_=r(9882),M="[object Arguments]",k="[object Function]",A="[object Object]",j={};j[M]=j["[object Array]"]=j["[object ArrayBuffer]"]=j["[object DataView]"]=j["[object Boolean]"]=j["[object Date]"]=j["[object Float32Array]"]=j["[object Float64Array]"]=j["[object Int8Array]"]=j["[object Int16Array]"]=j["[object Int32Array]"]=j["[object Map]"]=j["[object Number]"]=j[A]=j["[object RegExp]"]=j["[object Set]"]=j["[object String]"]=j["[object Symbol]"]=j["[object Uint8Array]"]=j["[object Uint8ClampedArray]"]=j["[object Uint16Array]"]=j["[object Uint32Array]"]=!0,j["[object Error]"]=j[k]=j["[object WeakMap]"]=!1,t.exports=function t(e,r,O,S,z,R){var I,P=1&r,C=2&r,D=4&r;if(O&&(I=z?O(e,S,z,R):O(e)),void 0!==I)return I;if(!b(e))return e;var T=m(e);if(T){if(I=p(e),!P)return d(e,I)}else{var L=g(e),F=L==k||"[object GeneratorFunction]"==L;if(w(e))return u(e,P);if(L==A||L==M||F&&!z){if(I=C||F?{}:y(e),!P)return C?c(e,a(I,e)):h(e,s(I,e))}else{if(!j[L])return z?e:{};I=v(e,L,P)}}R||(R=new n);var q=R.get(e);if(q)return q;R.set(e,I),E(e)?e.forEach((function(n){I.add(t(n,r,O,n,e,R))})):x(e)&&e.forEach((function(n,o){I.set(o,t(n,r,O,o,e,R))}));var V=T?void 0:(D?C?f:l:C?_:N)(e);return o(V||e,(function(n,o){V&&(n=e[o=n]),i(I,o,t(n,r,O,o,e,R))})),I}},7890:(t,e,r)=>{var n=r(3702),o=Object.create,i=function(){function t(){}return function(e){if(!n(e))return{};if(o)return o(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}();t.exports=i},1701:(t,e,r)=>{var n=r(4003),o=r(6313)(n);t.exports=o},5117:(t,e,r)=>{var n=r(2624);t.exports=function(t,e,r){for(var o=-1,i=t.length;++o<i;){var s=t[o],a=e(s);if(null!=a&&(void 0===u?a==a&&!n(a):r(a,u)))var u=a,d=s}return d}},8146:(t,e,r)=>{var n=r(1701);t.exports=function(t,e){var r=[];return n(t,(function(t,n,o){e(t,n,o)&&r.push(t)})),r}},4770:t=>{t.exports=function(t,e,r,n){for(var o=t.length,i=r+(n?1:-1);n?i--:++i<o;)if(e(t[i],i,t))return i;return-1}},6640:(t,e,r)=>{var n=r(111),o=r(7123);t.exports=function t(e,r,i,s,a){var u=-1,d=e.length;for(i||(i=o),a||(a=[]);++u<d;){var h=e[u];r>0&&i(h)?r>1?t(h,r-1,i,s,a):n(a,h):s||(a[a.length]=h)}return a}},9943:(t,e,r)=>{var n=r(2545)();t.exports=n},4003:(t,e,r)=>{var n=r(9943),o=r(2096);t.exports=function(t,e){return t&&n(t,e,o)}},548:(t,e,r)=>{var n=r(4007),o=r(6040);t.exports=function(t,e){for(var r=0,i=(e=n(e,t)).length;null!=t&&r<i;)t=t[o(e[r++])];return r&&r==i?t:void 0}},4468:(t,e,r)=>{var n=r(111),o=r(5589);t.exports=function(t,e,r){var i=e(t);return o(t)?i:n(i,r(t))}},9823:(t,e,r)=>{var n=r(861),o=r(1339),i=r(5151),s=n?n.toStringTag:void 0;t.exports=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":s&&s in Object(t)?o(t):i(t)}},1669:t=>{t.exports=function(t,e){return t>e}},2586:t=>{var e=Object.prototype.hasOwnProperty;t.exports=function(t,r){return null!=t&&e.call(t,r)}},2902:t=>{t.exports=function(t,e){return null!=t&&e in Object(t)}},4365:(t,e,r)=>{var n=r(4770),o=r(6963),i=r(5898);t.exports=function(t,e,r){return e==e?i(t,e,r):n(t,o,r)}},3016:(t,e,r)=>{var n=r(9823),o=r(440);t.exports=function(t){return o(t)&&"[object Arguments]"==n(t)}},4662:(t,e,r)=>{var n=r(8968),o=r(440);t.exports=function t(e,r,i,s,a){return e===r||(null==e||null==r||!o(e)&&!o(r)?e!=e&&r!=r:n(e,r,i,s,t,a))}},8968:(t,e,r)=>{var n=r(9549),o=r(4952),i=r(1080),s=r(6524),a=r(7493),u=r(5589),d=r(5778),h=r(922),c="[object Arguments]",l="[object Array]",f="[object Object]",g=Object.prototype.hasOwnProperty;t.exports=function(t,e,r,p,v,y){var m=u(t),w=u(e),x=m?l:a(t),b=w?l:a(e),E=(x=x==c?f:x)==f,N=(b=b==c?f:b)==f,_=x==b;if(_&&d(t)){if(!d(e))return!1;m=!0,E=!1}if(_&&!E)return y||(y=new n),m||h(t)?o(t,e,r,p,v,y):i(t,e,x,r,p,v,y);if(!(1&r)){var M=E&&g.call(t,"__wrapped__"),k=N&&g.call(e,"__wrapped__");if(M||k){var A=M?t.value():t,j=k?e.value():e;return y||(y=new n),v(A,j,r,p,y)}}return!!_&&(y||(y=new n),s(t,e,r,p,v,y))}},2275:(t,e,r)=>{var n=r(7493),o=r(440);t.exports=function(t){return o(t)&&"[object Map]"==n(t)}},2972:(t,e,r)=>{var n=r(9549),o=r(4662);t.exports=function(t,e,r,i){var s=r.length,a=s,u=!i;if(null==t)return!a;for(t=Object(t);s--;){var d=r[s];if(u&&d[2]?d[1]!==t[d[0]]:!(d[0]in t))return!1}for(;++s<a;){var h=(d=r[s])[0],c=t[h],l=d[1];if(u&&d[2]){if(void 0===c&&!(h in t))return!1}else{var f=new n;if(i)var g=i(c,l,h,t,e,f);if(!(void 0===g?o(l,c,3,i,f):g))return!1}}return!0}},6963:t=>{t.exports=function(t){return t!=t}},9817:(t,e,r)=>{var n=r(5563),o=r(8597),i=r(3702),s=r(5784),a=/^\\[object .+?Constructor\\]$/,u=Function.prototype,d=Object.prototype,h=u.toString,c=d.hasOwnProperty,l=RegExp("^"+h.call(c).replace(/[\\\\^$.*+?()[\\]{}|]/g,"\\\\$&").replace(/hasOwnProperty|(function).*?(?=\\\\\\()| for .+?(?=\\\\\\])/g,"$1.*?")+"$");t.exports=function(t){return!(!i(t)||o(t))&&(n(t)?l:a).test(s(t))}},7170:(t,e,r)=>{var n=r(7493),o=r(440);t.exports=function(t){return o(t)&&"[object Set]"==n(t)}},2448:(t,e,r)=>{var n=r(9823),o=r(6052),i=r(440),s={};s["[object Float32Array]"]=s["[object Float64Array]"]=s["[object Int8Array]"]=s["[object Int16Array]"]=s["[object Int32Array]"]=s["[object Uint8Array]"]=s["[object Uint8ClampedArray]"]=s["[object Uint16Array]"]=s["[object Uint32Array]"]=!0,s["[object Arguments]"]=s["[object Array]"]=s["[object ArrayBuffer]"]=s["[object Boolean]"]=s["[object DataView]"]=s["[object Date]"]=s["[object Error]"]=s["[object Function]"]=s["[object Map]"]=s["[object Number]"]=s["[object Object]"]=s["[object RegExp]"]=s["[object Set]"]=s["[object String]"]=s["[object WeakMap]"]=!1,t.exports=function(t){return i(t)&&o(t.length)&&!!s[n(t)]}},5833:(t,e,r)=>{var n=r(5640),o=r(9906),i=r(229),s=r(5589),a=r(4437);t.exports=function(t){return"function"==typeof t?t:null==t?i:"object"==typeof t?s(t)?o(t[0],t[1]):n(t):a(t)}},1351:(t,e,r)=>{var n=r(2840),o=r(2825),i=Object.prototype.hasOwnProperty;t.exports=function(t){if(!n(t))return o(t);var e=[];for(var r in Object(t))i.call(t,r)&&"constructor"!=r&&e.push(r);return e}},1309:(t,e,r)=>{var n=r(3702),o=r(2840),i=r(4866),s=Object.prototype.hasOwnProperty;t.exports=function(t){if(!n(t))return i(t);var e=o(t),r=[];for(var a in t)("constructor"!=a||!e&&s.call(t,a))&&r.push(a);return r}},6718:t=>{t.exports=function(t,e){return t<e}},8068:(t,e,r)=>{var n=r(1701),o=r(568);t.exports=function(t,e){var r=-1,i=o(t)?Array(t.length):[];return n(t,(function(t,n,o){i[++r]=e(t,n,o)})),i}},5640:(t,e,r)=>{var n=r(2972),o=r(2198),i=r(4656);t.exports=function(t){var e=o(t);return 1==e.length&&e[0][2]?i(e[0][0],e[0][1]):function(r){return r===t||n(r,t,e)}}},9906:(t,e,r)=>{var n=r(4662),o=r(3546),i=r(6708),s=r(5130),a=r(8802),u=r(4656),d=r(6040);t.exports=function(t,e){return s(t)&&a(e)?u(d(t),e):function(r){var s=o(r,t);return void 0===s&&s===e?i(r,t):n(e,s,3)}}},2133:(t,e,r)=>{var n=r(9549),o=r(3532),i=r(9943),s=r(1241),a=r(3702),u=r(9882),d=r(1933);t.exports=function t(e,r,h,c,l){e!==r&&i(r,(function(i,u){if(l||(l=new n),a(i))s(e,r,u,h,t,c,l);else{var f=c?c(d(e,u),i,u+"",e,r,l):void 0;void 0===f&&(f=i),o(e,u,f)}}),u)}},1241:(t,e,r)=>{var n=r(3532),o=r(6502),i=r(1327),s=r(2166),a=r(4046),u=r(9312),d=r(5589),h=r(8268),c=r(5778),l=r(5563),f=r(3702),g=r(4256),p=r(922),v=r(1933),y=r(6222);t.exports=function(t,e,r,m,w,x,b){var E=v(t,r),N=v(e,r),_=b.get(N);if(_)n(t,r,_);else{var M=x?x(E,N,r+"",t,e,b):void 0,k=void 0===M;if(k){var A=d(N),j=!A&&c(N),O=!A&&!j&&p(N);M=N,A||j||O?d(E)?M=E:h(E)?M=s(E):j?(k=!1,M=o(N,!0)):O?(k=!1,M=i(N,!0)):M=[]:g(N)||u(N)?(M=E,u(E)?M=y(E):f(E)&&!l(E)||(M=a(N))):k=!1}k&&(b.set(N,M),w(M,N,m,x,b),b.delete(N)),n(t,r,M)}}},3980:(t,e,r)=>{var n=r(9233),o=r(548),i=r(5833),s=r(8068),a=r(3340),u=r(1525),d=r(315),h=r(229),c=r(5589);t.exports=function(t,e,r){e=e.length?n(e,(function(t){return c(t)?function(e){return o(e,1===t.length?t[0]:t)}:t})):[h];var l=-1;e=n(e,u(i));var f=s(t,(function(t,r,o){return{criteria:n(e,(function(e){return e(t)})),index:++l,value:t}}));return a(f,(function(t,e){return d(t,e,r)}))}},1785:(t,e,r)=>{var n=r(7121),o=r(6708);t.exports=function(t,e){return n(t,e,(function(e,r){return o(t,r)}))}},7121:(t,e,r)=>{var n=r(548),o=r(2619),i=r(4007);t.exports=function(t,e,r){for(var s=-1,a=e.length,u={};++s<a;){var d=e[s],h=n(t,d);r(h,d)&&o(u,i(d,t),h)}return u}},6174:t=>{t.exports=function(t){return function(e){return null==e?void 0:e[t]}}},3293:(t,e,r)=>{var n=r(548);t.exports=function(t){return function(e){return n(e,t)}}},4930:t=>{var e=Math.ceil,r=Math.max;t.exports=function(t,n,o,i){for(var s=-1,a=r(e((n-t)/(o||1)),0),u=Array(a);a--;)u[i?a:++s]=t,t+=o;return u}},4306:t=>{t.exports=function(t,e,r,n,o){return o(t,(function(t,o,i){r=n?(n=!1,t):e(r,t,o,i)})),r}},9735:(t,e,r)=>{var n=r(229),o=r(340),i=r(4173);t.exports=function(t,e){return i(o(t,e,n),t+"")}},2619:(t,e,r)=>{var n=r(3192),o=r(4007),i=r(5023),s=r(3702),a=r(6040);t.exports=function(t,e,r,u){if(!s(t))return t;for(var d=-1,h=(e=o(e,t)).length,c=h-1,l=t;null!=l&&++d<h;){var f=a(e[d]),g=r;if("__proto__"===f||"constructor"===f||"prototype"===f)return t;if(d!=c){var p=l[f];void 0===(g=u?u(p,f,l):void 0)&&(g=s(p)?p:i(e[d+1])?[]:{})}n(l,f,g),l=l[f]}return t}},6739:(t,e,r)=>{var n=r(9203),o=r(5595),i=r(229),s=o?function(t,e){return o(t,"toString",{configurable:!0,enumerable:!1,value:n(e),writable:!0})}:i;t.exports=s},3340:t=>{t.exports=function(t,e){var r=t.length;for(t.sort(e);r--;)t[r]=t[r].value;return t}},8509:t=>{t.exports=function(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}},6245:(t,e,r)=>{var n=r(861),o=r(9233),i=r(5589),s=r(2624),a=n?n.prototype:void 0,u=a?a.toString:void 0;t.exports=function t(e){if("string"==typeof e)return e;if(i(e))return o(e,t)+"";if(s(e))return u?u.call(e):"";var r=e+"";return"0"==r&&1/e==-1/0?"-0":r}},1656:(t,e,r)=>{var n=r(2438),o=/^\\s+/;t.exports=function(t){return t?t.slice(0,n(t)+1).replace(o,""):t}},1525:t=>{t.exports=function(t){return function(e){return t(e)}}},135:(t,e,r)=>{var n=r(4546),o=r(5436),i=r(9105),s=r(7026),a=r(6262),u=r(7969);t.exports=function(t,e,r){var d=-1,h=o,c=t.length,l=!0,f=[],g=f;if(r)l=!1,h=i;else if(c>=200){var p=e?null:a(t);if(p)return u(p);l=!1,h=s,g=new n}else g=e?[]:f;t:for(;++d<c;){var v=t[d],y=e?e(v):v;if(v=r||0!==v?v:0,l&&y==y){for(var m=g.length;m--;)if(g[m]===y)continue t;e&&g.push(y),f.push(v)}else h(g,y,r)||(g!==f&&g.push(y),f.push(v))}return f}},71:(t,e,r)=>{var n=r(9233);t.exports=function(t,e){return n(e,(function(e){return t[e]}))}},6302:t=>{t.exports=function(t,e,r){for(var n=-1,o=t.length,i=e.length,s={};++n<o;){var a=n<i?e[n]:void 0;r(s,t[n],a)}return s}},7026:t=>{t.exports=function(t,e){return t.has(e)}},4781:(t,e,r)=>{var n=r(229);t.exports=function(t){return"function"==typeof t?t:n}},4007:(t,e,r)=>{var n=r(5589),o=r(5130),i=r(4041),s=r(9835);t.exports=function(t,e){return n(t)?t:o(t,e)?[t]:i(s(t))}},2962:(t,e,r)=>{var n=r(3526);t.exports=function(t){var e=new t.constructor(t.byteLength);return new n(e).set(new n(t)),e}},6502:(t,e,r)=>{t=r.nmd(t);var n=r(3250),o=e&&!e.nodeType&&e,i=o&&t&&!t.nodeType&&t,s=i&&i.exports===o?n.Buffer:void 0,a=s?s.allocUnsafe:void 0;t.exports=function(t,e){if(e)return t.slice();var r=t.length,n=a?a(r):new t.constructor(r);return t.copy(n),n}},7037:(t,e,r)=>{var n=r(2962);t.exports=function(t,e){var r=e?n(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}},3429:t=>{var e=/\\w*$/;t.exports=function(t){var r=new t.constructor(t.source,e.exec(t));return r.lastIndex=t.lastIndex,r}},9349:(t,e,r)=>{var n=r(861),o=n?n.prototype:void 0,i=o?o.valueOf:void 0;t.exports=function(t){return i?Object(i.call(t)):{}}},1327:(t,e,r)=>{var n=r(2962);t.exports=function(t,e){var r=e?n(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}},8899:(t,e,r)=>{var n=r(2624);t.exports=function(t,e){if(t!==e){var r=void 0!==t,o=null===t,i=t==t,s=n(t),a=void 0!==e,u=null===e,d=e==e,h=n(e);if(!u&&!h&&!s&&t>e||s&&a&&d&&!u&&!h||o&&a&&d||!r&&d||!i)return 1;if(!o&&!s&&!h&&t<e||h&&r&&i&&!o&&!s||u&&r&&i||!a&&i||!d)return-1}return 0}},315:(t,e,r)=>{var n=r(8899);t.exports=function(t,e,r){for(var o=-1,i=t.criteria,s=e.criteria,a=i.length,u=r.length;++o<a;){var d=n(i[o],s[o]);if(d)return o>=u?d:d*("desc"==r[o]?-1:1)}return t.index-e.index}},2166:t=>{t.exports=function(t,e){var r=-1,n=t.length;for(e||(e=Array(n));++r<n;)e[r]=t[r];return e}},8618:(t,e,r)=>{var n=r(3192),o=r(7500);t.exports=function(t,e,r,i){var s=!r;r||(r={});for(var a=-1,u=e.length;++a<u;){var d=e[a],h=i?i(r[d],t[d],d,r,t):void 0;void 0===h&&(h=t[d]),s?o(r,d,h):n(r,d,h)}return r}},7272:(t,e,r)=>{var n=r(8618),o=r(4450);t.exports=function(t,e){return n(t,o(t),e)}},2066:(t,e,r)=>{var n=r(8618),o=r(4969);t.exports=function(t,e){return n(t,o(t),e)}},1622:(t,e,r)=>{var n=r(3250)["__core-js_shared__"];t.exports=n},6948:(t,e,r)=>{var n=r(9735),o=r(8132);t.exports=function(t){return n((function(e,r){var n=-1,i=r.length,s=i>1?r[i-1]:void 0,a=i>2?r[2]:void 0;for(s=t.length>3&&"function"==typeof s?(i--,s):void 0,a&&o(r[0],r[1],a)&&(s=i<3?void 0:s,i=1),e=Object(e);++n<i;){var u=r[n];u&&t(e,u,n,s)}return e}))}},6313:(t,e,r)=>{var n=r(568);t.exports=function(t,e){return function(r,o){if(null==r)return r;if(!n(r))return t(r,o);for(var i=r.length,s=e?i:-1,a=Object(r);(e?s--:++s<i)&&!1!==o(a[s],s,a););return r}}},2545:t=>{t.exports=function(t){return function(e,r,n){for(var o=-1,i=Object(e),s=n(e),a=s.length;a--;){var u=s[t?a:++o];if(!1===r(i[u],u,i))break}return e}}},9301:(t,e,r)=>{var n=r(5833),o=r(568),i=r(2096);t.exports=function(t){return function(e,r,s){var a=Object(e);if(!o(e)){var u=n(r,3);e=i(e),r=function(t){return u(a[t],t,a)}}var d=t(e,r,s);return d>-1?a[u?e[d]:d]:void 0}}},1523:(t,e,r)=>{var n=r(4930),o=r(8132),i=r(9558);t.exports=function(t){return function(e,r,s){return s&&"number"!=typeof s&&o(e,r,s)&&(r=s=void 0),e=i(e),void 0===r?(r=e,e=0):r=i(r),s=void 0===s?e<r?1:-1:i(s),n(e,r,s,t)}}},6262:(t,e,r)=>{var n=r(6616),o=r(1607),i=r(7969),s=n&&1/i(new n([,-0]))[1]==1/0?function(t){return new n(t)}:o;t.exports=s},5595:(t,e,r)=>{var n=r(5234),o=function(){try{var t=n(Object,"defineProperty");return t({},"",{}),t}catch(t){}}();t.exports=o},4952:(t,e,r)=>{var n=r(4546),o=r(1831),i=r(7026);t.exports=function(t,e,r,s,a,u){var d=1&r,h=t.length,c=e.length;if(h!=c&&!(d&&c>h))return!1;var l=u.get(t),f=u.get(e);if(l&&f)return l==e&&f==t;var g=-1,p=!0,v=2&r?new n:void 0;for(u.set(t,e),u.set(e,t);++g<h;){var y=t[g],m=e[g];if(s)var w=d?s(m,y,g,e,t,u):s(y,m,g,t,e,u);if(void 0!==w){if(w)continue;p=!1;break}if(v){if(!o(e,(function(t,e){if(!i(v,e)&&(y===t||a(y,t,r,s,u)))return v.push(e)}))){p=!1;break}}else if(y!==m&&!a(y,m,r,s,u)){p=!1;break}}return u.delete(t),u.delete(e),p}},1080:(t,e,r)=>{var n=r(861),o=r(3526),i=r(8260),s=r(4952),a=r(1140),u=r(7969),d=n?n.prototype:void 0,h=d?d.valueOf:void 0;t.exports=function(t,e,r,n,d,c,l){switch(r){case"[object DataView]":if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case"[object ArrayBuffer]":return!(t.byteLength!=e.byteLength||!c(new o(t),new o(e)));case"[object Boolean]":case"[object Date]":case"[object Number]":return i(+t,+e);case"[object Error]":return t.name==e.name&&t.message==e.message;case"[object RegExp]":case"[object String]":return t==e+"";case"[object Map]":var f=a;case"[object Set]":var g=1&n;if(f||(f=u),t.size!=e.size&&!g)return!1;var p=l.get(t);if(p)return p==e;n|=2,l.set(t,e);var v=s(f(t),f(e),n,d,c,l);return l.delete(t),v;case"[object Symbol]":if(h)return h.call(t)==h.call(e)}return!1}},6524:(t,e,r)=>{var n=r(4357),o=Object.prototype.hasOwnProperty;t.exports=function(t,e,r,i,s,a){var u=1&r,d=n(t),h=d.length;if(h!=n(e).length&&!u)return!1;for(var c=h;c--;){var l=d[c];if(!(u?l in e:o.call(e,l)))return!1}var f=a.get(t),g=a.get(e);if(f&&g)return f==e&&g==t;var p=!0;a.set(t,e),a.set(e,t);for(var v=u;++c<h;){var y=t[l=d[c]],m=e[l];if(i)var w=u?i(m,y,l,e,t,a):i(y,m,l,t,e,a);if(!(void 0===w?y===m||s(y,m,r,i,a):w)){p=!1;break}v||(v="constructor"==l)}if(p&&!v){var x=t.constructor,b=e.constructor;x==b||!("constructor"in t)||!("constructor"in e)||"function"==typeof x&&x instanceof x&&"function"==typeof b&&b instanceof b||(p=!1)}return a.delete(t),a.delete(e),p}},3273:(t,e,r)=>{var n=r(2923),o=r(340),i=r(4173);t.exports=function(t){return i(o(t,void 0,n),t+"")}},302:(t,e,r)=>{var n="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g;t.exports=n},4357:(t,e,r)=>{var n=r(4468),o=r(4450),i=r(2096);t.exports=function(t){return n(t,i,o)}},5713:(t,e,r)=>{var n=r(4468),o=r(4969),i=r(9882);t.exports=function(t){return n(t,i,o)}},7570:(t,e,r)=>{var n=r(8949);t.exports=function(t,e){var r=t.__data__;return n(e)?r["string"==typeof e?"string":"hash"]:r.map}},2198:(t,e,r)=>{var n=r(8802),o=r(2096);t.exports=function(t){for(var e=o(t),r=e.length;r--;){var i=e[r],s=t[i];e[r]=[i,s,n(s)]}return e}},5234:(t,e,r)=>{var n=r(9817),o=r(7736);t.exports=function(t,e){var r=o(t,e);return n(r)?r:void 0}},8490:(t,e,r)=>{var n=r(3540)(Object.getPrototypeOf,Object);t.exports=n},1339:(t,e,r)=>{var n=r(861),o=Object.prototype,i=o.hasOwnProperty,s=o.toString,a=n?n.toStringTag:void 0;t.exports=function(t){var e=i.call(t,a),r=t[a];try{t[a]=void 0;var n=!0}catch(t){}var o=s.call(t);return n&&(e?t[a]=r:delete t[a]),o}},4450:(t,e,r)=>{var n=r(2493),o=r(4506),i=Object.prototype.propertyIsEnumerable,s=Object.getOwnPropertySymbols,a=s?function(t){return null==t?[]:(t=Object(t),n(s(t),(function(e){return i.call(t,e)})))}:o;t.exports=a},4969:(t,e,r)=>{var n=r(111),o=r(8490),i=r(4450),s=r(4506),a=Object.getOwnPropertySymbols?function(t){for(var e=[];t;)n(e,i(t)),t=o(t);return e}:s;t.exports=a},7493:(t,e,r)=>{var n=r(4466),o=r(2887),i=r(5747),s=r(6616),a=r(8001),u=r(9823),d=r(5784),h="[object Map]",c="[object Promise]",l="[object Set]",f="[object WeakMap]",g="[object DataView]",p=d(n),v=d(o),y=d(i),m=d(s),w=d(a),x=u;(n&&x(new n(new ArrayBuffer(1)))!=g||o&&x(new o)!=h||i&&x(i.resolve())!=c||s&&x(new s)!=l||a&&x(new a)!=f)&&(x=function(t){var e=u(t),r="[object Object]"==e?t.constructor:void 0,n=r?d(r):"";if(n)switch(n){case p:return g;case v:return h;case y:return c;case m:return l;case w:return f}return e}),t.exports=x},7736:t=>{t.exports=function(t,e){return null==t?void 0:t[e]}},3544:(t,e,r)=>{var n=r(4007),o=r(9312),i=r(5589),s=r(5023),a=r(6052),u=r(6040);t.exports=function(t,e,r){for(var d=-1,h=(e=n(e,t)).length,c=!1;++d<h;){var l=u(e[d]);if(!(c=null!=t&&r(t,l)))break;t=t[l]}return c||++d!=h?c:!!(h=null==t?0:t.length)&&a(h)&&s(l,h)&&(i(t)||o(t))}},3932:t=>{var e=RegExp("[\\\\u200d\\\\ud800-\\\\udfff\\\\u0300-\\\\u036f\\\\ufe20-\\\\ufe2f\\\\u20d0-\\\\u20ff\\\\ufe0e\\\\ufe0f]");t.exports=function(t){return e.test(t)}},4440:(t,e,r)=>{var n=r(4545);t.exports=function(){this.__data__=n?n(null):{},this.size=0}},4108:t=>{t.exports=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}},1085:(t,e,r)=>{var n=r(4545),o=Object.prototype.hasOwnProperty;t.exports=function(t){var e=this.__data__;if(n){var r=e[t];return"__lodash_hash_undefined__"===r?void 0:r}return o.call(e,t)?e[t]:void 0}},7706:(t,e,r)=>{var n=r(4545),o=Object.prototype.hasOwnProperty;t.exports=function(t){var e=this.__data__;return n?void 0!==e[t]:o.call(e,t)}},8636:(t,e,r)=>{var n=r(4545);t.exports=function(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=n&&void 0===e?"__lodash_hash_undefined__":e,this}},2865:t=>{var e=Object.prototype.hasOwnProperty;t.exports=function(t){var r=t.length,n=new t.constructor(r);return r&&"string"==typeof t[0]&&e.call(t,"index")&&(n.index=t.index,n.input=t.input),n}},1908:(t,e,r)=>{var n=r(2962),o=r(7037),i=r(3429),s=r(9349),a=r(1327);t.exports=function(t,e,r){var u=t.constructor;switch(e){case"[object ArrayBuffer]":return n(t);case"[object Boolean]":case"[object Date]":return new u(+t);case"[object DataView]":return o(t,r);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return a(t,r);case"[object Map]":case"[object Set]":return new u;case"[object Number]":case"[object String]":return new u(t);case"[object RegExp]":return i(t);case"[object Symbol]":return s(t)}}},4046:(t,e,r)=>{var n=r(7890),o=r(8490),i=r(2840);t.exports=function(t){return"function"!=typeof t.constructor||i(t)?{}:n(o(t))}},7123:(t,e,r)=>{var n=r(861),o=r(9312),i=r(5589),s=n?n.isConcatSpreadable:void 0;t.exports=function(t){return i(t)||o(t)||!!(s&&t&&t[s])}},5023:t=>{var e=/^(?:0|[1-9]\\d*)$/;t.exports=function(t,r){var n=typeof t;return!!(r=null==r?9007199254740991:r)&&("number"==n||"symbol"!=n&&e.test(t))&&t>-1&&t%1==0&&t<r}},8132:(t,e,r)=>{var n=r(8260),o=r(568),i=r(5023),s=r(3702);t.exports=function(t,e,r){if(!s(r))return!1;var a=typeof e;return!!("number"==a?o(r)&&i(e,r.length):"string"==a&&e in r)&&n(r[e],t)}},5130:(t,e,r)=>{var n=r(5589),o=r(2624),i=/\\.|\\[(?:[^[\\]]*|(["\'])(?:(?!\\1)[^\\\\]|\\\\.)*?\\1)\\]/,s=/^\\w*$/;t.exports=function(t,e){if(n(t))return!1;var r=typeof t;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=t&&!o(t))||s.test(t)||!i.test(t)||null!=e&&t in Object(e)}},8949:t=>{t.exports=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t}},8597:(t,e,r)=>{var n,o=r(1622),i=(n=/[^.]+$/.exec(o&&o.keys&&o.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"";t.exports=function(t){return!!i&&i in t}},2840:t=>{var e=Object.prototype;t.exports=function(t){var r=t&&t.constructor;return t===("function"==typeof r&&r.prototype||e)}},8802:(t,e,r)=>{var n=r(3702);t.exports=function(t){return t==t&&!n(t)}},266:t=>{t.exports=function(){this.__data__=[],this.size=0}},2875:(t,e,r)=>{var n=r(8498),o=Array.prototype.splice;t.exports=function(t){var e=this.__data__,r=n(e,t);return!(r<0||(r==e.length-1?e.pop():o.call(e,r,1),--this.size,0))}},5828:(t,e,r)=>{var n=r(8498);t.exports=function(t){var e=this.__data__,r=n(e,t);return r<0?void 0:e[r][1]}},4115:(t,e,r)=>{var n=r(8498);t.exports=function(t){return n(this.__data__,t)>-1}},7690:(t,e,r)=>{var n=r(8498);t.exports=function(t,e){var r=this.__data__,o=n(r,t);return o<0?(++this.size,r.push([t,e])):r[o][1]=e,this}},9016:(t,e,r)=>{var n=r(5208),o=r(1998),i=r(2887);t.exports=function(){this.size=0,this.__data__={hash:new n,map:new(i||o),string:new n}}},2363:(t,e,r)=>{var n=r(7570);t.exports=function(t){var e=n(this,t).delete(t);return this.size-=e?1:0,e}},4348:(t,e,r)=>{var n=r(7570);t.exports=function(t){return n(this,t).get(t)}},3062:(t,e,r)=>{var n=r(7570);t.exports=function(t){return n(this,t).has(t)}},262:(t,e,r)=>{var n=r(7570);t.exports=function(t,e){var r=n(this,t),o=r.size;return r.set(t,e),this.size+=r.size==o?0:1,this}},1140:t=>{t.exports=function(t){var e=-1,r=Array(t.size);return t.forEach((function(t,n){r[++e]=[n,t]})),r}},4656:t=>{t.exports=function(t,e){return function(r){return null!=r&&r[t]===e&&(void 0!==e||t in Object(r))}}},2924:(t,e,r)=>{var n=r(7997);t.exports=function(t){var e=n(t,(function(t){return 500===r.size&&r.clear(),t})),r=e.cache;return e}},4545:(t,e,r)=>{var n=r(5234)(Object,"create");t.exports=n},2825:(t,e,r)=>{var n=r(3540)(Object.keys,Object);t.exports=n},4866:t=>{t.exports=function(t){var e=[];if(null!=t)for(var r in Object(t))e.push(r);return e}},8690:(t,e,r)=>{t=r.nmd(t);var n=r(302),o=e&&!e.nodeType&&e,i=o&&t&&!t.nodeType&&t,s=i&&i.exports===o&&n.process,a=function(){try{return i&&i.require&&i.require("util").types||s&&s.binding&&s.binding("util")}catch(t){}}();t.exports=a},5151:t=>{var e=Object.prototype.toString;t.exports=function(t){return e.call(t)}},3540:t=>{t.exports=function(t,e){return function(r){return t(e(r))}}},340:(t,e,r)=>{var n=r(2274),o=Math.max;t.exports=function(t,e,r){return e=o(void 0===e?t.length-1:e,0),function(){for(var i=arguments,s=-1,a=o(i.length-e,0),u=Array(a);++s<a;)u[s]=i[e+s];s=-1;for(var d=Array(e+1);++s<e;)d[s]=i[s];return d[e]=r(u),n(t,this,d)}}},3250:(t,e,r)=>{var n=r(302),o="object"==typeof self&&self&&self.Object===Object&&self,i=n||o||Function("return this")();t.exports=i},1933:t=>{t.exports=function(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}},3937:t=>{t.exports=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this}},5009:t=>{t.exports=function(t){return this.__data__.has(t)}},7969:t=>{t.exports=function(t){var e=-1,r=Array(t.size);return t.forEach((function(t){r[++e]=t})),r}},4173:(t,e,r)=>{var n=r(6739),o=r(7357)(n);t.exports=o},7357:t=>{var e=Date.now;t.exports=function(t){var r=0,n=0;return function(){var o=e(),i=16-(o-n);if(n=o,i>0){if(++r>=800)return arguments[0]}else r=0;return t.apply(void 0,arguments)}}},3210:(t,e,r)=>{var n=r(1998);t.exports=function(){this.__data__=new n,this.size=0}},8603:t=>{t.exports=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}},8947:t=>{t.exports=function(t){return this.__data__.get(t)}},885:t=>{t.exports=function(t){return this.__data__.has(t)}},8938:(t,e,r)=>{var n=r(1998),o=r(2887),i=r(5678);t.exports=function(t,e){var r=this.__data__;if(r instanceof n){var s=r.__data__;if(!o||s.length<199)return s.push([t,e]),this.size=++r.size,this;r=this.__data__=new i(s)}return r.set(t,e),this.size=r.size,this}},5898:t=>{t.exports=function(t,e,r){for(var n=r-1,o=t.length;++n<o;)if(t[n]===e)return n;return-1}},1324:(t,e,r)=>{var n=r(7088),o=r(3932),i=r(445);t.exports=function(t){return o(t)?i(t):n(t)}},4041:(t,e,r)=>{var n=r(2924),o=/[^.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|(["\'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|$))/g,i=/\\\\(\\\\)?/g,s=n((function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(o,(function(t,r,n,o){e.push(n?o.replace(i,"$1"):r||t)})),e}));t.exports=s},6040:(t,e,r)=>{var n=r(2624);t.exports=function(t){if("string"==typeof t||n(t))return t;var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}},5784:t=>{var e=Function.prototype.toString;t.exports=function(t){if(null!=t){try{return e.call(t)}catch(t){}try{return t+""}catch(t){}}return""}},2438:t=>{var e=/\\s/;t.exports=function(t){for(var r=t.length;r--&&e.test(t.charAt(r)););return r}},445:t=>{var e="\\\\ud800-\\\\udfff",r="["+e+"]",n="[\\\\u0300-\\\\u036f\\\\ufe20-\\\\ufe2f\\\\u20d0-\\\\u20ff]",o="\\\\ud83c[\\\\udffb-\\\\udfff]",i="[^"+e+"]",s="(?:\\\\ud83c[\\\\udde6-\\\\uddff]){2}",a="[\\\\ud800-\\\\udbff][\\\\udc00-\\\\udfff]",u="(?:"+n+"|"+o+")?",d="[\\\\ufe0e\\\\ufe0f]?",h=d+u+"(?:\\\\u200d(?:"+[i,s,a].join("|")+")"+d+u+")*",c="(?:"+[i+n+"?",n,s,a,r].join("|")+")",l=RegExp(o+"(?="+o+")|"+c+h,"g");t.exports=function(t){for(var e=l.lastIndex=0;l.test(t);)++e;return e}},7953:(t,e,r)=>{var n=r(8361);t.exports=function(t){return n(t,4)}},7179:(t,e,r)=>{var n=r(8361);t.exports=function(t){return n(t,5)}},9203:t=>{t.exports=function(t){return function(){return t}}},3821:(t,e,r)=>{var n=r(9735),o=r(8260),i=r(8132),s=r(9882),a=Object.prototype,u=a.hasOwnProperty,d=n((function(t,e){t=Object(t);var r=-1,n=e.length,d=n>2?e[2]:void 0;for(d&&i(e[0],e[1],d)&&(n=1);++r<n;)for(var h=e[r],c=s(h),l=-1,f=c.length;++l<f;){var g=c[l],p=t[g];(void 0===p||o(p,a[g])&&!u.call(t,g))&&(t[g]=h[g])}return t}));t.exports=d},678:(t,e,r)=>{t.exports=r(7734)},8260:t=>{t.exports=function(t,e){return t===e||t!=t&&e!=e}},4663:(t,e,r)=>{var n=r(2493),o=r(8146),i=r(5833),s=r(5589);t.exports=function(t,e){return(s(t)?n:o)(t,i(e,3))}},6969:(t,e,r)=>{var n=r(9301)(r(564));t.exports=n},564:(t,e,r)=>{var n=r(4770),o=r(5833),i=r(6843),s=Math.max;t.exports=function(t,e,r){var a=null==t?0:t.length;if(!a)return-1;var u=null==r?0:i(r);return u<0&&(u=s(a+u,0)),n(t,o(e,3),u)}},2923:(t,e,r)=>{var n=r(6640);t.exports=function(t){return null!=t&&t.length?n(t,1):[]}},7734:(t,e,r)=>{var n=r(4004),o=r(1701),i=r(4781),s=r(5589);t.exports=function(t,e){return(s(t)?n:o)(t,i(e))}},7514:(t,e,r)=>{var n=r(9943),o=r(4781),i=r(9882);t.exports=function(t,e){return null==t?t:n(t,o(e),i)}},3546:(t,e,r)=>{var n=r(548);t.exports=function(t,e,r){var o=null==t?void 0:n(t,e);return void 0===o?r:o}},5346:(t,e,r)=>{var n=r(2586),o=r(3544);t.exports=function(t,e){return null!=t&&o(t,e,n)}},6708:(t,e,r)=>{var n=r(2902),o=r(3544);t.exports=function(t,e){return null!=t&&o(t,e,n)}},229:t=>{t.exports=function(t){return t}},9312:(t,e,r)=>{var n=r(3016),o=r(440),i=Object.prototype,s=i.hasOwnProperty,a=i.propertyIsEnumerable,u=n(function(){return arguments}())?n:function(t){return o(t)&&s.call(t,"callee")&&!a.call(t,"callee")};t.exports=u},5589:t=>{var e=Array.isArray;t.exports=e},568:(t,e,r)=>{var n=r(5563),o=r(6052);t.exports=function(t){return null!=t&&o(t.length)&&!n(t)}},8268:(t,e,r)=>{var n=r(568),o=r(440);t.exports=function(t){return o(t)&&n(t)}},5778:(t,e,r)=>{t=r.nmd(t);var n=r(3250),o=r(7999),i=e&&!e.nodeType&&e,s=i&&t&&!t.nodeType&&t,a=s&&s.exports===i?n.Buffer:void 0,u=(a?a.isBuffer:void 0)||o;t.exports=u},9787:(t,e,r)=>{var n=r(1351),o=r(7493),i=r(9312),s=r(5589),a=r(568),u=r(5778),d=r(2840),h=r(922),c=Object.prototype.hasOwnProperty;t.exports=function(t){if(null==t)return!0;if(a(t)&&(s(t)||"string"==typeof t||"function"==typeof t.splice||u(t)||h(t)||i(t)))return!t.length;var e=o(t);if("[object Map]"==e||"[object Set]"==e)return!t.size;if(d(t))return!n(t).length;for(var r in t)if(c.call(t,r))return!1;return!0}},5563:(t,e,r)=>{var n=r(9823),o=r(3702);t.exports=function(t){if(!o(t))return!1;var e=n(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e}},6052:t=>{t.exports=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}},7613:(t,e,r)=>{var n=r(2275),o=r(1525),i=r(8690),s=i&&i.isMap,a=s?o(s):n;t.exports=a},3702:t=>{t.exports=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}},440:t=>{t.exports=function(t){return null!=t&&"object"==typeof t}},4256:(t,e,r)=>{var n=r(9823),o=r(8490),i=r(440),s=Function.prototype,a=Object.prototype,u=s.toString,d=a.hasOwnProperty,h=u.call(Object);t.exports=function(t){if(!i(t)||"[object Object]"!=n(t))return!1;var e=o(t);if(null===e)return!0;var r=d.call(e,"constructor")&&e.constructor;return"function"==typeof r&&r instanceof r&&u.call(r)==h}},693:(t,e,r)=>{var n=r(7170),o=r(1525),i=r(8690),s=i&&i.isSet,a=s?o(s):n;t.exports=a},6705:(t,e,r)=>{var n=r(9823),o=r(5589),i=r(440);t.exports=function(t){return"string"==typeof t||!o(t)&&i(t)&&"[object String]"==n(t)}},2624:(t,e,r)=>{var n=r(9823),o=r(440);t.exports=function(t){return"symbol"==typeof t||o(t)&&"[object Symbol]"==n(t)}},922:(t,e,r)=>{var n=r(2448),o=r(1525),i=r(8690),s=i&&i.isTypedArray,a=s?o(s):n;t.exports=a},6474:t=>{t.exports=function(t){return void 0===t}},2096:(t,e,r)=>{var n=r(5825),o=r(1351),i=r(568);t.exports=function(t){return i(t)?n(t):o(t)}},9882:(t,e,r)=>{var n=r(5825),o=r(1309),i=r(568);t.exports=function(t){return i(t)?n(t,!0):o(t)}},7875:t=>{t.exports=function(t){var e=null==t?0:t.length;return e?t[e-1]:void 0}},9107:(t,e,r)=>{var n=r(9233),o=r(5833),i=r(8068),s=r(5589);t.exports=function(t,e){return(s(t)?n:i)(t,o(e,3))}},1230:(t,e,r)=>{var n=r(7500),o=r(4003),i=r(5833);t.exports=function(t,e){var r={};return e=i(e,3),o(t,(function(t,o,i){n(r,o,e(t,o,i))})),r}},6492:(t,e,r)=>{var n=r(5117),o=r(1669),i=r(229);t.exports=function(t){return t&&t.length?n(t,i,o):void 0}},7997:(t,e,r)=>{var n=r(5678);function o(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new TypeError("Expected a function");var r=function(){var n=arguments,o=e?e.apply(this,n):n[0],i=r.cache;if(i.has(o))return i.get(o);var s=t.apply(this,n);return r.cache=i.set(o,s)||i,s};return r.cache=new(o.Cache||n),r}o.Cache=n,t.exports=o},8469:(t,e,r)=>{var n=r(2133),o=r(6948)((function(t,e,r){n(t,e,r)}));t.exports=o},5071:(t,e,r)=>{var n=r(5117),o=r(6718),i=r(229);t.exports=function(t){return t&&t.length?n(t,i,o):void 0}},6838:(t,e,r)=>{var n=r(5117),o=r(5833),i=r(6718);t.exports=function(t,e){return t&&t.length?n(t,o(e,2),i):void 0}},1607:t=>{t.exports=function(){}},231:(t,e,r)=>{var n=r(3250);t.exports=function(){return n.Date.now()}},9335:(t,e,r)=>{var n=r(1785),o=r(3273)((function(t,e){return null==t?{}:n(t,e)}));t.exports=o},4437:(t,e,r)=>{var n=r(6174),o=r(3293),i=r(5130),s=r(6040);t.exports=function(t){return i(t)?n(s(t)):o(t)}},8569:(t,e,r)=>{var n=r(1523)();t.exports=n},7682:(t,e,r)=>{var n=r(5115),o=r(1701),i=r(5833),s=r(4306),a=r(5589);t.exports=function(t,e,r){var u=a(t)?n:s,d=arguments.length<3;return u(t,i(e,4),r,d,o)}},1039:(t,e,r)=>{var n=r(1351),o=r(7493),i=r(568),s=r(6705),a=r(1324);t.exports=function(t){if(null==t)return 0;if(i(t))return s(t)?a(t):t.length;var e=o(t);return"[object Map]"==e||"[object Set]"==e?t.size:n(t).length}},1635:(t,e,r)=>{var n=r(6640),o=r(3980),i=r(9735),s=r(8132),a=i((function(t,e){if(null==t)return[];var r=e.length;return r>1&&s(t,e[0],e[1])?e=[]:r>2&&s(e[0],e[1],e[2])&&(e=[e[0]]),o(t,n(e,1),[])}));t.exports=a},4506:t=>{t.exports=function(){return[]}},7999:t=>{t.exports=function(){return!1}},9558:(t,e,r)=>{var n=r(9153),o=1/0;t.exports=function(t){return t?(t=n(t))===o||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0}},6843:(t,e,r)=>{var n=r(9558);t.exports=function(t){var e=n(t),r=e%1;return e==e?r?e-r:e:0}},9153:(t,e,r)=>{var n=r(1656),o=r(3702),i=r(2624),s=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,u=/^0o[0-7]+$/i,d=parseInt;t.exports=function(t){if("number"==typeof t)return t;if(i(t))return NaN;if(o(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=o(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=n(t);var r=a.test(t);return r||u.test(t)?d(t.slice(2),r?2:8):s.test(t)?NaN:+t}},6222:(t,e,r)=>{var n=r(8618),o=r(9882);t.exports=function(t){return n(t,o(t))}},9835:(t,e,r)=>{var n=r(6245);t.exports=function(t){return null==t?"":n(t)}},3604:(t,e,r)=>{var n=r(4004),o=r(7890),i=r(4003),s=r(5833),a=r(8490),u=r(5589),d=r(5778),h=r(5563),c=r(3702),l=r(922);t.exports=function(t,e,r){var f=u(t),g=f||d(t)||l(t);if(e=s(e,4),null==r){var p=t&&t.constructor;r=g?f?new p:[]:c(t)&&h(p)?o(a(t)):{}}return(g?n:i)(t,(function(t,n,o){return e(r,t,n,o)})),r}},7767:(t,e,r)=>{var n=r(6640),o=r(9735),i=r(135),s=r(8268),a=o((function(t){return i(n(t,1,s,!0))}));t.exports=a},1422:(t,e,r)=>{var n=r(9835),o=0;t.exports=function(t){var e=++o;return n(t)+e}},1682:(t,e,r)=>{var n=r(71),o=r(2096);t.exports=function(t){return null==t?[]:n(t,o(t))}},4142:(t,e,r)=>{var n=r(3192),o=r(6302);t.exports=function(t,e){return o(t||[],e||[],n)}}},e={};function r(n){var o=e[n];if(void 0!==o)return o.exports;var i=e[n]={id:n,loaded:!1,exports:{}};return t[n](i,i.exports,r),i.loaded=!0,i.exports}r.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return r.d(e,{a:e}),e},r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.nmd=t=>(t.paths=[],t.children||(t.children=[]),t);var n={};(()=>{"use strict";function t(t,e,r,n){return new(r||(r=Promise))((function(o,i){function s(t){try{u(n.next(t))}catch(t){i(t)}}function a(t){try{u(n.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))}r.d(n,{calculateLayout:()=>ro,stopLayout:()=>eo}),Object.create,Object.create;const e=function(){function t(){this._events={}}return t.prototype.on=function(t,e,r){return this._events[t]||(this._events[t]=[]),this._events[t].push({callback:e,once:!!r}),this},t.prototype.once=function(t,e){return this.on(t,e,!0)},t.prototype.emit=function(t){for(var e=this,r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];var o=this._events[t]||[],i=this._events["*"]||[],s=function(n){for(var o=n.length,i=0;i<o;i++)if(n[i]){var s=n[i],a=s.callback;s.once&&(n.splice(i,1),0===n.length&&delete e._events[t],o--,i--),a.apply(e,r)}};s(o),s(i)},t.prototype.off=function(t,e){if(t)if(e){for(var r=this._events[t]||[],n=r.length,o=0;o<n;o++)r[o].callback===e&&(r.splice(o,1),n--,o--);0===r.length&&delete this._events[t]}else delete this._events[t];else this._events={};return this},t.prototype.getEvents=function(){return this._events},t}();function o(t,e,r,n){for(;t.length;){const o=t.shift();if(r(o))return!0;e.add(o.id),n(o.id).forEach((r=>{e.has(r.id)||(e.add(r.id),t.push(r))}))}return!1}function i(t,e,r,n){if(r(t))return!0;e.add(t.id);for(const o of n(t.id))if(!e.has(o.id)&&i(o,e,r,n))return!0;return!1}const s=()=>!0;class a{graph;nodeFilter;edgeFilter;cacheEnabled;inEdgesMap=new Map;outEdgesMap=new Map;bothEdgesMap=new Map;allNodesMap=new Map;allEdgesMap=new Map;constructor(t){this.graph=t.graph;const e=t.nodeFilter||s,r=t.edgeFilter||s;this.nodeFilter=e,this.edgeFilter=t=>{const{source:n,target:o}=this.graph.getEdgeDetail(t.id);return!(!e(n)||!e(o))&&r(t,n,o)},"auto"===t.cache?(this.cacheEnabled=!0,this.startAutoCache()):"manual"===t.cache?this.cacheEnabled=!0:this.cacheEnabled=!1}clearCache=()=>{this.inEdgesMap.clear(),this.outEdgesMap.clear(),this.bothEdgesMap.clear(),this.allNodesMap.clear(),this.allEdgesMap.clear()};refreshCache=()=>{this.clearCache(),this.updateCache(this.graph.getAllNodes().map((t=>t.id)))};updateCache=t=>{const e=new Set;t.forEach((t=>{const r=this.bothEdgesMap.get(t);if(r&&r.forEach((t=>e.add(t.id))),this.hasNode(t)){const r=this.graph.getRelatedEdges(t,"in").filter(this.edgeFilter),n=this.graph.getRelatedEdges(t,"out").filter(this.edgeFilter),o=Array.from(new Set([...r,...n]));o.forEach((t=>e.add(t.id))),this.inEdgesMap.set(t,r),this.outEdgesMap.set(t,n),this.bothEdgesMap.set(t,o),this.allNodesMap.set(t,this.graph.getNode(t))}else this.inEdgesMap.delete(t),this.outEdgesMap.delete(t),this.bothEdgesMap.delete(t),this.allNodesMap.delete(t)})),e.forEach((t=>{this.hasEdge(t)?this.allEdgesMap.set(t,this.graph.getEdge(t)):this.allEdgesMap.delete(t)}))};startAutoCache(){this.refreshCache(),this.graph.on("changed",this.handleGraphChanged)}stopAutoCache(){this.graph.off("changed",this.handleGraphChanged)}handleGraphChanged=t=>{const e=new Set;t.changes.forEach((r=>{switch(r.type){case"NodeAdded":case"NodeRemoved":e.add(r.value.id);break;case"NodeDataUpdated":e.add(r.id);break;case"EdgeAdded":case"EdgeRemoved":e.add(r.value.source),e.add(r.value.target);break;case"EdgeUpdated":"source"!==r.propertyName&&"target"!==r.propertyName||(e.add(r.oldValue),e.add(r.newValue));break;case"EdgeDataUpdated":if(t.graph.hasEdge(r.id)){const n=t.graph.getEdge(r.id);e.add(n.source),e.add(n.target)}}})),this.updateCache(e)};checkNodeExistence(t){this.getNode(t)}hasNode(t){if(!this.graph.hasNode(t))return!1;const e=this.graph.getNode(t);return this.nodeFilter(e)}areNeighbors(t,e){return this.checkNodeExistence(t),this.getNeighbors(e).some((e=>e.id===t))}getNode(t){const e=this.graph.getNode(t);if(!this.nodeFilter(e))throw new Error("Node not found for id: "+t);return e}getRelatedEdges(t,e){return this.checkNodeExistence(t),this.cacheEnabled?"in"===e?this.inEdgesMap.get(t):"out"===e?this.outEdgesMap.get(t):this.bothEdgesMap.get(t):this.graph.getRelatedEdges(t,e).filter(this.edgeFilter)}getDegree(t,e){return this.getRelatedEdges(t,e).length}getSuccessors(t){const e=this.getRelatedEdges(t,"out").map((t=>this.getNode(t.target)));return Array.from(new Set(e))}getPredecessors(t){const e=this.getRelatedEdges(t,"in").map((t=>this.getNode(t.source)));return Array.from(new Set(e))}getNeighbors(t){const e=this.getPredecessors(t),r=this.getSuccessors(t);return Array.from(new Set([...e,...r]))}hasEdge(t){if(!this.graph.hasEdge(t))return!1;const e=this.graph.getEdge(t);return this.edgeFilter(e)}getEdge(t){const e=this.graph.getEdge(t);if(!this.edgeFilter(e))throw new Error("Edge not found for id: "+t);return e}getEdgeDetail(t){const e=this.getEdge(t);return{edge:e,source:this.getNode(e.source),target:this.getNode(e.target)}}hasTreeStructure(t){return this.graph.hasTreeStructure(t)}getRoots(t){return this.graph.getRoots(t).filter(this.nodeFilter)}getChildren(t,e){return this.checkNodeExistence(t),this.graph.getChildren(t,e).filter(this.nodeFilter)}getParent(t,e){this.checkNodeExistence(t);const r=this.graph.getParent(t,e);return r&&this.nodeFilter(r)?r:null}getAllNodes(){return this.cacheEnabled?Array.from(this.allNodesMap.values()):this.graph.getAllNodes().filter(this.nodeFilter)}getAllEdges(){return this.cacheEnabled?Array.from(this.allEdgesMap.values()):this.graph.getAllEdges().filter(this.edgeFilter)}bfs(t,e,r="out"){const n={in:this.getPredecessors.bind(this),out:this.getSuccessors.bind(this),both:this.getNeighbors.bind(this)}[r];o([this.getNode(t)],new Set,e,n)}dfs(t,e,r="out"){const n={in:this.getPredecessors.bind(this),out:this.getSuccessors.bind(this),both:this.getNeighbors.bind(this)}[r];i(this.getNode(t),new Set,e,n)}}class u extends e{nodeMap=new Map;edgeMap=new Map;inEdgesMap=new Map;outEdgesMap=new Map;bothEdgesMap=new Map;treeIndices=new Map;changes=[];batchCount=0;onChanged=()=>{};constructor(t){super(),t&&(t.nodes&&this.addNodes(t.nodes),t.edges&&this.addEdges(t.edges),t.tree&&this.addTree(t.tree),t.onChanged&&(this.onChanged=t.onChanged))}batch=t=>{this.batchCount+=1,t(),this.batchCount-=1,this.batchCount||this.commit()};commit(){const t=this.changes;this.changes=[];const e={graph:this,changes:t};this.emit("changed",e),this.onChanged(e)}reduceChanges(t){let e=[];return t.forEach((t=>{switch(t.type){case"NodeRemoved":{let r=!1;e=e.filter((e=>{if("NodeAdded"===e.type){const n=e.value.id===t.value.id;return n&&(r=!0),!n}return"NodeDataUpdated"===e.type?e.id!==t.value.id:"TreeStructureChanged"!==e.type||e.nodeId!==t.value.id})),r||e.push(t);break}case"EdgeRemoved":{let r=!1;e=e.filter((e=>{if("EdgeAdded"===e.type){const n=e.value.id===t.value.id;return n&&(r=!0),!n}return"EdgeDataUpdated"!==e.type&&"EdgeUpdated"!==e.type||e.id!==t.value.id})),r||e.push(t);break}case"NodeDataUpdated":case"EdgeDataUpdated":case"EdgeUpdated":{const r=e.findIndex((e=>e.type===t.type&&e.id===t.id&&(void 0===t.propertyName||e.propertyName===t.propertyName))),n=e[r];n?void 0!==t.propertyName?n.newValue=t.newValue:(e.splice(r,1),e.push(t)):e.push(t);break}case"TreeStructureDetached":e=e.filter((e=>"TreeStructureAttached"===e.type?e.treeKey!==t.treeKey:"TreeStructureChanged"!==e.type||e.treeKey!==t.treeKey)),e.push(t);break;case"TreeStructureChanged":{const r=e.find((e=>"TreeStructureChanged"===e.type&&e.treeKey===t.treeKey&&e.nodeId===t.nodeId));r?r.newParentId=t.newParentId:e.push(t);break}default:e.push(t)}})),e}checkNodeExistence(t){this.getNode(t)}hasNode(t){return this.nodeMap.has(t)}areNeighbors(t,e){return this.getNeighbors(e).some((e=>e.id===t))}getNode(t){const e=this.nodeMap.get(t);if(!e)throw new Error("Node not found for id: "+t);return e}getRelatedEdges(t,e){if(this.checkNodeExistence(t),"in"===e){const e=this.inEdgesMap.get(t);return Array.from(e)}if("out"===e){const e=this.outEdgesMap.get(t);return Array.from(e)}{const e=this.bothEdgesMap.get(t);return Array.from(e)}}getDegree(t,e){return this.getRelatedEdges(t,e).length}getSuccessors(t){const e=this.getRelatedEdges(t,"out").map((t=>this.getNode(t.target)));return Array.from(new Set(e))}getPredecessors(t){const e=this.getRelatedEdges(t,"in").map((t=>this.getNode(t.source)));return Array.from(new Set(e))}getNeighbors(t){const e=this.getPredecessors(t),r=this.getSuccessors(t);return Array.from(new Set([...e,...r]))}doAddNode(t){if(this.hasNode(t.id))throw new Error("Node already exists: "+t.id);this.nodeMap.set(t.id,t),this.inEdgesMap.set(t.id,new Set),this.outEdgesMap.set(t.id,new Set),this.bothEdgesMap.set(t.id,new Set),this.treeIndices.forEach((e=>{e.childrenMap.set(t.id,new Set)})),this.changes.push({type:"NodeAdded",value:t})}addNodes(t){this.batch((()=>{for(const e of t)this.doAddNode(e)}))}addNode(t){this.addNodes([t])}doRemoveNode(t){const e=this.getNode(t),r=this.bothEdgesMap.get(t);r?.forEach((t=>this.doRemoveEdge(t.id))),this.nodeMap.delete(t),this.treeIndices.forEach((r=>{r.childrenMap.get(t)?.forEach((t=>{r.parentMap.delete(t.id)}));const n=r.parentMap.get(t);n&&r.childrenMap.get(n.id)?.delete(e),r.parentMap.delete(t),r.childrenMap.delete(t)})),this.bothEdgesMap.delete(t),this.inEdgesMap.delete(t),this.outEdgesMap.delete(t),this.changes.push({type:"NodeRemoved",value:e})}removeNodes(t){this.batch((()=>{t.forEach((t=>this.doRemoveNode(t)))}))}removeNode(t){this.removeNodes([t])}updateNodeDataProperty(t,e,r){const n=this.getNode(t);this.batch((()=>{const o=n.data[e],i=r;n.data[e]=i,this.changes.push({type:"NodeDataUpdated",id:t,propertyName:e,oldValue:o,newValue:i})}))}mergeNodeData(t,e){this.batch((()=>{Object.entries(e).forEach((([e,r])=>{this.updateNodeDataProperty(t,e,r)}))}))}updateNodeData(...t){const e=t[0],r=this.getNode(e);if("string"==typeof t[1])return void this.updateNodeDataProperty(e,t[1],t[2]);let n;if("function"==typeof t[1]){const e=t[1];n=e(r.data)}else"object"==typeof t[1]&&(n=t[1]);this.batch((()=>{const t=r.data,o=n;r.data=n,this.changes.push({type:"NodeDataUpdated",id:e,oldValue:t,newValue:o})}))}checkEdgeExistence(t){if(!this.hasEdge(t))throw new Error("Edge not found for id: "+t)}hasEdge(t){return this.edgeMap.has(t)}getEdge(t){return this.checkEdgeExistence(t),this.edgeMap.get(t)}getEdgeDetail(t){const e=this.getEdge(t);return{edge:e,source:this.getNode(e.source),target:this.getNode(e.target)}}doAddEdge(t){if(this.hasEdge(t.id))throw new Error("Edge already exists: "+t.id);this.checkNodeExistence(t.source),this.checkNodeExistence(t.target),this.edgeMap.set(t.id,t);const e=this.inEdgesMap.get(t.target),r=this.outEdgesMap.get(t.source),n=this.bothEdgesMap.get(t.source),o=this.bothEdgesMap.get(t.target);e.add(t),r.add(t),n.add(t),o.add(t),this.changes.push({type:"EdgeAdded",value:t})}addEdges(t){this.batch((()=>{for(const e of t)this.doAddEdge(e)}))}addEdge(t){this.addEdges([t])}doRemoveEdge(t){const e=this.getEdge(t),r=this.outEdgesMap.get(e.source),n=this.inEdgesMap.get(e.target),o=this.bothEdgesMap.get(e.source),i=this.bothEdgesMap.get(e.target);r.delete(e),n.delete(e),o.delete(e),i.delete(e),this.edgeMap.delete(t),this.changes.push({type:"EdgeRemoved",value:e})}removeEdges(t){this.batch((()=>{t.forEach((t=>this.doRemoveEdge(t)))}))}removeEdge(t){this.removeEdges([t])}updateEdgeSource(t,e){const r=this.getEdge(t);this.checkNodeExistence(e);const n=r.source,o=e;this.outEdgesMap.get(n).delete(r),this.bothEdgesMap.get(n).delete(r),this.outEdgesMap.get(o).add(r),this.bothEdgesMap.get(o).add(r),r.source=e,this.batch((()=>{this.changes.push({type:"EdgeUpdated",id:t,propertyName:"source",oldValue:n,newValue:o})}))}updateEdgeTarget(t,e){const r=this.getEdge(t);this.checkNodeExistence(e);const n=r.target,o=e;this.inEdgesMap.get(n).delete(r),this.bothEdgesMap.get(n).delete(r),this.inEdgesMap.get(o).add(r),this.bothEdgesMap.get(o).add(r),r.target=e,this.batch((()=>{this.changes.push({type:"EdgeUpdated",id:t,propertyName:"target",oldValue:n,newValue:o})}))}updateEdgeDataProperty(t,e,r){const n=this.getEdge(t);this.batch((()=>{const o=n.data[e],i=r;n.data[e]=i,this.changes.push({type:"EdgeDataUpdated",id:t,propertyName:e,oldValue:o,newValue:i})}))}updateEdgeData(...t){const e=t[0],r=this.getEdge(e);if("string"==typeof t[1])return void this.updateEdgeDataProperty(e,t[1],t[2]);let n;if("function"==typeof t[1]){const e=t[1];n=e(r.data)}else"object"==typeof t[1]&&(n=t[1]);this.batch((()=>{const t=r.data,o=n;r.data=n,this.changes.push({type:"EdgeDataUpdated",id:e,oldValue:t,newValue:o})}))}mergeEdgeData(t,e){this.batch((()=>{Object.entries(e).forEach((([e,r])=>{this.updateEdgeDataProperty(t,e,r)}))}))}checkTreeExistence(t){if(!this.hasTreeStructure(t))throw new Error("Tree structure not found for treeKey: "+t)}hasTreeStructure(t){return this.treeIndices.has(t)}attachTreeStructure(t){this.treeIndices.has(t)||(this.treeIndices.set(t,{parentMap:new Map,childrenMap:new Map}),this.batch((()=>{this.changes.push({type:"TreeStructureAttached",treeKey:t})})))}detachTreeStructure(t){this.checkTreeExistence(t),this.treeIndices.delete(t),this.batch((()=>{this.changes.push({type:"TreeStructureDetached",treeKey:t})}))}addTree(t,e){this.batch((()=>{this.attachTreeStructure(e);const r=[],n=Array.isArray(t)?t:[t];for(;n.length;){const t=n.shift();r.push(t),t.children&&n.push(...t.children)}this.addNodes(r),r.forEach((t=>{t.children?.forEach((r=>{this.setParent(r.id,t.id,e)}))}))}))}getRoots(t){return this.checkTreeExistence(t),this.getAllNodes().filter((e=>!this.getParent(e.id,t)))}getChildren(t,e){this.checkNodeExistence(t),this.checkTreeExistence(e);const r=this.treeIndices.get(e).childrenMap.get(t);return Array.from(r||[])}getParent(t,e){return this.checkNodeExistence(t),this.checkTreeExistence(e),this.treeIndices.get(e).parentMap.get(t)||null}getAncestors(t,e){const r=[];let n,o=this.getNode(t);for(;n=this.getParent(o.id,e);)r.push(n),o=n;return r}setParent(t,e,r){this.checkTreeExistence(r);const n=this.treeIndices.get(r),o=this.getNode(t),i=n.parentMap.get(t);if(i?.id===e)return;if(void 0===e)return i&&n.childrenMap.get(i.id)?.delete(o),void n.parentMap.delete(t);const s=this.getNode(e);n.parentMap.set(t,s),i&&n.childrenMap.get(i.id)?.delete(o);let a=n.childrenMap.get(s.id);a||(a=new Set,n.childrenMap.set(s.id,a)),a.add(o),this.batch((()=>{this.changes.push({type:"TreeStructureChanged",treeKey:r,nodeId:t,oldParentId:i?.id,newParentId:s.id})}))}dfsTree(t,e,r){return i(this.getNode(t),new Set,e,(t=>this.getChildren(t,r)))}bfsTree(t,e,r){return o([this.getNode(t)],new Set,e,(t=>this.getChildren(t,r)))}getAllNodes(){return Array.from(this.nodeMap.values())}getAllEdges(){return Array.from(this.edgeMap.values())}bfs(t,e,r="out"){const n={in:this.getPredecessors.bind(this),out:this.getSuccessors.bind(this),both:this.getNeighbors.bind(this)}[r];return o([this.getNode(t)],new Set,e,n)}dfs(t,e,r="out"){const n={in:this.getPredecessors.bind(this),out:this.getSuccessors.bind(this),both:this.getNeighbors.bind(this)}[r];return i(this.getNode(t),new Set,e,n)}clone(){const t=this.getAllNodes().map((t=>({...t,data:{...t.data}}))),e=this.getAllEdges().map((t=>({...t,data:{...t.data}}))),r=new u({nodes:t,edges:e});return this.treeIndices.forEach((({parentMap:t,childrenMap:e},n)=>{const o=new Map;t.forEach(((t,e)=>{o.set(e,r.getNode(t.id))}));const i=new Map;e.forEach(((t,e)=>{i.set(e,new Set(Array.from(t).map((t=>r.getNode(t.id)))))})),r.treeIndices.set(n,{parentMap:o,childrenMap:i})})),r}toJSON(){return JSON.stringify({nodes:this.getAllNodes(),edges:this.getAllEdges()})}createView(t){return new a({graph:this,...t})}}var d={}.toString;const h=function(t,e){return d.call(t)==="[object "+e+"]"},c=function(t){return h(t,"Number")},l=(t,e)=>{if("next"!==t&&"prev"!==t)return e},f=t=>{t.prev.next=t.next,t.next.prev=t.prev,delete t.next,delete t.prev};class g{constructor(){const t={};t.prev=t,t.next=t.prev,this.shortcut=t}dequeue(){const t=this.shortcut,e=t.prev;if(e&&e!==t)return f(e),e}enqueue(t){const e=this.shortcut;t.prev&&t.next&&f(t),t.next=e.next,e.next.prev=t,e.next=t,t.prev=e}toString(){const t=[],e=this.shortcut;let r=e.prev;for(;r!==e;)t.push(JSON.stringify(r,l)),r=null==r?void 0:r.prev;return`[${t.join(", ")}]`}}class p extends g{}const v=()=>1,y=(t,e,r,n,o)=>{var i,s;const a=[];return t.hasNode(n.v)&&(null===(i=t.getRelatedEdges(n.v,"in"))||void 0===i||i.forEach((n=>{const i=n.data.weight,s=t.getNode(n.source);o&&a.push({v:n.source,w:n.target,in:0,out:0}),void 0===s.data.out&&(s.data.out=0),s.data.out-=i,m(e,r,Object.assign({v:s.id},s.data))})),null===(s=t.getRelatedEdges(n.v,"out"))||void 0===s||s.forEach((n=>{const o=n.data.weight,i=n.target,s=t.getNode(i);void 0===s.data.in&&(s.data.in=0),s.data.in-=o,m(e,r,Object.assign({v:s.id},s.data))})),t.removeNode(n.v)),o?a:void 0},m=(t,e,r)=>{r.out?r.in?t[r.out-r.in+e].enqueue(r):t[t.length-1].enqueue(r):t[0].enqueue(r)},w=(t,e)=>{const r="greedy"===e?(t=>{var e;if(t.getAllNodes().length<=1)return[];const r=((t,e)=>{const r=new u;let n=0,o=0;t.getAllNodes().forEach((t=>{r.addNode({id:t.id,data:{v:t.id,in:0,out:0}})})),t.getAllEdges().forEach((t=>{const i=r.getRelatedEdges(t.source,"out").find((e=>e.target===t.target)),s=(null==e?void 0:e(t))||1;i?r.updateEdgeData(null==i?void 0:i.id,Object.assign(Object.assign({},i.data),{weight:i.data.weight+s})):r.addEdge({id:t.id,source:t.source,target:t.target,data:{weight:s}}),o=Math.max(o,r.getNode(t.source).data.out+=s),n=Math.max(n,r.getNode(t.target).data.in+=s)}));const i=[],s=o+n+3;for(let t=0;t<s;t++)i.push(new p);const a=n+1;return r.getAllNodes().forEach((t=>{m(i,a,Object.assign({v:t.id},r.getNode(t.id).data))})),{buckets:i,zeroIdx:a,graph:r}})(t,(t=>t.data.weight||1)||v);return null===(e=((t,e,r)=>{let n=[];const o=e[e.length-1],i=e[0];let s;for(;t.getAllNodes().length;){for(;s=i.dequeue();)y(t,e,r,s);for(;s=o.dequeue();)y(t,e,r,s);if(t.getAllNodes().length)for(let o=e.length-2;o>0;--o)if(s=e[o].dequeue(),s){n=n.concat(y(t,e,r,s,!0));break}}return n})(r.graph,r.buckets,r.zeroIdx).map((e=>t.getRelatedEdges(e.v,"out").filter((({target:t})=>t===e.w)))))||void 0===e?void 0:e.flat()})(t):x(t);null==r||r.forEach((e=>{const r=e.data;t.removeEdge(e.id),r.forwardName=e.data.name,r.reversed=!0,t.addEdge({id:e.id,source:e.target,target:e.source,data:Object.assign({},r)})}))},x=t=>{const e=[],r={},n={},o=i=>{n[i]||(n[i]=!0,r[i]=!0,t.getRelatedEdges(i,"out").forEach((t=>{r[t.target]?e.push(t):o(t.target)})),delete r[i])};return t.getAllNodes().forEach((t=>o(t.id))),e},b=(t,e,r,n)=>{let o;do{o=`${n}${Math.random()}`}while(t.hasNode(o));return r.dummy=e,t.addNode({id:o,data:r}),o},E=t=>{const e=new u;return t.getAllNodes().forEach((r=>{t.getChildren(r.id).length||e.addNode(Object.assign({},r))})),t.getAllEdges().forEach((t=>{e.addEdge(t)})),e},N=(t,e)=>{const r=Number(t.x),n=Number(t.y),o=Number(e.x)-r,i=Number(e.y)-n;let s,a,u=Number(t.width)/2,d=Number(t.height)/2;return o||i?(Math.abs(i)*u>Math.abs(o)*d?(i<0&&(d=-d),s=d*o/i,a=d):(o<0&&(u=-u),s=u,a=u*i/o),{x:r+s,y:n+a}):{x:0,y:0}},_=t=>{const e=[],r=k(t)+1;for(let t=0;t<r;t++)e.push([]);t.getAllNodes().forEach((t=>{const r=t.data.rank;void 0!==r&&e[r]&&e[r].push(t.id)}));for(let n=0;n<r;n++)e[n]=e[n].sort(((e,r)=>{return n=t.getNode(e).data.order,o=t.getNode(r).data.order,Number(n)-Number(o);var n,o}));return e},M=(t,e,r,n)=>{const o={width:0,height:0};return c(r)&&c(n)&&(o.rank=r,o.order=n),b(t,"border",o,e)},k=t=>{let e;return t.getAllNodes().forEach((t=>{const r=t.data.rank;void 0!==r&&(void 0===e||r>e)&&(e=r)})),e||(e=0),e},A=(t,e)=>t.reduce(((t,r)=>e(t)>e(r)?r:t)),j=(t,e,r,n,o,i)=>{n.includes(e.id)||(n.push(e.id),r||i.push(e.id),o(e.id).forEach((e=>j(t,e,r,n,o,i))),r&&i.push(e.id))},O=(t,e,r,n)=>{const o=Array.isArray(e)?e:[e],i=e=>n?t.getSuccessors(e):t.getNeighbors(e),s=[],a=[];return o.forEach((e=>{if(!t.hasNode(e.id))throw new Error(`Graph does not have node: ${e}`);j(t,e,"post"===r,a,i,s)})),s},S=(t,e,r,n,o,i)=>{const s={rank:i,borderType:e,width:0,height:0},a=o.data[e][i-1],u=b(t,"border",s,r);o.data[e][i]=u,t.setParent(u,n),a&&t.addEdge({id:`e${Math.random()}`,source:a,target:u,data:{weight:1}})},z=t=>{t.getAllNodes().forEach((t=>{R(t)})),t.getAllEdges().forEach((t=>{R(t)}))},R=t=>{const e=t.data.width;t.data.width=t.data.height,t.data.height=e},I=t=>{(null==t?void 0:t.y)&&(t.y=-t.y)},P=t=>{const e=t.x;t.x=t.y,t.y=e},C=(t,e,r,n,o,i,s)=>{const a=t.getChildren(s);if(!(null==a?void 0:a.length))return void(s!==e&&t.addEdge({id:`e${Math.random()}`,source:e,target:s,data:{weight:0,minlen:r}}));const u=M(t,"_bt"),d=M(t,"_bb"),h=t.getNode(s);t.setParent(u,s),h.data.borderTop=u,t.setParent(d,s),h.data.borderBottom=d,null==a||a.forEach((a=>{C(t,e,r,n,o,i,a.id);const h=a.data.borderTop?a.data.borderTop:a.id,c=a.data.borderBottom?a.data.borderBottom:a.id,l=a.data.borderTop?n:2*n,f=h!==c?1:o-i[s]+1;t.addEdge({id:`e${Math.random()}`,source:u,target:h,data:{minlen:f,weight:l,nestingEdge:!0}}),t.addEdge({id:`e${Math.random()}`,source:c,target:d,data:{minlen:f,weight:l,nestingEdge:!0}})})),t.getParent(s)||t.addEdge({id:`e${Math.random()}`,source:e,target:u,data:{weight:0,minlen:o+i[s]}})},D="edge-label",T=function(t){return Array.isArray?Array.isArray(t):h(t,"Array")};var L=function(t){if("object"!=typeof t||null===t)return t;var e;if(T(t)){e=[];for(var r=0,n=t.length;r<n;r++)"object"==typeof t[r]&&null!=t[r]?e[r]=L(t[r]):e[r]=t[r]}else for(var o in e={},t)"object"==typeof t[o]&&null!=t[o]?e[o]=L(t[o]):e[o]=t[o];return e};const F=L,q=(t,e,r)=>{const n=(i=r,s=r.map(((t,e)=>e)),null==i?void 0:i.reduce(((t,e,r)=>(t[e]=s[r],t)),{})),o=e.map((e=>{const r=t.getRelatedEdges(e,"out").map((t=>({pos:n[t.target]||0,weight:t.data.weight})));return null==r?void 0:r.sort(((t,e)=>t.pos-e.pos))})).flat().filter((t=>void 0!==t));var i,s;let a=1;for(;a<r.length;)a<<=1;const u=2*a-1;a-=1;const d=Array(u).fill(0,0,u);let h=0;return null==o||o.forEach((t=>{if(t){let e=t.pos+a;d[e]+=t.weight;let r=0;for(;e>0;)e%2&&(r+=d[e+1]),e=e-1>>1,d[e]+=t.weight;h+=t.weight*r}})),h},V=(t,e)=>{let r=0;for(let n=1;n<(null==e?void 0:e.length);n+=1)r+=q(t,e[n-1],e[n]);return r},B=t=>{const e={},r=t.getAllNodes(),n=r.map((t=>{var e;return null!==(e=t.data.rank)&&void 0!==e?e:-1/0})),o=Math.max(...n),i=[];for(let t=0;t<o+1;t++)i.push([]);const s=r.sort(((e,r)=>t.getNode(e.id).data.rank-t.getNode(r.id).data.rank)),a=s.filter((e=>void 0!==t.getNode(e.id).data.fixorder)).sort(((e,r)=>t.getNode(e.id).data.fixorder-t.getNode(r.id).data.fixorder));return null==a||a.forEach((r=>{isNaN(t.getNode(r.id).data.rank)||i[t.getNode(r.id).data.rank].push(r.id),e[r.id]=!0})),null==s||s.forEach((r=>t.dfsTree(r.id,(t=>{if(e.hasOwnProperty(t.id))return!0;e[t.id]=!0,isNaN(t.data.rank)||i[t.data.rank].push(t.id)})))),i},$=(t,e)=>{var r;let n=0,o=0;t.weight&&(n+=t.barycenter*t.weight,o+=t.weight),e.weight&&(n+=e.barycenter*e.weight,o+=e.weight),t.vs=null===(r=e.vs)||void 0===r?void 0:r.concat(t.vs),t.barycenter=n/o,t.weight=o,t.i=Math.min(e.i,t.i),e.merged=!0},G=(t,e)=>{var r,n,o;const i={};null==t||t.forEach(((t,e)=>{i[t.v]={i:e,indegree:0,in:[],out:[],vs:[t.v]};const r=i[t.v];void 0!==t.barycenter&&(r.barycenter=t.barycenter,r.weight=t.weight)})),null===(r=e.getAllEdges())||void 0===r||r.forEach((t=>{const e=i[t.source],r=i[t.target];void 0!==e&&void 0!==r&&(r.indegree++,e.out.push(i[t.target]))}));return(t=>{var e,r;const n=[];for(;null==t?void 0:t.length;){const o=t.pop();n.push(o),null===(e=o.in.reverse())||void 0===e||e.forEach((t=>{return(e=o,t=>{t.merged||(void 0===t.barycenter||void 0===e.barycenter||t.barycenter>=e.barycenter)&&$(e,t)})(t);var e})),null===(r=o.out)||void 0===r||r.forEach((e=>{return(r=o,e=>{e.in.push(r),0==--e.indegree&&t.push(e)})(e);var r}))}const o=n.filter((t=>!t.merged)),i=["vs","i","barycenter","weight"];return o.map((t=>{const e={};return null==i||i.forEach((r=>{void 0!==t[r]&&(e[r]=t[r])})),e}))})(null===(o=(n=Object.values(i)).filter)||void 0===o?void 0:o.call(n,(t=>!t.indegree)))},U=(t,e,r)=>{let n,o=r;for(;e.length&&(n=e[e.length-1]).i<=o;)e.pop(),null==t||t.push(n.vs),o++;return o},W=(t,e,r,n,o,i)=>{var s,a,u,d;let h=t.getChildren(e).map((t=>t.id));const c=t.getNode(e),l=c?c.data.borderLeft:void 0,f=c?c.data.borderRight:void 0,g={};l&&(h=null==h?void 0:h.filter((t=>t!==l&&t!==f)));const p=((t,e)=>e.map((e=>{const r=t.getRelatedEdges(e,"in");if(!(null==r?void 0:r.length))return{v:e};const n={sum:0,weight:0};return null==r||r.forEach((e=>{const r=t.getNode(e.source);n.sum+=e.data.weight*r.data.order,n.weight+=e.data.weight})),{v:e,barycenter:n.sum/n.weight,weight:n.weight}})))(t,h||[]);null==p||p.forEach((e=>{var o;if(null===(o=t.getChildren(e.v))||void 0===o?void 0:o.length){const o=W(t,e.v,r,n,i);g[e.v]=o,o.hasOwnProperty("barycenter")&&H(e,o)}}));const v=G(p,r);Y(v,g),null===(s=v.filter((t=>t.vs.length>0)))||void 0===s||s.forEach((e=>{const r=t.getNode(e.vs[0]);r&&(e.fixorder=r.data.fixorder,e.order=r.data.order)}));const y=((t,e,r,n)=>{const o=(t=>{const e={lhs:[],rhs:[]};return null==t||t.forEach((t=>{(t=>{const e=t.hasOwnProperty("fixorder")&&!isNaN(t.fixorder);return n?!e&&t.hasOwnProperty("barycenter"):e||t.hasOwnProperty("barycenter")})(t)?e.lhs.push(t):e.rhs.push(t)})),e})(t),i=o.lhs,s=o.rhs.sort(((t,e)=>-t.i- -e.i)),a=[];let u=0,d=0,h=0;null==i||i.sort(((t,e)=>(r,n)=>{if(void 0!==r.fixorder&&void 0!==n.fixorder)return r.fixorder-n.fixorder;if(r.barycenter<n.barycenter)return-1;if(r.barycenter>n.barycenter)return 1;if(e&&void 0!==r.order&&void 0!==n.order){if(r.order<n.order)return-1;if(r.order>n.order)return 1}return t?n.i-r.i:r.i-n.i})(!!e,!!r)),h=U(a,s,h),null==i||i.forEach((t=>{var e;h+=null===(e=t.vs)||void 0===e?void 0:e.length,a.push(t.vs),u+=t.barycenter*t.weight,d+=t.weight,h=U(a,s,h)}));const c={vs:a.flat()};return d&&(c.barycenter=u/d,c.weight=d),c})(v,n,o,i);if(l&&(y.vs=[l,y.vs,f].flat(),null===(a=t.getPredecessors(l))||void 0===a?void 0:a.length)){const e=t.getNode((null===(u=t.getPredecessors(l))||void 0===u?void 0:u[0].id)||""),r=t.getNode((null===(d=t.getPredecessors(f))||void 0===d?void 0:d[0].id)||"");y.hasOwnProperty("barycenter")||(y.barycenter=0,y.weight=0),y.barycenter=(y.barycenter*y.weight+e.data.order+r.data.order)/(y.weight+2),y.weight+=2}return y},Y=(t,e)=>{null==t||t.forEach((t=>{var r;const n=null===(r=t.vs)||void 0===r?void 0:r.map((t=>e[t]?e[t].vs:t));t.vs=n.flat()}))},H=(t,e)=>{void 0!==t.barycenter?(t.barycenter=(t.barycenter*t.weight+e.barycenter*e.weight)/(t.weight+e.weight),t.weight+=e.weight):(t.barycenter=e.barycenter,t.weight=e.weight)},K=(t,e,r)=>e.map((e=>((t,e,r)=>{const n=(t=>{let e;for(;t.hasNode(e=`_root${Math.random()}`););return e})(t),o=new u({tree:[{id:n,children:[],data:{}}]});return t.getAllNodes().forEach((i=>{const s=t.getParent(i.id);(i.data.rank===e||i.data.minRank<=e&&e<=i.data.maxRank)&&(o.hasNode(i.id)||o.addNode(Object.assign({},i)),(null==s?void 0:s.id)&&!o.hasNode(null==s?void 0:s.id)&&o.addNode(Object.assign({},s)),o.setParent(i.id,(null==s?void 0:s.id)||n),t.getRelatedEdges(i.id,r).forEach((e=>{const r=e.source===i.id?e.target:e.source;o.hasNode(r)||o.addNode(Object.assign({},t.getNode(r)));const n=o.getRelatedEdges(r,"out").find((({target:t})=>t===i.id)),s=void 0!==n?n.data.weight:0;n?o.updateEdgeData(n.id,Object.assign(Object.assign({},n.data),{weight:e.data.weight+s})):o.addEdge({id:e.id,source:r,target:i.id,data:{weight:e.data.weight+s}})})),i.data.hasOwnProperty("minRank")&&o.updateNodeData(i.id,Object.assign(Object.assign({},i.data),{borderLeft:i.data.borderLeft[e],borderRight:i.data.borderRight[e]})))})),o})(t,e,r))),J=(t,e,r,n)=>{const o=new u;null==t||t.forEach((t=>{var i;const s=t.getRoots()[0].id,a=W(t,s,o,e,r,n);for(let e=0;e<(null===(i=a.vs)||void 0===i?void 0:i.length);e++){const r=t.getNode(a.vs[e]);r&&(r.data.order=e)}((t,e,r)=>{const n={};let o;null==r||r.forEach((r=>{let i,s,a=t.getParent(r);for(;a;){if(i=t.getParent(a.id),i?(s=n[i.id],n[i.id]=a.id):(s=o,o=a.id),s&&s!==a.id)return e.hasNode(s)||e.addNode({id:s,data:{}}),e.hasNode(a.id)||e.addNode({id:a.id,data:{}}),void(e.hasEdge(`e${s}-${a.id}`)||e.addEdge({id:`e${s}-${a.id}`,source:s,target:a.id,data:{}}));a=i}}))})(t,o,a.vs)}))},X=(t,e)=>{null==e||e.forEach((e=>{null==e||e.forEach(((e,r)=>{t.getNode(e).data.order=r}))}))},Q=(t,e)=>{var r,n;if(null===(r=t.getNode(e))||void 0===r?void 0:r.data.dummy)return null===(n=t.getPredecessors(e))||void 0===n?void 0:n.find((e=>t.getNode(e.id).data.dummy))},Z=(t,e,r)=>{let n=e,o=r;if(n>o){const t=n;n=o,o=t}let i=t[n];i||(t[n]=i={}),i[o]=!0},tt=(t,e,r)=>{let n=e,o=r;return n>r&&(n=r,o=e),!!t[n]},et=(t,e,r,n,o,i)=>{const s=new u,a=rt(n,o,i);return null==e||e.forEach((e=>{let n;null==e||e.forEach((e=>{const o=r[e];if(s.hasNode(o)||s.addNode({id:o,data:{}}),n){const i=r[n],u=s.getRelatedEdges(i,"out").find((t=>t.target===o));u?s.updateEdgeData(u.id,Object.assign(Object.assign({},u.data),{weight:Math.max(a(t,e,n),u.data.weight||0)})):s.addEdge({id:`e${Math.random()}`,source:i,target:o,data:{weight:Math.max(a(t,e,n),0)}})}n=e}))})),s};const rt=(t,e,r)=>(n,o,i)=>{const s=n.getNode(o),a=n.getNode(i);let u=0,d=0;if(u+=s.data.width/2,s.data.hasOwnProperty("labelpos"))switch((s.data.labelpos||"").toLowerCase()){case"l":d=-s.data.width/2;break;case"r":d=s.data.width/2}if(d&&(u+=r?d:-d),d=0,u+=(s.data.dummy?e:t)/2,u+=(a.data.dummy?e:t)/2,u+=a.data.width/2,a.data.labelpos)switch((a.data.labelpos||"").toLowerCase()){case"l":d=a.data.width/2;break;case"r":d=-a.data.width/2}return d&&(u+=r?d:-d),d=0,u},nt=(t,e)=>t.getNode(e).data.width||0,ot=(t,e)=>{var r;const n=E(t);((t,e)=>{const{ranksep:r=0}=e||{},n=_(t);let o=0;null==n||n.forEach((e=>{const n=e.map((e=>t.getNode(e).data.height)),i=Math.max(...n,0);null==e||e.forEach((e=>{t.getNode(e).data.y=o+i/2})),o+=i+r}))})(n,e);const o=((t,e)=>{const{align:r,nodesep:n=0,edgesep:o=0}=e||{},i=_(t),s=Object.assign(((t,e)=>{const r={};return(null==e?void 0:e.length)&&e.reduce(((e,n)=>{let o=0,i=0;const s=e.length,a=null==n?void 0:n[(null==n?void 0:n.length)-1];return null==n||n.forEach(((e,u)=>{var d;const h=Q(t,e),c=h?t.getNode(h.id).data.order:s;(h||e===a)&&(null===(d=n.slice(i,u+1))||void 0===d||d.forEach((e=>{var n;null===(n=t.getPredecessors(e))||void 0===n||n.forEach((n=>{var i;const s=t.getNode(n.id),a=s.data.order;!(a<o||c<a)||s.data.dummy&&(null===(i=t.getNode(e))||void 0===i?void 0:i.data.dummy)||Z(r,n.id,e)}))})),i=u+1,o=c)})),n})),r})(t,i),((t,e)=>{const r={};function n(e,n){const o=function(t){return JSON.stringify(t.slice(1))}(e);n.get(o)||(function(e,n,o,i,s){var a,u;let d;for(let h=n;h<o;h++)d=e[h],(null===(a=t.getNode(d))||void 0===a?void 0:a.data.dummy)&&(null===(u=t.getPredecessors(d))||void 0===u||u.forEach((e=>{const n=t.getNode(e.id);n.data.dummy&&(n.data.order<i||n.data.order>s)&&Z(r,e.id,d)})))}(...e),n.set(o,!0))}return(null==e?void 0:e.length)&&e.reduce(((e,r)=>{let o,i=-1,s=0;const a=new Map;return null==r||r.forEach(((u,d)=>{var h;if("border"===(null===(h=t.getNode(u))||void 0===h?void 0:h.data.dummy)){const e=t.getPredecessors(u)||[];e.length&&(o=t.getNode(e[0].id).data.order,n([r,s,d,i,o],a),s=d,i=o)}n([r,s,r.length,o,e.length],a)})),r})),r})(t,i)),a={};let u=[];["u","d"].forEach((e=>{u="u"===e?i:Object.values(i).reverse(),["l","r"].forEach((r=>{"r"===r&&(u=u.map((t=>Object.values(t).reverse())));const i=("u"===e?t.getPredecessors:t.getSuccessors).bind(t),d=((t,e,r,n)=>{const o={},i={},s={};return null==e||e.forEach((t=>{null==t||t.forEach(((t,e)=>{o[t]=t,i[t]=t,s[t]=e}))})),null==e||e.forEach((t=>{let e=-1;null==t||t.forEach((t=>{let a=n(t).map((t=>t.id));if(a.length){a=a.sort(((t,e)=>s[t]-s[e]));const n=(a.length-1)/2;for(let u=Math.floor(n),d=Math.ceil(n);u<=d;++u){const n=a[u];i[t]===t&&e<s[n]&&!tt(r,t,n)&&(i[n]=t,i[t]=o[t]=o[n],e=s[n])}}}))})),{root:o,align:i}})(0,u,s,i),h=((t,e,r,n,o,i,s)=>{var a;const u={},d=et(t,e,r,o,i,s),h=s?"borderLeft":"borderRight",c=(t,e)=>{let r=d.getAllNodes(),n=r.pop();const o={};for(;n;)o[n.id]?t(n.id):(o[n.id]=!0,r.push(n),r=r.concat(e(n.id))),n=r.pop()};return c((t=>{u[t]=(d.getRelatedEdges(t,"in")||[]).reduce(((t,e)=>Math.max(t,(u[e.source]||0)+e.data.weight)),0)}),d.getPredecessors.bind(d)),c((e=>{const r=(d.getRelatedEdges(e,"out")||[]).reduce(((t,e)=>Math.min(t,(u[e.target]||0)-e.data.weight)),Number.POSITIVE_INFINITY),n=t.getNode(e);r!==Number.POSITIVE_INFINITY&&n.data.borderType!==h&&(u[e]=Math.max(u[e],r))}),d.getSuccessors.bind(d)),null===(a=Object.values(n))||void 0===a||a.forEach((t=>{u[t]=u[r[t]]})),u})(t,u,d.root,d.align,n,o,"r"===r);"r"===r&&Object.keys(h).forEach((t=>h[t]=-h[t])),a[e+r]=h}))}));const d=((t,e)=>A(Object.values(e),(e=>{var r;let n=Number.NEGATIVE_INFINITY,o=Number.POSITIVE_INFINITY;return null===(r=Object.keys(e))||void 0===r||r.forEach((r=>{const i=e[r],s=nt(t,r)/2;n=Math.max(i+s,n),o=Math.min(i-s,o)})),n-o})))(t,a);return d&&function(t,e){const r=Object.values(e),n=Math.min(...r),o=Math.max(...r);["u","d"].forEach((r=>{["l","r"].forEach((i=>{const s=r+i,a=t[s];let u;if(a===e)return;const d=Object.values(a);u="l"===i?n-Math.min(...d):o-Math.max(...d),u&&(t[s]={},Object.keys(a).forEach((e=>{t[s][e]=a[e]+u})))}))}))}(a,d),((t,e)=>{const r={};return Object.keys(t.ul).forEach((n=>{if(e)r[n]=t[e.toLowerCase()][n];else{const e=Object.values(t).map((t=>t[n]));r[n]=(e[0]+e[1])/2}})),r})(a,r)})(n,e);null===(r=Object.keys(o))||void 0===r||r.forEach((t=>{n.getNode(t).data.x=o[t]}))},it=t=>{const e={},r=n=>{var o;const i=t.getNode(n);if(!i)return 0;if(e[n])return i.data.rank;let s;return e[n]=!0,null===(o=t.getRelatedEdges(n,"out"))||void 0===o||o.forEach((t=>{const e=r(t.target)-t.data.minlen;e&&(void 0===s||e<s)&&(s=e)})),s||(s=0),i.data.rank=s,s};t.getAllNodes().filter((e=>0===t.getRelatedEdges(e.id,"in").length)).forEach((t=>r(t.id)))},st=(t,e)=>t.getNode(e.target).data.rank-t.getNode(e.source).data.rank-e.data.minlen,at=(t,e)=>{const r=n=>{e.getRelatedEdges(n,"both").forEach((o=>{const i=o.source,s=n===i?o.target:i;t.hasNode(s)||st(e,o)||(t.addNode({id:s,data:{}}),t.addEdge({id:o.id,source:n,target:s,data:{}}),r(s))}))};return t.getAllNodes().forEach((t=>r(t.id))),t.getAllNodes().length},ut=(t,e)=>{const r=n=>{var o;null===(o=e.getRelatedEdges(n,"both"))||void 0===o||o.forEach((o=>{const i=o.source,s=n===i?o.target:i;t.hasNode(s)||void 0===e.getNode(s).data.layer&&st(e,o)||(t.addNode({id:s,data:{}}),t.addEdge({id:o.id,source:n,target:s,data:{}}),r(s))}))};return t.getAllNodes().forEach((t=>r(t.id))),t.getAllNodes().length},dt=(t,e)=>A(e.getAllEdges(),(r=>t.hasNode(r.source)!==t.hasNode(r.target)?st(e,r):1/0)),ht=(t,e,r)=>{t.getAllNodes().forEach((t=>{const n=e.getNode(t.id);n.data.rank||(n.data.rank=0),n.data.rank+=r}))},ct=(t,e)=>{let r=O(t,t.getAllNodes(),"post",!1);r=r.slice(0,(null==r?void 0:r.length)-1),r.forEach((r=>{lt(t,e,r)}))},lt=(t,e,r)=>{const n=t.getNode(r).data.parent;t.getRelatedEdges(r,"both").find((t=>t.target===n||t.source===n)).data.cutvalue=ft(t,e,r)},ft=(t,e,r)=>{const n=t.getNode(r).data.parent;let o=!0,i=e.getRelatedEdges(r,"out").find((t=>t.target===n)),s=0;return i||(o=!1,i=e.getRelatedEdges(n,"out").find((t=>t.target===r))),s=i.data.weight,e.getRelatedEdges(r,"both").forEach((e=>{const i=e.source===r,a=i?e.target:e.source;if(a!==n){const n=i===o,u=e.data.weight;if(s+=n?u:-u,xt(t,r,a)){const e=t.getRelatedEdges(r,"both").find((t=>t.source===a||t.target===a)).data.cutvalue;s+=n?-e:e}}})),s},gt=(t,e=t.getAllNodes()[0].id)=>{pt(t,{},1,e)},pt=(t,e,r,n,o)=>{var i;const s=r;let a=r;const u=t.getNode(n);return e[n]=!0,null===(i=t.getNeighbors(n))||void 0===i||i.forEach((r=>{e[r.id]||(a=pt(t,e,a,r.id,n))})),u.data.low=s,u.data.lim=a++,o?u.data.parent=o:delete u.data.parent,a},vt=t=>t.getAllEdges().find((t=>t.data.cutvalue<0)),yt=(t,e,r)=>{let n=r.source,o=r.target;e.getRelatedEdges(n,"out").find((t=>t.target===o))||(n=r.target,o=r.source);const i=t.getNode(n),s=t.getNode(o);let a=i,u=!1;i.data.lim>s.data.lim&&(a=s,u=!0);const d=e.getAllEdges().filter((e=>u===bt(t.getNode(e.source),a)&&u!==bt(t.getNode(e.target),a)));return A(d,(t=>st(e,t)))},mt=(t,e,r,n)=>{const o=t.getRelatedEdges(r.source,"both").find((t=>t.source===r.target||t.target===r.target));o&&t.removeEdge(o.id),t.addEdge({id:`e${Math.random()}`,source:n.source,target:n.target,data:{}}),gt(t),ct(t,e),wt(t,e)},wt=(t,e)=>{const r=t.getAllNodes().find((t=>!t.data.parent));let n=O(t,r,"pre",!1);n=n.slice(1),n.forEach((r=>{const n=t.getNode(r).data.parent;let o=e.getRelatedEdges(r,"out").find((t=>t.target===n)),i=!1;!o&&e.hasNode(n)&&(o=e.getRelatedEdges(n,"out").find((t=>t.target===r)),i=!0),e.getNode(r).data.rank=(e.hasNode(n)&&e.getNode(n).data.rank||0)+(i?null==o?void 0:o.data.minlen:-(null==o?void 0:o.data.minlen))}))},xt=(t,e,r)=>t.getRelatedEdges(e,"both").find((t=>t.source===r||t.target===r)),bt=(t,e)=>e.data.low<=t.data.lim&&t.data.lim<=e.data.lim,Et=it,Nt=t=>{(t=>{const e=(t=>{const e=new u;return t.getAllNodes().forEach((t=>{e.addNode(Object.assign({},t))})),t.getAllEdges().forEach((t=>{const r=e.getRelatedEdges(t.source,"out").find((e=>e.target===t.target));r?e.updateEdgeData(null==r?void 0:r.id,Object.assign(Object.assign({},r.data),{weight:r.data.weight+t.data.weight||0,minlen:Math.max(r.data.minlen,t.data.minlen||1)})):e.addEdge({id:t.id,source:t.source,target:t.target,data:{weight:t.data.weight||0,minlen:t.data.minlen||1}})})),e})(t);it(e);const r=(t=>{const e=new u({tree:[]}),r=t.getAllNodes()[0],n=t.getAllNodes().length;let o,i;for(e.addNode(r);at(e,t)<n;)o=dt(e,t),i=e.hasNode(o.source)?st(t,o):-st(t,o),ht(e,t,i);return e})(e);let n,o;for(gt(r),ct(r,e);n=vt(r);)o=yt(r,e,n),mt(r,e,n,o)})(t)},_t=(t,e)=>{const{acyclicer:r,ranker:n,rankdir:o="tb",nodeOrder:i,keepNodeOrder:s,align:a,nodesep:d=50,edgesep:h=20,ranksep:c=50}=e;Lt(t),w(t,r);const{nestingRoot:l,nodeRankFactor:f}=(t=>{const e=b(t,"root",{},"_root"),r=(t=>{const e={},r=(n,o)=>{const i=t.getChildren(n);null==i||i.forEach((t=>r(t.id,o+1))),e[n]=o};return t.getRoots().forEach((t=>r(t.id,1))),e})(t);let n=Math.max(...Object.values(r));Math.abs(n)===1/0&&(n=1);const o=n-1,i=2*o+1;t.getAllEdges().forEach((t=>{t.data.minlen*=i}));const s=(t=>{let e=0;return t.getAllEdges().forEach((t=>{e+=t.data.weight})),e})(t)+1;return t.getRoots().forEach((n=>{C(t,e,i,s,o,r,n.id)})),{nestingRoot:e,nodeRankFactor:i}})(t);((t,e)=>{switch(e){case"network-simplex":Nt(t);break;case"tight-tree":default:(t=>{(t=>{const e={};let r;const n=o=>{var i;const s=t.getNode(o);if(!s)return 0;if(e[o])return s.data.rank;let a;return e[o]=!0,null===(i=t.getRelatedEdges(o,"out"))||void 0===i||i.forEach((t=>{const e=n(t.target)-t.data.minlen;e&&(void 0===a||e<a)&&(a=e)})),a||(a=0),(void 0===r||a<r)&&(r=a),s.data.rank=a,a};t.getAllNodes().filter((e=>0===t.getRelatedEdges(e.id,"in").length)).forEach((t=>{t&&n(t.id)})),void 0===r&&(r=0);const o={},i=(e,r)=>{var n;const s=t.getNode(e),a=isNaN(s.data.layer)?r:s.data.layer;(void 0===s.data.rank||s.data.rank<a)&&(s.data.rank=a),o[e]||(o[e]=!0,null===(n=t.getRelatedEdges(e,"out"))||void 0===n||n.forEach((t=>{i(t.target,a+t.data.minlen)})))};t.getAllNodes().forEach((t=>{const e=t.data;e&&(isNaN(e.layer)?e.rank-=r:i(t.id,e.layer))}))})(t),(t=>{const e=new u({tree:[]}),r=t.getAllNodes()[0],n=t.getAllNodes().length;let o,i;for(e.addNode(r);ut(e,t)<n;)o=dt(e,t),i=e.hasNode(o.source)?st(t,o):-st(t,o),ht(e,t,i)})(t)})(t);break;case"longest-path":Et(t)}})(E(t),n),St(t),((t,e=0)=>{const r=t.getAllNodes(),n=r.filter((t=>void 0!==t.data.rank)).map((t=>t.data.rank)),o=Math.min(...n),i=[];r.forEach((t=>{const e=(t.data.rank||0)-o;i[e]||(i[e]=[]),i[e].push(t.id)}));let s=0;for(let r=0;r<i.length;r++){const n=i[r];void 0===n?r%e!=0&&(s-=1):s&&(null==n||n.forEach((e=>{const r=t.getNode(e);r&&(r.data.rank=r.data.rank||0,r.data.rank+=s)})))}})(t,f),((t,e)=>{e&&t.removeNode(e),t.getAllEdges().forEach((e=>{e.data.nestingEdge&&t.removeEdge(e.id)}))})(t,l),(t=>{const e=t.getAllNodes().filter((t=>void 0!==t.data.rank)).map((t=>t.data.rank)),r=Math.min(...e);t.getAllNodes().forEach((t=>{t.data.hasOwnProperty("rank")&&r!==1/0&&(t.data.rank-=r)}))})(t),zt(t),Rt(t);const g=[];((t,e)=>{t.getAllEdges().forEach((r=>((t,e,r)=>{let n=e.source,o=t.getNode(n).data.rank;const i=e.target,s=t.getNode(i).data.rank,a=e.data.labelRank;if(s===o+1)return;let u,d,h;for(t.removeEdge(e.id),h=0,++o;o<s;++h,++o)e.data.points=[],d={originalEdge:e,width:0,height:0,rank:o},u=b(t,"edge",d,"_d"),o===a&&(d.width=e.data.width,d.height=e.data.height,d.dummy=D,d.labelpos=e.data.labelpos),t.addEdge({id:`e${Math.random()}`,source:n,target:u,data:{weight:e.data.weight}}),0===h&&r.push(u),n=u;t.addEdge({id:`e${Math.random()}`,source:n,target:i,data:{weight:e.data.weight}})})(t,r,e)))})(t,g),((t,e)=>{const r=(t=>{const e={};let r=0;const n=o=>{const i=r;t.getChildren(o).forEach((t=>n(t.id))),e[o]={low:i,lim:r++}};return t.getRoots().forEach((t=>n(t.id))),e})(t);e.forEach((e=>{var n,o;let i=e,s=t.getNode(i);const a=s.data.originalEdge;if(!a)return;const u=((t,e,r,n)=>{var o,i;const s=[],a=[],u=Math.min(e[r].low,e[n].low),d=Math.max(e[r].lim,e[n].lim);let h,c;h=r;do{h=null===(o=t.getParent(h))||void 0===o?void 0:o.id,s.push(h)}while(h&&(e[h].low>u||d>e[h].lim));for(c=h,h=n;h&&h!==c;)a.push(h),h=null===(i=t.getParent(h))||void 0===i?void 0:i.id;return{lca:c,path:s.concat(a.reverse())}})(t,r,a.source,a.target),d=u.path,h=u.lca;let c=0,l=d[c],f=!0;for(;i!==a.target;){if(s=t.getNode(i),f){for(;l!==h&&(null===(n=t.getNode(l))||void 0===n?void 0:n.data.maxRank)<s.data.rank;)c++,l=d[c];l===h&&(f=!1)}if(!f){for(;c<d.length-1&&(null===(o=t.getNode(d[c+1]))||void 0===o?void 0:o.data.minRank)<=s.data.rank;)c++;l=d[c]}t.hasNode(l)&&t.setParent(i,l),i=t.getSuccessors(i)[0].id}}))})(t,g),(t=>{const e=r=>{const n=t.getChildren(r),o=t.getNode(r);if((null==n?void 0:n.length)&&n.forEach((t=>e(t.id))),o.data.hasOwnProperty("minRank")){o.data.borderLeft=[],o.data.borderRight=[];for(let e=o.data.minRank,n=o.data.maxRank+1;e<n;e+=1)S(t,"borderLeft","_bl",r,o,e),S(t,"borderRight","_br",r,o,e)}};t.getRoots().forEach((t=>e(t.id)))})(t),s&&((t,e)=>{const r=t.getAllNodes().filter((e=>{var r;return!(null===(r=t.getChildren(e.id))||void 0===r?void 0:r.length)})).map((t=>t.data.rank)),n=Math.max(...r),o=[];for(let t=0;t<n+1;t++)o[t]=[];null==e||e.forEach((e=>{const r=t.getNode(e);r&&!r.data.dummy&&(isNaN(r.data.rank)||(r.data.fixorder=o[r.data.rank].length,o[r.data.rank].push(e)))}))})(t,i),((t,e)=>{const r=k(t),n=[],o=[];for(let t=1;t<r+1;t++)n.push(t);for(let t=r-1;t>-1;t--)o.push(t);const i=K(t,n,"in"),s=K(t,o,"out");let a=B(t);X(t,a);let u,d=Number.POSITIVE_INFINITY;for(let r=0,n=0;n<4;++r,++n){J(r%2?i:s,r%4>=2,!1,e),a=_(t);const o=V(t,a);o<d&&(n=0,u=F(a),d=o)}a=B(t),X(t,a);for(let r=0,n=0;n<4;++r,++n){J(r%2?i:s,r%4>=2,!0,e),a=_(t);const o=V(t,a);o<d&&(n=0,u=F(a),d=o)}X(t,u)})(t,s),Ft(t),((t,e)=>{const r=e.toLowerCase();"lr"!==r&&"rl"!==r||z(t)})(t,o),ot(t,{align:a,nodesep:d,edgesep:h,ranksep:c}),qt(t),Tt(t),((t,e)=>{e.forEach((e=>{let r=t.getNode(e);const{data:n}=r,o=n.originalEdge;let i;o&&t.addEdge(o);let s=e;for(;r.data.dummy;)i=t.getSuccessors(s)[0],t.removeNode(s),o.data.points.push({x:r.data.x,y:r.data.y}),r.data.dummy===D&&(o.data.x=r.data.x,o.data.y=r.data.y,o.data.width=r.data.width,o.data.height=r.data.height),s=i.id,r=t.getNode(s)}))})(t,g),Ct(t),((t,e)=>{const r=e.toLowerCase();"bt"!==r&&"rl"!==r||(t=>{t.getAllNodes().forEach((t=>{I(t.data)})),t.getAllEdges().forEach((t=>{var e;null===(e=t.data.points)||void 0===e||e.forEach((t=>I(t))),t.data.hasOwnProperty("y")&&I(t.data)}))})(t),"lr"!==r&&"rl"!==r||((t=>{t.getAllNodes().forEach((t=>{P(t.data)})),t.getAllEdges().forEach((t=>{var e;null===(e=t.data.points)||void 0===e||e.forEach((t=>P(t))),t.data.hasOwnProperty("x")&&P(t.data)}))})(t),z(t))})(t,o);const{width:p,height:v}=It(t);return Pt(t),Dt(t),(t=>{t.getAllEdges().forEach((e=>{const r=e.data;if(r.reversed){t.removeEdge(e.id);const n=r.forwardName;delete r.reversed,delete r.forwardName,t.addEdge({id:e.id,source:e.target,target:e.source,data:Object.assign(Object.assign({},r),{forwardName:n})})}}))})(t),{width:p,height:v}},Mt=["width","height","layer","fixorder"],kt={width:0,height:0},At=["minlen","weight","width","height","labeloffset"],jt={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},Ot=["labelpos"],St=t=>{t.getAllEdges().forEach((e=>{if(e.data.width&&e.data.height){const r=t.getNode(e.source),n={e,rank:(t.getNode(e.target).data.rank-r.data.rank)/2+r.data.rank};b(t,"edge-proxy",n,"_ep")}}))},zt=t=>{let e=0;return t.getAllNodes().forEach((r=>{var n,o;r.data.borderTop&&(r.data.minRank=null===(n=t.getNode(r.data.borderTop))||void 0===n?void 0:n.data.rank,r.data.maxRank=null===(o=t.getNode(r.data.borderBottom))||void 0===o?void 0:o.data.rank,e=Math.max(e,r.data.maxRank||-1/0))})),e},Rt=t=>{t.getAllNodes().forEach((e=>{"edge-proxy"===e.data.dummy&&(t.getEdge(e.data.e.id).data.labelRank=e.data.rank,t.removeNode(e.id))}))},It=(t,e)=>{let r,n,o=0,i=0;const{marginx:s=0,marginy:a=0}=e||{},u=t=>{if(!t.data)return;const e=t.data.x,s=t.data.y,a=t.data.width,u=t.data.height;isNaN(e)||isNaN(a)||(void 0===r&&(r=e-a/2),r=Math.min(r,e-a/2),o=Math.max(o,e+a/2)),isNaN(s)||isNaN(u)||(void 0===n&&(n=s-u/2),n=Math.min(n,s-u/2),i=Math.max(i,s+u/2))};return t.getAllNodes().forEach((t=>{u(t)})),t.getAllEdges().forEach((t=>{(null==t?void 0:t.data.hasOwnProperty("x"))&&u(t)})),r-=s,n-=a,t.getAllNodes().forEach((t=>{t.data.x-=r,t.data.y-=n})),t.getAllEdges().forEach((t=>{var e;null===(e=t.data.points)||void 0===e||e.forEach((t=>{t.x-=r,t.y-=n})),t.data.hasOwnProperty("x")&&(t.data.x-=r),t.data.hasOwnProperty("y")&&(t.data.y-=n)})),{width:o-r+s,height:i-n+a}},Pt=t=>{t.getAllEdges().forEach((e=>{const r=t.getNode(e.source),n=t.getNode(e.target);let o,i;e.data.points?(o=e.data.points[0],i=e.data.points[e.data.points.length-1]):(e.data.points=[],o={x:n.data.x,y:n.data.y},i={x:r.data.x,y:r.data.y}),e.data.points.unshift(N(r.data,o)),e.data.points.push(N(n.data,i))}))},Ct=t=>{t.getAllEdges().forEach((t=>{if(t.data.hasOwnProperty("x"))switch("l"!==t.data.labelpos&&"r"!==t.data.labelpos||(t.data.width-=t.data.labeloffset),t.data.labelpos){case"l":t.data.x-=t.data.width/2+t.data.labeloffset;break;case"r":t.data.x+=t.data.width/2+t.data.labeloffset}}))},Dt=t=>{t.getAllEdges().forEach((t=>{var e;t.data.reversed&&(null===(e=t.data.points)||void 0===e||e.reverse())}))},Tt=t=>{t.getAllNodes().forEach((e=>{var r,n,o;if(null===(r=t.getChildren(e.id))||void 0===r?void 0:r.length){const r=t.getNode(e.id),i=t.getNode(r.data.borderTop),s=t.getNode(r.data.borderBottom),a=t.getNode(r.data.borderLeft[(null===(n=r.data.borderLeft)||void 0===n?void 0:n.length)-1]),u=t.getNode(r.data.borderRight[(null===(o=r.data.borderRight)||void 0===o?void 0:o.length)-1]);r.data.width=Math.abs((null==u?void 0:u.data.x)-(null==a?void 0:a.data.x))||10,r.data.height=Math.abs((null==s?void 0:s.data.y)-(null==i?void 0:i.data.y))||10,r.data.x=((null==a?void 0:a.data.x)||0)+r.data.width/2,r.data.y=((null==i?void 0:i.data.y)||0)+r.data.height/2}})),t.getAllNodes().forEach((e=>{"border"===e.data.dummy&&t.removeNode(e.id)}))},Lt=t=>{t.getAllEdges().forEach((e=>{if(e.source===e.target){const r=t.getNode(e.source);r.data.selfEdges||(r.data.selfEdges=[]),r.data.selfEdges.push(e),t.removeEdge(e.id)}}))},Ft=t=>{const e=_(t);null==e||e.forEach((e=>{let r=0;null==e||e.forEach(((e,n)=>{var o;const i=t.getNode(e);i.data.order=n+r,null===(o=i.data.selfEdges)||void 0===o||o.forEach((e=>{b(t,"selfedge",{width:e.data.width,height:e.data.height,rank:i.data.rank,order:n+ ++r,e},"_se")})),delete i.data.selfEdges}))}))},qt=t=>{t.getAllNodes().forEach((e=>{const r=t.getNode(e.id);if("selfedge"===r.data.dummy){const n=t.getNode(r.data.e.source),o=n.data.x+n.data.width/2,i=n.data.y,s=r.data.x-o,a=n.data.height/2;t.hasEdge(r.data.e.id)?t.updateEdgeData(r.data.e.id,r.data.e.data):t.addEdge({id:r.data.e.id,source:r.data.e.source,target:r.data.e.target,data:r.data.e.data}),t.removeNode(e.id),r.data.e.data.points=[{x:o+2*s/3,y:i-a},{x:o+5*s/6,y:i-a},{y:i,x:o+s},{x:o+5*s/6,y:i+a},{x:o+2*s/3,y:i+a}],r.data.e.data.x=r.data.x,r.data.e.data.y=r.data.y}}))},Vt=(t,e)=>{const r={};return null==e||e.forEach((e=>{void 0!==t[e]&&(r[e]=+t[e])})),r},Bt=(t={})=>{const e={};return Object.keys(t).forEach((r=>{e[r.toLowerCase()]=t[r]})),e},$t=function(t){return"function"==typeof t},Gt=function(t){var e=typeof t;return null!==t&&"object"===e||"function"===e};function Ut(t){if(!t)return[0,0,0];if(c(t))return[t,t,t];if(0===t.length)return[0,0,0];const[e,r=e,n=e]=t;return[e,r,n]}function Wt(t,e){let r;return r=$t(e)?e:c(e)?()=>e:()=>t,r}function Yt(t,e,r=!0){return e||0===e?$t(e)?e:c(e)?()=>e:Array.isArray(e)?()=>r?Math.max(...e)||t:e:Gt(e)&&e.width&&e.height?()=>r?Math.max(e.width,e.height)||t:[e.width,e.height]:()=>t:e=>{const{size:n}=e.data||{};return n?Array.isArray(n)?r?Math.max(...n)||t:n:Gt(n)&&n.width&&n.height?r?Math.max(n.width,n.height)||t:[n.width,n.height]:n:t}}const Ht=(t,e,r=10)=>{let n;const o="function"==typeof e?e:()=>e||0;return n=t?Array.isArray(t)?e=>t:$t(t)?t:e=>t:t=>{var e,n,o;if(null===(e=t.data)||void 0===e?void 0:e.bboxSize)return null===(n=t.data)||void 0===n?void 0:n.bboxSize;if(null===(o=t.data)||void 0===o?void 0:o.size){const e=t.data.size;return Array.isArray(e)?e:Gt(e)?[e.width,e.height]:e}return r},t=>{const e=n(t),r=o(t);return Math.max(...Ut(e))+r}},Kt=t=>{if(null===t)return t;if(t instanceof Date)return new Date(t.getTime());if(t instanceof Array){const e=[];return t.forEach((t=>{e.push(t)})),e.map((t=>Kt(t)))}if("object"==typeof t){const e={};return Object.keys(t).forEach((r=>{e[r]=Kt(t[r])})),e}return t},Jt=(t,e)=>{const r=Kt(t);return r.data=r.data||{},e&&(c(r.data.x)||(r.data.x=Math.random()*e[0]),c(r.data.y)||(r.data.y=Math.random()*e[1])),r},Xt={rankdir:"TB",nodesep:50,ranksep:50,edgeLabelSpace:!0,ranker:"tight-tree",controlPoints:!1,radial:!1,focusNode:null},Qt=(t,e,r)=>{const n=t.getAllNodes(),o=t.getAllEdges();return(null==n?void 0:n.length)?1===n.length?(e&&t.mergeNodeData(n[0].id,{x:r[0],y:r[1]}),{nodes:[Object.assign(Object.assign({},n[0]),{data:Object.assign(Object.assign({},n[0].data),{x:r[0],y:r[1]})})],edges:o}):void 0:{nodes:[],edges:o}},Zt={radius:null,startRadius:null,endRadius:null,startAngle:0,endAngle:2*Math.PI,clockwise:!0,divisions:1,ordering:null,angleRatio:1},te=(t,e,r=!1)=>{const n=[Jt(e[0])],o={},i=e.length;o[e[0].id]=!0;let s=0;return e.forEach(((a,u)=>{if(0!==u)if(u!==i-1&&t.getDegree(a.id,"both")===t.getDegree(e[u+1].id,"both")&&!t.areNeighbors(n[s].id,a.id)||o[a.id]){const u=r?t.getSuccessors(n[s].id):t.getNeighbors(n[s].id);let d=!1;for(let e=0;e<u.length;e++){const r=u[e];if(t.getDegree(r.id)===t.getDegree(a.id)&&!o[r.id]){n.push(Jt(r)),o[r.id]=!0,d=!0;break}}let h=0;for(;!d&&(o[e[h].id]||(n.push(Jt(e[h])),o[e[h].id]=!0,d=!0),h++,h!==i););}else n.push(Jt(a)),o[a.id]=!0,s++})),n},ee=function(t){return h(t,"String")},re=Array.isArray,ne={nodeSize:30,nodeSpacing:10,preventOverlap:!1,sweep:void 0,equidistant:!1,startAngle:1.5*Math.PI,clockwise:!0,maxLevelDiff:void 0,sortBy:"degree"};class oe{constructor(t={}){this.options=t,this.id="concentric",this.options=Object.assign(Object.assign({},ne),t)}execute(e,r){return t(this,void 0,void 0,(function*(){return this.genericConcentricLayout(!1,e,r)}))}assign(e,r){return t(this,void 0,void 0,(function*(){yield this.genericConcentricLayout(!0,e,r)}))}genericConcentricLayout(e,r,n){return t(this,void 0,void 0,(function*(){const t=Object.assign(Object.assign({},this.options),n),{center:o,width:i,height:s,sortBy:a,maxLevelDiff:u,sweep:d,clockwise:h,equidistant:l,preventOverlap:f,startAngle:g=1.5*Math.PI,nodeSize:p,nodeSpacing:v}=t,y=r.getAllNodes(),m=r.getAllEdges(),w=i||"undefined"==typeof window?i:window.innerWidth,x=s||"undefined"==typeof window?s:window.innerHeight,b=o||[w/2,x/2];if(!(null==y?void 0:y.length)||1===y.length)return Qt(r,e,b);const E=[];let N,_=0;re(p)?N=Math.max(p[0],p[1]):$t(p)?(N=-1/0,y.forEach((t=>{const e=Math.max(...Ut(p(t)));e>N&&(N=e)}))):N=p,re(v)?_=Math.max(v[0],v[1]):c(v)&&(_=v),y.forEach((t=>{const e=Jt(t);E.push(e);let r=N;const{data:n}=e;re(n.size)?r=Math.max(n.size[0],n.size[1]):c(n.size)?r=n.size:Gt(n.size)&&(r=Math.max(n.size.width,n.size.height)),N=Math.max(N,r),$t(v)&&(_=Math.max(v(t),_))}));const M={};E.forEach(((t,e)=>{M[t.id]=e}));let k=a;ee(k)&&void 0!==E[0].data[k]||(k="degree"),"degree"===k?E.sort(((t,e)=>r.getDegree(e.id,"both")-r.getDegree(t.id,"both"))):E.sort(((t,e)=>e.data[k]-t.data[k]));const A=E[0],j=(u||("degree"===k?r.getDegree(A.id,"both"):A.data[k]))/4,O=[{nodes:[]}];let S=O[0];E.forEach((t=>{if(S.nodes.length>0){const e="degree"===k?Math.abs(r.getDegree(S.nodes[0].id,"both")-r.getDegree(t.id,"both")):Math.abs(S.nodes[0].data[k]-t.data[k]);j&&e>=j&&(S={nodes:[]},O.push(S))}S.nodes.push(t)}));let z=N+_;if(!f){const t=O.length>0&&O[0].nodes.length>1,e=(Math.min(w,x)/2-z)/(O.length+(t?1:0));z=Math.min(z,e)}let R=0;if(O.forEach((t=>{const e=void 0===d?2*Math.PI-2*Math.PI/t.nodes.length:d;if(t.dTheta=e/Math.max(1,t.nodes.length-1),t.nodes.length>1&&f){const e=Math.cos(t.dTheta)-Math.cos(0),r=Math.sin(t.dTheta)-Math.sin(0),n=Math.sqrt(z*z/(e*e+r*r));R=Math.max(n,R)}t.r=R,R+=z})),l){let t=0,e=0;for(let r=0;r<O.length;r++){const n=(O[r].r||0)-e;t=Math.max(t,n)}e=0,O.forEach(((r,n)=>{0===n&&(e=r.r||0),r.r=e,e+=t}))}return O.forEach((t=>{const e=t.dTheta||0,r=t.r||0;t.nodes.forEach(((t,n)=>{const o=g+(h?1:-1)*e*n;t.data.x=b[0]+r*Math.cos(o),t.data.y=b[1]+r*Math.sin(o)}))})),e&&E.forEach((t=>r.mergeNodeData(t.id,{x:t.data.x,y:t.data.y}))),{nodes:E,edges:m}}))}}function ie(t,e,r,n){if(isNaN(e)||isNaN(r))return t;var o,i,s,a,u,d,h,c,l,f=t._root,g={data:n},p=t._x0,v=t._y0,y=t._x1,m=t._y1;if(!f)return t._root=g,t;for(;f.length;)if((d=e>=(i=(p+y)/2))?p=i:y=i,(h=r>=(s=(v+m)/2))?v=s:m=s,o=f,!(f=f[c=h<<1|d]))return o[c]=g,t;if(a=+t._x.call(null,f.data),u=+t._y.call(null,f.data),e===a&&r===u)return g.next=f,o?o[c]=g:t._root=g,t;do{o=o?o[c]=new Array(4):t._root=new Array(4),(d=e>=(i=(p+y)/2))?p=i:y=i,(h=r>=(s=(v+m)/2))?v=s:m=s}while((c=h<<1|d)==(l=(u>=s)<<1|a>=i));return o[l]=f,o[c]=g,t}function se(t,e,r,n,o){this.node=t,this.x0=e,this.y0=r,this.x1=n,this.y1=o}function ae(t){return t[0]}function ue(t){return t[1]}function de(t,e,r){var n=new he(null==e?ae:e,null==r?ue:r,NaN,NaN,NaN,NaN);return null==t?n:n.addAll(t)}function he(t,e,r,n,o,i){this._x=t,this._y=e,this._x0=r,this._y0=n,this._x1=o,this._y1=i,this._root=void 0}function ce(t){for(var e={data:t.data},r=e;t=t.next;)r=r.next={data:t.data};return e}var le=de.prototype=he.prototype;function fe(t,e,r,n,o){if(isNaN(e)||isNaN(r)||isNaN(n))return t;var i,s,a,u,d,h,c,l,f,g,p,v,y=t._root,m={data:o},w=t._x0,x=t._y0,b=t._z0,E=t._x1,N=t._y1,_=t._z1;if(!y)return t._root=m,t;for(;y.length;)if((l=e>=(s=(w+E)/2))?w=s:E=s,(f=r>=(a=(x+N)/2))?x=a:N=a,(g=n>=(u=(b+_)/2))?b=u:_=u,i=y,!(y=y[p=g<<2|f<<1|l]))return i[p]=m,t;if(d=+t._x.call(null,y.data),h=+t._y.call(null,y.data),c=+t._z.call(null,y.data),e===d&&r===h&&n===c)return m.next=y,i?i[p]=m:t._root=m,t;do{i=i?i[p]=new Array(8):t._root=new Array(8),(l=e>=(s=(w+E)/2))?w=s:E=s,(f=r>=(a=(x+N)/2))?x=a:N=a,(g=n>=(u=(b+_)/2))?b=u:_=u}while((p=g<<2|f<<1|l)==(v=(c>=u)<<2|(h>=a)<<1|d>=s));return i[v]=y,i[p]=m,t}function ge(t,e,r,n,o,i,s){this.node=t,this.x0=e,this.y0=r,this.z0=n,this.x1=o,this.y1=i,this.z1=s}function pe(t){return t[0]}function ve(t){return t[1]}function ye(t){return t[2]}function me(t,e,r,n){var o=new we(null==e?pe:e,null==r?ve:r,null==n?ye:n,NaN,NaN,NaN,NaN,NaN,NaN);return null==t?o:o.addAll(t)}function we(t,e,r,n,o,i,s,a,u){this._x=t,this._y=e,this._z=r,this._x0=n,this._y0=o,this._z0=i,this._x1=s,this._y1=a,this._z1=u,this._root=void 0}function xe(t){for(var e={data:t.data},r=e;t=t.next;)r=r.next={data:t.data};return e}le.copy=function(){var t,e,r=new he(this._x,this._y,this._x0,this._y0,this._x1,this._y1),n=this._root;if(!n)return r;if(!n.length)return r._root=ce(n),r;for(t=[{source:n,target:r._root=new Array(4)}];n=t.pop();)for(var o=0;o<4;++o)(e=n.source[o])&&(e.length?t.push({source:e,target:n.target[o]=new Array(4)}):n.target[o]=ce(e));return r},le.add=function(t){const e=+this._x.call(null,t),r=+this._y.call(null,t);return ie(this.cover(e,r),e,r,t)},le.addAll=function(t){var e,r,n,o,i=t.length,s=new Array(i),a=new Array(i),u=1/0,d=1/0,h=-1/0,c=-1/0;for(r=0;r<i;++r)isNaN(n=+this._x.call(null,e=t[r]))||isNaN(o=+this._y.call(null,e))||(s[r]=n,a[r]=o,n<u&&(u=n),n>h&&(h=n),o<d&&(d=o),o>c&&(c=o));if(u>h||d>c)return this;for(this.cover(u,d).cover(h,c),r=0;r<i;++r)ie(this,s[r],a[r],t[r]);return this},le.cover=function(t,e){if(isNaN(t=+t)||isNaN(e=+e))return this;var r=this._x0,n=this._y0,o=this._x1,i=this._y1;if(isNaN(r))o=(r=Math.floor(t))+1,i=(n=Math.floor(e))+1;else{for(var s,a,u=o-r||1,d=this._root;r>t||t>=o||n>e||e>=i;)switch(a=(e<n)<<1|t<r,(s=new Array(4))[a]=d,d=s,u*=2,a){case 0:o=r+u,i=n+u;break;case 1:r=o-u,i=n+u;break;case 2:o=r+u,n=i-u;break;case 3:r=o-u,n=i-u}this._root&&this._root.length&&(this._root=d)}return this._x0=r,this._y0=n,this._x1=o,this._y1=i,this},le.data=function(){var t=[];return this.visit((function(e){if(!e.length)do{t.push(e.data)}while(e=e.next)})),t},le.extent=function(t){return arguments.length?this.cover(+t[0][0],+t[0][1]).cover(+t[1][0],+t[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]},le.find=function(t,e,r){var n,o,i,s,a,u,d,h=this._x0,c=this._y0,l=this._x1,f=this._y1,g=[],p=this._root;for(p&&g.push(new se(p,h,c,l,f)),null==r?r=1/0:(h=t-r,c=e-r,l=t+r,f=e+r,r*=r);u=g.pop();)if(!(!(p=u.node)||(o=u.x0)>l||(i=u.y0)>f||(s=u.x1)<h||(a=u.y1)<c))if(p.length){var v=(o+s)/2,y=(i+a)/2;g.push(new se(p[3],v,y,s,a),new se(p[2],o,y,v,a),new se(p[1],v,i,s,y),new se(p[0],o,i,v,y)),(d=(e>=y)<<1|t>=v)&&(u=g[g.length-1],g[g.length-1]=g[g.length-1-d],g[g.length-1-d]=u)}else{var m=t-+this._x.call(null,p.data),w=e-+this._y.call(null,p.data),x=m*m+w*w;if(x<r){var b=Math.sqrt(r=x);h=t-b,c=e-b,l=t+b,f=e+b,n=p.data}}return n},le.remove=function(t){if(isNaN(i=+this._x.call(null,t))||isNaN(s=+this._y.call(null,t)))return this;var e,r,n,o,i,s,a,u,d,h,c,l,f=this._root,g=this._x0,p=this._y0,v=this._x1,y=this._y1;if(!f)return this;if(f.length)for(;;){if((d=i>=(a=(g+v)/2))?g=a:v=a,(h=s>=(u=(p+y)/2))?p=u:y=u,e=f,!(f=f[c=h<<1|d]))return this;if(!f.length)break;(e[c+1&3]||e[c+2&3]||e[c+3&3])&&(r=e,l=c)}for(;f.data!==t;)if(n=f,!(f=f.next))return this;return(o=f.next)&&delete f.next,n?(o?n.next=o:delete n.next,this):e?(o?e[c]=o:delete e[c],(f=e[0]||e[1]||e[2]||e[3])&&f===(e[3]||e[2]||e[1]||e[0])&&!f.length&&(r?r[l]=f:this._root=f),this):(this._root=o,this)},le.removeAll=function(t){for(var e=0,r=t.length;e<r;++e)this.remove(t[e]);return this},le.root=function(){return this._root},le.size=function(){var t=0;return this.visit((function(e){if(!e.length)do{++t}while(e=e.next)})),t},le.visit=function(t){var e,r,n,o,i,s,a=[],u=this._root;for(u&&a.push(new se(u,this._x0,this._y0,this._x1,this._y1));e=a.pop();)if(!t(u=e.node,n=e.x0,o=e.y0,i=e.x1,s=e.y1)&&u.length){var d=(n+i)/2,h=(o+s)/2;(r=u[3])&&a.push(new se(r,d,h,i,s)),(r=u[2])&&a.push(new se(r,n,h,d,s)),(r=u[1])&&a.push(new se(r,d,o,i,h)),(r=u[0])&&a.push(new se(r,n,o,d,h))}return this},le.visitAfter=function(t){var e,r=[],n=[];for(this._root&&r.push(new se(this._root,this._x0,this._y0,this._x1,this._y1));e=r.pop();){var o=e.node;if(o.length){var i,s=e.x0,a=e.y0,u=e.x1,d=e.y1,h=(s+u)/2,c=(a+d)/2;(i=o[0])&&r.push(new se(i,s,a,h,c)),(i=o[1])&&r.push(new se(i,h,a,u,c)),(i=o[2])&&r.push(new se(i,s,c,h,d)),(i=o[3])&&r.push(new se(i,h,c,u,d))}n.push(e)}for(;e=n.pop();)t(e.node,e.x0,e.y0,e.x1,e.y1);return this},le.x=function(t){return arguments.length?(this._x=t,this):this._x},le.y=function(t){return arguments.length?(this._y=t,this):this._y};var be=me.prototype=we.prototype;function Ee(t){let e=0,r=0,n=0,o=0,i=0;const s=t.length;if(s){for(let a=0;a<s;a++){const s=t[a];s&&s.weight&&(e+=s.weight,r+=s.x*s.weight,n+=s.y*s.weight,o+=s.z*s.weight,i+=s.size*s.weight)}t.x=r/e,t.y=n/e,t.z=o/e,t.size=i/e,t.weight=e}else{const e=t;t.x=e.data.x,t.y=e.data.y,t.z=e.data.z,t.size=e.data.size,t.weight=e.data.weight}}be.copy=function(){var t,e,r=new we(this._x,this._y,this._z,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1),n=this._root;if(!n)return r;if(!n.length)return r._root=xe(n),r;for(t=[{source:n,target:r._root=new Array(8)}];n=t.pop();)for(var o=0;o<8;++o)(e=n.source[o])&&(e.length?t.push({source:e,target:n.target[o]=new Array(8)}):n.target[o]=xe(e));return r},be.add=function(t){const e=+this._x.call(null,t),r=+this._y.call(null,t),n=+this._z.call(null,t);return fe(this.cover(e,r,n),e,r,n,t)},be.addAll=function(t){Array.isArray(t)||(t=Array.from(t));const e=t.length,r=new Float64Array(e),n=new Float64Array(e),o=new Float64Array(e);let i=1/0,s=1/0,a=1/0,u=-1/0,d=-1/0,h=-1/0;for(let c,l,f,g,p=0;p<e;++p)isNaN(l=+this._x.call(null,c=t[p]))||isNaN(f=+this._y.call(null,c))||isNaN(g=+this._z.call(null,c))||(r[p]=l,n[p]=f,o[p]=g,l<i&&(i=l),l>u&&(u=l),f<s&&(s=f),f>d&&(d=f),g<a&&(a=g),g>h&&(h=g));if(i>u||s>d||a>h)return this;this.cover(i,s,a).cover(u,d,h);for(let i=0;i<e;++i)fe(this,r[i],n[i],o[i],t[i]);return this},be.cover=function(t,e,r){if(isNaN(t=+t)||isNaN(e=+e)||isNaN(r=+r))return this;var n=this._x0,o=this._y0,i=this._z0,s=this._x1,a=this._y1,u=this._z1;if(isNaN(n))s=(n=Math.floor(t))+1,a=(o=Math.floor(e))+1,u=(i=Math.floor(r))+1;else{for(var d,h,c=s-n||1,l=this._root;n>t||t>=s||o>e||e>=a||i>r||r>=u;)switch(h=(r<i)<<2|(e<o)<<1|t<n,(d=new Array(8))[h]=l,l=d,c*=2,h){case 0:s=n+c,a=o+c,u=i+c;break;case 1:n=s-c,a=o+c,u=i+c;break;case 2:s=n+c,o=a-c,u=i+c;break;case 3:n=s-c,o=a-c,u=i+c;break;case 4:s=n+c,a=o+c,i=u-c;break;case 5:n=s-c,a=o+c,i=u-c;break;case 6:s=n+c,o=a-c,i=u-c;break;case 7:n=s-c,o=a-c,i=u-c}this._root&&this._root.length&&(this._root=l)}return this._x0=n,this._y0=o,this._z0=i,this._x1=s,this._y1=a,this._z1=u,this},be.data=function(){var t=[];return this.visit((function(e){if(!e.length)do{t.push(e.data)}while(e=e.next)})),t},be.extent=function(t){return arguments.length?this.cover(+t[0][0],+t[0][1],+t[0][2]).cover(+t[1][0],+t[1][1],+t[1][2]):isNaN(this._x0)?void 0:[[this._x0,this._y0,this._z0],[this._x1,this._y1,this._z1]]},be.find=function(t,e,r,n){var o,i,s,a,u,d,h,c,l,f=this._x0,g=this._y0,p=this._z0,v=this._x1,y=this._y1,m=this._z1,w=[],x=this._root;for(x&&w.push(new ge(x,f,g,p,v,y,m)),null==n?n=1/0:(f=t-n,g=e-n,p=r-n,v=t+n,y=e+n,m=r+n,n*=n);c=w.pop();)if(!(!(x=c.node)||(i=c.x0)>v||(s=c.y0)>y||(a=c.z0)>m||(u=c.x1)<f||(d=c.y1)<g||(h=c.z1)<p))if(x.length){var b=(i+u)/2,E=(s+d)/2,N=(a+h)/2;w.push(new ge(x[7],b,E,N,u,d,h),new ge(x[6],i,E,N,b,d,h),new ge(x[5],b,s,N,u,E,h),new ge(x[4],i,s,N,b,E,h),new ge(x[3],b,E,a,u,d,N),new ge(x[2],i,E,a,b,d,N),new ge(x[1],b,s,a,u,E,N),new ge(x[0],i,s,a,b,E,N)),(l=(r>=N)<<2|(e>=E)<<1|t>=b)&&(c=w[w.length-1],w[w.length-1]=w[w.length-1-l],w[w.length-1-l]=c)}else{var _=t-+this._x.call(null,x.data),M=e-+this._y.call(null,x.data),k=r-+this._z.call(null,x.data),A=_*_+M*M+k*k;if(A<n){var j=Math.sqrt(n=A);f=t-j,g=e-j,p=r-j,v=t+j,y=e+j,m=r+j,o=x.data}}return o},be.remove=function(t){if(isNaN(i=+this._x.call(null,t))||isNaN(s=+this._y.call(null,t))||isNaN(a=+this._z.call(null,t)))return this;var e,r,n,o,i,s,a,u,d,h,c,l,f,g,p,v=this._root,y=this._x0,m=this._y0,w=this._z0,x=this._x1,b=this._y1,E=this._z1;if(!v)return this;if(v.length)for(;;){if((c=i>=(u=(y+x)/2))?y=u:x=u,(l=s>=(d=(m+b)/2))?m=d:b=d,(f=a>=(h=(w+E)/2))?w=h:E=h,e=v,!(v=v[g=f<<2|l<<1|c]))return this;if(!v.length)break;(e[g+1&7]||e[g+2&7]||e[g+3&7]||e[g+4&7]||e[g+5&7]||e[g+6&7]||e[g+7&7])&&(r=e,p=g)}for(;v.data!==t;)if(n=v,!(v=v.next))return this;return(o=v.next)&&delete v.next,n?(o?n.next=o:delete n.next,this):e?(o?e[g]=o:delete e[g],(v=e[0]||e[1]||e[2]||e[3]||e[4]||e[5]||e[6]||e[7])&&v===(e[7]||e[6]||e[5]||e[4]||e[3]||e[2]||e[1]||e[0])&&!v.length&&(r?r[p]=v:this._root=v),this):(this._root=o,this)},be.removeAll=function(t){for(var e=0,r=t.length;e<r;++e)this.remove(t[e]);return this},be.root=function(){return this._root},be.size=function(){var t=0;return this.visit((function(e){if(!e.length)do{++t}while(e=e.next)})),t},be.visit=function(t){var e,r,n,o,i,s,a,u,d=[],h=this._root;for(h&&d.push(new ge(h,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));e=d.pop();)if(!t(h=e.node,n=e.x0,o=e.y0,i=e.z0,s=e.x1,a=e.y1,u=e.z1)&&h.length){var c=(n+s)/2,l=(o+a)/2,f=(i+u)/2;(r=h[7])&&d.push(new ge(r,c,l,f,s,a,u)),(r=h[6])&&d.push(new ge(r,n,l,f,c,a,u)),(r=h[5])&&d.push(new ge(r,c,o,f,s,l,u)),(r=h[4])&&d.push(new ge(r,n,o,f,c,l,u)),(r=h[3])&&d.push(new ge(r,c,l,i,s,a,f)),(r=h[2])&&d.push(new ge(r,n,l,i,c,a,f)),(r=h[1])&&d.push(new ge(r,c,o,i,s,l,f)),(r=h[0])&&d.push(new ge(r,n,o,i,c,l,f))}return this},be.visitAfter=function(t){var e,r=[],n=[];for(this._root&&r.push(new ge(this._root,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));e=r.pop();){var o=e.node;if(o.length){var i,s=e.x0,a=e.y0,u=e.z0,d=e.x1,h=e.y1,c=e.z1,l=(s+d)/2,f=(a+h)/2,g=(u+c)/2;(i=o[0])&&r.push(new ge(i,s,a,u,l,f,g)),(i=o[1])&&r.push(new ge(i,l,a,u,d,f,g)),(i=o[2])&&r.push(new ge(i,s,f,u,l,h,g)),(i=o[3])&&r.push(new ge(i,l,f,u,d,h,g)),(i=o[4])&&r.push(new ge(i,s,a,g,l,f,c)),(i=o[5])&&r.push(new ge(i,l,a,g,d,f,c)),(i=o[6])&&r.push(new ge(i,s,f,g,l,h,c)),(i=o[7])&&r.push(new ge(i,l,f,g,d,h,c))}n.push(e)}for(;e=n.pop();)t(e.node,e.x0,e.y0,e.z0,e.x1,e.y1,e.z1);return this},be.x=function(t){return arguments.length?(this._x=t,this):this._x},be.y=function(t){return arguments.length?(this._y=t,this):this._y},be.z=function(t){return arguments.length?(this._z=t,this):this._z};const Ne=(t,e,r,n,o,i,s)=>{var a;if((null===(a=t.data)||void 0===a?void 0:a.id)===i.id)return;const u=[r,n,o][s-1],d=i.x-t.x||.1,h=i.y-t.y||.1,c=i.z-t.z||.1,l=[d,h,c],f=u-e;let g=0;for(let t=0;t<s;t++)g+=l[t]*l[t];const p=Math.sqrt(g)*g;if(f*f*.81<g){const e=t.weight/p;return i.vx+=d*e,i.vy+=h*e,i.vz+=c*e,!0}if(t.length)return!1;if(t.data!==i){const e=t.data.weight/p;i.vx+=d*e,i.vy+=h*e,i.vz+=c*e}},_e={dimensions:2,maxIteration:500,gravity:10,factor:1,edgeStrength:50,nodeStrength:1e3,coulombDisScale:.005,damping:.9,maxSpeed:200,minMovement:.4,interval:.02,linkDistance:200,clusterNodeStrength:20,preventOverlap:!0,distanceThresholdMode:"mean"};class Me{constructor(t={}){this.options=t,this.id="force",this.timeInterval=0,this.judgingDistance=0,this.running=!1,this.options=Object.assign(Object.assign({},_e),t)}execute(e,r){return t(this,void 0,void 0,(function*(){return this.genericForceLayout(!1,e,r)}))}assign(e,r){return t(this,void 0,void 0,(function*(){yield this.genericForceLayout(!0,e,r)}))}stop(){this.timeInterval&&"undefined"!=typeof window&&window.clearInterval(this.timeInterval),this.running=!1}tick(t=this.options.maxIteration||1){if(this.lastResult)return this.lastResult;for(let e=0;(this.judgingDistance>this.lastOptions.minMovement||e<1)&&e<t;e++)this.runOneStep(this.lastCalcGraph,this.lastGraph,e,this.lastVelMap,this.lastOptions),this.updatePosition(this.lastGraph,this.lastCalcGraph,this.lastVelMap,this.lastOptions);const e={nodes:this.lastLayoutNodes,edges:this.lastLayoutEdges};return this.lastAssign&&e.nodes.forEach((t=>this.lastGraph.mergeNodeData(t.id,{x:t.data.x,y:t.data.y,z:3===this.options.dimensions?t.data.z:void 0}))),e}genericForceLayout(e,r,n){return t(this,void 0,void 0,(function*(){const t=Object.assign(Object.assign({},this.options),n),o=r.getAllNodes(),i=r.getAllEdges(),s=this.formatOptions(t,r),{dimensions:a,width:d,height:h,nodeSize:l,getMass:f,nodeStrength:g,edgeStrength:p,linkDistance:v}=s,y=o.map(((t,e)=>Object.assign(Object.assign({},t),{data:Object.assign(Object.assign({},t.data),{x:c(t.data.x)?t.data.x:Math.random()*d,y:c(t.data.y)?t.data.y:Math.random()*h,z:c(t.data.z)?t.data.z:Math.random()*Math.sqrt(d*h),size:l(t)||30,mass:f(t),nodeStrength:g(t)})}))),m=i.map((t=>Object.assign(Object.assign({},t),{data:Object.assign(Object.assign({},t.data),{edgeStrength:p(t),linkDistance:v(t,r.getNode(t.source),r.getNode(t.target))})})));if(!(null==o?void 0:o.length))return this.lastResult={nodes:[],edges:i},{nodes:[],edges:i};const w={};o.forEach(((t,e)=>{w[t.id]={x:0,y:0,z:0}}));const x=new u({nodes:y,edges:m});this.formatCentripetal(s,x);const{maxIteration:b,minMovement:E,onTick:N}=s;if(this.lastLayoutNodes=y,this.lastLayoutEdges=m,this.lastAssign=e,this.lastGraph=r,this.lastCalcGraph=x,this.lastOptions=s,this.lastVelMap=w,"undefined"==typeof window)return;let _=0;return new Promise((t=>{this.timeInterval=window.setInterval((()=>{o&&this.running||t({nodes:Se(r,y),edges:i}),this.runOneStep(x,r,_,w,s),this.updatePosition(r,x,w,s),e&&y.forEach((t=>r.mergeNodeData(t.id,{x:t.data.x,y:t.data.y,z:3===a?t.data.z:void 0}))),null==N||N({nodes:Se(r,y),edges:i}),_++,(_>=b||this.judgingDistance<E)&&(window.clearInterval(this.timeInterval),t({nodes:Se(r,y),edges:i}))}),0),this.running=!0}))}))}formatOptions(t,e){const r=Object.assign({},t),{width:n,height:o,getMass:i}=t;r.width=n||"undefined"==typeof window?n:window.innerWidth,r.height=o||"undefined"==typeof window?o:window.innerHeight,t.center||(r.center=[r.width/2,r.height/2]),i||(r.getMass=t=>{let r=1;c(null==t?void 0:t.data.mass)&&(r=null==t?void 0:t.data.mass);const n=e.getDegree(t.id,"both");return!n||n<5?r:5*n*r}),r.nodeSize=Ht(t.nodeSize,t.nodeSpacing);const s=t.linkDistance?Wt(1,t.linkDistance):t=>1+r.nodeSize(e.getNode(t.source))+r.nodeSize(e.getNode(t.target));return r.linkDistance=s,r.nodeStrength=Wt(1,t.nodeStrength),r.edgeStrength=Wt(1,t.edgeStrength),r}formatCentripetal(t,e){const{dimensions:r,centripetalOptions:n,center:o,clusterNodeStrength:i,leafCluster:s,clustering:a,nodeClusterBy:u}=t,d=e.getAllNodes(),h=n||{leaf:2,single:2,others:1,center:t=>({x:o[0],y:o[1],z:3===r?o[2]:void 0})};let c,l;if("function"!=typeof i&&(t.clusterNodeStrength=t=>i),s&&u&&(c=ke(e,u),l=Array.from(new Set(null==d?void 0:d.map((t=>t.data[u]))))||[],t.centripetalOptions=Object.assign(h,{single:100,leaf:e=>{const{siblingLeaves:r,sameTypeLeaves:n}=c[e.id]||{};return(null==n?void 0:n.length)===(null==r?void 0:r.length)||1===(null==l?void 0:l.length)?1:t.clusterNodeStrength(e)},others:1,center:t=>{const r=e.getDegree(t.id,"both");if(!r)return{x:100,y:100,z:0};let n;if(1===r){const{sameTypeLeaves:e=[]}=c[t.id]||{};1===e.length?n=void 0:e.length>1&&(n=Oe(e))}else n=void 0;return{x:null==n?void 0:n.x,y:null==n?void 0:n.y,z:null==n?void 0:n.z}}})),a&&u){c||(c=ke(e,u)),l||(l=Array.from(new Set(d.map((t=>t.data[u]))))),l=l.filter((t=>void 0!==t));const r={};l.forEach((t=>{const n=d.filter((e=>e.data[u]===t)).map((t=>e.getNode(t.id)));r[t]=Oe(n)})),t.centripetalOptions=Object.assign(h,{single:e=>t.clusterNodeStrength(e),leaf:e=>t.clusterNodeStrength(e),others:e=>t.clusterNodeStrength(e),center:t=>{const e=r[t.data[u]];return{x:null==e?void 0:e.x,y:null==e?void 0:e.y,z:null==e?void 0:e.z}}})}const{leaf:f,single:g,others:p}=t.centripetalOptions||{};f&&"function"!=typeof f&&(t.centripetalOptions.leaf=()=>f),g&&"function"!=typeof g&&(t.centripetalOptions.single=()=>g),p&&"function"!=typeof p&&(t.centripetalOptions.others=()=>p)}runOneStep(t,e,r,n,o){const i={},s=t.getAllNodes(),a=t.getAllEdges();if(!(null==s?void 0:s.length))return;const{monitor:u}=o;this.calRepulsive(t,i,o),a&&this.calAttractive(t,i,o),this.calGravity(t,e,i,o),this.updateVelocity(t,i,n,o),u&&u({energy:this.calTotalEnergy(i,s),nodes:e.getAllNodes(),edges:e.getAllEdges(),iterations:r})}calTotalEnergy(t,e){if(!(null==e?void 0:e.length))return 0;let r=0;return e.forEach(((e,n)=>{const o=t[e.id].x,i=t[e.id].y,s=3===this.options.dimensions?t[e.id].z:0,a=o*o+i*i+s*s,{mass:u=1}=e.data;r+=u*a*.5})),r}calRepulsive(t,e,r){const{dimensions:n,factor:o,coulombDisScale:i}=r;!function(t,e,r,n,o=2){const i=e/r,s=t.getAllNodes(),a=s.map(((t,e)=>{const{nodeStrength:r,x:n,y:o,z:s,size:a}=t.data;return{x:n,y:o,z:s,size:a,index:e,id:t.id,vx:0,vy:0,vz:0,weight:i*r}})),u=(2===o?de(a,(t=>t.x),(t=>t.y)):me(a,(t=>t.x),(t=>t.y),(t=>t.z))).visitAfter(Ee),d=new Map;a.forEach((t=>{d.set(t.id,t),function(t,e,r){e.visit(((e,n,o,i,s)=>Ne(e,n,o,i,s,t,r)))}(t,u,o)})),a.map(((t,e)=>{const{id:r,data:o}=s[e],{mass:i=1}=o;n[r]={x:t.vx/i,y:t.vy/i,z:t.vz/i}}))}(t,o,i*i,e,n)}calAttractive(t,e,r){const{dimensions:n,nodeSize:o}=r;t.getAllEdges().forEach(((r,i)=>{const{source:s,target:a}=r,u=t.getNode(s),d=t.getNode(a);if(!u||!d)return;let h=d.data.x-u.data.x,c=d.data.y-u.data.y,l=3===n?d.data.z-u.data.z:0;h||c||(h=.01*Math.random(),c=.01*Math.random(),3!==n||l||(l=.01*Math.random()));const f=Math.sqrt(h*h+c*c+l*l);if(f<o(u)+o(d))return;const g=h/f,p=c/f,v=l/f,{linkDistance:y=200,edgeStrength:m=200}=r.data||{},w=(y-f)*m,x=1/(u.data.mass||1),b=1/(d.data.mass||1),E=g*w,N=p*w,_=v*w;e[s].x-=E*x,e[s].y-=N*x,e[s].z-=_*x,e[a].x+=E*b,e[a].y+=N*b,e[a].z+=_*b}))}calGravity(t,e,r,n){const{getCenter:o}=n,i=t.getAllNodes(),s=e.getAllNodes(),a=e.getAllEdges(),{width:u,height:d,center:h,gravity:l,centripetalOptions:f}=n;i&&i.forEach((n=>{const{id:i,data:g}=n,{mass:p,x:v,y,z:m}=g,w=e.getNode(i);let x=0,b=0,E=0,N=l;const _=t.getDegree(i,"in"),M=t.getDegree(i,"out"),k=t.getDegree(i,"both"),A=null==o?void 0:o(w,k);if(A){const[t,e,r]=A;x=v-t,b=y-e,N=r}else x=v-h[0],b=y-h[1],E=m-h[2];if(N&&(r[i].x-=N*x/p,r[i].y-=N*b/p,r[i].z-=N*E/p),f){const{leaf:t,single:e,others:n,center:o}=f,{x:h,y:l,z:g,centerStrength:x}=(null==o?void 0:o(w,s,a,u,d))||{x:0,y:0,z:0,centerStrength:0};if(!c(h)||!c(l))return;const b=(v-h)/p,E=(y-l)/p,N=(m-g)/p;if(x&&(r[i].x-=x*b,r[i].y-=x*E,r[i].z-=x*N),0===k){const t=e(w);if(!t)return;return r[i].x-=t*b,r[i].y-=t*E,void(r[i].z-=t*N)}if(0===_||0===M){const e=t(w,s,a);if(!e)return;return r[i].x-=e*b,r[i].y-=e*E,void(r[i].z-=e*N)}const A=n(w);if(!A)return;r[i].x-=A*b,r[i].y-=A*E,r[i].z-=A*N}}))}updateVelocity(t,e,r,n){const{damping:o,maxSpeed:i,interval:s,dimensions:a}=n,u=t.getAllNodes();(null==u?void 0:u.length)&&u.forEach((t=>{const{id:n}=t;let u=(r[n].x+e[n].x*s)*o||.01,d=(r[n].y+e[n].y*s)*o||.01,h=3===a?(r[n].z+e[n].z*s)*o||.01:0;const c=Math.sqrt(u*u+d*d+h*h);if(c>i){const t=i/c;u*=t,d*=t,h*=t}r[n]={x:u,y:d,z:h}}))}updatePosition(t,e,r,n){const{distanceThresholdMode:o,interval:i,dimensions:s}=n,a=e.getAllNodes();if(!(null==a?void 0:a.length))return void(this.judgingDistance=0);let u=0;"max"===o?this.judgingDistance=-1/0:"min"===o&&(this.judgingDistance=1/0),a.forEach((n=>{const{id:a}=n,d=t.getNode(a);if(c(d.data.fx)&&c(d.data.fy))return void e.mergeNodeData(a,{x:d.data.fx,y:d.data.fy,z:3===s?d.data.fz:void 0});const h=r[a].x*i,l=r[a].y*i,f=3===s?r[a].z*i:0;e.mergeNodeData(a,{x:n.data.x+h,y:n.data.y+l,z:n.data.z+f});const g=Math.sqrt(h*h+l*l+f*f);switch(o){case"max":this.judgingDistance<g&&(this.judgingDistance=g);break;case"min":this.judgingDistance>g&&(this.judgingDistance=g);break;default:u+=g}})),o&&"mean"!==o||(this.judgingDistance=u/a.length)}}const ke=(t,e)=>{const r=t.getAllNodes();if(!(null==r?void 0:r.length))return{};const n={};return r.forEach(((r,o)=>{1===t.getDegree(r.id,"both")&&(n[r.id]=Ae(t,"leaf",r,e))})),n},Ae=(t,e,r,n)=>{const o=t.getDegree(r.id,"in"),i=t.getDegree(r.id,"out");let s=r,a=[];return 0===o?(s=t.getSuccessors(r.id)[0],a=t.getNeighbors(s.id)):0===i&&(s=t.getPredecessors(r.id)[0],a=t.getNeighbors(s.id)),a=a.filter((e=>0===t.getDegree(e.id,"in")||0===t.getDegree(e.id,"out"))),{coreNode:s,siblingLeaves:a,sameTypeLeaves:je(t,e,n,r,a)}},je=(t,e,r,n,o)=>{const i=n.data[r]||"";let s=(null==o?void 0:o.filter((t=>t.data[r]===i)))||[];return"leaf"===e&&(s=s.filter((e=>0===t.getDegree(e.id,"in")||0===t.getDegree(e.id,"out")))),s},Oe=t=>{const e={x:0,y:0};t.forEach((t=>{const{x:r,y:n}=t.data;e.x+=r||0,e.y+=n||0}));const r=t.length||1;return{x:e.x/r,y:e.y/r}},Se=(t,e)=>e.map((e=>{const{id:r,data:n}=e,o=t.getNode(r);return Object.assign(Object.assign({},o),{data:Object.assign(Object.assign({},o.data),{x:n.x,y:n.y,z:n.z})})})),ze=Object.prototype.toString;function Re(t){const e=ze.call(t);return e.endsWith("Array]")&&!e.includes("Big")}function Ie(t){var e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!Re(t))throw new TypeError("input must be an array");if(0===t.length)throw new TypeError("input must not be empty");if(void 0!==r.output){if(!Re(r.output))throw new TypeError("output option must be an array if specified");e=r.output}else e=new Array(t.length);var n=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!Re(t))throw new TypeError("input must be an array");if(0===t.length)throw new TypeError("input must not be empty");var r=e.fromIndex,n=void 0===r?0:r,o=e.toIndex,i=void 0===o?t.length:o;if(n<0||n>=t.length||!Number.isInteger(n))throw new Error("fromIndex must be a positive integer smaller than length");if(i<=n||i>t.length||!Number.isInteger(i))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var s=t[n],a=n+1;a<i;a++)t[a]<s&&(s=t[a]);return s}(t),o=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!Re(t))throw new TypeError("input must be an array");if(0===t.length)throw new TypeError("input must not be empty");var r=e.fromIndex,n=void 0===r?0:r,o=e.toIndex,i=void 0===o?t.length:o;if(n<0||n>=t.length||!Number.isInteger(n))throw new Error("fromIndex must be a positive integer smaller than length");if(i<=n||i>t.length||!Number.isInteger(i))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var s=t[n],a=n+1;a<i;a++)t[a]>s&&(s=t[a]);return s}(t);if(n===o)throw new RangeError("minimum and maximum input values are equal. Cannot rescale a constant array");var i=r.min,s=void 0===i?r.autoMinMax?n:0:i,a=r.max,u=void 0===a?r.autoMinMax?o:1:a;if(s>=u)throw new RangeError("min option must be smaller than max option");for(var d=(u-s)/(o-n),h=0;h<t.length;h++)e[h]=(t[h]-n)*d+s;return e}const Pe=" ".repeat(2),Ce=" ".repeat(4);function De(t,e={}){const{maxRows:r=15,maxColumns:n=10,maxNumSize:o=8,padMinus:i="auto"}=e;return`${t.constructor.name} {\\n${Pe}[\\n${Ce}${function(t,e,r,n,o){const{rows:i,columns:s}=t,a=Math.min(i,e),u=Math.min(s,r),d=[];if("auto"===o){o=!1;t:for(let e=0;e<a;e++)for(let r=0;r<u;r++)if(t.get(e,r)<0){o=!0;break t}}for(let e=0;e<a;e++){let r=[];for(let i=0;i<u;i++)r.push(Te(t.get(e,i),n,o));d.push(`${r.join(" ")}`)}return u!==s&&(d[d.length-1]+=` ... ${s-r} more columns`),a!==i&&d.push(`... ${i-e} more rows`),d.join(`\\n${Ce}`)}(t,r,n,o,i)}\\n${Pe}]\\n${Pe}rows: ${t.rows}\\n${Pe}columns: ${t.columns}\\n}`}function Te(t,e,r){return(t>=0&&r?` ${Le(t,e-1)}`:Le(t,e)).padEnd(e)}function Le(t,e){let r=t.toString();if(r.length<=e)return r;let n=t.toFixed(e);if(n.length>e&&(n=t.toFixed(Math.max(0,e-(n.length-e)))),n.length<=e&&!n.startsWith("0.000")&&!n.startsWith("-0.000"))return n;let o=t.toExponential(e);return o.length>e&&(o=t.toExponential(Math.max(0,e-(o.length-e)))),o.slice(0)}function Fe(t,e,r){let n=r?t.rows:t.rows-1;if(e<0||e>n)throw new RangeError("Row index out of range")}function qe(t,e,r){let n=r?t.columns:t.columns-1;if(e<0||e>n)throw new RangeError("Column index out of range")}function Ve(t,e){if(e.to1DArray&&(e=e.to1DArray()),e.length!==t.columns)throw new RangeError("vector size must be the same as the number of columns");return e}function Be(t,e){if(e.to1DArray&&(e=e.to1DArray()),e.length!==t.rows)throw new RangeError("vector size must be the same as the number of rows");return e}function $e(t,e,r,n,o){if(5!==arguments.length)throw new RangeError("expected 4 arguments");if(Ue("startRow",e),Ue("endRow",r),Ue("startColumn",n),Ue("endColumn",o),e>r||n>o||e<0||e>=t.rows||r<0||r>=t.rows||n<0||n>=t.columns||o<0||o>=t.columns)throw new RangeError("Submatrix indices are out of range")}function Ge(t,e=0){let r=[];for(let n=0;n<t;n++)r.push(e);return r}function Ue(t,e){if("number"!=typeof e)throw new TypeError(`${t} must be a number`)}function We(t){if(t.isEmpty())throw new Error("Empty matrix has no elements to index")}class Ye{static from1DArray(t,e,r){if(t*e!==r.length)throw new RangeError("data length does not match given dimensions");let n=new Ke(t,e);for(let o=0;o<t;o++)for(let t=0;t<e;t++)n.set(o,t,r[o*e+t]);return n}static rowVector(t){let e=new Ke(1,t.length);for(let r=0;r<t.length;r++)e.set(0,r,t[r]);return e}static columnVector(t){let e=new Ke(t.length,1);for(let r=0;r<t.length;r++)e.set(r,0,t[r]);return e}static zeros(t,e){return new Ke(t,e)}static ones(t,e){return new Ke(t,e).fill(1)}static rand(t,e,r={}){if("object"!=typeof r)throw new TypeError("options must be an object");const{random:n=Math.random}=r;let o=new Ke(t,e);for(let r=0;r<t;r++)for(let t=0;t<e;t++)o.set(r,t,n());return o}static randInt(t,e,r={}){if("object"!=typeof r)throw new TypeError("options must be an object");const{min:n=0,max:o=1e3,random:i=Math.random}=r;if(!Number.isInteger(n))throw new TypeError("min must be an integer");if(!Number.isInteger(o))throw new TypeError("max must be an integer");if(n>=o)throw new RangeError("min must be smaller than max");let s=o-n,a=new Ke(t,e);for(let r=0;r<t;r++)for(let t=0;t<e;t++){let e=n+Math.round(i()*s);a.set(r,t,e)}return a}static eye(t,e,r){void 0===e&&(e=t),void 0===r&&(r=1);let n=Math.min(t,e),o=this.zeros(t,e);for(let t=0;t<n;t++)o.set(t,t,r);return o}static diag(t,e,r){let n=t.length;void 0===e&&(e=n),void 0===r&&(r=e);let o=Math.min(n,e,r),i=this.zeros(e,r);for(let e=0;e<o;e++)i.set(e,e,t[e]);return i}static min(t,e){t=this.checkMatrix(t),e=this.checkMatrix(e);let r=t.rows,n=t.columns,o=new Ke(r,n);for(let i=0;i<r;i++)for(let r=0;r<n;r++)o.set(i,r,Math.min(t.get(i,r),e.get(i,r)));return o}static max(t,e){t=this.checkMatrix(t),e=this.checkMatrix(e);let r=t.rows,n=t.columns,o=new this(r,n);for(let i=0;i<r;i++)for(let r=0;r<n;r++)o.set(i,r,Math.max(t.get(i,r),e.get(i,r)));return o}static checkMatrix(t){return Ye.isMatrix(t)?t:new Ke(t)}static isMatrix(t){return null!=t&&"Matrix"===t.klass}get size(){return this.rows*this.columns}apply(t){if("function"!=typeof t)throw new TypeError("callback must be a function");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)t.call(this,e,r);return this}to1DArray(){let t=[];for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)t.push(this.get(e,r));return t}to2DArray(){let t=[];for(let e=0;e<this.rows;e++){t.push([]);for(let r=0;r<this.columns;r++)t[e].push(this.get(e,r))}return t}toJSON(){return this.to2DArray()}isRowVector(){return 1===this.rows}isColumnVector(){return 1===this.columns}isVector(){return 1===this.rows||1===this.columns}isSquare(){return this.rows===this.columns}isEmpty(){return 0===this.rows||0===this.columns}isSymmetric(){if(this.isSquare()){for(let t=0;t<this.rows;t++)for(let e=0;e<=t;e++)if(this.get(t,e)!==this.get(e,t))return!1;return!0}return!1}isEchelonForm(){let t=0,e=0,r=-1,n=!0,o=!1;for(;t<this.rows&&n;){for(e=0,o=!1;e<this.columns&&!1===o;)0===this.get(t,e)?e++:1===this.get(t,e)&&e>r?(o=!0,r=e):(n=!1,o=!0);t++}return n}isReducedEchelonForm(){let t=0,e=0,r=-1,n=!0,o=!1;for(;t<this.rows&&n;){for(e=0,o=!1;e<this.columns&&!1===o;)0===this.get(t,e)?e++:1===this.get(t,e)&&e>r?(o=!0,r=e):(n=!1,o=!0);for(let r=e+1;r<this.rows;r++)0!==this.get(t,r)&&(n=!1);t++}return n}echelonForm(){let t=this.clone(),e=0,r=0;for(;e<t.rows&&r<t.columns;){let n=e;for(let o=e;o<t.rows;o++)t.get(o,r)>t.get(n,r)&&(n=o);if(0===t.get(n,r))r++;else{t.swapRows(e,n);let o=t.get(e,r);for(let n=r;n<t.columns;n++)t.set(e,n,t.get(e,n)/o);for(let n=e+1;n<t.rows;n++){let o=t.get(n,r)/t.get(e,r);t.set(n,r,0);for(let i=r+1;i<t.columns;i++)t.set(n,i,t.get(n,i)-t.get(e,i)*o)}e++,r++}}return t}reducedEchelonForm(){let t=this.echelonForm(),e=t.columns,r=t.rows,n=r-1;for(;n>=0;)if(0===t.maxRow(n))n--;else{let o=0,i=!1;for(;o<r&&!1===i;)1===t.get(n,o)?i=!0:o++;for(let r=0;r<n;r++){let i=t.get(r,o);for(let s=o;s<e;s++){let e=t.get(r,s)-i*t.get(n,s);t.set(r,s,e)}}n--}return t}set(){throw new Error("set method is unimplemented")}get(){throw new Error("get method is unimplemented")}repeat(t={}){if("object"!=typeof t)throw new TypeError("options must be an object");const{rows:e=1,columns:r=1}=t;if(!Number.isInteger(e)||e<=0)throw new TypeError("rows must be a positive integer");if(!Number.isInteger(r)||r<=0)throw new TypeError("columns must be a positive integer");let n=new Ke(this.rows*e,this.columns*r);for(let t=0;t<e;t++)for(let e=0;e<r;e++)n.setSubMatrix(this,this.rows*t,this.columns*e);return n}fill(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,t);return this}neg(){return this.mulS(-1)}getRow(t){Fe(this,t);let e=[];for(let r=0;r<this.columns;r++)e.push(this.get(t,r));return e}getRowVector(t){return Ke.rowVector(this.getRow(t))}setRow(t,e){Fe(this,t),e=Ve(this,e);for(let r=0;r<this.columns;r++)this.set(t,r,e[r]);return this}swapRows(t,e){Fe(this,t),Fe(this,e);for(let r=0;r<this.columns;r++){let n=this.get(t,r);this.set(t,r,this.get(e,r)),this.set(e,r,n)}return this}getColumn(t){qe(this,t);let e=[];for(let r=0;r<this.rows;r++)e.push(this.get(r,t));return e}getColumnVector(t){return Ke.columnVector(this.getColumn(t))}setColumn(t,e){qe(this,t),e=Be(this,e);for(let r=0;r<this.rows;r++)this.set(r,t,e[r]);return this}swapColumns(t,e){qe(this,t),qe(this,e);for(let r=0;r<this.rows;r++){let n=this.get(r,t);this.set(r,t,this.get(r,e)),this.set(r,e,n)}return this}addRowVector(t){t=Ve(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)+t[r]);return this}subRowVector(t){t=Ve(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)-t[r]);return this}mulRowVector(t){t=Ve(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)*t[r]);return this}divRowVector(t){t=Ve(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)/t[r]);return this}addColumnVector(t){t=Be(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)+t[e]);return this}subColumnVector(t){t=Be(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)-t[e]);return this}mulColumnVector(t){t=Be(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)*t[e]);return this}divColumnVector(t){t=Be(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)/t[e]);return this}mulRow(t,e){Fe(this,t);for(let r=0;r<this.columns;r++)this.set(t,r,this.get(t,r)*e);return this}mulColumn(t,e){qe(this,t);for(let r=0;r<this.rows;r++)this.set(r,t,this.get(r,t)*e);return this}max(t){if(this.isEmpty())return NaN;switch(t){case"row":{const t=new Array(this.rows).fill(Number.NEGATIVE_INFINITY);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.get(e,r)>t[e]&&(t[e]=this.get(e,r));return t}case"column":{const t=new Array(this.columns).fill(Number.NEGATIVE_INFINITY);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.get(e,r)>t[r]&&(t[r]=this.get(e,r));return t}case void 0:{let t=this.get(0,0);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.get(e,r)>t&&(t=this.get(e,r));return t}default:throw new Error(`invalid option: ${t}`)}}maxIndex(){We(this);let t=this.get(0,0),e=[0,0];for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.get(r,n)>t&&(t=this.get(r,n),e[0]=r,e[1]=n);return e}min(t){if(this.isEmpty())return NaN;switch(t){case"row":{const t=new Array(this.rows).fill(Number.POSITIVE_INFINITY);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.get(e,r)<t[e]&&(t[e]=this.get(e,r));return t}case"column":{const t=new Array(this.columns).fill(Number.POSITIVE_INFINITY);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.get(e,r)<t[r]&&(t[r]=this.get(e,r));return t}case void 0:{let t=this.get(0,0);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.get(e,r)<t&&(t=this.get(e,r));return t}default:throw new Error(`invalid option: ${t}`)}}minIndex(){We(this);let t=this.get(0,0),e=[0,0];for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.get(r,n)<t&&(t=this.get(r,n),e[0]=r,e[1]=n);return e}maxRow(t){if(Fe(this,t),this.isEmpty())return NaN;let e=this.get(t,0);for(let r=1;r<this.columns;r++)this.get(t,r)>e&&(e=this.get(t,r));return e}maxRowIndex(t){Fe(this,t),We(this);let e=this.get(t,0),r=[t,0];for(let n=1;n<this.columns;n++)this.get(t,n)>e&&(e=this.get(t,n),r[1]=n);return r}minRow(t){if(Fe(this,t),this.isEmpty())return NaN;let e=this.get(t,0);for(let r=1;r<this.columns;r++)this.get(t,r)<e&&(e=this.get(t,r));return e}minRowIndex(t){Fe(this,t),We(this);let e=this.get(t,0),r=[t,0];for(let n=1;n<this.columns;n++)this.get(t,n)<e&&(e=this.get(t,n),r[1]=n);return r}maxColumn(t){if(qe(this,t),this.isEmpty())return NaN;let e=this.get(0,t);for(let r=1;r<this.rows;r++)this.get(r,t)>e&&(e=this.get(r,t));return e}maxColumnIndex(t){qe(this,t),We(this);let e=this.get(0,t),r=[0,t];for(let n=1;n<this.rows;n++)this.get(n,t)>e&&(e=this.get(n,t),r[0]=n);return r}minColumn(t){if(qe(this,t),this.isEmpty())return NaN;let e=this.get(0,t);for(let r=1;r<this.rows;r++)this.get(r,t)<e&&(e=this.get(r,t));return e}minColumnIndex(t){qe(this,t),We(this);let e=this.get(0,t),r=[0,t];for(let n=1;n<this.rows;n++)this.get(n,t)<e&&(e=this.get(n,t),r[0]=n);return r}diag(){let t=Math.min(this.rows,this.columns),e=[];for(let r=0;r<t;r++)e.push(this.get(r,r));return e}norm(t="frobenius"){let e=0;if("max"===t)return this.max();if("frobenius"===t){for(let t=0;t<this.rows;t++)for(let r=0;r<this.columns;r++)e+=this.get(t,r)*this.get(t,r);return Math.sqrt(e)}throw new RangeError(`unknown norm type: ${t}`)}cumulativeSum(){let t=0;for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)t+=this.get(e,r),this.set(e,r,t);return this}dot(t){Ye.isMatrix(t)&&(t=t.to1DArray());let e=this.to1DArray();if(e.length!==t.length)throw new RangeError("vectors do not have the same size");let r=0;for(let n=0;n<e.length;n++)r+=e[n]*t[n];return r}mmul(t){t=Ke.checkMatrix(t);let e=this.rows,r=this.columns,n=t.columns,o=new Ke(e,n),i=new Float64Array(r);for(let s=0;s<n;s++){for(let e=0;e<r;e++)i[e]=t.get(e,s);for(let t=0;t<e;t++){let e=0;for(let n=0;n<r;n++)e+=this.get(t,n)*i[n];o.set(t,s,e)}}return o}strassen2x2(t){t=Ke.checkMatrix(t);let e=new Ke(2,2);const r=this.get(0,0),n=t.get(0,0),o=this.get(0,1),i=t.get(0,1),s=this.get(1,0),a=t.get(1,0),u=this.get(1,1),d=t.get(1,1),h=(r+u)*(n+d),c=(s+u)*n,l=r*(i-d),f=u*(a-n),g=(r+o)*d,p=h+f-g+(o-u)*(a+d),v=l+g,y=c+f,m=h-c+l+(s-r)*(n+i);return e.set(0,0,p),e.set(0,1,v),e.set(1,0,y),e.set(1,1,m),e}strassen3x3(t){t=Ke.checkMatrix(t);let e=new Ke(3,3);const r=this.get(0,0),n=this.get(0,1),o=this.get(0,2),i=this.get(1,0),s=this.get(1,1),a=this.get(1,2),u=this.get(2,0),d=this.get(2,1),h=this.get(2,2),c=t.get(0,0),l=t.get(0,1),f=t.get(0,2),g=t.get(1,0),p=t.get(1,1),v=t.get(1,2),y=t.get(2,0),m=t.get(2,1),w=t.get(2,2),x=(r-i)*(-l+p),b=(-r+i+s)*(c-l+p),E=(i+s)*(-c+l),N=r*c,_=(-r+u+d)*(c-f+v),M=(-r+u)*(f-v),k=(u+d)*(-c+f),A=(-o+d+h)*(p+y-m),j=(o-h)*(p-m),O=o*y,S=(d+h)*(-y+m),z=(-o+s+a)*(v+y-w),R=(o-a)*(v-w),I=(s+a)*(-y+w),P=N+O+n*g,C=(r+n+o-i-s-d-h)*p+b+E+N+A+O+S,D=N+_+k+(r+n+o-s-a-u-d)*v+O+z+I,T=x+s*(-c+l+g-p-v-y+w)+b+N+O+z+R,L=x+b+E+N+a*m,F=O+z+R+I+i*f,q=N+_+M+d*(-c+f+g-p-v-y+m)+A+j+O,V=A+j+O+S+u*l,B=N+_+M+k+h*w;return e.set(0,0,P),e.set(0,1,C),e.set(0,2,D),e.set(1,0,T),e.set(1,1,L),e.set(1,2,F),e.set(2,0,q),e.set(2,1,V),e.set(2,2,B),e}mmulStrassen(t){t=Ke.checkMatrix(t);let e=this.clone(),r=e.rows,n=e.columns,o=t.rows,i=t.columns;function s(t,e,r){let n=t.rows,o=t.columns;if(n===e&&o===r)return t;{let n=Ye.zeros(e,r);return n=n.setSubMatrix(t,0,0),n}}n!==o&&console.warn(`Multiplying ${r} x ${n} and ${o} x ${i} matrix: dimensions do not match.`);let a=Math.max(r,o),u=Math.max(n,i);return e=s(e,a,u),function t(e,r,n,o){if(n<=512||o<=512)return e.mmul(r);n%2==1&&o%2==1?(e=s(e,n+1,o+1),r=s(r,n+1,o+1)):n%2==1?(e=s(e,n+1,o),r=s(r,n+1,o)):o%2==1&&(e=s(e,n,o+1),r=s(r,n,o+1));let i=parseInt(e.rows/2,10),a=parseInt(e.columns/2,10),u=e.subMatrix(0,i-1,0,a-1),d=r.subMatrix(0,i-1,0,a-1),h=e.subMatrix(0,i-1,a,e.columns-1),c=r.subMatrix(0,i-1,a,r.columns-1),l=e.subMatrix(i,e.rows-1,0,a-1),f=r.subMatrix(i,r.rows-1,0,a-1),g=e.subMatrix(i,e.rows-1,a,e.columns-1),p=r.subMatrix(i,r.rows-1,a,r.columns-1),v=t(Ye.add(u,g),Ye.add(d,p),i,a),y=t(Ye.add(l,g),d,i,a),m=t(u,Ye.sub(c,p),i,a),w=t(g,Ye.sub(f,d),i,a),x=t(Ye.add(u,h),p,i,a),b=t(Ye.sub(l,u),Ye.add(d,c),i,a),E=t(Ye.sub(h,g),Ye.add(f,p),i,a),N=Ye.add(v,w);N.sub(x),N.add(E);let _=Ye.add(m,x),M=Ye.add(y,w),k=Ye.sub(v,y);k.add(m),k.add(b);let A=Ye.zeros(2*N.rows,2*N.columns);return A=A.setSubMatrix(N,0,0),A=A.setSubMatrix(_,N.rows,0),A=A.setSubMatrix(M,0,N.columns),A=A.setSubMatrix(k,N.rows,N.columns),A.subMatrix(0,n-1,0,o-1)}(e,t=s(t,a,u),a,u)}scaleRows(t={}){if("object"!=typeof t)throw new TypeError("options must be an object");const{min:e=0,max:r=1}=t;if(!Number.isFinite(e))throw new TypeError("min must be a number");if(!Number.isFinite(r))throw new TypeError("max must be a number");if(e>=r)throw new RangeError("min must be smaller than max");let n=new Ke(this.rows,this.columns);for(let t=0;t<this.rows;t++){const o=this.getRow(t);o.length>0&&Ie(o,{min:e,max:r,output:o}),n.setRow(t,o)}return n}scaleColumns(t={}){if("object"!=typeof t)throw new TypeError("options must be an object");const{min:e=0,max:r=1}=t;if(!Number.isFinite(e))throw new TypeError("min must be a number");if(!Number.isFinite(r))throw new TypeError("max must be a number");if(e>=r)throw new RangeError("min must be smaller than max");let n=new Ke(this.rows,this.columns);for(let t=0;t<this.columns;t++){const o=this.getColumn(t);o.length&&Ie(o,{min:e,max:r,output:o}),n.setColumn(t,o)}return n}flipRows(){const t=Math.ceil(this.columns/2);for(let e=0;e<this.rows;e++)for(let r=0;r<t;r++){let t=this.get(e,r),n=this.get(e,this.columns-1-r);this.set(e,r,n),this.set(e,this.columns-1-r,t)}return this}flipColumns(){const t=Math.ceil(this.rows/2);for(let e=0;e<this.columns;e++)for(let r=0;r<t;r++){let t=this.get(r,e),n=this.get(this.rows-1-r,e);this.set(r,e,n),this.set(this.rows-1-r,e,t)}return this}kroneckerProduct(t){t=Ke.checkMatrix(t);let e=this.rows,r=this.columns,n=t.rows,o=t.columns,i=new Ke(e*n,r*o);for(let s=0;s<e;s++)for(let e=0;e<r;e++)for(let r=0;r<n;r++)for(let a=0;a<o;a++)i.set(n*s+r,o*e+a,this.get(s,e)*t.get(r,a));return i}kroneckerSum(t){if(t=Ke.checkMatrix(t),!this.isSquare()||!t.isSquare())throw new Error("Kronecker Sum needs two Square Matrices");let e=this.rows,r=t.rows,n=this.kroneckerProduct(Ke.eye(r,r)),o=Ke.eye(e,e).kroneckerProduct(t);return n.add(o)}transpose(){let t=new Ke(this.columns,this.rows);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)t.set(r,e,this.get(e,r));return t}sortRows(t=He){for(let e=0;e<this.rows;e++)this.setRow(e,this.getRow(e).sort(t));return this}sortColumns(t=He){for(let e=0;e<this.columns;e++)this.setColumn(e,this.getColumn(e).sort(t));return this}subMatrix(t,e,r,n){$e(this,t,e,r,n);let o=new Ke(e-t+1,n-r+1);for(let i=t;i<=e;i++)for(let e=r;e<=n;e++)o.set(i-t,e-r,this.get(i,e));return o}subMatrixRow(t,e,r){if(void 0===e&&(e=0),void 0===r&&(r=this.columns-1),e>r||e<0||e>=this.columns||r<0||r>=this.columns)throw new RangeError("Argument out of range");let n=new Ke(t.length,r-e+1);for(let o=0;o<t.length;o++)for(let i=e;i<=r;i++){if(t[o]<0||t[o]>=this.rows)throw new RangeError(`Row index out of range: ${t[o]}`);n.set(o,i-e,this.get(t[o],i))}return n}subMatrixColumn(t,e,r){if(void 0===e&&(e=0),void 0===r&&(r=this.rows-1),e>r||e<0||e>=this.rows||r<0||r>=this.rows)throw new RangeError("Argument out of range");let n=new Ke(r-e+1,t.length);for(let o=0;o<t.length;o++)for(let i=e;i<=r;i++){if(t[o]<0||t[o]>=this.columns)throw new RangeError(`Column index out of range: ${t[o]}`);n.set(i-e,o,this.get(i,t[o]))}return n}setSubMatrix(t,e,r){if((t=Ke.checkMatrix(t)).isEmpty())return this;$e(this,e,e+t.rows-1,r,r+t.columns-1);for(let n=0;n<t.rows;n++)for(let o=0;o<t.columns;o++)this.set(e+n,r+o,t.get(n,o));return this}selection(t,e){!function(t,e){if(!Re(e))throw new TypeError("row indices must be an array");for(let r=0;r<e.length;r++)if(e[r]<0||e[r]>=t.rows)throw new RangeError("row indices are out of range")}(this,t),function(t,e){if(!Re(e))throw new TypeError("column indices must be an array");for(let r=0;r<e.length;r++)if(e[r]<0||e[r]>=t.columns)throw new RangeError("column indices are out of range")}(this,e);let r=new Ke(t.length,e.length);for(let n=0;n<t.length;n++){let o=t[n];for(let t=0;t<e.length;t++){let i=e[t];r.set(n,t,this.get(o,i))}}return r}trace(){let t=Math.min(this.rows,this.columns),e=0;for(let r=0;r<t;r++)e+=this.get(r,r);return e}clone(){let t=new Ke(this.rows,this.columns);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)t.set(e,r,this.get(e,r));return t}sum(t){switch(t){case"row":return function(t){let e=Ge(t.rows);for(let r=0;r<t.rows;++r)for(let n=0;n<t.columns;++n)e[r]+=t.get(r,n);return e}(this);case"column":return function(t){let e=Ge(t.columns);for(let r=0;r<t.rows;++r)for(let n=0;n<t.columns;++n)e[n]+=t.get(r,n);return e}(this);case void 0:return function(t){let e=0;for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)e+=t.get(r,n);return e}(this);default:throw new Error(`invalid option: ${t}`)}}product(t){switch(t){case"row":return function(t){let e=Ge(t.rows,1);for(let r=0;r<t.rows;++r)for(let n=0;n<t.columns;++n)e[r]*=t.get(r,n);return e}(this);case"column":return function(t){let e=Ge(t.columns,1);for(let r=0;r<t.rows;++r)for(let n=0;n<t.columns;++n)e[n]*=t.get(r,n);return e}(this);case void 0:return function(t){let e=1;for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)e*=t.get(r,n);return e}(this);default:throw new Error(`invalid option: ${t}`)}}mean(t){const e=this.sum(t);switch(t){case"row":for(let t=0;t<this.rows;t++)e[t]/=this.columns;return e;case"column":for(let t=0;t<this.columns;t++)e[t]/=this.rows;return e;case void 0:return e/this.size;default:throw new Error(`invalid option: ${t}`)}}variance(t,e={}){if("object"==typeof t&&(e=t,t=void 0),"object"!=typeof e)throw new TypeError("options must be an object");const{unbiased:r=!0,mean:n=this.mean(t)}=e;if("boolean"!=typeof r)throw new TypeError("unbiased must be a boolean");switch(t){case"row":if(!Re(n))throw new TypeError("mean must be an array");return function(t,e,r){const n=t.rows,o=t.columns,i=[];for(let s=0;s<n;s++){let n=0,a=0,u=0;for(let e=0;e<o;e++)u=t.get(s,e)-r[s],n+=u,a+=u*u;e?i.push((a-n*n/o)/(o-1)):i.push((a-n*n/o)/o)}return i}(this,r,n);case"column":if(!Re(n))throw new TypeError("mean must be an array");return function(t,e,r){const n=t.rows,o=t.columns,i=[];for(let s=0;s<o;s++){let o=0,a=0,u=0;for(let e=0;e<n;e++)u=t.get(e,s)-r[s],o+=u,a+=u*u;e?i.push((a-o*o/n)/(n-1)):i.push((a-o*o/n)/n)}return i}(this,r,n);case void 0:if("number"!=typeof n)throw new TypeError("mean must be a number");return function(t,e,r){const n=t.rows,o=t.columns,i=n*o;let s=0,a=0,u=0;for(let e=0;e<n;e++)for(let n=0;n<o;n++)u=t.get(e,n)-r,s+=u,a+=u*u;return e?(a-s*s/i)/(i-1):(a-s*s/i)/i}(this,r,n);default:throw new Error(`invalid option: ${t}`)}}standardDeviation(t,e){"object"==typeof t&&(e=t,t=void 0);const r=this.variance(t,e);if(void 0===t)return Math.sqrt(r);for(let t=0;t<r.length;t++)r[t]=Math.sqrt(r[t]);return r}center(t,e={}){if("object"==typeof t&&(e=t,t=void 0),"object"!=typeof e)throw new TypeError("options must be an object");const{center:r=this.mean(t)}=e;switch(t){case"row":if(!Re(r))throw new TypeError("center must be an array");return function(t,e){for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)t.set(r,n,t.get(r,n)-e[r])}(this,r),this;case"column":if(!Re(r))throw new TypeError("center must be an array");return function(t,e){for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)t.set(r,n,t.get(r,n)-e[n])}(this,r),this;case void 0:if("number"!=typeof r)throw new TypeError("center must be a number");return function(t,e){for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)t.set(r,n,t.get(r,n)-e)}(this,r),this;default:throw new Error(`invalid option: ${t}`)}}scale(t,e={}){if("object"==typeof t&&(e=t,t=void 0),"object"!=typeof e)throw new TypeError("options must be an object");let r=e.scale;switch(t){case"row":if(void 0===r)r=function(t){const e=[];for(let r=0;r<t.rows;r++){let n=0;for(let e=0;e<t.columns;e++)n+=Math.pow(t.get(r,e),2)/(t.columns-1);e.push(Math.sqrt(n))}return e}(this);else if(!Re(r))throw new TypeError("scale must be an array");return function(t,e){for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)t.set(r,n,t.get(r,n)/e[r])}(this,r),this;case"column":if(void 0===r)r=function(t){const e=[];for(let r=0;r<t.columns;r++){let n=0;for(let e=0;e<t.rows;e++)n+=Math.pow(t.get(e,r),2)/(t.rows-1);e.push(Math.sqrt(n))}return e}(this);else if(!Re(r))throw new TypeError("scale must be an array");return function(t,e){for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)t.set(r,n,t.get(r,n)/e[n])}(this,r),this;case void 0:if(void 0===r)r=function(t){const e=t.size-1;let r=0;for(let n=0;n<t.columns;n++)for(let o=0;o<t.rows;o++)r+=Math.pow(t.get(o,n),2)/e;return Math.sqrt(r)}(this);else if("number"!=typeof r)throw new TypeError("scale must be a number");return function(t,e){for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)t.set(r,n,t.get(r,n)/e)}(this,r),this;default:throw new Error(`invalid option: ${t}`)}}toString(t){return De(this,t)}}function He(t,e){return t-e}Ye.prototype.klass="Matrix","undefined"!=typeof Symbol&&(Ye.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return De(this)}),Ye.random=Ye.rand,Ye.randomInt=Ye.randInt,Ye.diagonal=Ye.diag,Ye.prototype.diagonal=Ye.prototype.diag,Ye.identity=Ye.eye,Ye.prototype.negate=Ye.prototype.neg,Ye.prototype.tensorProduct=Ye.prototype.kroneckerProduct;class Ke extends Ye{constructor(t,e){if(super(),Ke.isMatrix(t))return t.clone();if(Number.isInteger(t)&&t>=0){if(this.data=[],!(Number.isInteger(e)&&e>=0))throw new TypeError("nColumns must be a positive integer");for(let r=0;r<t;r++)this.data.push(new Float64Array(e))}else{if(!Re(t))throw new TypeError("First argument must be a positive number or an array");{const r=t;if("number"!=typeof(e=(t=r.length)?r[0].length:0))throw new TypeError("Data must be a 2D array with at least one element");this.data=[];for(let n=0;n<t;n++){if(r[n].length!==e)throw new RangeError("Inconsistent array dimensions");if(!r[n].every((t=>"number"==typeof t)))throw new TypeError("Input data contains non-numeric values");this.data.push(Float64Array.from(r[n]))}}}this.rows=t,this.columns=e}set(t,e,r){return this.data[t][e]=r,this}get(t,e){return this.data[t][e]}removeRow(t){return Fe(this,t),this.data.splice(t,1),this.rows-=1,this}addRow(t,e){return void 0===e&&(e=t,t=this.rows),Fe(this,t,!0),e=Float64Array.from(Ve(this,e)),this.data.splice(t,0,e),this.rows+=1,this}removeColumn(t){qe(this,t);for(let e=0;e<this.rows;e++){const r=new Float64Array(this.columns-1);for(let n=0;n<t;n++)r[n]=this.data[e][n];for(let n=t+1;n<this.columns;n++)r[n-1]=this.data[e][n];this.data[e]=r}return this.columns-=1,this}addColumn(t,e){void 0===e&&(e=t,t=this.columns),qe(this,t,!0),e=Be(this,e);for(let r=0;r<this.rows;r++){const n=new Float64Array(this.columns+1);let o=0;for(;o<t;o++)n[o]=this.data[r][o];for(n[o++]=e[r];o<this.columns+1;o++)n[o]=this.data[r][o-1];this.data[r]=n}return this.columns+=1,this}}!function(t,e){t.prototype.add=function(t){return"number"==typeof t?this.addS(t):this.addM(t)},t.prototype.addS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)+t);return this},t.prototype.addM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)+t.get(e,r));return this},t.add=function(t,r){return new e(t).add(r)},t.prototype.sub=function(t){return"number"==typeof t?this.subS(t):this.subM(t)},t.prototype.subS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)-t);return this},t.prototype.subM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)-t.get(e,r));return this},t.sub=function(t,r){return new e(t).sub(r)},t.prototype.subtract=t.prototype.sub,t.prototype.subtractS=t.prototype.subS,t.prototype.subtractM=t.prototype.subM,t.subtract=t.sub,t.prototype.mul=function(t){return"number"==typeof t?this.mulS(t):this.mulM(t)},t.prototype.mulS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)*t);return this},t.prototype.mulM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)*t.get(e,r));return this},t.mul=function(t,r){return new e(t).mul(r)},t.prototype.multiply=t.prototype.mul,t.prototype.multiplyS=t.prototype.mulS,t.prototype.multiplyM=t.prototype.mulM,t.multiply=t.mul,t.prototype.div=function(t){return"number"==typeof t?this.divS(t):this.divM(t)},t.prototype.divS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)/t);return this},t.prototype.divM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)/t.get(e,r));return this},t.div=function(t,r){return new e(t).div(r)},t.prototype.divide=t.prototype.div,t.prototype.divideS=t.prototype.divS,t.prototype.divideM=t.prototype.divM,t.divide=t.div,t.prototype.mod=function(t){return"number"==typeof t?this.modS(t):this.modM(t)},t.prototype.modS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)%t);return this},t.prototype.modM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)%t.get(e,r));return this},t.mod=function(t,r){return new e(t).mod(r)},t.prototype.modulus=t.prototype.mod,t.prototype.modulusS=t.prototype.modS,t.prototype.modulusM=t.prototype.modM,t.modulus=t.mod,t.prototype.and=function(t){return"number"==typeof t?this.andS(t):this.andM(t)},t.prototype.andS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)&t);return this},t.prototype.andM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)&t.get(e,r));return this},t.and=function(t,r){return new e(t).and(r)},t.prototype.or=function(t){return"number"==typeof t?this.orS(t):this.orM(t)},t.prototype.orS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)|t);return this},t.prototype.orM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)|t.get(e,r));return this},t.or=function(t,r){return new e(t).or(r)},t.prototype.xor=function(t){return"number"==typeof t?this.xorS(t):this.xorM(t)},t.prototype.xorS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)^t);return this},t.prototype.xorM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)^t.get(e,r));return this},t.xor=function(t,r){return new e(t).xor(r)},t.prototype.leftShift=function(t){return"number"==typeof t?this.leftShiftS(t):this.leftShiftM(t)},t.prototype.leftShiftS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)<<t);return this},t.prototype.leftShiftM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)<<t.get(e,r));return this},t.leftShift=function(t,r){return new e(t).leftShift(r)},t.prototype.signPropagatingRightShift=function(t){return"number"==typeof t?this.signPropagatingRightShiftS(t):this.signPropagatingRightShiftM(t)},t.prototype.signPropagatingRightShiftS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)>>t);return this},t.prototype.signPropagatingRightShiftM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)>>t.get(e,r));return this},t.signPropagatingRightShift=function(t,r){return new e(t).signPropagatingRightShift(r)},t.prototype.rightShift=function(t){return"number"==typeof t?this.rightShiftS(t):this.rightShiftM(t)},t.prototype.rightShiftS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)>>>t);return this},t.prototype.rightShiftM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)>>>t.get(e,r));return this},t.rightShift=function(t,r){return new e(t).rightShift(r)},t.prototype.zeroFillRightShift=t.prototype.rightShift,t.prototype.zeroFillRightShiftS=t.prototype.rightShiftS,t.prototype.zeroFillRightShiftM=t.prototype.rightShiftM,t.zeroFillRightShift=t.rightShift,t.prototype.not=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,~this.get(t,e));return this},t.not=function(t){return new e(t).not()},t.prototype.abs=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.abs(this.get(t,e)));return this},t.abs=function(t){return new e(t).abs()},t.prototype.acos=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.acos(this.get(t,e)));return this},t.acos=function(t){return new e(t).acos()},t.prototype.acosh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.acosh(this.get(t,e)));return this},t.acosh=function(t){return new e(t).acosh()},t.prototype.asin=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.asin(this.get(t,e)));return this},t.asin=function(t){return new e(t).asin()},t.prototype.asinh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.asinh(this.get(t,e)));return this},t.asinh=function(t){return new e(t).asinh()},t.prototype.atan=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.atan(this.get(t,e)));return this},t.atan=function(t){return new e(t).atan()},t.prototype.atanh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.atanh(this.get(t,e)));return this},t.atanh=function(t){return new e(t).atanh()},t.prototype.cbrt=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.cbrt(this.get(t,e)));return this},t.cbrt=function(t){return new e(t).cbrt()},t.prototype.ceil=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.ceil(this.get(t,e)));return this},t.ceil=function(t){return new e(t).ceil()},t.prototype.clz32=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.clz32(this.get(t,e)));return this},t.clz32=function(t){return new e(t).clz32()},t.prototype.cos=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.cos(this.get(t,e)));return this},t.cos=function(t){return new e(t).cos()},t.prototype.cosh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.cosh(this.get(t,e)));return this},t.cosh=function(t){return new e(t).cosh()},t.prototype.exp=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.exp(this.get(t,e)));return this},t.exp=function(t){return new e(t).exp()},t.prototype.expm1=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.expm1(this.get(t,e)));return this},t.expm1=function(t){return new e(t).expm1()},t.prototype.floor=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.floor(this.get(t,e)));return this},t.floor=function(t){return new e(t).floor()},t.prototype.fround=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.fround(this.get(t,e)));return this},t.fround=function(t){return new e(t).fround()},t.prototype.log=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.log(this.get(t,e)));return this},t.log=function(t){return new e(t).log()},t.prototype.log1p=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.log1p(this.get(t,e)));return this},t.log1p=function(t){return new e(t).log1p()},t.prototype.log10=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.log10(this.get(t,e)));return this},t.log10=function(t){return new e(t).log10()},t.prototype.log2=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.log2(this.get(t,e)));return this},t.log2=function(t){return new e(t).log2()},t.prototype.round=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.round(this.get(t,e)));return this},t.round=function(t){return new e(t).round()},t.prototype.sign=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.sign(this.get(t,e)));return this},t.sign=function(t){return new e(t).sign()},t.prototype.sin=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.sin(this.get(t,e)));return this},t.sin=function(t){return new e(t).sin()},t.prototype.sinh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.sinh(this.get(t,e)));return this},t.sinh=function(t){return new e(t).sinh()},t.prototype.sqrt=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.sqrt(this.get(t,e)));return this},t.sqrt=function(t){return new e(t).sqrt()},t.prototype.tan=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.tan(this.get(t,e)));return this},t.tan=function(t){return new e(t).tan()},t.prototype.tanh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.tanh(this.get(t,e)));return this},t.tanh=function(t){return new e(t).tanh()},t.prototype.trunc=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.trunc(this.get(t,e)));return this},t.trunc=function(t){return new e(t).trunc()},t.pow=function(t,r){return new e(t).pow(r)},t.prototype.pow=function(t){return"number"==typeof t?this.powS(t):this.powM(t)},t.prototype.powS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,Math.pow(this.get(e,r),t));return this},t.prototype.powM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,Math.pow(this.get(e,r),t.get(e,r)));return this}}(Ye,Ke);class Je extends Ye{constructor(t){super(),this.data=t,this.rows=t.length,this.columns=t[0].length}set(t,e,r){return this.data[t][e]=r,this}get(t,e){return this.data[t][e]}}function Xe(t,e){let r=0;return Math.abs(t)>Math.abs(e)?(r=e/t,Math.abs(t)*Math.sqrt(1+r*r)):0!==e?(r=t/e,Math.abs(e)*Math.sqrt(1+r*r)):0}class Qe{constructor(t,e={}){if((t=Je.checkMatrix(t)).isEmpty())throw new Error("Matrix must be non-empty");let r=t.rows,n=t.columns;const{computeLeftSingularVectors:o=!0,computeRightSingularVectors:i=!0,autoTranspose:s=!1}=e;let a,u=Boolean(o),d=Boolean(i),h=!1;if(r<n)if(s){a=t.transpose(),r=a.rows,n=a.columns,h=!0;let e=u;u=d,d=e}else a=t.clone(),console.warn("Computing SVD on a matrix with more columns than rows. Consider enabling autoTranspose");else a=t.clone();let c=Math.min(r,n),l=Math.min(r+1,n),f=new Float64Array(l),g=new Ke(r,c),p=new Ke(n,n),v=new Float64Array(n),y=new Float64Array(r),m=new Float64Array(l);for(let t=0;t<l;t++)m[t]=t;let w=Math.min(r-1,n),x=Math.max(0,Math.min(n-2,r)),b=Math.max(w,x);for(let t=0;t<b;t++){if(t<w){f[t]=0;for(let e=t;e<r;e++)f[t]=Xe(f[t],a.get(e,t));if(0!==f[t]){a.get(t,t)<0&&(f[t]=-f[t]);for(let e=t;e<r;e++)a.set(e,t,a.get(e,t)/f[t]);a.set(t,t,a.get(t,t)+1)}f[t]=-f[t]}for(let e=t+1;e<n;e++){if(t<w&&0!==f[t]){let n=0;for(let o=t;o<r;o++)n+=a.get(o,t)*a.get(o,e);n=-n/a.get(t,t);for(let o=t;o<r;o++)a.set(o,e,a.get(o,e)+n*a.get(o,t))}v[e]=a.get(t,e)}if(u&&t<w)for(let e=t;e<r;e++)g.set(e,t,a.get(e,t));if(t<x){v[t]=0;for(let e=t+1;e<n;e++)v[t]=Xe(v[t],v[e]);if(0!==v[t]){v[t+1]<0&&(v[t]=0-v[t]);for(let e=t+1;e<n;e++)v[e]/=v[t];v[t+1]+=1}if(v[t]=-v[t],t+1<r&&0!==v[t]){for(let e=t+1;e<r;e++)y[e]=0;for(let e=t+1;e<r;e++)for(let r=t+1;r<n;r++)y[e]+=v[r]*a.get(e,r);for(let e=t+1;e<n;e++){let n=-v[e]/v[t+1];for(let o=t+1;o<r;o++)a.set(o,e,a.get(o,e)+n*y[o])}}if(d)for(let e=t+1;e<n;e++)p.set(e,t,v[e])}}let E=Math.min(n,r+1);if(w<n&&(f[w]=a.get(w,w)),r<E&&(f[E-1]=0),x+1<E&&(v[x]=a.get(x,E-1)),v[E-1]=0,u){for(let t=w;t<c;t++){for(let e=0;e<r;e++)g.set(e,t,0);g.set(t,t,1)}for(let t=w-1;t>=0;t--)if(0!==f[t]){for(let e=t+1;e<c;e++){let n=0;for(let o=t;o<r;o++)n+=g.get(o,t)*g.get(o,e);n=-n/g.get(t,t);for(let o=t;o<r;o++)g.set(o,e,g.get(o,e)+n*g.get(o,t))}for(let e=t;e<r;e++)g.set(e,t,-g.get(e,t));g.set(t,t,1+g.get(t,t));for(let e=0;e<t-1;e++)g.set(e,t,0)}else{for(let e=0;e<r;e++)g.set(e,t,0);g.set(t,t,1)}}if(d)for(let t=n-1;t>=0;t--){if(t<x&&0!==v[t])for(let e=t+1;e<n;e++){let r=0;for(let o=t+1;o<n;o++)r+=p.get(o,t)*p.get(o,e);r=-r/p.get(t+1,t);for(let o=t+1;o<n;o++)p.set(o,e,p.get(o,e)+r*p.get(o,t))}for(let e=0;e<n;e++)p.set(e,t,0);p.set(t,t,1)}let N=E-1,_=0,M=Number.EPSILON;for(;E>0;){let t,e;for(t=E-2;t>=-1&&-1!==t;t--){const e=Number.MIN_VALUE+M*Math.abs(f[t]+Math.abs(f[t+1]));if(Math.abs(v[t])<=e||Number.isNaN(v[t])){v[t]=0;break}}if(t===E-2)e=4;else{let r;for(r=E-1;r>=t&&r!==t;r--){let e=(r!==E?Math.abs(v[r]):0)+(r!==t+1?Math.abs(v[r-1]):0);if(Math.abs(f[r])<=M*e){f[r]=0;break}}r===t?e=3:r===E-1?e=1:(e=2,t=r)}switch(t++,e){case 1:{let e=v[E-2];v[E-2]=0;for(let r=E-2;r>=t;r--){let o=Xe(f[r],e),i=f[r]/o,s=e/o;if(f[r]=o,r!==t&&(e=-s*v[r-1],v[r-1]=i*v[r-1]),d)for(let t=0;t<n;t++)o=i*p.get(t,r)+s*p.get(t,E-1),p.set(t,E-1,-s*p.get(t,r)+i*p.get(t,E-1)),p.set(t,r,o)}break}case 2:{let e=v[t-1];v[t-1]=0;for(let n=t;n<E;n++){let o=Xe(f[n],e),i=f[n]/o,s=e/o;if(f[n]=o,e=-s*v[n],v[n]=i*v[n],u)for(let e=0;e<r;e++)o=i*g.get(e,n)+s*g.get(e,t-1),g.set(e,t-1,-s*g.get(e,n)+i*g.get(e,t-1)),g.set(e,n,o)}break}case 3:{const e=Math.max(Math.abs(f[E-1]),Math.abs(f[E-2]),Math.abs(v[E-2]),Math.abs(f[t]),Math.abs(v[t])),o=f[E-1]/e,i=f[E-2]/e,s=v[E-2]/e,a=f[t]/e,h=v[t]/e,c=((i+o)*(i-o)+s*s)/2,l=o*s*(o*s);let y=0;0===c&&0===l||(y=c<0?0-Math.sqrt(c*c+l):Math.sqrt(c*c+l),y=l/(c+y));let m=(a+o)*(a-o)+y,w=a*h;for(let e=t;e<E-1;e++){let o=Xe(m,w);0===o&&(o=Number.MIN_VALUE);let i=m/o,s=w/o;if(e!==t&&(v[e-1]=o),m=i*f[e]+s*v[e],v[e]=i*v[e]-s*f[e],w=s*f[e+1],f[e+1]=i*f[e+1],d)for(let t=0;t<n;t++)o=i*p.get(t,e)+s*p.get(t,e+1),p.set(t,e+1,-s*p.get(t,e)+i*p.get(t,e+1)),p.set(t,e,o);if(o=Xe(m,w),0===o&&(o=Number.MIN_VALUE),i=m/o,s=w/o,f[e]=o,m=i*v[e]+s*f[e+1],f[e+1]=-s*v[e]+i*f[e+1],w=s*v[e+1],v[e+1]=i*v[e+1],u&&e<r-1)for(let t=0;t<r;t++)o=i*g.get(t,e)+s*g.get(t,e+1),g.set(t,e+1,-s*g.get(t,e)+i*g.get(t,e+1)),g.set(t,e,o)}v[E-2]=m,_+=1;break}case 4:if(f[t]<=0&&(f[t]=f[t]<0?-f[t]:0,d))for(let e=0;e<=N;e++)p.set(e,t,-p.get(e,t));for(;t<N&&!(f[t]>=f[t+1]);){let e=f[t];if(f[t]=f[t+1],f[t+1]=e,d&&t<n-1)for(let r=0;r<n;r++)e=p.get(r,t+1),p.set(r,t+1,p.get(r,t)),p.set(r,t,e);if(u&&t<r-1)for(let n=0;n<r;n++)e=g.get(n,t+1),g.set(n,t+1,g.get(n,t)),g.set(n,t,e);t++}_=0,E--}}if(h){let t=p;p=g,g=t}this.m=r,this.n=n,this.s=f,this.U=g,this.V=p}solve(t){let e=t,r=this.threshold,n=this.s.length,o=Ke.zeros(n,n);for(let t=0;t<n;t++)Math.abs(this.s[t])<=r?o.set(t,t,0):o.set(t,t,1/this.s[t]);let i=this.U,s=this.rightSingularVectors,a=s.mmul(o),u=s.rows,d=i.rows,h=Ke.zeros(u,d);for(let t=0;t<u;t++)for(let e=0;e<d;e++){let r=0;for(let o=0;o<n;o++)r+=a.get(t,o)*i.get(e,o);h.set(t,e,r)}return h.mmul(e)}solveForDiagonal(t){return this.solve(Ke.diag(t))}inverse(){let t=this.V,e=this.threshold,r=t.rows,n=t.columns,o=new Ke(r,this.s.length);for(let i=0;i<r;i++)for(let r=0;r<n;r++)Math.abs(this.s[r])>e&&o.set(i,r,t.get(i,r)/this.s[r]);let i=this.U,s=i.rows,a=i.columns,u=new Ke(r,s);for(let t=0;t<r;t++)for(let e=0;e<s;e++){let r=0;for(let n=0;n<a;n++)r+=o.get(t,n)*i.get(e,n);u.set(t,e,r)}return u}get condition(){return this.s[0]/this.s[Math.min(this.m,this.n)-1]}get norm2(){return this.s[0]}get rank(){let t=Math.max(this.m,this.n)*this.s[0]*Number.EPSILON,e=0,r=this.s;for(let n=0,o=r.length;n<o;n++)r[n]>t&&e++;return e}get diagonal(){return Array.from(this.s)}get threshold(){return Number.EPSILON/2*Math.max(this.m,this.n)*this.s[0]}get leftSingularVectors(){return this.U}get rightSingularVectors(){return this.V}get diagonalMatrix(){return Ke.diag(this.s)}}const Ze=t=>{const e=[],r=t.length;for(let n=0;n<r;n+=1){e[n]=[];for(let o=0;o<r;o+=1)n===o?e[n][o]=0:0!==t[n][o]&&t[n][o]?e[n][o]=t[n][o]:e[n][o]=1/0}for(let t=0;t<r;t+=1)for(let n=0;n<r;n+=1)for(let o=0;o<r;o+=1)e[n][o]>e[n][t]+e[t][o]&&(e[n][o]=e[n][t]+e[t][o]);return e},tr=(t,e)=>{const{nodes:r,edges:n}=t,o=[],i={};if(!r)throw new Error("invalid nodes data!");return r&&r.forEach(((t,e)=>{i[t.id]=e,o.push([])})),null==n||n.forEach((t=>{const{source:r,target:n}=t,s=i[r],a=i[n];void 0!==s&&void 0!==a&&(o[s][a]=1,e||(o[a][s]=1))})),o},er=(t,e)=>Math.sqrt((t.x-e.x)*(t.x-e.x)+(t.y-e.y)*(t.y-e.y)),rr=(t,e,r,n="TB",o,i={})=>{if(!(null==e?void 0:e.length))return;const{stopBranchFn:s,stopAllFn:a}=i;for(let u=0;u<e.length;u++){const d=e[u];if(t.hasNode(d.id)&&!(null==s?void 0:s(d))){if(null==a?void 0:a(d))return;"TB"===n&&r(d),rr(t,t.getChildren(d.id,o),r,n,o,i),"TB"!==n&&r(d)}}},nr={center:[0,0],linkDistance:50};class or{constructor(t={}){this.options=t,this.id="mds",this.options=Object.assign(Object.assign({},nr),t)}execute(e,r){return t(this,void 0,void 0,(function*(){return this.genericMDSLayout(!1,e,r)}))}assign(e,r){return t(this,void 0,void 0,(function*(){yield this.genericMDSLayout(!0,e,r)}))}genericMDSLayout(e,r,n){return t(this,void 0,void 0,(function*(){const t=Object.assign(Object.assign({},this.options),n),{center:o=[0,0],linkDistance:i=50}=t,s=r.getAllNodes(),a=r.getAllEdges();if(!(null==s?void 0:s.length)||1===s.length)return Qt(r,e,o);const u=tr({nodes:s,edges:a},!1),d=Ze(u);ir(d);const h=((t,e)=>{const r=[];return t.forEach((t=>{const n=[];t.forEach((t=>{n.push(t*e)})),r.push(n)})),r})(d,i),c=sr(h),l=[];return c.forEach(((t,e)=>{const r=Jt(s[e]);r.data.x=t[0]+o[0],r.data.y=t[1]+o[1],l.push(r)})),e&&l.forEach((t=>r.mergeNodeData(t.id,{x:t.data.x,y:t.data.y}))),{nodes:l,edges:a}}))}}const ir=t=>{let e=-999999;t.forEach((t=>{t.forEach((t=>{t!==1/0&&e<t&&(e=t)}))})),t.forEach(((r,n)=>{r.forEach(((r,o)=>{r===1/0&&(t[n][o]=e)}))}))},sr=t=>{const e=Ke.mul(Ke.pow(t,2),-.5),r=e.mean("row"),n=e.mean("column"),o=e.mean();e.add(o).subRowVector(r).subColumnVector(n);const i=new Qe(e),s=Ke.sqrt(i.diagonalMatrix).diagonal();return i.leftSingularVectors.toJSON().map((t=>Ke.mul([t],[s]).toJSON()[0].splice(0,2)))};function ar(t){return!!t.tick&&!!t.stop}const ur={gForce:!0,force2:!0,d3force:!0,fruchterman:!0,forceAtlas2:!0,force:!0,"graphin-force":!0},dr={center:[0,0],comboPadding:10,treeKey:"combo"};function hr(e,r,n,o){var i;return t(this,void 0,void 0,(function*(){return ar(e)?(e.execute(r,n),e.stop(),e.tick(null!==(i=n.iterations)&&void 0!==i?i:300)):o?yield e.assign(r,n):yield e.execute(r,n)}))}const cr=function(t){if(!function(t){return"object"==typeof t&&null!==t}(t)||!h(t,"Object"))return!1;if(null===Object.getPrototypeOf(t))return!0;for(var e=t;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e};function lr(t,e,r,n){for(var o in r=r||0,n=n||5,e)if(e.hasOwnProperty(o)){var i=e[o];null!==i&&cr(i)?(cr(t[o])||(t[o]={}),r<n?lr(t[o],i,r+1,n):t[o]=e[o]):T(i)?(t[o]=[],t[o]=t[o].concat(i)):void 0!==i&&(t[o]=i)}}const fr=function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];for(var n=0;n<e.length;n+=1)lr(t,e[n]);return t};var gr=Object.prototype.hasOwnProperty;const pr=function(t,e){if(null===t||!cr(t))return{};var r={};return function(t,e){if(t)if(T(t))for(var r=0,n=t.length;r<n&&!1!==e(t[r],r);r++);else if(Gt(t))for(var o in t)if(t.hasOwnProperty(o)&&!1===e(t[o],o))break}(e,(function(e){gr.call(t,e)&&(r[e]=t[e])})),r};function vr(t){return function(){return t}}function yr(t){return 1e-6*(t()-.5)}function mr(t){return t.index}function wr(t,e){var r=t.get(e);if(!r)throw new Error("node not found: "+e);return r}function xr(t){var e,r,n,o,i,s,a=mr,u=function(t){return 1/Math.min(o[t.source.index],o[t.target.index])},d=vr(30),h=1;function c(n){for(var o=0,a=t.length;o<h;++o)for(var u,d,c,l,f,g,p,v=0;v<a;++v)d=(u=t[v]).source,l=(c=u.target).x+c.vx-d.x-d.vx||yr(s),f=c.y+c.vy-d.y-d.vy||yr(s),l*=g=((g=Math.sqrt(l*l+f*f))-r[v])/g*n*e[v],f*=g,c.vx-=l*(p=i[v]),c.vy-=f*p,d.vx+=l*(p=1-p),d.vy+=f*p}function l(){if(n){var s,u,d=n.length,h=t.length,c=new Map(n.map(((t,e)=>[a(t,e,n),t])));for(s=0,o=new Array(d);s<h;++s)(u=t[s]).index=s,"object"!=typeof u.source&&(u.source=wr(c,u.source)),"object"!=typeof u.target&&(u.target=wr(c,u.target)),o[u.source.index]=(o[u.source.index]||0)+1,o[u.target.index]=(o[u.target.index]||0)+1;for(s=0,i=new Array(h);s<h;++s)u=t[s],i[s]=o[u.source.index]/(o[u.source.index]+o[u.target.index]);e=new Array(h),f(),r=new Array(h),g()}}function f(){if(n)for(var r=0,o=t.length;r<o;++r)e[r]=+u(t[r],r,t)}function g(){if(n)for(var e=0,o=t.length;e<o;++e)r[e]=+d(t[e],e,t)}return null==t&&(t=[]),c.initialize=function(t,e){n=t,s=e,l()},c.links=function(e){return arguments.length?(t=e,l(),c):t},c.id=function(t){return arguments.length?(a=t,c):a},c.iterations=function(t){return arguments.length?(h=+t,c):h},c.strength=function(t){return arguments.length?(u="function"==typeof t?t:vr(+t),f(),c):u},c.distance=function(t){return arguments.length?(d="function"==typeof t?t:vr(+t),g(),c):d},c}var br={value:()=>{}};function Er(){for(var t,e=0,r=arguments.length,n={};e<r;++e){if(!(t=arguments[e]+"")||t in n||/[\\s.]/.test(t))throw new Error("illegal type: "+t);n[t]=[]}return new Nr(n)}function Nr(t){this._=t}function _r(t,e){for(var r,n=0,o=t.length;n<o;++n)if((r=t[n]).name===e)return r.value}function Mr(t,e,r){for(var n=0,o=t.length;n<o;++n)if(t[n].name===e){t[n]=br,t=t.slice(0,n).concat(t.slice(n+1));break}return null!=r&&t.push({name:e,value:r}),t}Nr.prototype=Er.prototype={constructor:Nr,on:function(t,e){var r,n,o=this._,i=(n=o,(t+"").trim().split(/^|\\s+/).map((function(t){var e="",r=t.indexOf(".");if(r>=0&&(e=t.slice(r+1),t=t.slice(0,r)),t&&!n.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}}))),s=-1,a=i.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++s<a;)if(r=(t=i[s]).type)o[r]=Mr(o[r],t.name,e);else if(null==e)for(r in o)o[r]=Mr(o[r],t.name,null);return this}for(;++s<a;)if((r=(t=i[s]).type)&&(r=_r(o[r],t.name)))return r},copy:function(){var t={},e=this._;for(var r in e)t[r]=e[r].slice();return new Nr(t)},call:function(t,e){if((r=arguments.length-2)>0)for(var r,n,o=new Array(r),i=0;i<r;++i)o[i]=arguments[i+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(i=0,r=(n=this._[t]).length;i<r;++i)n[i].value.apply(e,o)},apply:function(t,e,r){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var n=this._[t],o=0,i=n.length;o<i;++o)n[o].value.apply(e,r)}};const kr=Er;var Ar,jr,Or=0,Sr=0,zr=0,Rr=0,Ir=0,Pr=0,Cr="object"==typeof performance&&performance.now?performance:Date,Dr="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function Tr(){return Ir||(Dr(Lr),Ir=Cr.now()+Pr)}function Lr(){Ir=0}function Fr(){this._call=this._time=this._next=null}function qr(t,e,r){var n=new Fr;return n.restart(t,e,r),n}function Vr(){Ir=(Rr=Cr.now())+Pr,Or=Sr=0;try{!function(){Tr(),++Or;for(var t,e=Ar;e;)(t=Ir-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Or}()}finally{Or=0,function(){for(var t,e,r=Ar,n=1/0;r;)r._call?(n>r._time&&(n=r._time),t=r,r=r._next):(e=r._next,r._next=null,r=t?t._next=e:Ar=e);jr=t,$r(n)}(),Ir=0}}function Br(){var t=Cr.now(),e=t-Rr;e>1e3&&(Pr-=e,Rr=t)}function $r(t){Or||(Sr&&(Sr=clearTimeout(Sr)),t-Ir>24?(t<1/0&&(Sr=setTimeout(Vr,t-Cr.now()-Pr)),zr&&(zr=clearInterval(zr))):(zr||(Rr=Cr.now(),zr=setInterval(Br,1e3)),Or=1,Dr(Vr)))}Fr.prototype=qr.prototype={constructor:Fr,restart:function(t,e,r){if("function"!=typeof t)throw new TypeError("callback is not a function");r=(null==r?Tr():+r)+(null==e?0:+e),this._next||jr===this||(jr?jr._next=this:Ar=this,jr=this),this._call=t,this._time=r,$r()},stop:function(){this._call&&(this._call=null,this._time=1/0,$r())}};const Gr=4294967296;function Ur(t){return t.x}function Wr(t){return t.y}var Yr=Math.PI*(3-Math.sqrt(5));function Hr(){var t,e,r,n,o,i=vr(-30),s=1,a=1/0,u=.81;function d(r){var o,i=t.length,s=de(t,Ur,Wr).visitAfter(c);for(n=r,o=0;o<i;++o)e=t[o],s.visit(l)}function h(){if(t){var e,r,n=t.length;for(o=new Array(n),e=0;e<n;++e)r=t[e],o[r.index]=+i(r,e,t)}}function c(t){var e,r,n,i,s,a=0,u=0;if(t.length){for(n=i=s=0;s<4;++s)(e=t[s])&&(r=Math.abs(e.value))&&(a+=e.value,u+=r,n+=r*e.x,i+=r*e.y);t.x=n/u,t.y=i/u}else{(e=t).x=e.data.x,e.y=e.data.y;do{a+=o[e.data.index]}while(e=e.next)}t.value=a}function l(t,i,d,h){if(!t.value)return!0;var c=t.x-e.x,l=t.y-e.y,f=h-i,g=c*c+l*l;if(f*f/u<g)return g<a&&(0===c&&(g+=(c=yr(r))*c),0===l&&(g+=(l=yr(r))*l),g<s&&(g=Math.sqrt(s*g)),e.vx+=c*t.value*n/g,e.vy+=l*t.value*n/g),!0;if(!(t.length||g>=a)){(t.data!==e||t.next)&&(0===c&&(g+=(c=yr(r))*c),0===l&&(g+=(l=yr(r))*l),g<s&&(g=Math.sqrt(s*g)));do{t.data!==e&&(f=o[t.data.index]*n/g,e.vx+=c*f,e.vy+=l*f)}while(t=t.next)}}return d.initialize=function(e,n){t=e,r=n,h()},d.strength=function(t){return arguments.length?(i="function"==typeof t?t:vr(+t),h(),d):i},d.distanceMin=function(t){return arguments.length?(s=t*t,d):Math.sqrt(s)},d.distanceMax=function(t){return arguments.length?(a=t*t,d):Math.sqrt(a)},d.theta=function(t){return arguments.length?(u=t*t,d):Math.sqrt(u)},d}function Kr(t,e){var r,n=1;function o(){var o,i,s=r.length,a=0,u=0;for(o=0;o<s;++o)a+=(i=r[o]).x,u+=i.y;for(a=(a/s-t)*n,u=(u/s-e)*n,o=0;o<s;++o)(i=r[o]).x-=a,i.y-=u}return null==t&&(t=0),null==e&&(e=0),o.initialize=function(t){r=t},o.x=function(e){return arguments.length?(t=+e,o):t},o.y=function(t){return arguments.length?(e=+t,o):e},o.strength=function(t){return arguments.length?(n=+t,o):n},o}function Jr(t){return t.x+t.vx}function Xr(t){return t.y+t.vy}function Qr(t){var e,r,n,o=1,i=1;function s(){for(var t,s,u,d,h,c,l,f=e.length,g=0;g<i;++g)for(s=de(e,Jr,Xr).visitAfter(a),t=0;t<f;++t)u=e[t],c=r[u.index],l=c*c,d=u.x+u.vx,h=u.y+u.vy,s.visit(p);function p(t,e,r,i,s){var a=t.data,f=t.r,g=c+f;if(!a)return e>d+g||i<d-g||r>h+g||s<h-g;if(a.index>u.index){var p=d-a.x-a.vx,v=h-a.y-a.vy,y=p*p+v*v;y<g*g&&(0===p&&(y+=(p=yr(n))*p),0===v&&(y+=(v=yr(n))*v),y=(g-(y=Math.sqrt(y)))/y*o,u.vx+=(p*=y)*(g=(f*=f)/(l+f)),u.vy+=(v*=y)*g,a.vx-=p*(g=1-g),a.vy-=v*g)}}}function a(t){if(t.data)return t.r=r[t.data.index];for(var e=t.r=0;e<4;++e)t[e]&&t[e].r>t.r&&(t.r=t[e].r)}function u(){if(e){var n,o,i=e.length;for(r=new Array(i),n=0;n<i;++n)o=e[n],r[o.index]=+t(o,n,e)}}return"function"!=typeof t&&(t=vr(null==t?1:+t)),s.initialize=function(t,r){e=t,n=r,u()},s.iterations=function(t){return arguments.length?(i=+t,s):i},s.strength=function(t){return arguments.length?(o=+t,s):o},s.radius=function(e){return arguments.length?(t="function"==typeof e?e:vr(+e),u(),s):t},s}function Zr(t,e,r){var n,o,i,s=vr(.1);function a(t){for(var s=0,a=n.length;s<a;++s){var u=n[s],d=u.x-e||1e-6,h=u.y-r||1e-6,c=Math.sqrt(d*d+h*h),l=(i[s]-c)*o[s]*t/c;u.vx+=d*l,u.vy+=h*l}}function u(){if(n){var e,r=n.length;for(o=new Array(r),i=new Array(r),e=0;e<r;++e)i[e]=+t(n[e],e,n),o[e]=isNaN(i[e])?0:+s(n[e],e,n)}}return"function"!=typeof t&&(t=vr(+t)),null==e&&(e=0),null==r&&(r=0),a.initialize=function(t){n=t,u()},a.strength=function(t){return arguments.length?(s="function"==typeof t?t:vr(+t),u(),a):s},a.radius=function(e){return arguments.length?(t="function"==typeof e?e:vr(+e),u(),a):t},a.x=function(t){return arguments.length?(e=+t,a):e},a.y=function(t){return arguments.length?(r=+t,a):r},a}function tn(t){var e,r,n,o=vr(.1);function i(t){for(var o,i=0,s=e.length;i<s;++i)(o=e[i]).vx+=(n[i]-o.x)*r[i]*t}function s(){if(e){var i,s=e.length;for(r=new Array(s),n=new Array(s),i=0;i<s;++i)r[i]=isNaN(n[i]=+t(e[i],i,e))?0:+o(e[i],i,e)}}return"function"!=typeof t&&(t=vr(null==t?0:+t)),i.initialize=function(t){e=t,s()},i.strength=function(t){return arguments.length?(o="function"==typeof t?t:vr(+t),s(),i):o},i.x=function(e){return arguments.length?(t="function"==typeof e?e:vr(+e),s(),i):t},i}function en(t){var e,r,n,o=vr(.1);function i(t){for(var o,i=0,s=e.length;i<s;++i)(o=e[i]).vy+=(n[i]-o.y)*r[i]*t}function s(){if(e){var i,s=e.length;for(r=new Array(s),n=new Array(s),i=0;i<s;++i)r[i]=isNaN(n[i]=+t(e[i],i,e))?0:+o(e[i],i,e)}}return"function"!=typeof t&&(t=vr(null==t?0:+t)),i.initialize=function(t){e=t,s()},i.strength=function(t){return arguments.length?(o="function"==typeof t?t:vr(+t),s(),i):o},i.y=function(e){return arguments.length?(t="function"==typeof e?e:vr(+e),s(),i):t},i}class rn{constructor(t){this.id="d3-force",this.config={inputNodeAttrs:["x","y","vx","vy","fx","fy"],outputNodeAttrs:["x","y","vx","vy"],simulationAttrs:["alpha","alphaMin","alphaDecay","alphaTarget","velocityDecay","randomSource"]},this.forceMap={link:xr,manyBody:Hr,center:Kr,collide:Qr,radial:Zr,x:tn,y:en},this.options={link:{id:t=>t.id},manyBody:{},center:{x:0,y:0}},this.context={options:{},assign:!1,nodes:[],edges:[]},fr(this.options,t),this.options.forceSimulation&&(this.simulation=this.options.forceSimulation)}execute(e,r){return t(this,void 0,void 0,(function*(){return this.genericLayout(!1,e,r)}))}assign(e,r){return t(this,void 0,void 0,(function*(){yield this.genericLayout(!0,e,r)}))}stop(){this.simulation.stop()}tick(t){return this.simulation.tick(t),this.getResult()}restart(){this.simulation.restart()}setFixedPosition(t,e){const r=this.context.nodes.find((e=>e.id===t));r&&e.forEach(((t,e)=>{"number"!=typeof t&&null!==t||(r[["fx","fy","fz"][e]]=t)}))}getOptions(t){var e,r;const n=fr({},this.options,t);return n.collide&&void 0===(null===(e=n.collide)||void 0===e?void 0:e.radius)&&(n.collide=n.collide||{},n.collide.radius=null!==(r=n.nodeSize)&&void 0!==r?r:10),void 0===n.iterations&&(n.link&&void 0===n.link.iterations&&(n.iterations=n.link.iterations),n.collide&&void 0===n.collide.iterations&&(n.iterations=n.collide.iterations)),this.context.options=n,n}genericLayout(e,r,n){var o;return t(this,void 0,void 0,(function*(){const t=this.getOptions(n),i=r.getAllNodes().map((({id:t,data:e})=>Object.assign(Object.assign({id:t},e),pr(e.data,this.config.inputNodeAttrs)))),s=r.getAllEdges().map((t=>Object.assign({},t)));Object.assign(this.context,{assign:e,nodes:i,edges:s,graph:r});const a=new Promise((t=>{this.resolver=t})),u=this.setSimulation(t);return u.nodes(i),null===(o=u.force("link"))||void 0===o||o.links(s),a}))}getResult(){const{assign:t,nodes:e,edges:r,graph:n}=this.context,o=e.map((t=>({id:t.id,data:Object.assign(Object.assign({},t.data),pr(t,this.config.outputNodeAttrs))}))),i=r.map((({id:t,source:e,target:r,data:n})=>({id:t,source:"object"==typeof e?e.id:e,target:"object"==typeof r?r.id:r,data:n})));return t&&o.forEach((t=>n.mergeNodeData(t.id,t.data))),{nodes:o,edges:i}}initSimulation(){return function(t){var e,r=1,n=.001,o=1-Math.pow(n,1/300),i=0,s=.6,a=new Map,u=qr(c),d=kr("tick","end"),h=function(){let t=1;return()=>(t=(1664525*t+1013904223)%Gr)/Gr}();function c(){l(),d.call("tick",e),r<n&&(u.stop(),d.call("end",e))}function l(n){var u,d,h=t.length;void 0===n&&(n=1);for(var c=0;c<n;++c)for(r+=(i-r)*o,a.forEach((function(t){t(r)})),u=0;u<h;++u)null==(d=t[u]).fx?d.x+=d.vx*=s:(d.x=d.fx,d.vx=0),null==d.fy?d.y+=d.vy*=s:(d.y=d.fy,d.vy=0);return e}function f(){for(var e,r=0,n=t.length;r<n;++r){if((e=t[r]).index=r,null!=e.fx&&(e.x=e.fx),null!=e.fy&&(e.y=e.fy),isNaN(e.x)||isNaN(e.y)){var o=10*Math.sqrt(.5+r),i=r*Yr;e.x=o*Math.cos(i),e.y=o*Math.sin(i)}(isNaN(e.vx)||isNaN(e.vy))&&(e.vx=e.vy=0)}}function g(e){return e.initialize&&e.initialize(t,h),e}return null==t&&(t=[]),f(),e={tick:l,restart:function(){return u.restart(c),e},stop:function(){return u.stop(),e},nodes:function(r){return arguments.length?(t=r,f(),a.forEach(g),e):t},alpha:function(t){return arguments.length?(r=+t,e):r},alphaMin:function(t){return arguments.length?(n=+t,e):n},alphaDecay:function(t){return arguments.length?(o=+t,e):+o},alphaTarget:function(t){return arguments.length?(i=+t,e):i},velocityDecay:function(t){return arguments.length?(s=1-t,e):1-s},randomSource:function(t){return arguments.length?(h=t,a.forEach(g),e):h},force:function(t,r){return arguments.length>1?(null==r?a.delete(t):a.set(t,g(r)),e):a.get(t)},find:function(e,r,n){var o,i,s,a,u,d=0,h=t.length;for(null==n?n=1/0:n*=n,d=0;d<h;++d)(s=(o=e-(a=t[d]).x)*o+(i=r-a.y)*i)<n&&(u=a,n=s);return u},on:function(t,r){return arguments.length>1?(d.on(t,r),e):d.on(t)}}}()}setSimulation(t){const e=this.simulation||this.options.forceSimulation||this.initSimulation();return this.simulation||(this.simulation=e.on("tick",(()=>{var e;return null===(e=t.onTick)||void 0===e?void 0:e.call(t,this.getResult())})).on("end",(()=>{var t;return null===(t=this.resolver)||void 0===t?void 0:t.call(this,this.getResult())}))),nn(e,this.config.simulationAttrs.map((e=>[e,t[e]]))),Object.entries(this.forceMap).forEach((([r,n])=>{const o=r;if(t[r]){let r=e.force(o);r||(r=n(),e.force(o,r)),nn(r,Object.entries(t[o]))}else e.force(o,null)})),e}}const nn=(t,e)=>e.reduce(((e,[r,n])=>e[r]&&void 0!==n?e[r].call(t,n):e),t);function on(t){return function(){return t}}function sn(t){return 1e-6*(t()-.5)}function an(t){return t.index}function un(t,e){var r=t.get(e);if(!r)throw new Error("node not found: "+e);return r}function dn(t){var e,r,n,o,i,s,a,u=an,d=function(t){return 1/Math.min(i[t.source.index],i[t.target.index])},h=on(30),c=1;function l(n){for(var i=0,u=t.length;i<c;++i)for(var d,h,l,f,g,p=0,v=0,y=0,m=0;p<u;++p)h=(d=t[p]).source,v=(l=d.target).x+l.vx-h.x-h.vx||sn(a),o>1&&(y=l.y+l.vy-h.y-h.vy||sn(a)),o>2&&(m=l.z+l.vz-h.z-h.vz||sn(a)),v*=f=((f=Math.sqrt(v*v+y*y+m*m))-r[p])/f*n*e[p],y*=f,m*=f,l.vx-=v*(g=s[p]),o>1&&(l.vy-=y*g),o>2&&(l.vz-=m*g),h.vx+=v*(g=1-g),o>1&&(h.vy+=y*g),o>2&&(h.vz+=m*g)}function f(){if(n){var o,a,d=n.length,h=t.length,c=new Map(n.map(((t,e)=>[u(t,e,n),t])));for(o=0,i=new Array(d);o<h;++o)(a=t[o]).index=o,"object"!=typeof a.source&&(a.source=un(c,a.source)),"object"!=typeof a.target&&(a.target=un(c,a.target)),i[a.source.index]=(i[a.source.index]||0)+1,i[a.target.index]=(i[a.target.index]||0)+1;for(o=0,s=new Array(h);o<h;++o)a=t[o],s[o]=i[a.source.index]/(i[a.source.index]+i[a.target.index]);e=new Array(h),g(),r=new Array(h),p()}}function g(){if(n)for(var r=0,o=t.length;r<o;++r)e[r]=+d(t[r],r,t)}function p(){if(n)for(var e=0,o=t.length;e<o;++e)r[e]=+h(t[e],e,t)}return null==t&&(t=[]),l.initialize=function(t,...e){n=t,a=e.find((t=>"function"==typeof t))||Math.random,o=e.find((t=>[1,2,3].includes(t)))||2,f()},l.links=function(e){return arguments.length?(t=e,f(),l):t},l.id=function(t){return arguments.length?(u=t,l):u},l.iterations=function(t){return arguments.length?(c=+t,l):c},l.strength=function(t){return arguments.length?(d="function"==typeof t?t:on(+t),g(),l):d},l.distance=function(t){return arguments.length?(h="function"==typeof t?t:on(+t),p(),l):h},l}function hn(t,e,r){if(isNaN(e))return t;var n,o,i,s,a,u,d=t._root,h={data:r},c=t._x0,l=t._x1;if(!d)return t._root=h,t;for(;d.length;)if((s=e>=(o=(c+l)/2))?c=o:l=o,n=d,!(d=d[a=+s]))return n[a]=h,t;if(e===(i=+t._x.call(null,d.data)))return h.next=d,n?n[a]=h:t._root=h,t;do{n=n?n[a]=new Array(2):t._root=new Array(2),(s=e>=(o=(c+l)/2))?c=o:l=o}while((a=+s)==(u=+(i>=o)));return n[u]=d,n[a]=h,t}function cn(t,e,r){this.node=t,this.x0=e,this.x1=r}function ln(t){return t[0]}function fn(t,e){var r=new gn(null==e?ln:e,NaN,NaN);return null==t?r:r.addAll(t)}function gn(t,e,r){this._x=t,this._x0=e,this._x1=r,this._root=void 0}function pn(t){for(var e={data:t.data},r=e;t=t.next;)r=r.next={data:t.data};return e}var vn=fn.prototype=gn.prototype;vn.copy=function(){var t,e,r=new gn(this._x,this._x0,this._x1),n=this._root;if(!n)return r;if(!n.length)return r._root=pn(n),r;for(t=[{source:n,target:r._root=new Array(2)}];n=t.pop();)for(var o=0;o<2;++o)(e=n.source[o])&&(e.length?t.push({source:e,target:n.target[o]=new Array(2)}):n.target[o]=pn(e));return r},vn.add=function(t){const e=+this._x.call(null,t);return hn(this.cover(e),e,t)},vn.addAll=function(t){Array.isArray(t)||(t=Array.from(t));const e=t.length,r=new Float64Array(e);let n=1/0,o=-1/0;for(let i,s=0;s<e;++s)isNaN(i=+this._x.call(null,t[s]))||(r[s]=i,i<n&&(n=i),i>o&&(o=i));if(n>o)return this;this.cover(n).cover(o);for(let n=0;n<e;++n)hn(this,r[n],t[n]);return this},vn.cover=function(t){if(isNaN(t=+t))return this;var e=this._x0,r=this._x1;if(isNaN(e))r=(e=Math.floor(t))+1;else{for(var n,o,i=r-e||1,s=this._root;e>t||t>=r;)switch(o=+(t<e),(n=new Array(2))[o]=s,s=n,i*=2,o){case 0:r=e+i;break;case 1:e=r-i}this._root&&this._root.length&&(this._root=s)}return this._x0=e,this._x1=r,this},vn.data=function(){var t=[];return this.visit((function(e){if(!e.length)do{t.push(e.data)}while(e=e.next)})),t},vn.extent=function(t){return arguments.length?this.cover(+t[0][0]).cover(+t[1][0]):isNaN(this._x0)?void 0:[[this._x0],[this._x1]]},vn.find=function(t,e){var r,n,o,i,s,a=this._x0,u=this._x1,d=[],h=this._root;for(h&&d.push(new cn(h,a,u)),null==e?e=1/0:(a=t-e,u=t+e);i=d.pop();)if(!(!(h=i.node)||(n=i.x0)>u||(o=i.x1)<a))if(h.length){var c=(n+o)/2;d.push(new cn(h[1],c,o),new cn(h[0],n,c)),(s=+(t>=c))&&(i=d[d.length-1],d[d.length-1]=d[d.length-1-s],d[d.length-1-s]=i)}else{var l=Math.abs(t-+this._x.call(null,h.data));l<e&&(e=l,a=t-l,u=t+l,r=h.data)}return r},vn.remove=function(t){if(isNaN(i=+this._x.call(null,t)))return this;var e,r,n,o,i,s,a,u,d,h=this._root,c=this._x0,l=this._x1;if(!h)return this;if(h.length)for(;;){if((a=i>=(s=(c+l)/2))?c=s:l=s,e=h,!(h=h[u=+a]))return this;if(!h.length)break;e[u+1&1]&&(r=e,d=u)}for(;h.data!==t;)if(n=h,!(h=h.next))return this;return(o=h.next)&&delete h.next,n?(o?n.next=o:delete n.next,this):e?(o?e[u]=o:delete e[u],(h=e[0]||e[1])&&h===(e[1]||e[0])&&!h.length&&(r?r[d]=h:this._root=h),this):(this._root=o,this)},vn.removeAll=function(t){for(var e=0,r=t.length;e<r;++e)this.remove(t[e]);return this},vn.root=function(){return this._root},vn.size=function(){var t=0;return this.visit((function(e){if(!e.length)do{++t}while(e=e.next)})),t},vn.visit=function(t){var e,r,n,o,i=[],s=this._root;for(s&&i.push(new cn(s,this._x0,this._x1));e=i.pop();)if(!t(s=e.node,n=e.x0,o=e.x1)&&s.length){var a=(n+o)/2;(r=s[1])&&i.push(new cn(r,a,o)),(r=s[0])&&i.push(new cn(r,n,a))}return this},vn.visitAfter=function(t){var e,r=[],n=[];for(this._root&&r.push(new cn(this._root,this._x0,this._x1));e=r.pop();){var o=e.node;if(o.length){var i,s=e.x0,a=e.x1,u=(s+a)/2;(i=o[0])&&r.push(new cn(i,s,u)),(i=o[1])&&r.push(new cn(i,u,a))}n.push(e)}for(;e=n.pop();)t(e.node,e.x0,e.x1);return this},vn.x=function(t){return arguments.length?(this._x=t,this):this._x};const yn=4294967296;function mn(t){return t.x}function wn(t){return t.y}function xn(t){return t.z}var bn=Math.PI*(3-Math.sqrt(5)),En=20*Math.PI/(9+Math.sqrt(221));function Nn(){var t,e,r,n,o,i,s=on(-30),a=1,u=1/0,d=.81;function h(n){var i,s=t.length,a=(1===e?fn(t,mn):2===e?de(t,mn,wn):3===e?me(t,mn,wn,xn):null).visitAfter(l);for(o=n,i=0;i<s;++i)r=t[i],a.visit(f)}function c(){if(t){var e,r,n=t.length;for(i=new Array(n),e=0;e<n;++e)r=t[e],i[r.index]=+s(r,e,t)}}function l(t){var r,n,o,s,a,u,d=0,h=0,c=t.length;if(c){for(o=s=a=u=0;u<c;++u)(r=t[u])&&(n=Math.abs(r.value))&&(d+=r.value,h+=n,o+=n*(r.x||0),s+=n*(r.y||0),a+=n*(r.z||0));d*=Math.sqrt(4/c),t.x=o/h,e>1&&(t.y=s/h),e>2&&(t.z=a/h)}else{(r=t).x=r.data.x,e>1&&(r.y=r.data.y),e>2&&(r.z=r.data.z);do{d+=i[r.data.index]}while(r=r.next)}t.value=d}function f(t,s,h,c,l){if(!t.value)return!0;var f=[h,c,l][e-1],g=t.x-r.x,p=e>1?t.y-r.y:0,v=e>2?t.z-r.z:0,y=f-s,m=g*g+p*p+v*v;if(y*y/d<m)return m<u&&(0===g&&(m+=(g=sn(n))*g),e>1&&0===p&&(m+=(p=sn(n))*p),e>2&&0===v&&(m+=(v=sn(n))*v),m<a&&(m=Math.sqrt(a*m)),r.vx+=g*t.value*o/m,e>1&&(r.vy+=p*t.value*o/m),e>2&&(r.vz+=v*t.value*o/m)),!0;if(!(t.length||m>=u)){(t.data!==r||t.next)&&(0===g&&(m+=(g=sn(n))*g),e>1&&0===p&&(m+=(p=sn(n))*p),e>2&&0===v&&(m+=(v=sn(n))*v),m<a&&(m=Math.sqrt(a*m)));do{t.data!==r&&(y=i[t.data.index]*o/m,r.vx+=g*y,e>1&&(r.vy+=p*y),e>2&&(r.vz+=v*y))}while(t=t.next)}}return h.initialize=function(r,...o){t=r,n=o.find((t=>"function"==typeof t))||Math.random,e=o.find((t=>[1,2,3].includes(t)))||2,c()},h.strength=function(t){return arguments.length?(s="function"==typeof t?t:on(+t),c(),h):s},h.distanceMin=function(t){return arguments.length?(a=t*t,h):Math.sqrt(a)},h.distanceMax=function(t){return arguments.length?(u=t*t,h):Math.sqrt(u)},h.theta=function(t){return arguments.length?(d=t*t,h):Math.sqrt(d)},h}function _n(t,e,r){var n,o=1;function i(){var i,s,a=n.length,u=0,d=0,h=0;for(i=0;i<a;++i)u+=(s=n[i]).x||0,d+=s.y||0,h+=s.z||0;for(u=(u/a-t)*o,d=(d/a-e)*o,h=(h/a-r)*o,i=0;i<a;++i)s=n[i],u&&(s.x-=u),d&&(s.y-=d),h&&(s.z-=h)}return null==t&&(t=0),null==e&&(e=0),null==r&&(r=0),i.initialize=function(t){n=t},i.x=function(e){return arguments.length?(t=+e,i):t},i.y=function(t){return arguments.length?(e=+t,i):e},i.z=function(t){return arguments.length?(r=+t,i):r},i.strength=function(t){return arguments.length?(o=+t,i):o},i}function Mn(t){return t.x+t.vx}function kn(t){return t.y+t.vy}function An(t){return t.z+t.vz}function jn(t){var e,r,n,o,i=1,s=1;function a(){for(var t,a,d,h,c,l,f,g,p=e.length,v=0;v<s;++v)for(a=(1===r?fn(e,Mn):2===r?de(e,Mn,kn):3===r?me(e,Mn,kn,An):null).visitAfter(u),t=0;t<p;++t)d=e[t],f=n[d.index],g=f*f,h=d.x+d.vx,r>1&&(c=d.y+d.vy),r>2&&(l=d.z+d.vz),a.visit(y);function y(t,e,n,s,a,u,p){var v=[e,n,s,a,u,p],y=v[0],m=v[1],w=v[2],x=v[r],b=v[r+1],E=v[r+2],N=t.data,_=t.r,M=f+_;if(!N)return y>h+M||x<h-M||r>1&&(m>c+M||b<c-M)||r>2&&(w>l+M||E<l-M);if(N.index>d.index){var k=h-N.x-N.vx,A=r>1?c-N.y-N.vy:0,j=r>2?l-N.z-N.vz:0,O=k*k+A*A+j*j;O<M*M&&(0===k&&(O+=(k=sn(o))*k),r>1&&0===A&&(O+=(A=sn(o))*A),r>2&&0===j&&(O+=(j=sn(o))*j),O=(M-(O=Math.sqrt(O)))/O*i,d.vx+=(k*=O)*(M=(_*=_)/(g+_)),r>1&&(d.vy+=(A*=O)*M),r>2&&(d.vz+=(j*=O)*M),N.vx-=k*(M=1-M),r>1&&(N.vy-=A*M),r>2&&(N.vz-=j*M))}}}function u(t){if(t.data)return t.r=n[t.data.index];for(var e=t.r=0;e<Math.pow(2,r);++e)t[e]&&t[e].r>t.r&&(t.r=t[e].r)}function d(){if(e){var r,o,i=e.length;for(n=new Array(i),r=0;r<i;++r)o=e[r],n[o.index]=+t(o,r,e)}}return"function"!=typeof t&&(t=on(null==t?1:+t)),a.initialize=function(t,...n){e=t,o=n.find((t=>"function"==typeof t))||Math.random,r=n.find((t=>[1,2,3].includes(t)))||2,d()},a.iterations=function(t){return arguments.length?(s=+t,a):s},a.strength=function(t){return arguments.length?(i=+t,a):i},a.radius=function(e){return arguments.length?(t="function"==typeof e?e:on(+e),d(),a):t},a}function On(t,e,r,n){var o,i,s,a,u=on(.1);function d(t){for(var u=0,d=o.length;u<d;++u){var h=o[u],c=h.x-e||1e-6,l=(h.y||0)-r||1e-6,f=(h.z||0)-n||1e-6,g=Math.sqrt(c*c+l*l+f*f),p=(a[u]-g)*s[u]*t/g;h.vx+=c*p,i>1&&(h.vy+=l*p),i>2&&(h.vz+=f*p)}}function h(){if(o){var e,r=o.length;for(s=new Array(r),a=new Array(r),e=0;e<r;++e)a[e]=+t(o[e],e,o),s[e]=isNaN(a[e])?0:+u(o[e],e,o)}}return"function"!=typeof t&&(t=on(+t)),null==e&&(e=0),null==r&&(r=0),null==n&&(n=0),d.initialize=function(t,...e){o=t,i=e.find((t=>[1,2,3].includes(t)))||2,h()},d.strength=function(t){return arguments.length?(u="function"==typeof t?t:on(+t),h(),d):u},d.radius=function(e){return arguments.length?(t="function"==typeof e?e:on(+e),h(),d):t},d.x=function(t){return arguments.length?(e=+t,d):e},d.y=function(t){return arguments.length?(r=+t,d):r},d.z=function(t){return arguments.length?(n=+t,d):n},d}function Sn(t){var e,r,n,o=on(.1);function i(t){for(var o,i=0,s=e.length;i<s;++i)(o=e[i]).vx+=(n[i]-o.x)*r[i]*t}function s(){if(e){var i,s=e.length;for(r=new Array(s),n=new Array(s),i=0;i<s;++i)r[i]=isNaN(n[i]=+t(e[i],i,e))?0:+o(e[i],i,e)}}return"function"!=typeof t&&(t=on(null==t?0:+t)),i.initialize=function(t){e=t,s()},i.strength=function(t){return arguments.length?(o="function"==typeof t?t:on(+t),s(),i):o},i.x=function(e){return arguments.length?(t="function"==typeof e?e:on(+e),s(),i):t},i}function zn(t){var e,r,n,o=on(.1);function i(t){for(var o,i=0,s=e.length;i<s;++i)(o=e[i]).vy+=(n[i]-o.y)*r[i]*t}function s(){if(e){var i,s=e.length;for(r=new Array(s),n=new Array(s),i=0;i<s;++i)r[i]=isNaN(n[i]=+t(e[i],i,e))?0:+o(e[i],i,e)}}return"function"!=typeof t&&(t=on(null==t?0:+t)),i.initialize=function(t){e=t,s()},i.strength=function(t){return arguments.length?(o="function"==typeof t?t:on(+t),s(),i):o},i.y=function(e){return arguments.length?(t="function"==typeof e?e:on(+e),s(),i):t},i}function Rn(t){var e,r,n,o=on(.1);function i(t){for(var o,i=0,s=e.length;i<s;++i)(o=e[i]).vz+=(n[i]-o.z)*r[i]*t}function s(){if(e){var i,s=e.length;for(r=new Array(s),n=new Array(s),i=0;i<s;++i)r[i]=isNaN(n[i]=+t(e[i],i,e))?0:+o(e[i],i,e)}}return"function"!=typeof t&&(t=on(null==t?0:+t)),i.initialize=function(t){e=t,s()},i.strength=function(t){return arguments.length?(o="function"==typeof t?t:on(+t),s(),i):o},i.z=function(e){return arguments.length?(t="function"==typeof e?e:on(+e),s(),i):t},i}var In=r(5439),Pn=r.n(In);class Cn{constructor(t){this.id="dagre",this.options={},Object.assign(this.options,Cn.defaultOptions,t)}execute(e,r){return t(this,void 0,void 0,(function*(){return this.genericDagreLayout(!1,e,Object.assign(Object.assign({},this.options),r))}))}assign(e,r){return t(this,void 0,void 0,(function*(){yield this.genericDagreLayout(!0,e,Object.assign(Object.assign({},this.options),r))}))}genericDagreLayout(e,r,n){return t(this,void 0,void 0,(function*(){const{nodeSize:t}=n,o=new In.graphlib.Graph;o.setGraph(n),o.setDefaultEdgeLabel((()=>({}))),[...r.getAllNodes(),...r.getAllEdges()].some((({id:t})=>c(t)))&&console.error("Dagre layout only support string id, it will convert number to string."),r.getAllNodes().forEach((e=>{const{id:r}=e,n=Object.assign({},e.data);if(void 0!==t){const[r,o]=Ut($t(t)?t(e):t);Object.assign(n,{width:r,height:o})}o.setNode(r.toString(),n)})),r.getAllEdges().forEach((({id:t,source:e,target:r})=>{o.setEdge(e.toString(),r.toString(),{id:t})})),Pn().layout(o);const i={nodes:[],edges:[]};return o.nodes().forEach((t=>{const n=o.node(t);i.nodes.push({id:t,data:n}),e&&r.mergeNodeData(t,n)})),o.edges().forEach((t=>{const n=o.edge(t),{id:s}=n,a=function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(r[n[o]]=t[n[o]])}return r}(n,["id"]),{v:u,w:d}=t;i.edges.push({id:s,source:u,target:d,data:a}),e&&r.mergeEdgeData(s,a)})),i}))}}Cn.defaultOptions={};class Dn{constructor(t){this.id=t.id||0,this.rx=t.rx,this.ry=t.ry,this.fx=0,this.fy=0,this.mass=t.mass,this.degree=t.degree,this.g=t.g||0}distanceTo(t){const e=this.rx-t.rx,r=this.ry-t.ry;return Math.hypot(e,r)}setPos(t,e){this.rx=t,this.ry=e}resetForce(){this.fx=0,this.fy=0}addForce(t){const e=t.rx-this.rx,r=t.ry-this.ry;let n=Math.hypot(e,r);n=n<1e-4?1e-4:n;const o=this.g*(this.degree+1)*(t.degree+1)/n;this.fx+=o*e/n,this.fy+=o*r/n}in(t){return t.contains(this.rx,this.ry)}add(t){const e=this.mass+t.mass,r=(this.rx*this.mass+t.rx*t.mass)/e,n=(this.ry*this.mass+t.ry*t.mass)/e,o=this.degree+t.degree;return new Dn({rx:r,ry:n,mass:e,degree:o})}}class Tn{constructor(t){this.xmid=t.xmid,this.ymid=t.ymid,this.length=t.length,this.massCenter=t.massCenter||[0,0],this.mass=t.mass||1}getLength(){return this.length}contains(t,e){const r=this.length/2;return t<=this.xmid+r&&t>=this.xmid-r&&e<=this.ymid+r&&e>=this.ymid-r}NW(){const t=this.xmid-this.length/4,e=this.ymid+this.length/4,r=this.length/2;return new Tn({xmid:t,ymid:e,length:r})}NE(){const t=this.xmid+this.length/4,e=this.ymid+this.length/4,r=this.length/2;return new Tn({xmid:t,ymid:e,length:r})}SW(){const t=this.xmid-this.length/4,e=this.ymid-this.length/4,r=this.length/2;return new Tn({xmid:t,ymid:e,length:r})}SE(){const t=this.xmid+this.length/4,e=this.ymid-this.length/4,r=this.length/2;return new Tn({xmid:t,ymid:e,length:r})}}class Ln{constructor(t){this.body=null,this.quad=null,this.NW=null,this.NE=null,this.SW=null,this.SE=null,this.theta=.5,null!=t&&(this.quad=t)}insert(t){null!=this.body?this._isExternal()?(this.quad&&(this.NW=new Ln(this.quad.NW()),this.NE=new Ln(this.quad.NE()),this.SW=new Ln(this.quad.SW()),this.SE=new Ln(this.quad.SE())),this._putBody(this.body),this._putBody(t),this.body=this.body.add(t)):(this.body=this.body.add(t),this._putBody(t)):this.body=t}_putBody(t){this.quad&&(t.in(this.quad.NW())&&this.NW?this.NW.insert(t):t.in(this.quad.NE())&&this.NE?this.NE.insert(t):t.in(this.quad.SW())&&this.SW?this.SW.insert(t):t.in(this.quad.SE())&&this.SE&&this.SE.insert(t))}_isExternal(){return null==this.NW&&null==this.NE&&null==this.SW&&null==this.SE}updateForce(t){null!=this.body&&t!==this.body&&(this._isExternal()||(this.quad?this.quad.getLength():0)/this.body.distanceTo(t)<this.theta?t.addForce(this.body):(this.NW&&this.NW.updateForce(t),this.NE&&this.NE.updateForce(t),this.SW&&this.SW.updateForce(t),this.SE&&this.SE.updateForce(t)))}}const Fn={center:[0,0],width:300,height:300,kr:5,kg:1,mode:"normal",preventOverlap:!1,dissuadeHubs:!1,maxIteration:0,ks:.1,ksmax:10,tao:.1},qn={maxIteration:1e3,gravity:10,speed:5,clustering:!1,clusterGravity:10,width:300,height:300,nodeClusterBy:"cluster"},Vn={begin:[0,0],preventOverlap:!0,preventOverlapPadding:10,condense:!1,rows:void 0,cols:void 0,position:void 0,sortBy:"degree",nodeSize:30,width:300,height:300},Bn=(t,e)=>{let r;const n=t.rows||5,o=t.cols||5;return null==e?r=Math.min(n,o):Math.min(n,o)===t.rows?t.rows=e:t.cols=e,r},$n=(t,e)=>{let r;const n=t.rows||5,o=t.cols||5;return null==e?r=Math.max(n,o):Math.max(n,o)===t.rows?t.rows=e:t.cols=e,r},Gn=(t,e)=>t[`c-${e.row}-${e.col}`]||!1,Un=(t,e)=>t[`c-${e.row}-${e.col}`]=!0,Wn=(t,e)=>{const r=t.cols||5;e.col++,e.col>=r&&(e.col=0,e.row++)},Yn=(t,e,r,n,o,i,s,a)=>{let u,d;const h=o[t.id];if(h)u=h.col*r+r/2+e[0],d=h.row*n+n/2+e[1];else{for(;Gn(a,s);)Wn(i,s);u=s.col*r+r/2+e[0],d=s.row*n+n/2+e[1],Un(a,s),Wn(i,s)}t.data.x=u,t.data.y=d},Hn={iterations:10,height:10,width:10,speed:100,gravity:10,k:5},Kn=(t,e,r,n,o,i)=>{e.forEach(((s,a)=>{r[a]={x:0,y:0},e.forEach(((e,u)=>{if(a===u)return;if(o[a]!==o[u])return;let d=s.x-e.x,h=s.y-e.y,c=Math.sqrt(d*d+h*h);if(0===c){c=1;const t=a>u?1:-1;d=.01*t,h=.01*t}if(c<i(t[a])/2+i(t[u])/2){const t=n*n/c;r[a].x+=d/c*t,r[a].y+=h/c*t}}))}))},Jn=(t,e,r,n,o,i,s,a)=>{const u=i||s/10;return n&&e.forEach(((e,r)=>{const n=t[r].x-t[o].x,i=t[r].y-t[o].y,s=Math.sqrt(n*n+i*i);let a=i/s,u=-n/s;const d=Math.sqrt(e.x*e.x+e.y*e.y);let h=Math.acos((a*e.x+u*e.y)/d);h>Math.PI/2&&(h-=Math.PI/2,a*=-1,u*=-1);const c=Math.cos(h)*d;e.x=a*c,e.y=u*c})),t.forEach(((i,s)=>{if(s===o)return;const d=Math.sqrt(e[s].x*e[s].x+e[s].y*e[s].y);if(d>0&&s!==o){const h=Math.min(u*(r/800),d);if(i.x+=e[s].x/d*h,i.y+=e[s].y/d*h,n){let e=i.x-t[o].x,r=i.y-t[o].y;const n=Math.sqrt(e*e+r*r);e=e/n*a[s],r=r/n*a[s],i.x=t[o].x+e,i.y=t[o].y+r}}})),t},Xn={maxIteration:1e3,focusNode:null,unitRadius:null,linkDistance:50,preventOverlap:!1,strictRadial:!0,maxPreventOverlapIteration:200,sortStrength:10},Qn={center:[0,0],width:300,height:300},Zn={circular:class{constructor(t={}){this.options=t,this.id="circular",this.options=Object.assign(Object.assign({},Zt),t)}execute(e,r){return t(this,void 0,void 0,(function*(){return this.genericCircularLayout(!1,e,r)}))}assign(e,r){return t(this,void 0,void 0,(function*(){yield this.genericCircularLayout(!0,e,r)}))}genericCircularLayout(e,r,n){return t(this,void 0,void 0,(function*(){const t=Object.assign(Object.assign({},this.options),n),{width:o,height:i,center:s,divisions:a,startAngle:u=0,endAngle:d=2*Math.PI,angleRatio:h,ordering:c,clockwise:l,nodeSpacing:f,nodeSize:g}=t,p=r.getAllNodes(),v=r.getAllEdges(),[y,m,w]=((t,e,r)=>{let n=t,o=e,i=r;return n||"undefined"==typeof window||(n=window.innerWidth),o||"undefined"==typeof window||(o=window.innerHeight),i||(i=[n/2,o/2]),[n,o,i]})(o,i,s),x=null==p?void 0:p.length;if(!x||1===x)return Qt(r,e,w);const b=(d-u)/x;let{radius:E,startRadius:N,endRadius:_}=t;if(f){const t=Wt(10,f),e=Yt(10,g);let r=-1/0;p.forEach((t=>{const n=e(t);r<n&&(r=n)}));let n=0;p.forEach(((e,o)=>{n+=0===o?r||10:(t(e)||0)+(r||10)})),E=n/(2*Math.PI)}else E||N||_?!N&&_?N=_:N&&!_&&(_=N):E=Math.min(m,y)/2;const M=b*h;let k=[];k="topology"===c?te(r,p):"topology-directed"===c?te(r,p,!0):"degree"===c?function(t,e){const r=[];return e.forEach(((t,e)=>{r.push(Jt(t))})),r.sort(((e,r)=>t.getDegree(e.id,"both")-t.getDegree(r.id,"both"))),r}(r,p):p.map((t=>Jt(t)));const A=Math.ceil(x/a);for(let t=0;t<x;++t){let e=E;e||null===N||null===_||(e=N+t*(_-N)/(x-1)),e||(e=10+100*t/(x-1));let r=u+t%A*M+2*Math.PI/a*Math.floor(t/A);l||(r=d-t%A*M-2*Math.PI/a*Math.floor(t/A)),k[t].data.x=w[0]+Math.cos(r)*e,k[t].data.y=w[1]+Math.sin(r)*e}return e&&k.forEach((t=>{r.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})})),{nodes:k,edges:v}}))}},concentric:oe,mds:or,random:class{constructor(t={}){this.options=t,this.id="random",this.options=Object.assign(Object.assign({},Qn),t)}execute(e,r){return t(this,void 0,void 0,(function*(){return this.genericRandomLayout(!1,e,r)}))}assign(e,r){return t(this,void 0,void 0,(function*(){yield this.genericRandomLayout(!0,e,r)}))}genericRandomLayout(e,r,n){return t(this,void 0,void 0,(function*(){const t=Object.assign(Object.assign({},this.options),n),{center:o,width:i,height:s}=t,a=r.getAllNodes(),u=i||"undefined"==typeof window?i:window.innerWidth,d=s||"undefined"==typeof window?s:window.innerHeight,h=o||[u/2,d/2],c=[];return a&&a.forEach((t=>{c.push({id:t.id,data:{x:.9*(Math.random()-.5)*u+h[0],y:.9*(Math.random()-.5)*d+h[1]}})})),e&&c.forEach((t=>r.mergeNodeData(t.id,{x:t.data.x,y:t.data.y}))),{nodes:c,edges:r.getAllEdges()}}))}},grid:class{constructor(t={}){this.options=t,this.id="grid",this.options=Object.assign(Object.assign({},Vn),t)}execute(e,r){return t(this,void 0,void 0,(function*(){return this.genericGridLayout(!1,e,r)}))}assign(e,r){return t(this,void 0,void 0,(function*(){yield this.genericGridLayout(!0,e,r)}))}genericGridLayout(e,r,n){return t(this,void 0,void 0,(function*(){const t=Object.assign(Object.assign({},this.options),n),{begin:o=[0,0],condense:i,preventOverlapPadding:s,preventOverlap:a,rows:u,cols:d,nodeSpacing:h,nodeSize:l,width:f,height:g,position:p}=t;let{sortBy:v}=t;const y=r.getAllNodes(),m=r.getAllEdges(),w=null==y?void 0:y.length;if(!w||1===w)return Qt(r,e,o);const x=y.map((t=>Jt(t)));"id"===v||ee(v)&&void 0!==x[0].data[v]||(v="degree"),"degree"===v?x.sort(((t,e)=>r.getDegree(e.id,"both")-r.getDegree(t.id,"both"))):"id"===v?x.sort(((t,e)=>c(e.id)&&c(t.id)?e.id-t.id:`${t.id}`.localeCompare(`${e.id}`))):x.sort(((t,e)=>e.data[v]-t.data[v]));const b=f||"undefined"==typeof window?f:window.innerWidth,E=g||"undefined"==typeof window?g:window.innerHeight,N=w,_={rows:u,cols:d};if(null!=u&&null!=d)_.rows=u,_.cols=d;else if(null!=u&&null==d)_.rows=u,_.cols=Math.ceil(N/_.rows);else if(null==u&&null!=d)_.cols=d,_.rows=Math.ceil(N/_.cols);else{const t=Math.sqrt(N*E/b);_.rows=Math.round(t),_.cols=Math.round(b/E*t)}if(_.rows=Math.max(_.rows,1),_.cols=Math.max(_.cols,1),_.cols*_.rows>N){const t=Bn(_),e=$n(_);(t-1)*e>=N?Bn(_,t-1):(e-1)*t>=N&&$n(_,e-1)}else for(;_.cols*_.rows<N;){const t=Bn(_),e=$n(_);(e+1)*t>=N?$n(_,e+1):Bn(_,t+1)}let M=i?0:b/_.cols,k=i?0:E/_.rows;if(a||h){const t=Wt(10,h),e=Yt(30,l,!1);x.forEach((n=>{n.data.x&&n.data.y||(n.data.x=0,n.data.y=0);const o=r.getNode(n.id),[i,a]=Ut(e(o)||30),u=void 0!==t?t(n):s,d=i+u,h=a+u;M=Math.max(M,d),k=Math.max(k,h)}))}const A={},j={row:0,col:0},O={};for(let t=0;t<x.length;t++){const e=x[t];let n;if(p&&(n=p(r.getNode(e.id))),n&&(void 0!==n.row||void 0!==n.col)){const t={row:n.row,col:n.col};if(void 0===t.col)for(t.col=0;Gn(A,t);)t.col++;else if(void 0===t.row)for(t.row=0;Gn(A,t);)t.row++;O[e.id]=t,Un(A,t)}Yn(e,o,M,k,O,_,j,A)}const S={nodes:x,edges:m};return e&&x.forEach((t=>{r.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})})),S}))}},radial:class{constructor(t={}){this.options=t,this.id="radial",this.options=Object.assign(Object.assign({},Xn),t)}execute(e,r){return t(this,void 0,void 0,(function*(){return this.genericRadialLayout(!1,e,r)}))}assign(e,r){return t(this,void 0,void 0,(function*(){yield this.genericRadialLayout(!0,e,r)}))}genericRadialLayout(e,r,n){return t(this,void 0,void 0,(function*(){const t=Object.assign(Object.assign({},this.options),n),{width:o,height:i,center:s,focusNode:a,unitRadius:u,nodeSize:d,nodeSpacing:h,strictRadial:c,preventOverlap:l,maxPreventOverlapIteration:f,sortBy:g,linkDistance:p=50,sortStrength:v=10,maxIteration:y=1e3}=t,m=r.getAllNodes(),w=r.getAllEdges(),x=o||"undefined"==typeof window?o:window.innerWidth,b=i||"undefined"==typeof window?i:window.innerHeight,E=s||[x/2,b/2];if(!(null==m?void 0:m.length)||1===m.length)return Qt(r,e,E);let N=m[0];if(ee(a)){for(let t=0;t<m.length;t++)if(m[t].id===a){N=m[t];break}}else N=a||m[0];const _=((t,e)=>{let r=-1;return t.forEach(((t,n)=>{t.id===e&&(r=n)})),Math.max(r,0)})(m,N.id),M=tr({nodes:m,edges:w},!1),k=Ze(M),A=((t,e)=>{let r=0;for(let n=0;n<t[e].length;n++)t[e][n]!==1/0&&(r=t[e][n]>r?t[e][n]:r);return r})(k,_);((t,e,r)=>{const n=t.length;for(let o=0;o<n;o++)if(t[e][o]===1/0){t[e][o]=r,t[o][e]=r;for(let i=0;i<n;i++)t[o][i]!==1/0&&t[e][i]===1/0&&(t[e][i]=r+t[o][i],t[i][e]=r+t[o][i])}for(let r=0;r<n;r++)if(r!==e)for(let o=0;o<n;o++)if(t[r][o]===1/0){let n=Math.abs(t[e][r]-t[e][o]);n=0===n?1:n,t[r][o]=n}})(k,_,A+1);const j=k[_];let O=x-E[0]>E[0]?E[0]:x-E[0],S=b-E[1]>E[1]?E[1]:b-E[1];0===O&&(O=x/2),0===S&&(S=b/2);const z=Math.min(O,S),R=Math.max(...j),I=[],P=u||z/R;j.forEach(((t,e)=>{I[e]=t*P}));const C=((t,e,r,n,o,i,s)=>{if(!t)return[];const a=[];if(e){const u={};e.forEach(((e,d)=>{const h=[];e.forEach(((e,a)=>{var c,l;if(d===a)h.push(0);else if(n[d]===n[a])if("data"===i)h.push(e*(Math.abs(d-a)*s)/(n[d]/o));else if(i){let r,f;if(u[t[d].id])r=u[t[d].id];else{const e=("id"===i?t[d].id:null===(c=t[d].data)||void 0===c?void 0:c[i])||0;r=ee(e)?e.charCodeAt(0):e,u[t[d].id]=r}if(u[t[a].id])f=u[t[a].id];else{const e=("id"===i?t[a].id:null===(l=t[a].data)||void 0===l?void 0:l[i])||0;f=ee(e)?e.charCodeAt(0):e,u[t[a].id]=f}h.push(e*(Math.abs(r-f)*s)/(n[d]/o))}else h.push(e*r/(n[d]/o));else{const t=(r+o)/2;h.push(e*t)}})),a.push(h)}))}return a})(m,k,p,I,P,g,v),D=(t=>{const e=t.length,r=t[0].length,n=[];for(let o=0;o<e;o++){const e=[];for(let n=0;n<r;n++)0!==t[o][n]?e.push(1/(t[o][n]*t[o][n])):e.push(0);n.push(e)}return n})(C),T=((t,e,r)=>{try{const r=Ke.mul(Ke.pow(e,2),-.5),n=r.mean("row"),o=r.mean("column"),i=r.mean();r.add(i).subRowVector(n).subColumnVector(o);const s=new Qe(r),a=Ke.sqrt(s.diagonalMatrix).diagonal();return s.leftSingularVectors.toJSON().map((e=>Ke.mul([e],[a]).toJSON()[0].splice(0,t)))}catch(t){const n=[];for(let t=0;t<e.length;t++){const t=Math.random()*r,e=Math.random()*r;n.push([t,e])}return n}})(p,C,p);let L,F=T.map((([t,e])=>({x:(isNaN(t)?Math.random()*p:t)-T[_][0],y:(isNaN(e)?Math.random()*p:e)-T[_][1]})));if(this.run(y,F,D,C,I,_),l){L=Ht(d,h);const t={nodes:m,nodeSizeFunc:L,positions:F,radii:I,height:b,width:x,strictRadial:Boolean(c),focusIdx:_,iterations:f||200,k:F.length/4.5};F=((t,e)=>{const r=Object.assign(Object.assign({},Hn),e),{positions:n,iterations:o,width:i,k:s,speed:a=100,strictRadial:u,focusIdx:d,radii:h=[],nodeSizeFunc:c}=r,l=t.getAllNodes(),f=[],g=i/10;for(let t=0;t<o;t++)n.forEach(((t,e)=>{f[e]={x:0,y:0}})),Kn(l,n,f,s,h,c),Jn(n,f,a,u,d,g,i,h);return n})(r,t)}const q=[];return F.forEach(((t,e)=>{const r=Jt(m[e]);r.data.x=t.x+E[0],r.data.y=t.y+E[1],q.push(r)})),e&&q.forEach((t=>r.mergeNodeData(t.id,{x:t.data.x,y:t.data.y}))),{nodes:q,edges:w}}))}run(t,e,r,n,o,i){for(let s=0;s<=t;s++){const a=s/t;this.oneIteration(a,e,o,n,r,i)}}oneIteration(t,e,r,n,o,i){const s=1-t;e.forEach(((a,u)=>{const d=er(a,{x:0,y:0}),h=0===d?0:1/d;if(u===i)return;let c=0,l=0,f=0;e.forEach(((t,e)=>{if(u===e)return;const r=er(a,t),i=0===r?0:1/r,s=n[e][u];f+=o[u][e],c+=o[u][e]*(t.x+s*(a.x-t.x)*i),l+=o[u][e]*(t.y+s*(a.y-t.y)*i)}));const g=0===r[u]?0:1/r[u];f*=s,f+=t*g*g,c*=s,c+=t*g*a.x*h,a.x=c/f,l*=s,l+=t*g*a.y*h,a.y=l/f}))}},force:Me,d3force:rn,"d3-force-3d":class extends rn{constructor(){super(...arguments),this.id="d3-force-3d",this.config={inputNodeAttrs:["x","y","z","vx","vy","vz","fx","fy","fz"],outputNodeAttrs:["x","y","z","vx","vy","vz"],simulationAttrs:["alpha","alphaMin","alphaDecay","alphaTarget","velocityDecay","randomSource","numDimensions"]},this.forceMap={link:dn,manyBody:Nn,center:_n,collide:jn,radial:On,x:Sn,y:zn,z:Rn},this.options={numDimensions:3,link:{id:t=>t.id},manyBody:{},center:{x:0,y:0,z:0}}}initSimulation(){return function(t,e){e=e||2;var r,n=Math.min(3,Math.max(1,Math.round(e))),o=1,i=.001,s=1-Math.pow(i,1/300),a=0,u=.6,d=new Map,h=qr(f),c=kr("tick","end"),l=function(){let t=1;return()=>(t=(1664525*t+1013904223)%yn)/yn}();function f(){g(),c.call("tick",r),o<i&&(h.stop(),c.call("end",r))}function g(e){var i,h,c=t.length;void 0===e&&(e=1);for(var l=0;l<e;++l)for(o+=(a-o)*s,d.forEach((function(t){t(o)})),i=0;i<c;++i)null==(h=t[i]).fx?h.x+=h.vx*=u:(h.x=h.fx,h.vx=0),n>1&&(null==h.fy?h.y+=h.vy*=u:(h.y=h.fy,h.vy=0)),n>2&&(null==h.fz?h.z+=h.vz*=u:(h.z=h.fz,h.vz=0));return r}function p(){for(var e,r=0,o=t.length;r<o;++r){if((e=t[r]).index=r,null!=e.fx&&(e.x=e.fx),null!=e.fy&&(e.y=e.fy),null!=e.fz&&(e.z=e.fz),isNaN(e.x)||n>1&&isNaN(e.y)||n>2&&isNaN(e.z)){var i=10*(n>2?Math.cbrt(.5+r):n>1?Math.sqrt(.5+r):r),s=r*bn,a=r*En;1===n?e.x=i:2===n?(e.x=i*Math.cos(s),e.y=i*Math.sin(s)):(e.x=i*Math.sin(s)*Math.cos(a),e.y=i*Math.cos(s),e.z=i*Math.sin(s)*Math.sin(a))}(isNaN(e.vx)||n>1&&isNaN(e.vy)||n>2&&isNaN(e.vz))&&(e.vx=0,n>1&&(e.vy=0),n>2&&(e.vz=0))}}function v(e){return e.initialize&&e.initialize(t,l,n),e}return null==t&&(t=[]),p(),r={tick:g,restart:function(){return h.restart(f),r},stop:function(){return h.stop(),r},numDimensions:function(t){return arguments.length?(n=Math.min(3,Math.max(1,Math.round(t))),d.forEach(v),r):n},nodes:function(e){return arguments.length?(t=e,p(),d.forEach(v),r):t},alpha:function(t){return arguments.length?(o=+t,r):o},alphaMin:function(t){return arguments.length?(i=+t,r):i},alphaDecay:function(t){return arguments.length?(s=+t,r):+s},alphaTarget:function(t){return arguments.length?(a=+t,r):a},velocityDecay:function(t){return arguments.length?(u=1-t,r):1-u},randomSource:function(t){return arguments.length?(l=t,d.forEach(v),r):l},force:function(t,e){return arguments.length>1?(null==e?d.delete(t):d.set(t,v(e)),r):d.get(t)},find:function(){var e,r,o,i,s,a,u=Array.prototype.slice.call(arguments),d=u.shift()||0,h=(n>1?u.shift():null)||0,c=(n>2?u.shift():null)||0,l=u.shift()||1/0,f=0,g=t.length;for(l*=l,f=0;f<g;++f)(i=(e=d-(s=t[f]).x)*e+(r=h-(s.y||0))*r+(o=c-(s.z||0))*o)<l&&(a=s,l=i);return a},on:function(t,e){return arguments.length>1?(c.on(t,e),r):c.on(t)}}}()}},fruchterman:class{constructor(t={}){this.options=t,this.id="fruchterman",this.timeInterval=0,this.running=!1,this.options=Object.assign(Object.assign({},qn),t)}execute(e,r){return t(this,void 0,void 0,(function*(){return this.genericFruchtermanLayout(!1,e,r)}))}assign(e,r){return t(this,void 0,void 0,(function*(){yield this.genericFruchtermanLayout(!0,e,r)}))}stop(){this.timeInterval&&"undefined"!=typeof window&&window.clearInterval(this.timeInterval),this.running=!1}tick(t=this.options.maxIteration||1){if(this.lastResult)return this.lastResult;for(let e=0;e<t;e++)this.runOneStep(this.lastGraph,this.lastClusterMap,this.lastOptions);const e={nodes:this.lastLayoutNodes,edges:this.lastLayoutEdges};return this.lastAssign&&e.nodes.forEach((t=>this.lastGraph.mergeNodeData(t.id,{x:t.data.x,y:t.data.y,z:3===this.options.dimensions?t.data.z:void 0}))),e}genericFruchtermanLayout(e,r,n){return t(this,void 0,void 0,(function*(){if(this.running)return;const t=this.formatOptions(n),{dimensions:o,width:i,height:s,center:a,clustering:d,nodeClusterBy:h,maxIteration:c,onTick:l}=t,f=r.getAllNodes(),g=r.getAllEdges();if(!(null==f?void 0:f.length)){const t={nodes:[],edges:g};return this.lastResult=t,t}if(1===f.length){e&&r.mergeNodeData(f[0].id,{x:a[0],y:a[1],z:3===o?a[2]:void 0});const t={nodes:[Object.assign(Object.assign({},f[0]),{data:Object.assign(Object.assign({},f[0].data),{x:a[0],y:a[1],z:3===o?a[2]:void 0})})],edges:g};return this.lastResult=t,t}const p=f.map((t=>Jt(t,[i,s]))),v=new u({nodes:p,edges:g}),y={};if(d&&p.forEach((t=>{const e=t.data[h];y[e]||(y[e]={name:e,cx:0,cy:0,count:0})})),this.lastLayoutNodes=p,this.lastLayoutEdges=g,this.lastAssign=e,this.lastGraph=v,this.lastOptions=t,this.lastClusterMap=y,"undefined"==typeof window)return;let m=0;return new Promise((n=>{this.timeInterval=window.setInterval((()=>{this.running?(this.runOneStep(v,y,t),e&&p.forEach((({id:t,data:e})=>r.mergeNodeData(t,{x:e.x,y:e.y,z:3===o?e.z:void 0}))),null==l||l({nodes:p,edges:g}),m++,m>=c&&(window.clearInterval(this.timeInterval),n({nodes:p,edges:g}))):n({nodes:p,edges:g})}),0),this.running=!0}))}))}formatOptions(t={}){const e=Object.assign(Object.assign({},this.options),t),{clustering:r,nodeClusterBy:n}=e,{center:o,width:i,height:s}=e;return e.width=i||"undefined"==typeof window?i:window.innerWidth,e.height=s||"undefined"==typeof window?s:window.innerHeight,e.center=o||[e.width/2,e.height/2],e.clustering=r&&!!n,e}runOneStep(t,e,r){const{dimensions:n,height:o,width:i,gravity:s,center:a,speed:u,clustering:d,nodeClusterBy:h,clusterGravity:l}=r,f=o*i,g=Math.sqrt(f)/10,p=t.getAllNodes(),v=f/(p.length+1),y=Math.sqrt(v),m={};if(this.applyCalculate(t,m,y,v),d){for(const t in e)e[t].cx=0,e[t].cy=0,e[t].count=0;p.forEach((t=>{const{data:r}=t,n=e[r[h]];c(r.x)&&(n.cx+=r.x),c(r.y)&&(n.cy+=r.y),n.count++}));for(const t in e)e[t].cx/=e[t].count,e[t].cy/=e[t].count;const t=l||s;p.forEach(((r,n)=>{const{id:o,data:i}=r;if(!c(i.x)||!c(i.y))return;const s=e[i[h]],a=Math.sqrt((i.x-s.cx)*(i.x-s.cx)+(i.y-s.cy)*(i.y-s.cy)),u=y*t;m[o].x-=u*(i.x-s.cx)/a,m[o].y-=u*(i.y-s.cy)/a}))}p.forEach(((t,e)=>{const{id:r,data:o}=t;if(!c(o.x)||!c(o.y))return;const i=.01*y*s;m[r].x-=i*(o.x-a[0]),m[r].y-=i*(o.y-a[1]),3===n&&(m[r].z-=i*(o.z-a[2]))})),p.forEach(((e,r)=>{const{id:o,data:i}=e;if(c(i.fx)&&c(i.fy))return i.x=i.fx,i.y=i.fy,void(3===n&&(i.z=i.fz));if(!c(i.x)||!c(i.y))return;const s=Math.sqrt(m[o].x*m[o].x+m[o].y*m[o].y+(3===n?m[o].z*m[o].z:0));if(s>0){const e=Math.min(g*(u/800),s);t.mergeNodeData(o,{x:i.x+m[o].x/s*e,y:i.y+m[o].y/s*e,z:3===n?i.z+m[o].z/s*e:void 0})}}))}applyCalculate(t,e,r,n){this.calRepulsive(t,e,n),this.calAttractive(t,e,r)}calRepulsive(t,e,r){const n=t.getAllNodes();n.forEach((({data:t,id:o},i)=>{e[o]={x:0,y:0,z:0},n.forEach((({data:n,id:s},a)=>{if(i<=a||!c(t.x)||!c(n.x)||!c(t.y)||!c(n.y))return;let u=t.x-n.x,d=t.y-n.y,h=3===this.options.dimensions?t.z-n.z:0,l=u*u+d*d+h*h;0===l&&(l=1,u=.01,d=.01,h=.01);const f=r/l,g=u*f,p=d*f,v=h*f;e[o].x+=g,e[o].y+=p,e[s].x-=g,e[s].y-=p,3===this.options.dimensions&&(e[o].z+=v,e[s].z-=v)}))}))}calAttractive(t,e,r){t.getAllEdges().forEach((n=>{const{source:o,target:i}=n;if(!o||!i||o===i)return;const{data:s}=t.getNode(o),{data:a}=t.getNode(i);if(!(c(a.x)&&c(s.x)&&c(a.y)&&c(s.y)))return;const u=a.x-s.x,d=a.y-s.y,h=3===this.options.dimensions?a.z-s.z:0,l=Math.sqrt(u*u+d*d+h*h)/r,f=u*l,g=d*l,p=h*l;e[o].x+=f,e[o].y+=g,e[i].x-=f,e[i].y-=g,3===this.options.dimensions&&(e[o].z+=p,e[i].z-=p)}))}},forceAtlas2:class{constructor(t={}){this.options=t,this.id="forceAtlas2",this.options=Object.assign(Object.assign({},Fn),t)}execute(e,r){return t(this,void 0,void 0,(function*(){return this.genericForceAtlas2Layout(!1,e,r)}))}assign(e,r){return t(this,void 0,void 0,(function*(){yield this.genericForceAtlas2Layout(!0,e,r)}))}genericForceAtlas2Layout(e,r,n){return t(this,void 0,void 0,(function*(){const t=r.getAllEdges(),o=r.getAllNodes(),i=this.formatOptions(n,o.length),{width:s,height:a,prune:d,maxIteration:h,nodeSize:c,center:l}=i;if(!(null==o?void 0:o.length)||1===o.length)return Qt(r,e,l);const f=o.map((t=>Jt(t,[s,a]))),g=t.filter((t=>{const{source:e,target:r}=t;return e!==r})),p=new u({nodes:f,edges:g}),v=this.getSizes(p,c);if(this.run(p,r,h,v,e,i),d){for(let t=0;t<g.length;t+=1){const{source:e,target:r}=g[t],n=p.getDegree(e),o=p.getDegree(e);if(n<=1){const t=p.getNode(r);p.mergeNodeData(e,{x:t.data.x,y:t.data.y})}else if(o<=1){const t=p.getNode(e);p.mergeNodeData(r,{x:t.data.x,y:t.data.y})}}const t=Object.assign(Object.assign({},i),{prune:!1,barnesHut:!1});this.run(p,r,100,v,e,t)}return{nodes:f,edges:t}}))}getSizes(t,e){const r=t.getAllNodes(),n={};for(let t=0;t<r.length;t+=1){const o=r[t];n[o.id]=Ht(e,void 0)(o)}return n}formatOptions(t={},e){const r=Object.assign(Object.assign({},this.options),t),{center:n,width:o,height:i,barnesHut:s,prune:a,maxIteration:u,kr:d,kg:h}=r;return r.width=o||"undefined"==typeof window?o:window.innerWidth,r.height=i||"undefined"==typeof window?i:window.innerHeight,r.center=n||[r.width/2,r.height/2],void 0===s&&e>250&&(r.barnesHut=!0),void 0===a&&e>100&&(r.prune=!0),0!==u||a?0===u&&a&&(r.maxIteration=100,e<=200&&e>100?r.maxIteration=500:e>200&&(r.maxIteration=950)):(r.maxIteration=250,e<=200&&e>100?r.maxIteration=1e3:e>200&&(r.maxIteration=1200)),d||(r.kr=50,e>100&&e<=500?r.kr=20:e>500&&(r.kr=1)),h||(r.kg=20,e>100&&e<=500?r.kg=10:e>500&&(r.kg=1)),r}run(t,e,r,n,o,i){const{kr:s,barnesHut:a,onTick:u}=i,d=t.getAllNodes();let h=0,c=r;const l={},f={},g={};for(let e=0;e<d.length;e+=1){const{data:r,id:n}=d[e];if(l[n]=[0,0],a){const o={id:e,rx:r.x,ry:r.y,mass:1,g:s,degree:t.getDegree(n)};g[n]=new Dn(o)}}for(;c>0;)h=this.oneStep(t,{iter:c,preventOverlapIters:50,krPrime:100,sg:h,forces:l,preForces:f,bodies:g,sizes:n},i),c--,null==u||u({nodes:d,edges:e.getAllEdges()});return t}oneStep(t,e,r){const{iter:n,preventOverlapIters:o,krPrime:i,sg:s,preForces:a,bodies:u,sizes:d}=e;let{forces:h}=e;const{preventOverlap:c,barnesHut:l}=r,f=t.getAllNodes();for(let t=0;t<f.length;t+=1){const{id:e}=f[t];a[e]=[...h[e]],h[e]=[0,0]}return h=this.getAttrForces(t,n,o,d,h,r),h=l&&(c&&n>o||!c)?this.getOptRepGraForces(t,h,u,r):this.getRepGraForces(t,n,o,h,i,d,r),this.updatePos(t,h,a,s,r)}getAttrForces(t,e,r,n,o,i){const{preventOverlap:s,dissuadeHubs:a,mode:u,prune:d}=i,h=t.getAllEdges();for(let i=0;i<h.length;i+=1){const{source:c,target:l}=h[i],f=t.getNode(c),g=t.getNode(l),p=t.getDegree(c),v=t.getDegree(l);if(d&&(p<=1||v<=1))continue;const y=[g.data.x-f.data.x,g.data.y-f.data.y];let m=Math.hypot(y[0],y[1]);m=m<1e-4?1e-4:m,y[0]=y[0]/m,y[1]=y[1]/m,s&&e<r&&(m=m-n[c]-n[l]);let w=m,x=w;"linlog"===u&&(w=Math.log(1+m),x=w),a&&(w=m/p,x=m/v),s&&e<r&&m<=0?(w=0,x=0):s&&e<r&&m>0&&(w=m,x=m),o[c][0]+=w*y[0],o[l][0]-=x*y[0],o[c][1]+=w*y[1],o[l][1]-=x*y[1]}return o}getOptRepGraForces(t,e,r,n){const{kg:o,center:i,prune:s}=n,a=t.getAllNodes(),u=a.length;let d=9e10,h=-9e10,c=9e10,l=-9e10;for(let e=0;e<u;e+=1){const{id:n,data:o}=a[e];s&&t.getDegree(n)<=1||(r[n].setPos(o.x,o.y),o.x>=h&&(h=o.x),o.x<=d&&(d=o.x),o.y>=l&&(l=o.y),o.y<=c&&(c=o.y))}const f=Math.max(h-d,l-c),g=new Tn({xmid:(h+d)/2,ymid:(l+c)/2,length:f,massCenter:i,mass:u}),p=new Ln(g);for(let e=0;e<u;e+=1){const{id:n}=a[e];s&&t.getDegree(n)<=1||r[n].in(g)&&p.insert(r[n])}for(let n=0;n<u;n+=1){const{id:u,data:d}=a[n],h=t.getDegree(u);if(s&&h<=1)continue;r[u].resetForce(),p.updateForce(r[u]),e[u][0]-=r[u].fx,e[u][1]-=r[u].fy;const c=[d.x-i[0],d.y-i[1]];let l=Math.hypot(c[0],c[1]);l=l<1e-4?1e-4:l,c[0]=c[0]/l,c[1]=c[1]/l;const f=o*(h+1);e[u][0]-=f*c[0],e[u][1]-=f*c[1]}return e}getRepGraForces(t,e,r,n,o,i,s){const{preventOverlap:a,kr:u,kg:d,center:h,prune:c}=s,l=t.getAllNodes(),f=l.length;for(let s=0;s<f;s+=1){const g=l[s],p=t.getDegree(g.id);for(let d=s+1;d<f;d+=1){const s=l[d],h=t.getDegree(s.id);if(c&&(p<=1||h<=1))continue;const f=[s.data.x-g.data.x,s.data.y-g.data.y];let v=Math.hypot(f[0],f[1]);v=v<1e-4?1e-4:v,f[0]=f[0]/v,f[1]=f[1]/v,a&&e<r&&(v=v-i[g.id]-i[s.id]);let y=u*(p+1)*(h+1)/v;a&&e<r&&v<0?y=o*(p+1)*(h+1):a&&e<r&&0===v?y=0:a&&e<r&&v>0&&(y=u*(p+1)*(h+1)/v),n[g.id][0]-=y*f[0],n[s.id][0]+=y*f[0],n[g.id][1]-=y*f[1],n[s.id][1]+=y*f[1]}const v=[g.data.x-h[0],g.data.y-h[1]],y=Math.hypot(v[0],v[1]);v[0]=v[0]/y,v[1]=v[1]/y;const m=d*(p+1);n[g.id][0]-=m*v[0],n[g.id][1]-=m*v[1]}return n}updatePos(t,e,r,n,o){const{ks:i,tao:s,prune:a,ksmax:u}=o,d=t.getAllNodes(),h=d.length,l=[],f=[];let g=0,p=0,v=n;for(let n=0;n<h;n+=1){const{id:o}=d[n],i=t.getDegree(o);if(a&&i<=1)continue;const s=[e[o][0]-r[o][0],e[o][1]-r[o][1]],u=Math.hypot(s[0],s[1]),h=[e[o][0]+r[o][0],e[o][1]+r[o][1]],c=Math.hypot(h[0],h[1]);l[n]=u,f[n]=c/2,g+=(i+1)*l[n],p+=(i+1)*f[n]}const y=v;v=s*p/g,0!==y&&(v=v>1.5*y?1.5*y:v);for(let r=0;r<h;r+=1){const{id:n,data:o}=d[r],s=t.getDegree(n);if(a&&s<=1)continue;if(c(o.fx)&&c(o.fy))continue;let h=i*v/(1+v*Math.sqrt(l[r])),f=Math.hypot(e[n][0],e[n][1]);f=f<1e-4?1e-4:f;const g=u/f;h=h>g?g:h;const p=h*e[n][0],y=h*e[n][1];t.mergeNodeData(n,{x:o.x+p,y:o.y+y})}return v}},dagre:Cn,antvDagre:class{constructor(t={}){this.options=t,this.id="antv-dagre",this.options=Object.assign(Object.assign({},Xt),t)}execute(e,r){return t(this,void 0,void 0,(function*(){return this.genericDagreLayout(!1,e,r)}))}assign(e,r){return t(this,void 0,void 0,(function*(){yield this.genericDagreLayout(!0,e,r)}))}genericDagreLayout(e,r,n){return t(this,void 0,void 0,(function*(){const t=Object.assign(Object.assign({},this.options),n),{nodeSize:o,align:i,rankdir:s="TB",ranksep:a,nodesep:d,ranksepFunc:h,nodesepFunc:l,edgeLabelSpace:f,ranker:g,nodeOrder:p,begin:v,controlPoints:y,radial:m,sortByCombo:w,preset:x}=t,b=new u({tree:[]}),E=Wt(a||50,h),N=Wt(d||50,l);let _=N,M=E;"LR"!==s&&"RL"!==s||(_=E,M=N);const k=Yt(10,o,!1),A=r.getAllNodes(),j=r.getAllEdges();let O;A.forEach((t=>{const e=Ut(k(t)),r=M(t),n=_(t),o=e[0]+2*n,i=e[1]+2*r,s=t.data.layer;c(s)?b.addNode({id:t.id,data:{width:o,height:i,layer:s}}):b.addNode({id:t.id,data:{width:o,height:i}})})),w&&(b.attachTreeStructure("combo"),A.forEach((t=>{const{parentId:e}=t.data;void 0!==e&&b.hasNode(e)&&b.setParent(t.id,e,"combo")}))),j.forEach((t=>{b.addEdge({id:t.id,source:t.source,target:t.target,data:{weight:t.data.weight||1}})})),(null==x?void 0:x.length)&&(O=new u({nodes:x})),((t,e)=>{const{edgeLabelSpace:r,keepNodeOrder:n,prevGraph:o,rankdir:i,ranksep:s}=e;var a,d;!n&&o&&(d=o,(a=t).getAllNodes().forEach((t=>{const e=a.getNode(t.id);if(d.hasNode(t.id)){const r=d.getNode(t.id);e.data.fixorder=r.data._order,delete r.data._order}else delete e.data.fixorder})));const h=(t=>{const e=new u({tree:[]});return t.getAllNodes().forEach((r=>{const n=Bt(t.getNode(r.id).data),o=Object.assign(Object.assign({},kt),n),i=Vt(o,Mt);e.hasNode(r.id)||e.addNode({id:r.id,data:Object.assign({},i)});const s=t.hasTreeStructure("combo")?t.getParent(r.id,"combo"):t.getParent(r.id);null==s||(e.hasNode(s.id)||e.addNode(Object.assign({},s)),e.setParent(r.id,s.id))})),t.getAllEdges().forEach((r=>{const n=Bt(t.getEdge(r.id).data),o={};null==Ot||Ot.forEach((t=>{void 0!==n[t]&&(o[t]=n[t])})),e.addEdge({id:r.id,source:r.source,target:r.target,data:Object.assign({},jt,Vt(n,At),o)})})),e})(t);let c;r&&(e.ranksep=((t,e)=>{const{ranksep:r=0,rankdir:n}=e;return t.getAllNodes().forEach((t=>{isNaN(t.data.layer)||t.data.layer||(t.data.layer=0)})),t.getAllEdges().forEach((t=>{var e;t.data.minlen*=2,"c"!==(null===(e=t.data.labelpos)||void 0===e?void 0:e.toLowerCase())&&("TB"===n||"BT"===n?t.data.width+=t.data.labeloffset:t.data.height+=t.data.labeloffset)})),r/2})(h,{rankdir:i,ranksep:s}));try{c=_t(h,e)}catch(t){if("Not possible to find intersection inside of the rectangle"===t.message)return void console.error("The following error may be caused by improper layer setting, please make sure your manual layer setting does not violate the graph\'s structure:\\n",t);throw t}((t,e)=>{t.getAllNodes().forEach((r=>{var n;const o=t.getNode(r.id);if(o){const t=e.getNode(r.id);o.data.x=t.data.x,o.data.y=t.data.y,o.data._order=t.data.order,o.data._rank=t.data.rank,(null===(n=e.getChildren(r.id))||void 0===n?void 0:n.length)&&(o.data.width=t.data.width,o.data.height=t.data.height)}})),t.getAllEdges().forEach((r=>{const n=t.getEdge(r.id),o=e.getEdge(r.id);n.data.points=o?o.data.points:[],o&&o.data.hasOwnProperty("x")&&(n.data.x=o.data.x,n.data.y=o.data.y)}))})(t,h)})(b,{prevGraph:O,edgeLabelSpace:f,keepNodeOrder:!!p,nodeOrder:p||[],acyclicer:"greedy",ranker:g,rankdir:s,nodesep:d,align:i});const S=[0,0];if(v){let t=1/0,e=1/0;b.getAllNodes().forEach((r=>{t>r.data.x&&(t=r.data.x),e>r.data.y&&(e=r.data.y)})),b.getAllEdges().forEach((r=>{var n;null===(n=r.data.points)||void 0===n||n.forEach((r=>{t>r.x&&(t=r.x),e>r.y&&(e=r.y)}))})),S[0]=v[0]-t,S[1]=v[1]-e}const z="LR"===s||"RL"===s;if(m);else{const t=new Set,e="BT"===s||"RL"===s?(t,e)=>e-t:(t,e)=>t-e;b.getAllNodes().forEach((e=>{e.data.x=e.data.x+S[0],e.data.y=e.data.y+S[1],t.add(z?e.data.x:e.data.y)}));const r=Array.from(t).sort(e),n=z?(t,e)=>t.x!==e.x:(t,e)=>t.y!==e.y,o=z?(t,e,r)=>{const n=Math.max(e.y,r.y),o=Math.min(e.y,r.y);return t.filter((t=>t.y<=n&&t.y>=o))}:(t,e,r)=>{const n=Math.max(e.x,r.x),o=Math.min(e.x,r.x);return t.filter((t=>t.x<=n&&t.x>=o))};b.getAllEdges().forEach(((t,e)=>{var i;f&&y&&"loop"!==t.data.type&&(t.data.controlPoints=((t,e,r,n,o,i,s)=>{let a=(null==t?void 0:t.slice(1,t.length-1))||[];if(e&&r){let{x:t,y:u}=e.data,{x:d,y:h}=r.data;if(o&&(t=e.data.y,u=e.data.x,d=r.data.y,h=r.data.x),h!==u&&t!==d){const c=n.indexOf(u),l=n[c+1];if(l){const t=a[0],e=o?{x:(u+l)/2,y:(null==t?void 0:t.y)||d}:{x:(null==t?void 0:t.x)||d,y:(u+l)/2};t&&!i(t,e)||a.unshift(e)}const f=n.indexOf(h),g=Math.abs(f-c);if(1===g)a=s(a,e.data,r.data),a.length||a.push(o?{x:(u+h)/2,y:t}:{x:t,y:(u+h)/2});else if(g>1){const e=n[f-1];if(e){const r=a[a.length-1],n=o?{x:(h+e)/2,y:(null==r?void 0:r.y)||d}:{x:(null==r?void 0:r.x)||t,y:(h+e)/2};r&&!i(r,n)||a.push(n)}}}}return a})(null===(i=t.data.points)||void 0===i?void 0:i.map((({x:t,y:e})=>({x:t+S[0],y:e+S[1]}))),b.getNode(t.source),b.getNode(t.target),r,z,n,o))}))}let R=[];R=b.getAllNodes().map((t=>Jt(t)));const I=b.getAllEdges();return e&&(R.forEach((t=>{r.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})})),I.forEach((t=>{r.mergeEdgeData(t.id,{controlPoints:t.data.controlPoints})}))),{nodes:R,edges:I}}))}},comboCombined:class{constructor(t={}){this.options=t,this.id="comboCombined",this.options=Object.assign(Object.assign({},dr),t)}execute(e,r){return t(this,void 0,void 0,(function*(){return this.genericComboCombinedLayout(!1,e,r)}))}assign(e,r){return t(this,void 0,void 0,(function*(){yield this.genericComboCombinedLayout(!0,e,r)}))}genericComboCombinedLayout(e,r,n){return t(this,void 0,void 0,(function*(){const t=this.initVals(Object.assign(Object.assign({},this.options),n)),{center:o,treeKey:i,outerLayout:s}=t,a=r.getAllNodes().filter((t=>!t.data._isCombo)),d=r.getAllNodes().filter((t=>t.data._isCombo)),h=r.getAllEdges(),c=null==a?void 0:a.length;if(!c||1===c)return Qt(r,e,o);const l=[],f=new Map;a.forEach((t=>{f.set(t.id,t)}));const g=new Map;d.forEach((t=>{g.set(t.id,t)}));const p=new Map,v=this.getInnerGraphs(r,i,f,g,h,t,p);yield Promise.all(v);const y=new Map,m=[],w=new Map;let x=!0;r.getRoots(i).forEach((t=>{const e=p.get(t.id),n=g.get(t.id)||f.get(t.id),o={id:t.id,data:Object.assign(Object.assign({},t.data),{x:e.data.x||n.data.x,y:e.data.y||n.data.y,fx:e.data.fx||n.data.fx,fy:e.data.fy||n.data.fy,mass:e.data.mass||n.data.mass,size:e.data.size})};m.push(o),y.set(t.id,!0),isNaN(o.data.x)||0===o.data.x||isNaN(o.data.y)||0===o.data.y?(o.data.x=100*Math.random(),o.data.y=100*Math.random()):x=!1,rr(r,[t],(e=>{e.id!==t.id&&w.set(e.id,t.id)}),"TB",i)}));const b=[];let E;if(h.forEach((t=>{const e=w.get(t.source)||t.source,r=w.get(t.target)||t.target;e!==r&&y.has(e)&&y.has(r)&&b.push({id:t.id,source:e,target:r,data:{}})})),null==m?void 0:m.length){if(1===m.length)m[0].data.x=o[0],m[0].data.y=o[1];else{const t=new u({nodes:m,edges:b}),e=s||new Me;if(x&&ur[e.id]){const e=m.length<100?new or:new oe;yield e.assign(t)}const r=Object.assign({center:o,kg:5,preventOverlap:!0,animate:!1},"force"===e.id?{gravity:1,factor:4,linkDistance:(t,e,r)=>(Math.max(...e.data.size)||32)/2+(Math.max(...r.data.size)||32)/2+200}:{});E=yield hr(e,t,r)}p.forEach((t=>{var e;const r=E.nodes.find((e=>e.id===t.id));if(r){const{x:e,y:n}=r.data;t.data.visited=!0,t.data.x=e,t.data.y=n,l.push({id:t.id,data:{x:e,y:n}})}const{x:n,y:o}=t.data;null===(e=t.data.nodes)||void 0===e||e.forEach((t=>{l.push({id:t.id,data:{x:t.data.x+n,y:t.data.y+o}})}))})),p.forEach((({data:t})=>{const{x:e,y:r,visited:n,nodes:o}=t;null==o||o.forEach((t=>{if(!n){const n=l.find((e=>e.id===t.id));n.data.x+=e||0,n.data.y+=r||0}}))}))}return e&&l.forEach((t=>{r.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})})),{nodes:l,edges:h}}))}initVals(t){const e=Object.assign({},t),{nodeSize:r,spacing:n,comboPadding:o}=t;let i,s,a;if(s=c(n)?()=>n:$t(n)?n:()=>0,e.spacing=s,r)if($t(r))i=t=>{const e=r(t),n=s(t);return re(t.size)?((t.size[0]>t.size[1]?t.size[0]:t.size[1])+n)/2:((e||32)+n)/2};else if(re(r)){const t=(r[0]>r[1]?r[0]:r[1])/2;i=e=>t+s(e)/2}else{const t=r/2;i=e=>t+s(e)/2}else i=t=>{const e=s(t);return t.size?re(t.size)?((t.size[0]>t.size[1]?t.size[0]:t.size[1])+e)/2:Gt(t.size)?((t.size.width>t.size.height?t.size.width:t.size.height)+e)/2:(t.size+e)/2:32+e/2};return e.nodeSize=i,a=c(o)?()=>o:re(o)?()=>Math.max.apply(null,o):$t(o)?o:()=>0,e.comboPadding=a,e}getInnerGraphs(e,r,n,o,i,s,a){const{nodeSize:d,comboPadding:h,spacing:l,innerLayout:f}=s,g=f||new oe({}),p={center:[0,0],preventOverlap:!0,nodeSpacing:l},v=[],y=t=>{let e=(null==h?void 0:h(t))||10;return re(e)&&(e=Math.max(...e)),{size:e?[2*e,2*e]:[30,30],padding:e}};return e.getRoots(r).forEach((s=>{a.set(s.id,{id:s.id,data:{nodes:[],size:y(s).size}});let h=Promise.resolve();rr(e,[s],(s=>{var l;if(!s.data._isCombo)return;const{size:f,padding:v}=y(s);if(null===(l=e.getChildren(s.id,r))||void 0===l?void 0:l.length){const l=a.get(s.id);a.set(s.id,{id:s.id,data:Object.assign({nodes:[]},null==l?void 0:l.data)});const f=new Map,y=e.getChildren(s.id,r).map((t=>{if(t.data._isCombo)return a.has(t.id)||a.set(t.id,{id:t.id,data:Object.assign({},t.data)}),f.set(t.id,!0),a.get(t.id);const e=n.get(t.id)||o.get(t.id);return f.set(t.id,!0),{id:t.id,data:Object.assign(Object.assign({},e.data),t.data)}})),m={nodes:y,edges:i.filter((t=>f.has(t.source)&&f.has(t.target)))};let w=1/0;y.forEach((t=>{var e;let{size:r}=t.data;r||(r=(null===(e=a.get(t.id))||void 0===e?void 0:e.data.size)||(null==d?void 0:d(t))||[30,30]),c(r)&&(r=[r,r]);const[n,o]=r;w>n&&(w=n),w>o&&(w=o),t.data.size=r})),h=h.then((()=>t(this,void 0,void 0,(function*(){const t=new u(m);yield hr(g,t,p,!0);const{minX:e,minY:r,maxX:n,maxY:o}=(t=>{let e=1/0,r=1/0,n=-1/0,o=-1/0;return t.forEach((t=>{let i=t.data.size;re(i)?1===i.length&&(i=[i[0],i[0]]):c(i)?i=[i,i]:(void 0===i||isNaN(i))&&(i=[30,30]);const s=[i[0]/2,i[1]/2],a=t.data.x-s[0],u=t.data.x+s[0],d=t.data.y-s[1],h=t.data.y+s[1];e>a&&(e=a),r>d&&(r=d),n<u&&(n=u),o<h&&(o=h)})),{minX:e,minY:r,maxX:n,maxY:o}})(y),i=(n+e)/2,d=(o+r)/2;m.nodes.forEach((t=>{t.data.x-=i,t.data.y-=d}));const h=[Math.max(n-e,w)+2*v,Math.max(o-r,w)+2*v];a.get(s.id).data.size=h,a.get(s.id).data.nodes=y}))))}else a.set(s.id,{id:s.id,data:Object.assign(Object.assign({},s.data),{size:f})});return!0}),"BT",r),v.push(h)})),v}}};let to;function eo(){(null==to?void 0:to.stop)&&to.stop()}function ro(e,r){return t(this,void 0,void 0,(function*(){const{layout:{id:t,options:n,iterations:o},nodes:i,edges:s}=e,a=new u({nodes:i,edges:s}),d=Zn[t];if(!d)throw new Error(`Unknown layout id: ${t}`);to=new d(n);let h=yield to.execute(a);return ar(to)&&(to.stop(),h=to.tick(o)),[h,r]}))}addEventListener("message",(function(t){var e,r=t.data,o=r.type,i=r.method,s=r.id,a=r.params;"RPC"===o&&i&&((e=n[i])?Promise.resolve().then((function(){return e.apply(n,a)})):Promise.reject("No such method")).then((function(t){postMessage({type:"RPC",id:s,result:t})})).catch((function(t){var e={message:t};t.stack&&(e.message=t.message,e.stack=t.stack,e.name=t.name),postMessage({type:"RPC",id:s,error:e})}))})),postMessage({type:"RPC",method:"ready"})})()})();\n//# sourceMappingURL=e2b4e534ff10c7df8b27.worker.js.map'])),{name:"[fullhash].worker.js"});return URL.revokeObjectURL(URL.createObjectURL(new Blob(['(()=>{var t={5439:(t,e,r)=>{t.exports={graphlib:r(1943),layout:r(5499),debug:r(5856),util:{time:r(345).time,notime:r(345).notime},version:r(3404)}},5205:(t,e,r)=>{"use strict";var n=r(2692),o=r(824);t.exports={run:function(t){var e="greedy"===t.graph().acyclicer?o(t,function(t){return function(e){return t.edge(e).weight}}(t)):function(t){var e=[],r={},o={};return n.forEach(t.nodes(),(function i(s){n.has(o,s)||(o[s]=!0,r[s]=!0,n.forEach(t.outEdges(s),(function(t){n.has(r,t.w)?e.push(t):i(t.w)})),delete r[s])})),e}(t);n.forEach(e,(function(e){var r=t.edge(e);t.removeEdge(e),r.forwardName=e.name,r.reversed=!0,t.setEdge(e.w,e.v,r,n.uniqueId("rev"))}))},undo:function(t){n.forEach(t.edges(),(function(e){var r=t.edge(e);if(r.reversed){t.removeEdge(e);var n=r.forwardName;delete r.reversed,delete r.forwardName,t.setEdge(e.w,e.v,r,n)}}))}}},1555:(t,e,r)=>{var n=r(2692),o=r(345);function i(t,e,r,n,i,s){var a={width:0,height:0,rank:s,borderType:e},u=i[e][s-1],d=o.addDummyNode(t,"border",a,r);i[e][s]=d,t.setParent(d,n),u&&t.setEdge(u,d,{weight:1})}t.exports=function(t){n.forEach(t.children(),(function e(r){var o=t.children(r),s=t.node(r);if(o.length&&n.forEach(o,e),n.has(s,"minRank")){s.borderLeft=[],s.borderRight=[];for(var a=s.minRank,u=s.maxRank+1;a<u;++a)i(t,"borderLeft","_bl",r,s,a),i(t,"borderRight","_br",r,s,a)}}))}},4688:(t,e,r)=>{"use strict";var n=r(2692);function o(t){n.forEach(t.nodes(),(function(e){i(t.node(e))})),n.forEach(t.edges(),(function(e){i(t.edge(e))}))}function i(t){var e=t.width;t.width=t.height,t.height=e}function s(t){t.y=-t.y}function a(t){var e=t.x;t.x=t.y,t.y=e}t.exports={adjust:function(t){var e=t.graph().rankdir.toLowerCase();"lr"!==e&&"rl"!==e||o(t)},undo:function(t){var e=t.graph().rankdir.toLowerCase();"bt"!==e&&"rl"!==e||function(t){n.forEach(t.nodes(),(function(e){s(t.node(e))})),n.forEach(t.edges(),(function(e){var r=t.edge(e);n.forEach(r.points,s),n.has(r,"y")&&s(r)}))}(t),"lr"!==e&&"rl"!==e||(function(t){n.forEach(t.nodes(),(function(e){a(t.node(e))})),n.forEach(t.edges(),(function(e){var r=t.edge(e);n.forEach(r.points,a),n.has(r,"x")&&a(r)}))}(t),o(t))}}},2278:t=>{function e(){var t={};t._next=t._prev=t,this._sentinel=t}function r(t){t._prev._next=t._next,t._next._prev=t._prev,delete t._next,delete t._prev}function n(t,e){if("_next"!==t&&"_prev"!==t)return e}t.exports=e,e.prototype.dequeue=function(){var t=this._sentinel,e=t._prev;if(e!==t)return r(e),e},e.prototype.enqueue=function(t){var e=this._sentinel;t._prev&&t._next&&r(t),t._next=e._next,e._next._prev=t,e._next=t,t._prev=e},e.prototype.toString=function(){for(var t=[],e=this._sentinel,r=e._prev;r!==e;)t.push(JSON.stringify(r,n)),r=r._prev;return"["+t.join(", ")+"]"}},5856:(t,e,r)=>{var n=r(2692),o=r(345),i=r(1943).Graph;t.exports={debugOrdering:function(t){var e=o.buildLayerMatrix(t),r=new i({compound:!0,multigraph:!0}).setGraph({});return n.forEach(t.nodes(),(function(e){r.setNode(e,{label:e}),r.setParent(e,"layer"+t.node(e).rank)})),n.forEach(t.edges(),(function(t){r.setEdge(t.v,t.w,{},t.name)})),n.forEach(e,(function(t,e){var o="layer"+e;r.setNode(o,{rank:"same"}),n.reduce(t,(function(t,e){return r.setEdge(t,e,{style:"invis"}),e}))})),r}}},1943:(t,e,r)=>{var n;try{n=r(6960)}catch(t){}n||(n=window.graphlib),t.exports=n},824:(t,e,r)=>{var n=r(2692),o=r(1943).Graph,i=r(2278);t.exports=function(t,e){if(t.nodeCount()<=1)return[];var r=function(t,e){var r=new o,s=0,a=0;n.forEach(t.nodes(),(function(t){r.setNode(t,{v:t,in:0,out:0})})),n.forEach(t.edges(),(function(t){var n=r.edge(t.v,t.w)||0,o=e(t),i=n+o;r.setEdge(t.v,t.w,i),a=Math.max(a,r.node(t.v).out+=o),s=Math.max(s,r.node(t.w).in+=o)}));var d=n.range(a+s+3).map((function(){return new i})),h=s+1;return n.forEach(r.nodes(),(function(t){u(d,h,r.node(t))})),{graph:r,buckets:d,zeroIdx:h}}(t,e||s),d=function(t,e,r){for(var n,o=[],i=e[e.length-1],s=e[0];t.nodeCount();){for(;n=s.dequeue();)a(t,e,r,n);for(;n=i.dequeue();)a(t,e,r,n);if(t.nodeCount())for(var u=e.length-2;u>0;--u)if(n=e[u].dequeue()){o=o.concat(a(t,e,r,n,!0));break}}return o}(r.graph,r.buckets,r.zeroIdx);return n.flatten(n.map(d,(function(e){return t.outEdges(e.v,e.w)})),!0)};var s=n.constant(1);function a(t,e,r,o,i){var s=i?[]:void 0;return n.forEach(t.inEdges(o.v),(function(n){var o=t.edge(n),a=t.node(n.v);i&&s.push({v:n.v,w:n.w}),a.out-=o,u(e,r,a)})),n.forEach(t.outEdges(o.v),(function(n){var o=t.edge(n),i=n.w,s=t.node(i);s.in-=o,u(e,r,s)})),t.removeNode(o.v),s}function u(t,e,r){r.out?r.in?t[r.out-r.in+e].enqueue(r):t[t.length-1].enqueue(r):t[0].enqueue(r)}},5499:(t,e,r)=>{"use strict";var n=r(2692),o=r(5205),i=r(4125),s=r(8264),a=r(345).normalizeRanks,u=r(2555),d=r(345).removeEmptyRanks,h=r(838),c=r(1555),l=r(4688),f=r(6571),g=r(9533),p=r(345),v=r(1943).Graph;t.exports=function(t,e){var r=e&&e.debugTiming?p.time:p.notime;r("layout",(function(){var e=r(" buildLayoutGraph",(function(){return function(t){var e=new v({multigraph:!0,compound:!0}),r=k(t.graph());return e.setGraph(n.merge({},m,M(r,y),n.pick(r,w))),n.forEach(t.nodes(),(function(r){var o=k(t.node(r));e.setNode(r,n.defaults(M(o,x),b)),e.setParent(r,t.parent(r))})),n.forEach(t.edges(),(function(r){var o=k(t.edge(r));e.setEdge(r,n.merge({},N,M(o,E),n.pick(o,_)))})),e}(t)}));r(" runLayout",(function(){!function(t,e){e(" makeSpaceForEdgeLabels",(function(){!function(t){var e=t.graph();e.ranksep/=2,n.forEach(t.edges(),(function(r){var n=t.edge(r);n.minlen*=2,"c"!==n.labelpos.toLowerCase()&&("TB"===e.rankdir||"BT"===e.rankdir?n.width+=n.labeloffset:n.height+=n.labeloffset)}))}(t)})),e(" removeSelfEdges",(function(){!function(t){n.forEach(t.edges(),(function(e){if(e.v===e.w){var r=t.node(e.v);r.selfEdges||(r.selfEdges=[]),r.selfEdges.push({e,label:t.edge(e)}),t.removeEdge(e)}}))}(t)})),e(" acyclic",(function(){o.run(t)})),e(" nestingGraph.run",(function(){h.run(t)})),e(" rank",(function(){s(p.asNonCompoundGraph(t))})),e(" injectEdgeLabelProxies",(function(){!function(t){n.forEach(t.edges(),(function(e){var r=t.edge(e);if(r.width&&r.height){var n=t.node(e.v),o={rank:(t.node(e.w).rank-n.rank)/2+n.rank,e};p.addDummyNode(t,"edge-proxy",o,"_ep")}}))}(t)})),e(" removeEmptyRanks",(function(){d(t)})),e(" nestingGraph.cleanup",(function(){h.cleanup(t)})),e(" normalizeRanks",(function(){a(t)})),e(" assignRankMinMax",(function(){!function(t){var e=0;n.forEach(t.nodes(),(function(r){var o=t.node(r);o.borderTop&&(o.minRank=t.node(o.borderTop).rank,o.maxRank=t.node(o.borderBottom).rank,e=n.max(e,o.maxRank))})),t.graph().maxRank=e}(t)})),e(" removeEdgeLabelProxies",(function(){!function(t){n.forEach(t.nodes(),(function(e){var r=t.node(e);"edge-proxy"===r.dummy&&(t.edge(r.e).labelRank=r.rank,t.removeNode(e))}))}(t)})),e(" normalize.run",(function(){i.run(t)})),e(" parentDummyChains",(function(){u(t)})),e(" addBorderSegments",(function(){c(t)})),e(" order",(function(){f(t)})),e(" insertSelfEdges",(function(){!function(t){var e=p.buildLayerMatrix(t);n.forEach(e,(function(e){var r=0;n.forEach(e,(function(e,o){var i=t.node(e);i.order=o+r,n.forEach(i.selfEdges,(function(e){p.addDummyNode(t,"selfedge",{width:e.label.width,height:e.label.height,rank:i.rank,order:o+ ++r,e:e.e,label:e.label},"_se")})),delete i.selfEdges}))}))}(t)})),e(" adjustCoordinateSystem",(function(){l.adjust(t)})),e(" position",(function(){g(t)})),e(" positionSelfEdges",(function(){!function(t){n.forEach(t.nodes(),(function(e){var r=t.node(e);if("selfedge"===r.dummy){var n=t.node(r.e.v),o=n.x+n.width/2,i=n.y,s=r.x-o,a=n.height/2;t.setEdge(r.e,r.label),t.removeNode(e),r.label.points=[{x:o+2*s/3,y:i-a},{x:o+5*s/6,y:i-a},{x:o+s,y:i},{x:o+5*s/6,y:i+a},{x:o+2*s/3,y:i+a}],r.label.x=r.x,r.label.y=r.y}}))}(t)})),e(" removeBorderNodes",(function(){!function(t){n.forEach(t.nodes(),(function(e){if(t.children(e).length){var r=t.node(e),o=t.node(r.borderTop),i=t.node(r.borderBottom),s=t.node(n.last(r.borderLeft)),a=t.node(n.last(r.borderRight));r.width=Math.abs(a.x-s.x),r.height=Math.abs(i.y-o.y),r.x=s.x+r.width/2,r.y=o.y+r.height/2}})),n.forEach(t.nodes(),(function(e){"border"===t.node(e).dummy&&t.removeNode(e)}))}(t)})),e(" normalize.undo",(function(){i.undo(t)})),e(" fixupEdgeLabelCoords",(function(){!function(t){n.forEach(t.edges(),(function(e){var r=t.edge(e);if(n.has(r,"x"))switch("l"!==r.labelpos&&"r"!==r.labelpos||(r.width-=r.labeloffset),r.labelpos){case"l":r.x-=r.width/2+r.labeloffset;break;case"r":r.x+=r.width/2+r.labeloffset}}))}(t)})),e(" undoCoordinateSystem",(function(){l.undo(t)})),e(" translateGraph",(function(){!function(t){var e=Number.POSITIVE_INFINITY,r=0,o=Number.POSITIVE_INFINITY,i=0,s=t.graph(),a=s.marginx||0,u=s.marginy||0;function d(t){var n=t.x,s=t.y,a=t.width,u=t.height;e=Math.min(e,n-a/2),r=Math.max(r,n+a/2),o=Math.min(o,s-u/2),i=Math.max(i,s+u/2)}n.forEach(t.nodes(),(function(e){d(t.node(e))})),n.forEach(t.edges(),(function(e){var r=t.edge(e);n.has(r,"x")&&d(r)})),e-=a,o-=u,n.forEach(t.nodes(),(function(r){var n=t.node(r);n.x-=e,n.y-=o})),n.forEach(t.edges(),(function(r){var i=t.edge(r);n.forEach(i.points,(function(t){t.x-=e,t.y-=o})),n.has(i,"x")&&(i.x-=e),n.has(i,"y")&&(i.y-=o)})),s.width=r-e+a,s.height=i-o+u}(t)})),e(" assignNodeIntersects",(function(){!function(t){n.forEach(t.edges(),(function(e){var r,n,o=t.edge(e),i=t.node(e.v),s=t.node(e.w);o.points?(r=o.points[0],n=o.points[o.points.length-1]):(o.points=[],r=s,n=i),o.points.unshift(p.intersectRect(i,r)),o.points.push(p.intersectRect(s,n))}))}(t)})),e(" reversePoints",(function(){!function(t){n.forEach(t.edges(),(function(e){var r=t.edge(e);r.reversed&&r.points.reverse()}))}(t)})),e(" acyclic.undo",(function(){o.undo(t)}))}(e,r)})),r(" updateInputGraph",(function(){!function(t,e){n.forEach(t.nodes(),(function(r){var n=t.node(r),o=e.node(r);n&&(n.x=o.x,n.y=o.y,e.children(r).length&&(n.width=o.width,n.height=o.height))})),n.forEach(t.edges(),(function(r){var o=t.edge(r),i=e.edge(r);o.points=i.points,n.has(i,"x")&&(o.x=i.x,o.y=i.y)})),t.graph().width=e.graph().width,t.graph().height=e.graph().height}(t,e)}))}))};var y=["nodesep","edgesep","ranksep","marginx","marginy"],m={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},w=["acyclicer","ranker","rankdir","align"],x=["width","height"],b={width:0,height:0},E=["minlen","weight","width","height","labeloffset"],N={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},_=["labelpos"];function M(t,e){return n.mapValues(n.pick(t,e),Number)}function k(t){var e={};return n.forEach(t,(function(t,r){e[r.toLowerCase()]=t})),e}},2692:(t,e,r)=>{var n;try{n={cloneDeep:r(7179),constant:r(9203),defaults:r(3821),each:r(678),filter:r(4663),find:r(6969),flatten:r(2923),forEach:r(7734),forIn:r(7514),has:r(5346),isUndefined:r(6474),last:r(7875),map:r(9107),mapValues:r(1230),max:r(6492),merge:r(8469),min:r(5071),minBy:r(6838),now:r(231),pick:r(9335),range:r(8569),reduce:r(7682),sortBy:r(1635),uniqueId:r(1422),values:r(1682),zipObject:r(4142)}}catch(t){}n||(n=window._),t.exports=n},838:(t,e,r)=>{var n=r(2692),o=r(345);function i(t,e,r,s,a,u,d){var h=t.children(d);if(h.length){var c=o.addBorderNode(t,"_bt"),l=o.addBorderNode(t,"_bb"),f=t.node(d);t.setParent(c,d),f.borderTop=c,t.setParent(l,d),f.borderBottom=l,n.forEach(h,(function(n){i(t,e,r,s,a,u,n);var o=t.node(n),h=o.borderTop?o.borderTop:n,f=o.borderBottom?o.borderBottom:n,g=o.borderTop?s:2*s,p=h!==f?1:a-u[d]+1;t.setEdge(c,h,{weight:g,minlen:p,nestingEdge:!0}),t.setEdge(f,l,{weight:g,minlen:p,nestingEdge:!0})})),t.parent(d)||t.setEdge(e,c,{weight:0,minlen:a+u[d]})}else d!==e&&t.setEdge(e,d,{weight:0,minlen:r})}t.exports={run:function(t){var e=o.addDummyNode(t,"root",{},"_root"),r=function(t){var e={};function r(o,i){var s=t.children(o);s&&s.length&&n.forEach(s,(function(t){r(t,i+1)})),e[o]=i}return n.forEach(t.children(),(function(t){r(t,1)})),e}(t),s=n.max(n.values(r))-1,a=2*s+1;t.graph().nestingRoot=e,n.forEach(t.edges(),(function(e){t.edge(e).minlen*=a}));var u=function(t){return n.reduce(t.edges(),(function(e,r){return e+t.edge(r).weight}),0)}(t)+1;n.forEach(t.children(),(function(n){i(t,e,a,u,s,r,n)})),t.graph().nodeRankFactor=a},cleanup:function(t){var e=t.graph();t.removeNode(e.nestingRoot),delete e.nestingRoot,n.forEach(t.edges(),(function(e){t.edge(e).nestingEdge&&t.removeEdge(e)}))}}},4125:(t,e,r)=>{"use strict";var n=r(2692),o=r(345);t.exports={run:function(t){t.graph().dummyChains=[],n.forEach(t.edges(),(function(e){!function(t,e){var r,n,i,s=e.v,a=t.node(s).rank,u=e.w,d=t.node(u).rank,h=e.name,c=t.edge(e),l=c.labelRank;if(d!==a+1){for(t.removeEdge(e),i=0,++a;a<d;++i,++a)c.points=[],n={width:0,height:0,edgeLabel:c,edgeObj:e,rank:a},r=o.addDummyNode(t,"edge",n,"_d"),a===l&&(n.width=c.width,n.height=c.height,n.dummy="edge-label",n.labelpos=c.labelpos),t.setEdge(s,r,{weight:c.weight},h),0===i&&t.graph().dummyChains.push(r),s=r;t.setEdge(s,u,{weight:c.weight},h)}}(t,e)}))},undo:function(t){n.forEach(t.graph().dummyChains,(function(e){var r,n=t.node(e),o=n.edgeLabel;for(t.setEdge(n.edgeObj,o);n.dummy;)r=t.successors(e)[0],t.removeNode(e),o.points.push({x:n.x,y:n.y}),"edge-label"===n.dummy&&(o.x=n.x,o.y=n.y,o.width=n.width,o.height=n.height),e=r,n=t.node(e)}))}}},4333:(t,e,r)=>{var n=r(2692);t.exports=function(t,e,r){var o,i={};n.forEach(r,(function(r){for(var n,s,a=t.parent(r);a;){if((n=t.parent(a))?(s=i[n],i[n]=a):(s=o,o=a),s&&s!==a)return void e.setEdge(s,a);a=n}}))}},5374:(t,e,r)=>{var n=r(2692);t.exports=function(t,e){return n.map(e,(function(e){var r=t.inEdges(e);if(r.length){var o=n.reduce(r,(function(e,r){var n=t.edge(r),o=t.node(r.v);return{sum:e.sum+n.weight*o.order,weight:e.weight+n.weight}}),{sum:0,weight:0});return{v:e,barycenter:o.sum/o.weight,weight:o.weight}}return{v:e}}))}},3037:(t,e,r)=>{var n=r(2692),o=r(1943).Graph;t.exports=function(t,e,r){var i=function(t){for(var e;t.hasNode(e=n.uniqueId("_root")););return e}(t),s=new o({compound:!0}).setGraph({root:i}).setDefaultNodeLabel((function(e){return t.node(e)}));return n.forEach(t.nodes(),(function(o){var a=t.node(o),u=t.parent(o);(a.rank===e||a.minRank<=e&&e<=a.maxRank)&&(s.setNode(o),s.setParent(o,u||i),n.forEach(t[r](o),(function(e){var r=e.v===o?e.w:e.v,i=s.edge(r,o),a=n.isUndefined(i)?0:i.weight;s.setEdge(r,o,{weight:t.edge(e).weight+a})})),n.has(a,"minRank")&&s.setNode(o,{borderLeft:a.borderLeft[e],borderRight:a.borderRight[e]}))})),s}},9420:(t,e,r)=>{"use strict";var n=r(2692);function o(t,e,r){for(var o=n.zipObject(r,n.map(r,(function(t,e){return e}))),i=n.flatten(n.map(e,(function(e){return n.sortBy(n.map(t.outEdges(e),(function(e){return{pos:o[e.w],weight:t.edge(e).weight}})),"pos")})),!0),s=1;s<r.length;)s<<=1;var a=2*s-1;s-=1;var u=n.map(new Array(a),(function(){return 0})),d=0;return n.forEach(i.forEach((function(t){var e=t.pos+s;u[e]+=t.weight;for(var r=0;e>0;)e%2&&(r+=u[e+1]),u[e=e-1>>1]+=t.weight;d+=t.weight*r}))),d}t.exports=function(t,e){for(var r=0,n=1;n<e.length;++n)r+=o(t,e[n-1],e[n]);return r}},6571:(t,e,r)=>{"use strict";var n=r(2692),o=r(1001),i=r(9420),s=r(7407),a=r(3037),u=r(4333),d=r(1943).Graph,h=r(345);function c(t,e,r){return n.map(e,(function(e){return a(t,e,r)}))}function l(t,e){var r=new d;n.forEach(t,(function(t){var o=t.graph().root,i=s(t,o,r,e);n.forEach(i.vs,(function(e,r){t.node(e).order=r})),u(t,r,i.vs)}))}function f(t,e){n.forEach(e,(function(e){n.forEach(e,(function(e,r){t.node(e).order=r}))}))}t.exports=function(t){var e=h.maxRank(t),r=c(t,n.range(1,e+1),"inEdges"),s=c(t,n.range(e-1,-1,-1),"outEdges"),a=o(t);f(t,a);for(var u,d=Number.POSITIVE_INFINITY,g=0,p=0;p<4;++g,++p){l(g%2?r:s,g%4>=2),a=h.buildLayerMatrix(t);var v=i(t,a);v<d&&(p=0,u=n.cloneDeep(a),d=v)}f(t,u)}},1001:(t,e,r)=>{"use strict";var n=r(2692);t.exports=function(t){var e={},r=n.filter(t.nodes(),(function(e){return!t.children(e).length})),o=n.max(n.map(r,(function(e){return t.node(e).rank}))),i=n.map(n.range(o+1),(function(){return[]})),s=n.sortBy(r,(function(e){return t.node(e).rank}));return n.forEach(s,(function r(o){if(!n.has(e,o)){e[o]=!0;var s=t.node(o);i[s.rank].push(o),n.forEach(t.successors(o),r)}})),i}},8522:(t,e,r)=>{"use strict";var n=r(2692);t.exports=function(t,e){var r={};return n.forEach(t,(function(t,e){var o=r[t.v]={indegree:0,in:[],out:[],vs:[t.v],i:e};n.isUndefined(t.barycenter)||(o.barycenter=t.barycenter,o.weight=t.weight)})),n.forEach(e.edges(),(function(t){var e=r[t.v],o=r[t.w];n.isUndefined(e)||n.isUndefined(o)||(o.indegree++,e.out.push(r[t.w]))})),function(t){var e=[];function r(t){return function(e){var r,o,i,s;e.merged||(n.isUndefined(e.barycenter)||n.isUndefined(t.barycenter)||e.barycenter>=t.barycenter)&&(o=e,i=0,s=0,(r=t).weight&&(i+=r.barycenter*r.weight,s+=r.weight),o.weight&&(i+=o.barycenter*o.weight,s+=o.weight),r.vs=o.vs.concat(r.vs),r.barycenter=i/s,r.weight=s,r.i=Math.min(o.i,r.i),o.merged=!0)}}function o(e){return function(r){r.in.push(e),0==--r.indegree&&t.push(r)}}for(;t.length;){var i=t.pop();e.push(i),n.forEach(i.in.reverse(),r(i)),n.forEach(i.out,o(i))}return n.map(n.filter(e,(function(t){return!t.merged})),(function(t){return n.pick(t,["vs","i","barycenter","weight"])}))}(n.filter(r,(function(t){return!t.indegree})))}},7407:(t,e,r)=>{var n=r(2692),o=r(5374),i=r(8522),s=r(2711);t.exports=function t(e,r,a,u){var d=e.children(r),h=e.node(r),c=h?h.borderLeft:void 0,l=h?h.borderRight:void 0,f={};c&&(d=n.filter(d,(function(t){return t!==c&&t!==l})));var g=o(e,d);n.forEach(g,(function(r){if(e.children(r.v).length){var o=t(e,r.v,a,u);f[r.v]=o,n.has(o,"barycenter")&&(i=r,s=o,n.isUndefined(i.barycenter)?(i.barycenter=s.barycenter,i.weight=s.weight):(i.barycenter=(i.barycenter*i.weight+s.barycenter*s.weight)/(i.weight+s.weight),i.weight+=s.weight))}var i,s}));var p=i(g,a);!function(t,e){n.forEach(t,(function(t){t.vs=n.flatten(t.vs.map((function(t){return e[t]?e[t].vs:t})),!0)}))}(p,f);var v=s(p,u);if(c&&(v.vs=n.flatten([c,v.vs,l],!0),e.predecessors(c).length)){var y=e.node(e.predecessors(c)[0]),m=e.node(e.predecessors(l)[0]);n.has(v,"barycenter")||(v.barycenter=0,v.weight=0),v.barycenter=(v.barycenter*v.weight+y.order+m.order)/(v.weight+2),v.weight+=2}return v}},2711:(t,e,r)=>{var n=r(2692),o=r(345);function i(t,e,r){for(var o;e.length&&(o=n.last(e)).i<=r;)e.pop(),t.push(o.vs),r++;return r}t.exports=function(t,e){var r,s=o.partition(t,(function(t){return n.has(t,"barycenter")})),a=s.lhs,u=n.sortBy(s.rhs,(function(t){return-t.i})),d=[],h=0,c=0,l=0;a.sort((r=!!e,function(t,e){return t.barycenter<e.barycenter?-1:t.barycenter>e.barycenter?1:r?e.i-t.i:t.i-e.i})),l=i(d,u,l),n.forEach(a,(function(t){l+=t.vs.length,d.push(t.vs),h+=t.barycenter*t.weight,c+=t.weight,l=i(d,u,l)}));var f={vs:n.flatten(d,!0)};return c&&(f.barycenter=h/c,f.weight=c),f}},2555:(t,e,r)=>{var n=r(2692);t.exports=function(t){var e=function(t){var e={},r=0;return n.forEach(t.children(),(function o(i){var s=r;n.forEach(t.children(i),o),e[i]={low:s,lim:r++}})),e}(t);n.forEach(t.graph().dummyChains,(function(r){for(var n=t.node(r),o=n.edgeObj,i=function(t,e,r,n){var o,i,s=[],a=[],u=Math.min(e[r].low,e[n].low),d=Math.max(e[r].lim,e[n].lim);o=r;do{o=t.parent(o),s.push(o)}while(o&&(e[o].low>u||d>e[o].lim));for(i=o,o=n;(o=t.parent(o))!==i;)a.push(o);return{path:s.concat(a.reverse()),lca:i}}(t,e,o.v,o.w),s=i.path,a=i.lca,u=0,d=s[u],h=!0;r!==o.w;){if(n=t.node(r),h){for(;(d=s[u])!==a&&t.node(d).maxRank<n.rank;)u++;d===a&&(h=!1)}if(!h){for(;u<s.length-1&&t.node(d=s[u+1]).minRank<=n.rank;)u++;d=s[u]}t.setParent(r,d),r=t.successors(r)[0]}}))}},7828:(t,e,r)=>{"use strict";var n=r(2692),o=r(1943).Graph,i=r(345);function s(t,e){var r={};return n.reduce(e,(function(e,o){var i=0,s=0,a=e.length,d=n.last(o);return n.forEach(o,(function(e,h){var c=function(t,e){if(t.node(e).dummy)return n.find(t.predecessors(e),(function(e){return t.node(e).dummy}))}(t,e),l=c?t.node(c).order:a;(c||e===d)&&(n.forEach(o.slice(s,h+1),(function(e){n.forEach(t.predecessors(e),(function(n){var o=t.node(n),s=o.order;!(s<i||l<s)||o.dummy&&t.node(e).dummy||u(r,n,e)}))})),s=h+1,i=l)})),o})),r}function a(t,e){var r={};function o(e,o,i,s,a){var d;n.forEach(n.range(o,i),(function(o){d=e[o],t.node(d).dummy&&n.forEach(t.predecessors(d),(function(e){var n=t.node(e);n.dummy&&(n.order<s||n.order>a)&&u(r,e,d)}))}))}return n.reduce(e,(function(e,r){var i,s=-1,a=0;return n.forEach(r,(function(n,u){if("border"===t.node(n).dummy){var d=t.predecessors(n);d.length&&(i=t.node(d[0]).order,o(r,a,u,s,i),a=u,s=i)}o(r,a,r.length,i,e.length)})),r})),r}function u(t,e,r){if(e>r){var n=e;e=r,r=n}var o=t[e];o||(t[e]=o={}),o[r]=!0}function d(t,e,r){if(e>r){var o=e;e=r,r=o}return n.has(t[e],r)}function h(t,e,r,o){var i={},s={},a={};return n.forEach(e,(function(t){n.forEach(t,(function(t,e){i[t]=t,s[t]=t,a[t]=e}))})),n.forEach(e,(function(t){var e=-1;n.forEach(t,(function(t){var u=o(t);if(u.length){u=n.sortBy(u,(function(t){return a[t]}));for(var h=(u.length-1)/2,c=Math.floor(h),l=Math.ceil(h);c<=l;++c){var f=u[c];s[t]===t&&e<a[f]&&!d(r,t,f)&&(s[f]=t,s[t]=i[t]=i[f],e=a[f])}}}))})),{root:i,align:s}}function c(t,e,r,i,s){var a={},u=function(t,e,r,i){var s=new o,a=t.graph(),u=function(t,e,r){return function(o,i,s){var a,u=o.node(i),d=o.node(s),h=0;if(h+=u.width/2,n.has(u,"labelpos"))switch(u.labelpos.toLowerCase()){case"l":a=-u.width/2;break;case"r":a=u.width/2}if(a&&(h+=r?a:-a),a=0,h+=(u.dummy?e:t)/2,h+=(d.dummy?e:t)/2,h+=d.width/2,n.has(d,"labelpos"))switch(d.labelpos.toLowerCase()){case"l":a=d.width/2;break;case"r":a=-d.width/2}return a&&(h+=r?a:-a),a=0,h}}(a.nodesep,a.edgesep,i);return n.forEach(e,(function(e){var o;n.forEach(e,(function(e){var n=r[e];if(s.setNode(n),o){var i=r[o],a=s.edge(i,n);s.setEdge(i,n,Math.max(u(t,e,o),a||0))}o=e}))})),s}(t,e,r,s),d=s?"borderLeft":"borderRight";function h(t,e){for(var r=u.nodes(),n=r.pop(),o={};n;)o[n]?t(n):(o[n]=!0,r.push(n),r=r.concat(e(n))),n=r.pop()}return h((function(t){a[t]=u.inEdges(t).reduce((function(t,e){return Math.max(t,a[e.v]+u.edge(e))}),0)}),u.predecessors.bind(u)),h((function(e){var r=u.outEdges(e).reduce((function(t,e){return Math.min(t,a[e.w]-u.edge(e))}),Number.POSITIVE_INFINITY),n=t.node(e);r!==Number.POSITIVE_INFINITY&&n.borderType!==d&&(a[e]=Math.max(a[e],r))}),u.successors.bind(u)),n.forEach(i,(function(t){a[t]=a[r[t]]})),a}function l(t,e){return n.minBy(n.values(e),(function(e){var r=Number.NEGATIVE_INFINITY,o=Number.POSITIVE_INFINITY;return n.forIn(e,(function(e,n){var i=function(t,e){return t.node(e).width}(t,n)/2;r=Math.max(e+i,r),o=Math.min(e-i,o)})),r-o}))}function f(t,e){var r=n.values(e),o=n.min(r),i=n.max(r);n.forEach(["u","d"],(function(r){n.forEach(["l","r"],(function(s){var a,u=r+s,d=t[u];if(d!==e){var h=n.values(d);(a="l"===s?o-n.min(h):i-n.max(h))&&(t[u]=n.mapValues(d,(function(t){return t+a})))}}))}))}function g(t,e){return n.mapValues(t.ul,(function(r,o){if(e)return t[e.toLowerCase()][o];var i=n.sortBy(n.map(t,o));return(i[1]+i[2])/2}))}t.exports={positionX:function(t){var e,r=i.buildLayerMatrix(t),o=n.merge(s(t,r),a(t,r)),u={};n.forEach(["u","d"],(function(i){e="u"===i?r:n.values(r).reverse(),n.forEach(["l","r"],(function(r){"r"===r&&(e=n.map(e,(function(t){return n.values(t).reverse()})));var s=("u"===i?t.predecessors:t.successors).bind(t),a=h(0,e,o,s),d=c(t,e,a.root,a.align,"r"===r);"r"===r&&(d=n.mapValues(d,(function(t){return-t}))),u[i+r]=d}))}));var d=l(t,u);return f(u,d),g(u,t.graph().align)},findType1Conflicts:s,findType2Conflicts:a,addConflict:u,hasConflict:d,verticalAlignment:h,horizontalCompaction:c,alignCoordinates:f,findSmallestWidthAlignment:l,balance:g}},9533:(t,e,r)=>{"use strict";var n=r(2692),o=r(345),i=r(7828).positionX;t.exports=function(t){(function(t){var e=o.buildLayerMatrix(t),r=t.graph().ranksep,i=0;n.forEach(e,(function(e){var o=n.max(n.map(e,(function(e){return t.node(e).height})));n.forEach(e,(function(e){t.node(e).y=i+o/2})),i+=o+r}))})(t=o.asNonCompoundGraph(t)),n.forEach(i(t),(function(e,r){t.node(r).x=e}))}},6771:(t,e,r)=>{"use strict";var n=r(2692),o=r(1943).Graph,i=r(3834).slack;function s(t,e){return n.forEach(t.nodes(),(function r(o){n.forEach(e.nodeEdges(o),(function(n){var s=n.v,a=o===s?n.w:s;t.hasNode(a)||i(e,n)||(t.setNode(a,{}),t.setEdge(o,a,{}),r(a))}))})),t.nodeCount()}function a(t,e){return n.minBy(e.edges(),(function(r){if(t.hasNode(r.v)!==t.hasNode(r.w))return i(e,r)}))}function u(t,e,r){n.forEach(t.nodes(),(function(t){e.node(t).rank+=r}))}t.exports=function(t){var e,r,n=new o({directed:!1}),d=t.nodes()[0],h=t.nodeCount();for(n.setNode(d,{});s(n,t)<h;)e=a(n,t),r=n.hasNode(e.v)?i(t,e):-i(t,e),u(n,t,r);return n}},8264:(t,e,r)=>{"use strict";var n=r(3834).longestPath,o=r(6771),i=r(3284);t.exports=function(t){switch(t.graph().ranker){case"network-simplex":default:!function(t){i(t)}(t);break;case"tight-tree":!function(t){n(t),o(t)}(t);break;case"longest-path":s(t)}};var s=n},3284:(t,e,r)=>{"use strict";var n=r(2692),o=r(6771),i=r(3834).slack,s=r(3834).longestPath,a=r(1943).alg.preorder,u=r(1943).alg.postorder,d=r(345).simplify;function h(t){t=d(t),s(t);var e,r=o(t);for(f(r),c(r,t);e=p(r);)y(r,t,e,v(r,t,e))}function c(t,e){var r=u(t,t.nodes());r=r.slice(0,r.length-1),n.forEach(r,(function(r){!function(t,e,r){var n=t.node(r).parent;t.edge(r,n).cutvalue=l(t,e,r)}(t,e,r)}))}function l(t,e,r){var o=t.node(r).parent,i=!0,s=e.edge(r,o),a=0;return s||(i=!1,s=e.edge(o,r)),a=s.weight,n.forEach(e.nodeEdges(r),(function(n){var s,u,d=n.v===r,h=d?n.w:n.v;if(h!==o){var c=d===i,l=e.edge(n).weight;if(a+=c?l:-l,s=r,u=h,t.hasEdge(s,u)){var f=t.edge(r,h).cutvalue;a+=c?-f:f}}})),a}function f(t,e){arguments.length<2&&(e=t.nodes()[0]),g(t,{},1,e)}function g(t,e,r,o,i){var s=r,a=t.node(o);return e[o]=!0,n.forEach(t.neighbors(o),(function(i){n.has(e,i)||(r=g(t,e,r,i,o))})),a.low=s,a.lim=r++,i?a.parent=i:delete a.parent,r}function p(t){return n.find(t.edges(),(function(e){return t.edge(e).cutvalue<0}))}function v(t,e,r){var o=r.v,s=r.w;e.hasEdge(o,s)||(o=r.w,s=r.v);var a=t.node(o),u=t.node(s),d=a,h=!1;a.lim>u.lim&&(d=u,h=!0);var c=n.filter(e.edges(),(function(e){return h===m(0,t.node(e.v),d)&&h!==m(0,t.node(e.w),d)}));return n.minBy(c,(function(t){return i(e,t)}))}function y(t,e,r,o){var i=r.v,s=r.w;t.removeEdge(i,s),t.setEdge(o.v,o.w,{}),f(t),c(t,e),function(t,e){var r=n.find(t.nodes(),(function(t){return!e.node(t).parent})),o=a(t,r);o=o.slice(1),n.forEach(o,(function(r){var n=t.node(r).parent,o=e.edge(r,n),i=!1;o||(o=e.edge(n,r),i=!0),e.node(r).rank=e.node(n).rank+(i?o.minlen:-o.minlen)}))}(t,e)}function m(t,e,r){return r.low<=e.lim&&e.lim<=r.lim}t.exports=h,h.initLowLimValues=f,h.initCutValues=c,h.calcCutValue=l,h.leaveEdge=p,h.enterEdge=v,h.exchangeEdges=y},3834:(t,e,r)=>{"use strict";var n=r(2692);t.exports={longestPath:function(t){var e={};n.forEach(t.sources(),(function r(o){var i=t.node(o);if(n.has(e,o))return i.rank;e[o]=!0;var s=n.min(n.map(t.outEdges(o),(function(e){return r(e.w)-t.edge(e).minlen})));return s!==Number.POSITIVE_INFINITY&&null!=s||(s=0),i.rank=s}))},slack:function(t,e){return t.node(e.w).rank-t.node(e.v).rank-t.edge(e).minlen}}},345:(t,e,r)=>{"use strict";var n=r(2692),o=r(1943).Graph;function i(t,e,r,o){var i;do{i=n.uniqueId(o)}while(t.hasNode(i));return r.dummy=e,t.setNode(i,r),i}function s(t){return n.max(n.map(t.nodes(),(function(e){var r=t.node(e).rank;if(!n.isUndefined(r))return r})))}t.exports={addDummyNode:i,simplify:function(t){var e=(new o).setGraph(t.graph());return n.forEach(t.nodes(),(function(r){e.setNode(r,t.node(r))})),n.forEach(t.edges(),(function(r){var n=e.edge(r.v,r.w)||{weight:0,minlen:1},o=t.edge(r);e.setEdge(r.v,r.w,{weight:n.weight+o.weight,minlen:Math.max(n.minlen,o.minlen)})})),e},asNonCompoundGraph:function(t){var e=new o({multigraph:t.isMultigraph()}).setGraph(t.graph());return n.forEach(t.nodes(),(function(r){t.children(r).length||e.setNode(r,t.node(r))})),n.forEach(t.edges(),(function(r){e.setEdge(r,t.edge(r))})),e},successorWeights:function(t){var e=n.map(t.nodes(),(function(e){var r={};return n.forEach(t.outEdges(e),(function(e){r[e.w]=(r[e.w]||0)+t.edge(e).weight})),r}));return n.zipObject(t.nodes(),e)},predecessorWeights:function(t){var e=n.map(t.nodes(),(function(e){var r={};return n.forEach(t.inEdges(e),(function(e){r[e.v]=(r[e.v]||0)+t.edge(e).weight})),r}));return n.zipObject(t.nodes(),e)},intersectRect:function(t,e){var r,n,o=t.x,i=t.y,s=e.x-o,a=e.y-i,u=t.width/2,d=t.height/2;if(!s&&!a)throw new Error("Not possible to find intersection inside of the rectangle");return Math.abs(a)*u>Math.abs(s)*d?(a<0&&(d=-d),r=d*s/a,n=d):(s<0&&(u=-u),r=u,n=u*a/s),{x:o+r,y:i+n}},buildLayerMatrix:function(t){var e=n.map(n.range(s(t)+1),(function(){return[]}));return n.forEach(t.nodes(),(function(r){var o=t.node(r),i=o.rank;n.isUndefined(i)||(e[i][o.order]=r)})),e},normalizeRanks:function(t){var e=n.min(n.map(t.nodes(),(function(e){return t.node(e).rank})));n.forEach(t.nodes(),(function(r){var o=t.node(r);n.has(o,"rank")&&(o.rank-=e)}))},removeEmptyRanks:function(t){var e=n.min(n.map(t.nodes(),(function(e){return t.node(e).rank}))),r=[];n.forEach(t.nodes(),(function(n){var o=t.node(n).rank-e;r[o]||(r[o]=[]),r[o].push(n)}));var o=0,i=t.graph().nodeRankFactor;n.forEach(r,(function(e,r){n.isUndefined(e)&&r%i!=0?--o:o&&n.forEach(e,(function(e){t.node(e).rank+=o}))}))},addBorderNode:function(t,e,r,n){var o={width:0,height:0};return arguments.length>=4&&(o.rank=r,o.order=n),i(t,"border",o,e)},maxRank:s,partition:function(t,e){var r={lhs:[],rhs:[]};return n.forEach(t,(function(t){e(t)?r.lhs.push(t):r.rhs.push(t)})),r},time:function(t,e){var r=n.now();try{return e()}finally{console.log(t+" time: "+(n.now()-r)+"ms")}},notime:function(t,e){return e()}}},3404:t=>{t.exports="0.8.5"},6960:(t,e,r)=>{var n=r(3150);t.exports={Graph:n.Graph,json:r(1430),alg:r(9757),version:n.version}},9535:(t,e,r)=>{var n=r(4434);t.exports=function(t){var e,r={},o=[];function i(o){n.has(r,o)||(r[o]=!0,e.push(o),n.each(t.successors(o),i),n.each(t.predecessors(o),i))}return n.each(t.nodes(),(function(t){e=[],i(t),e.length&&o.push(e)})),o}},7819:(t,e,r)=>{var n=r(4434);function o(t,e,r,i,s,a){n.has(i,e)||(i[e]=!0,r||a.push(e),n.each(s(e),(function(e){o(t,e,r,i,s,a)})),r&&a.push(e))}t.exports=function(t,e,r){n.isArray(e)||(e=[e]);var i=(t.isDirected()?t.successors:t.neighbors).bind(t),s=[],a={};return n.each(e,(function(e){if(!t.hasNode(e))throw new Error("Graph does not have node: "+e);o(t,e,"post"===r,a,i,s)})),s}},1353:(t,e,r)=>{var n=r(4245),o=r(4434);t.exports=function(t,e,r){return o.transform(t.nodes(),(function(o,i){o[i]=n(t,i,e,r)}),{})}},4245:(t,e,r)=>{var n=r(4434),o=r(1011);t.exports=function(t,e,r,n){return function(t,e,r,n){var i,s,a={},u=new o,d=function(t){var e=t.v!==i?t.v:t.w,n=a[e],o=r(t),d=s.distance+o;if(o<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+t+" Weight: "+o);d<n.distance&&(n.distance=d,n.predecessor=i,u.decrease(e,d))};for(t.nodes().forEach((function(t){var r=t===e?0:Number.POSITIVE_INFINITY;a[t]={distance:r},u.add(t,r)}));u.size()>0&&(i=u.removeMin(),(s=a[i]).distance!==Number.POSITIVE_INFINITY);)n(i).forEach(d);return a}(t,String(e),r||i,n||function(e){return t.outEdges(e)})};var i=n.constant(1)},937:(t,e,r)=>{var n=r(4434),o=r(9177);t.exports=function(t){return n.filter(o(t),(function(e){return e.length>1||1===e.length&&t.hasEdge(e[0],e[0])}))}},86:(t,e,r)=>{var n=r(4434);t.exports=function(t,e,r){return function(t,e,r){var n={},o=t.nodes();return o.forEach((function(t){n[t]={},n[t][t]={distance:0},o.forEach((function(e){t!==e&&(n[t][e]={distance:Number.POSITIVE_INFINITY})})),r(t).forEach((function(r){var o=r.v===t?r.w:r.v,i=e(r);n[t][o]={distance:i,predecessor:t}}))})),o.forEach((function(t){var e=n[t];o.forEach((function(r){var i=n[r];o.forEach((function(r){var n=i[t],o=e[r],s=i[r],a=n.distance+o.distance;a<s.distance&&(s.distance=a,s.predecessor=o.predecessor)}))}))})),n}(t,e||o,r||function(e){return t.outEdges(e)})};var o=n.constant(1)},9757:(t,e,r)=>{t.exports={components:r(9535),dijkstra:r(4245),dijkstraAll:r(1353),findCycles:r(937),floydWarshall:r(86),isAcyclic:r(7772),postorder:r(8494),preorder:r(101),prim:r(3816),tarjan:r(9177),topsort:r(750)}},7772:(t,e,r)=>{var n=r(750);t.exports=function(t){try{n(t)}catch(t){if(t instanceof n.CycleException)return!1;throw t}return!0}},8494:(t,e,r)=>{var n=r(7819);t.exports=function(t,e){return n(t,e,"post")}},101:(t,e,r)=>{var n=r(7819);t.exports=function(t,e){return n(t,e,"pre")}},3816:(t,e,r)=>{var n=r(4434),o=r(9955),i=r(1011);t.exports=function(t,e){var r,s=new o,a={},u=new i;function d(t){var n=t.v===r?t.w:t.v,o=u.priority(n);if(void 0!==o){var i=e(t);i<o&&(a[n]=r,u.decrease(n,i))}}if(0===t.nodeCount())return s;n.each(t.nodes(),(function(t){u.add(t,Number.POSITIVE_INFINITY),s.setNode(t)})),u.decrease(t.nodes()[0],0);for(var h=!1;u.size()>0;){if(r=u.removeMin(),n.has(a,r))s.setEdge(r,a[r]);else{if(h)throw new Error("Input graph is not connected: "+t);h=!0}t.nodeEdges(r).forEach(d)}return s}},9177:(t,e,r)=>{var n=r(4434);t.exports=function(t){var e=0,r=[],o={},i=[];function s(a){var u=o[a]={onStack:!0,lowlink:e,index:e++};if(r.push(a),t.successors(a).forEach((function(t){n.has(o,t)?o[t].onStack&&(u.lowlink=Math.min(u.lowlink,o[t].index)):(s(t),u.lowlink=Math.min(u.lowlink,o[t].lowlink))})),u.lowlink===u.index){var d,h=[];do{d=r.pop(),o[d].onStack=!1,h.push(d)}while(a!==d);i.push(h)}}return t.nodes().forEach((function(t){n.has(o,t)||s(t)})),i}},750:(t,e,r)=>{var n=r(4434);function o(t){var e={},r={},o=[];if(n.each(t.sinks(),(function s(a){if(n.has(r,a))throw new i;n.has(e,a)||(r[a]=!0,e[a]=!0,n.each(t.predecessors(a),s),delete r[a],o.push(a))})),n.size(e)!==t.nodeCount())throw new i;return o}function i(){}t.exports=o,o.CycleException=i,i.prototype=new Error},1011:(t,e,r)=>{var n=r(4434);function o(){this._arr=[],this._keyIndices={}}t.exports=o,o.prototype.size=function(){return this._arr.length},o.prototype.keys=function(){return this._arr.map((function(t){return t.key}))},o.prototype.has=function(t){return n.has(this._keyIndices,t)},o.prototype.priority=function(t){var e=this._keyIndices[t];if(void 0!==e)return this._arr[e].priority},o.prototype.min=function(){if(0===this.size())throw new Error("Queue underflow");return this._arr[0].key},o.prototype.add=function(t,e){var r=this._keyIndices;if(t=String(t),!n.has(r,t)){var o=this._arr,i=o.length;return r[t]=i,o.push({key:t,priority:e}),this._decrease(i),!0}return!1},o.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var t=this._arr.pop();return delete this._keyIndices[t.key],this._heapify(0),t.key},o.prototype.decrease=function(t,e){var r=this._keyIndices[t];if(e>this._arr[r].priority)throw new Error("New priority is greater than current priority. Key: "+t+" Old: "+this._arr[r].priority+" New: "+e);this._arr[r].priority=e,this._decrease(r)},o.prototype._heapify=function(t){var e=this._arr,r=2*t,n=r+1,o=t;r<e.length&&(o=e[r].priority<e[o].priority?r:o,n<e.length&&(o=e[n].priority<e[o].priority?n:o),o!==t&&(this._swap(t,o),this._heapify(o)))},o.prototype._decrease=function(t){for(var e,r=this._arr,n=r[t].priority;0!==t&&!(r[e=t>>1].priority<n);)this._swap(t,e),t=e},o.prototype._swap=function(t,e){var r=this._arr,n=this._keyIndices,o=r[t],i=r[e];r[t]=i,r[e]=o,n[i.key]=t,n[o.key]=e}},9955:(t,e,r)=>{"use strict";var n=r(4434);t.exports=i;var o="\\0";function i(t){this._isDirected=!n.has(t,"directed")||t.directed,this._isMultigraph=!!n.has(t,"multigraph")&&t.multigraph,this._isCompound=!!n.has(t,"compound")&&t.compound,this._label=void 0,this._defaultNodeLabelFn=n.constant(void 0),this._defaultEdgeLabelFn=n.constant(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[o]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}function s(t,e){t[e]?t[e]++:t[e]=1}function a(t,e){--t[e]||delete t[e]}function u(t,e,r,o){var i=""+e,s=""+r;if(!t&&i>s){var a=i;i=s,s=a}return i+""+s+""+(n.isUndefined(o)?"\\0":o)}function d(t,e){return u(t,e.v,e.w,e.name)}i.prototype._nodeCount=0,i.prototype._edgeCount=0,i.prototype.isDirected=function(){return this._isDirected},i.prototype.isMultigraph=function(){return this._isMultigraph},i.prototype.isCompound=function(){return this._isCompound},i.prototype.setGraph=function(t){return this._label=t,this},i.prototype.graph=function(){return this._label},i.prototype.setDefaultNodeLabel=function(t){return n.isFunction(t)||(t=n.constant(t)),this._defaultNodeLabelFn=t,this},i.prototype.nodeCount=function(){return this._nodeCount},i.prototype.nodes=function(){return n.keys(this._nodes)},i.prototype.sources=function(){var t=this;return n.filter(this.nodes(),(function(e){return n.isEmpty(t._in[e])}))},i.prototype.sinks=function(){var t=this;return n.filter(this.nodes(),(function(e){return n.isEmpty(t._out[e])}))},i.prototype.setNodes=function(t,e){var r=arguments,o=this;return n.each(t,(function(t){r.length>1?o.setNode(t,e):o.setNode(t)})),this},i.prototype.setNode=function(t,e){return n.has(this._nodes,t)?(arguments.length>1&&(this._nodes[t]=e),this):(this._nodes[t]=arguments.length>1?e:this._defaultNodeLabelFn(t),this._isCompound&&(this._parent[t]=o,this._children[t]={},this._children[o][t]=!0),this._in[t]={},this._preds[t]={},this._out[t]={},this._sucs[t]={},++this._nodeCount,this)},i.prototype.node=function(t){return this._nodes[t]},i.prototype.hasNode=function(t){return n.has(this._nodes,t)},i.prototype.removeNode=function(t){var e=this;if(n.has(this._nodes,t)){var r=function(t){e.removeEdge(e._edgeObjs[t])};delete this._nodes[t],this._isCompound&&(this._removeFromParentsChildList(t),delete this._parent[t],n.each(this.children(t),(function(t){e.setParent(t)})),delete this._children[t]),n.each(n.keys(this._in[t]),r),delete this._in[t],delete this._preds[t],n.each(n.keys(this._out[t]),r),delete this._out[t],delete this._sucs[t],--this._nodeCount}return this},i.prototype.setParent=function(t,e){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(n.isUndefined(e))e=o;else{for(var r=e+="";!n.isUndefined(r);r=this.parent(r))if(r===t)throw new Error("Setting "+e+" as parent of "+t+" would create a cycle");this.setNode(e)}return this.setNode(t),this._removeFromParentsChildList(t),this._parent[t]=e,this._children[e][t]=!0,this},i.prototype._removeFromParentsChildList=function(t){delete this._children[this._parent[t]][t]},i.prototype.parent=function(t){if(this._isCompound){var e=this._parent[t];if(e!==o)return e}},i.prototype.children=function(t){if(n.isUndefined(t)&&(t=o),this._isCompound){var e=this._children[t];if(e)return n.keys(e)}else{if(t===o)return this.nodes();if(this.hasNode(t))return[]}},i.prototype.predecessors=function(t){var e=this._preds[t];if(e)return n.keys(e)},i.prototype.successors=function(t){var e=this._sucs[t];if(e)return n.keys(e)},i.prototype.neighbors=function(t){var e=this.predecessors(t);if(e)return n.union(e,this.successors(t))},i.prototype.isLeaf=function(t){return 0===(this.isDirected()?this.successors(t):this.neighbors(t)).length},i.prototype.filterNodes=function(t){var e=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});e.setGraph(this.graph());var r=this;n.each(this._nodes,(function(r,n){t(n)&&e.setNode(n,r)})),n.each(this._edgeObjs,(function(t){e.hasNode(t.v)&&e.hasNode(t.w)&&e.setEdge(t,r.edge(t))}));var o={};function i(t){var n=r.parent(t);return void 0===n||e.hasNode(n)?(o[t]=n,n):n in o?o[n]:i(n)}return this._isCompound&&n.each(e.nodes(),(function(t){e.setParent(t,i(t))})),e},i.prototype.setDefaultEdgeLabel=function(t){return n.isFunction(t)||(t=n.constant(t)),this._defaultEdgeLabelFn=t,this},i.prototype.edgeCount=function(){return this._edgeCount},i.prototype.edges=function(){return n.values(this._edgeObjs)},i.prototype.setPath=function(t,e){var r=this,o=arguments;return n.reduce(t,(function(t,n){return o.length>1?r.setEdge(t,n,e):r.setEdge(t,n),n})),this},i.prototype.setEdge=function(){var t,e,r,o,i=!1,a=arguments[0];"object"==typeof a&&null!==a&&"v"in a?(t=a.v,e=a.w,r=a.name,2===arguments.length&&(o=arguments[1],i=!0)):(t=a,e=arguments[1],r=arguments[3],arguments.length>2&&(o=arguments[2],i=!0)),t=""+t,e=""+e,n.isUndefined(r)||(r=""+r);var d=u(this._isDirected,t,e,r);if(n.has(this._edgeLabels,d))return i&&(this._edgeLabels[d]=o),this;if(!n.isUndefined(r)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(t),this.setNode(e),this._edgeLabels[d]=i?o:this._defaultEdgeLabelFn(t,e,r);var h=function(t,e,r,n){var o=""+e,i=""+r;if(!t&&o>i){var s=o;o=i,i=s}var a={v:o,w:i};return n&&(a.name=n),a}(this._isDirected,t,e,r);return t=h.v,e=h.w,Object.freeze(h),this._edgeObjs[d]=h,s(this._preds[e],t),s(this._sucs[t],e),this._in[e][d]=h,this._out[t][d]=h,this._edgeCount++,this},i.prototype.edge=function(t,e,r){var n=1===arguments.length?d(this._isDirected,arguments[0]):u(this._isDirected,t,e,r);return this._edgeLabels[n]},i.prototype.hasEdge=function(t,e,r){var o=1===arguments.length?d(this._isDirected,arguments[0]):u(this._isDirected,t,e,r);return n.has(this._edgeLabels,o)},i.prototype.removeEdge=function(t,e,r){var n=1===arguments.length?d(this._isDirected,arguments[0]):u(this._isDirected,t,e,r),o=this._edgeObjs[n];return o&&(t=o.v,e=o.w,delete this._edgeLabels[n],delete this._edgeObjs[n],a(this._preds[e],t),a(this._sucs[t],e),delete this._in[e][n],delete this._out[t][n],this._edgeCount--),this},i.prototype.inEdges=function(t,e){var r=this._in[t];if(r){var o=n.values(r);return e?n.filter(o,(function(t){return t.v===e})):o}},i.prototype.outEdges=function(t,e){var r=this._out[t];if(r){var o=n.values(r);return e?n.filter(o,(function(t){return t.w===e})):o}},i.prototype.nodeEdges=function(t,e){var r=this.inEdges(t,e);if(r)return r.concat(this.outEdges(t,e))}},3150:(t,e,r)=>{t.exports={Graph:r(9955),version:r(9127)}},1430:(t,e,r)=>{var n=r(4434),o=r(9955);function i(t){return n.map(t.nodes(),(function(e){var r=t.node(e),o=t.parent(e),i={v:e};return n.isUndefined(r)||(i.value=r),n.isUndefined(o)||(i.parent=o),i}))}function s(t){return n.map(t.edges(),(function(e){var r=t.edge(e),o={v:e.v,w:e.w};return n.isUndefined(e.name)||(o.name=e.name),n.isUndefined(r)||(o.value=r),o}))}t.exports={write:function(t){var e={options:{directed:t.isDirected(),multigraph:t.isMultigraph(),compound:t.isCompound()},nodes:i(t),edges:s(t)};return n.isUndefined(t.graph())||(e.value=n.clone(t.graph())),e},read:function(t){var e=new o(t.options).setGraph(t.value);return n.each(t.nodes,(function(t){e.setNode(t.v,t.value),t.parent&&e.setParent(t.v,t.parent)})),n.each(t.edges,(function(t){e.setEdge({v:t.v,w:t.w,name:t.name},t.value)})),e}}},4434:(t,e,r)=>{var n;try{n={clone:r(7953),constant:r(9203),each:r(678),filter:r(4663),has:r(5346),isArray:r(5589),isEmpty:r(9787),isFunction:r(5563),isUndefined:r(6474),keys:r(2096),map:r(9107),reduce:r(7682),size:r(1039),transform:r(3604),union:r(7767),values:r(1682)}}catch(t){}n||(n=window._),t.exports=n},9127:t=>{t.exports="2.1.8"},4466:(t,e,r)=>{var n=r(5234)(r(3250),"DataView");t.exports=n},5208:(t,e,r)=>{var n=r(4440),o=r(4108),i=r(1085),s=r(7706),a=r(8636);function u(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}u.prototype.clear=n,u.prototype.delete=o,u.prototype.get=i,u.prototype.has=s,u.prototype.set=a,t.exports=u},1998:(t,e,r)=>{var n=r(266),o=r(2875),i=r(5828),s=r(4115),a=r(7690);function u(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}u.prototype.clear=n,u.prototype.delete=o,u.prototype.get=i,u.prototype.has=s,u.prototype.set=a,t.exports=u},2887:(t,e,r)=>{var n=r(5234)(r(3250),"Map");t.exports=n},5678:(t,e,r)=>{var n=r(9016),o=r(2363),i=r(4348),s=r(3062),a=r(262);function u(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}u.prototype.clear=n,u.prototype.delete=o,u.prototype.get=i,u.prototype.has=s,u.prototype.set=a,t.exports=u},5747:(t,e,r)=>{var n=r(5234)(r(3250),"Promise");t.exports=n},6616:(t,e,r)=>{var n=r(5234)(r(3250),"Set");t.exports=n},4546:(t,e,r)=>{var n=r(5678),o=r(3937),i=r(5009);function s(t){var e=-1,r=null==t?0:t.length;for(this.__data__=new n;++e<r;)this.add(t[e])}s.prototype.add=s.prototype.push=o,s.prototype.has=i,t.exports=s},9549:(t,e,r)=>{var n=r(1998),o=r(3210),i=r(8603),s=r(8947),a=r(885),u=r(8938);function d(t){var e=this.__data__=new n(t);this.size=e.size}d.prototype.clear=o,d.prototype.delete=i,d.prototype.get=s,d.prototype.has=a,d.prototype.set=u,t.exports=d},861:(t,e,r)=>{var n=r(3250).Symbol;t.exports=n},3526:(t,e,r)=>{var n=r(3250).Uint8Array;t.exports=n},8001:(t,e,r)=>{var n=r(5234)(r(3250),"WeakMap");t.exports=n},2274:t=>{t.exports=function(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}},4004:t=>{t.exports=function(t,e){for(var r=-1,n=null==t?0:t.length;++r<n&&!1!==e(t[r],r,t););return t}},2493:t=>{t.exports=function(t,e){for(var r=-1,n=null==t?0:t.length,o=0,i=[];++r<n;){var s=t[r];e(s,r,t)&&(i[o++]=s)}return i}},5436:(t,e,r)=>{var n=r(4365);t.exports=function(t,e){return!(null==t||!t.length)&&n(t,e,0)>-1}},9105:t=>{t.exports=function(t,e,r){for(var n=-1,o=null==t?0:t.length;++n<o;)if(r(e,t[n]))return!0;return!1}},5825:(t,e,r)=>{var n=r(8509),o=r(9312),i=r(5589),s=r(5778),a=r(5023),u=r(922),d=Object.prototype.hasOwnProperty;t.exports=function(t,e){var r=i(t),h=!r&&o(t),c=!r&&!h&&s(t),l=!r&&!h&&!c&&u(t),f=r||h||c||l,g=f?n(t.length,String):[],p=g.length;for(var v in t)!e&&!d.call(t,v)||f&&("length"==v||c&&("offset"==v||"parent"==v)||l&&("buffer"==v||"byteLength"==v||"byteOffset"==v)||a(v,p))||g.push(v);return g}},9233:t=>{t.exports=function(t,e){for(var r=-1,n=null==t?0:t.length,o=Array(n);++r<n;)o[r]=e(t[r],r,t);return o}},111:t=>{t.exports=function(t,e){for(var r=-1,n=e.length,o=t.length;++r<n;)t[o+r]=e[r];return t}},5115:t=>{t.exports=function(t,e,r,n){var o=-1,i=null==t?0:t.length;for(n&&i&&(r=t[++o]);++o<i;)r=e(r,t[o],o,t);return r}},1831:t=>{t.exports=function(t,e){for(var r=-1,n=null==t?0:t.length;++r<n;)if(e(t[r],r,t))return!0;return!1}},7088:(t,e,r)=>{var n=r(6174)("length");t.exports=n},3532:(t,e,r)=>{var n=r(7500),o=r(8260);t.exports=function(t,e,r){(void 0!==r&&!o(t[e],r)||void 0===r&&!(e in t))&&n(t,e,r)}},3192:(t,e,r)=>{var n=r(7500),o=r(8260),i=Object.prototype.hasOwnProperty;t.exports=function(t,e,r){var s=t[e];i.call(t,e)&&o(s,r)&&(void 0!==r||e in t)||n(t,e,r)}},8498:(t,e,r)=>{var n=r(8260);t.exports=function(t,e){for(var r=t.length;r--;)if(n(t[r][0],e))return r;return-1}},4265:(t,e,r)=>{var n=r(8618),o=r(2096);t.exports=function(t,e){return t&&n(e,o(e),t)}},1629:(t,e,r)=>{var n=r(8618),o=r(9882);t.exports=function(t,e){return t&&n(e,o(e),t)}},7500:(t,e,r)=>{var n=r(5595);t.exports=function(t,e,r){"__proto__"==e&&n?n(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}},8361:(t,e,r)=>{var n=r(9549),o=r(4004),i=r(3192),s=r(4265),a=r(1629),u=r(6502),d=r(2166),h=r(7272),c=r(2066),l=r(4357),f=r(5713),g=r(7493),p=r(2865),v=r(1908),y=r(4046),m=r(5589),w=r(5778),x=r(7613),b=r(3702),E=r(693),N=r(2096),_=r(9882),M="[object Arguments]",k="[object Function]",A="[object Object]",j={};j[M]=j["[object Array]"]=j["[object ArrayBuffer]"]=j["[object DataView]"]=j["[object Boolean]"]=j["[object Date]"]=j["[object Float32Array]"]=j["[object Float64Array]"]=j["[object Int8Array]"]=j["[object Int16Array]"]=j["[object Int32Array]"]=j["[object Map]"]=j["[object Number]"]=j[A]=j["[object RegExp]"]=j["[object Set]"]=j["[object String]"]=j["[object Symbol]"]=j["[object Uint8Array]"]=j["[object Uint8ClampedArray]"]=j["[object Uint16Array]"]=j["[object Uint32Array]"]=!0,j["[object Error]"]=j[k]=j["[object WeakMap]"]=!1,t.exports=function t(e,r,O,S,z,R){var I,P=1&r,C=2&r,D=4&r;if(O&&(I=z?O(e,S,z,R):O(e)),void 0!==I)return I;if(!b(e))return e;var T=m(e);if(T){if(I=p(e),!P)return d(e,I)}else{var L=g(e),F=L==k||"[object GeneratorFunction]"==L;if(w(e))return u(e,P);if(L==A||L==M||F&&!z){if(I=C||F?{}:y(e),!P)return C?c(e,a(I,e)):h(e,s(I,e))}else{if(!j[L])return z?e:{};I=v(e,L,P)}}R||(R=new n);var q=R.get(e);if(q)return q;R.set(e,I),E(e)?e.forEach((function(n){I.add(t(n,r,O,n,e,R))})):x(e)&&e.forEach((function(n,o){I.set(o,t(n,r,O,o,e,R))}));var V=T?void 0:(D?C?f:l:C?_:N)(e);return o(V||e,(function(n,o){V&&(n=e[o=n]),i(I,o,t(n,r,O,o,e,R))})),I}},7890:(t,e,r)=>{var n=r(3702),o=Object.create,i=function(){function t(){}return function(e){if(!n(e))return{};if(o)return o(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}();t.exports=i},1701:(t,e,r)=>{var n=r(4003),o=r(6313)(n);t.exports=o},5117:(t,e,r)=>{var n=r(2624);t.exports=function(t,e,r){for(var o=-1,i=t.length;++o<i;){var s=t[o],a=e(s);if(null!=a&&(void 0===u?a==a&&!n(a):r(a,u)))var u=a,d=s}return d}},8146:(t,e,r)=>{var n=r(1701);t.exports=function(t,e){var r=[];return n(t,(function(t,n,o){e(t,n,o)&&r.push(t)})),r}},4770:t=>{t.exports=function(t,e,r,n){for(var o=t.length,i=r+(n?1:-1);n?i--:++i<o;)if(e(t[i],i,t))return i;return-1}},6640:(t,e,r)=>{var n=r(111),o=r(7123);t.exports=function t(e,r,i,s,a){var u=-1,d=e.length;for(i||(i=o),a||(a=[]);++u<d;){var h=e[u];r>0&&i(h)?r>1?t(h,r-1,i,s,a):n(a,h):s||(a[a.length]=h)}return a}},9943:(t,e,r)=>{var n=r(2545)();t.exports=n},4003:(t,e,r)=>{var n=r(9943),o=r(2096);t.exports=function(t,e){return t&&n(t,e,o)}},548:(t,e,r)=>{var n=r(4007),o=r(6040);t.exports=function(t,e){for(var r=0,i=(e=n(e,t)).length;null!=t&&r<i;)t=t[o(e[r++])];return r&&r==i?t:void 0}},4468:(t,e,r)=>{var n=r(111),o=r(5589);t.exports=function(t,e,r){var i=e(t);return o(t)?i:n(i,r(t))}},9823:(t,e,r)=>{var n=r(861),o=r(1339),i=r(5151),s=n?n.toStringTag:void 0;t.exports=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":s&&s in Object(t)?o(t):i(t)}},1669:t=>{t.exports=function(t,e){return t>e}},2586:t=>{var e=Object.prototype.hasOwnProperty;t.exports=function(t,r){return null!=t&&e.call(t,r)}},2902:t=>{t.exports=function(t,e){return null!=t&&e in Object(t)}},4365:(t,e,r)=>{var n=r(4770),o=r(6963),i=r(5898);t.exports=function(t,e,r){return e==e?i(t,e,r):n(t,o,r)}},3016:(t,e,r)=>{var n=r(9823),o=r(440);t.exports=function(t){return o(t)&&"[object Arguments]"==n(t)}},4662:(t,e,r)=>{var n=r(8968),o=r(440);t.exports=function t(e,r,i,s,a){return e===r||(null==e||null==r||!o(e)&&!o(r)?e!=e&&r!=r:n(e,r,i,s,t,a))}},8968:(t,e,r)=>{var n=r(9549),o=r(4952),i=r(1080),s=r(6524),a=r(7493),u=r(5589),d=r(5778),h=r(922),c="[object Arguments]",l="[object Array]",f="[object Object]",g=Object.prototype.hasOwnProperty;t.exports=function(t,e,r,p,v,y){var m=u(t),w=u(e),x=m?l:a(t),b=w?l:a(e),E=(x=x==c?f:x)==f,N=(b=b==c?f:b)==f,_=x==b;if(_&&d(t)){if(!d(e))return!1;m=!0,E=!1}if(_&&!E)return y||(y=new n),m||h(t)?o(t,e,r,p,v,y):i(t,e,x,r,p,v,y);if(!(1&r)){var M=E&&g.call(t,"__wrapped__"),k=N&&g.call(e,"__wrapped__");if(M||k){var A=M?t.value():t,j=k?e.value():e;return y||(y=new n),v(A,j,r,p,y)}}return!!_&&(y||(y=new n),s(t,e,r,p,v,y))}},2275:(t,e,r)=>{var n=r(7493),o=r(440);t.exports=function(t){return o(t)&&"[object Map]"==n(t)}},2972:(t,e,r)=>{var n=r(9549),o=r(4662);t.exports=function(t,e,r,i){var s=r.length,a=s,u=!i;if(null==t)return!a;for(t=Object(t);s--;){var d=r[s];if(u&&d[2]?d[1]!==t[d[0]]:!(d[0]in t))return!1}for(;++s<a;){var h=(d=r[s])[0],c=t[h],l=d[1];if(u&&d[2]){if(void 0===c&&!(h in t))return!1}else{var f=new n;if(i)var g=i(c,l,h,t,e,f);if(!(void 0===g?o(l,c,3,i,f):g))return!1}}return!0}},6963:t=>{t.exports=function(t){return t!=t}},9817:(t,e,r)=>{var n=r(5563),o=r(8597),i=r(3702),s=r(5784),a=/^\\[object .+?Constructor\\]$/,u=Function.prototype,d=Object.prototype,h=u.toString,c=d.hasOwnProperty,l=RegExp("^"+h.call(c).replace(/[\\\\^$.*+?()[\\]{}|]/g,"\\\\$&").replace(/hasOwnProperty|(function).*?(?=\\\\\\()| for .+?(?=\\\\\\])/g,"$1.*?")+"$");t.exports=function(t){return!(!i(t)||o(t))&&(n(t)?l:a).test(s(t))}},7170:(t,e,r)=>{var n=r(7493),o=r(440);t.exports=function(t){return o(t)&&"[object Set]"==n(t)}},2448:(t,e,r)=>{var n=r(9823),o=r(6052),i=r(440),s={};s["[object Float32Array]"]=s["[object Float64Array]"]=s["[object Int8Array]"]=s["[object Int16Array]"]=s["[object Int32Array]"]=s["[object Uint8Array]"]=s["[object Uint8ClampedArray]"]=s["[object Uint16Array]"]=s["[object Uint32Array]"]=!0,s["[object Arguments]"]=s["[object Array]"]=s["[object ArrayBuffer]"]=s["[object Boolean]"]=s["[object DataView]"]=s["[object Date]"]=s["[object Error]"]=s["[object Function]"]=s["[object Map]"]=s["[object Number]"]=s["[object Object]"]=s["[object RegExp]"]=s["[object Set]"]=s["[object String]"]=s["[object WeakMap]"]=!1,t.exports=function(t){return i(t)&&o(t.length)&&!!s[n(t)]}},5833:(t,e,r)=>{var n=r(5640),o=r(9906),i=r(229),s=r(5589),a=r(4437);t.exports=function(t){return"function"==typeof t?t:null==t?i:"object"==typeof t?s(t)?o(t[0],t[1]):n(t):a(t)}},1351:(t,e,r)=>{var n=r(2840),o=r(2825),i=Object.prototype.hasOwnProperty;t.exports=function(t){if(!n(t))return o(t);var e=[];for(var r in Object(t))i.call(t,r)&&"constructor"!=r&&e.push(r);return e}},1309:(t,e,r)=>{var n=r(3702),o=r(2840),i=r(4866),s=Object.prototype.hasOwnProperty;t.exports=function(t){if(!n(t))return i(t);var e=o(t),r=[];for(var a in t)("constructor"!=a||!e&&s.call(t,a))&&r.push(a);return r}},6718:t=>{t.exports=function(t,e){return t<e}},8068:(t,e,r)=>{var n=r(1701),o=r(568);t.exports=function(t,e){var r=-1,i=o(t)?Array(t.length):[];return n(t,(function(t,n,o){i[++r]=e(t,n,o)})),i}},5640:(t,e,r)=>{var n=r(2972),o=r(2198),i=r(4656);t.exports=function(t){var e=o(t);return 1==e.length&&e[0][2]?i(e[0][0],e[0][1]):function(r){return r===t||n(r,t,e)}}},9906:(t,e,r)=>{var n=r(4662),o=r(3546),i=r(6708),s=r(5130),a=r(8802),u=r(4656),d=r(6040);t.exports=function(t,e){return s(t)&&a(e)?u(d(t),e):function(r){var s=o(r,t);return void 0===s&&s===e?i(r,t):n(e,s,3)}}},2133:(t,e,r)=>{var n=r(9549),o=r(3532),i=r(9943),s=r(1241),a=r(3702),u=r(9882),d=r(1933);t.exports=function t(e,r,h,c,l){e!==r&&i(r,(function(i,u){if(l||(l=new n),a(i))s(e,r,u,h,t,c,l);else{var f=c?c(d(e,u),i,u+"",e,r,l):void 0;void 0===f&&(f=i),o(e,u,f)}}),u)}},1241:(t,e,r)=>{var n=r(3532),o=r(6502),i=r(1327),s=r(2166),a=r(4046),u=r(9312),d=r(5589),h=r(8268),c=r(5778),l=r(5563),f=r(3702),g=r(4256),p=r(922),v=r(1933),y=r(6222);t.exports=function(t,e,r,m,w,x,b){var E=v(t,r),N=v(e,r),_=b.get(N);if(_)n(t,r,_);else{var M=x?x(E,N,r+"",t,e,b):void 0,k=void 0===M;if(k){var A=d(N),j=!A&&c(N),O=!A&&!j&&p(N);M=N,A||j||O?d(E)?M=E:h(E)?M=s(E):j?(k=!1,M=o(N,!0)):O?(k=!1,M=i(N,!0)):M=[]:g(N)||u(N)?(M=E,u(E)?M=y(E):f(E)&&!l(E)||(M=a(N))):k=!1}k&&(b.set(N,M),w(M,N,m,x,b),b.delete(N)),n(t,r,M)}}},3980:(t,e,r)=>{var n=r(9233),o=r(548),i=r(5833),s=r(8068),a=r(3340),u=r(1525),d=r(315),h=r(229),c=r(5589);t.exports=function(t,e,r){e=e.length?n(e,(function(t){return c(t)?function(e){return o(e,1===t.length?t[0]:t)}:t})):[h];var l=-1;e=n(e,u(i));var f=s(t,(function(t,r,o){return{criteria:n(e,(function(e){return e(t)})),index:++l,value:t}}));return a(f,(function(t,e){return d(t,e,r)}))}},1785:(t,e,r)=>{var n=r(7121),o=r(6708);t.exports=function(t,e){return n(t,e,(function(e,r){return o(t,r)}))}},7121:(t,e,r)=>{var n=r(548),o=r(2619),i=r(4007);t.exports=function(t,e,r){for(var s=-1,a=e.length,u={};++s<a;){var d=e[s],h=n(t,d);r(h,d)&&o(u,i(d,t),h)}return u}},6174:t=>{t.exports=function(t){return function(e){return null==e?void 0:e[t]}}},3293:(t,e,r)=>{var n=r(548);t.exports=function(t){return function(e){return n(e,t)}}},4930:t=>{var e=Math.ceil,r=Math.max;t.exports=function(t,n,o,i){for(var s=-1,a=r(e((n-t)/(o||1)),0),u=Array(a);a--;)u[i?a:++s]=t,t+=o;return u}},4306:t=>{t.exports=function(t,e,r,n,o){return o(t,(function(t,o,i){r=n?(n=!1,t):e(r,t,o,i)})),r}},9735:(t,e,r)=>{var n=r(229),o=r(340),i=r(4173);t.exports=function(t,e){return i(o(t,e,n),t+"")}},2619:(t,e,r)=>{var n=r(3192),o=r(4007),i=r(5023),s=r(3702),a=r(6040);t.exports=function(t,e,r,u){if(!s(t))return t;for(var d=-1,h=(e=o(e,t)).length,c=h-1,l=t;null!=l&&++d<h;){var f=a(e[d]),g=r;if("__proto__"===f||"constructor"===f||"prototype"===f)return t;if(d!=c){var p=l[f];void 0===(g=u?u(p,f,l):void 0)&&(g=s(p)?p:i(e[d+1])?[]:{})}n(l,f,g),l=l[f]}return t}},6739:(t,e,r)=>{var n=r(9203),o=r(5595),i=r(229),s=o?function(t,e){return o(t,"toString",{configurable:!0,enumerable:!1,value:n(e),writable:!0})}:i;t.exports=s},3340:t=>{t.exports=function(t,e){var r=t.length;for(t.sort(e);r--;)t[r]=t[r].value;return t}},8509:t=>{t.exports=function(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}},6245:(t,e,r)=>{var n=r(861),o=r(9233),i=r(5589),s=r(2624),a=n?n.prototype:void 0,u=a?a.toString:void 0;t.exports=function t(e){if("string"==typeof e)return e;if(i(e))return o(e,t)+"";if(s(e))return u?u.call(e):"";var r=e+"";return"0"==r&&1/e==-1/0?"-0":r}},1656:(t,e,r)=>{var n=r(2438),o=/^\\s+/;t.exports=function(t){return t?t.slice(0,n(t)+1).replace(o,""):t}},1525:t=>{t.exports=function(t){return function(e){return t(e)}}},135:(t,e,r)=>{var n=r(4546),o=r(5436),i=r(9105),s=r(7026),a=r(6262),u=r(7969);t.exports=function(t,e,r){var d=-1,h=o,c=t.length,l=!0,f=[],g=f;if(r)l=!1,h=i;else if(c>=200){var p=e?null:a(t);if(p)return u(p);l=!1,h=s,g=new n}else g=e?[]:f;t:for(;++d<c;){var v=t[d],y=e?e(v):v;if(v=r||0!==v?v:0,l&&y==y){for(var m=g.length;m--;)if(g[m]===y)continue t;e&&g.push(y),f.push(v)}else h(g,y,r)||(g!==f&&g.push(y),f.push(v))}return f}},71:(t,e,r)=>{var n=r(9233);t.exports=function(t,e){return n(e,(function(e){return t[e]}))}},6302:t=>{t.exports=function(t,e,r){for(var n=-1,o=t.length,i=e.length,s={};++n<o;){var a=n<i?e[n]:void 0;r(s,t[n],a)}return s}},7026:t=>{t.exports=function(t,e){return t.has(e)}},4781:(t,e,r)=>{var n=r(229);t.exports=function(t){return"function"==typeof t?t:n}},4007:(t,e,r)=>{var n=r(5589),o=r(5130),i=r(4041),s=r(9835);t.exports=function(t,e){return n(t)?t:o(t,e)?[t]:i(s(t))}},2962:(t,e,r)=>{var n=r(3526);t.exports=function(t){var e=new t.constructor(t.byteLength);return new n(e).set(new n(t)),e}},6502:(t,e,r)=>{t=r.nmd(t);var n=r(3250),o=e&&!e.nodeType&&e,i=o&&t&&!t.nodeType&&t,s=i&&i.exports===o?n.Buffer:void 0,a=s?s.allocUnsafe:void 0;t.exports=function(t,e){if(e)return t.slice();var r=t.length,n=a?a(r):new t.constructor(r);return t.copy(n),n}},7037:(t,e,r)=>{var n=r(2962);t.exports=function(t,e){var r=e?n(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}},3429:t=>{var e=/\\w*$/;t.exports=function(t){var r=new t.constructor(t.source,e.exec(t));return r.lastIndex=t.lastIndex,r}},9349:(t,e,r)=>{var n=r(861),o=n?n.prototype:void 0,i=o?o.valueOf:void 0;t.exports=function(t){return i?Object(i.call(t)):{}}},1327:(t,e,r)=>{var n=r(2962);t.exports=function(t,e){var r=e?n(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}},8899:(t,e,r)=>{var n=r(2624);t.exports=function(t,e){if(t!==e){var r=void 0!==t,o=null===t,i=t==t,s=n(t),a=void 0!==e,u=null===e,d=e==e,h=n(e);if(!u&&!h&&!s&&t>e||s&&a&&d&&!u&&!h||o&&a&&d||!r&&d||!i)return 1;if(!o&&!s&&!h&&t<e||h&&r&&i&&!o&&!s||u&&r&&i||!a&&i||!d)return-1}return 0}},315:(t,e,r)=>{var n=r(8899);t.exports=function(t,e,r){for(var o=-1,i=t.criteria,s=e.criteria,a=i.length,u=r.length;++o<a;){var d=n(i[o],s[o]);if(d)return o>=u?d:d*("desc"==r[o]?-1:1)}return t.index-e.index}},2166:t=>{t.exports=function(t,e){var r=-1,n=t.length;for(e||(e=Array(n));++r<n;)e[r]=t[r];return e}},8618:(t,e,r)=>{var n=r(3192),o=r(7500);t.exports=function(t,e,r,i){var s=!r;r||(r={});for(var a=-1,u=e.length;++a<u;){var d=e[a],h=i?i(r[d],t[d],d,r,t):void 0;void 0===h&&(h=t[d]),s?o(r,d,h):n(r,d,h)}return r}},7272:(t,e,r)=>{var n=r(8618),o=r(4450);t.exports=function(t,e){return n(t,o(t),e)}},2066:(t,e,r)=>{var n=r(8618),o=r(4969);t.exports=function(t,e){return n(t,o(t),e)}},1622:(t,e,r)=>{var n=r(3250)["__core-js_shared__"];t.exports=n},6948:(t,e,r)=>{var n=r(9735),o=r(8132);t.exports=function(t){return n((function(e,r){var n=-1,i=r.length,s=i>1?r[i-1]:void 0,a=i>2?r[2]:void 0;for(s=t.length>3&&"function"==typeof s?(i--,s):void 0,a&&o(r[0],r[1],a)&&(s=i<3?void 0:s,i=1),e=Object(e);++n<i;){var u=r[n];u&&t(e,u,n,s)}return e}))}},6313:(t,e,r)=>{var n=r(568);t.exports=function(t,e){return function(r,o){if(null==r)return r;if(!n(r))return t(r,o);for(var i=r.length,s=e?i:-1,a=Object(r);(e?s--:++s<i)&&!1!==o(a[s],s,a););return r}}},2545:t=>{t.exports=function(t){return function(e,r,n){for(var o=-1,i=Object(e),s=n(e),a=s.length;a--;){var u=s[t?a:++o];if(!1===r(i[u],u,i))break}return e}}},9301:(t,e,r)=>{var n=r(5833),o=r(568),i=r(2096);t.exports=function(t){return function(e,r,s){var a=Object(e);if(!o(e)){var u=n(r,3);e=i(e),r=function(t){return u(a[t],t,a)}}var d=t(e,r,s);return d>-1?a[u?e[d]:d]:void 0}}},1523:(t,e,r)=>{var n=r(4930),o=r(8132),i=r(9558);t.exports=function(t){return function(e,r,s){return s&&"number"!=typeof s&&o(e,r,s)&&(r=s=void 0),e=i(e),void 0===r?(r=e,e=0):r=i(r),s=void 0===s?e<r?1:-1:i(s),n(e,r,s,t)}}},6262:(t,e,r)=>{var n=r(6616),o=r(1607),i=r(7969),s=n&&1/i(new n([,-0]))[1]==1/0?function(t){return new n(t)}:o;t.exports=s},5595:(t,e,r)=>{var n=r(5234),o=function(){try{var t=n(Object,"defineProperty");return t({},"",{}),t}catch(t){}}();t.exports=o},4952:(t,e,r)=>{var n=r(4546),o=r(1831),i=r(7026);t.exports=function(t,e,r,s,a,u){var d=1&r,h=t.length,c=e.length;if(h!=c&&!(d&&c>h))return!1;var l=u.get(t),f=u.get(e);if(l&&f)return l==e&&f==t;var g=-1,p=!0,v=2&r?new n:void 0;for(u.set(t,e),u.set(e,t);++g<h;){var y=t[g],m=e[g];if(s)var w=d?s(m,y,g,e,t,u):s(y,m,g,t,e,u);if(void 0!==w){if(w)continue;p=!1;break}if(v){if(!o(e,(function(t,e){if(!i(v,e)&&(y===t||a(y,t,r,s,u)))return v.push(e)}))){p=!1;break}}else if(y!==m&&!a(y,m,r,s,u)){p=!1;break}}return u.delete(t),u.delete(e),p}},1080:(t,e,r)=>{var n=r(861),o=r(3526),i=r(8260),s=r(4952),a=r(1140),u=r(7969),d=n?n.prototype:void 0,h=d?d.valueOf:void 0;t.exports=function(t,e,r,n,d,c,l){switch(r){case"[object DataView]":if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case"[object ArrayBuffer]":return!(t.byteLength!=e.byteLength||!c(new o(t),new o(e)));case"[object Boolean]":case"[object Date]":case"[object Number]":return i(+t,+e);case"[object Error]":return t.name==e.name&&t.message==e.message;case"[object RegExp]":case"[object String]":return t==e+"";case"[object Map]":var f=a;case"[object Set]":var g=1&n;if(f||(f=u),t.size!=e.size&&!g)return!1;var p=l.get(t);if(p)return p==e;n|=2,l.set(t,e);var v=s(f(t),f(e),n,d,c,l);return l.delete(t),v;case"[object Symbol]":if(h)return h.call(t)==h.call(e)}return!1}},6524:(t,e,r)=>{var n=r(4357),o=Object.prototype.hasOwnProperty;t.exports=function(t,e,r,i,s,a){var u=1&r,d=n(t),h=d.length;if(h!=n(e).length&&!u)return!1;for(var c=h;c--;){var l=d[c];if(!(u?l in e:o.call(e,l)))return!1}var f=a.get(t),g=a.get(e);if(f&&g)return f==e&&g==t;var p=!0;a.set(t,e),a.set(e,t);for(var v=u;++c<h;){var y=t[l=d[c]],m=e[l];if(i)var w=u?i(m,y,l,e,t,a):i(y,m,l,t,e,a);if(!(void 0===w?y===m||s(y,m,r,i,a):w)){p=!1;break}v||(v="constructor"==l)}if(p&&!v){var x=t.constructor,b=e.constructor;x==b||!("constructor"in t)||!("constructor"in e)||"function"==typeof x&&x instanceof x&&"function"==typeof b&&b instanceof b||(p=!1)}return a.delete(t),a.delete(e),p}},3273:(t,e,r)=>{var n=r(2923),o=r(340),i=r(4173);t.exports=function(t){return i(o(t,void 0,n),t+"")}},302:(t,e,r)=>{var n="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g;t.exports=n},4357:(t,e,r)=>{var n=r(4468),o=r(4450),i=r(2096);t.exports=function(t){return n(t,i,o)}},5713:(t,e,r)=>{var n=r(4468),o=r(4969),i=r(9882);t.exports=function(t){return n(t,i,o)}},7570:(t,e,r)=>{var n=r(8949);t.exports=function(t,e){var r=t.__data__;return n(e)?r["string"==typeof e?"string":"hash"]:r.map}},2198:(t,e,r)=>{var n=r(8802),o=r(2096);t.exports=function(t){for(var e=o(t),r=e.length;r--;){var i=e[r],s=t[i];e[r]=[i,s,n(s)]}return e}},5234:(t,e,r)=>{var n=r(9817),o=r(7736);t.exports=function(t,e){var r=o(t,e);return n(r)?r:void 0}},8490:(t,e,r)=>{var n=r(3540)(Object.getPrototypeOf,Object);t.exports=n},1339:(t,e,r)=>{var n=r(861),o=Object.prototype,i=o.hasOwnProperty,s=o.toString,a=n?n.toStringTag:void 0;t.exports=function(t){var e=i.call(t,a),r=t[a];try{t[a]=void 0;var n=!0}catch(t){}var o=s.call(t);return n&&(e?t[a]=r:delete t[a]),o}},4450:(t,e,r)=>{var n=r(2493),o=r(4506),i=Object.prototype.propertyIsEnumerable,s=Object.getOwnPropertySymbols,a=s?function(t){return null==t?[]:(t=Object(t),n(s(t),(function(e){return i.call(t,e)})))}:o;t.exports=a},4969:(t,e,r)=>{var n=r(111),o=r(8490),i=r(4450),s=r(4506),a=Object.getOwnPropertySymbols?function(t){for(var e=[];t;)n(e,i(t)),t=o(t);return e}:s;t.exports=a},7493:(t,e,r)=>{var n=r(4466),o=r(2887),i=r(5747),s=r(6616),a=r(8001),u=r(9823),d=r(5784),h="[object Map]",c="[object Promise]",l="[object Set]",f="[object WeakMap]",g="[object DataView]",p=d(n),v=d(o),y=d(i),m=d(s),w=d(a),x=u;(n&&x(new n(new ArrayBuffer(1)))!=g||o&&x(new o)!=h||i&&x(i.resolve())!=c||s&&x(new s)!=l||a&&x(new a)!=f)&&(x=function(t){var e=u(t),r="[object Object]"==e?t.constructor:void 0,n=r?d(r):"";if(n)switch(n){case p:return g;case v:return h;case y:return c;case m:return l;case w:return f}return e}),t.exports=x},7736:t=>{t.exports=function(t,e){return null==t?void 0:t[e]}},3544:(t,e,r)=>{var n=r(4007),o=r(9312),i=r(5589),s=r(5023),a=r(6052),u=r(6040);t.exports=function(t,e,r){for(var d=-1,h=(e=n(e,t)).length,c=!1;++d<h;){var l=u(e[d]);if(!(c=null!=t&&r(t,l)))break;t=t[l]}return c||++d!=h?c:!!(h=null==t?0:t.length)&&a(h)&&s(l,h)&&(i(t)||o(t))}},3932:t=>{var e=RegExp("[\\\\u200d\\\\ud800-\\\\udfff\\\\u0300-\\\\u036f\\\\ufe20-\\\\ufe2f\\\\u20d0-\\\\u20ff\\\\ufe0e\\\\ufe0f]");t.exports=function(t){return e.test(t)}},4440:(t,e,r)=>{var n=r(4545);t.exports=function(){this.__data__=n?n(null):{},this.size=0}},4108:t=>{t.exports=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}},1085:(t,e,r)=>{var n=r(4545),o=Object.prototype.hasOwnProperty;t.exports=function(t){var e=this.__data__;if(n){var r=e[t];return"__lodash_hash_undefined__"===r?void 0:r}return o.call(e,t)?e[t]:void 0}},7706:(t,e,r)=>{var n=r(4545),o=Object.prototype.hasOwnProperty;t.exports=function(t){var e=this.__data__;return n?void 0!==e[t]:o.call(e,t)}},8636:(t,e,r)=>{var n=r(4545);t.exports=function(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=n&&void 0===e?"__lodash_hash_undefined__":e,this}},2865:t=>{var e=Object.prototype.hasOwnProperty;t.exports=function(t){var r=t.length,n=new t.constructor(r);return r&&"string"==typeof t[0]&&e.call(t,"index")&&(n.index=t.index,n.input=t.input),n}},1908:(t,e,r)=>{var n=r(2962),o=r(7037),i=r(3429),s=r(9349),a=r(1327);t.exports=function(t,e,r){var u=t.constructor;switch(e){case"[object ArrayBuffer]":return n(t);case"[object Boolean]":case"[object Date]":return new u(+t);case"[object DataView]":return o(t,r);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return a(t,r);case"[object Map]":case"[object Set]":return new u;case"[object Number]":case"[object String]":return new u(t);case"[object RegExp]":return i(t);case"[object Symbol]":return s(t)}}},4046:(t,e,r)=>{var n=r(7890),o=r(8490),i=r(2840);t.exports=function(t){return"function"!=typeof t.constructor||i(t)?{}:n(o(t))}},7123:(t,e,r)=>{var n=r(861),o=r(9312),i=r(5589),s=n?n.isConcatSpreadable:void 0;t.exports=function(t){return i(t)||o(t)||!!(s&&t&&t[s])}},5023:t=>{var e=/^(?:0|[1-9]\\d*)$/;t.exports=function(t,r){var n=typeof t;return!!(r=null==r?9007199254740991:r)&&("number"==n||"symbol"!=n&&e.test(t))&&t>-1&&t%1==0&&t<r}},8132:(t,e,r)=>{var n=r(8260),o=r(568),i=r(5023),s=r(3702);t.exports=function(t,e,r){if(!s(r))return!1;var a=typeof e;return!!("number"==a?o(r)&&i(e,r.length):"string"==a&&e in r)&&n(r[e],t)}},5130:(t,e,r)=>{var n=r(5589),o=r(2624),i=/\\.|\\[(?:[^[\\]]*|(["\'])(?:(?!\\1)[^\\\\]|\\\\.)*?\\1)\\]/,s=/^\\w*$/;t.exports=function(t,e){if(n(t))return!1;var r=typeof t;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=t&&!o(t))||s.test(t)||!i.test(t)||null!=e&&t in Object(e)}},8949:t=>{t.exports=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t}},8597:(t,e,r)=>{var n,o=r(1622),i=(n=/[^.]+$/.exec(o&&o.keys&&o.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"";t.exports=function(t){return!!i&&i in t}},2840:t=>{var e=Object.prototype;t.exports=function(t){var r=t&&t.constructor;return t===("function"==typeof r&&r.prototype||e)}},8802:(t,e,r)=>{var n=r(3702);t.exports=function(t){return t==t&&!n(t)}},266:t=>{t.exports=function(){this.__data__=[],this.size=0}},2875:(t,e,r)=>{var n=r(8498),o=Array.prototype.splice;t.exports=function(t){var e=this.__data__,r=n(e,t);return!(r<0||(r==e.length-1?e.pop():o.call(e,r,1),--this.size,0))}},5828:(t,e,r)=>{var n=r(8498);t.exports=function(t){var e=this.__data__,r=n(e,t);return r<0?void 0:e[r][1]}},4115:(t,e,r)=>{var n=r(8498);t.exports=function(t){return n(this.__data__,t)>-1}},7690:(t,e,r)=>{var n=r(8498);t.exports=function(t,e){var r=this.__data__,o=n(r,t);return o<0?(++this.size,r.push([t,e])):r[o][1]=e,this}},9016:(t,e,r)=>{var n=r(5208),o=r(1998),i=r(2887);t.exports=function(){this.size=0,this.__data__={hash:new n,map:new(i||o),string:new n}}},2363:(t,e,r)=>{var n=r(7570);t.exports=function(t){var e=n(this,t).delete(t);return this.size-=e?1:0,e}},4348:(t,e,r)=>{var n=r(7570);t.exports=function(t){return n(this,t).get(t)}},3062:(t,e,r)=>{var n=r(7570);t.exports=function(t){return n(this,t).has(t)}},262:(t,e,r)=>{var n=r(7570);t.exports=function(t,e){var r=n(this,t),o=r.size;return r.set(t,e),this.size+=r.size==o?0:1,this}},1140:t=>{t.exports=function(t){var e=-1,r=Array(t.size);return t.forEach((function(t,n){r[++e]=[n,t]})),r}},4656:t=>{t.exports=function(t,e){return function(r){return null!=r&&r[t]===e&&(void 0!==e||t in Object(r))}}},2924:(t,e,r)=>{var n=r(7997);t.exports=function(t){var e=n(t,(function(t){return 500===r.size&&r.clear(),t})),r=e.cache;return e}},4545:(t,e,r)=>{var n=r(5234)(Object,"create");t.exports=n},2825:(t,e,r)=>{var n=r(3540)(Object.keys,Object);t.exports=n},4866:t=>{t.exports=function(t){var e=[];if(null!=t)for(var r in Object(t))e.push(r);return e}},8690:(t,e,r)=>{t=r.nmd(t);var n=r(302),o=e&&!e.nodeType&&e,i=o&&t&&!t.nodeType&&t,s=i&&i.exports===o&&n.process,a=function(){try{return i&&i.require&&i.require("util").types||s&&s.binding&&s.binding("util")}catch(t){}}();t.exports=a},5151:t=>{var e=Object.prototype.toString;t.exports=function(t){return e.call(t)}},3540:t=>{t.exports=function(t,e){return function(r){return t(e(r))}}},340:(t,e,r)=>{var n=r(2274),o=Math.max;t.exports=function(t,e,r){return e=o(void 0===e?t.length-1:e,0),function(){for(var i=arguments,s=-1,a=o(i.length-e,0),u=Array(a);++s<a;)u[s]=i[e+s];s=-1;for(var d=Array(e+1);++s<e;)d[s]=i[s];return d[e]=r(u),n(t,this,d)}}},3250:(t,e,r)=>{var n=r(302),o="object"==typeof self&&self&&self.Object===Object&&self,i=n||o||Function("return this")();t.exports=i},1933:t=>{t.exports=function(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}},3937:t=>{t.exports=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this}},5009:t=>{t.exports=function(t){return this.__data__.has(t)}},7969:t=>{t.exports=function(t){var e=-1,r=Array(t.size);return t.forEach((function(t){r[++e]=t})),r}},4173:(t,e,r)=>{var n=r(6739),o=r(7357)(n);t.exports=o},7357:t=>{var e=Date.now;t.exports=function(t){var r=0,n=0;return function(){var o=e(),i=16-(o-n);if(n=o,i>0){if(++r>=800)return arguments[0]}else r=0;return t.apply(void 0,arguments)}}},3210:(t,e,r)=>{var n=r(1998);t.exports=function(){this.__data__=new n,this.size=0}},8603:t=>{t.exports=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}},8947:t=>{t.exports=function(t){return this.__data__.get(t)}},885:t=>{t.exports=function(t){return this.__data__.has(t)}},8938:(t,e,r)=>{var n=r(1998),o=r(2887),i=r(5678);t.exports=function(t,e){var r=this.__data__;if(r instanceof n){var s=r.__data__;if(!o||s.length<199)return s.push([t,e]),this.size=++r.size,this;r=this.__data__=new i(s)}return r.set(t,e),this.size=r.size,this}},5898:t=>{t.exports=function(t,e,r){for(var n=r-1,o=t.length;++n<o;)if(t[n]===e)return n;return-1}},1324:(t,e,r)=>{var n=r(7088),o=r(3932),i=r(445);t.exports=function(t){return o(t)?i(t):n(t)}},4041:(t,e,r)=>{var n=r(2924),o=/[^.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|(["\'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|$))/g,i=/\\\\(\\\\)?/g,s=n((function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(o,(function(t,r,n,o){e.push(n?o.replace(i,"$1"):r||t)})),e}));t.exports=s},6040:(t,e,r)=>{var n=r(2624);t.exports=function(t){if("string"==typeof t||n(t))return t;var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}},5784:t=>{var e=Function.prototype.toString;t.exports=function(t){if(null!=t){try{return e.call(t)}catch(t){}try{return t+""}catch(t){}}return""}},2438:t=>{var e=/\\s/;t.exports=function(t){for(var r=t.length;r--&&e.test(t.charAt(r)););return r}},445:t=>{var e="\\\\ud800-\\\\udfff",r="["+e+"]",n="[\\\\u0300-\\\\u036f\\\\ufe20-\\\\ufe2f\\\\u20d0-\\\\u20ff]",o="\\\\ud83c[\\\\udffb-\\\\udfff]",i="[^"+e+"]",s="(?:\\\\ud83c[\\\\udde6-\\\\uddff]){2}",a="[\\\\ud800-\\\\udbff][\\\\udc00-\\\\udfff]",u="(?:"+n+"|"+o+")?",d="[\\\\ufe0e\\\\ufe0f]?",h=d+u+"(?:\\\\u200d(?:"+[i,s,a].join("|")+")"+d+u+")*",c="(?:"+[i+n+"?",n,s,a,r].join("|")+")",l=RegExp(o+"(?="+o+")|"+c+h,"g");t.exports=function(t){for(var e=l.lastIndex=0;l.test(t);)++e;return e}},7953:(t,e,r)=>{var n=r(8361);t.exports=function(t){return n(t,4)}},7179:(t,e,r)=>{var n=r(8361);t.exports=function(t){return n(t,5)}},9203:t=>{t.exports=function(t){return function(){return t}}},3821:(t,e,r)=>{var n=r(9735),o=r(8260),i=r(8132),s=r(9882),a=Object.prototype,u=a.hasOwnProperty,d=n((function(t,e){t=Object(t);var r=-1,n=e.length,d=n>2?e[2]:void 0;for(d&&i(e[0],e[1],d)&&(n=1);++r<n;)for(var h=e[r],c=s(h),l=-1,f=c.length;++l<f;){var g=c[l],p=t[g];(void 0===p||o(p,a[g])&&!u.call(t,g))&&(t[g]=h[g])}return t}));t.exports=d},678:(t,e,r)=>{t.exports=r(7734)},8260:t=>{t.exports=function(t,e){return t===e||t!=t&&e!=e}},4663:(t,e,r)=>{var n=r(2493),o=r(8146),i=r(5833),s=r(5589);t.exports=function(t,e){return(s(t)?n:o)(t,i(e,3))}},6969:(t,e,r)=>{var n=r(9301)(r(564));t.exports=n},564:(t,e,r)=>{var n=r(4770),o=r(5833),i=r(6843),s=Math.max;t.exports=function(t,e,r){var a=null==t?0:t.length;if(!a)return-1;var u=null==r?0:i(r);return u<0&&(u=s(a+u,0)),n(t,o(e,3),u)}},2923:(t,e,r)=>{var n=r(6640);t.exports=function(t){return null!=t&&t.length?n(t,1):[]}},7734:(t,e,r)=>{var n=r(4004),o=r(1701),i=r(4781),s=r(5589);t.exports=function(t,e){return(s(t)?n:o)(t,i(e))}},7514:(t,e,r)=>{var n=r(9943),o=r(4781),i=r(9882);t.exports=function(t,e){return null==t?t:n(t,o(e),i)}},3546:(t,e,r)=>{var n=r(548);t.exports=function(t,e,r){var o=null==t?void 0:n(t,e);return void 0===o?r:o}},5346:(t,e,r)=>{var n=r(2586),o=r(3544);t.exports=function(t,e){return null!=t&&o(t,e,n)}},6708:(t,e,r)=>{var n=r(2902),o=r(3544);t.exports=function(t,e){return null!=t&&o(t,e,n)}},229:t=>{t.exports=function(t){return t}},9312:(t,e,r)=>{var n=r(3016),o=r(440),i=Object.prototype,s=i.hasOwnProperty,a=i.propertyIsEnumerable,u=n(function(){return arguments}())?n:function(t){return o(t)&&s.call(t,"callee")&&!a.call(t,"callee")};t.exports=u},5589:t=>{var e=Array.isArray;t.exports=e},568:(t,e,r)=>{var n=r(5563),o=r(6052);t.exports=function(t){return null!=t&&o(t.length)&&!n(t)}},8268:(t,e,r)=>{var n=r(568),o=r(440);t.exports=function(t){return o(t)&&n(t)}},5778:(t,e,r)=>{t=r.nmd(t);var n=r(3250),o=r(7999),i=e&&!e.nodeType&&e,s=i&&t&&!t.nodeType&&t,a=s&&s.exports===i?n.Buffer:void 0,u=(a?a.isBuffer:void 0)||o;t.exports=u},9787:(t,e,r)=>{var n=r(1351),o=r(7493),i=r(9312),s=r(5589),a=r(568),u=r(5778),d=r(2840),h=r(922),c=Object.prototype.hasOwnProperty;t.exports=function(t){if(null==t)return!0;if(a(t)&&(s(t)||"string"==typeof t||"function"==typeof t.splice||u(t)||h(t)||i(t)))return!t.length;var e=o(t);if("[object Map]"==e||"[object Set]"==e)return!t.size;if(d(t))return!n(t).length;for(var r in t)if(c.call(t,r))return!1;return!0}},5563:(t,e,r)=>{var n=r(9823),o=r(3702);t.exports=function(t){if(!o(t))return!1;var e=n(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e}},6052:t=>{t.exports=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}},7613:(t,e,r)=>{var n=r(2275),o=r(1525),i=r(8690),s=i&&i.isMap,a=s?o(s):n;t.exports=a},3702:t=>{t.exports=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}},440:t=>{t.exports=function(t){return null!=t&&"object"==typeof t}},4256:(t,e,r)=>{var n=r(9823),o=r(8490),i=r(440),s=Function.prototype,a=Object.prototype,u=s.toString,d=a.hasOwnProperty,h=u.call(Object);t.exports=function(t){if(!i(t)||"[object Object]"!=n(t))return!1;var e=o(t);if(null===e)return!0;var r=d.call(e,"constructor")&&e.constructor;return"function"==typeof r&&r instanceof r&&u.call(r)==h}},693:(t,e,r)=>{var n=r(7170),o=r(1525),i=r(8690),s=i&&i.isSet,a=s?o(s):n;t.exports=a},6705:(t,e,r)=>{var n=r(9823),o=r(5589),i=r(440);t.exports=function(t){return"string"==typeof t||!o(t)&&i(t)&&"[object String]"==n(t)}},2624:(t,e,r)=>{var n=r(9823),o=r(440);t.exports=function(t){return"symbol"==typeof t||o(t)&&"[object Symbol]"==n(t)}},922:(t,e,r)=>{var n=r(2448),o=r(1525),i=r(8690),s=i&&i.isTypedArray,a=s?o(s):n;t.exports=a},6474:t=>{t.exports=function(t){return void 0===t}},2096:(t,e,r)=>{var n=r(5825),o=r(1351),i=r(568);t.exports=function(t){return i(t)?n(t):o(t)}},9882:(t,e,r)=>{var n=r(5825),o=r(1309),i=r(568);t.exports=function(t){return i(t)?n(t,!0):o(t)}},7875:t=>{t.exports=function(t){var e=null==t?0:t.length;return e?t[e-1]:void 0}},9107:(t,e,r)=>{var n=r(9233),o=r(5833),i=r(8068),s=r(5589);t.exports=function(t,e){return(s(t)?n:i)(t,o(e,3))}},1230:(t,e,r)=>{var n=r(7500),o=r(4003),i=r(5833);t.exports=function(t,e){var r={};return e=i(e,3),o(t,(function(t,o,i){n(r,o,e(t,o,i))})),r}},6492:(t,e,r)=>{var n=r(5117),o=r(1669),i=r(229);t.exports=function(t){return t&&t.length?n(t,i,o):void 0}},7997:(t,e,r)=>{var n=r(5678);function o(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new TypeError("Expected a function");var r=function(){var n=arguments,o=e?e.apply(this,n):n[0],i=r.cache;if(i.has(o))return i.get(o);var s=t.apply(this,n);return r.cache=i.set(o,s)||i,s};return r.cache=new(o.Cache||n),r}o.Cache=n,t.exports=o},8469:(t,e,r)=>{var n=r(2133),o=r(6948)((function(t,e,r){n(t,e,r)}));t.exports=o},5071:(t,e,r)=>{var n=r(5117),o=r(6718),i=r(229);t.exports=function(t){return t&&t.length?n(t,i,o):void 0}},6838:(t,e,r)=>{var n=r(5117),o=r(5833),i=r(6718);t.exports=function(t,e){return t&&t.length?n(t,o(e,2),i):void 0}},1607:t=>{t.exports=function(){}},231:(t,e,r)=>{var n=r(3250);t.exports=function(){return n.Date.now()}},9335:(t,e,r)=>{var n=r(1785),o=r(3273)((function(t,e){return null==t?{}:n(t,e)}));t.exports=o},4437:(t,e,r)=>{var n=r(6174),o=r(3293),i=r(5130),s=r(6040);t.exports=function(t){return i(t)?n(s(t)):o(t)}},8569:(t,e,r)=>{var n=r(1523)();t.exports=n},7682:(t,e,r)=>{var n=r(5115),o=r(1701),i=r(5833),s=r(4306),a=r(5589);t.exports=function(t,e,r){var u=a(t)?n:s,d=arguments.length<3;return u(t,i(e,4),r,d,o)}},1039:(t,e,r)=>{var n=r(1351),o=r(7493),i=r(568),s=r(6705),a=r(1324);t.exports=function(t){if(null==t)return 0;if(i(t))return s(t)?a(t):t.length;var e=o(t);return"[object Map]"==e||"[object Set]"==e?t.size:n(t).length}},1635:(t,e,r)=>{var n=r(6640),o=r(3980),i=r(9735),s=r(8132),a=i((function(t,e){if(null==t)return[];var r=e.length;return r>1&&s(t,e[0],e[1])?e=[]:r>2&&s(e[0],e[1],e[2])&&(e=[e[0]]),o(t,n(e,1),[])}));t.exports=a},4506:t=>{t.exports=function(){return[]}},7999:t=>{t.exports=function(){return!1}},9558:(t,e,r)=>{var n=r(9153),o=1/0;t.exports=function(t){return t?(t=n(t))===o||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0}},6843:(t,e,r)=>{var n=r(9558);t.exports=function(t){var e=n(t),r=e%1;return e==e?r?e-r:e:0}},9153:(t,e,r)=>{var n=r(1656),o=r(3702),i=r(2624),s=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,u=/^0o[0-7]+$/i,d=parseInt;t.exports=function(t){if("number"==typeof t)return t;if(i(t))return NaN;if(o(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=o(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=n(t);var r=a.test(t);return r||u.test(t)?d(t.slice(2),r?2:8):s.test(t)?NaN:+t}},6222:(t,e,r)=>{var n=r(8618),o=r(9882);t.exports=function(t){return n(t,o(t))}},9835:(t,e,r)=>{var n=r(6245);t.exports=function(t){return null==t?"":n(t)}},3604:(t,e,r)=>{var n=r(4004),o=r(7890),i=r(4003),s=r(5833),a=r(8490),u=r(5589),d=r(5778),h=r(5563),c=r(3702),l=r(922);t.exports=function(t,e,r){var f=u(t),g=f||d(t)||l(t);if(e=s(e,4),null==r){var p=t&&t.constructor;r=g?f?new p:[]:c(t)&&h(p)?o(a(t)):{}}return(g?n:i)(t,(function(t,n,o){return e(r,t,n,o)})),r}},7767:(t,e,r)=>{var n=r(6640),o=r(9735),i=r(135),s=r(8268),a=o((function(t){return i(n(t,1,s,!0))}));t.exports=a},1422:(t,e,r)=>{var n=r(9835),o=0;t.exports=function(t){var e=++o;return n(t)+e}},1682:(t,e,r)=>{var n=r(71),o=r(2096);t.exports=function(t){return null==t?[]:n(t,o(t))}},4142:(t,e,r)=>{var n=r(3192),o=r(6302);t.exports=function(t,e){return o(t||[],e||[],n)}}},e={};function r(n){var o=e[n];if(void 0!==o)return o.exports;var i=e[n]={id:n,loaded:!1,exports:{}};return t[n](i,i.exports,r),i.loaded=!0,i.exports}r.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return r.d(e,{a:e}),e},r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.nmd=t=>(t.paths=[],t.children||(t.children=[]),t);var n={};(()=>{"use strict";function t(t,e,r,n){return new(r||(r=Promise))((function(o,i){function s(t){try{u(n.next(t))}catch(t){i(t)}}function a(t){try{u(n.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))}r.d(n,{calculateLayout:()=>ro,stopLayout:()=>eo}),Object.create,Object.create;const e=function(){function t(){this._events={}}return t.prototype.on=function(t,e,r){return this._events[t]||(this._events[t]=[]),this._events[t].push({callback:e,once:!!r}),this},t.prototype.once=function(t,e){return this.on(t,e,!0)},t.prototype.emit=function(t){for(var e=this,r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];var o=this._events[t]||[],i=this._events["*"]||[],s=function(n){for(var o=n.length,i=0;i<o;i++)if(n[i]){var s=n[i],a=s.callback;s.once&&(n.splice(i,1),0===n.length&&delete e._events[t],o--,i--),a.apply(e,r)}};s(o),s(i)},t.prototype.off=function(t,e){if(t)if(e){for(var r=this._events[t]||[],n=r.length,o=0;o<n;o++)r[o].callback===e&&(r.splice(o,1),n--,o--);0===r.length&&delete this._events[t]}else delete this._events[t];else this._events={};return this},t.prototype.getEvents=function(){return this._events},t}();function o(t,e,r,n){for(;t.length;){const o=t.shift();if(r(o))return!0;e.add(o.id),n(o.id).forEach((r=>{e.has(r.id)||(e.add(r.id),t.push(r))}))}return!1}function i(t,e,r,n){if(r(t))return!0;e.add(t.id);for(const o of n(t.id))if(!e.has(o.id)&&i(o,e,r,n))return!0;return!1}const s=()=>!0;class a{graph;nodeFilter;edgeFilter;cacheEnabled;inEdgesMap=new Map;outEdgesMap=new Map;bothEdgesMap=new Map;allNodesMap=new Map;allEdgesMap=new Map;constructor(t){this.graph=t.graph;const e=t.nodeFilter||s,r=t.edgeFilter||s;this.nodeFilter=e,this.edgeFilter=t=>{const{source:n,target:o}=this.graph.getEdgeDetail(t.id);return!(!e(n)||!e(o))&&r(t,n,o)},"auto"===t.cache?(this.cacheEnabled=!0,this.startAutoCache()):"manual"===t.cache?this.cacheEnabled=!0:this.cacheEnabled=!1}clearCache=()=>{this.inEdgesMap.clear(),this.outEdgesMap.clear(),this.bothEdgesMap.clear(),this.allNodesMap.clear(),this.allEdgesMap.clear()};refreshCache=()=>{this.clearCache(),this.updateCache(this.graph.getAllNodes().map((t=>t.id)))};updateCache=t=>{const e=new Set;t.forEach((t=>{const r=this.bothEdgesMap.get(t);if(r&&r.forEach((t=>e.add(t.id))),this.hasNode(t)){const r=this.graph.getRelatedEdges(t,"in").filter(this.edgeFilter),n=this.graph.getRelatedEdges(t,"out").filter(this.edgeFilter),o=Array.from(new Set([...r,...n]));o.forEach((t=>e.add(t.id))),this.inEdgesMap.set(t,r),this.outEdgesMap.set(t,n),this.bothEdgesMap.set(t,o),this.allNodesMap.set(t,this.graph.getNode(t))}else this.inEdgesMap.delete(t),this.outEdgesMap.delete(t),this.bothEdgesMap.delete(t),this.allNodesMap.delete(t)})),e.forEach((t=>{this.hasEdge(t)?this.allEdgesMap.set(t,this.graph.getEdge(t)):this.allEdgesMap.delete(t)}))};startAutoCache(){this.refreshCache(),this.graph.on("changed",this.handleGraphChanged)}stopAutoCache(){this.graph.off("changed",this.handleGraphChanged)}handleGraphChanged=t=>{const e=new Set;t.changes.forEach((r=>{switch(r.type){case"NodeAdded":case"NodeRemoved":e.add(r.value.id);break;case"NodeDataUpdated":e.add(r.id);break;case"EdgeAdded":case"EdgeRemoved":e.add(r.value.source),e.add(r.value.target);break;case"EdgeUpdated":"source"!==r.propertyName&&"target"!==r.propertyName||(e.add(r.oldValue),e.add(r.newValue));break;case"EdgeDataUpdated":if(t.graph.hasEdge(r.id)){const n=t.graph.getEdge(r.id);e.add(n.source),e.add(n.target)}}})),this.updateCache(e)};checkNodeExistence(t){this.getNode(t)}hasNode(t){if(!this.graph.hasNode(t))return!1;const e=this.graph.getNode(t);return this.nodeFilter(e)}areNeighbors(t,e){return this.checkNodeExistence(t),this.getNeighbors(e).some((e=>e.id===t))}getNode(t){const e=this.graph.getNode(t);if(!this.nodeFilter(e))throw new Error("Node not found for id: "+t);return e}getRelatedEdges(t,e){return this.checkNodeExistence(t),this.cacheEnabled?"in"===e?this.inEdgesMap.get(t):"out"===e?this.outEdgesMap.get(t):this.bothEdgesMap.get(t):this.graph.getRelatedEdges(t,e).filter(this.edgeFilter)}getDegree(t,e){return this.getRelatedEdges(t,e).length}getSuccessors(t){const e=this.getRelatedEdges(t,"out").map((t=>this.getNode(t.target)));return Array.from(new Set(e))}getPredecessors(t){const e=this.getRelatedEdges(t,"in").map((t=>this.getNode(t.source)));return Array.from(new Set(e))}getNeighbors(t){const e=this.getPredecessors(t),r=this.getSuccessors(t);return Array.from(new Set([...e,...r]))}hasEdge(t){if(!this.graph.hasEdge(t))return!1;const e=this.graph.getEdge(t);return this.edgeFilter(e)}getEdge(t){const e=this.graph.getEdge(t);if(!this.edgeFilter(e))throw new Error("Edge not found for id: "+t);return e}getEdgeDetail(t){const e=this.getEdge(t);return{edge:e,source:this.getNode(e.source),target:this.getNode(e.target)}}hasTreeStructure(t){return this.graph.hasTreeStructure(t)}getRoots(t){return this.graph.getRoots(t).filter(this.nodeFilter)}getChildren(t,e){return this.checkNodeExistence(t),this.graph.getChildren(t,e).filter(this.nodeFilter)}getParent(t,e){this.checkNodeExistence(t);const r=this.graph.getParent(t,e);return r&&this.nodeFilter(r)?r:null}getAllNodes(){return this.cacheEnabled?Array.from(this.allNodesMap.values()):this.graph.getAllNodes().filter(this.nodeFilter)}getAllEdges(){return this.cacheEnabled?Array.from(this.allEdgesMap.values()):this.graph.getAllEdges().filter(this.edgeFilter)}bfs(t,e,r="out"){const n={in:this.getPredecessors.bind(this),out:this.getSuccessors.bind(this),both:this.getNeighbors.bind(this)}[r];o([this.getNode(t)],new Set,e,n)}dfs(t,e,r="out"){const n={in:this.getPredecessors.bind(this),out:this.getSuccessors.bind(this),both:this.getNeighbors.bind(this)}[r];i(this.getNode(t),new Set,e,n)}}class u extends e{nodeMap=new Map;edgeMap=new Map;inEdgesMap=new Map;outEdgesMap=new Map;bothEdgesMap=new Map;treeIndices=new Map;changes=[];batchCount=0;onChanged=()=>{};constructor(t){super(),t&&(t.nodes&&this.addNodes(t.nodes),t.edges&&this.addEdges(t.edges),t.tree&&this.addTree(t.tree),t.onChanged&&(this.onChanged=t.onChanged))}batch=t=>{this.batchCount+=1,t(),this.batchCount-=1,this.batchCount||this.commit()};commit(){const t=this.changes;this.changes=[];const e={graph:this,changes:t};this.emit("changed",e),this.onChanged(e)}reduceChanges(t){let e=[];return t.forEach((t=>{switch(t.type){case"NodeRemoved":{let r=!1;e=e.filter((e=>{if("NodeAdded"===e.type){const n=e.value.id===t.value.id;return n&&(r=!0),!n}return"NodeDataUpdated"===e.type?e.id!==t.value.id:"TreeStructureChanged"!==e.type||e.nodeId!==t.value.id})),r||e.push(t);break}case"EdgeRemoved":{let r=!1;e=e.filter((e=>{if("EdgeAdded"===e.type){const n=e.value.id===t.value.id;return n&&(r=!0),!n}return"EdgeDataUpdated"!==e.type&&"EdgeUpdated"!==e.type||e.id!==t.value.id})),r||e.push(t);break}case"NodeDataUpdated":case"EdgeDataUpdated":case"EdgeUpdated":{const r=e.findIndex((e=>e.type===t.type&&e.id===t.id&&(void 0===t.propertyName||e.propertyName===t.propertyName))),n=e[r];n?void 0!==t.propertyName?n.newValue=t.newValue:(e.splice(r,1),e.push(t)):e.push(t);break}case"TreeStructureDetached":e=e.filter((e=>"TreeStructureAttached"===e.type?e.treeKey!==t.treeKey:"TreeStructureChanged"!==e.type||e.treeKey!==t.treeKey)),e.push(t);break;case"TreeStructureChanged":{const r=e.find((e=>"TreeStructureChanged"===e.type&&e.treeKey===t.treeKey&&e.nodeId===t.nodeId));r?r.newParentId=t.newParentId:e.push(t);break}default:e.push(t)}})),e}checkNodeExistence(t){this.getNode(t)}hasNode(t){return this.nodeMap.has(t)}areNeighbors(t,e){return this.getNeighbors(e).some((e=>e.id===t))}getNode(t){const e=this.nodeMap.get(t);if(!e)throw new Error("Node not found for id: "+t);return e}getRelatedEdges(t,e){if(this.checkNodeExistence(t),"in"===e){const e=this.inEdgesMap.get(t);return Array.from(e)}if("out"===e){const e=this.outEdgesMap.get(t);return Array.from(e)}{const e=this.bothEdgesMap.get(t);return Array.from(e)}}getDegree(t,e){return this.getRelatedEdges(t,e).length}getSuccessors(t){const e=this.getRelatedEdges(t,"out").map((t=>this.getNode(t.target)));return Array.from(new Set(e))}getPredecessors(t){const e=this.getRelatedEdges(t,"in").map((t=>this.getNode(t.source)));return Array.from(new Set(e))}getNeighbors(t){const e=this.getPredecessors(t),r=this.getSuccessors(t);return Array.from(new Set([...e,...r]))}doAddNode(t){if(this.hasNode(t.id))throw new Error("Node already exists: "+t.id);this.nodeMap.set(t.id,t),this.inEdgesMap.set(t.id,new Set),this.outEdgesMap.set(t.id,new Set),this.bothEdgesMap.set(t.id,new Set),this.treeIndices.forEach((e=>{e.childrenMap.set(t.id,new Set)})),this.changes.push({type:"NodeAdded",value:t})}addNodes(t){this.batch((()=>{for(const e of t)this.doAddNode(e)}))}addNode(t){this.addNodes([t])}doRemoveNode(t){const e=this.getNode(t),r=this.bothEdgesMap.get(t);r?.forEach((t=>this.doRemoveEdge(t.id))),this.nodeMap.delete(t),this.treeIndices.forEach((r=>{r.childrenMap.get(t)?.forEach((t=>{r.parentMap.delete(t.id)}));const n=r.parentMap.get(t);n&&r.childrenMap.get(n.id)?.delete(e),r.parentMap.delete(t),r.childrenMap.delete(t)})),this.bothEdgesMap.delete(t),this.inEdgesMap.delete(t),this.outEdgesMap.delete(t),this.changes.push({type:"NodeRemoved",value:e})}removeNodes(t){this.batch((()=>{t.forEach((t=>this.doRemoveNode(t)))}))}removeNode(t){this.removeNodes([t])}updateNodeDataProperty(t,e,r){const n=this.getNode(t);this.batch((()=>{const o=n.data[e],i=r;n.data[e]=i,this.changes.push({type:"NodeDataUpdated",id:t,propertyName:e,oldValue:o,newValue:i})}))}mergeNodeData(t,e){this.batch((()=>{Object.entries(e).forEach((([e,r])=>{this.updateNodeDataProperty(t,e,r)}))}))}updateNodeData(...t){const e=t[0],r=this.getNode(e);if("string"==typeof t[1])return void this.updateNodeDataProperty(e,t[1],t[2]);let n;if("function"==typeof t[1]){const e=t[1];n=e(r.data)}else"object"==typeof t[1]&&(n=t[1]);this.batch((()=>{const t=r.data,o=n;r.data=n,this.changes.push({type:"NodeDataUpdated",id:e,oldValue:t,newValue:o})}))}checkEdgeExistence(t){if(!this.hasEdge(t))throw new Error("Edge not found for id: "+t)}hasEdge(t){return this.edgeMap.has(t)}getEdge(t){return this.checkEdgeExistence(t),this.edgeMap.get(t)}getEdgeDetail(t){const e=this.getEdge(t);return{edge:e,source:this.getNode(e.source),target:this.getNode(e.target)}}doAddEdge(t){if(this.hasEdge(t.id))throw new Error("Edge already exists: "+t.id);this.checkNodeExistence(t.source),this.checkNodeExistence(t.target),this.edgeMap.set(t.id,t);const e=this.inEdgesMap.get(t.target),r=this.outEdgesMap.get(t.source),n=this.bothEdgesMap.get(t.source),o=this.bothEdgesMap.get(t.target);e.add(t),r.add(t),n.add(t),o.add(t),this.changes.push({type:"EdgeAdded",value:t})}addEdges(t){this.batch((()=>{for(const e of t)this.doAddEdge(e)}))}addEdge(t){this.addEdges([t])}doRemoveEdge(t){const e=this.getEdge(t),r=this.outEdgesMap.get(e.source),n=this.inEdgesMap.get(e.target),o=this.bothEdgesMap.get(e.source),i=this.bothEdgesMap.get(e.target);r.delete(e),n.delete(e),o.delete(e),i.delete(e),this.edgeMap.delete(t),this.changes.push({type:"EdgeRemoved",value:e})}removeEdges(t){this.batch((()=>{t.forEach((t=>this.doRemoveEdge(t)))}))}removeEdge(t){this.removeEdges([t])}updateEdgeSource(t,e){const r=this.getEdge(t);this.checkNodeExistence(e);const n=r.source,o=e;this.outEdgesMap.get(n).delete(r),this.bothEdgesMap.get(n).delete(r),this.outEdgesMap.get(o).add(r),this.bothEdgesMap.get(o).add(r),r.source=e,this.batch((()=>{this.changes.push({type:"EdgeUpdated",id:t,propertyName:"source",oldValue:n,newValue:o})}))}updateEdgeTarget(t,e){const r=this.getEdge(t);this.checkNodeExistence(e);const n=r.target,o=e;this.inEdgesMap.get(n).delete(r),this.bothEdgesMap.get(n).delete(r),this.inEdgesMap.get(o).add(r),this.bothEdgesMap.get(o).add(r),r.target=e,this.batch((()=>{this.changes.push({type:"EdgeUpdated",id:t,propertyName:"target",oldValue:n,newValue:o})}))}updateEdgeDataProperty(t,e,r){const n=this.getEdge(t);this.batch((()=>{const o=n.data[e],i=r;n.data[e]=i,this.changes.push({type:"EdgeDataUpdated",id:t,propertyName:e,oldValue:o,newValue:i})}))}updateEdgeData(...t){const e=t[0],r=this.getEdge(e);if("string"==typeof t[1])return void this.updateEdgeDataProperty(e,t[1],t[2]);let n;if("function"==typeof t[1]){const e=t[1];n=e(r.data)}else"object"==typeof t[1]&&(n=t[1]);this.batch((()=>{const t=r.data,o=n;r.data=n,this.changes.push({type:"EdgeDataUpdated",id:e,oldValue:t,newValue:o})}))}mergeEdgeData(t,e){this.batch((()=>{Object.entries(e).forEach((([e,r])=>{this.updateEdgeDataProperty(t,e,r)}))}))}checkTreeExistence(t){if(!this.hasTreeStructure(t))throw new Error("Tree structure not found for treeKey: "+t)}hasTreeStructure(t){return this.treeIndices.has(t)}attachTreeStructure(t){this.treeIndices.has(t)||(this.treeIndices.set(t,{parentMap:new Map,childrenMap:new Map}),this.batch((()=>{this.changes.push({type:"TreeStructureAttached",treeKey:t})})))}detachTreeStructure(t){this.checkTreeExistence(t),this.treeIndices.delete(t),this.batch((()=>{this.changes.push({type:"TreeStructureDetached",treeKey:t})}))}addTree(t,e){this.batch((()=>{this.attachTreeStructure(e);const r=[],n=Array.isArray(t)?t:[t];for(;n.length;){const t=n.shift();r.push(t),t.children&&n.push(...t.children)}this.addNodes(r),r.forEach((t=>{t.children?.forEach((r=>{this.setParent(r.id,t.id,e)}))}))}))}getRoots(t){return this.checkTreeExistence(t),this.getAllNodes().filter((e=>!this.getParent(e.id,t)))}getChildren(t,e){this.checkNodeExistence(t),this.checkTreeExistence(e);const r=this.treeIndices.get(e).childrenMap.get(t);return Array.from(r||[])}getParent(t,e){return this.checkNodeExistence(t),this.checkTreeExistence(e),this.treeIndices.get(e).parentMap.get(t)||null}getAncestors(t,e){const r=[];let n,o=this.getNode(t);for(;n=this.getParent(o.id,e);)r.push(n),o=n;return r}setParent(t,e,r){this.checkTreeExistence(r);const n=this.treeIndices.get(r),o=this.getNode(t),i=n.parentMap.get(t);if(i?.id===e)return;if(void 0===e)return i&&n.childrenMap.get(i.id)?.delete(o),void n.parentMap.delete(t);const s=this.getNode(e);n.parentMap.set(t,s),i&&n.childrenMap.get(i.id)?.delete(o);let a=n.childrenMap.get(s.id);a||(a=new Set,n.childrenMap.set(s.id,a)),a.add(o),this.batch((()=>{this.changes.push({type:"TreeStructureChanged",treeKey:r,nodeId:t,oldParentId:i?.id,newParentId:s.id})}))}dfsTree(t,e,r){return i(this.getNode(t),new Set,e,(t=>this.getChildren(t,r)))}bfsTree(t,e,r){return o([this.getNode(t)],new Set,e,(t=>this.getChildren(t,r)))}getAllNodes(){return Array.from(this.nodeMap.values())}getAllEdges(){return Array.from(this.edgeMap.values())}bfs(t,e,r="out"){const n={in:this.getPredecessors.bind(this),out:this.getSuccessors.bind(this),both:this.getNeighbors.bind(this)}[r];return o([this.getNode(t)],new Set,e,n)}dfs(t,e,r="out"){const n={in:this.getPredecessors.bind(this),out:this.getSuccessors.bind(this),both:this.getNeighbors.bind(this)}[r];return i(this.getNode(t),new Set,e,n)}clone(){const t=this.getAllNodes().map((t=>({...t,data:{...t.data}}))),e=this.getAllEdges().map((t=>({...t,data:{...t.data}}))),r=new u({nodes:t,edges:e});return this.treeIndices.forEach((({parentMap:t,childrenMap:e},n)=>{const o=new Map;t.forEach(((t,e)=>{o.set(e,r.getNode(t.id))}));const i=new Map;e.forEach(((t,e)=>{i.set(e,new Set(Array.from(t).map((t=>r.getNode(t.id)))))})),r.treeIndices.set(n,{parentMap:o,childrenMap:i})})),r}toJSON(){return JSON.stringify({nodes:this.getAllNodes(),edges:this.getAllEdges()})}createView(t){return new a({graph:this,...t})}}var d={}.toString;const h=function(t,e){return d.call(t)==="[object "+e+"]"},c=function(t){return h(t,"Number")},l=(t,e)=>{if("next"!==t&&"prev"!==t)return e},f=t=>{t.prev.next=t.next,t.next.prev=t.prev,delete t.next,delete t.prev};class g{constructor(){const t={};t.prev=t,t.next=t.prev,this.shortcut=t}dequeue(){const t=this.shortcut,e=t.prev;if(e&&e!==t)return f(e),e}enqueue(t){const e=this.shortcut;t.prev&&t.next&&f(t),t.next=e.next,e.next.prev=t,e.next=t,t.prev=e}toString(){const t=[],e=this.shortcut;let r=e.prev;for(;r!==e;)t.push(JSON.stringify(r,l)),r=null==r?void 0:r.prev;return`[${t.join(", ")}]`}}class p extends g{}const v=()=>1,y=(t,e,r,n,o)=>{var i,s;const a=[];return t.hasNode(n.v)&&(null===(i=t.getRelatedEdges(n.v,"in"))||void 0===i||i.forEach((n=>{const i=n.data.weight,s=t.getNode(n.source);o&&a.push({v:n.source,w:n.target,in:0,out:0}),void 0===s.data.out&&(s.data.out=0),s.data.out-=i,m(e,r,Object.assign({v:s.id},s.data))})),null===(s=t.getRelatedEdges(n.v,"out"))||void 0===s||s.forEach((n=>{const o=n.data.weight,i=n.target,s=t.getNode(i);void 0===s.data.in&&(s.data.in=0),s.data.in-=o,m(e,r,Object.assign({v:s.id},s.data))})),t.removeNode(n.v)),o?a:void 0},m=(t,e,r)=>{r.out?r.in?t[r.out-r.in+e].enqueue(r):t[t.length-1].enqueue(r):t[0].enqueue(r)},w=(t,e)=>{const r="greedy"===e?(t=>{var e;if(t.getAllNodes().length<=1)return[];const r=((t,e)=>{const r=new u;let n=0,o=0;t.getAllNodes().forEach((t=>{r.addNode({id:t.id,data:{v:t.id,in:0,out:0}})})),t.getAllEdges().forEach((t=>{const i=r.getRelatedEdges(t.source,"out").find((e=>e.target===t.target)),s=(null==e?void 0:e(t))||1;i?r.updateEdgeData(null==i?void 0:i.id,Object.assign(Object.assign({},i.data),{weight:i.data.weight+s})):r.addEdge({id:t.id,source:t.source,target:t.target,data:{weight:s}}),o=Math.max(o,r.getNode(t.source).data.out+=s),n=Math.max(n,r.getNode(t.target).data.in+=s)}));const i=[],s=o+n+3;for(let t=0;t<s;t++)i.push(new p);const a=n+1;return r.getAllNodes().forEach((t=>{m(i,a,Object.assign({v:t.id},r.getNode(t.id).data))})),{buckets:i,zeroIdx:a,graph:r}})(t,(t=>t.data.weight||1)||v);return null===(e=((t,e,r)=>{let n=[];const o=e[e.length-1],i=e[0];let s;for(;t.getAllNodes().length;){for(;s=i.dequeue();)y(t,e,r,s);for(;s=o.dequeue();)y(t,e,r,s);if(t.getAllNodes().length)for(let o=e.length-2;o>0;--o)if(s=e[o].dequeue(),s){n=n.concat(y(t,e,r,s,!0));break}}return n})(r.graph,r.buckets,r.zeroIdx).map((e=>t.getRelatedEdges(e.v,"out").filter((({target:t})=>t===e.w)))))||void 0===e?void 0:e.flat()})(t):x(t);null==r||r.forEach((e=>{const r=e.data;t.removeEdge(e.id),r.forwardName=e.data.name,r.reversed=!0,t.addEdge({id:e.id,source:e.target,target:e.source,data:Object.assign({},r)})}))},x=t=>{const e=[],r={},n={},o=i=>{n[i]||(n[i]=!0,r[i]=!0,t.getRelatedEdges(i,"out").forEach((t=>{r[t.target]?e.push(t):o(t.target)})),delete r[i])};return t.getAllNodes().forEach((t=>o(t.id))),e},b=(t,e,r,n)=>{let o;do{o=`${n}${Math.random()}`}while(t.hasNode(o));return r.dummy=e,t.addNode({id:o,data:r}),o},E=t=>{const e=new u;return t.getAllNodes().forEach((r=>{t.getChildren(r.id).length||e.addNode(Object.assign({},r))})),t.getAllEdges().forEach((t=>{e.addEdge(t)})),e},N=(t,e)=>{const r=Number(t.x),n=Number(t.y),o=Number(e.x)-r,i=Number(e.y)-n;let s,a,u=Number(t.width)/2,d=Number(t.height)/2;return o||i?(Math.abs(i)*u>Math.abs(o)*d?(i<0&&(d=-d),s=d*o/i,a=d):(o<0&&(u=-u),s=u,a=u*i/o),{x:r+s,y:n+a}):{x:0,y:0}},_=t=>{const e=[],r=k(t)+1;for(let t=0;t<r;t++)e.push([]);t.getAllNodes().forEach((t=>{const r=t.data.rank;void 0!==r&&e[r]&&e[r].push(t.id)}));for(let n=0;n<r;n++)e[n]=e[n].sort(((e,r)=>{return n=t.getNode(e).data.order,o=t.getNode(r).data.order,Number(n)-Number(o);var n,o}));return e},M=(t,e,r,n)=>{const o={width:0,height:0};return c(r)&&c(n)&&(o.rank=r,o.order=n),b(t,"border",o,e)},k=t=>{let e;return t.getAllNodes().forEach((t=>{const r=t.data.rank;void 0!==r&&(void 0===e||r>e)&&(e=r)})),e||(e=0),e},A=(t,e)=>t.reduce(((t,r)=>e(t)>e(r)?r:t)),j=(t,e,r,n,o,i)=>{n.includes(e.id)||(n.push(e.id),r||i.push(e.id),o(e.id).forEach((e=>j(t,e,r,n,o,i))),r&&i.push(e.id))},O=(t,e,r,n)=>{const o=Array.isArray(e)?e:[e],i=e=>n?t.getSuccessors(e):t.getNeighbors(e),s=[],a=[];return o.forEach((e=>{if(!t.hasNode(e.id))throw new Error(`Graph does not have node: ${e}`);j(t,e,"post"===r,a,i,s)})),s},S=(t,e,r,n,o,i)=>{const s={rank:i,borderType:e,width:0,height:0},a=o.data[e][i-1],u=b(t,"border",s,r);o.data[e][i]=u,t.setParent(u,n),a&&t.addEdge({id:`e${Math.random()}`,source:a,target:u,data:{weight:1}})},z=t=>{t.getAllNodes().forEach((t=>{R(t)})),t.getAllEdges().forEach((t=>{R(t)}))},R=t=>{const e=t.data.width;t.data.width=t.data.height,t.data.height=e},I=t=>{(null==t?void 0:t.y)&&(t.y=-t.y)},P=t=>{const e=t.x;t.x=t.y,t.y=e},C=(t,e,r,n,o,i,s)=>{const a=t.getChildren(s);if(!(null==a?void 0:a.length))return void(s!==e&&t.addEdge({id:`e${Math.random()}`,source:e,target:s,data:{weight:0,minlen:r}}));const u=M(t,"_bt"),d=M(t,"_bb"),h=t.getNode(s);t.setParent(u,s),h.data.borderTop=u,t.setParent(d,s),h.data.borderBottom=d,null==a||a.forEach((a=>{C(t,e,r,n,o,i,a.id);const h=a.data.borderTop?a.data.borderTop:a.id,c=a.data.borderBottom?a.data.borderBottom:a.id,l=a.data.borderTop?n:2*n,f=h!==c?1:o-i[s]+1;t.addEdge({id:`e${Math.random()}`,source:u,target:h,data:{minlen:f,weight:l,nestingEdge:!0}}),t.addEdge({id:`e${Math.random()}`,source:c,target:d,data:{minlen:f,weight:l,nestingEdge:!0}})})),t.getParent(s)||t.addEdge({id:`e${Math.random()}`,source:e,target:u,data:{weight:0,minlen:o+i[s]}})},D="edge-label",T=function(t){return Array.isArray?Array.isArray(t):h(t,"Array")};var L=function(t){if("object"!=typeof t||null===t)return t;var e;if(T(t)){e=[];for(var r=0,n=t.length;r<n;r++)"object"==typeof t[r]&&null!=t[r]?e[r]=L(t[r]):e[r]=t[r]}else for(var o in e={},t)"object"==typeof t[o]&&null!=t[o]?e[o]=L(t[o]):e[o]=t[o];return e};const F=L,q=(t,e,r)=>{const n=(i=r,s=r.map(((t,e)=>e)),null==i?void 0:i.reduce(((t,e,r)=>(t[e]=s[r],t)),{})),o=e.map((e=>{const r=t.getRelatedEdges(e,"out").map((t=>({pos:n[t.target]||0,weight:t.data.weight})));return null==r?void 0:r.sort(((t,e)=>t.pos-e.pos))})).flat().filter((t=>void 0!==t));var i,s;let a=1;for(;a<r.length;)a<<=1;const u=2*a-1;a-=1;const d=Array(u).fill(0,0,u);let h=0;return null==o||o.forEach((t=>{if(t){let e=t.pos+a;d[e]+=t.weight;let r=0;for(;e>0;)e%2&&(r+=d[e+1]),e=e-1>>1,d[e]+=t.weight;h+=t.weight*r}})),h},V=(t,e)=>{let r=0;for(let n=1;n<(null==e?void 0:e.length);n+=1)r+=q(t,e[n-1],e[n]);return r},B=t=>{const e={},r=t.getAllNodes(),n=r.map((t=>{var e;return null!==(e=t.data.rank)&&void 0!==e?e:-1/0})),o=Math.max(...n),i=[];for(let t=0;t<o+1;t++)i.push([]);const s=r.sort(((e,r)=>t.getNode(e.id).data.rank-t.getNode(r.id).data.rank)),a=s.filter((e=>void 0!==t.getNode(e.id).data.fixorder)).sort(((e,r)=>t.getNode(e.id).data.fixorder-t.getNode(r.id).data.fixorder));return null==a||a.forEach((r=>{isNaN(t.getNode(r.id).data.rank)||i[t.getNode(r.id).data.rank].push(r.id),e[r.id]=!0})),null==s||s.forEach((r=>t.dfsTree(r.id,(t=>{if(e.hasOwnProperty(t.id))return!0;e[t.id]=!0,isNaN(t.data.rank)||i[t.data.rank].push(t.id)})))),i},$=(t,e)=>{var r;let n=0,o=0;t.weight&&(n+=t.barycenter*t.weight,o+=t.weight),e.weight&&(n+=e.barycenter*e.weight,o+=e.weight),t.vs=null===(r=e.vs)||void 0===r?void 0:r.concat(t.vs),t.barycenter=n/o,t.weight=o,t.i=Math.min(e.i,t.i),e.merged=!0},G=(t,e)=>{var r,n,o;const i={};null==t||t.forEach(((t,e)=>{i[t.v]={i:e,indegree:0,in:[],out:[],vs:[t.v]};const r=i[t.v];void 0!==t.barycenter&&(r.barycenter=t.barycenter,r.weight=t.weight)})),null===(r=e.getAllEdges())||void 0===r||r.forEach((t=>{const e=i[t.source],r=i[t.target];void 0!==e&&void 0!==r&&(r.indegree++,e.out.push(i[t.target]))}));return(t=>{var e,r;const n=[];for(;null==t?void 0:t.length;){const o=t.pop();n.push(o),null===(e=o.in.reverse())||void 0===e||e.forEach((t=>{return(e=o,t=>{t.merged||(void 0===t.barycenter||void 0===e.barycenter||t.barycenter>=e.barycenter)&&$(e,t)})(t);var e})),null===(r=o.out)||void 0===r||r.forEach((e=>{return(r=o,e=>{e.in.push(r),0==--e.indegree&&t.push(e)})(e);var r}))}const o=n.filter((t=>!t.merged)),i=["vs","i","barycenter","weight"];return o.map((t=>{const e={};return null==i||i.forEach((r=>{void 0!==t[r]&&(e[r]=t[r])})),e}))})(null===(o=(n=Object.values(i)).filter)||void 0===o?void 0:o.call(n,(t=>!t.indegree)))},U=(t,e,r)=>{let n,o=r;for(;e.length&&(n=e[e.length-1]).i<=o;)e.pop(),null==t||t.push(n.vs),o++;return o},W=(t,e,r,n,o,i)=>{var s,a,u,d;let h=t.getChildren(e).map((t=>t.id));const c=t.getNode(e),l=c?c.data.borderLeft:void 0,f=c?c.data.borderRight:void 0,g={};l&&(h=null==h?void 0:h.filter((t=>t!==l&&t!==f)));const p=((t,e)=>e.map((e=>{const r=t.getRelatedEdges(e,"in");if(!(null==r?void 0:r.length))return{v:e};const n={sum:0,weight:0};return null==r||r.forEach((e=>{const r=t.getNode(e.source);n.sum+=e.data.weight*r.data.order,n.weight+=e.data.weight})),{v:e,barycenter:n.sum/n.weight,weight:n.weight}})))(t,h||[]);null==p||p.forEach((e=>{var o;if(null===(o=t.getChildren(e.v))||void 0===o?void 0:o.length){const o=W(t,e.v,r,n,i);g[e.v]=o,o.hasOwnProperty("barycenter")&&H(e,o)}}));const v=G(p,r);Y(v,g),null===(s=v.filter((t=>t.vs.length>0)))||void 0===s||s.forEach((e=>{const r=t.getNode(e.vs[0]);r&&(e.fixorder=r.data.fixorder,e.order=r.data.order)}));const y=((t,e,r,n)=>{const o=(t=>{const e={lhs:[],rhs:[]};return null==t||t.forEach((t=>{(t=>{const e=t.hasOwnProperty("fixorder")&&!isNaN(t.fixorder);return n?!e&&t.hasOwnProperty("barycenter"):e||t.hasOwnProperty("barycenter")})(t)?e.lhs.push(t):e.rhs.push(t)})),e})(t),i=o.lhs,s=o.rhs.sort(((t,e)=>-t.i- -e.i)),a=[];let u=0,d=0,h=0;null==i||i.sort(((t,e)=>(r,n)=>{if(void 0!==r.fixorder&&void 0!==n.fixorder)return r.fixorder-n.fixorder;if(r.barycenter<n.barycenter)return-1;if(r.barycenter>n.barycenter)return 1;if(e&&void 0!==r.order&&void 0!==n.order){if(r.order<n.order)return-1;if(r.order>n.order)return 1}return t?n.i-r.i:r.i-n.i})(!!e,!!r)),h=U(a,s,h),null==i||i.forEach((t=>{var e;h+=null===(e=t.vs)||void 0===e?void 0:e.length,a.push(t.vs),u+=t.barycenter*t.weight,d+=t.weight,h=U(a,s,h)}));const c={vs:a.flat()};return d&&(c.barycenter=u/d,c.weight=d),c})(v,n,o,i);if(l&&(y.vs=[l,y.vs,f].flat(),null===(a=t.getPredecessors(l))||void 0===a?void 0:a.length)){const e=t.getNode((null===(u=t.getPredecessors(l))||void 0===u?void 0:u[0].id)||""),r=t.getNode((null===(d=t.getPredecessors(f))||void 0===d?void 0:d[0].id)||"");y.hasOwnProperty("barycenter")||(y.barycenter=0,y.weight=0),y.barycenter=(y.barycenter*y.weight+e.data.order+r.data.order)/(y.weight+2),y.weight+=2}return y},Y=(t,e)=>{null==t||t.forEach((t=>{var r;const n=null===(r=t.vs)||void 0===r?void 0:r.map((t=>e[t]?e[t].vs:t));t.vs=n.flat()}))},H=(t,e)=>{void 0!==t.barycenter?(t.barycenter=(t.barycenter*t.weight+e.barycenter*e.weight)/(t.weight+e.weight),t.weight+=e.weight):(t.barycenter=e.barycenter,t.weight=e.weight)},K=(t,e,r)=>e.map((e=>((t,e,r)=>{const n=(t=>{let e;for(;t.hasNode(e=`_root${Math.random()}`););return e})(t),o=new u({tree:[{id:n,children:[],data:{}}]});return t.getAllNodes().forEach((i=>{const s=t.getParent(i.id);(i.data.rank===e||i.data.minRank<=e&&e<=i.data.maxRank)&&(o.hasNode(i.id)||o.addNode(Object.assign({},i)),(null==s?void 0:s.id)&&!o.hasNode(null==s?void 0:s.id)&&o.addNode(Object.assign({},s)),o.setParent(i.id,(null==s?void 0:s.id)||n),t.getRelatedEdges(i.id,r).forEach((e=>{const r=e.source===i.id?e.target:e.source;o.hasNode(r)||o.addNode(Object.assign({},t.getNode(r)));const n=o.getRelatedEdges(r,"out").find((({target:t})=>t===i.id)),s=void 0!==n?n.data.weight:0;n?o.updateEdgeData(n.id,Object.assign(Object.assign({},n.data),{weight:e.data.weight+s})):o.addEdge({id:e.id,source:r,target:i.id,data:{weight:e.data.weight+s}})})),i.data.hasOwnProperty("minRank")&&o.updateNodeData(i.id,Object.assign(Object.assign({},i.data),{borderLeft:i.data.borderLeft[e],borderRight:i.data.borderRight[e]})))})),o})(t,e,r))),J=(t,e,r,n)=>{const o=new u;null==t||t.forEach((t=>{var i;const s=t.getRoots()[0].id,a=W(t,s,o,e,r,n);for(let e=0;e<(null===(i=a.vs)||void 0===i?void 0:i.length);e++){const r=t.getNode(a.vs[e]);r&&(r.data.order=e)}((t,e,r)=>{const n={};let o;null==r||r.forEach((r=>{let i,s,a=t.getParent(r);for(;a;){if(i=t.getParent(a.id),i?(s=n[i.id],n[i.id]=a.id):(s=o,o=a.id),s&&s!==a.id)return e.hasNode(s)||e.addNode({id:s,data:{}}),e.hasNode(a.id)||e.addNode({id:a.id,data:{}}),void(e.hasEdge(`e${s}-${a.id}`)||e.addEdge({id:`e${s}-${a.id}`,source:s,target:a.id,data:{}}));a=i}}))})(t,o,a.vs)}))},X=(t,e)=>{null==e||e.forEach((e=>{null==e||e.forEach(((e,r)=>{t.getNode(e).data.order=r}))}))},Q=(t,e)=>{var r,n;if(null===(r=t.getNode(e))||void 0===r?void 0:r.data.dummy)return null===(n=t.getPredecessors(e))||void 0===n?void 0:n.find((e=>t.getNode(e.id).data.dummy))},Z=(t,e,r)=>{let n=e,o=r;if(n>o){const t=n;n=o,o=t}let i=t[n];i||(t[n]=i={}),i[o]=!0},tt=(t,e,r)=>{let n=e,o=r;return n>r&&(n=r,o=e),!!t[n]},et=(t,e,r,n,o,i)=>{const s=new u,a=rt(n,o,i);return null==e||e.forEach((e=>{let n;null==e||e.forEach((e=>{const o=r[e];if(s.hasNode(o)||s.addNode({id:o,data:{}}),n){const i=r[n],u=s.getRelatedEdges(i,"out").find((t=>t.target===o));u?s.updateEdgeData(u.id,Object.assign(Object.assign({},u.data),{weight:Math.max(a(t,e,n),u.data.weight||0)})):s.addEdge({id:`e${Math.random()}`,source:i,target:o,data:{weight:Math.max(a(t,e,n),0)}})}n=e}))})),s};const rt=(t,e,r)=>(n,o,i)=>{const s=n.getNode(o),a=n.getNode(i);let u=0,d=0;if(u+=s.data.width/2,s.data.hasOwnProperty("labelpos"))switch((s.data.labelpos||"").toLowerCase()){case"l":d=-s.data.width/2;break;case"r":d=s.data.width/2}if(d&&(u+=r?d:-d),d=0,u+=(s.data.dummy?e:t)/2,u+=(a.data.dummy?e:t)/2,u+=a.data.width/2,a.data.labelpos)switch((a.data.labelpos||"").toLowerCase()){case"l":d=a.data.width/2;break;case"r":d=-a.data.width/2}return d&&(u+=r?d:-d),d=0,u},nt=(t,e)=>t.getNode(e).data.width||0,ot=(t,e)=>{var r;const n=E(t);((t,e)=>{const{ranksep:r=0}=e||{},n=_(t);let o=0;null==n||n.forEach((e=>{const n=e.map((e=>t.getNode(e).data.height)),i=Math.max(...n,0);null==e||e.forEach((e=>{t.getNode(e).data.y=o+i/2})),o+=i+r}))})(n,e);const o=((t,e)=>{const{align:r,nodesep:n=0,edgesep:o=0}=e||{},i=_(t),s=Object.assign(((t,e)=>{const r={};return(null==e?void 0:e.length)&&e.reduce(((e,n)=>{let o=0,i=0;const s=e.length,a=null==n?void 0:n[(null==n?void 0:n.length)-1];return null==n||n.forEach(((e,u)=>{var d;const h=Q(t,e),c=h?t.getNode(h.id).data.order:s;(h||e===a)&&(null===(d=n.slice(i,u+1))||void 0===d||d.forEach((e=>{var n;null===(n=t.getPredecessors(e))||void 0===n||n.forEach((n=>{var i;const s=t.getNode(n.id),a=s.data.order;!(a<o||c<a)||s.data.dummy&&(null===(i=t.getNode(e))||void 0===i?void 0:i.data.dummy)||Z(r,n.id,e)}))})),i=u+1,o=c)})),n})),r})(t,i),((t,e)=>{const r={};function n(e,n){const o=function(t){return JSON.stringify(t.slice(1))}(e);n.get(o)||(function(e,n,o,i,s){var a,u;let d;for(let h=n;h<o;h++)d=e[h],(null===(a=t.getNode(d))||void 0===a?void 0:a.data.dummy)&&(null===(u=t.getPredecessors(d))||void 0===u||u.forEach((e=>{const n=t.getNode(e.id);n.data.dummy&&(n.data.order<i||n.data.order>s)&&Z(r,e.id,d)})))}(...e),n.set(o,!0))}return(null==e?void 0:e.length)&&e.reduce(((e,r)=>{let o,i=-1,s=0;const a=new Map;return null==r||r.forEach(((u,d)=>{var h;if("border"===(null===(h=t.getNode(u))||void 0===h?void 0:h.data.dummy)){const e=t.getPredecessors(u)||[];e.length&&(o=t.getNode(e[0].id).data.order,n([r,s,d,i,o],a),s=d,i=o)}n([r,s,r.length,o,e.length],a)})),r})),r})(t,i)),a={};let u=[];["u","d"].forEach((e=>{u="u"===e?i:Object.values(i).reverse(),["l","r"].forEach((r=>{"r"===r&&(u=u.map((t=>Object.values(t).reverse())));const i=("u"===e?t.getPredecessors:t.getSuccessors).bind(t),d=((t,e,r,n)=>{const o={},i={},s={};return null==e||e.forEach((t=>{null==t||t.forEach(((t,e)=>{o[t]=t,i[t]=t,s[t]=e}))})),null==e||e.forEach((t=>{let e=-1;null==t||t.forEach((t=>{let a=n(t).map((t=>t.id));if(a.length){a=a.sort(((t,e)=>s[t]-s[e]));const n=(a.length-1)/2;for(let u=Math.floor(n),d=Math.ceil(n);u<=d;++u){const n=a[u];i[t]===t&&e<s[n]&&!tt(r,t,n)&&(i[n]=t,i[t]=o[t]=o[n],e=s[n])}}}))})),{root:o,align:i}})(0,u,s,i),h=((t,e,r,n,o,i,s)=>{var a;const u={},d=et(t,e,r,o,i,s),h=s?"borderLeft":"borderRight",c=(t,e)=>{let r=d.getAllNodes(),n=r.pop();const o={};for(;n;)o[n.id]?t(n.id):(o[n.id]=!0,r.push(n),r=r.concat(e(n.id))),n=r.pop()};return c((t=>{u[t]=(d.getRelatedEdges(t,"in")||[]).reduce(((t,e)=>Math.max(t,(u[e.source]||0)+e.data.weight)),0)}),d.getPredecessors.bind(d)),c((e=>{const r=(d.getRelatedEdges(e,"out")||[]).reduce(((t,e)=>Math.min(t,(u[e.target]||0)-e.data.weight)),Number.POSITIVE_INFINITY),n=t.getNode(e);r!==Number.POSITIVE_INFINITY&&n.data.borderType!==h&&(u[e]=Math.max(u[e],r))}),d.getSuccessors.bind(d)),null===(a=Object.values(n))||void 0===a||a.forEach((t=>{u[t]=u[r[t]]})),u})(t,u,d.root,d.align,n,o,"r"===r);"r"===r&&Object.keys(h).forEach((t=>h[t]=-h[t])),a[e+r]=h}))}));const d=((t,e)=>A(Object.values(e),(e=>{var r;let n=Number.NEGATIVE_INFINITY,o=Number.POSITIVE_INFINITY;return null===(r=Object.keys(e))||void 0===r||r.forEach((r=>{const i=e[r],s=nt(t,r)/2;n=Math.max(i+s,n),o=Math.min(i-s,o)})),n-o})))(t,a);return d&&function(t,e){const r=Object.values(e),n=Math.min(...r),o=Math.max(...r);["u","d"].forEach((r=>{["l","r"].forEach((i=>{const s=r+i,a=t[s];let u;if(a===e)return;const d=Object.values(a);u="l"===i?n-Math.min(...d):o-Math.max(...d),u&&(t[s]={},Object.keys(a).forEach((e=>{t[s][e]=a[e]+u})))}))}))}(a,d),((t,e)=>{const r={};return Object.keys(t.ul).forEach((n=>{if(e)r[n]=t[e.toLowerCase()][n];else{const e=Object.values(t).map((t=>t[n]));r[n]=(e[0]+e[1])/2}})),r})(a,r)})(n,e);null===(r=Object.keys(o))||void 0===r||r.forEach((t=>{n.getNode(t).data.x=o[t]}))},it=t=>{const e={},r=n=>{var o;const i=t.getNode(n);if(!i)return 0;if(e[n])return i.data.rank;let s;return e[n]=!0,null===(o=t.getRelatedEdges(n,"out"))||void 0===o||o.forEach((t=>{const e=r(t.target)-t.data.minlen;e&&(void 0===s||e<s)&&(s=e)})),s||(s=0),i.data.rank=s,s};t.getAllNodes().filter((e=>0===t.getRelatedEdges(e.id,"in").length)).forEach((t=>r(t.id)))},st=(t,e)=>t.getNode(e.target).data.rank-t.getNode(e.source).data.rank-e.data.minlen,at=(t,e)=>{const r=n=>{e.getRelatedEdges(n,"both").forEach((o=>{const i=o.source,s=n===i?o.target:i;t.hasNode(s)||st(e,o)||(t.addNode({id:s,data:{}}),t.addEdge({id:o.id,source:n,target:s,data:{}}),r(s))}))};return t.getAllNodes().forEach((t=>r(t.id))),t.getAllNodes().length},ut=(t,e)=>{const r=n=>{var o;null===(o=e.getRelatedEdges(n,"both"))||void 0===o||o.forEach((o=>{const i=o.source,s=n===i?o.target:i;t.hasNode(s)||void 0===e.getNode(s).data.layer&&st(e,o)||(t.addNode({id:s,data:{}}),t.addEdge({id:o.id,source:n,target:s,data:{}}),r(s))}))};return t.getAllNodes().forEach((t=>r(t.id))),t.getAllNodes().length},dt=(t,e)=>A(e.getAllEdges(),(r=>t.hasNode(r.source)!==t.hasNode(r.target)?st(e,r):1/0)),ht=(t,e,r)=>{t.getAllNodes().forEach((t=>{const n=e.getNode(t.id);n.data.rank||(n.data.rank=0),n.data.rank+=r}))},ct=(t,e)=>{let r=O(t,t.getAllNodes(),"post",!1);r=r.slice(0,(null==r?void 0:r.length)-1),r.forEach((r=>{lt(t,e,r)}))},lt=(t,e,r)=>{const n=t.getNode(r).data.parent;t.getRelatedEdges(r,"both").find((t=>t.target===n||t.source===n)).data.cutvalue=ft(t,e,r)},ft=(t,e,r)=>{const n=t.getNode(r).data.parent;let o=!0,i=e.getRelatedEdges(r,"out").find((t=>t.target===n)),s=0;return i||(o=!1,i=e.getRelatedEdges(n,"out").find((t=>t.target===r))),s=i.data.weight,e.getRelatedEdges(r,"both").forEach((e=>{const i=e.source===r,a=i?e.target:e.source;if(a!==n){const n=i===o,u=e.data.weight;if(s+=n?u:-u,xt(t,r,a)){const e=t.getRelatedEdges(r,"both").find((t=>t.source===a||t.target===a)).data.cutvalue;s+=n?-e:e}}})),s},gt=(t,e=t.getAllNodes()[0].id)=>{pt(t,{},1,e)},pt=(t,e,r,n,o)=>{var i;const s=r;let a=r;const u=t.getNode(n);return e[n]=!0,null===(i=t.getNeighbors(n))||void 0===i||i.forEach((r=>{e[r.id]||(a=pt(t,e,a,r.id,n))})),u.data.low=s,u.data.lim=a++,o?u.data.parent=o:delete u.data.parent,a},vt=t=>t.getAllEdges().find((t=>t.data.cutvalue<0)),yt=(t,e,r)=>{let n=r.source,o=r.target;e.getRelatedEdges(n,"out").find((t=>t.target===o))||(n=r.target,o=r.source);const i=t.getNode(n),s=t.getNode(o);let a=i,u=!1;i.data.lim>s.data.lim&&(a=s,u=!0);const d=e.getAllEdges().filter((e=>u===bt(t.getNode(e.source),a)&&u!==bt(t.getNode(e.target),a)));return A(d,(t=>st(e,t)))},mt=(t,e,r,n)=>{const o=t.getRelatedEdges(r.source,"both").find((t=>t.source===r.target||t.target===r.target));o&&t.removeEdge(o.id),t.addEdge({id:`e${Math.random()}`,source:n.source,target:n.target,data:{}}),gt(t),ct(t,e),wt(t,e)},wt=(t,e)=>{const r=t.getAllNodes().find((t=>!t.data.parent));let n=O(t,r,"pre",!1);n=n.slice(1),n.forEach((r=>{const n=t.getNode(r).data.parent;let o=e.getRelatedEdges(r,"out").find((t=>t.target===n)),i=!1;!o&&e.hasNode(n)&&(o=e.getRelatedEdges(n,"out").find((t=>t.target===r)),i=!0),e.getNode(r).data.rank=(e.hasNode(n)&&e.getNode(n).data.rank||0)+(i?null==o?void 0:o.data.minlen:-(null==o?void 0:o.data.minlen))}))},xt=(t,e,r)=>t.getRelatedEdges(e,"both").find((t=>t.source===r||t.target===r)),bt=(t,e)=>e.data.low<=t.data.lim&&t.data.lim<=e.data.lim,Et=it,Nt=t=>{(t=>{const e=(t=>{const e=new u;return t.getAllNodes().forEach((t=>{e.addNode(Object.assign({},t))})),t.getAllEdges().forEach((t=>{const r=e.getRelatedEdges(t.source,"out").find((e=>e.target===t.target));r?e.updateEdgeData(null==r?void 0:r.id,Object.assign(Object.assign({},r.data),{weight:r.data.weight+t.data.weight||0,minlen:Math.max(r.data.minlen,t.data.minlen||1)})):e.addEdge({id:t.id,source:t.source,target:t.target,data:{weight:t.data.weight||0,minlen:t.data.minlen||1}})})),e})(t);it(e);const r=(t=>{const e=new u({tree:[]}),r=t.getAllNodes()[0],n=t.getAllNodes().length;let o,i;for(e.addNode(r);at(e,t)<n;)o=dt(e,t),i=e.hasNode(o.source)?st(t,o):-st(t,o),ht(e,t,i);return e})(e);let n,o;for(gt(r),ct(r,e);n=vt(r);)o=yt(r,e,n),mt(r,e,n,o)})(t)},_t=(t,e)=>{const{acyclicer:r,ranker:n,rankdir:o="tb",nodeOrder:i,keepNodeOrder:s,align:a,nodesep:d=50,edgesep:h=20,ranksep:c=50}=e;Lt(t),w(t,r);const{nestingRoot:l,nodeRankFactor:f}=(t=>{const e=b(t,"root",{},"_root"),r=(t=>{const e={},r=(n,o)=>{const i=t.getChildren(n);null==i||i.forEach((t=>r(t.id,o+1))),e[n]=o};return t.getRoots().forEach((t=>r(t.id,1))),e})(t);let n=Math.max(...Object.values(r));Math.abs(n)===1/0&&(n=1);const o=n-1,i=2*o+1;t.getAllEdges().forEach((t=>{t.data.minlen*=i}));const s=(t=>{let e=0;return t.getAllEdges().forEach((t=>{e+=t.data.weight})),e})(t)+1;return t.getRoots().forEach((n=>{C(t,e,i,s,o,r,n.id)})),{nestingRoot:e,nodeRankFactor:i}})(t);((t,e)=>{switch(e){case"network-simplex":Nt(t);break;case"tight-tree":default:(t=>{(t=>{const e={};let r;const n=o=>{var i;const s=t.getNode(o);if(!s)return 0;if(e[o])return s.data.rank;let a;return e[o]=!0,null===(i=t.getRelatedEdges(o,"out"))||void 0===i||i.forEach((t=>{const e=n(t.target)-t.data.minlen;e&&(void 0===a||e<a)&&(a=e)})),a||(a=0),(void 0===r||a<r)&&(r=a),s.data.rank=a,a};t.getAllNodes().filter((e=>0===t.getRelatedEdges(e.id,"in").length)).forEach((t=>{t&&n(t.id)})),void 0===r&&(r=0);const o={},i=(e,r)=>{var n;const s=t.getNode(e),a=isNaN(s.data.layer)?r:s.data.layer;(void 0===s.data.rank||s.data.rank<a)&&(s.data.rank=a),o[e]||(o[e]=!0,null===(n=t.getRelatedEdges(e,"out"))||void 0===n||n.forEach((t=>{i(t.target,a+t.data.minlen)})))};t.getAllNodes().forEach((t=>{const e=t.data;e&&(isNaN(e.layer)?e.rank-=r:i(t.id,e.layer))}))})(t),(t=>{const e=new u({tree:[]}),r=t.getAllNodes()[0],n=t.getAllNodes().length;let o,i;for(e.addNode(r);ut(e,t)<n;)o=dt(e,t),i=e.hasNode(o.source)?st(t,o):-st(t,o),ht(e,t,i)})(t)})(t);break;case"longest-path":Et(t)}})(E(t),n),St(t),((t,e=0)=>{const r=t.getAllNodes(),n=r.filter((t=>void 0!==t.data.rank)).map((t=>t.data.rank)),o=Math.min(...n),i=[];r.forEach((t=>{const e=(t.data.rank||0)-o;i[e]||(i[e]=[]),i[e].push(t.id)}));let s=0;for(let r=0;r<i.length;r++){const n=i[r];void 0===n?r%e!=0&&(s-=1):s&&(null==n||n.forEach((e=>{const r=t.getNode(e);r&&(r.data.rank=r.data.rank||0,r.data.rank+=s)})))}})(t,f),((t,e)=>{e&&t.removeNode(e),t.getAllEdges().forEach((e=>{e.data.nestingEdge&&t.removeEdge(e.id)}))})(t,l),(t=>{const e=t.getAllNodes().filter((t=>void 0!==t.data.rank)).map((t=>t.data.rank)),r=Math.min(...e);t.getAllNodes().forEach((t=>{t.data.hasOwnProperty("rank")&&r!==1/0&&(t.data.rank-=r)}))})(t),zt(t),Rt(t);const g=[];((t,e)=>{t.getAllEdges().forEach((r=>((t,e,r)=>{let n=e.source,o=t.getNode(n).data.rank;const i=e.target,s=t.getNode(i).data.rank,a=e.data.labelRank;if(s===o+1)return;let u,d,h;for(t.removeEdge(e.id),h=0,++o;o<s;++h,++o)e.data.points=[],d={originalEdge:e,width:0,height:0,rank:o},u=b(t,"edge",d,"_d"),o===a&&(d.width=e.data.width,d.height=e.data.height,d.dummy=D,d.labelpos=e.data.labelpos),t.addEdge({id:`e${Math.random()}`,source:n,target:u,data:{weight:e.data.weight}}),0===h&&r.push(u),n=u;t.addEdge({id:`e${Math.random()}`,source:n,target:i,data:{weight:e.data.weight}})})(t,r,e)))})(t,g),((t,e)=>{const r=(t=>{const e={};let r=0;const n=o=>{const i=r;t.getChildren(o).forEach((t=>n(t.id))),e[o]={low:i,lim:r++}};return t.getRoots().forEach((t=>n(t.id))),e})(t);e.forEach((e=>{var n,o;let i=e,s=t.getNode(i);const a=s.data.originalEdge;if(!a)return;const u=((t,e,r,n)=>{var o,i;const s=[],a=[],u=Math.min(e[r].low,e[n].low),d=Math.max(e[r].lim,e[n].lim);let h,c;h=r;do{h=null===(o=t.getParent(h))||void 0===o?void 0:o.id,s.push(h)}while(h&&(e[h].low>u||d>e[h].lim));for(c=h,h=n;h&&h!==c;)a.push(h),h=null===(i=t.getParent(h))||void 0===i?void 0:i.id;return{lca:c,path:s.concat(a.reverse())}})(t,r,a.source,a.target),d=u.path,h=u.lca;let c=0,l=d[c],f=!0;for(;i!==a.target;){if(s=t.getNode(i),f){for(;l!==h&&(null===(n=t.getNode(l))||void 0===n?void 0:n.data.maxRank)<s.data.rank;)c++,l=d[c];l===h&&(f=!1)}if(!f){for(;c<d.length-1&&(null===(o=t.getNode(d[c+1]))||void 0===o?void 0:o.data.minRank)<=s.data.rank;)c++;l=d[c]}t.hasNode(l)&&t.setParent(i,l),i=t.getSuccessors(i)[0].id}}))})(t,g),(t=>{const e=r=>{const n=t.getChildren(r),o=t.getNode(r);if((null==n?void 0:n.length)&&n.forEach((t=>e(t.id))),o.data.hasOwnProperty("minRank")){o.data.borderLeft=[],o.data.borderRight=[];for(let e=o.data.minRank,n=o.data.maxRank+1;e<n;e+=1)S(t,"borderLeft","_bl",r,o,e),S(t,"borderRight","_br",r,o,e)}};t.getRoots().forEach((t=>e(t.id)))})(t),s&&((t,e)=>{const r=t.getAllNodes().filter((e=>{var r;return!(null===(r=t.getChildren(e.id))||void 0===r?void 0:r.length)})).map((t=>t.data.rank)),n=Math.max(...r),o=[];for(let t=0;t<n+1;t++)o[t]=[];null==e||e.forEach((e=>{const r=t.getNode(e);r&&!r.data.dummy&&(isNaN(r.data.rank)||(r.data.fixorder=o[r.data.rank].length,o[r.data.rank].push(e)))}))})(t,i),((t,e)=>{const r=k(t),n=[],o=[];for(let t=1;t<r+1;t++)n.push(t);for(let t=r-1;t>-1;t--)o.push(t);const i=K(t,n,"in"),s=K(t,o,"out");let a=B(t);X(t,a);let u,d=Number.POSITIVE_INFINITY;for(let r=0,n=0;n<4;++r,++n){J(r%2?i:s,r%4>=2,!1,e),a=_(t);const o=V(t,a);o<d&&(n=0,u=F(a),d=o)}a=B(t),X(t,a);for(let r=0,n=0;n<4;++r,++n){J(r%2?i:s,r%4>=2,!0,e),a=_(t);const o=V(t,a);o<d&&(n=0,u=F(a),d=o)}X(t,u)})(t,s),Ft(t),((t,e)=>{const r=e.toLowerCase();"lr"!==r&&"rl"!==r||z(t)})(t,o),ot(t,{align:a,nodesep:d,edgesep:h,ranksep:c}),qt(t),Tt(t),((t,e)=>{e.forEach((e=>{let r=t.getNode(e);const{data:n}=r,o=n.originalEdge;let i;o&&t.addEdge(o);let s=e;for(;r.data.dummy;)i=t.getSuccessors(s)[0],t.removeNode(s),o.data.points.push({x:r.data.x,y:r.data.y}),r.data.dummy===D&&(o.data.x=r.data.x,o.data.y=r.data.y,o.data.width=r.data.width,o.data.height=r.data.height),s=i.id,r=t.getNode(s)}))})(t,g),Ct(t),((t,e)=>{const r=e.toLowerCase();"bt"!==r&&"rl"!==r||(t=>{t.getAllNodes().forEach((t=>{I(t.data)})),t.getAllEdges().forEach((t=>{var e;null===(e=t.data.points)||void 0===e||e.forEach((t=>I(t))),t.data.hasOwnProperty("y")&&I(t.data)}))})(t),"lr"!==r&&"rl"!==r||((t=>{t.getAllNodes().forEach((t=>{P(t.data)})),t.getAllEdges().forEach((t=>{var e;null===(e=t.data.points)||void 0===e||e.forEach((t=>P(t))),t.data.hasOwnProperty("x")&&P(t.data)}))})(t),z(t))})(t,o);const{width:p,height:v}=It(t);return Pt(t),Dt(t),(t=>{t.getAllEdges().forEach((e=>{const r=e.data;if(r.reversed){t.removeEdge(e.id);const n=r.forwardName;delete r.reversed,delete r.forwardName,t.addEdge({id:e.id,source:e.target,target:e.source,data:Object.assign(Object.assign({},r),{forwardName:n})})}}))})(t),{width:p,height:v}},Mt=["width","height","layer","fixorder"],kt={width:0,height:0},At=["minlen","weight","width","height","labeloffset"],jt={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},Ot=["labelpos"],St=t=>{t.getAllEdges().forEach((e=>{if(e.data.width&&e.data.height){const r=t.getNode(e.source),n={e,rank:(t.getNode(e.target).data.rank-r.data.rank)/2+r.data.rank};b(t,"edge-proxy",n,"_ep")}}))},zt=t=>{let e=0;return t.getAllNodes().forEach((r=>{var n,o;r.data.borderTop&&(r.data.minRank=null===(n=t.getNode(r.data.borderTop))||void 0===n?void 0:n.data.rank,r.data.maxRank=null===(o=t.getNode(r.data.borderBottom))||void 0===o?void 0:o.data.rank,e=Math.max(e,r.data.maxRank||-1/0))})),e},Rt=t=>{t.getAllNodes().forEach((e=>{"edge-proxy"===e.data.dummy&&(t.getEdge(e.data.e.id).data.labelRank=e.data.rank,t.removeNode(e.id))}))},It=(t,e)=>{let r,n,o=0,i=0;const{marginx:s=0,marginy:a=0}=e||{},u=t=>{if(!t.data)return;const e=t.data.x,s=t.data.y,a=t.data.width,u=t.data.height;isNaN(e)||isNaN(a)||(void 0===r&&(r=e-a/2),r=Math.min(r,e-a/2),o=Math.max(o,e+a/2)),isNaN(s)||isNaN(u)||(void 0===n&&(n=s-u/2),n=Math.min(n,s-u/2),i=Math.max(i,s+u/2))};return t.getAllNodes().forEach((t=>{u(t)})),t.getAllEdges().forEach((t=>{(null==t?void 0:t.data.hasOwnProperty("x"))&&u(t)})),r-=s,n-=a,t.getAllNodes().forEach((t=>{t.data.x-=r,t.data.y-=n})),t.getAllEdges().forEach((t=>{var e;null===(e=t.data.points)||void 0===e||e.forEach((t=>{t.x-=r,t.y-=n})),t.data.hasOwnProperty("x")&&(t.data.x-=r),t.data.hasOwnProperty("y")&&(t.data.y-=n)})),{width:o-r+s,height:i-n+a}},Pt=t=>{t.getAllEdges().forEach((e=>{const r=t.getNode(e.source),n=t.getNode(e.target);let o,i;e.data.points?(o=e.data.points[0],i=e.data.points[e.data.points.length-1]):(e.data.points=[],o={x:n.data.x,y:n.data.y},i={x:r.data.x,y:r.data.y}),e.data.points.unshift(N(r.data,o)),e.data.points.push(N(n.data,i))}))},Ct=t=>{t.getAllEdges().forEach((t=>{if(t.data.hasOwnProperty("x"))switch("l"!==t.data.labelpos&&"r"!==t.data.labelpos||(t.data.width-=t.data.labeloffset),t.data.labelpos){case"l":t.data.x-=t.data.width/2+t.data.labeloffset;break;case"r":t.data.x+=t.data.width/2+t.data.labeloffset}}))},Dt=t=>{t.getAllEdges().forEach((t=>{var e;t.data.reversed&&(null===(e=t.data.points)||void 0===e||e.reverse())}))},Tt=t=>{t.getAllNodes().forEach((e=>{var r,n,o;if(null===(r=t.getChildren(e.id))||void 0===r?void 0:r.length){const r=t.getNode(e.id),i=t.getNode(r.data.borderTop),s=t.getNode(r.data.borderBottom),a=t.getNode(r.data.borderLeft[(null===(n=r.data.borderLeft)||void 0===n?void 0:n.length)-1]),u=t.getNode(r.data.borderRight[(null===(o=r.data.borderRight)||void 0===o?void 0:o.length)-1]);r.data.width=Math.abs((null==u?void 0:u.data.x)-(null==a?void 0:a.data.x))||10,r.data.height=Math.abs((null==s?void 0:s.data.y)-(null==i?void 0:i.data.y))||10,r.data.x=((null==a?void 0:a.data.x)||0)+r.data.width/2,r.data.y=((null==i?void 0:i.data.y)||0)+r.data.height/2}})),t.getAllNodes().forEach((e=>{"border"===e.data.dummy&&t.removeNode(e.id)}))},Lt=t=>{t.getAllEdges().forEach((e=>{if(e.source===e.target){const r=t.getNode(e.source);r.data.selfEdges||(r.data.selfEdges=[]),r.data.selfEdges.push(e),t.removeEdge(e.id)}}))},Ft=t=>{const e=_(t);null==e||e.forEach((e=>{let r=0;null==e||e.forEach(((e,n)=>{var o;const i=t.getNode(e);i.data.order=n+r,null===(o=i.data.selfEdges)||void 0===o||o.forEach((e=>{b(t,"selfedge",{width:e.data.width,height:e.data.height,rank:i.data.rank,order:n+ ++r,e},"_se")})),delete i.data.selfEdges}))}))},qt=t=>{t.getAllNodes().forEach((e=>{const r=t.getNode(e.id);if("selfedge"===r.data.dummy){const n=t.getNode(r.data.e.source),o=n.data.x+n.data.width/2,i=n.data.y,s=r.data.x-o,a=n.data.height/2;t.hasEdge(r.data.e.id)?t.updateEdgeData(r.data.e.id,r.data.e.data):t.addEdge({id:r.data.e.id,source:r.data.e.source,target:r.data.e.target,data:r.data.e.data}),t.removeNode(e.id),r.data.e.data.points=[{x:o+2*s/3,y:i-a},{x:o+5*s/6,y:i-a},{y:i,x:o+s},{x:o+5*s/6,y:i+a},{x:o+2*s/3,y:i+a}],r.data.e.data.x=r.data.x,r.data.e.data.y=r.data.y}}))},Vt=(t,e)=>{const r={};return null==e||e.forEach((e=>{void 0!==t[e]&&(r[e]=+t[e])})),r},Bt=(t={})=>{const e={};return Object.keys(t).forEach((r=>{e[r.toLowerCase()]=t[r]})),e},$t=function(t){return"function"==typeof t},Gt=function(t){var e=typeof t;return null!==t&&"object"===e||"function"===e};function Ut(t){if(!t)return[0,0,0];if(c(t))return[t,t,t];if(0===t.length)return[0,0,0];const[e,r=e,n=e]=t;return[e,r,n]}function Wt(t,e){let r;return r=$t(e)?e:c(e)?()=>e:()=>t,r}function Yt(t,e,r=!0){return e||0===e?$t(e)?e:c(e)?()=>e:Array.isArray(e)?()=>r?Math.max(...e)||t:e:Gt(e)&&e.width&&e.height?()=>r?Math.max(e.width,e.height)||t:[e.width,e.height]:()=>t:e=>{const{size:n}=e.data||{};return n?Array.isArray(n)?r?Math.max(...n)||t:n:Gt(n)&&n.width&&n.height?r?Math.max(n.width,n.height)||t:[n.width,n.height]:n:t}}const Ht=(t,e,r=10)=>{let n;const o="function"==typeof e?e:()=>e||0;return n=t?Array.isArray(t)?e=>t:$t(t)?t:e=>t:t=>{var e,n,o;if(null===(e=t.data)||void 0===e?void 0:e.bboxSize)return null===(n=t.data)||void 0===n?void 0:n.bboxSize;if(null===(o=t.data)||void 0===o?void 0:o.size){const e=t.data.size;return Array.isArray(e)?e:Gt(e)?[e.width,e.height]:e}return r},t=>{const e=n(t),r=o(t);return Math.max(...Ut(e))+r}},Kt=t=>{if(null===t)return t;if(t instanceof Date)return new Date(t.getTime());if(t instanceof Array){const e=[];return t.forEach((t=>{e.push(t)})),e.map((t=>Kt(t)))}if("object"==typeof t){const e={};return Object.keys(t).forEach((r=>{e[r]=Kt(t[r])})),e}return t},Jt=(t,e)=>{const r=Kt(t);return r.data=r.data||{},e&&(c(r.data.x)||(r.data.x=Math.random()*e[0]),c(r.data.y)||(r.data.y=Math.random()*e[1])),r},Xt={rankdir:"TB",nodesep:50,ranksep:50,edgeLabelSpace:!0,ranker:"tight-tree",controlPoints:!1,radial:!1,focusNode:null},Qt=(t,e,r)=>{const n=t.getAllNodes(),o=t.getAllEdges();return(null==n?void 0:n.length)?1===n.length?(e&&t.mergeNodeData(n[0].id,{x:r[0],y:r[1]}),{nodes:[Object.assign(Object.assign({},n[0]),{data:Object.assign(Object.assign({},n[0].data),{x:r[0],y:r[1]})})],edges:o}):void 0:{nodes:[],edges:o}},Zt={radius:null,startRadius:null,endRadius:null,startAngle:0,endAngle:2*Math.PI,clockwise:!0,divisions:1,ordering:null,angleRatio:1},te=(t,e,r=!1)=>{const n=[Jt(e[0])],o={},i=e.length;o[e[0].id]=!0;let s=0;return e.forEach(((a,u)=>{if(0!==u)if(u!==i-1&&t.getDegree(a.id,"both")===t.getDegree(e[u+1].id,"both")&&!t.areNeighbors(n[s].id,a.id)||o[a.id]){const u=r?t.getSuccessors(n[s].id):t.getNeighbors(n[s].id);let d=!1;for(let e=0;e<u.length;e++){const r=u[e];if(t.getDegree(r.id)===t.getDegree(a.id)&&!o[r.id]){n.push(Jt(r)),o[r.id]=!0,d=!0;break}}let h=0;for(;!d&&(o[e[h].id]||(n.push(Jt(e[h])),o[e[h].id]=!0,d=!0),h++,h!==i););}else n.push(Jt(a)),o[a.id]=!0,s++})),n},ee=function(t){return h(t,"String")},re=Array.isArray,ne={nodeSize:30,nodeSpacing:10,preventOverlap:!1,sweep:void 0,equidistant:!1,startAngle:1.5*Math.PI,clockwise:!0,maxLevelDiff:void 0,sortBy:"degree"};class oe{constructor(t={}){this.options=t,this.id="concentric",this.options=Object.assign(Object.assign({},ne),t)}execute(e,r){return t(this,void 0,void 0,(function*(){return this.genericConcentricLayout(!1,e,r)}))}assign(e,r){return t(this,void 0,void 0,(function*(){yield this.genericConcentricLayout(!0,e,r)}))}genericConcentricLayout(e,r,n){return t(this,void 0,void 0,(function*(){const t=Object.assign(Object.assign({},this.options),n),{center:o,width:i,height:s,sortBy:a,maxLevelDiff:u,sweep:d,clockwise:h,equidistant:l,preventOverlap:f,startAngle:g=1.5*Math.PI,nodeSize:p,nodeSpacing:v}=t,y=r.getAllNodes(),m=r.getAllEdges(),w=i||"undefined"==typeof window?i:window.innerWidth,x=s||"undefined"==typeof window?s:window.innerHeight,b=o||[w/2,x/2];if(!(null==y?void 0:y.length)||1===y.length)return Qt(r,e,b);const E=[];let N,_=0;re(p)?N=Math.max(p[0],p[1]):$t(p)?(N=-1/0,y.forEach((t=>{const e=Math.max(...Ut(p(t)));e>N&&(N=e)}))):N=p,re(v)?_=Math.max(v[0],v[1]):c(v)&&(_=v),y.forEach((t=>{const e=Jt(t);E.push(e);let r=N;const{data:n}=e;re(n.size)?r=Math.max(n.size[0],n.size[1]):c(n.size)?r=n.size:Gt(n.size)&&(r=Math.max(n.size.width,n.size.height)),N=Math.max(N,r),$t(v)&&(_=Math.max(v(t),_))}));const M={};E.forEach(((t,e)=>{M[t.id]=e}));let k=a;ee(k)&&void 0!==E[0].data[k]||(k="degree"),"degree"===k?E.sort(((t,e)=>r.getDegree(e.id,"both")-r.getDegree(t.id,"both"))):E.sort(((t,e)=>e.data[k]-t.data[k]));const A=E[0],j=(u||("degree"===k?r.getDegree(A.id,"both"):A.data[k]))/4,O=[{nodes:[]}];let S=O[0];E.forEach((t=>{if(S.nodes.length>0){const e="degree"===k?Math.abs(r.getDegree(S.nodes[0].id,"both")-r.getDegree(t.id,"both")):Math.abs(S.nodes[0].data[k]-t.data[k]);j&&e>=j&&(S={nodes:[]},O.push(S))}S.nodes.push(t)}));let z=N+_;if(!f){const t=O.length>0&&O[0].nodes.length>1,e=(Math.min(w,x)/2-z)/(O.length+(t?1:0));z=Math.min(z,e)}let R=0;if(O.forEach((t=>{const e=void 0===d?2*Math.PI-2*Math.PI/t.nodes.length:d;if(t.dTheta=e/Math.max(1,t.nodes.length-1),t.nodes.length>1&&f){const e=Math.cos(t.dTheta)-Math.cos(0),r=Math.sin(t.dTheta)-Math.sin(0),n=Math.sqrt(z*z/(e*e+r*r));R=Math.max(n,R)}t.r=R,R+=z})),l){let t=0,e=0;for(let r=0;r<O.length;r++){const n=(O[r].r||0)-e;t=Math.max(t,n)}e=0,O.forEach(((r,n)=>{0===n&&(e=r.r||0),r.r=e,e+=t}))}return O.forEach((t=>{const e=t.dTheta||0,r=t.r||0;t.nodes.forEach(((t,n)=>{const o=g+(h?1:-1)*e*n;t.data.x=b[0]+r*Math.cos(o),t.data.y=b[1]+r*Math.sin(o)}))})),e&&E.forEach((t=>r.mergeNodeData(t.id,{x:t.data.x,y:t.data.y}))),{nodes:E,edges:m}}))}}function ie(t,e,r,n){if(isNaN(e)||isNaN(r))return t;var o,i,s,a,u,d,h,c,l,f=t._root,g={data:n},p=t._x0,v=t._y0,y=t._x1,m=t._y1;if(!f)return t._root=g,t;for(;f.length;)if((d=e>=(i=(p+y)/2))?p=i:y=i,(h=r>=(s=(v+m)/2))?v=s:m=s,o=f,!(f=f[c=h<<1|d]))return o[c]=g,t;if(a=+t._x.call(null,f.data),u=+t._y.call(null,f.data),e===a&&r===u)return g.next=f,o?o[c]=g:t._root=g,t;do{o=o?o[c]=new Array(4):t._root=new Array(4),(d=e>=(i=(p+y)/2))?p=i:y=i,(h=r>=(s=(v+m)/2))?v=s:m=s}while((c=h<<1|d)==(l=(u>=s)<<1|a>=i));return o[l]=f,o[c]=g,t}function se(t,e,r,n,o){this.node=t,this.x0=e,this.y0=r,this.x1=n,this.y1=o}function ae(t){return t[0]}function ue(t){return t[1]}function de(t,e,r){var n=new he(null==e?ae:e,null==r?ue:r,NaN,NaN,NaN,NaN);return null==t?n:n.addAll(t)}function he(t,e,r,n,o,i){this._x=t,this._y=e,this._x0=r,this._y0=n,this._x1=o,this._y1=i,this._root=void 0}function ce(t){for(var e={data:t.data},r=e;t=t.next;)r=r.next={data:t.data};return e}var le=de.prototype=he.prototype;function fe(t,e,r,n,o){if(isNaN(e)||isNaN(r)||isNaN(n))return t;var i,s,a,u,d,h,c,l,f,g,p,v,y=t._root,m={data:o},w=t._x0,x=t._y0,b=t._z0,E=t._x1,N=t._y1,_=t._z1;if(!y)return t._root=m,t;for(;y.length;)if((l=e>=(s=(w+E)/2))?w=s:E=s,(f=r>=(a=(x+N)/2))?x=a:N=a,(g=n>=(u=(b+_)/2))?b=u:_=u,i=y,!(y=y[p=g<<2|f<<1|l]))return i[p]=m,t;if(d=+t._x.call(null,y.data),h=+t._y.call(null,y.data),c=+t._z.call(null,y.data),e===d&&r===h&&n===c)return m.next=y,i?i[p]=m:t._root=m,t;do{i=i?i[p]=new Array(8):t._root=new Array(8),(l=e>=(s=(w+E)/2))?w=s:E=s,(f=r>=(a=(x+N)/2))?x=a:N=a,(g=n>=(u=(b+_)/2))?b=u:_=u}while((p=g<<2|f<<1|l)==(v=(c>=u)<<2|(h>=a)<<1|d>=s));return i[v]=y,i[p]=m,t}function ge(t,e,r,n,o,i,s){this.node=t,this.x0=e,this.y0=r,this.z0=n,this.x1=o,this.y1=i,this.z1=s}function pe(t){return t[0]}function ve(t){return t[1]}function ye(t){return t[2]}function me(t,e,r,n){var o=new we(null==e?pe:e,null==r?ve:r,null==n?ye:n,NaN,NaN,NaN,NaN,NaN,NaN);return null==t?o:o.addAll(t)}function we(t,e,r,n,o,i,s,a,u){this._x=t,this._y=e,this._z=r,this._x0=n,this._y0=o,this._z0=i,this._x1=s,this._y1=a,this._z1=u,this._root=void 0}function xe(t){for(var e={data:t.data},r=e;t=t.next;)r=r.next={data:t.data};return e}le.copy=function(){var t,e,r=new he(this._x,this._y,this._x0,this._y0,this._x1,this._y1),n=this._root;if(!n)return r;if(!n.length)return r._root=ce(n),r;for(t=[{source:n,target:r._root=new Array(4)}];n=t.pop();)for(var o=0;o<4;++o)(e=n.source[o])&&(e.length?t.push({source:e,target:n.target[o]=new Array(4)}):n.target[o]=ce(e));return r},le.add=function(t){const e=+this._x.call(null,t),r=+this._y.call(null,t);return ie(this.cover(e,r),e,r,t)},le.addAll=function(t){var e,r,n,o,i=t.length,s=new Array(i),a=new Array(i),u=1/0,d=1/0,h=-1/0,c=-1/0;for(r=0;r<i;++r)isNaN(n=+this._x.call(null,e=t[r]))||isNaN(o=+this._y.call(null,e))||(s[r]=n,a[r]=o,n<u&&(u=n),n>h&&(h=n),o<d&&(d=o),o>c&&(c=o));if(u>h||d>c)return this;for(this.cover(u,d).cover(h,c),r=0;r<i;++r)ie(this,s[r],a[r],t[r]);return this},le.cover=function(t,e){if(isNaN(t=+t)||isNaN(e=+e))return this;var r=this._x0,n=this._y0,o=this._x1,i=this._y1;if(isNaN(r))o=(r=Math.floor(t))+1,i=(n=Math.floor(e))+1;else{for(var s,a,u=o-r||1,d=this._root;r>t||t>=o||n>e||e>=i;)switch(a=(e<n)<<1|t<r,(s=new Array(4))[a]=d,d=s,u*=2,a){case 0:o=r+u,i=n+u;break;case 1:r=o-u,i=n+u;break;case 2:o=r+u,n=i-u;break;case 3:r=o-u,n=i-u}this._root&&this._root.length&&(this._root=d)}return this._x0=r,this._y0=n,this._x1=o,this._y1=i,this},le.data=function(){var t=[];return this.visit((function(e){if(!e.length)do{t.push(e.data)}while(e=e.next)})),t},le.extent=function(t){return arguments.length?this.cover(+t[0][0],+t[0][1]).cover(+t[1][0],+t[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]},le.find=function(t,e,r){var n,o,i,s,a,u,d,h=this._x0,c=this._y0,l=this._x1,f=this._y1,g=[],p=this._root;for(p&&g.push(new se(p,h,c,l,f)),null==r?r=1/0:(h=t-r,c=e-r,l=t+r,f=e+r,r*=r);u=g.pop();)if(!(!(p=u.node)||(o=u.x0)>l||(i=u.y0)>f||(s=u.x1)<h||(a=u.y1)<c))if(p.length){var v=(o+s)/2,y=(i+a)/2;g.push(new se(p[3],v,y,s,a),new se(p[2],o,y,v,a),new se(p[1],v,i,s,y),new se(p[0],o,i,v,y)),(d=(e>=y)<<1|t>=v)&&(u=g[g.length-1],g[g.length-1]=g[g.length-1-d],g[g.length-1-d]=u)}else{var m=t-+this._x.call(null,p.data),w=e-+this._y.call(null,p.data),x=m*m+w*w;if(x<r){var b=Math.sqrt(r=x);h=t-b,c=e-b,l=t+b,f=e+b,n=p.data}}return n},le.remove=function(t){if(isNaN(i=+this._x.call(null,t))||isNaN(s=+this._y.call(null,t)))return this;var e,r,n,o,i,s,a,u,d,h,c,l,f=this._root,g=this._x0,p=this._y0,v=this._x1,y=this._y1;if(!f)return this;if(f.length)for(;;){if((d=i>=(a=(g+v)/2))?g=a:v=a,(h=s>=(u=(p+y)/2))?p=u:y=u,e=f,!(f=f[c=h<<1|d]))return this;if(!f.length)break;(e[c+1&3]||e[c+2&3]||e[c+3&3])&&(r=e,l=c)}for(;f.data!==t;)if(n=f,!(f=f.next))return this;return(o=f.next)&&delete f.next,n?(o?n.next=o:delete n.next,this):e?(o?e[c]=o:delete e[c],(f=e[0]||e[1]||e[2]||e[3])&&f===(e[3]||e[2]||e[1]||e[0])&&!f.length&&(r?r[l]=f:this._root=f),this):(this._root=o,this)},le.removeAll=function(t){for(var e=0,r=t.length;e<r;++e)this.remove(t[e]);return this},le.root=function(){return this._root},le.size=function(){var t=0;return this.visit((function(e){if(!e.length)do{++t}while(e=e.next)})),t},le.visit=function(t){var e,r,n,o,i,s,a=[],u=this._root;for(u&&a.push(new se(u,this._x0,this._y0,this._x1,this._y1));e=a.pop();)if(!t(u=e.node,n=e.x0,o=e.y0,i=e.x1,s=e.y1)&&u.length){var d=(n+i)/2,h=(o+s)/2;(r=u[3])&&a.push(new se(r,d,h,i,s)),(r=u[2])&&a.push(new se(r,n,h,d,s)),(r=u[1])&&a.push(new se(r,d,o,i,h)),(r=u[0])&&a.push(new se(r,n,o,d,h))}return this},le.visitAfter=function(t){var e,r=[],n=[];for(this._root&&r.push(new se(this._root,this._x0,this._y0,this._x1,this._y1));e=r.pop();){var o=e.node;if(o.length){var i,s=e.x0,a=e.y0,u=e.x1,d=e.y1,h=(s+u)/2,c=(a+d)/2;(i=o[0])&&r.push(new se(i,s,a,h,c)),(i=o[1])&&r.push(new se(i,h,a,u,c)),(i=o[2])&&r.push(new se(i,s,c,h,d)),(i=o[3])&&r.push(new se(i,h,c,u,d))}n.push(e)}for(;e=n.pop();)t(e.node,e.x0,e.y0,e.x1,e.y1);return this},le.x=function(t){return arguments.length?(this._x=t,this):this._x},le.y=function(t){return arguments.length?(this._y=t,this):this._y};var be=me.prototype=we.prototype;function Ee(t){let e=0,r=0,n=0,o=0,i=0;const s=t.length;if(s){for(let a=0;a<s;a++){const s=t[a];s&&s.weight&&(e+=s.weight,r+=s.x*s.weight,n+=s.y*s.weight,o+=s.z*s.weight,i+=s.size*s.weight)}t.x=r/e,t.y=n/e,t.z=o/e,t.size=i/e,t.weight=e}else{const e=t;t.x=e.data.x,t.y=e.data.y,t.z=e.data.z,t.size=e.data.size,t.weight=e.data.weight}}be.copy=function(){var t,e,r=new we(this._x,this._y,this._z,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1),n=this._root;if(!n)return r;if(!n.length)return r._root=xe(n),r;for(t=[{source:n,target:r._root=new Array(8)}];n=t.pop();)for(var o=0;o<8;++o)(e=n.source[o])&&(e.length?t.push({source:e,target:n.target[o]=new Array(8)}):n.target[o]=xe(e));return r},be.add=function(t){const e=+this._x.call(null,t),r=+this._y.call(null,t),n=+this._z.call(null,t);return fe(this.cover(e,r,n),e,r,n,t)},be.addAll=function(t){Array.isArray(t)||(t=Array.from(t));const e=t.length,r=new Float64Array(e),n=new Float64Array(e),o=new Float64Array(e);let i=1/0,s=1/0,a=1/0,u=-1/0,d=-1/0,h=-1/0;for(let c,l,f,g,p=0;p<e;++p)isNaN(l=+this._x.call(null,c=t[p]))||isNaN(f=+this._y.call(null,c))||isNaN(g=+this._z.call(null,c))||(r[p]=l,n[p]=f,o[p]=g,l<i&&(i=l),l>u&&(u=l),f<s&&(s=f),f>d&&(d=f),g<a&&(a=g),g>h&&(h=g));if(i>u||s>d||a>h)return this;this.cover(i,s,a).cover(u,d,h);for(let i=0;i<e;++i)fe(this,r[i],n[i],o[i],t[i]);return this},be.cover=function(t,e,r){if(isNaN(t=+t)||isNaN(e=+e)||isNaN(r=+r))return this;var n=this._x0,o=this._y0,i=this._z0,s=this._x1,a=this._y1,u=this._z1;if(isNaN(n))s=(n=Math.floor(t))+1,a=(o=Math.floor(e))+1,u=(i=Math.floor(r))+1;else{for(var d,h,c=s-n||1,l=this._root;n>t||t>=s||o>e||e>=a||i>r||r>=u;)switch(h=(r<i)<<2|(e<o)<<1|t<n,(d=new Array(8))[h]=l,l=d,c*=2,h){case 0:s=n+c,a=o+c,u=i+c;break;case 1:n=s-c,a=o+c,u=i+c;break;case 2:s=n+c,o=a-c,u=i+c;break;case 3:n=s-c,o=a-c,u=i+c;break;case 4:s=n+c,a=o+c,i=u-c;break;case 5:n=s-c,a=o+c,i=u-c;break;case 6:s=n+c,o=a-c,i=u-c;break;case 7:n=s-c,o=a-c,i=u-c}this._root&&this._root.length&&(this._root=l)}return this._x0=n,this._y0=o,this._z0=i,this._x1=s,this._y1=a,this._z1=u,this},be.data=function(){var t=[];return this.visit((function(e){if(!e.length)do{t.push(e.data)}while(e=e.next)})),t},be.extent=function(t){return arguments.length?this.cover(+t[0][0],+t[0][1],+t[0][2]).cover(+t[1][0],+t[1][1],+t[1][2]):isNaN(this._x0)?void 0:[[this._x0,this._y0,this._z0],[this._x1,this._y1,this._z1]]},be.find=function(t,e,r,n){var o,i,s,a,u,d,h,c,l,f=this._x0,g=this._y0,p=this._z0,v=this._x1,y=this._y1,m=this._z1,w=[],x=this._root;for(x&&w.push(new ge(x,f,g,p,v,y,m)),null==n?n=1/0:(f=t-n,g=e-n,p=r-n,v=t+n,y=e+n,m=r+n,n*=n);c=w.pop();)if(!(!(x=c.node)||(i=c.x0)>v||(s=c.y0)>y||(a=c.z0)>m||(u=c.x1)<f||(d=c.y1)<g||(h=c.z1)<p))if(x.length){var b=(i+u)/2,E=(s+d)/2,N=(a+h)/2;w.push(new ge(x[7],b,E,N,u,d,h),new ge(x[6],i,E,N,b,d,h),new ge(x[5],b,s,N,u,E,h),new ge(x[4],i,s,N,b,E,h),new ge(x[3],b,E,a,u,d,N),new ge(x[2],i,E,a,b,d,N),new ge(x[1],b,s,a,u,E,N),new ge(x[0],i,s,a,b,E,N)),(l=(r>=N)<<2|(e>=E)<<1|t>=b)&&(c=w[w.length-1],w[w.length-1]=w[w.length-1-l],w[w.length-1-l]=c)}else{var _=t-+this._x.call(null,x.data),M=e-+this._y.call(null,x.data),k=r-+this._z.call(null,x.data),A=_*_+M*M+k*k;if(A<n){var j=Math.sqrt(n=A);f=t-j,g=e-j,p=r-j,v=t+j,y=e+j,m=r+j,o=x.data}}return o},be.remove=function(t){if(isNaN(i=+this._x.call(null,t))||isNaN(s=+this._y.call(null,t))||isNaN(a=+this._z.call(null,t)))return this;var e,r,n,o,i,s,a,u,d,h,c,l,f,g,p,v=this._root,y=this._x0,m=this._y0,w=this._z0,x=this._x1,b=this._y1,E=this._z1;if(!v)return this;if(v.length)for(;;){if((c=i>=(u=(y+x)/2))?y=u:x=u,(l=s>=(d=(m+b)/2))?m=d:b=d,(f=a>=(h=(w+E)/2))?w=h:E=h,e=v,!(v=v[g=f<<2|l<<1|c]))return this;if(!v.length)break;(e[g+1&7]||e[g+2&7]||e[g+3&7]||e[g+4&7]||e[g+5&7]||e[g+6&7]||e[g+7&7])&&(r=e,p=g)}for(;v.data!==t;)if(n=v,!(v=v.next))return this;return(o=v.next)&&delete v.next,n?(o?n.next=o:delete n.next,this):e?(o?e[g]=o:delete e[g],(v=e[0]||e[1]||e[2]||e[3]||e[4]||e[5]||e[6]||e[7])&&v===(e[7]||e[6]||e[5]||e[4]||e[3]||e[2]||e[1]||e[0])&&!v.length&&(r?r[p]=v:this._root=v),this):(this._root=o,this)},be.removeAll=function(t){for(var e=0,r=t.length;e<r;++e)this.remove(t[e]);return this},be.root=function(){return this._root},be.size=function(){var t=0;return this.visit((function(e){if(!e.length)do{++t}while(e=e.next)})),t},be.visit=function(t){var e,r,n,o,i,s,a,u,d=[],h=this._root;for(h&&d.push(new ge(h,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));e=d.pop();)if(!t(h=e.node,n=e.x0,o=e.y0,i=e.z0,s=e.x1,a=e.y1,u=e.z1)&&h.length){var c=(n+s)/2,l=(o+a)/2,f=(i+u)/2;(r=h[7])&&d.push(new ge(r,c,l,f,s,a,u)),(r=h[6])&&d.push(new ge(r,n,l,f,c,a,u)),(r=h[5])&&d.push(new ge(r,c,o,f,s,l,u)),(r=h[4])&&d.push(new ge(r,n,o,f,c,l,u)),(r=h[3])&&d.push(new ge(r,c,l,i,s,a,f)),(r=h[2])&&d.push(new ge(r,n,l,i,c,a,f)),(r=h[1])&&d.push(new ge(r,c,o,i,s,l,f)),(r=h[0])&&d.push(new ge(r,n,o,i,c,l,f))}return this},be.visitAfter=function(t){var e,r=[],n=[];for(this._root&&r.push(new ge(this._root,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));e=r.pop();){var o=e.node;if(o.length){var i,s=e.x0,a=e.y0,u=e.z0,d=e.x1,h=e.y1,c=e.z1,l=(s+d)/2,f=(a+h)/2,g=(u+c)/2;(i=o[0])&&r.push(new ge(i,s,a,u,l,f,g)),(i=o[1])&&r.push(new ge(i,l,a,u,d,f,g)),(i=o[2])&&r.push(new ge(i,s,f,u,l,h,g)),(i=o[3])&&r.push(new ge(i,l,f,u,d,h,g)),(i=o[4])&&r.push(new ge(i,s,a,g,l,f,c)),(i=o[5])&&r.push(new ge(i,l,a,g,d,f,c)),(i=o[6])&&r.push(new ge(i,s,f,g,l,h,c)),(i=o[7])&&r.push(new ge(i,l,f,g,d,h,c))}n.push(e)}for(;e=n.pop();)t(e.node,e.x0,e.y0,e.z0,e.x1,e.y1,e.z1);return this},be.x=function(t){return arguments.length?(this._x=t,this):this._x},be.y=function(t){return arguments.length?(this._y=t,this):this._y},be.z=function(t){return arguments.length?(this._z=t,this):this._z};const Ne=(t,e,r,n,o,i,s)=>{var a;if((null===(a=t.data)||void 0===a?void 0:a.id)===i.id)return;const u=[r,n,o][s-1],d=i.x-t.x||.1,h=i.y-t.y||.1,c=i.z-t.z||.1,l=[d,h,c],f=u-e;let g=0;for(let t=0;t<s;t++)g+=l[t]*l[t];const p=Math.sqrt(g)*g;if(f*f*.81<g){const e=t.weight/p;return i.vx+=d*e,i.vy+=h*e,i.vz+=c*e,!0}if(t.length)return!1;if(t.data!==i){const e=t.data.weight/p;i.vx+=d*e,i.vy+=h*e,i.vz+=c*e}},_e={dimensions:2,maxIteration:500,gravity:10,factor:1,edgeStrength:50,nodeStrength:1e3,coulombDisScale:.005,damping:.9,maxSpeed:200,minMovement:.4,interval:.02,linkDistance:200,clusterNodeStrength:20,preventOverlap:!0,distanceThresholdMode:"mean"};class Me{constructor(t={}){this.options=t,this.id="force",this.timeInterval=0,this.judgingDistance=0,this.running=!1,this.options=Object.assign(Object.assign({},_e),t)}execute(e,r){return t(this,void 0,void 0,(function*(){return this.genericForceLayout(!1,e,r)}))}assign(e,r){return t(this,void 0,void 0,(function*(){yield this.genericForceLayout(!0,e,r)}))}stop(){this.timeInterval&&"undefined"!=typeof window&&window.clearInterval(this.timeInterval),this.running=!1}tick(t=this.options.maxIteration||1){if(this.lastResult)return this.lastResult;for(let e=0;(this.judgingDistance>this.lastOptions.minMovement||e<1)&&e<t;e++)this.runOneStep(this.lastCalcGraph,this.lastGraph,e,this.lastVelMap,this.lastOptions),this.updatePosition(this.lastGraph,this.lastCalcGraph,this.lastVelMap,this.lastOptions);const e={nodes:this.lastLayoutNodes,edges:this.lastLayoutEdges};return this.lastAssign&&e.nodes.forEach((t=>this.lastGraph.mergeNodeData(t.id,{x:t.data.x,y:t.data.y,z:3===this.options.dimensions?t.data.z:void 0}))),e}genericForceLayout(e,r,n){return t(this,void 0,void 0,(function*(){const t=Object.assign(Object.assign({},this.options),n),o=r.getAllNodes(),i=r.getAllEdges(),s=this.formatOptions(t,r),{dimensions:a,width:d,height:h,nodeSize:l,getMass:f,nodeStrength:g,edgeStrength:p,linkDistance:v}=s,y=o.map(((t,e)=>Object.assign(Object.assign({},t),{data:Object.assign(Object.assign({},t.data),{x:c(t.data.x)?t.data.x:Math.random()*d,y:c(t.data.y)?t.data.y:Math.random()*h,z:c(t.data.z)?t.data.z:Math.random()*Math.sqrt(d*h),size:l(t)||30,mass:f(t),nodeStrength:g(t)})}))),m=i.map((t=>Object.assign(Object.assign({},t),{data:Object.assign(Object.assign({},t.data),{edgeStrength:p(t),linkDistance:v(t,r.getNode(t.source),r.getNode(t.target))})})));if(!(null==o?void 0:o.length))return this.lastResult={nodes:[],edges:i},{nodes:[],edges:i};const w={};o.forEach(((t,e)=>{w[t.id]={x:0,y:0,z:0}}));const x=new u({nodes:y,edges:m});this.formatCentripetal(s,x);const{maxIteration:b,minMovement:E,onTick:N}=s;if(this.lastLayoutNodes=y,this.lastLayoutEdges=m,this.lastAssign=e,this.lastGraph=r,this.lastCalcGraph=x,this.lastOptions=s,this.lastVelMap=w,"undefined"==typeof window)return;let _=0;return new Promise((t=>{this.timeInterval=window.setInterval((()=>{o&&this.running||t({nodes:Se(r,y),edges:i}),this.runOneStep(x,r,_,w,s),this.updatePosition(r,x,w,s),e&&y.forEach((t=>r.mergeNodeData(t.id,{x:t.data.x,y:t.data.y,z:3===a?t.data.z:void 0}))),null==N||N({nodes:Se(r,y),edges:i}),_++,(_>=b||this.judgingDistance<E)&&(window.clearInterval(this.timeInterval),t({nodes:Se(r,y),edges:i}))}),0),this.running=!0}))}))}formatOptions(t,e){const r=Object.assign({},t),{width:n,height:o,getMass:i}=t;r.width=n||"undefined"==typeof window?n:window.innerWidth,r.height=o||"undefined"==typeof window?o:window.innerHeight,t.center||(r.center=[r.width/2,r.height/2]),i||(r.getMass=t=>{let r=1;c(null==t?void 0:t.data.mass)&&(r=null==t?void 0:t.data.mass);const n=e.getDegree(t.id,"both");return!n||n<5?r:5*n*r}),r.nodeSize=Ht(t.nodeSize,t.nodeSpacing);const s=t.linkDistance?Wt(1,t.linkDistance):t=>1+r.nodeSize(e.getNode(t.source))+r.nodeSize(e.getNode(t.target));return r.linkDistance=s,r.nodeStrength=Wt(1,t.nodeStrength),r.edgeStrength=Wt(1,t.edgeStrength),r}formatCentripetal(t,e){const{dimensions:r,centripetalOptions:n,center:o,clusterNodeStrength:i,leafCluster:s,clustering:a,nodeClusterBy:u}=t,d=e.getAllNodes(),h=n||{leaf:2,single:2,others:1,center:t=>({x:o[0],y:o[1],z:3===r?o[2]:void 0})};let c,l;if("function"!=typeof i&&(t.clusterNodeStrength=t=>i),s&&u&&(c=ke(e,u),l=Array.from(new Set(null==d?void 0:d.map((t=>t.data[u]))))||[],t.centripetalOptions=Object.assign(h,{single:100,leaf:e=>{const{siblingLeaves:r,sameTypeLeaves:n}=c[e.id]||{};return(null==n?void 0:n.length)===(null==r?void 0:r.length)||1===(null==l?void 0:l.length)?1:t.clusterNodeStrength(e)},others:1,center:t=>{const r=e.getDegree(t.id,"both");if(!r)return{x:100,y:100,z:0};let n;if(1===r){const{sameTypeLeaves:e=[]}=c[t.id]||{};1===e.length?n=void 0:e.length>1&&(n=Oe(e))}else n=void 0;return{x:null==n?void 0:n.x,y:null==n?void 0:n.y,z:null==n?void 0:n.z}}})),a&&u){c||(c=ke(e,u)),l||(l=Array.from(new Set(d.map((t=>t.data[u]))))),l=l.filter((t=>void 0!==t));const r={};l.forEach((t=>{const n=d.filter((e=>e.data[u]===t)).map((t=>e.getNode(t.id)));r[t]=Oe(n)})),t.centripetalOptions=Object.assign(h,{single:e=>t.clusterNodeStrength(e),leaf:e=>t.clusterNodeStrength(e),others:e=>t.clusterNodeStrength(e),center:t=>{const e=r[t.data[u]];return{x:null==e?void 0:e.x,y:null==e?void 0:e.y,z:null==e?void 0:e.z}}})}const{leaf:f,single:g,others:p}=t.centripetalOptions||{};f&&"function"!=typeof f&&(t.centripetalOptions.leaf=()=>f),g&&"function"!=typeof g&&(t.centripetalOptions.single=()=>g),p&&"function"!=typeof p&&(t.centripetalOptions.others=()=>p)}runOneStep(t,e,r,n,o){const i={},s=t.getAllNodes(),a=t.getAllEdges();if(!(null==s?void 0:s.length))return;const{monitor:u}=o;this.calRepulsive(t,i,o),a&&this.calAttractive(t,i,o),this.calGravity(t,e,i,o),this.updateVelocity(t,i,n,o),u&&u({energy:this.calTotalEnergy(i,s),nodes:e.getAllNodes(),edges:e.getAllEdges(),iterations:r})}calTotalEnergy(t,e){if(!(null==e?void 0:e.length))return 0;let r=0;return e.forEach(((e,n)=>{const o=t[e.id].x,i=t[e.id].y,s=3===this.options.dimensions?t[e.id].z:0,a=o*o+i*i+s*s,{mass:u=1}=e.data;r+=u*a*.5})),r}calRepulsive(t,e,r){const{dimensions:n,factor:o,coulombDisScale:i}=r;!function(t,e,r,n,o=2){const i=e/r,s=t.getAllNodes(),a=s.map(((t,e)=>{const{nodeStrength:r,x:n,y:o,z:s,size:a}=t.data;return{x:n,y:o,z:s,size:a,index:e,id:t.id,vx:0,vy:0,vz:0,weight:i*r}})),u=(2===o?de(a,(t=>t.x),(t=>t.y)):me(a,(t=>t.x),(t=>t.y),(t=>t.z))).visitAfter(Ee),d=new Map;a.forEach((t=>{d.set(t.id,t),function(t,e,r){e.visit(((e,n,o,i,s)=>Ne(e,n,o,i,s,t,r)))}(t,u,o)})),a.map(((t,e)=>{const{id:r,data:o}=s[e],{mass:i=1}=o;n[r]={x:t.vx/i,y:t.vy/i,z:t.vz/i}}))}(t,o,i*i,e,n)}calAttractive(t,e,r){const{dimensions:n,nodeSize:o}=r;t.getAllEdges().forEach(((r,i)=>{const{source:s,target:a}=r,u=t.getNode(s),d=t.getNode(a);if(!u||!d)return;let h=d.data.x-u.data.x,c=d.data.y-u.data.y,l=3===n?d.data.z-u.data.z:0;h||c||(h=.01*Math.random(),c=.01*Math.random(),3!==n||l||(l=.01*Math.random()));const f=Math.sqrt(h*h+c*c+l*l);if(f<o(u)+o(d))return;const g=h/f,p=c/f,v=l/f,{linkDistance:y=200,edgeStrength:m=200}=r.data||{},w=(y-f)*m,x=1/(u.data.mass||1),b=1/(d.data.mass||1),E=g*w,N=p*w,_=v*w;e[s].x-=E*x,e[s].y-=N*x,e[s].z-=_*x,e[a].x+=E*b,e[a].y+=N*b,e[a].z+=_*b}))}calGravity(t,e,r,n){const{getCenter:o}=n,i=t.getAllNodes(),s=e.getAllNodes(),a=e.getAllEdges(),{width:u,height:d,center:h,gravity:l,centripetalOptions:f}=n;i&&i.forEach((n=>{const{id:i,data:g}=n,{mass:p,x:v,y,z:m}=g,w=e.getNode(i);let x=0,b=0,E=0,N=l;const _=t.getDegree(i,"in"),M=t.getDegree(i,"out"),k=t.getDegree(i,"both"),A=null==o?void 0:o(w,k);if(A){const[t,e,r]=A;x=v-t,b=y-e,N=r}else x=v-h[0],b=y-h[1],E=m-h[2];if(N&&(r[i].x-=N*x/p,r[i].y-=N*b/p,r[i].z-=N*E/p),f){const{leaf:t,single:e,others:n,center:o}=f,{x:h,y:l,z:g,centerStrength:x}=(null==o?void 0:o(w,s,a,u,d))||{x:0,y:0,z:0,centerStrength:0};if(!c(h)||!c(l))return;const b=(v-h)/p,E=(y-l)/p,N=(m-g)/p;if(x&&(r[i].x-=x*b,r[i].y-=x*E,r[i].z-=x*N),0===k){const t=e(w);if(!t)return;return r[i].x-=t*b,r[i].y-=t*E,void(r[i].z-=t*N)}if(0===_||0===M){const e=t(w,s,a);if(!e)return;return r[i].x-=e*b,r[i].y-=e*E,void(r[i].z-=e*N)}const A=n(w);if(!A)return;r[i].x-=A*b,r[i].y-=A*E,r[i].z-=A*N}}))}updateVelocity(t,e,r,n){const{damping:o,maxSpeed:i,interval:s,dimensions:a}=n,u=t.getAllNodes();(null==u?void 0:u.length)&&u.forEach((t=>{const{id:n}=t;let u=(r[n].x+e[n].x*s)*o||.01,d=(r[n].y+e[n].y*s)*o||.01,h=3===a?(r[n].z+e[n].z*s)*o||.01:0;const c=Math.sqrt(u*u+d*d+h*h);if(c>i){const t=i/c;u*=t,d*=t,h*=t}r[n]={x:u,y:d,z:h}}))}updatePosition(t,e,r,n){const{distanceThresholdMode:o,interval:i,dimensions:s}=n,a=e.getAllNodes();if(!(null==a?void 0:a.length))return void(this.judgingDistance=0);let u=0;"max"===o?this.judgingDistance=-1/0:"min"===o&&(this.judgingDistance=1/0),a.forEach((n=>{const{id:a}=n,d=t.getNode(a);if(c(d.data.fx)&&c(d.data.fy))return void e.mergeNodeData(a,{x:d.data.fx,y:d.data.fy,z:3===s?d.data.fz:void 0});const h=r[a].x*i,l=r[a].y*i,f=3===s?r[a].z*i:0;e.mergeNodeData(a,{x:n.data.x+h,y:n.data.y+l,z:n.data.z+f});const g=Math.sqrt(h*h+l*l+f*f);switch(o){case"max":this.judgingDistance<g&&(this.judgingDistance=g);break;case"min":this.judgingDistance>g&&(this.judgingDistance=g);break;default:u+=g}})),o&&"mean"!==o||(this.judgingDistance=u/a.length)}}const ke=(t,e)=>{const r=t.getAllNodes();if(!(null==r?void 0:r.length))return{};const n={};return r.forEach(((r,o)=>{1===t.getDegree(r.id,"both")&&(n[r.id]=Ae(t,"leaf",r,e))})),n},Ae=(t,e,r,n)=>{const o=t.getDegree(r.id,"in"),i=t.getDegree(r.id,"out");let s=r,a=[];return 0===o?(s=t.getSuccessors(r.id)[0],a=t.getNeighbors(s.id)):0===i&&(s=t.getPredecessors(r.id)[0],a=t.getNeighbors(s.id)),a=a.filter((e=>0===t.getDegree(e.id,"in")||0===t.getDegree(e.id,"out"))),{coreNode:s,siblingLeaves:a,sameTypeLeaves:je(t,e,n,r,a)}},je=(t,e,r,n,o)=>{const i=n.data[r]||"";let s=(null==o?void 0:o.filter((t=>t.data[r]===i)))||[];return"leaf"===e&&(s=s.filter((e=>0===t.getDegree(e.id,"in")||0===t.getDegree(e.id,"out")))),s},Oe=t=>{const e={x:0,y:0};t.forEach((t=>{const{x:r,y:n}=t.data;e.x+=r||0,e.y+=n||0}));const r=t.length||1;return{x:e.x/r,y:e.y/r}},Se=(t,e)=>e.map((e=>{const{id:r,data:n}=e,o=t.getNode(r);return Object.assign(Object.assign({},o),{data:Object.assign(Object.assign({},o.data),{x:n.x,y:n.y,z:n.z})})})),ze=Object.prototype.toString;function Re(t){const e=ze.call(t);return e.endsWith("Array]")&&!e.includes("Big")}function Ie(t){var e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!Re(t))throw new TypeError("input must be an array");if(0===t.length)throw new TypeError("input must not be empty");if(void 0!==r.output){if(!Re(r.output))throw new TypeError("output option must be an array if specified");e=r.output}else e=new Array(t.length);var n=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!Re(t))throw new TypeError("input must be an array");if(0===t.length)throw new TypeError("input must not be empty");var r=e.fromIndex,n=void 0===r?0:r,o=e.toIndex,i=void 0===o?t.length:o;if(n<0||n>=t.length||!Number.isInteger(n))throw new Error("fromIndex must be a positive integer smaller than length");if(i<=n||i>t.length||!Number.isInteger(i))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var s=t[n],a=n+1;a<i;a++)t[a]<s&&(s=t[a]);return s}(t),o=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!Re(t))throw new TypeError("input must be an array");if(0===t.length)throw new TypeError("input must not be empty");var r=e.fromIndex,n=void 0===r?0:r,o=e.toIndex,i=void 0===o?t.length:o;if(n<0||n>=t.length||!Number.isInteger(n))throw new Error("fromIndex must be a positive integer smaller than length");if(i<=n||i>t.length||!Number.isInteger(i))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var s=t[n],a=n+1;a<i;a++)t[a]>s&&(s=t[a]);return s}(t);if(n===o)throw new RangeError("minimum and maximum input values are equal. Cannot rescale a constant array");var i=r.min,s=void 0===i?r.autoMinMax?n:0:i,a=r.max,u=void 0===a?r.autoMinMax?o:1:a;if(s>=u)throw new RangeError("min option must be smaller than max option");for(var d=(u-s)/(o-n),h=0;h<t.length;h++)e[h]=(t[h]-n)*d+s;return e}const Pe=" ".repeat(2),Ce=" ".repeat(4);function De(t,e={}){const{maxRows:r=15,maxColumns:n=10,maxNumSize:o=8,padMinus:i="auto"}=e;return`${t.constructor.name} {\\n${Pe}[\\n${Ce}${function(t,e,r,n,o){const{rows:i,columns:s}=t,a=Math.min(i,e),u=Math.min(s,r),d=[];if("auto"===o){o=!1;t:for(let e=0;e<a;e++)for(let r=0;r<u;r++)if(t.get(e,r)<0){o=!0;break t}}for(let e=0;e<a;e++){let r=[];for(let i=0;i<u;i++)r.push(Te(t.get(e,i),n,o));d.push(`${r.join(" ")}`)}return u!==s&&(d[d.length-1]+=` ... ${s-r} more columns`),a!==i&&d.push(`... ${i-e} more rows`),d.join(`\\n${Ce}`)}(t,r,n,o,i)}\\n${Pe}]\\n${Pe}rows: ${t.rows}\\n${Pe}columns: ${t.columns}\\n}`}function Te(t,e,r){return(t>=0&&r?` ${Le(t,e-1)}`:Le(t,e)).padEnd(e)}function Le(t,e){let r=t.toString();if(r.length<=e)return r;let n=t.toFixed(e);if(n.length>e&&(n=t.toFixed(Math.max(0,e-(n.length-e)))),n.length<=e&&!n.startsWith("0.000")&&!n.startsWith("-0.000"))return n;let o=t.toExponential(e);return o.length>e&&(o=t.toExponential(Math.max(0,e-(o.length-e)))),o.slice(0)}function Fe(t,e,r){let n=r?t.rows:t.rows-1;if(e<0||e>n)throw new RangeError("Row index out of range")}function qe(t,e,r){let n=r?t.columns:t.columns-1;if(e<0||e>n)throw new RangeError("Column index out of range")}function Ve(t,e){if(e.to1DArray&&(e=e.to1DArray()),e.length!==t.columns)throw new RangeError("vector size must be the same as the number of columns");return e}function Be(t,e){if(e.to1DArray&&(e=e.to1DArray()),e.length!==t.rows)throw new RangeError("vector size must be the same as the number of rows");return e}function $e(t,e,r,n,o){if(5!==arguments.length)throw new RangeError("expected 4 arguments");if(Ue("startRow",e),Ue("endRow",r),Ue("startColumn",n),Ue("endColumn",o),e>r||n>o||e<0||e>=t.rows||r<0||r>=t.rows||n<0||n>=t.columns||o<0||o>=t.columns)throw new RangeError("Submatrix indices are out of range")}function Ge(t,e=0){let r=[];for(let n=0;n<t;n++)r.push(e);return r}function Ue(t,e){if("number"!=typeof e)throw new TypeError(`${t} must be a number`)}function We(t){if(t.isEmpty())throw new Error("Empty matrix has no elements to index")}class Ye{static from1DArray(t,e,r){if(t*e!==r.length)throw new RangeError("data length does not match given dimensions");let n=new Ke(t,e);for(let o=0;o<t;o++)for(let t=0;t<e;t++)n.set(o,t,r[o*e+t]);return n}static rowVector(t){let e=new Ke(1,t.length);for(let r=0;r<t.length;r++)e.set(0,r,t[r]);return e}static columnVector(t){let e=new Ke(t.length,1);for(let r=0;r<t.length;r++)e.set(r,0,t[r]);return e}static zeros(t,e){return new Ke(t,e)}static ones(t,e){return new Ke(t,e).fill(1)}static rand(t,e,r={}){if("object"!=typeof r)throw new TypeError("options must be an object");const{random:n=Math.random}=r;let o=new Ke(t,e);for(let r=0;r<t;r++)for(let t=0;t<e;t++)o.set(r,t,n());return o}static randInt(t,e,r={}){if("object"!=typeof r)throw new TypeError("options must be an object");const{min:n=0,max:o=1e3,random:i=Math.random}=r;if(!Number.isInteger(n))throw new TypeError("min must be an integer");if(!Number.isInteger(o))throw new TypeError("max must be an integer");if(n>=o)throw new RangeError("min must be smaller than max");let s=o-n,a=new Ke(t,e);for(let r=0;r<t;r++)for(let t=0;t<e;t++){let e=n+Math.round(i()*s);a.set(r,t,e)}return a}static eye(t,e,r){void 0===e&&(e=t),void 0===r&&(r=1);let n=Math.min(t,e),o=this.zeros(t,e);for(let t=0;t<n;t++)o.set(t,t,r);return o}static diag(t,e,r){let n=t.length;void 0===e&&(e=n),void 0===r&&(r=e);let o=Math.min(n,e,r),i=this.zeros(e,r);for(let e=0;e<o;e++)i.set(e,e,t[e]);return i}static min(t,e){t=this.checkMatrix(t),e=this.checkMatrix(e);let r=t.rows,n=t.columns,o=new Ke(r,n);for(let i=0;i<r;i++)for(let r=0;r<n;r++)o.set(i,r,Math.min(t.get(i,r),e.get(i,r)));return o}static max(t,e){t=this.checkMatrix(t),e=this.checkMatrix(e);let r=t.rows,n=t.columns,o=new this(r,n);for(let i=0;i<r;i++)for(let r=0;r<n;r++)o.set(i,r,Math.max(t.get(i,r),e.get(i,r)));return o}static checkMatrix(t){return Ye.isMatrix(t)?t:new Ke(t)}static isMatrix(t){return null!=t&&"Matrix"===t.klass}get size(){return this.rows*this.columns}apply(t){if("function"!=typeof t)throw new TypeError("callback must be a function");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)t.call(this,e,r);return this}to1DArray(){let t=[];for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)t.push(this.get(e,r));return t}to2DArray(){let t=[];for(let e=0;e<this.rows;e++){t.push([]);for(let r=0;r<this.columns;r++)t[e].push(this.get(e,r))}return t}toJSON(){return this.to2DArray()}isRowVector(){return 1===this.rows}isColumnVector(){return 1===this.columns}isVector(){return 1===this.rows||1===this.columns}isSquare(){return this.rows===this.columns}isEmpty(){return 0===this.rows||0===this.columns}isSymmetric(){if(this.isSquare()){for(let t=0;t<this.rows;t++)for(let e=0;e<=t;e++)if(this.get(t,e)!==this.get(e,t))return!1;return!0}return!1}isEchelonForm(){let t=0,e=0,r=-1,n=!0,o=!1;for(;t<this.rows&&n;){for(e=0,o=!1;e<this.columns&&!1===o;)0===this.get(t,e)?e++:1===this.get(t,e)&&e>r?(o=!0,r=e):(n=!1,o=!0);t++}return n}isReducedEchelonForm(){let t=0,e=0,r=-1,n=!0,o=!1;for(;t<this.rows&&n;){for(e=0,o=!1;e<this.columns&&!1===o;)0===this.get(t,e)?e++:1===this.get(t,e)&&e>r?(o=!0,r=e):(n=!1,o=!0);for(let r=e+1;r<this.rows;r++)0!==this.get(t,r)&&(n=!1);t++}return n}echelonForm(){let t=this.clone(),e=0,r=0;for(;e<t.rows&&r<t.columns;){let n=e;for(let o=e;o<t.rows;o++)t.get(o,r)>t.get(n,r)&&(n=o);if(0===t.get(n,r))r++;else{t.swapRows(e,n);let o=t.get(e,r);for(let n=r;n<t.columns;n++)t.set(e,n,t.get(e,n)/o);for(let n=e+1;n<t.rows;n++){let o=t.get(n,r)/t.get(e,r);t.set(n,r,0);for(let i=r+1;i<t.columns;i++)t.set(n,i,t.get(n,i)-t.get(e,i)*o)}e++,r++}}return t}reducedEchelonForm(){let t=this.echelonForm(),e=t.columns,r=t.rows,n=r-1;for(;n>=0;)if(0===t.maxRow(n))n--;else{let o=0,i=!1;for(;o<r&&!1===i;)1===t.get(n,o)?i=!0:o++;for(let r=0;r<n;r++){let i=t.get(r,o);for(let s=o;s<e;s++){let e=t.get(r,s)-i*t.get(n,s);t.set(r,s,e)}}n--}return t}set(){throw new Error("set method is unimplemented")}get(){throw new Error("get method is unimplemented")}repeat(t={}){if("object"!=typeof t)throw new TypeError("options must be an object");const{rows:e=1,columns:r=1}=t;if(!Number.isInteger(e)||e<=0)throw new TypeError("rows must be a positive integer");if(!Number.isInteger(r)||r<=0)throw new TypeError("columns must be a positive integer");let n=new Ke(this.rows*e,this.columns*r);for(let t=0;t<e;t++)for(let e=0;e<r;e++)n.setSubMatrix(this,this.rows*t,this.columns*e);return n}fill(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,t);return this}neg(){return this.mulS(-1)}getRow(t){Fe(this,t);let e=[];for(let r=0;r<this.columns;r++)e.push(this.get(t,r));return e}getRowVector(t){return Ke.rowVector(this.getRow(t))}setRow(t,e){Fe(this,t),e=Ve(this,e);for(let r=0;r<this.columns;r++)this.set(t,r,e[r]);return this}swapRows(t,e){Fe(this,t),Fe(this,e);for(let r=0;r<this.columns;r++){let n=this.get(t,r);this.set(t,r,this.get(e,r)),this.set(e,r,n)}return this}getColumn(t){qe(this,t);let e=[];for(let r=0;r<this.rows;r++)e.push(this.get(r,t));return e}getColumnVector(t){return Ke.columnVector(this.getColumn(t))}setColumn(t,e){qe(this,t),e=Be(this,e);for(let r=0;r<this.rows;r++)this.set(r,t,e[r]);return this}swapColumns(t,e){qe(this,t),qe(this,e);for(let r=0;r<this.rows;r++){let n=this.get(r,t);this.set(r,t,this.get(r,e)),this.set(r,e,n)}return this}addRowVector(t){t=Ve(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)+t[r]);return this}subRowVector(t){t=Ve(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)-t[r]);return this}mulRowVector(t){t=Ve(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)*t[r]);return this}divRowVector(t){t=Ve(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)/t[r]);return this}addColumnVector(t){t=Be(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)+t[e]);return this}subColumnVector(t){t=Be(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)-t[e]);return this}mulColumnVector(t){t=Be(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)*t[e]);return this}divColumnVector(t){t=Be(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)/t[e]);return this}mulRow(t,e){Fe(this,t);for(let r=0;r<this.columns;r++)this.set(t,r,this.get(t,r)*e);return this}mulColumn(t,e){qe(this,t);for(let r=0;r<this.rows;r++)this.set(r,t,this.get(r,t)*e);return this}max(t){if(this.isEmpty())return NaN;switch(t){case"row":{const t=new Array(this.rows).fill(Number.NEGATIVE_INFINITY);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.get(e,r)>t[e]&&(t[e]=this.get(e,r));return t}case"column":{const t=new Array(this.columns).fill(Number.NEGATIVE_INFINITY);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.get(e,r)>t[r]&&(t[r]=this.get(e,r));return t}case void 0:{let t=this.get(0,0);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.get(e,r)>t&&(t=this.get(e,r));return t}default:throw new Error(`invalid option: ${t}`)}}maxIndex(){We(this);let t=this.get(0,0),e=[0,0];for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.get(r,n)>t&&(t=this.get(r,n),e[0]=r,e[1]=n);return e}min(t){if(this.isEmpty())return NaN;switch(t){case"row":{const t=new Array(this.rows).fill(Number.POSITIVE_INFINITY);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.get(e,r)<t[e]&&(t[e]=this.get(e,r));return t}case"column":{const t=new Array(this.columns).fill(Number.POSITIVE_INFINITY);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.get(e,r)<t[r]&&(t[r]=this.get(e,r));return t}case void 0:{let t=this.get(0,0);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.get(e,r)<t&&(t=this.get(e,r));return t}default:throw new Error(`invalid option: ${t}`)}}minIndex(){We(this);let t=this.get(0,0),e=[0,0];for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.get(r,n)<t&&(t=this.get(r,n),e[0]=r,e[1]=n);return e}maxRow(t){if(Fe(this,t),this.isEmpty())return NaN;let e=this.get(t,0);for(let r=1;r<this.columns;r++)this.get(t,r)>e&&(e=this.get(t,r));return e}maxRowIndex(t){Fe(this,t),We(this);let e=this.get(t,0),r=[t,0];for(let n=1;n<this.columns;n++)this.get(t,n)>e&&(e=this.get(t,n),r[1]=n);return r}minRow(t){if(Fe(this,t),this.isEmpty())return NaN;let e=this.get(t,0);for(let r=1;r<this.columns;r++)this.get(t,r)<e&&(e=this.get(t,r));return e}minRowIndex(t){Fe(this,t),We(this);let e=this.get(t,0),r=[t,0];for(let n=1;n<this.columns;n++)this.get(t,n)<e&&(e=this.get(t,n),r[1]=n);return r}maxColumn(t){if(qe(this,t),this.isEmpty())return NaN;let e=this.get(0,t);for(let r=1;r<this.rows;r++)this.get(r,t)>e&&(e=this.get(r,t));return e}maxColumnIndex(t){qe(this,t),We(this);let e=this.get(0,t),r=[0,t];for(let n=1;n<this.rows;n++)this.get(n,t)>e&&(e=this.get(n,t),r[0]=n);return r}minColumn(t){if(qe(this,t),this.isEmpty())return NaN;let e=this.get(0,t);for(let r=1;r<this.rows;r++)this.get(r,t)<e&&(e=this.get(r,t));return e}minColumnIndex(t){qe(this,t),We(this);let e=this.get(0,t),r=[0,t];for(let n=1;n<this.rows;n++)this.get(n,t)<e&&(e=this.get(n,t),r[0]=n);return r}diag(){let t=Math.min(this.rows,this.columns),e=[];for(let r=0;r<t;r++)e.push(this.get(r,r));return e}norm(t="frobenius"){let e=0;if("max"===t)return this.max();if("frobenius"===t){for(let t=0;t<this.rows;t++)for(let r=0;r<this.columns;r++)e+=this.get(t,r)*this.get(t,r);return Math.sqrt(e)}throw new RangeError(`unknown norm type: ${t}`)}cumulativeSum(){let t=0;for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)t+=this.get(e,r),this.set(e,r,t);return this}dot(t){Ye.isMatrix(t)&&(t=t.to1DArray());let e=this.to1DArray();if(e.length!==t.length)throw new RangeError("vectors do not have the same size");let r=0;for(let n=0;n<e.length;n++)r+=e[n]*t[n];return r}mmul(t){t=Ke.checkMatrix(t);let e=this.rows,r=this.columns,n=t.columns,o=new Ke(e,n),i=new Float64Array(r);for(let s=0;s<n;s++){for(let e=0;e<r;e++)i[e]=t.get(e,s);for(let t=0;t<e;t++){let e=0;for(let n=0;n<r;n++)e+=this.get(t,n)*i[n];o.set(t,s,e)}}return o}strassen2x2(t){t=Ke.checkMatrix(t);let e=new Ke(2,2);const r=this.get(0,0),n=t.get(0,0),o=this.get(0,1),i=t.get(0,1),s=this.get(1,0),a=t.get(1,0),u=this.get(1,1),d=t.get(1,1),h=(r+u)*(n+d),c=(s+u)*n,l=r*(i-d),f=u*(a-n),g=(r+o)*d,p=h+f-g+(o-u)*(a+d),v=l+g,y=c+f,m=h-c+l+(s-r)*(n+i);return e.set(0,0,p),e.set(0,1,v),e.set(1,0,y),e.set(1,1,m),e}strassen3x3(t){t=Ke.checkMatrix(t);let e=new Ke(3,3);const r=this.get(0,0),n=this.get(0,1),o=this.get(0,2),i=this.get(1,0),s=this.get(1,1),a=this.get(1,2),u=this.get(2,0),d=this.get(2,1),h=this.get(2,2),c=t.get(0,0),l=t.get(0,1),f=t.get(0,2),g=t.get(1,0),p=t.get(1,1),v=t.get(1,2),y=t.get(2,0),m=t.get(2,1),w=t.get(2,2),x=(r-i)*(-l+p),b=(-r+i+s)*(c-l+p),E=(i+s)*(-c+l),N=r*c,_=(-r+u+d)*(c-f+v),M=(-r+u)*(f-v),k=(u+d)*(-c+f),A=(-o+d+h)*(p+y-m),j=(o-h)*(p-m),O=o*y,S=(d+h)*(-y+m),z=(-o+s+a)*(v+y-w),R=(o-a)*(v-w),I=(s+a)*(-y+w),P=N+O+n*g,C=(r+n+o-i-s-d-h)*p+b+E+N+A+O+S,D=N+_+k+(r+n+o-s-a-u-d)*v+O+z+I,T=x+s*(-c+l+g-p-v-y+w)+b+N+O+z+R,L=x+b+E+N+a*m,F=O+z+R+I+i*f,q=N+_+M+d*(-c+f+g-p-v-y+m)+A+j+O,V=A+j+O+S+u*l,B=N+_+M+k+h*w;return e.set(0,0,P),e.set(0,1,C),e.set(0,2,D),e.set(1,0,T),e.set(1,1,L),e.set(1,2,F),e.set(2,0,q),e.set(2,1,V),e.set(2,2,B),e}mmulStrassen(t){t=Ke.checkMatrix(t);let e=this.clone(),r=e.rows,n=e.columns,o=t.rows,i=t.columns;function s(t,e,r){let n=t.rows,o=t.columns;if(n===e&&o===r)return t;{let n=Ye.zeros(e,r);return n=n.setSubMatrix(t,0,0),n}}n!==o&&console.warn(`Multiplying ${r} x ${n} and ${o} x ${i} matrix: dimensions do not match.`);let a=Math.max(r,o),u=Math.max(n,i);return e=s(e,a,u),function t(e,r,n,o){if(n<=512||o<=512)return e.mmul(r);n%2==1&&o%2==1?(e=s(e,n+1,o+1),r=s(r,n+1,o+1)):n%2==1?(e=s(e,n+1,o),r=s(r,n+1,o)):o%2==1&&(e=s(e,n,o+1),r=s(r,n,o+1));let i=parseInt(e.rows/2,10),a=parseInt(e.columns/2,10),u=e.subMatrix(0,i-1,0,a-1),d=r.subMatrix(0,i-1,0,a-1),h=e.subMatrix(0,i-1,a,e.columns-1),c=r.subMatrix(0,i-1,a,r.columns-1),l=e.subMatrix(i,e.rows-1,0,a-1),f=r.subMatrix(i,r.rows-1,0,a-1),g=e.subMatrix(i,e.rows-1,a,e.columns-1),p=r.subMatrix(i,r.rows-1,a,r.columns-1),v=t(Ye.add(u,g),Ye.add(d,p),i,a),y=t(Ye.add(l,g),d,i,a),m=t(u,Ye.sub(c,p),i,a),w=t(g,Ye.sub(f,d),i,a),x=t(Ye.add(u,h),p,i,a),b=t(Ye.sub(l,u),Ye.add(d,c),i,a),E=t(Ye.sub(h,g),Ye.add(f,p),i,a),N=Ye.add(v,w);N.sub(x),N.add(E);let _=Ye.add(m,x),M=Ye.add(y,w),k=Ye.sub(v,y);k.add(m),k.add(b);let A=Ye.zeros(2*N.rows,2*N.columns);return A=A.setSubMatrix(N,0,0),A=A.setSubMatrix(_,N.rows,0),A=A.setSubMatrix(M,0,N.columns),A=A.setSubMatrix(k,N.rows,N.columns),A.subMatrix(0,n-1,0,o-1)}(e,t=s(t,a,u),a,u)}scaleRows(t={}){if("object"!=typeof t)throw new TypeError("options must be an object");const{min:e=0,max:r=1}=t;if(!Number.isFinite(e))throw new TypeError("min must be a number");if(!Number.isFinite(r))throw new TypeError("max must be a number");if(e>=r)throw new RangeError("min must be smaller than max");let n=new Ke(this.rows,this.columns);for(let t=0;t<this.rows;t++){const o=this.getRow(t);o.length>0&&Ie(o,{min:e,max:r,output:o}),n.setRow(t,o)}return n}scaleColumns(t={}){if("object"!=typeof t)throw new TypeError("options must be an object");const{min:e=0,max:r=1}=t;if(!Number.isFinite(e))throw new TypeError("min must be a number");if(!Number.isFinite(r))throw new TypeError("max must be a number");if(e>=r)throw new RangeError("min must be smaller than max");let n=new Ke(this.rows,this.columns);for(let t=0;t<this.columns;t++){const o=this.getColumn(t);o.length&&Ie(o,{min:e,max:r,output:o}),n.setColumn(t,o)}return n}flipRows(){const t=Math.ceil(this.columns/2);for(let e=0;e<this.rows;e++)for(let r=0;r<t;r++){let t=this.get(e,r),n=this.get(e,this.columns-1-r);this.set(e,r,n),this.set(e,this.columns-1-r,t)}return this}flipColumns(){const t=Math.ceil(this.rows/2);for(let e=0;e<this.columns;e++)for(let r=0;r<t;r++){let t=this.get(r,e),n=this.get(this.rows-1-r,e);this.set(r,e,n),this.set(this.rows-1-r,e,t)}return this}kroneckerProduct(t){t=Ke.checkMatrix(t);let e=this.rows,r=this.columns,n=t.rows,o=t.columns,i=new Ke(e*n,r*o);for(let s=0;s<e;s++)for(let e=0;e<r;e++)for(let r=0;r<n;r++)for(let a=0;a<o;a++)i.set(n*s+r,o*e+a,this.get(s,e)*t.get(r,a));return i}kroneckerSum(t){if(t=Ke.checkMatrix(t),!this.isSquare()||!t.isSquare())throw new Error("Kronecker Sum needs two Square Matrices");let e=this.rows,r=t.rows,n=this.kroneckerProduct(Ke.eye(r,r)),o=Ke.eye(e,e).kroneckerProduct(t);return n.add(o)}transpose(){let t=new Ke(this.columns,this.rows);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)t.set(r,e,this.get(e,r));return t}sortRows(t=He){for(let e=0;e<this.rows;e++)this.setRow(e,this.getRow(e).sort(t));return this}sortColumns(t=He){for(let e=0;e<this.columns;e++)this.setColumn(e,this.getColumn(e).sort(t));return this}subMatrix(t,e,r,n){$e(this,t,e,r,n);let o=new Ke(e-t+1,n-r+1);for(let i=t;i<=e;i++)for(let e=r;e<=n;e++)o.set(i-t,e-r,this.get(i,e));return o}subMatrixRow(t,e,r){if(void 0===e&&(e=0),void 0===r&&(r=this.columns-1),e>r||e<0||e>=this.columns||r<0||r>=this.columns)throw new RangeError("Argument out of range");let n=new Ke(t.length,r-e+1);for(let o=0;o<t.length;o++)for(let i=e;i<=r;i++){if(t[o]<0||t[o]>=this.rows)throw new RangeError(`Row index out of range: ${t[o]}`);n.set(o,i-e,this.get(t[o],i))}return n}subMatrixColumn(t,e,r){if(void 0===e&&(e=0),void 0===r&&(r=this.rows-1),e>r||e<0||e>=this.rows||r<0||r>=this.rows)throw new RangeError("Argument out of range");let n=new Ke(r-e+1,t.length);for(let o=0;o<t.length;o++)for(let i=e;i<=r;i++){if(t[o]<0||t[o]>=this.columns)throw new RangeError(`Column index out of range: ${t[o]}`);n.set(i-e,o,this.get(i,t[o]))}return n}setSubMatrix(t,e,r){if((t=Ke.checkMatrix(t)).isEmpty())return this;$e(this,e,e+t.rows-1,r,r+t.columns-1);for(let n=0;n<t.rows;n++)for(let o=0;o<t.columns;o++)this.set(e+n,r+o,t.get(n,o));return this}selection(t,e){!function(t,e){if(!Re(e))throw new TypeError("row indices must be an array");for(let r=0;r<e.length;r++)if(e[r]<0||e[r]>=t.rows)throw new RangeError("row indices are out of range")}(this,t),function(t,e){if(!Re(e))throw new TypeError("column indices must be an array");for(let r=0;r<e.length;r++)if(e[r]<0||e[r]>=t.columns)throw new RangeError("column indices are out of range")}(this,e);let r=new Ke(t.length,e.length);for(let n=0;n<t.length;n++){let o=t[n];for(let t=0;t<e.length;t++){let i=e[t];r.set(n,t,this.get(o,i))}}return r}trace(){let t=Math.min(this.rows,this.columns),e=0;for(let r=0;r<t;r++)e+=this.get(r,r);return e}clone(){let t=new Ke(this.rows,this.columns);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)t.set(e,r,this.get(e,r));return t}sum(t){switch(t){case"row":return function(t){let e=Ge(t.rows);for(let r=0;r<t.rows;++r)for(let n=0;n<t.columns;++n)e[r]+=t.get(r,n);return e}(this);case"column":return function(t){let e=Ge(t.columns);for(let r=0;r<t.rows;++r)for(let n=0;n<t.columns;++n)e[n]+=t.get(r,n);return e}(this);case void 0:return function(t){let e=0;for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)e+=t.get(r,n);return e}(this);default:throw new Error(`invalid option: ${t}`)}}product(t){switch(t){case"row":return function(t){let e=Ge(t.rows,1);for(let r=0;r<t.rows;++r)for(let n=0;n<t.columns;++n)e[r]*=t.get(r,n);return e}(this);case"column":return function(t){let e=Ge(t.columns,1);for(let r=0;r<t.rows;++r)for(let n=0;n<t.columns;++n)e[n]*=t.get(r,n);return e}(this);case void 0:return function(t){let e=1;for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)e*=t.get(r,n);return e}(this);default:throw new Error(`invalid option: ${t}`)}}mean(t){const e=this.sum(t);switch(t){case"row":for(let t=0;t<this.rows;t++)e[t]/=this.columns;return e;case"column":for(let t=0;t<this.columns;t++)e[t]/=this.rows;return e;case void 0:return e/this.size;default:throw new Error(`invalid option: ${t}`)}}variance(t,e={}){if("object"==typeof t&&(e=t,t=void 0),"object"!=typeof e)throw new TypeError("options must be an object");const{unbiased:r=!0,mean:n=this.mean(t)}=e;if("boolean"!=typeof r)throw new TypeError("unbiased must be a boolean");switch(t){case"row":if(!Re(n))throw new TypeError("mean must be an array");return function(t,e,r){const n=t.rows,o=t.columns,i=[];for(let s=0;s<n;s++){let n=0,a=0,u=0;for(let e=0;e<o;e++)u=t.get(s,e)-r[s],n+=u,a+=u*u;e?i.push((a-n*n/o)/(o-1)):i.push((a-n*n/o)/o)}return i}(this,r,n);case"column":if(!Re(n))throw new TypeError("mean must be an array");return function(t,e,r){const n=t.rows,o=t.columns,i=[];for(let s=0;s<o;s++){let o=0,a=0,u=0;for(let e=0;e<n;e++)u=t.get(e,s)-r[s],o+=u,a+=u*u;e?i.push((a-o*o/n)/(n-1)):i.push((a-o*o/n)/n)}return i}(this,r,n);case void 0:if("number"!=typeof n)throw new TypeError("mean must be a number");return function(t,e,r){const n=t.rows,o=t.columns,i=n*o;let s=0,a=0,u=0;for(let e=0;e<n;e++)for(let n=0;n<o;n++)u=t.get(e,n)-r,s+=u,a+=u*u;return e?(a-s*s/i)/(i-1):(a-s*s/i)/i}(this,r,n);default:throw new Error(`invalid option: ${t}`)}}standardDeviation(t,e){"object"==typeof t&&(e=t,t=void 0);const r=this.variance(t,e);if(void 0===t)return Math.sqrt(r);for(let t=0;t<r.length;t++)r[t]=Math.sqrt(r[t]);return r}center(t,e={}){if("object"==typeof t&&(e=t,t=void 0),"object"!=typeof e)throw new TypeError("options must be an object");const{center:r=this.mean(t)}=e;switch(t){case"row":if(!Re(r))throw new TypeError("center must be an array");return function(t,e){for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)t.set(r,n,t.get(r,n)-e[r])}(this,r),this;case"column":if(!Re(r))throw new TypeError("center must be an array");return function(t,e){for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)t.set(r,n,t.get(r,n)-e[n])}(this,r),this;case void 0:if("number"!=typeof r)throw new TypeError("center must be a number");return function(t,e){for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)t.set(r,n,t.get(r,n)-e)}(this,r),this;default:throw new Error(`invalid option: ${t}`)}}scale(t,e={}){if("object"==typeof t&&(e=t,t=void 0),"object"!=typeof e)throw new TypeError("options must be an object");let r=e.scale;switch(t){case"row":if(void 0===r)r=function(t){const e=[];for(let r=0;r<t.rows;r++){let n=0;for(let e=0;e<t.columns;e++)n+=Math.pow(t.get(r,e),2)/(t.columns-1);e.push(Math.sqrt(n))}return e}(this);else if(!Re(r))throw new TypeError("scale must be an array");return function(t,e){for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)t.set(r,n,t.get(r,n)/e[r])}(this,r),this;case"column":if(void 0===r)r=function(t){const e=[];for(let r=0;r<t.columns;r++){let n=0;for(let e=0;e<t.rows;e++)n+=Math.pow(t.get(e,r),2)/(t.rows-1);e.push(Math.sqrt(n))}return e}(this);else if(!Re(r))throw new TypeError("scale must be an array");return function(t,e){for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)t.set(r,n,t.get(r,n)/e[n])}(this,r),this;case void 0:if(void 0===r)r=function(t){const e=t.size-1;let r=0;for(let n=0;n<t.columns;n++)for(let o=0;o<t.rows;o++)r+=Math.pow(t.get(o,n),2)/e;return Math.sqrt(r)}(this);else if("number"!=typeof r)throw new TypeError("scale must be a number");return function(t,e){for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)t.set(r,n,t.get(r,n)/e)}(this,r),this;default:throw new Error(`invalid option: ${t}`)}}toString(t){return De(this,t)}}function He(t,e){return t-e}Ye.prototype.klass="Matrix","undefined"!=typeof Symbol&&(Ye.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return De(this)}),Ye.random=Ye.rand,Ye.randomInt=Ye.randInt,Ye.diagonal=Ye.diag,Ye.prototype.diagonal=Ye.prototype.diag,Ye.identity=Ye.eye,Ye.prototype.negate=Ye.prototype.neg,Ye.prototype.tensorProduct=Ye.prototype.kroneckerProduct;class Ke extends Ye{constructor(t,e){if(super(),Ke.isMatrix(t))return t.clone();if(Number.isInteger(t)&&t>=0){if(this.data=[],!(Number.isInteger(e)&&e>=0))throw new TypeError("nColumns must be a positive integer");for(let r=0;r<t;r++)this.data.push(new Float64Array(e))}else{if(!Re(t))throw new TypeError("First argument must be a positive number or an array");{const r=t;if("number"!=typeof(e=(t=r.length)?r[0].length:0))throw new TypeError("Data must be a 2D array with at least one element");this.data=[];for(let n=0;n<t;n++){if(r[n].length!==e)throw new RangeError("Inconsistent array dimensions");if(!r[n].every((t=>"number"==typeof t)))throw new TypeError("Input data contains non-numeric values");this.data.push(Float64Array.from(r[n]))}}}this.rows=t,this.columns=e}set(t,e,r){return this.data[t][e]=r,this}get(t,e){return this.data[t][e]}removeRow(t){return Fe(this,t),this.data.splice(t,1),this.rows-=1,this}addRow(t,e){return void 0===e&&(e=t,t=this.rows),Fe(this,t,!0),e=Float64Array.from(Ve(this,e)),this.data.splice(t,0,e),this.rows+=1,this}removeColumn(t){qe(this,t);for(let e=0;e<this.rows;e++){const r=new Float64Array(this.columns-1);for(let n=0;n<t;n++)r[n]=this.data[e][n];for(let n=t+1;n<this.columns;n++)r[n-1]=this.data[e][n];this.data[e]=r}return this.columns-=1,this}addColumn(t,e){void 0===e&&(e=t,t=this.columns),qe(this,t,!0),e=Be(this,e);for(let r=0;r<this.rows;r++){const n=new Float64Array(this.columns+1);let o=0;for(;o<t;o++)n[o]=this.data[r][o];for(n[o++]=e[r];o<this.columns+1;o++)n[o]=this.data[r][o-1];this.data[r]=n}return this.columns+=1,this}}!function(t,e){t.prototype.add=function(t){return"number"==typeof t?this.addS(t):this.addM(t)},t.prototype.addS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)+t);return this},t.prototype.addM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)+t.get(e,r));return this},t.add=function(t,r){return new e(t).add(r)},t.prototype.sub=function(t){return"number"==typeof t?this.subS(t):this.subM(t)},t.prototype.subS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)-t);return this},t.prototype.subM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)-t.get(e,r));return this},t.sub=function(t,r){return new e(t).sub(r)},t.prototype.subtract=t.prototype.sub,t.prototype.subtractS=t.prototype.subS,t.prototype.subtractM=t.prototype.subM,t.subtract=t.sub,t.prototype.mul=function(t){return"number"==typeof t?this.mulS(t):this.mulM(t)},t.prototype.mulS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)*t);return this},t.prototype.mulM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)*t.get(e,r));return this},t.mul=function(t,r){return new e(t).mul(r)},t.prototype.multiply=t.prototype.mul,t.prototype.multiplyS=t.prototype.mulS,t.prototype.multiplyM=t.prototype.mulM,t.multiply=t.mul,t.prototype.div=function(t){return"number"==typeof t?this.divS(t):this.divM(t)},t.prototype.divS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)/t);return this},t.prototype.divM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)/t.get(e,r));return this},t.div=function(t,r){return new e(t).div(r)},t.prototype.divide=t.prototype.div,t.prototype.divideS=t.prototype.divS,t.prototype.divideM=t.prototype.divM,t.divide=t.div,t.prototype.mod=function(t){return"number"==typeof t?this.modS(t):this.modM(t)},t.prototype.modS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)%t);return this},t.prototype.modM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)%t.get(e,r));return this},t.mod=function(t,r){return new e(t).mod(r)},t.prototype.modulus=t.prototype.mod,t.prototype.modulusS=t.prototype.modS,t.prototype.modulusM=t.prototype.modM,t.modulus=t.mod,t.prototype.and=function(t){return"number"==typeof t?this.andS(t):this.andM(t)},t.prototype.andS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)&t);return this},t.prototype.andM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)&t.get(e,r));return this},t.and=function(t,r){return new e(t).and(r)},t.prototype.or=function(t){return"number"==typeof t?this.orS(t):this.orM(t)},t.prototype.orS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)|t);return this},t.prototype.orM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)|t.get(e,r));return this},t.or=function(t,r){return new e(t).or(r)},t.prototype.xor=function(t){return"number"==typeof t?this.xorS(t):this.xorM(t)},t.prototype.xorS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)^t);return this},t.prototype.xorM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)^t.get(e,r));return this},t.xor=function(t,r){return new e(t).xor(r)},t.prototype.leftShift=function(t){return"number"==typeof t?this.leftShiftS(t):this.leftShiftM(t)},t.prototype.leftShiftS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)<<t);return this},t.prototype.leftShiftM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)<<t.get(e,r));return this},t.leftShift=function(t,r){return new e(t).leftShift(r)},t.prototype.signPropagatingRightShift=function(t){return"number"==typeof t?this.signPropagatingRightShiftS(t):this.signPropagatingRightShiftM(t)},t.prototype.signPropagatingRightShiftS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)>>t);return this},t.prototype.signPropagatingRightShiftM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)>>t.get(e,r));return this},t.signPropagatingRightShift=function(t,r){return new e(t).signPropagatingRightShift(r)},t.prototype.rightShift=function(t){return"number"==typeof t?this.rightShiftS(t):this.rightShiftM(t)},t.prototype.rightShiftS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)>>>t);return this},t.prototype.rightShiftM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)>>>t.get(e,r));return this},t.rightShift=function(t,r){return new e(t).rightShift(r)},t.prototype.zeroFillRightShift=t.prototype.rightShift,t.prototype.zeroFillRightShiftS=t.prototype.rightShiftS,t.prototype.zeroFillRightShiftM=t.prototype.rightShiftM,t.zeroFillRightShift=t.rightShift,t.prototype.not=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,~this.get(t,e));return this},t.not=function(t){return new e(t).not()},t.prototype.abs=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.abs(this.get(t,e)));return this},t.abs=function(t){return new e(t).abs()},t.prototype.acos=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.acos(this.get(t,e)));return this},t.acos=function(t){return new e(t).acos()},t.prototype.acosh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.acosh(this.get(t,e)));return this},t.acosh=function(t){return new e(t).acosh()},t.prototype.asin=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.asin(this.get(t,e)));return this},t.asin=function(t){return new e(t).asin()},t.prototype.asinh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.asinh(this.get(t,e)));return this},t.asinh=function(t){return new e(t).asinh()},t.prototype.atan=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.atan(this.get(t,e)));return this},t.atan=function(t){return new e(t).atan()},t.prototype.atanh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.atanh(this.get(t,e)));return this},t.atanh=function(t){return new e(t).atanh()},t.prototype.cbrt=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.cbrt(this.get(t,e)));return this},t.cbrt=function(t){return new e(t).cbrt()},t.prototype.ceil=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.ceil(this.get(t,e)));return this},t.ceil=function(t){return new e(t).ceil()},t.prototype.clz32=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.clz32(this.get(t,e)));return this},t.clz32=function(t){return new e(t).clz32()},t.prototype.cos=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.cos(this.get(t,e)));return this},t.cos=function(t){return new e(t).cos()},t.prototype.cosh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.cosh(this.get(t,e)));return this},t.cosh=function(t){return new e(t).cosh()},t.prototype.exp=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.exp(this.get(t,e)));return this},t.exp=function(t){return new e(t).exp()},t.prototype.expm1=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.expm1(this.get(t,e)));return this},t.expm1=function(t){return new e(t).expm1()},t.prototype.floor=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.floor(this.get(t,e)));return this},t.floor=function(t){return new e(t).floor()},t.prototype.fround=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.fround(this.get(t,e)));return this},t.fround=function(t){return new e(t).fround()},t.prototype.log=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.log(this.get(t,e)));return this},t.log=function(t){return new e(t).log()},t.prototype.log1p=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.log1p(this.get(t,e)));return this},t.log1p=function(t){return new e(t).log1p()},t.prototype.log10=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.log10(this.get(t,e)));return this},t.log10=function(t){return new e(t).log10()},t.prototype.log2=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.log2(this.get(t,e)));return this},t.log2=function(t){return new e(t).log2()},t.prototype.round=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.round(this.get(t,e)));return this},t.round=function(t){return new e(t).round()},t.prototype.sign=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.sign(this.get(t,e)));return this},t.sign=function(t){return new e(t).sign()},t.prototype.sin=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.sin(this.get(t,e)));return this},t.sin=function(t){return new e(t).sin()},t.prototype.sinh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.sinh(this.get(t,e)));return this},t.sinh=function(t){return new e(t).sinh()},t.prototype.sqrt=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.sqrt(this.get(t,e)));return this},t.sqrt=function(t){return new e(t).sqrt()},t.prototype.tan=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.tan(this.get(t,e)));return this},t.tan=function(t){return new e(t).tan()},t.prototype.tanh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.tanh(this.get(t,e)));return this},t.tanh=function(t){return new e(t).tanh()},t.prototype.trunc=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.trunc(this.get(t,e)));return this},t.trunc=function(t){return new e(t).trunc()},t.pow=function(t,r){return new e(t).pow(r)},t.prototype.pow=function(t){return"number"==typeof t?this.powS(t):this.powM(t)},t.prototype.powS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,Math.pow(this.get(e,r),t));return this},t.prototype.powM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,Math.pow(this.get(e,r),t.get(e,r)));return this}}(Ye,Ke);class Je extends Ye{constructor(t){super(),this.data=t,this.rows=t.length,this.columns=t[0].length}set(t,e,r){return this.data[t][e]=r,this}get(t,e){return this.data[t][e]}}function Xe(t,e){let r=0;return Math.abs(t)>Math.abs(e)?(r=e/t,Math.abs(t)*Math.sqrt(1+r*r)):0!==e?(r=t/e,Math.abs(e)*Math.sqrt(1+r*r)):0}class Qe{constructor(t,e={}){if((t=Je.checkMatrix(t)).isEmpty())throw new Error("Matrix must be non-empty");let r=t.rows,n=t.columns;const{computeLeftSingularVectors:o=!0,computeRightSingularVectors:i=!0,autoTranspose:s=!1}=e;let a,u=Boolean(o),d=Boolean(i),h=!1;if(r<n)if(s){a=t.transpose(),r=a.rows,n=a.columns,h=!0;let e=u;u=d,d=e}else a=t.clone(),console.warn("Computing SVD on a matrix with more columns than rows. Consider enabling autoTranspose");else a=t.clone();let c=Math.min(r,n),l=Math.min(r+1,n),f=new Float64Array(l),g=new Ke(r,c),p=new Ke(n,n),v=new Float64Array(n),y=new Float64Array(r),m=new Float64Array(l);for(let t=0;t<l;t++)m[t]=t;let w=Math.min(r-1,n),x=Math.max(0,Math.min(n-2,r)),b=Math.max(w,x);for(let t=0;t<b;t++){if(t<w){f[t]=0;for(let e=t;e<r;e++)f[t]=Xe(f[t],a.get(e,t));if(0!==f[t]){a.get(t,t)<0&&(f[t]=-f[t]);for(let e=t;e<r;e++)a.set(e,t,a.get(e,t)/f[t]);a.set(t,t,a.get(t,t)+1)}f[t]=-f[t]}for(let e=t+1;e<n;e++){if(t<w&&0!==f[t]){let n=0;for(let o=t;o<r;o++)n+=a.get(o,t)*a.get(o,e);n=-n/a.get(t,t);for(let o=t;o<r;o++)a.set(o,e,a.get(o,e)+n*a.get(o,t))}v[e]=a.get(t,e)}if(u&&t<w)for(let e=t;e<r;e++)g.set(e,t,a.get(e,t));if(t<x){v[t]=0;for(let e=t+1;e<n;e++)v[t]=Xe(v[t],v[e]);if(0!==v[t]){v[t+1]<0&&(v[t]=0-v[t]);for(let e=t+1;e<n;e++)v[e]/=v[t];v[t+1]+=1}if(v[t]=-v[t],t+1<r&&0!==v[t]){for(let e=t+1;e<r;e++)y[e]=0;for(let e=t+1;e<r;e++)for(let r=t+1;r<n;r++)y[e]+=v[r]*a.get(e,r);for(let e=t+1;e<n;e++){let n=-v[e]/v[t+1];for(let o=t+1;o<r;o++)a.set(o,e,a.get(o,e)+n*y[o])}}if(d)for(let e=t+1;e<n;e++)p.set(e,t,v[e])}}let E=Math.min(n,r+1);if(w<n&&(f[w]=a.get(w,w)),r<E&&(f[E-1]=0),x+1<E&&(v[x]=a.get(x,E-1)),v[E-1]=0,u){for(let t=w;t<c;t++){for(let e=0;e<r;e++)g.set(e,t,0);g.set(t,t,1)}for(let t=w-1;t>=0;t--)if(0!==f[t]){for(let e=t+1;e<c;e++){let n=0;for(let o=t;o<r;o++)n+=g.get(o,t)*g.get(o,e);n=-n/g.get(t,t);for(let o=t;o<r;o++)g.set(o,e,g.get(o,e)+n*g.get(o,t))}for(let e=t;e<r;e++)g.set(e,t,-g.get(e,t));g.set(t,t,1+g.get(t,t));for(let e=0;e<t-1;e++)g.set(e,t,0)}else{for(let e=0;e<r;e++)g.set(e,t,0);g.set(t,t,1)}}if(d)for(let t=n-1;t>=0;t--){if(t<x&&0!==v[t])for(let e=t+1;e<n;e++){let r=0;for(let o=t+1;o<n;o++)r+=p.get(o,t)*p.get(o,e);r=-r/p.get(t+1,t);for(let o=t+1;o<n;o++)p.set(o,e,p.get(o,e)+r*p.get(o,t))}for(let e=0;e<n;e++)p.set(e,t,0);p.set(t,t,1)}let N=E-1,_=0,M=Number.EPSILON;for(;E>0;){let t,e;for(t=E-2;t>=-1&&-1!==t;t--){const e=Number.MIN_VALUE+M*Math.abs(f[t]+Math.abs(f[t+1]));if(Math.abs(v[t])<=e||Number.isNaN(v[t])){v[t]=0;break}}if(t===E-2)e=4;else{let r;for(r=E-1;r>=t&&r!==t;r--){let e=(r!==E?Math.abs(v[r]):0)+(r!==t+1?Math.abs(v[r-1]):0);if(Math.abs(f[r])<=M*e){f[r]=0;break}}r===t?e=3:r===E-1?e=1:(e=2,t=r)}switch(t++,e){case 1:{let e=v[E-2];v[E-2]=0;for(let r=E-2;r>=t;r--){let o=Xe(f[r],e),i=f[r]/o,s=e/o;if(f[r]=o,r!==t&&(e=-s*v[r-1],v[r-1]=i*v[r-1]),d)for(let t=0;t<n;t++)o=i*p.get(t,r)+s*p.get(t,E-1),p.set(t,E-1,-s*p.get(t,r)+i*p.get(t,E-1)),p.set(t,r,o)}break}case 2:{let e=v[t-1];v[t-1]=0;for(let n=t;n<E;n++){let o=Xe(f[n],e),i=f[n]/o,s=e/o;if(f[n]=o,e=-s*v[n],v[n]=i*v[n],u)for(let e=0;e<r;e++)o=i*g.get(e,n)+s*g.get(e,t-1),g.set(e,t-1,-s*g.get(e,n)+i*g.get(e,t-1)),g.set(e,n,o)}break}case 3:{const e=Math.max(Math.abs(f[E-1]),Math.abs(f[E-2]),Math.abs(v[E-2]),Math.abs(f[t]),Math.abs(v[t])),o=f[E-1]/e,i=f[E-2]/e,s=v[E-2]/e,a=f[t]/e,h=v[t]/e,c=((i+o)*(i-o)+s*s)/2,l=o*s*(o*s);let y=0;0===c&&0===l||(y=c<0?0-Math.sqrt(c*c+l):Math.sqrt(c*c+l),y=l/(c+y));let m=(a+o)*(a-o)+y,w=a*h;for(let e=t;e<E-1;e++){let o=Xe(m,w);0===o&&(o=Number.MIN_VALUE);let i=m/o,s=w/o;if(e!==t&&(v[e-1]=o),m=i*f[e]+s*v[e],v[e]=i*v[e]-s*f[e],w=s*f[e+1],f[e+1]=i*f[e+1],d)for(let t=0;t<n;t++)o=i*p.get(t,e)+s*p.get(t,e+1),p.set(t,e+1,-s*p.get(t,e)+i*p.get(t,e+1)),p.set(t,e,o);if(o=Xe(m,w),0===o&&(o=Number.MIN_VALUE),i=m/o,s=w/o,f[e]=o,m=i*v[e]+s*f[e+1],f[e+1]=-s*v[e]+i*f[e+1],w=s*v[e+1],v[e+1]=i*v[e+1],u&&e<r-1)for(let t=0;t<r;t++)o=i*g.get(t,e)+s*g.get(t,e+1),g.set(t,e+1,-s*g.get(t,e)+i*g.get(t,e+1)),g.set(t,e,o)}v[E-2]=m,_+=1;break}case 4:if(f[t]<=0&&(f[t]=f[t]<0?-f[t]:0,d))for(let e=0;e<=N;e++)p.set(e,t,-p.get(e,t));for(;t<N&&!(f[t]>=f[t+1]);){let e=f[t];if(f[t]=f[t+1],f[t+1]=e,d&&t<n-1)for(let r=0;r<n;r++)e=p.get(r,t+1),p.set(r,t+1,p.get(r,t)),p.set(r,t,e);if(u&&t<r-1)for(let n=0;n<r;n++)e=g.get(n,t+1),g.set(n,t+1,g.get(n,t)),g.set(n,t,e);t++}_=0,E--}}if(h){let t=p;p=g,g=t}this.m=r,this.n=n,this.s=f,this.U=g,this.V=p}solve(t){let e=t,r=this.threshold,n=this.s.length,o=Ke.zeros(n,n);for(let t=0;t<n;t++)Math.abs(this.s[t])<=r?o.set(t,t,0):o.set(t,t,1/this.s[t]);let i=this.U,s=this.rightSingularVectors,a=s.mmul(o),u=s.rows,d=i.rows,h=Ke.zeros(u,d);for(let t=0;t<u;t++)for(let e=0;e<d;e++){let r=0;for(let o=0;o<n;o++)r+=a.get(t,o)*i.get(e,o);h.set(t,e,r)}return h.mmul(e)}solveForDiagonal(t){return this.solve(Ke.diag(t))}inverse(){let t=this.V,e=this.threshold,r=t.rows,n=t.columns,o=new Ke(r,this.s.length);for(let i=0;i<r;i++)for(let r=0;r<n;r++)Math.abs(this.s[r])>e&&o.set(i,r,t.get(i,r)/this.s[r]);let i=this.U,s=i.rows,a=i.columns,u=new Ke(r,s);for(let t=0;t<r;t++)for(let e=0;e<s;e++){let r=0;for(let n=0;n<a;n++)r+=o.get(t,n)*i.get(e,n);u.set(t,e,r)}return u}get condition(){return this.s[0]/this.s[Math.min(this.m,this.n)-1]}get norm2(){return this.s[0]}get rank(){let t=Math.max(this.m,this.n)*this.s[0]*Number.EPSILON,e=0,r=this.s;for(let n=0,o=r.length;n<o;n++)r[n]>t&&e++;return e}get diagonal(){return Array.from(this.s)}get threshold(){return Number.EPSILON/2*Math.max(this.m,this.n)*this.s[0]}get leftSingularVectors(){return this.U}get rightSingularVectors(){return this.V}get diagonalMatrix(){return Ke.diag(this.s)}}const Ze=t=>{const e=[],r=t.length;for(let n=0;n<r;n+=1){e[n]=[];for(let o=0;o<r;o+=1)n===o?e[n][o]=0:0!==t[n][o]&&t[n][o]?e[n][o]=t[n][o]:e[n][o]=1/0}for(let t=0;t<r;t+=1)for(let n=0;n<r;n+=1)for(let o=0;o<r;o+=1)e[n][o]>e[n][t]+e[t][o]&&(e[n][o]=e[n][t]+e[t][o]);return e},tr=(t,e)=>{const{nodes:r,edges:n}=t,o=[],i={};if(!r)throw new Error("invalid nodes data!");return r&&r.forEach(((t,e)=>{i[t.id]=e,o.push([])})),null==n||n.forEach((t=>{const{source:r,target:n}=t,s=i[r],a=i[n];void 0!==s&&void 0!==a&&(o[s][a]=1,e||(o[a][s]=1))})),o},er=(t,e)=>Math.sqrt((t.x-e.x)*(t.x-e.x)+(t.y-e.y)*(t.y-e.y)),rr=(t,e,r,n="TB",o,i={})=>{if(!(null==e?void 0:e.length))return;const{stopBranchFn:s,stopAllFn:a}=i;for(let u=0;u<e.length;u++){const d=e[u];if(t.hasNode(d.id)&&!(null==s?void 0:s(d))){if(null==a?void 0:a(d))return;"TB"===n&&r(d),rr(t,t.getChildren(d.id,o),r,n,o,i),"TB"!==n&&r(d)}}},nr={center:[0,0],linkDistance:50};class or{constructor(t={}){this.options=t,this.id="mds",this.options=Object.assign(Object.assign({},nr),t)}execute(e,r){return t(this,void 0,void 0,(function*(){return this.genericMDSLayout(!1,e,r)}))}assign(e,r){return t(this,void 0,void 0,(function*(){yield this.genericMDSLayout(!0,e,r)}))}genericMDSLayout(e,r,n){return t(this,void 0,void 0,(function*(){const t=Object.assign(Object.assign({},this.options),n),{center:o=[0,0],linkDistance:i=50}=t,s=r.getAllNodes(),a=r.getAllEdges();if(!(null==s?void 0:s.length)||1===s.length)return Qt(r,e,o);const u=tr({nodes:s,edges:a},!1),d=Ze(u);ir(d);const h=((t,e)=>{const r=[];return t.forEach((t=>{const n=[];t.forEach((t=>{n.push(t*e)})),r.push(n)})),r})(d,i),c=sr(h),l=[];return c.forEach(((t,e)=>{const r=Jt(s[e]);r.data.x=t[0]+o[0],r.data.y=t[1]+o[1],l.push(r)})),e&&l.forEach((t=>r.mergeNodeData(t.id,{x:t.data.x,y:t.data.y}))),{nodes:l,edges:a}}))}}const ir=t=>{let e=-999999;t.forEach((t=>{t.forEach((t=>{t!==1/0&&e<t&&(e=t)}))})),t.forEach(((r,n)=>{r.forEach(((r,o)=>{r===1/0&&(t[n][o]=e)}))}))},sr=t=>{const e=Ke.mul(Ke.pow(t,2),-.5),r=e.mean("row"),n=e.mean("column"),o=e.mean();e.add(o).subRowVector(r).subColumnVector(n);const i=new Qe(e),s=Ke.sqrt(i.diagonalMatrix).diagonal();return i.leftSingularVectors.toJSON().map((t=>Ke.mul([t],[s]).toJSON()[0].splice(0,2)))};function ar(t){return!!t.tick&&!!t.stop}const ur={gForce:!0,force2:!0,d3force:!0,fruchterman:!0,forceAtlas2:!0,force:!0,"graphin-force":!0},dr={center:[0,0],comboPadding:10,treeKey:"combo"};function hr(e,r,n,o){var i;return t(this,void 0,void 0,(function*(){return ar(e)?(e.execute(r,n),e.stop(),e.tick(null!==(i=n.iterations)&&void 0!==i?i:300)):o?yield e.assign(r,n):yield e.execute(r,n)}))}const cr=function(t){if(!function(t){return"object"==typeof t&&null!==t}(t)||!h(t,"Object"))return!1;if(null===Object.getPrototypeOf(t))return!0;for(var e=t;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e};function lr(t,e,r,n){for(var o in r=r||0,n=n||5,e)if(e.hasOwnProperty(o)){var i=e[o];null!==i&&cr(i)?(cr(t[o])||(t[o]={}),r<n?lr(t[o],i,r+1,n):t[o]=e[o]):T(i)?(t[o]=[],t[o]=t[o].concat(i)):void 0!==i&&(t[o]=i)}}const fr=function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];for(var n=0;n<e.length;n+=1)lr(t,e[n]);return t};var gr=Object.prototype.hasOwnProperty;const pr=function(t,e){if(null===t||!cr(t))return{};var r={};return function(t,e){if(t)if(T(t))for(var r=0,n=t.length;r<n&&!1!==e(t[r],r);r++);else if(Gt(t))for(var o in t)if(t.hasOwnProperty(o)&&!1===e(t[o],o))break}(e,(function(e){gr.call(t,e)&&(r[e]=t[e])})),r};function vr(t){return function(){return t}}function yr(t){return 1e-6*(t()-.5)}function mr(t){return t.index}function wr(t,e){var r=t.get(e);if(!r)throw new Error("node not found: "+e);return r}function xr(t){var e,r,n,o,i,s,a=mr,u=function(t){return 1/Math.min(o[t.source.index],o[t.target.index])},d=vr(30),h=1;function c(n){for(var o=0,a=t.length;o<h;++o)for(var u,d,c,l,f,g,p,v=0;v<a;++v)d=(u=t[v]).source,l=(c=u.target).x+c.vx-d.x-d.vx||yr(s),f=c.y+c.vy-d.y-d.vy||yr(s),l*=g=((g=Math.sqrt(l*l+f*f))-r[v])/g*n*e[v],f*=g,c.vx-=l*(p=i[v]),c.vy-=f*p,d.vx+=l*(p=1-p),d.vy+=f*p}function l(){if(n){var s,u,d=n.length,h=t.length,c=new Map(n.map(((t,e)=>[a(t,e,n),t])));for(s=0,o=new Array(d);s<h;++s)(u=t[s]).index=s,"object"!=typeof u.source&&(u.source=wr(c,u.source)),"object"!=typeof u.target&&(u.target=wr(c,u.target)),o[u.source.index]=(o[u.source.index]||0)+1,o[u.target.index]=(o[u.target.index]||0)+1;for(s=0,i=new Array(h);s<h;++s)u=t[s],i[s]=o[u.source.index]/(o[u.source.index]+o[u.target.index]);e=new Array(h),f(),r=new Array(h),g()}}function f(){if(n)for(var r=0,o=t.length;r<o;++r)e[r]=+u(t[r],r,t)}function g(){if(n)for(var e=0,o=t.length;e<o;++e)r[e]=+d(t[e],e,t)}return null==t&&(t=[]),c.initialize=function(t,e){n=t,s=e,l()},c.links=function(e){return arguments.length?(t=e,l(),c):t},c.id=function(t){return arguments.length?(a=t,c):a},c.iterations=function(t){return arguments.length?(h=+t,c):h},c.strength=function(t){return arguments.length?(u="function"==typeof t?t:vr(+t),f(),c):u},c.distance=function(t){return arguments.length?(d="function"==typeof t?t:vr(+t),g(),c):d},c}var br={value:()=>{}};function Er(){for(var t,e=0,r=arguments.length,n={};e<r;++e){if(!(t=arguments[e]+"")||t in n||/[\\s.]/.test(t))throw new Error("illegal type: "+t);n[t]=[]}return new Nr(n)}function Nr(t){this._=t}function _r(t,e){for(var r,n=0,o=t.length;n<o;++n)if((r=t[n]).name===e)return r.value}function Mr(t,e,r){for(var n=0,o=t.length;n<o;++n)if(t[n].name===e){t[n]=br,t=t.slice(0,n).concat(t.slice(n+1));break}return null!=r&&t.push({name:e,value:r}),t}Nr.prototype=Er.prototype={constructor:Nr,on:function(t,e){var r,n,o=this._,i=(n=o,(t+"").trim().split(/^|\\s+/).map((function(t){var e="",r=t.indexOf(".");if(r>=0&&(e=t.slice(r+1),t=t.slice(0,r)),t&&!n.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}}))),s=-1,a=i.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++s<a;)if(r=(t=i[s]).type)o[r]=Mr(o[r],t.name,e);else if(null==e)for(r in o)o[r]=Mr(o[r],t.name,null);return this}for(;++s<a;)if((r=(t=i[s]).type)&&(r=_r(o[r],t.name)))return r},copy:function(){var t={},e=this._;for(var r in e)t[r]=e[r].slice();return new Nr(t)},call:function(t,e){if((r=arguments.length-2)>0)for(var r,n,o=new Array(r),i=0;i<r;++i)o[i]=arguments[i+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(i=0,r=(n=this._[t]).length;i<r;++i)n[i].value.apply(e,o)},apply:function(t,e,r){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var n=this._[t],o=0,i=n.length;o<i;++o)n[o].value.apply(e,r)}};const kr=Er;var Ar,jr,Or=0,Sr=0,zr=0,Rr=0,Ir=0,Pr=0,Cr="object"==typeof performance&&performance.now?performance:Date,Dr="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function Tr(){return Ir||(Dr(Lr),Ir=Cr.now()+Pr)}function Lr(){Ir=0}function Fr(){this._call=this._time=this._next=null}function qr(t,e,r){var n=new Fr;return n.restart(t,e,r),n}function Vr(){Ir=(Rr=Cr.now())+Pr,Or=Sr=0;try{!function(){Tr(),++Or;for(var t,e=Ar;e;)(t=Ir-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Or}()}finally{Or=0,function(){for(var t,e,r=Ar,n=1/0;r;)r._call?(n>r._time&&(n=r._time),t=r,r=r._next):(e=r._next,r._next=null,r=t?t._next=e:Ar=e);jr=t,$r(n)}(),Ir=0}}function Br(){var t=Cr.now(),e=t-Rr;e>1e3&&(Pr-=e,Rr=t)}function $r(t){Or||(Sr&&(Sr=clearTimeout(Sr)),t-Ir>24?(t<1/0&&(Sr=setTimeout(Vr,t-Cr.now()-Pr)),zr&&(zr=clearInterval(zr))):(zr||(Rr=Cr.now(),zr=setInterval(Br,1e3)),Or=1,Dr(Vr)))}Fr.prototype=qr.prototype={constructor:Fr,restart:function(t,e,r){if("function"!=typeof t)throw new TypeError("callback is not a function");r=(null==r?Tr():+r)+(null==e?0:+e),this._next||jr===this||(jr?jr._next=this:Ar=this,jr=this),this._call=t,this._time=r,$r()},stop:function(){this._call&&(this._call=null,this._time=1/0,$r())}};const Gr=4294967296;function Ur(t){return t.x}function Wr(t){return t.y}var Yr=Math.PI*(3-Math.sqrt(5));function Hr(){var t,e,r,n,o,i=vr(-30),s=1,a=1/0,u=.81;function d(r){var o,i=t.length,s=de(t,Ur,Wr).visitAfter(c);for(n=r,o=0;o<i;++o)e=t[o],s.visit(l)}function h(){if(t){var e,r,n=t.length;for(o=new Array(n),e=0;e<n;++e)r=t[e],o[r.index]=+i(r,e,t)}}function c(t){var e,r,n,i,s,a=0,u=0;if(t.length){for(n=i=s=0;s<4;++s)(e=t[s])&&(r=Math.abs(e.value))&&(a+=e.value,u+=r,n+=r*e.x,i+=r*e.y);t.x=n/u,t.y=i/u}else{(e=t).x=e.data.x,e.y=e.data.y;do{a+=o[e.data.index]}while(e=e.next)}t.value=a}function l(t,i,d,h){if(!t.value)return!0;var c=t.x-e.x,l=t.y-e.y,f=h-i,g=c*c+l*l;if(f*f/u<g)return g<a&&(0===c&&(g+=(c=yr(r))*c),0===l&&(g+=(l=yr(r))*l),g<s&&(g=Math.sqrt(s*g)),e.vx+=c*t.value*n/g,e.vy+=l*t.value*n/g),!0;if(!(t.length||g>=a)){(t.data!==e||t.next)&&(0===c&&(g+=(c=yr(r))*c),0===l&&(g+=(l=yr(r))*l),g<s&&(g=Math.sqrt(s*g)));do{t.data!==e&&(f=o[t.data.index]*n/g,e.vx+=c*f,e.vy+=l*f)}while(t=t.next)}}return d.initialize=function(e,n){t=e,r=n,h()},d.strength=function(t){return arguments.length?(i="function"==typeof t?t:vr(+t),h(),d):i},d.distanceMin=function(t){return arguments.length?(s=t*t,d):Math.sqrt(s)},d.distanceMax=function(t){return arguments.length?(a=t*t,d):Math.sqrt(a)},d.theta=function(t){return arguments.length?(u=t*t,d):Math.sqrt(u)},d}function Kr(t,e){var r,n=1;function o(){var o,i,s=r.length,a=0,u=0;for(o=0;o<s;++o)a+=(i=r[o]).x,u+=i.y;for(a=(a/s-t)*n,u=(u/s-e)*n,o=0;o<s;++o)(i=r[o]).x-=a,i.y-=u}return null==t&&(t=0),null==e&&(e=0),o.initialize=function(t){r=t},o.x=function(e){return arguments.length?(t=+e,o):t},o.y=function(t){return arguments.length?(e=+t,o):e},o.strength=function(t){return arguments.length?(n=+t,o):n},o}function Jr(t){return t.x+t.vx}function Xr(t){return t.y+t.vy}function Qr(t){var e,r,n,o=1,i=1;function s(){for(var t,s,u,d,h,c,l,f=e.length,g=0;g<i;++g)for(s=de(e,Jr,Xr).visitAfter(a),t=0;t<f;++t)u=e[t],c=r[u.index],l=c*c,d=u.x+u.vx,h=u.y+u.vy,s.visit(p);function p(t,e,r,i,s){var a=t.data,f=t.r,g=c+f;if(!a)return e>d+g||i<d-g||r>h+g||s<h-g;if(a.index>u.index){var p=d-a.x-a.vx,v=h-a.y-a.vy,y=p*p+v*v;y<g*g&&(0===p&&(y+=(p=yr(n))*p),0===v&&(y+=(v=yr(n))*v),y=(g-(y=Math.sqrt(y)))/y*o,u.vx+=(p*=y)*(g=(f*=f)/(l+f)),u.vy+=(v*=y)*g,a.vx-=p*(g=1-g),a.vy-=v*g)}}}function a(t){if(t.data)return t.r=r[t.data.index];for(var e=t.r=0;e<4;++e)t[e]&&t[e].r>t.r&&(t.r=t[e].r)}function u(){if(e){var n,o,i=e.length;for(r=new Array(i),n=0;n<i;++n)o=e[n],r[o.index]=+t(o,n,e)}}return"function"!=typeof t&&(t=vr(null==t?1:+t)),s.initialize=function(t,r){e=t,n=r,u()},s.iterations=function(t){return arguments.length?(i=+t,s):i},s.strength=function(t){return arguments.length?(o=+t,s):o},s.radius=function(e){return arguments.length?(t="function"==typeof e?e:vr(+e),u(),s):t},s}function Zr(t,e,r){var n,o,i,s=vr(.1);function a(t){for(var s=0,a=n.length;s<a;++s){var u=n[s],d=u.x-e||1e-6,h=u.y-r||1e-6,c=Math.sqrt(d*d+h*h),l=(i[s]-c)*o[s]*t/c;u.vx+=d*l,u.vy+=h*l}}function u(){if(n){var e,r=n.length;for(o=new Array(r),i=new Array(r),e=0;e<r;++e)i[e]=+t(n[e],e,n),o[e]=isNaN(i[e])?0:+s(n[e],e,n)}}return"function"!=typeof t&&(t=vr(+t)),null==e&&(e=0),null==r&&(r=0),a.initialize=function(t){n=t,u()},a.strength=function(t){return arguments.length?(s="function"==typeof t?t:vr(+t),u(),a):s},a.radius=function(e){return arguments.length?(t="function"==typeof e?e:vr(+e),u(),a):t},a.x=function(t){return arguments.length?(e=+t,a):e},a.y=function(t){return arguments.length?(r=+t,a):r},a}function tn(t){var e,r,n,o=vr(.1);function i(t){for(var o,i=0,s=e.length;i<s;++i)(o=e[i]).vx+=(n[i]-o.x)*r[i]*t}function s(){if(e){var i,s=e.length;for(r=new Array(s),n=new Array(s),i=0;i<s;++i)r[i]=isNaN(n[i]=+t(e[i],i,e))?0:+o(e[i],i,e)}}return"function"!=typeof t&&(t=vr(null==t?0:+t)),i.initialize=function(t){e=t,s()},i.strength=function(t){return arguments.length?(o="function"==typeof t?t:vr(+t),s(),i):o},i.x=function(e){return arguments.length?(t="function"==typeof e?e:vr(+e),s(),i):t},i}function en(t){var e,r,n,o=vr(.1);function i(t){for(var o,i=0,s=e.length;i<s;++i)(o=e[i]).vy+=(n[i]-o.y)*r[i]*t}function s(){if(e){var i,s=e.length;for(r=new Array(s),n=new Array(s),i=0;i<s;++i)r[i]=isNaN(n[i]=+t(e[i],i,e))?0:+o(e[i],i,e)}}return"function"!=typeof t&&(t=vr(null==t?0:+t)),i.initialize=function(t){e=t,s()},i.strength=function(t){return arguments.length?(o="function"==typeof t?t:vr(+t),s(),i):o},i.y=function(e){return arguments.length?(t="function"==typeof e?e:vr(+e),s(),i):t},i}class rn{constructor(t){this.id="d3-force",this.config={inputNodeAttrs:["x","y","vx","vy","fx","fy"],outputNodeAttrs:["x","y","vx","vy"],simulationAttrs:["alpha","alphaMin","alphaDecay","alphaTarget","velocityDecay","randomSource"]},this.forceMap={link:xr,manyBody:Hr,center:Kr,collide:Qr,radial:Zr,x:tn,y:en},this.options={link:{id:t=>t.id},manyBody:{},center:{x:0,y:0}},this.context={options:{},assign:!1,nodes:[],edges:[]},fr(this.options,t),this.options.forceSimulation&&(this.simulation=this.options.forceSimulation)}execute(e,r){return t(this,void 0,void 0,(function*(){return this.genericLayout(!1,e,r)}))}assign(e,r){return t(this,void 0,void 0,(function*(){yield this.genericLayout(!0,e,r)}))}stop(){this.simulation.stop()}tick(t){return this.simulation.tick(t),this.getResult()}restart(){this.simulation.restart()}setFixedPosition(t,e){const r=this.context.nodes.find((e=>e.id===t));r&&e.forEach(((t,e)=>{"number"!=typeof t&&null!==t||(r[["fx","fy","fz"][e]]=t)}))}getOptions(t){var e,r;const n=fr({},this.options,t);return n.collide&&void 0===(null===(e=n.collide)||void 0===e?void 0:e.radius)&&(n.collide=n.collide||{},n.collide.radius=null!==(r=n.nodeSize)&&void 0!==r?r:10),void 0===n.iterations&&(n.link&&void 0===n.link.iterations&&(n.iterations=n.link.iterations),n.collide&&void 0===n.collide.iterations&&(n.iterations=n.collide.iterations)),this.context.options=n,n}genericLayout(e,r,n){var o;return t(this,void 0,void 0,(function*(){const t=this.getOptions(n),i=r.getAllNodes().map((({id:t,data:e})=>Object.assign(Object.assign({id:t},e),pr(e.data,this.config.inputNodeAttrs)))),s=r.getAllEdges().map((t=>Object.assign({},t)));Object.assign(this.context,{assign:e,nodes:i,edges:s,graph:r});const a=new Promise((t=>{this.resolver=t})),u=this.setSimulation(t);return u.nodes(i),null===(o=u.force("link"))||void 0===o||o.links(s),a}))}getResult(){const{assign:t,nodes:e,edges:r,graph:n}=this.context,o=e.map((t=>({id:t.id,data:Object.assign(Object.assign({},t.data),pr(t,this.config.outputNodeAttrs))}))),i=r.map((({id:t,source:e,target:r,data:n})=>({id:t,source:"object"==typeof e?e.id:e,target:"object"==typeof r?r.id:r,data:n})));return t&&o.forEach((t=>n.mergeNodeData(t.id,t.data))),{nodes:o,edges:i}}initSimulation(){return function(t){var e,r=1,n=.001,o=1-Math.pow(n,1/300),i=0,s=.6,a=new Map,u=qr(c),d=kr("tick","end"),h=function(){let t=1;return()=>(t=(1664525*t+1013904223)%Gr)/Gr}();function c(){l(),d.call("tick",e),r<n&&(u.stop(),d.call("end",e))}function l(n){var u,d,h=t.length;void 0===n&&(n=1);for(var c=0;c<n;++c)for(r+=(i-r)*o,a.forEach((function(t){t(r)})),u=0;u<h;++u)null==(d=t[u]).fx?d.x+=d.vx*=s:(d.x=d.fx,d.vx=0),null==d.fy?d.y+=d.vy*=s:(d.y=d.fy,d.vy=0);return e}function f(){for(var e,r=0,n=t.length;r<n;++r){if((e=t[r]).index=r,null!=e.fx&&(e.x=e.fx),null!=e.fy&&(e.y=e.fy),isNaN(e.x)||isNaN(e.y)){var o=10*Math.sqrt(.5+r),i=r*Yr;e.x=o*Math.cos(i),e.y=o*Math.sin(i)}(isNaN(e.vx)||isNaN(e.vy))&&(e.vx=e.vy=0)}}function g(e){return e.initialize&&e.initialize(t,h),e}return null==t&&(t=[]),f(),e={tick:l,restart:function(){return u.restart(c),e},stop:function(){return u.stop(),e},nodes:function(r){return arguments.length?(t=r,f(),a.forEach(g),e):t},alpha:function(t){return arguments.length?(r=+t,e):r},alphaMin:function(t){return arguments.length?(n=+t,e):n},alphaDecay:function(t){return arguments.length?(o=+t,e):+o},alphaTarget:function(t){return arguments.length?(i=+t,e):i},velocityDecay:function(t){return arguments.length?(s=1-t,e):1-s},randomSource:function(t){return arguments.length?(h=t,a.forEach(g),e):h},force:function(t,r){return arguments.length>1?(null==r?a.delete(t):a.set(t,g(r)),e):a.get(t)},find:function(e,r,n){var o,i,s,a,u,d=0,h=t.length;for(null==n?n=1/0:n*=n,d=0;d<h;++d)(s=(o=e-(a=t[d]).x)*o+(i=r-a.y)*i)<n&&(u=a,n=s);return u},on:function(t,r){return arguments.length>1?(d.on(t,r),e):d.on(t)}}}()}setSimulation(t){const e=this.simulation||this.options.forceSimulation||this.initSimulation();return this.simulation||(this.simulation=e.on("tick",(()=>{var e;return null===(e=t.onTick)||void 0===e?void 0:e.call(t,this.getResult())})).on("end",(()=>{var t;return null===(t=this.resolver)||void 0===t?void 0:t.call(this,this.getResult())}))),nn(e,this.config.simulationAttrs.map((e=>[e,t[e]]))),Object.entries(this.forceMap).forEach((([r,n])=>{const o=r;if(t[r]){let r=e.force(o);r||(r=n(),e.force(o,r)),nn(r,Object.entries(t[o]))}else e.force(o,null)})),e}}const nn=(t,e)=>e.reduce(((e,[r,n])=>e[r]&&void 0!==n?e[r].call(t,n):e),t);function on(t){return function(){return t}}function sn(t){return 1e-6*(t()-.5)}function an(t){return t.index}function un(t,e){var r=t.get(e);if(!r)throw new Error("node not found: "+e);return r}function dn(t){var e,r,n,o,i,s,a,u=an,d=function(t){return 1/Math.min(i[t.source.index],i[t.target.index])},h=on(30),c=1;function l(n){for(var i=0,u=t.length;i<c;++i)for(var d,h,l,f,g,p=0,v=0,y=0,m=0;p<u;++p)h=(d=t[p]).source,v=(l=d.target).x+l.vx-h.x-h.vx||sn(a),o>1&&(y=l.y+l.vy-h.y-h.vy||sn(a)),o>2&&(m=l.z+l.vz-h.z-h.vz||sn(a)),v*=f=((f=Math.sqrt(v*v+y*y+m*m))-r[p])/f*n*e[p],y*=f,m*=f,l.vx-=v*(g=s[p]),o>1&&(l.vy-=y*g),o>2&&(l.vz-=m*g),h.vx+=v*(g=1-g),o>1&&(h.vy+=y*g),o>2&&(h.vz+=m*g)}function f(){if(n){var o,a,d=n.length,h=t.length,c=new Map(n.map(((t,e)=>[u(t,e,n),t])));for(o=0,i=new Array(d);o<h;++o)(a=t[o]).index=o,"object"!=typeof a.source&&(a.source=un(c,a.source)),"object"!=typeof a.target&&(a.target=un(c,a.target)),i[a.source.index]=(i[a.source.index]||0)+1,i[a.target.index]=(i[a.target.index]||0)+1;for(o=0,s=new Array(h);o<h;++o)a=t[o],s[o]=i[a.source.index]/(i[a.source.index]+i[a.target.index]);e=new Array(h),g(),r=new Array(h),p()}}function g(){if(n)for(var r=0,o=t.length;r<o;++r)e[r]=+d(t[r],r,t)}function p(){if(n)for(var e=0,o=t.length;e<o;++e)r[e]=+h(t[e],e,t)}return null==t&&(t=[]),l.initialize=function(t,...e){n=t,a=e.find((t=>"function"==typeof t))||Math.random,o=e.find((t=>[1,2,3].includes(t)))||2,f()},l.links=function(e){return arguments.length?(t=e,f(),l):t},l.id=function(t){return arguments.length?(u=t,l):u},l.iterations=function(t){return arguments.length?(c=+t,l):c},l.strength=function(t){return arguments.length?(d="function"==typeof t?t:on(+t),g(),l):d},l.distance=function(t){return arguments.length?(h="function"==typeof t?t:on(+t),p(),l):h},l}function hn(t,e,r){if(isNaN(e))return t;var n,o,i,s,a,u,d=t._root,h={data:r},c=t._x0,l=t._x1;if(!d)return t._root=h,t;for(;d.length;)if((s=e>=(o=(c+l)/2))?c=o:l=o,n=d,!(d=d[a=+s]))return n[a]=h,t;if(e===(i=+t._x.call(null,d.data)))return h.next=d,n?n[a]=h:t._root=h,t;do{n=n?n[a]=new Array(2):t._root=new Array(2),(s=e>=(o=(c+l)/2))?c=o:l=o}while((a=+s)==(u=+(i>=o)));return n[u]=d,n[a]=h,t}function cn(t,e,r){this.node=t,this.x0=e,this.x1=r}function ln(t){return t[0]}function fn(t,e){var r=new gn(null==e?ln:e,NaN,NaN);return null==t?r:r.addAll(t)}function gn(t,e,r){this._x=t,this._x0=e,this._x1=r,this._root=void 0}function pn(t){for(var e={data:t.data},r=e;t=t.next;)r=r.next={data:t.data};return e}var vn=fn.prototype=gn.prototype;vn.copy=function(){var t,e,r=new gn(this._x,this._x0,this._x1),n=this._root;if(!n)return r;if(!n.length)return r._root=pn(n),r;for(t=[{source:n,target:r._root=new Array(2)}];n=t.pop();)for(var o=0;o<2;++o)(e=n.source[o])&&(e.length?t.push({source:e,target:n.target[o]=new Array(2)}):n.target[o]=pn(e));return r},vn.add=function(t){const e=+this._x.call(null,t);return hn(this.cover(e),e,t)},vn.addAll=function(t){Array.isArray(t)||(t=Array.from(t));const e=t.length,r=new Float64Array(e);let n=1/0,o=-1/0;for(let i,s=0;s<e;++s)isNaN(i=+this._x.call(null,t[s]))||(r[s]=i,i<n&&(n=i),i>o&&(o=i));if(n>o)return this;this.cover(n).cover(o);for(let n=0;n<e;++n)hn(this,r[n],t[n]);return this},vn.cover=function(t){if(isNaN(t=+t))return this;var e=this._x0,r=this._x1;if(isNaN(e))r=(e=Math.floor(t))+1;else{for(var n,o,i=r-e||1,s=this._root;e>t||t>=r;)switch(o=+(t<e),(n=new Array(2))[o]=s,s=n,i*=2,o){case 0:r=e+i;break;case 1:e=r-i}this._root&&this._root.length&&(this._root=s)}return this._x0=e,this._x1=r,this},vn.data=function(){var t=[];return this.visit((function(e){if(!e.length)do{t.push(e.data)}while(e=e.next)})),t},vn.extent=function(t){return arguments.length?this.cover(+t[0][0]).cover(+t[1][0]):isNaN(this._x0)?void 0:[[this._x0],[this._x1]]},vn.find=function(t,e){var r,n,o,i,s,a=this._x0,u=this._x1,d=[],h=this._root;for(h&&d.push(new cn(h,a,u)),null==e?e=1/0:(a=t-e,u=t+e);i=d.pop();)if(!(!(h=i.node)||(n=i.x0)>u||(o=i.x1)<a))if(h.length){var c=(n+o)/2;d.push(new cn(h[1],c,o),new cn(h[0],n,c)),(s=+(t>=c))&&(i=d[d.length-1],d[d.length-1]=d[d.length-1-s],d[d.length-1-s]=i)}else{var l=Math.abs(t-+this._x.call(null,h.data));l<e&&(e=l,a=t-l,u=t+l,r=h.data)}return r},vn.remove=function(t){if(isNaN(i=+this._x.call(null,t)))return this;var e,r,n,o,i,s,a,u,d,h=this._root,c=this._x0,l=this._x1;if(!h)return this;if(h.length)for(;;){if((a=i>=(s=(c+l)/2))?c=s:l=s,e=h,!(h=h[u=+a]))return this;if(!h.length)break;e[u+1&1]&&(r=e,d=u)}for(;h.data!==t;)if(n=h,!(h=h.next))return this;return(o=h.next)&&delete h.next,n?(o?n.next=o:delete n.next,this):e?(o?e[u]=o:delete e[u],(h=e[0]||e[1])&&h===(e[1]||e[0])&&!h.length&&(r?r[d]=h:this._root=h),this):(this._root=o,this)},vn.removeAll=function(t){for(var e=0,r=t.length;e<r;++e)this.remove(t[e]);return this},vn.root=function(){return this._root},vn.size=function(){var t=0;return this.visit((function(e){if(!e.length)do{++t}while(e=e.next)})),t},vn.visit=function(t){var e,r,n,o,i=[],s=this._root;for(s&&i.push(new cn(s,this._x0,this._x1));e=i.pop();)if(!t(s=e.node,n=e.x0,o=e.x1)&&s.length){var a=(n+o)/2;(r=s[1])&&i.push(new cn(r,a,o)),(r=s[0])&&i.push(new cn(r,n,a))}return this},vn.visitAfter=function(t){var e,r=[],n=[];for(this._root&&r.push(new cn(this._root,this._x0,this._x1));e=r.pop();){var o=e.node;if(o.length){var i,s=e.x0,a=e.x1,u=(s+a)/2;(i=o[0])&&r.push(new cn(i,s,u)),(i=o[1])&&r.push(new cn(i,u,a))}n.push(e)}for(;e=n.pop();)t(e.node,e.x0,e.x1);return this},vn.x=function(t){return arguments.length?(this._x=t,this):this._x};const yn=4294967296;function mn(t){return t.x}function wn(t){return t.y}function xn(t){return t.z}var bn=Math.PI*(3-Math.sqrt(5)),En=20*Math.PI/(9+Math.sqrt(221));function Nn(){var t,e,r,n,o,i,s=on(-30),a=1,u=1/0,d=.81;function h(n){var i,s=t.length,a=(1===e?fn(t,mn):2===e?de(t,mn,wn):3===e?me(t,mn,wn,xn):null).visitAfter(l);for(o=n,i=0;i<s;++i)r=t[i],a.visit(f)}function c(){if(t){var e,r,n=t.length;for(i=new Array(n),e=0;e<n;++e)r=t[e],i[r.index]=+s(r,e,t)}}function l(t){var r,n,o,s,a,u,d=0,h=0,c=t.length;if(c){for(o=s=a=u=0;u<c;++u)(r=t[u])&&(n=Math.abs(r.value))&&(d+=r.value,h+=n,o+=n*(r.x||0),s+=n*(r.y||0),a+=n*(r.z||0));d*=Math.sqrt(4/c),t.x=o/h,e>1&&(t.y=s/h),e>2&&(t.z=a/h)}else{(r=t).x=r.data.x,e>1&&(r.y=r.data.y),e>2&&(r.z=r.data.z);do{d+=i[r.data.index]}while(r=r.next)}t.value=d}function f(t,s,h,c,l){if(!t.value)return!0;var f=[h,c,l][e-1],g=t.x-r.x,p=e>1?t.y-r.y:0,v=e>2?t.z-r.z:0,y=f-s,m=g*g+p*p+v*v;if(y*y/d<m)return m<u&&(0===g&&(m+=(g=sn(n))*g),e>1&&0===p&&(m+=(p=sn(n))*p),e>2&&0===v&&(m+=(v=sn(n))*v),m<a&&(m=Math.sqrt(a*m)),r.vx+=g*t.value*o/m,e>1&&(r.vy+=p*t.value*o/m),e>2&&(r.vz+=v*t.value*o/m)),!0;if(!(t.length||m>=u)){(t.data!==r||t.next)&&(0===g&&(m+=(g=sn(n))*g),e>1&&0===p&&(m+=(p=sn(n))*p),e>2&&0===v&&(m+=(v=sn(n))*v),m<a&&(m=Math.sqrt(a*m)));do{t.data!==r&&(y=i[t.data.index]*o/m,r.vx+=g*y,e>1&&(r.vy+=p*y),e>2&&(r.vz+=v*y))}while(t=t.next)}}return h.initialize=function(r,...o){t=r,n=o.find((t=>"function"==typeof t))||Math.random,e=o.find((t=>[1,2,3].includes(t)))||2,c()},h.strength=function(t){return arguments.length?(s="function"==typeof t?t:on(+t),c(),h):s},h.distanceMin=function(t){return arguments.length?(a=t*t,h):Math.sqrt(a)},h.distanceMax=function(t){return arguments.length?(u=t*t,h):Math.sqrt(u)},h.theta=function(t){return arguments.length?(d=t*t,h):Math.sqrt(d)},h}function _n(t,e,r){var n,o=1;function i(){var i,s,a=n.length,u=0,d=0,h=0;for(i=0;i<a;++i)u+=(s=n[i]).x||0,d+=s.y||0,h+=s.z||0;for(u=(u/a-t)*o,d=(d/a-e)*o,h=(h/a-r)*o,i=0;i<a;++i)s=n[i],u&&(s.x-=u),d&&(s.y-=d),h&&(s.z-=h)}return null==t&&(t=0),null==e&&(e=0),null==r&&(r=0),i.initialize=function(t){n=t},i.x=function(e){return arguments.length?(t=+e,i):t},i.y=function(t){return arguments.length?(e=+t,i):e},i.z=function(t){return arguments.length?(r=+t,i):r},i.strength=function(t){return arguments.length?(o=+t,i):o},i}function Mn(t){return t.x+t.vx}function kn(t){return t.y+t.vy}function An(t){return t.z+t.vz}function jn(t){var e,r,n,o,i=1,s=1;function a(){for(var t,a,d,h,c,l,f,g,p=e.length,v=0;v<s;++v)for(a=(1===r?fn(e,Mn):2===r?de(e,Mn,kn):3===r?me(e,Mn,kn,An):null).visitAfter(u),t=0;t<p;++t)d=e[t],f=n[d.index],g=f*f,h=d.x+d.vx,r>1&&(c=d.y+d.vy),r>2&&(l=d.z+d.vz),a.visit(y);function y(t,e,n,s,a,u,p){var v=[e,n,s,a,u,p],y=v[0],m=v[1],w=v[2],x=v[r],b=v[r+1],E=v[r+2],N=t.data,_=t.r,M=f+_;if(!N)return y>h+M||x<h-M||r>1&&(m>c+M||b<c-M)||r>2&&(w>l+M||E<l-M);if(N.index>d.index){var k=h-N.x-N.vx,A=r>1?c-N.y-N.vy:0,j=r>2?l-N.z-N.vz:0,O=k*k+A*A+j*j;O<M*M&&(0===k&&(O+=(k=sn(o))*k),r>1&&0===A&&(O+=(A=sn(o))*A),r>2&&0===j&&(O+=(j=sn(o))*j),O=(M-(O=Math.sqrt(O)))/O*i,d.vx+=(k*=O)*(M=(_*=_)/(g+_)),r>1&&(d.vy+=(A*=O)*M),r>2&&(d.vz+=(j*=O)*M),N.vx-=k*(M=1-M),r>1&&(N.vy-=A*M),r>2&&(N.vz-=j*M))}}}function u(t){if(t.data)return t.r=n[t.data.index];for(var e=t.r=0;e<Math.pow(2,r);++e)t[e]&&t[e].r>t.r&&(t.r=t[e].r)}function d(){if(e){var r,o,i=e.length;for(n=new Array(i),r=0;r<i;++r)o=e[r],n[o.index]=+t(o,r,e)}}return"function"!=typeof t&&(t=on(null==t?1:+t)),a.initialize=function(t,...n){e=t,o=n.find((t=>"function"==typeof t))||Math.random,r=n.find((t=>[1,2,3].includes(t)))||2,d()},a.iterations=function(t){return arguments.length?(s=+t,a):s},a.strength=function(t){return arguments.length?(i=+t,a):i},a.radius=function(e){return arguments.length?(t="function"==typeof e?e:on(+e),d(),a):t},a}function On(t,e,r,n){var o,i,s,a,u=on(.1);function d(t){for(var u=0,d=o.length;u<d;++u){var h=o[u],c=h.x-e||1e-6,l=(h.y||0)-r||1e-6,f=(h.z||0)-n||1e-6,g=Math.sqrt(c*c+l*l+f*f),p=(a[u]-g)*s[u]*t/g;h.vx+=c*p,i>1&&(h.vy+=l*p),i>2&&(h.vz+=f*p)}}function h(){if(o){var e,r=o.length;for(s=new Array(r),a=new Array(r),e=0;e<r;++e)a[e]=+t(o[e],e,o),s[e]=isNaN(a[e])?0:+u(o[e],e,o)}}return"function"!=typeof t&&(t=on(+t)),null==e&&(e=0),null==r&&(r=0),null==n&&(n=0),d.initialize=function(t,...e){o=t,i=e.find((t=>[1,2,3].includes(t)))||2,h()},d.strength=function(t){return arguments.length?(u="function"==typeof t?t:on(+t),h(),d):u},d.radius=function(e){return arguments.length?(t="function"==typeof e?e:on(+e),h(),d):t},d.x=function(t){return arguments.length?(e=+t,d):e},d.y=function(t){return arguments.length?(r=+t,d):r},d.z=function(t){return arguments.length?(n=+t,d):n},d}function Sn(t){var e,r,n,o=on(.1);function i(t){for(var o,i=0,s=e.length;i<s;++i)(o=e[i]).vx+=(n[i]-o.x)*r[i]*t}function s(){if(e){var i,s=e.length;for(r=new Array(s),n=new Array(s),i=0;i<s;++i)r[i]=isNaN(n[i]=+t(e[i],i,e))?0:+o(e[i],i,e)}}return"function"!=typeof t&&(t=on(null==t?0:+t)),i.initialize=function(t){e=t,s()},i.strength=function(t){return arguments.length?(o="function"==typeof t?t:on(+t),s(),i):o},i.x=function(e){return arguments.length?(t="function"==typeof e?e:on(+e),s(),i):t},i}function zn(t){var e,r,n,o=on(.1);function i(t){for(var o,i=0,s=e.length;i<s;++i)(o=e[i]).vy+=(n[i]-o.y)*r[i]*t}function s(){if(e){var i,s=e.length;for(r=new Array(s),n=new Array(s),i=0;i<s;++i)r[i]=isNaN(n[i]=+t(e[i],i,e))?0:+o(e[i],i,e)}}return"function"!=typeof t&&(t=on(null==t?0:+t)),i.initialize=function(t){e=t,s()},i.strength=function(t){return arguments.length?(o="function"==typeof t?t:on(+t),s(),i):o},i.y=function(e){return arguments.length?(t="function"==typeof e?e:on(+e),s(),i):t},i}function Rn(t){var e,r,n,o=on(.1);function i(t){for(var o,i=0,s=e.length;i<s;++i)(o=e[i]).vz+=(n[i]-o.z)*r[i]*t}function s(){if(e){var i,s=e.length;for(r=new Array(s),n=new Array(s),i=0;i<s;++i)r[i]=isNaN(n[i]=+t(e[i],i,e))?0:+o(e[i],i,e)}}return"function"!=typeof t&&(t=on(null==t?0:+t)),i.initialize=function(t){e=t,s()},i.strength=function(t){return arguments.length?(o="function"==typeof t?t:on(+t),s(),i):o},i.z=function(e){return arguments.length?(t="function"==typeof e?e:on(+e),s(),i):t},i}var In=r(5439),Pn=r.n(In);class Cn{constructor(t){this.id="dagre",this.options={},Object.assign(this.options,Cn.defaultOptions,t)}execute(e,r){return t(this,void 0,void 0,(function*(){return this.genericDagreLayout(!1,e,Object.assign(Object.assign({},this.options),r))}))}assign(e,r){return t(this,void 0,void 0,(function*(){yield this.genericDagreLayout(!0,e,Object.assign(Object.assign({},this.options),r))}))}genericDagreLayout(e,r,n){return t(this,void 0,void 0,(function*(){const{nodeSize:t}=n,o=new In.graphlib.Graph;o.setGraph(n),o.setDefaultEdgeLabel((()=>({}))),[...r.getAllNodes(),...r.getAllEdges()].some((({id:t})=>c(t)))&&console.error("Dagre layout only support string id, it will convert number to string."),r.getAllNodes().forEach((e=>{const{id:r}=e,n=Object.assign({},e.data);if(void 0!==t){const[r,o]=Ut($t(t)?t(e):t);Object.assign(n,{width:r,height:o})}o.setNode(r.toString(),n)})),r.getAllEdges().forEach((({id:t,source:e,target:r})=>{o.setEdge(e.toString(),r.toString(),{id:t})})),Pn().layout(o);const i={nodes:[],edges:[]};return o.nodes().forEach((t=>{const n=o.node(t);i.nodes.push({id:t,data:n}),e&&r.mergeNodeData(t,n)})),o.edges().forEach((t=>{const n=o.edge(t),{id:s}=n,a=function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(r[n[o]]=t[n[o]])}return r}(n,["id"]),{v:u,w:d}=t;i.edges.push({id:s,source:u,target:d,data:a}),e&&r.mergeEdgeData(s,a)})),i}))}}Cn.defaultOptions={};class Dn{constructor(t){this.id=t.id||0,this.rx=t.rx,this.ry=t.ry,this.fx=0,this.fy=0,this.mass=t.mass,this.degree=t.degree,this.g=t.g||0}distanceTo(t){const e=this.rx-t.rx,r=this.ry-t.ry;return Math.hypot(e,r)}setPos(t,e){this.rx=t,this.ry=e}resetForce(){this.fx=0,this.fy=0}addForce(t){const e=t.rx-this.rx,r=t.ry-this.ry;let n=Math.hypot(e,r);n=n<1e-4?1e-4:n;const o=this.g*(this.degree+1)*(t.degree+1)/n;this.fx+=o*e/n,this.fy+=o*r/n}in(t){return t.contains(this.rx,this.ry)}add(t){const e=this.mass+t.mass,r=(this.rx*this.mass+t.rx*t.mass)/e,n=(this.ry*this.mass+t.ry*t.mass)/e,o=this.degree+t.degree;return new Dn({rx:r,ry:n,mass:e,degree:o})}}class Tn{constructor(t){this.xmid=t.xmid,this.ymid=t.ymid,this.length=t.length,this.massCenter=t.massCenter||[0,0],this.mass=t.mass||1}getLength(){return this.length}contains(t,e){const r=this.length/2;return t<=this.xmid+r&&t>=this.xmid-r&&e<=this.ymid+r&&e>=this.ymid-r}NW(){const t=this.xmid-this.length/4,e=this.ymid+this.length/4,r=this.length/2;return new Tn({xmid:t,ymid:e,length:r})}NE(){const t=this.xmid+this.length/4,e=this.ymid+this.length/4,r=this.length/2;return new Tn({xmid:t,ymid:e,length:r})}SW(){const t=this.xmid-this.length/4,e=this.ymid-this.length/4,r=this.length/2;return new Tn({xmid:t,ymid:e,length:r})}SE(){const t=this.xmid+this.length/4,e=this.ymid-this.length/4,r=this.length/2;return new Tn({xmid:t,ymid:e,length:r})}}class Ln{constructor(t){this.body=null,this.quad=null,this.NW=null,this.NE=null,this.SW=null,this.SE=null,this.theta=.5,null!=t&&(this.quad=t)}insert(t){null!=this.body?this._isExternal()?(this.quad&&(this.NW=new Ln(this.quad.NW()),this.NE=new Ln(this.quad.NE()),this.SW=new Ln(this.quad.SW()),this.SE=new Ln(this.quad.SE())),this._putBody(this.body),this._putBody(t),this.body=this.body.add(t)):(this.body=this.body.add(t),this._putBody(t)):this.body=t}_putBody(t){this.quad&&(t.in(this.quad.NW())&&this.NW?this.NW.insert(t):t.in(this.quad.NE())&&this.NE?this.NE.insert(t):t.in(this.quad.SW())&&this.SW?this.SW.insert(t):t.in(this.quad.SE())&&this.SE&&this.SE.insert(t))}_isExternal(){return null==this.NW&&null==this.NE&&null==this.SW&&null==this.SE}updateForce(t){null!=this.body&&t!==this.body&&(this._isExternal()||(this.quad?this.quad.getLength():0)/this.body.distanceTo(t)<this.theta?t.addForce(this.body):(this.NW&&this.NW.updateForce(t),this.NE&&this.NE.updateForce(t),this.SW&&this.SW.updateForce(t),this.SE&&this.SE.updateForce(t)))}}const Fn={center:[0,0],width:300,height:300,kr:5,kg:1,mode:"normal",preventOverlap:!1,dissuadeHubs:!1,maxIteration:0,ks:.1,ksmax:10,tao:.1},qn={maxIteration:1e3,gravity:10,speed:5,clustering:!1,clusterGravity:10,width:300,height:300,nodeClusterBy:"cluster"},Vn={begin:[0,0],preventOverlap:!0,preventOverlapPadding:10,condense:!1,rows:void 0,cols:void 0,position:void 0,sortBy:"degree",nodeSize:30,width:300,height:300},Bn=(t,e)=>{let r;const n=t.rows||5,o=t.cols||5;return null==e?r=Math.min(n,o):Math.min(n,o)===t.rows?t.rows=e:t.cols=e,r},$n=(t,e)=>{let r;const n=t.rows||5,o=t.cols||5;return null==e?r=Math.max(n,o):Math.max(n,o)===t.rows?t.rows=e:t.cols=e,r},Gn=(t,e)=>t[`c-${e.row}-${e.col}`]||!1,Un=(t,e)=>t[`c-${e.row}-${e.col}`]=!0,Wn=(t,e)=>{const r=t.cols||5;e.col++,e.col>=r&&(e.col=0,e.row++)},Yn=(t,e,r,n,o,i,s,a)=>{let u,d;const h=o[t.id];if(h)u=h.col*r+r/2+e[0],d=h.row*n+n/2+e[1];else{for(;Gn(a,s);)Wn(i,s);u=s.col*r+r/2+e[0],d=s.row*n+n/2+e[1],Un(a,s),Wn(i,s)}t.data.x=u,t.data.y=d},Hn={iterations:10,height:10,width:10,speed:100,gravity:10,k:5},Kn=(t,e,r,n,o,i)=>{e.forEach(((s,a)=>{r[a]={x:0,y:0},e.forEach(((e,u)=>{if(a===u)return;if(o[a]!==o[u])return;let d=s.x-e.x,h=s.y-e.y,c=Math.sqrt(d*d+h*h);if(0===c){c=1;const t=a>u?1:-1;d=.01*t,h=.01*t}if(c<i(t[a])/2+i(t[u])/2){const t=n*n/c;r[a].x+=d/c*t,r[a].y+=h/c*t}}))}))},Jn=(t,e,r,n,o,i,s,a)=>{const u=i||s/10;return n&&e.forEach(((e,r)=>{const n=t[r].x-t[o].x,i=t[r].y-t[o].y,s=Math.sqrt(n*n+i*i);let a=i/s,u=-n/s;const d=Math.sqrt(e.x*e.x+e.y*e.y);let h=Math.acos((a*e.x+u*e.y)/d);h>Math.PI/2&&(h-=Math.PI/2,a*=-1,u*=-1);const c=Math.cos(h)*d;e.x=a*c,e.y=u*c})),t.forEach(((i,s)=>{if(s===o)return;const d=Math.sqrt(e[s].x*e[s].x+e[s].y*e[s].y);if(d>0&&s!==o){const h=Math.min(u*(r/800),d);if(i.x+=e[s].x/d*h,i.y+=e[s].y/d*h,n){let e=i.x-t[o].x,r=i.y-t[o].y;const n=Math.sqrt(e*e+r*r);e=e/n*a[s],r=r/n*a[s],i.x=t[o].x+e,i.y=t[o].y+r}}})),t},Xn={maxIteration:1e3,focusNode:null,unitRadius:null,linkDistance:50,preventOverlap:!1,strictRadial:!0,maxPreventOverlapIteration:200,sortStrength:10},Qn={center:[0,0],width:300,height:300},Zn={circular:class{constructor(t={}){this.options=t,this.id="circular",this.options=Object.assign(Object.assign({},Zt),t)}execute(e,r){return t(this,void 0,void 0,(function*(){return this.genericCircularLayout(!1,e,r)}))}assign(e,r){return t(this,void 0,void 0,(function*(){yield this.genericCircularLayout(!0,e,r)}))}genericCircularLayout(e,r,n){return t(this,void 0,void 0,(function*(){const t=Object.assign(Object.assign({},this.options),n),{width:o,height:i,center:s,divisions:a,startAngle:u=0,endAngle:d=2*Math.PI,angleRatio:h,ordering:c,clockwise:l,nodeSpacing:f,nodeSize:g}=t,p=r.getAllNodes(),v=r.getAllEdges(),[y,m,w]=((t,e,r)=>{let n=t,o=e,i=r;return n||"undefined"==typeof window||(n=window.innerWidth),o||"undefined"==typeof window||(o=window.innerHeight),i||(i=[n/2,o/2]),[n,o,i]})(o,i,s),x=null==p?void 0:p.length;if(!x||1===x)return Qt(r,e,w);const b=(d-u)/x;let{radius:E,startRadius:N,endRadius:_}=t;if(f){const t=Wt(10,f),e=Yt(10,g);let r=-1/0;p.forEach((t=>{const n=e(t);r<n&&(r=n)}));let n=0;p.forEach(((e,o)=>{n+=0===o?r||10:(t(e)||0)+(r||10)})),E=n/(2*Math.PI)}else E||N||_?!N&&_?N=_:N&&!_&&(_=N):E=Math.min(m,y)/2;const M=b*h;let k=[];k="topology"===c?te(r,p):"topology-directed"===c?te(r,p,!0):"degree"===c?function(t,e){const r=[];return e.forEach(((t,e)=>{r.push(Jt(t))})),r.sort(((e,r)=>t.getDegree(e.id,"both")-t.getDegree(r.id,"both"))),r}(r,p):p.map((t=>Jt(t)));const A=Math.ceil(x/a);for(let t=0;t<x;++t){let e=E;e||null===N||null===_||(e=N+t*(_-N)/(x-1)),e||(e=10+100*t/(x-1));let r=u+t%A*M+2*Math.PI/a*Math.floor(t/A);l||(r=d-t%A*M-2*Math.PI/a*Math.floor(t/A)),k[t].data.x=w[0]+Math.cos(r)*e,k[t].data.y=w[1]+Math.sin(r)*e}return e&&k.forEach((t=>{r.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})})),{nodes:k,edges:v}}))}},concentric:oe,mds:or,random:class{constructor(t={}){this.options=t,this.id="random",this.options=Object.assign(Object.assign({},Qn),t)}execute(e,r){return t(this,void 0,void 0,(function*(){return this.genericRandomLayout(!1,e,r)}))}assign(e,r){return t(this,void 0,void 0,(function*(){yield this.genericRandomLayout(!0,e,r)}))}genericRandomLayout(e,r,n){return t(this,void 0,void 0,(function*(){const t=Object.assign(Object.assign({},this.options),n),{center:o,width:i,height:s}=t,a=r.getAllNodes(),u=i||"undefined"==typeof window?i:window.innerWidth,d=s||"undefined"==typeof window?s:window.innerHeight,h=o||[u/2,d/2],c=[];return a&&a.forEach((t=>{c.push({id:t.id,data:{x:.9*(Math.random()-.5)*u+h[0],y:.9*(Math.random()-.5)*d+h[1]}})})),e&&c.forEach((t=>r.mergeNodeData(t.id,{x:t.data.x,y:t.data.y}))),{nodes:c,edges:r.getAllEdges()}}))}},grid:class{constructor(t={}){this.options=t,this.id="grid",this.options=Object.assign(Object.assign({},Vn),t)}execute(e,r){return t(this,void 0,void 0,(function*(){return this.genericGridLayout(!1,e,r)}))}assign(e,r){return t(this,void 0,void 0,(function*(){yield this.genericGridLayout(!0,e,r)}))}genericGridLayout(e,r,n){return t(this,void 0,void 0,(function*(){const t=Object.assign(Object.assign({},this.options),n),{begin:o=[0,0],condense:i,preventOverlapPadding:s,preventOverlap:a,rows:u,cols:d,nodeSpacing:h,nodeSize:l,width:f,height:g,position:p}=t;let{sortBy:v}=t;const y=r.getAllNodes(),m=r.getAllEdges(),w=null==y?void 0:y.length;if(!w||1===w)return Qt(r,e,o);const x=y.map((t=>Jt(t)));"id"===v||ee(v)&&void 0!==x[0].data[v]||(v="degree"),"degree"===v?x.sort(((t,e)=>r.getDegree(e.id,"both")-r.getDegree(t.id,"both"))):"id"===v?x.sort(((t,e)=>c(e.id)&&c(t.id)?e.id-t.id:`${t.id}`.localeCompare(`${e.id}`))):x.sort(((t,e)=>e.data[v]-t.data[v]));const b=f||"undefined"==typeof window?f:window.innerWidth,E=g||"undefined"==typeof window?g:window.innerHeight,N=w,_={rows:u,cols:d};if(null!=u&&null!=d)_.rows=u,_.cols=d;else if(null!=u&&null==d)_.rows=u,_.cols=Math.ceil(N/_.rows);else if(null==u&&null!=d)_.cols=d,_.rows=Math.ceil(N/_.cols);else{const t=Math.sqrt(N*E/b);_.rows=Math.round(t),_.cols=Math.round(b/E*t)}if(_.rows=Math.max(_.rows,1),_.cols=Math.max(_.cols,1),_.cols*_.rows>N){const t=Bn(_),e=$n(_);(t-1)*e>=N?Bn(_,t-1):(e-1)*t>=N&&$n(_,e-1)}else for(;_.cols*_.rows<N;){const t=Bn(_),e=$n(_);(e+1)*t>=N?$n(_,e+1):Bn(_,t+1)}let M=i?0:b/_.cols,k=i?0:E/_.rows;if(a||h){const t=Wt(10,h),e=Yt(30,l,!1);x.forEach((n=>{n.data.x&&n.data.y||(n.data.x=0,n.data.y=0);const o=r.getNode(n.id),[i,a]=Ut(e(o)||30),u=void 0!==t?t(n):s,d=i+u,h=a+u;M=Math.max(M,d),k=Math.max(k,h)}))}const A={},j={row:0,col:0},O={};for(let t=0;t<x.length;t++){const e=x[t];let n;if(p&&(n=p(r.getNode(e.id))),n&&(void 0!==n.row||void 0!==n.col)){const t={row:n.row,col:n.col};if(void 0===t.col)for(t.col=0;Gn(A,t);)t.col++;else if(void 0===t.row)for(t.row=0;Gn(A,t);)t.row++;O[e.id]=t,Un(A,t)}Yn(e,o,M,k,O,_,j,A)}const S={nodes:x,edges:m};return e&&x.forEach((t=>{r.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})})),S}))}},radial:class{constructor(t={}){this.options=t,this.id="radial",this.options=Object.assign(Object.assign({},Xn),t)}execute(e,r){return t(this,void 0,void 0,(function*(){return this.genericRadialLayout(!1,e,r)}))}assign(e,r){return t(this,void 0,void 0,(function*(){yield this.genericRadialLayout(!0,e,r)}))}genericRadialLayout(e,r,n){return t(this,void 0,void 0,(function*(){const t=Object.assign(Object.assign({},this.options),n),{width:o,height:i,center:s,focusNode:a,unitRadius:u,nodeSize:d,nodeSpacing:h,strictRadial:c,preventOverlap:l,maxPreventOverlapIteration:f,sortBy:g,linkDistance:p=50,sortStrength:v=10,maxIteration:y=1e3}=t,m=r.getAllNodes(),w=r.getAllEdges(),x=o||"undefined"==typeof window?o:window.innerWidth,b=i||"undefined"==typeof window?i:window.innerHeight,E=s||[x/2,b/2];if(!(null==m?void 0:m.length)||1===m.length)return Qt(r,e,E);let N=m[0];if(ee(a)){for(let t=0;t<m.length;t++)if(m[t].id===a){N=m[t];break}}else N=a||m[0];const _=((t,e)=>{let r=-1;return t.forEach(((t,n)=>{t.id===e&&(r=n)})),Math.max(r,0)})(m,N.id),M=tr({nodes:m,edges:w},!1),k=Ze(M),A=((t,e)=>{let r=0;for(let n=0;n<t[e].length;n++)t[e][n]!==1/0&&(r=t[e][n]>r?t[e][n]:r);return r})(k,_);((t,e,r)=>{const n=t.length;for(let o=0;o<n;o++)if(t[e][o]===1/0){t[e][o]=r,t[o][e]=r;for(let i=0;i<n;i++)t[o][i]!==1/0&&t[e][i]===1/0&&(t[e][i]=r+t[o][i],t[i][e]=r+t[o][i])}for(let r=0;r<n;r++)if(r!==e)for(let o=0;o<n;o++)if(t[r][o]===1/0){let n=Math.abs(t[e][r]-t[e][o]);n=0===n?1:n,t[r][o]=n}})(k,_,A+1);const j=k[_];let O=x-E[0]>E[0]?E[0]:x-E[0],S=b-E[1]>E[1]?E[1]:b-E[1];0===O&&(O=x/2),0===S&&(S=b/2);const z=Math.min(O,S),R=Math.max(...j),I=[],P=u||z/R;j.forEach(((t,e)=>{I[e]=t*P}));const C=((t,e,r,n,o,i,s)=>{if(!t)return[];const a=[];if(e){const u={};e.forEach(((e,d)=>{const h=[];e.forEach(((e,a)=>{var c,l;if(d===a)h.push(0);else if(n[d]===n[a])if("data"===i)h.push(e*(Math.abs(d-a)*s)/(n[d]/o));else if(i){let r,f;if(u[t[d].id])r=u[t[d].id];else{const e=("id"===i?t[d].id:null===(c=t[d].data)||void 0===c?void 0:c[i])||0;r=ee(e)?e.charCodeAt(0):e,u[t[d].id]=r}if(u[t[a].id])f=u[t[a].id];else{const e=("id"===i?t[a].id:null===(l=t[a].data)||void 0===l?void 0:l[i])||0;f=ee(e)?e.charCodeAt(0):e,u[t[a].id]=f}h.push(e*(Math.abs(r-f)*s)/(n[d]/o))}else h.push(e*r/(n[d]/o));else{const t=(r+o)/2;h.push(e*t)}})),a.push(h)}))}return a})(m,k,p,I,P,g,v),D=(t=>{const e=t.length,r=t[0].length,n=[];for(let o=0;o<e;o++){const e=[];for(let n=0;n<r;n++)0!==t[o][n]?e.push(1/(t[o][n]*t[o][n])):e.push(0);n.push(e)}return n})(C),T=((t,e,r)=>{try{const r=Ke.mul(Ke.pow(e,2),-.5),n=r.mean("row"),o=r.mean("column"),i=r.mean();r.add(i).subRowVector(n).subColumnVector(o);const s=new Qe(r),a=Ke.sqrt(s.diagonalMatrix).diagonal();return s.leftSingularVectors.toJSON().map((e=>Ke.mul([e],[a]).toJSON()[0].splice(0,t)))}catch(t){const n=[];for(let t=0;t<e.length;t++){const t=Math.random()*r,e=Math.random()*r;n.push([t,e])}return n}})(p,C,p);let L,F=T.map((([t,e])=>({x:(isNaN(t)?Math.random()*p:t)-T[_][0],y:(isNaN(e)?Math.random()*p:e)-T[_][1]})));if(this.run(y,F,D,C,I,_),l){L=Ht(d,h);const t={nodes:m,nodeSizeFunc:L,positions:F,radii:I,height:b,width:x,strictRadial:Boolean(c),focusIdx:_,iterations:f||200,k:F.length/4.5};F=((t,e)=>{const r=Object.assign(Object.assign({},Hn),e),{positions:n,iterations:o,width:i,k:s,speed:a=100,strictRadial:u,focusIdx:d,radii:h=[],nodeSizeFunc:c}=r,l=t.getAllNodes(),f=[],g=i/10;for(let t=0;t<o;t++)n.forEach(((t,e)=>{f[e]={x:0,y:0}})),Kn(l,n,f,s,h,c),Jn(n,f,a,u,d,g,i,h);return n})(r,t)}const q=[];return F.forEach(((t,e)=>{const r=Jt(m[e]);r.data.x=t.x+E[0],r.data.y=t.y+E[1],q.push(r)})),e&&q.forEach((t=>r.mergeNodeData(t.id,{x:t.data.x,y:t.data.y}))),{nodes:q,edges:w}}))}run(t,e,r,n,o,i){for(let s=0;s<=t;s++){const a=s/t;this.oneIteration(a,e,o,n,r,i)}}oneIteration(t,e,r,n,o,i){const s=1-t;e.forEach(((a,u)=>{const d=er(a,{x:0,y:0}),h=0===d?0:1/d;if(u===i)return;let c=0,l=0,f=0;e.forEach(((t,e)=>{if(u===e)return;const r=er(a,t),i=0===r?0:1/r,s=n[e][u];f+=o[u][e],c+=o[u][e]*(t.x+s*(a.x-t.x)*i),l+=o[u][e]*(t.y+s*(a.y-t.y)*i)}));const g=0===r[u]?0:1/r[u];f*=s,f+=t*g*g,c*=s,c+=t*g*a.x*h,a.x=c/f,l*=s,l+=t*g*a.y*h,a.y=l/f}))}},force:Me,d3force:rn,"d3-force-3d":class extends rn{constructor(){super(...arguments),this.id="d3-force-3d",this.config={inputNodeAttrs:["x","y","z","vx","vy","vz","fx","fy","fz"],outputNodeAttrs:["x","y","z","vx","vy","vz"],simulationAttrs:["alpha","alphaMin","alphaDecay","alphaTarget","velocityDecay","randomSource","numDimensions"]},this.forceMap={link:dn,manyBody:Nn,center:_n,collide:jn,radial:On,x:Sn,y:zn,z:Rn},this.options={numDimensions:3,link:{id:t=>t.id},manyBody:{},center:{x:0,y:0,z:0}}}initSimulation(){return function(t,e){e=e||2;var r,n=Math.min(3,Math.max(1,Math.round(e))),o=1,i=.001,s=1-Math.pow(i,1/300),a=0,u=.6,d=new Map,h=qr(f),c=kr("tick","end"),l=function(){let t=1;return()=>(t=(1664525*t+1013904223)%yn)/yn}();function f(){g(),c.call("tick",r),o<i&&(h.stop(),c.call("end",r))}function g(e){var i,h,c=t.length;void 0===e&&(e=1);for(var l=0;l<e;++l)for(o+=(a-o)*s,d.forEach((function(t){t(o)})),i=0;i<c;++i)null==(h=t[i]).fx?h.x+=h.vx*=u:(h.x=h.fx,h.vx=0),n>1&&(null==h.fy?h.y+=h.vy*=u:(h.y=h.fy,h.vy=0)),n>2&&(null==h.fz?h.z+=h.vz*=u:(h.z=h.fz,h.vz=0));return r}function p(){for(var e,r=0,o=t.length;r<o;++r){if((e=t[r]).index=r,null!=e.fx&&(e.x=e.fx),null!=e.fy&&(e.y=e.fy),null!=e.fz&&(e.z=e.fz),isNaN(e.x)||n>1&&isNaN(e.y)||n>2&&isNaN(e.z)){var i=10*(n>2?Math.cbrt(.5+r):n>1?Math.sqrt(.5+r):r),s=r*bn,a=r*En;1===n?e.x=i:2===n?(e.x=i*Math.cos(s),e.y=i*Math.sin(s)):(e.x=i*Math.sin(s)*Math.cos(a),e.y=i*Math.cos(s),e.z=i*Math.sin(s)*Math.sin(a))}(isNaN(e.vx)||n>1&&isNaN(e.vy)||n>2&&isNaN(e.vz))&&(e.vx=0,n>1&&(e.vy=0),n>2&&(e.vz=0))}}function v(e){return e.initialize&&e.initialize(t,l,n),e}return null==t&&(t=[]),p(),r={tick:g,restart:function(){return h.restart(f),r},stop:function(){return h.stop(),r},numDimensions:function(t){return arguments.length?(n=Math.min(3,Math.max(1,Math.round(t))),d.forEach(v),r):n},nodes:function(e){return arguments.length?(t=e,p(),d.forEach(v),r):t},alpha:function(t){return arguments.length?(o=+t,r):o},alphaMin:function(t){return arguments.length?(i=+t,r):i},alphaDecay:function(t){return arguments.length?(s=+t,r):+s},alphaTarget:function(t){return arguments.length?(a=+t,r):a},velocityDecay:function(t){return arguments.length?(u=1-t,r):1-u},randomSource:function(t){return arguments.length?(l=t,d.forEach(v),r):l},force:function(t,e){return arguments.length>1?(null==e?d.delete(t):d.set(t,v(e)),r):d.get(t)},find:function(){var e,r,o,i,s,a,u=Array.prototype.slice.call(arguments),d=u.shift()||0,h=(n>1?u.shift():null)||0,c=(n>2?u.shift():null)||0,l=u.shift()||1/0,f=0,g=t.length;for(l*=l,f=0;f<g;++f)(i=(e=d-(s=t[f]).x)*e+(r=h-(s.y||0))*r+(o=c-(s.z||0))*o)<l&&(a=s,l=i);return a},on:function(t,e){return arguments.length>1?(c.on(t,e),r):c.on(t)}}}()}},fruchterman:class{constructor(t={}){this.options=t,this.id="fruchterman",this.timeInterval=0,this.running=!1,this.options=Object.assign(Object.assign({},qn),t)}execute(e,r){return t(this,void 0,void 0,(function*(){return this.genericFruchtermanLayout(!1,e,r)}))}assign(e,r){return t(this,void 0,void 0,(function*(){yield this.genericFruchtermanLayout(!0,e,r)}))}stop(){this.timeInterval&&"undefined"!=typeof window&&window.clearInterval(this.timeInterval),this.running=!1}tick(t=this.options.maxIteration||1){if(this.lastResult)return this.lastResult;for(let e=0;e<t;e++)this.runOneStep(this.lastGraph,this.lastClusterMap,this.lastOptions);const e={nodes:this.lastLayoutNodes,edges:this.lastLayoutEdges};return this.lastAssign&&e.nodes.forEach((t=>this.lastGraph.mergeNodeData(t.id,{x:t.data.x,y:t.data.y,z:3===this.options.dimensions?t.data.z:void 0}))),e}genericFruchtermanLayout(e,r,n){return t(this,void 0,void 0,(function*(){if(this.running)return;const t=this.formatOptions(n),{dimensions:o,width:i,height:s,center:a,clustering:d,nodeClusterBy:h,maxIteration:c,onTick:l}=t,f=r.getAllNodes(),g=r.getAllEdges();if(!(null==f?void 0:f.length)){const t={nodes:[],edges:g};return this.lastResult=t,t}if(1===f.length){e&&r.mergeNodeData(f[0].id,{x:a[0],y:a[1],z:3===o?a[2]:void 0});const t={nodes:[Object.assign(Object.assign({},f[0]),{data:Object.assign(Object.assign({},f[0].data),{x:a[0],y:a[1],z:3===o?a[2]:void 0})})],edges:g};return this.lastResult=t,t}const p=f.map((t=>Jt(t,[i,s]))),v=new u({nodes:p,edges:g}),y={};if(d&&p.forEach((t=>{const e=t.data[h];y[e]||(y[e]={name:e,cx:0,cy:0,count:0})})),this.lastLayoutNodes=p,this.lastLayoutEdges=g,this.lastAssign=e,this.lastGraph=v,this.lastOptions=t,this.lastClusterMap=y,"undefined"==typeof window)return;let m=0;return new Promise((n=>{this.timeInterval=window.setInterval((()=>{this.running?(this.runOneStep(v,y,t),e&&p.forEach((({id:t,data:e})=>r.mergeNodeData(t,{x:e.x,y:e.y,z:3===o?e.z:void 0}))),null==l||l({nodes:p,edges:g}),m++,m>=c&&(window.clearInterval(this.timeInterval),n({nodes:p,edges:g}))):n({nodes:p,edges:g})}),0),this.running=!0}))}))}formatOptions(t={}){const e=Object.assign(Object.assign({},this.options),t),{clustering:r,nodeClusterBy:n}=e,{center:o,width:i,height:s}=e;return e.width=i||"undefined"==typeof window?i:window.innerWidth,e.height=s||"undefined"==typeof window?s:window.innerHeight,e.center=o||[e.width/2,e.height/2],e.clustering=r&&!!n,e}runOneStep(t,e,r){const{dimensions:n,height:o,width:i,gravity:s,center:a,speed:u,clustering:d,nodeClusterBy:h,clusterGravity:l}=r,f=o*i,g=Math.sqrt(f)/10,p=t.getAllNodes(),v=f/(p.length+1),y=Math.sqrt(v),m={};if(this.applyCalculate(t,m,y,v),d){for(const t in e)e[t].cx=0,e[t].cy=0,e[t].count=0;p.forEach((t=>{const{data:r}=t,n=e[r[h]];c(r.x)&&(n.cx+=r.x),c(r.y)&&(n.cy+=r.y),n.count++}));for(const t in e)e[t].cx/=e[t].count,e[t].cy/=e[t].count;const t=l||s;p.forEach(((r,n)=>{const{id:o,data:i}=r;if(!c(i.x)||!c(i.y))return;const s=e[i[h]],a=Math.sqrt((i.x-s.cx)*(i.x-s.cx)+(i.y-s.cy)*(i.y-s.cy)),u=y*t;m[o].x-=u*(i.x-s.cx)/a,m[o].y-=u*(i.y-s.cy)/a}))}p.forEach(((t,e)=>{const{id:r,data:o}=t;if(!c(o.x)||!c(o.y))return;const i=.01*y*s;m[r].x-=i*(o.x-a[0]),m[r].y-=i*(o.y-a[1]),3===n&&(m[r].z-=i*(o.z-a[2]))})),p.forEach(((e,r)=>{const{id:o,data:i}=e;if(c(i.fx)&&c(i.fy))return i.x=i.fx,i.y=i.fy,void(3===n&&(i.z=i.fz));if(!c(i.x)||!c(i.y))return;const s=Math.sqrt(m[o].x*m[o].x+m[o].y*m[o].y+(3===n?m[o].z*m[o].z:0));if(s>0){const e=Math.min(g*(u/800),s);t.mergeNodeData(o,{x:i.x+m[o].x/s*e,y:i.y+m[o].y/s*e,z:3===n?i.z+m[o].z/s*e:void 0})}}))}applyCalculate(t,e,r,n){this.calRepulsive(t,e,n),this.calAttractive(t,e,r)}calRepulsive(t,e,r){const n=t.getAllNodes();n.forEach((({data:t,id:o},i)=>{e[o]={x:0,y:0,z:0},n.forEach((({data:n,id:s},a)=>{if(i<=a||!c(t.x)||!c(n.x)||!c(t.y)||!c(n.y))return;let u=t.x-n.x,d=t.y-n.y,h=3===this.options.dimensions?t.z-n.z:0,l=u*u+d*d+h*h;0===l&&(l=1,u=.01,d=.01,h=.01);const f=r/l,g=u*f,p=d*f,v=h*f;e[o].x+=g,e[o].y+=p,e[s].x-=g,e[s].y-=p,3===this.options.dimensions&&(e[o].z+=v,e[s].z-=v)}))}))}calAttractive(t,e,r){t.getAllEdges().forEach((n=>{const{source:o,target:i}=n;if(!o||!i||o===i)return;const{data:s}=t.getNode(o),{data:a}=t.getNode(i);if(!(c(a.x)&&c(s.x)&&c(a.y)&&c(s.y)))return;const u=a.x-s.x,d=a.y-s.y,h=3===this.options.dimensions?a.z-s.z:0,l=Math.sqrt(u*u+d*d+h*h)/r,f=u*l,g=d*l,p=h*l;e[o].x+=f,e[o].y+=g,e[i].x-=f,e[i].y-=g,3===this.options.dimensions&&(e[o].z+=p,e[i].z-=p)}))}},forceAtlas2:class{constructor(t={}){this.options=t,this.id="forceAtlas2",this.options=Object.assign(Object.assign({},Fn),t)}execute(e,r){return t(this,void 0,void 0,(function*(){return this.genericForceAtlas2Layout(!1,e,r)}))}assign(e,r){return t(this,void 0,void 0,(function*(){yield this.genericForceAtlas2Layout(!0,e,r)}))}genericForceAtlas2Layout(e,r,n){return t(this,void 0,void 0,(function*(){const t=r.getAllEdges(),o=r.getAllNodes(),i=this.formatOptions(n,o.length),{width:s,height:a,prune:d,maxIteration:h,nodeSize:c,center:l}=i;if(!(null==o?void 0:o.length)||1===o.length)return Qt(r,e,l);const f=o.map((t=>Jt(t,[s,a]))),g=t.filter((t=>{const{source:e,target:r}=t;return e!==r})),p=new u({nodes:f,edges:g}),v=this.getSizes(p,c);if(this.run(p,r,h,v,e,i),d){for(let t=0;t<g.length;t+=1){const{source:e,target:r}=g[t],n=p.getDegree(e),o=p.getDegree(e);if(n<=1){const t=p.getNode(r);p.mergeNodeData(e,{x:t.data.x,y:t.data.y})}else if(o<=1){const t=p.getNode(e);p.mergeNodeData(r,{x:t.data.x,y:t.data.y})}}const t=Object.assign(Object.assign({},i),{prune:!1,barnesHut:!1});this.run(p,r,100,v,e,t)}return{nodes:f,edges:t}}))}getSizes(t,e){const r=t.getAllNodes(),n={};for(let t=0;t<r.length;t+=1){const o=r[t];n[o.id]=Ht(e,void 0)(o)}return n}formatOptions(t={},e){const r=Object.assign(Object.assign({},this.options),t),{center:n,width:o,height:i,barnesHut:s,prune:a,maxIteration:u,kr:d,kg:h}=r;return r.width=o||"undefined"==typeof window?o:window.innerWidth,r.height=i||"undefined"==typeof window?i:window.innerHeight,r.center=n||[r.width/2,r.height/2],void 0===s&&e>250&&(r.barnesHut=!0),void 0===a&&e>100&&(r.prune=!0),0!==u||a?0===u&&a&&(r.maxIteration=100,e<=200&&e>100?r.maxIteration=500:e>200&&(r.maxIteration=950)):(r.maxIteration=250,e<=200&&e>100?r.maxIteration=1e3:e>200&&(r.maxIteration=1200)),d||(r.kr=50,e>100&&e<=500?r.kr=20:e>500&&(r.kr=1)),h||(r.kg=20,e>100&&e<=500?r.kg=10:e>500&&(r.kg=1)),r}run(t,e,r,n,o,i){const{kr:s,barnesHut:a,onTick:u}=i,d=t.getAllNodes();let h=0,c=r;const l={},f={},g={};for(let e=0;e<d.length;e+=1){const{data:r,id:n}=d[e];if(l[n]=[0,0],a){const o={id:e,rx:r.x,ry:r.y,mass:1,g:s,degree:t.getDegree(n)};g[n]=new Dn(o)}}for(;c>0;)h=this.oneStep(t,{iter:c,preventOverlapIters:50,krPrime:100,sg:h,forces:l,preForces:f,bodies:g,sizes:n},i),c--,null==u||u({nodes:d,edges:e.getAllEdges()});return t}oneStep(t,e,r){const{iter:n,preventOverlapIters:o,krPrime:i,sg:s,preForces:a,bodies:u,sizes:d}=e;let{forces:h}=e;const{preventOverlap:c,barnesHut:l}=r,f=t.getAllNodes();for(let t=0;t<f.length;t+=1){const{id:e}=f[t];a[e]=[...h[e]],h[e]=[0,0]}return h=this.getAttrForces(t,n,o,d,h,r),h=l&&(c&&n>o||!c)?this.getOptRepGraForces(t,h,u,r):this.getRepGraForces(t,n,o,h,i,d,r),this.updatePos(t,h,a,s,r)}getAttrForces(t,e,r,n,o,i){const{preventOverlap:s,dissuadeHubs:a,mode:u,prune:d}=i,h=t.getAllEdges();for(let i=0;i<h.length;i+=1){const{source:c,target:l}=h[i],f=t.getNode(c),g=t.getNode(l),p=t.getDegree(c),v=t.getDegree(l);if(d&&(p<=1||v<=1))continue;const y=[g.data.x-f.data.x,g.data.y-f.data.y];let m=Math.hypot(y[0],y[1]);m=m<1e-4?1e-4:m,y[0]=y[0]/m,y[1]=y[1]/m,s&&e<r&&(m=m-n[c]-n[l]);let w=m,x=w;"linlog"===u&&(w=Math.log(1+m),x=w),a&&(w=m/p,x=m/v),s&&e<r&&m<=0?(w=0,x=0):s&&e<r&&m>0&&(w=m,x=m),o[c][0]+=w*y[0],o[l][0]-=x*y[0],o[c][1]+=w*y[1],o[l][1]-=x*y[1]}return o}getOptRepGraForces(t,e,r,n){const{kg:o,center:i,prune:s}=n,a=t.getAllNodes(),u=a.length;let d=9e10,h=-9e10,c=9e10,l=-9e10;for(let e=0;e<u;e+=1){const{id:n,data:o}=a[e];s&&t.getDegree(n)<=1||(r[n].setPos(o.x,o.y),o.x>=h&&(h=o.x),o.x<=d&&(d=o.x),o.y>=l&&(l=o.y),o.y<=c&&(c=o.y))}const f=Math.max(h-d,l-c),g=new Tn({xmid:(h+d)/2,ymid:(l+c)/2,length:f,massCenter:i,mass:u}),p=new Ln(g);for(let e=0;e<u;e+=1){const{id:n}=a[e];s&&t.getDegree(n)<=1||r[n].in(g)&&p.insert(r[n])}for(let n=0;n<u;n+=1){const{id:u,data:d}=a[n],h=t.getDegree(u);if(s&&h<=1)continue;r[u].resetForce(),p.updateForce(r[u]),e[u][0]-=r[u].fx,e[u][1]-=r[u].fy;const c=[d.x-i[0],d.y-i[1]];let l=Math.hypot(c[0],c[1]);l=l<1e-4?1e-4:l,c[0]=c[0]/l,c[1]=c[1]/l;const f=o*(h+1);e[u][0]-=f*c[0],e[u][1]-=f*c[1]}return e}getRepGraForces(t,e,r,n,o,i,s){const{preventOverlap:a,kr:u,kg:d,center:h,prune:c}=s,l=t.getAllNodes(),f=l.length;for(let s=0;s<f;s+=1){const g=l[s],p=t.getDegree(g.id);for(let d=s+1;d<f;d+=1){const s=l[d],h=t.getDegree(s.id);if(c&&(p<=1||h<=1))continue;const f=[s.data.x-g.data.x,s.data.y-g.data.y];let v=Math.hypot(f[0],f[1]);v=v<1e-4?1e-4:v,f[0]=f[0]/v,f[1]=f[1]/v,a&&e<r&&(v=v-i[g.id]-i[s.id]);let y=u*(p+1)*(h+1)/v;a&&e<r&&v<0?y=o*(p+1)*(h+1):a&&e<r&&0===v?y=0:a&&e<r&&v>0&&(y=u*(p+1)*(h+1)/v),n[g.id][0]-=y*f[0],n[s.id][0]+=y*f[0],n[g.id][1]-=y*f[1],n[s.id][1]+=y*f[1]}const v=[g.data.x-h[0],g.data.y-h[1]],y=Math.hypot(v[0],v[1]);v[0]=v[0]/y,v[1]=v[1]/y;const m=d*(p+1);n[g.id][0]-=m*v[0],n[g.id][1]-=m*v[1]}return n}updatePos(t,e,r,n,o){const{ks:i,tao:s,prune:a,ksmax:u}=o,d=t.getAllNodes(),h=d.length,l=[],f=[];let g=0,p=0,v=n;for(let n=0;n<h;n+=1){const{id:o}=d[n],i=t.getDegree(o);if(a&&i<=1)continue;const s=[e[o][0]-r[o][0],e[o][1]-r[o][1]],u=Math.hypot(s[0],s[1]),h=[e[o][0]+r[o][0],e[o][1]+r[o][1]],c=Math.hypot(h[0],h[1]);l[n]=u,f[n]=c/2,g+=(i+1)*l[n],p+=(i+1)*f[n]}const y=v;v=s*p/g,0!==y&&(v=v>1.5*y?1.5*y:v);for(let r=0;r<h;r+=1){const{id:n,data:o}=d[r],s=t.getDegree(n);if(a&&s<=1)continue;if(c(o.fx)&&c(o.fy))continue;let h=i*v/(1+v*Math.sqrt(l[r])),f=Math.hypot(e[n][0],e[n][1]);f=f<1e-4?1e-4:f;const g=u/f;h=h>g?g:h;const p=h*e[n][0],y=h*e[n][1];t.mergeNodeData(n,{x:o.x+p,y:o.y+y})}return v}},dagre:Cn,antvDagre:class{constructor(t={}){this.options=t,this.id="antv-dagre",this.options=Object.assign(Object.assign({},Xt),t)}execute(e,r){return t(this,void 0,void 0,(function*(){return this.genericDagreLayout(!1,e,r)}))}assign(e,r){return t(this,void 0,void 0,(function*(){yield this.genericDagreLayout(!0,e,r)}))}genericDagreLayout(e,r,n){return t(this,void 0,void 0,(function*(){const t=Object.assign(Object.assign({},this.options),n),{nodeSize:o,align:i,rankdir:s="TB",ranksep:a,nodesep:d,ranksepFunc:h,nodesepFunc:l,edgeLabelSpace:f,ranker:g,nodeOrder:p,begin:v,controlPoints:y,radial:m,sortByCombo:w,preset:x}=t,b=new u({tree:[]}),E=Wt(a||50,h),N=Wt(d||50,l);let _=N,M=E;"LR"!==s&&"RL"!==s||(_=E,M=N);const k=Yt(10,o,!1),A=r.getAllNodes(),j=r.getAllEdges();let O;A.forEach((t=>{const e=Ut(k(t)),r=M(t),n=_(t),o=e[0]+2*n,i=e[1]+2*r,s=t.data.layer;c(s)?b.addNode({id:t.id,data:{width:o,height:i,layer:s}}):b.addNode({id:t.id,data:{width:o,height:i}})})),w&&(b.attachTreeStructure("combo"),A.forEach((t=>{const{parentId:e}=t.data;void 0!==e&&b.hasNode(e)&&b.setParent(t.id,e,"combo")}))),j.forEach((t=>{b.addEdge({id:t.id,source:t.source,target:t.target,data:{weight:t.data.weight||1}})})),(null==x?void 0:x.length)&&(O=new u({nodes:x})),((t,e)=>{const{edgeLabelSpace:r,keepNodeOrder:n,prevGraph:o,rankdir:i,ranksep:s}=e;var a,d;!n&&o&&(d=o,(a=t).getAllNodes().forEach((t=>{const e=a.getNode(t.id);if(d.hasNode(t.id)){const r=d.getNode(t.id);e.data.fixorder=r.data._order,delete r.data._order}else delete e.data.fixorder})));const h=(t=>{const e=new u({tree:[]});return t.getAllNodes().forEach((r=>{const n=Bt(t.getNode(r.id).data),o=Object.assign(Object.assign({},kt),n),i=Vt(o,Mt);e.hasNode(r.id)||e.addNode({id:r.id,data:Object.assign({},i)});const s=t.hasTreeStructure("combo")?t.getParent(r.id,"combo"):t.getParent(r.id);null==s||(e.hasNode(s.id)||e.addNode(Object.assign({},s)),e.setParent(r.id,s.id))})),t.getAllEdges().forEach((r=>{const n=Bt(t.getEdge(r.id).data),o={};null==Ot||Ot.forEach((t=>{void 0!==n[t]&&(o[t]=n[t])})),e.addEdge({id:r.id,source:r.source,target:r.target,data:Object.assign({},jt,Vt(n,At),o)})})),e})(t);let c;r&&(e.ranksep=((t,e)=>{const{ranksep:r=0,rankdir:n}=e;return t.getAllNodes().forEach((t=>{isNaN(t.data.layer)||t.data.layer||(t.data.layer=0)})),t.getAllEdges().forEach((t=>{var e;t.data.minlen*=2,"c"!==(null===(e=t.data.labelpos)||void 0===e?void 0:e.toLowerCase())&&("TB"===n||"BT"===n?t.data.width+=t.data.labeloffset:t.data.height+=t.data.labeloffset)})),r/2})(h,{rankdir:i,ranksep:s}));try{c=_t(h,e)}catch(t){if("Not possible to find intersection inside of the rectangle"===t.message)return void console.error("The following error may be caused by improper layer setting, please make sure your manual layer setting does not violate the graph\'s structure:\\n",t);throw t}((t,e)=>{t.getAllNodes().forEach((r=>{var n;const o=t.getNode(r.id);if(o){const t=e.getNode(r.id);o.data.x=t.data.x,o.data.y=t.data.y,o.data._order=t.data.order,o.data._rank=t.data.rank,(null===(n=e.getChildren(r.id))||void 0===n?void 0:n.length)&&(o.data.width=t.data.width,o.data.height=t.data.height)}})),t.getAllEdges().forEach((r=>{const n=t.getEdge(r.id),o=e.getEdge(r.id);n.data.points=o?o.data.points:[],o&&o.data.hasOwnProperty("x")&&(n.data.x=o.data.x,n.data.y=o.data.y)}))})(t,h)})(b,{prevGraph:O,edgeLabelSpace:f,keepNodeOrder:!!p,nodeOrder:p||[],acyclicer:"greedy",ranker:g,rankdir:s,nodesep:d,align:i});const S=[0,0];if(v){let t=1/0,e=1/0;b.getAllNodes().forEach((r=>{t>r.data.x&&(t=r.data.x),e>r.data.y&&(e=r.data.y)})),b.getAllEdges().forEach((r=>{var n;null===(n=r.data.points)||void 0===n||n.forEach((r=>{t>r.x&&(t=r.x),e>r.y&&(e=r.y)}))})),S[0]=v[0]-t,S[1]=v[1]-e}const z="LR"===s||"RL"===s;if(m);else{const t=new Set,e="BT"===s||"RL"===s?(t,e)=>e-t:(t,e)=>t-e;b.getAllNodes().forEach((e=>{e.data.x=e.data.x+S[0],e.data.y=e.data.y+S[1],t.add(z?e.data.x:e.data.y)}));const r=Array.from(t).sort(e),n=z?(t,e)=>t.x!==e.x:(t,e)=>t.y!==e.y,o=z?(t,e,r)=>{const n=Math.max(e.y,r.y),o=Math.min(e.y,r.y);return t.filter((t=>t.y<=n&&t.y>=o))}:(t,e,r)=>{const n=Math.max(e.x,r.x),o=Math.min(e.x,r.x);return t.filter((t=>t.x<=n&&t.x>=o))};b.getAllEdges().forEach(((t,e)=>{var i;f&&y&&"loop"!==t.data.type&&(t.data.controlPoints=((t,e,r,n,o,i,s)=>{let a=(null==t?void 0:t.slice(1,t.length-1))||[];if(e&&r){let{x:t,y:u}=e.data,{x:d,y:h}=r.data;if(o&&(t=e.data.y,u=e.data.x,d=r.data.y,h=r.data.x),h!==u&&t!==d){const c=n.indexOf(u),l=n[c+1];if(l){const t=a[0],e=o?{x:(u+l)/2,y:(null==t?void 0:t.y)||d}:{x:(null==t?void 0:t.x)||d,y:(u+l)/2};t&&!i(t,e)||a.unshift(e)}const f=n.indexOf(h),g=Math.abs(f-c);if(1===g)a=s(a,e.data,r.data),a.length||a.push(o?{x:(u+h)/2,y:t}:{x:t,y:(u+h)/2});else if(g>1){const e=n[f-1];if(e){const r=a[a.length-1],n=o?{x:(h+e)/2,y:(null==r?void 0:r.y)||d}:{x:(null==r?void 0:r.x)||t,y:(h+e)/2};r&&!i(r,n)||a.push(n)}}}}return a})(null===(i=t.data.points)||void 0===i?void 0:i.map((({x:t,y:e})=>({x:t+S[0],y:e+S[1]}))),b.getNode(t.source),b.getNode(t.target),r,z,n,o))}))}let R=[];R=b.getAllNodes().map((t=>Jt(t)));const I=b.getAllEdges();return e&&(R.forEach((t=>{r.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})})),I.forEach((t=>{r.mergeEdgeData(t.id,{controlPoints:t.data.controlPoints})}))),{nodes:R,edges:I}}))}},comboCombined:class{constructor(t={}){this.options=t,this.id="comboCombined",this.options=Object.assign(Object.assign({},dr),t)}execute(e,r){return t(this,void 0,void 0,(function*(){return this.genericComboCombinedLayout(!1,e,r)}))}assign(e,r){return t(this,void 0,void 0,(function*(){yield this.genericComboCombinedLayout(!0,e,r)}))}genericComboCombinedLayout(e,r,n){return t(this,void 0,void 0,(function*(){const t=this.initVals(Object.assign(Object.assign({},this.options),n)),{center:o,treeKey:i,outerLayout:s}=t,a=r.getAllNodes().filter((t=>!t.data._isCombo)),d=r.getAllNodes().filter((t=>t.data._isCombo)),h=r.getAllEdges(),c=null==a?void 0:a.length;if(!c||1===c)return Qt(r,e,o);const l=[],f=new Map;a.forEach((t=>{f.set(t.id,t)}));const g=new Map;d.forEach((t=>{g.set(t.id,t)}));const p=new Map,v=this.getInnerGraphs(r,i,f,g,h,t,p);yield Promise.all(v);const y=new Map,m=[],w=new Map;let x=!0;r.getRoots(i).forEach((t=>{const e=p.get(t.id),n=g.get(t.id)||f.get(t.id),o={id:t.id,data:Object.assign(Object.assign({},t.data),{x:e.data.x||n.data.x,y:e.data.y||n.data.y,fx:e.data.fx||n.data.fx,fy:e.data.fy||n.data.fy,mass:e.data.mass||n.data.mass,size:e.data.size})};m.push(o),y.set(t.id,!0),isNaN(o.data.x)||0===o.data.x||isNaN(o.data.y)||0===o.data.y?(o.data.x=100*Math.random(),o.data.y=100*Math.random()):x=!1,rr(r,[t],(e=>{e.id!==t.id&&w.set(e.id,t.id)}),"TB",i)}));const b=[];let E;if(h.forEach((t=>{const e=w.get(t.source)||t.source,r=w.get(t.target)||t.target;e!==r&&y.has(e)&&y.has(r)&&b.push({id:t.id,source:e,target:r,data:{}})})),null==m?void 0:m.length){if(1===m.length)m[0].data.x=o[0],m[0].data.y=o[1];else{const t=new u({nodes:m,edges:b}),e=s||new Me;if(x&&ur[e.id]){const e=m.length<100?new or:new oe;yield e.assign(t)}const r=Object.assign({center:o,kg:5,preventOverlap:!0,animate:!1},"force"===e.id?{gravity:1,factor:4,linkDistance:(t,e,r)=>(Math.max(...e.data.size)||32)/2+(Math.max(...r.data.size)||32)/2+200}:{});E=yield hr(e,t,r)}p.forEach((t=>{var e;const r=E.nodes.find((e=>e.id===t.id));if(r){const{x:e,y:n}=r.data;t.data.visited=!0,t.data.x=e,t.data.y=n,l.push({id:t.id,data:{x:e,y:n}})}const{x:n,y:o}=t.data;null===(e=t.data.nodes)||void 0===e||e.forEach((t=>{l.push({id:t.id,data:{x:t.data.x+n,y:t.data.y+o}})}))})),p.forEach((({data:t})=>{const{x:e,y:r,visited:n,nodes:o}=t;null==o||o.forEach((t=>{if(!n){const n=l.find((e=>e.id===t.id));n.data.x+=e||0,n.data.y+=r||0}}))}))}return e&&l.forEach((t=>{r.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})})),{nodes:l,edges:h}}))}initVals(t){const e=Object.assign({},t),{nodeSize:r,spacing:n,comboPadding:o}=t;let i,s,a;if(s=c(n)?()=>n:$t(n)?n:()=>0,e.spacing=s,r)if($t(r))i=t=>{const e=r(t),n=s(t);return re(t.size)?((t.size[0]>t.size[1]?t.size[0]:t.size[1])+n)/2:((e||32)+n)/2};else if(re(r)){const t=(r[0]>r[1]?r[0]:r[1])/2;i=e=>t+s(e)/2}else{const t=r/2;i=e=>t+s(e)/2}else i=t=>{const e=s(t);return t.size?re(t.size)?((t.size[0]>t.size[1]?t.size[0]:t.size[1])+e)/2:Gt(t.size)?((t.size.width>t.size.height?t.size.width:t.size.height)+e)/2:(t.size+e)/2:32+e/2};return e.nodeSize=i,a=c(o)?()=>o:re(o)?()=>Math.max.apply(null,o):$t(o)?o:()=>0,e.comboPadding=a,e}getInnerGraphs(e,r,n,o,i,s,a){const{nodeSize:d,comboPadding:h,spacing:l,innerLayout:f}=s,g=f||new oe({}),p={center:[0,0],preventOverlap:!0,nodeSpacing:l},v=[],y=t=>{let e=(null==h?void 0:h(t))||10;return re(e)&&(e=Math.max(...e)),{size:e?[2*e,2*e]:[30,30],padding:e}};return e.getRoots(r).forEach((s=>{a.set(s.id,{id:s.id,data:{nodes:[],size:y(s).size}});let h=Promise.resolve();rr(e,[s],(s=>{var l;if(!s.data._isCombo)return;const{size:f,padding:v}=y(s);if(null===(l=e.getChildren(s.id,r))||void 0===l?void 0:l.length){const l=a.get(s.id);a.set(s.id,{id:s.id,data:Object.assign({nodes:[]},null==l?void 0:l.data)});const f=new Map,y=e.getChildren(s.id,r).map((t=>{if(t.data._isCombo)return a.has(t.id)||a.set(t.id,{id:t.id,data:Object.assign({},t.data)}),f.set(t.id,!0),a.get(t.id);const e=n.get(t.id)||o.get(t.id);return f.set(t.id,!0),{id:t.id,data:Object.assign(Object.assign({},e.data),t.data)}})),m={nodes:y,edges:i.filter((t=>f.has(t.source)&&f.has(t.target)))};let w=1/0;y.forEach((t=>{var e;let{size:r}=t.data;r||(r=(null===(e=a.get(t.id))||void 0===e?void 0:e.data.size)||(null==d?void 0:d(t))||[30,30]),c(r)&&(r=[r,r]);const[n,o]=r;w>n&&(w=n),w>o&&(w=o),t.data.size=r})),h=h.then((()=>t(this,void 0,void 0,(function*(){const t=new u(m);yield hr(g,t,p,!0);const{minX:e,minY:r,maxX:n,maxY:o}=(t=>{let e=1/0,r=1/0,n=-1/0,o=-1/0;return t.forEach((t=>{let i=t.data.size;re(i)?1===i.length&&(i=[i[0],i[0]]):c(i)?i=[i,i]:(void 0===i||isNaN(i))&&(i=[30,30]);const s=[i[0]/2,i[1]/2],a=t.data.x-s[0],u=t.data.x+s[0],d=t.data.y-s[1],h=t.data.y+s[1];e>a&&(e=a),r>d&&(r=d),n<u&&(n=u),o<h&&(o=h)})),{minX:e,minY:r,maxX:n,maxY:o}})(y),i=(n+e)/2,d=(o+r)/2;m.nodes.forEach((t=>{t.data.x-=i,t.data.y-=d}));const h=[Math.max(n-e,w)+2*v,Math.max(o-r,w)+2*v];a.get(s.id).data.size=h,a.get(s.id).data.nodes=y}))))}else a.set(s.id,{id:s.id,data:Object.assign(Object.assign({},s.data),{size:f})});return!0}),"BT",r),v.push(h)})),v}}};let to;function eo(){(null==to?void 0:to.stop)&&to.stop()}function ro(e,r){return t(this,void 0,void 0,(function*(){const{layout:{id:t,options:n,iterations:o},nodes:i,edges:s}=e,a=new u({nodes:i,edges:s}),d=Zn[t];if(!d)throw new Error(`Unknown layout id: ${t}`);to=new d(n);let h=yield to.execute(a);return ar(to)&&(to.stop(),h=to.tick(o)),[h,r]}))}addEventListener("message",(function(t){var e,r=t.data,o=r.type,i=r.method,s=r.id,a=r.params;"RPC"===o&&i&&((e=n[i])?Promise.resolve().then((function(){return e.apply(n,a)})):Promise.reject("No such method")).then((function(t){postMessage({type:"RPC",id:s,result:t})})).catch((function(t){var e={message:t};t.stack&&(e.message=t.message,e.stack=t.stack,e.name=t.name),postMessage({type:"RPC",id:s,error:e})}))})),postMessage({type:"RPC",method:"ready"})})()})();\n//# sourceMappingURL=e2b4e534ff10c7df8b27.worker.js.map']))),n(t,o),t}},8331:t=>{t.exports=function(t,e){var r=0,n={};t.addEventListener("message",(function(e){var r=e.data;if("RPC"===r.type)if(r.id){var o=n[r.id];o&&(delete n[r.id],r.error?o[1](Object.assign(Error(r.error.message),r.error)):o[0](r.result))}else{var i=document.createEvent("Event");i.initEvent(r.method,!1,!1),i.data=r.params,t.dispatchEvent(i)}})),e.forEach((function(e){t[e]=function(){var o=arguments;return new Promise((function(i,s){var a=++r;n[a]=[i,s],t.postMessage({type:"RPC",id:a,method:e,params:[].slice.call(o)})}))}}))}}},e={};function r(n){var o=e[n];if(void 0!==o)return o.exports;var i=e[n]={id:n,loaded:!1,exports:{}};return t[n](i,i.exports,r),i.loaded=!0,i.exports}r.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return r.d(e,{a:e}),e},r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.nmd=t=>(t.paths=[],t.children||(t.children=[]),t);var n={};return(()=>{"use strict";function t(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(r[n[o]]=t[n[o]])}return r}function e(t,e,r,n){return new(r||(r=Promise))((function(o,i){function s(t){try{u(n.next(t))}catch(t){i(t)}}function a(t){try{u(n.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))}r.r(n),r.d(n,{AntVDagreLayout:()=>ne,CircularLayout:()=>ae,ComboCombinedLayout:()=>br,ConcentricLayout:()=>fe,D3Force3DLayout:()=>Un,D3ForceLayout:()=>pn,DagreLayout:()=>Kn,ForceAtlas2Layout:()=>Zn,ForceLayout:()=>Pe,FruchtermanLayout:()=>eo,GridLayout:()=>no,MDSLayout:()=>pr,RadialLayout:()=>po,RandomLayout:()=>Eo,Supervisor:()=>u,clone:()=>te,cloneFormatData:()=>ee,floydWarshall:()=>ur,formatNodeSizeToNumber:()=>Zt,formatNumberFn:()=>Xt,formatSizeFn:()=>Qt,getAdjMatrix:()=>dr,getEuclideanDistance:()=>lr,getLayoutBBox:()=>cr,graphTreeDfs:()=>fr,isArray:()=>ce,isLayoutWithIterations:()=>mr,registry:()=>No,scaleMatrix:()=>hr}),Object.create,Object.create;var o=function(){function t(){this._events={}}return t.prototype.on=function(t,e,r){return this._events[t]||(this._events[t]=[]),this._events[t].push({callback:e,once:!!r}),this},t.prototype.once=function(t,e){return this.on(t,e,!0)},t.prototype.emit=function(t){for(var e=this,r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];var o=this._events[t]||[],i=this._events["*"]||[],s=function(n){for(var o=n.length,i=0;i<o;i++)if(n[i]){var s=n[i],a=s.callback;s.once&&(n.splice(i,1),0===n.length&&delete e._events[t],o--,i--),a.apply(e,r)}};s(o),s(i)},t.prototype.off=function(t,e){if(t)if(e){for(var r=this._events[t]||[],n=r.length,o=0;o<n;o++)r[o].callback===e&&(r.splice(o,1),n--,o--);0===r.length&&delete this._events[t]}else delete this._events[t];else this._events={};return this},t.prototype.getEvents=function(){return this._events},t}();const i=o;var s=r(3795),a=r.n(s);class u extends i{constructor(t,e,r){super(),this.graph=t,this.layout=e,this.options=r,this.spawnWorker()}spawnWorker(){this.worker&&this.worker.terminate(),this.worker=a()(),this.running&&(this.running=!1,this.execute())}execute(){var r;return e(this,void 0,void 0,(function*(){if(this.running)return this;this.running=!0;const e=this.layout.options,{onTick:n}=e,o=t(e,["onTick"]),i={layout:{id:this.layout.id,options:o,iterations:null===(r=this.options)||void 0===r?void 0:r.iterations},nodes:this.graph.getAllNodes(),edges:this.graph.getAllEdges()},s=new Float32Array([0]),[a]=yield this.worker.calculateLayout(i,[s]);return a}))}stop(){return this.running=!1,this.worker.stopLayout(),this}kill(){this.worker&&this.worker.terminate()}isRunning(){return this.running}}function d(t,e,r,n){for(;t.length;){const o=t.shift();if(r(o))return!0;e.add(o.id),n(o.id).forEach((r=>{e.has(r.id)||(e.add(r.id),t.push(r))}))}return!1}function h(t,e,r,n){if(r(t))return!0;e.add(t.id);for(const o of n(t.id))if(!e.has(o.id)&&h(o,e,r,n))return!0;return!1}const c=()=>!0;class l{graph;nodeFilter;edgeFilter;cacheEnabled;inEdgesMap=new Map;outEdgesMap=new Map;bothEdgesMap=new Map;allNodesMap=new Map;allEdgesMap=new Map;constructor(t){this.graph=t.graph;const e=t.nodeFilter||c,r=t.edgeFilter||c;this.nodeFilter=e,this.edgeFilter=t=>{const{source:n,target:o}=this.graph.getEdgeDetail(t.id);return!(!e(n)||!e(o))&&r(t,n,o)},"auto"===t.cache?(this.cacheEnabled=!0,this.startAutoCache()):"manual"===t.cache?this.cacheEnabled=!0:this.cacheEnabled=!1}clearCache=()=>{this.inEdgesMap.clear(),this.outEdgesMap.clear(),this.bothEdgesMap.clear(),this.allNodesMap.clear(),this.allEdgesMap.clear()};refreshCache=()=>{this.clearCache(),this.updateCache(this.graph.getAllNodes().map((t=>t.id)))};updateCache=t=>{const e=new Set;t.forEach((t=>{const r=this.bothEdgesMap.get(t);if(r&&r.forEach((t=>e.add(t.id))),this.hasNode(t)){const r=this.graph.getRelatedEdges(t,"in").filter(this.edgeFilter),n=this.graph.getRelatedEdges(t,"out").filter(this.edgeFilter),o=Array.from(new Set([...r,...n]));o.forEach((t=>e.add(t.id))),this.inEdgesMap.set(t,r),this.outEdgesMap.set(t,n),this.bothEdgesMap.set(t,o),this.allNodesMap.set(t,this.graph.getNode(t))}else this.inEdgesMap.delete(t),this.outEdgesMap.delete(t),this.bothEdgesMap.delete(t),this.allNodesMap.delete(t)})),e.forEach((t=>{this.hasEdge(t)?this.allEdgesMap.set(t,this.graph.getEdge(t)):this.allEdgesMap.delete(t)}))};startAutoCache(){this.refreshCache(),this.graph.on("changed",this.handleGraphChanged)}stopAutoCache(){this.graph.off("changed",this.handleGraphChanged)}handleGraphChanged=t=>{const e=new Set;t.changes.forEach((r=>{switch(r.type){case"NodeAdded":case"NodeRemoved":e.add(r.value.id);break;case"NodeDataUpdated":e.add(r.id);break;case"EdgeAdded":case"EdgeRemoved":e.add(r.value.source),e.add(r.value.target);break;case"EdgeUpdated":"source"!==r.propertyName&&"target"!==r.propertyName||(e.add(r.oldValue),e.add(r.newValue));break;case"EdgeDataUpdated":if(t.graph.hasEdge(r.id)){const n=t.graph.getEdge(r.id);e.add(n.source),e.add(n.target)}}})),this.updateCache(e)};checkNodeExistence(t){this.getNode(t)}hasNode(t){if(!this.graph.hasNode(t))return!1;const e=this.graph.getNode(t);return this.nodeFilter(e)}areNeighbors(t,e){return this.checkNodeExistence(t),this.getNeighbors(e).some((e=>e.id===t))}getNode(t){const e=this.graph.getNode(t);if(!this.nodeFilter(e))throw new Error("Node not found for id: "+t);return e}getRelatedEdges(t,e){return this.checkNodeExistence(t),this.cacheEnabled?"in"===e?this.inEdgesMap.get(t):"out"===e?this.outEdgesMap.get(t):this.bothEdgesMap.get(t):this.graph.getRelatedEdges(t,e).filter(this.edgeFilter)}getDegree(t,e){return this.getRelatedEdges(t,e).length}getSuccessors(t){const e=this.getRelatedEdges(t,"out").map((t=>this.getNode(t.target)));return Array.from(new Set(e))}getPredecessors(t){const e=this.getRelatedEdges(t,"in").map((t=>this.getNode(t.source)));return Array.from(new Set(e))}getNeighbors(t){const e=this.getPredecessors(t),r=this.getSuccessors(t);return Array.from(new Set([...e,...r]))}hasEdge(t){if(!this.graph.hasEdge(t))return!1;const e=this.graph.getEdge(t);return this.edgeFilter(e)}getEdge(t){const e=this.graph.getEdge(t);if(!this.edgeFilter(e))throw new Error("Edge not found for id: "+t);return e}getEdgeDetail(t){const e=this.getEdge(t);return{edge:e,source:this.getNode(e.source),target:this.getNode(e.target)}}hasTreeStructure(t){return this.graph.hasTreeStructure(t)}getRoots(t){return this.graph.getRoots(t).filter(this.nodeFilter)}getChildren(t,e){return this.checkNodeExistence(t),this.graph.getChildren(t,e).filter(this.nodeFilter)}getParent(t,e){this.checkNodeExistence(t);const r=this.graph.getParent(t,e);return r&&this.nodeFilter(r)?r:null}getAllNodes(){return this.cacheEnabled?Array.from(this.allNodesMap.values()):this.graph.getAllNodes().filter(this.nodeFilter)}getAllEdges(){return this.cacheEnabled?Array.from(this.allEdgesMap.values()):this.graph.getAllEdges().filter(this.edgeFilter)}bfs(t,e,r="out"){const n={in:this.getPredecessors.bind(this),out:this.getSuccessors.bind(this),both:this.getNeighbors.bind(this)}[r];d([this.getNode(t)],new Set,e,n)}dfs(t,e,r="out"){const n={in:this.getPredecessors.bind(this),out:this.getSuccessors.bind(this),both:this.getNeighbors.bind(this)}[r];h(this.getNode(t),new Set,e,n)}}class f extends i{nodeMap=new Map;edgeMap=new Map;inEdgesMap=new Map;outEdgesMap=new Map;bothEdgesMap=new Map;treeIndices=new Map;changes=[];batchCount=0;onChanged=()=>{};constructor(t){super(),t&&(t.nodes&&this.addNodes(t.nodes),t.edges&&this.addEdges(t.edges),t.tree&&this.addTree(t.tree),t.onChanged&&(this.onChanged=t.onChanged))}batch=t=>{this.batchCount+=1,t(),this.batchCount-=1,this.batchCount||this.commit()};commit(){const t=this.changes;this.changes=[];const e={graph:this,changes:t};this.emit("changed",e),this.onChanged(e)}reduceChanges(t){let e=[];return t.forEach((t=>{switch(t.type){case"NodeRemoved":{let r=!1;e=e.filter((e=>{if("NodeAdded"===e.type){const n=e.value.id===t.value.id;return n&&(r=!0),!n}return"NodeDataUpdated"===e.type?e.id!==t.value.id:"TreeStructureChanged"!==e.type||e.nodeId!==t.value.id})),r||e.push(t);break}case"EdgeRemoved":{let r=!1;e=e.filter((e=>{if("EdgeAdded"===e.type){const n=e.value.id===t.value.id;return n&&(r=!0),!n}return"EdgeDataUpdated"!==e.type&&"EdgeUpdated"!==e.type||e.id!==t.value.id})),r||e.push(t);break}case"NodeDataUpdated":case"EdgeDataUpdated":case"EdgeUpdated":{const r=e.findIndex((e=>e.type===t.type&&e.id===t.id&&(void 0===t.propertyName||e.propertyName===t.propertyName))),n=e[r];n?void 0!==t.propertyName?n.newValue=t.newValue:(e.splice(r,1),e.push(t)):e.push(t);break}case"TreeStructureDetached":e=e.filter((e=>"TreeStructureAttached"===e.type?e.treeKey!==t.treeKey:"TreeStructureChanged"!==e.type||e.treeKey!==t.treeKey)),e.push(t);break;case"TreeStructureChanged":{const r=e.find((e=>"TreeStructureChanged"===e.type&&e.treeKey===t.treeKey&&e.nodeId===t.nodeId));r?r.newParentId=t.newParentId:e.push(t);break}default:e.push(t)}})),e}checkNodeExistence(t){this.getNode(t)}hasNode(t){return this.nodeMap.has(t)}areNeighbors(t,e){return this.getNeighbors(e).some((e=>e.id===t))}getNode(t){const e=this.nodeMap.get(t);if(!e)throw new Error("Node not found for id: "+t);return e}getRelatedEdges(t,e){if(this.checkNodeExistence(t),"in"===e){const e=this.inEdgesMap.get(t);return Array.from(e)}if("out"===e){const e=this.outEdgesMap.get(t);return Array.from(e)}{const e=this.bothEdgesMap.get(t);return Array.from(e)}}getDegree(t,e){return this.getRelatedEdges(t,e).length}getSuccessors(t){const e=this.getRelatedEdges(t,"out").map((t=>this.getNode(t.target)));return Array.from(new Set(e))}getPredecessors(t){const e=this.getRelatedEdges(t,"in").map((t=>this.getNode(t.source)));return Array.from(new Set(e))}getNeighbors(t){const e=this.getPredecessors(t),r=this.getSuccessors(t);return Array.from(new Set([...e,...r]))}doAddNode(t){if(this.hasNode(t.id))throw new Error("Node already exists: "+t.id);this.nodeMap.set(t.id,t),this.inEdgesMap.set(t.id,new Set),this.outEdgesMap.set(t.id,new Set),this.bothEdgesMap.set(t.id,new Set),this.treeIndices.forEach((e=>{e.childrenMap.set(t.id,new Set)})),this.changes.push({type:"NodeAdded",value:t})}addNodes(t){this.batch((()=>{for(const e of t)this.doAddNode(e)}))}addNode(t){this.addNodes([t])}doRemoveNode(t){const e=this.getNode(t),r=this.bothEdgesMap.get(t);r?.forEach((t=>this.doRemoveEdge(t.id))),this.nodeMap.delete(t),this.treeIndices.forEach((r=>{r.childrenMap.get(t)?.forEach((t=>{r.parentMap.delete(t.id)}));const n=r.parentMap.get(t);n&&r.childrenMap.get(n.id)?.delete(e),r.parentMap.delete(t),r.childrenMap.delete(t)})),this.bothEdgesMap.delete(t),this.inEdgesMap.delete(t),this.outEdgesMap.delete(t),this.changes.push({type:"NodeRemoved",value:e})}removeNodes(t){this.batch((()=>{t.forEach((t=>this.doRemoveNode(t)))}))}removeNode(t){this.removeNodes([t])}updateNodeDataProperty(t,e,r){const n=this.getNode(t);this.batch((()=>{const o=n.data[e],i=r;n.data[e]=i,this.changes.push({type:"NodeDataUpdated",id:t,propertyName:e,oldValue:o,newValue:i})}))}mergeNodeData(t,e){this.batch((()=>{Object.entries(e).forEach((([e,r])=>{this.updateNodeDataProperty(t,e,r)}))}))}updateNodeData(...t){const e=t[0],r=this.getNode(e);if("string"==typeof t[1])return void this.updateNodeDataProperty(e,t[1],t[2]);let n;if("function"==typeof t[1]){const e=t[1];n=e(r.data)}else"object"==typeof t[1]&&(n=t[1]);this.batch((()=>{const t=r.data,o=n;r.data=n,this.changes.push({type:"NodeDataUpdated",id:e,oldValue:t,newValue:o})}))}checkEdgeExistence(t){if(!this.hasEdge(t))throw new Error("Edge not found for id: "+t)}hasEdge(t){return this.edgeMap.has(t)}getEdge(t){return this.checkEdgeExistence(t),this.edgeMap.get(t)}getEdgeDetail(t){const e=this.getEdge(t);return{edge:e,source:this.getNode(e.source),target:this.getNode(e.target)}}doAddEdge(t){if(this.hasEdge(t.id))throw new Error("Edge already exists: "+t.id);this.checkNodeExistence(t.source),this.checkNodeExistence(t.target),this.edgeMap.set(t.id,t);const e=this.inEdgesMap.get(t.target),r=this.outEdgesMap.get(t.source),n=this.bothEdgesMap.get(t.source),o=this.bothEdgesMap.get(t.target);e.add(t),r.add(t),n.add(t),o.add(t),this.changes.push({type:"EdgeAdded",value:t})}addEdges(t){this.batch((()=>{for(const e of t)this.doAddEdge(e)}))}addEdge(t){this.addEdges([t])}doRemoveEdge(t){const e=this.getEdge(t),r=this.outEdgesMap.get(e.source),n=this.inEdgesMap.get(e.target),o=this.bothEdgesMap.get(e.source),i=this.bothEdgesMap.get(e.target);r.delete(e),n.delete(e),o.delete(e),i.delete(e),this.edgeMap.delete(t),this.changes.push({type:"EdgeRemoved",value:e})}removeEdges(t){this.batch((()=>{t.forEach((t=>this.doRemoveEdge(t)))}))}removeEdge(t){this.removeEdges([t])}updateEdgeSource(t,e){const r=this.getEdge(t);this.checkNodeExistence(e);const n=r.source,o=e;this.outEdgesMap.get(n).delete(r),this.bothEdgesMap.get(n).delete(r),this.outEdgesMap.get(o).add(r),this.bothEdgesMap.get(o).add(r),r.source=e,this.batch((()=>{this.changes.push({type:"EdgeUpdated",id:t,propertyName:"source",oldValue:n,newValue:o})}))}updateEdgeTarget(t,e){const r=this.getEdge(t);this.checkNodeExistence(e);const n=r.target,o=e;this.inEdgesMap.get(n).delete(r),this.bothEdgesMap.get(n).delete(r),this.inEdgesMap.get(o).add(r),this.bothEdgesMap.get(o).add(r),r.target=e,this.batch((()=>{this.changes.push({type:"EdgeUpdated",id:t,propertyName:"target",oldValue:n,newValue:o})}))}updateEdgeDataProperty(t,e,r){const n=this.getEdge(t);this.batch((()=>{const o=n.data[e],i=r;n.data[e]=i,this.changes.push({type:"EdgeDataUpdated",id:t,propertyName:e,oldValue:o,newValue:i})}))}updateEdgeData(...t){const e=t[0],r=this.getEdge(e);if("string"==typeof t[1])return void this.updateEdgeDataProperty(e,t[1],t[2]);let n;if("function"==typeof t[1]){const e=t[1];n=e(r.data)}else"object"==typeof t[1]&&(n=t[1]);this.batch((()=>{const t=r.data,o=n;r.data=n,this.changes.push({type:"EdgeDataUpdated",id:e,oldValue:t,newValue:o})}))}mergeEdgeData(t,e){this.batch((()=>{Object.entries(e).forEach((([e,r])=>{this.updateEdgeDataProperty(t,e,r)}))}))}checkTreeExistence(t){if(!this.hasTreeStructure(t))throw new Error("Tree structure not found for treeKey: "+t)}hasTreeStructure(t){return this.treeIndices.has(t)}attachTreeStructure(t){this.treeIndices.has(t)||(this.treeIndices.set(t,{parentMap:new Map,childrenMap:new Map}),this.batch((()=>{this.changes.push({type:"TreeStructureAttached",treeKey:t})})))}detachTreeStructure(t){this.checkTreeExistence(t),this.treeIndices.delete(t),this.batch((()=>{this.changes.push({type:"TreeStructureDetached",treeKey:t})}))}addTree(t,e){this.batch((()=>{this.attachTreeStructure(e);const r=[],n=Array.isArray(t)?t:[t];for(;n.length;){const t=n.shift();r.push(t),t.children&&n.push(...t.children)}this.addNodes(r),r.forEach((t=>{t.children?.forEach((r=>{this.setParent(r.id,t.id,e)}))}))}))}getRoots(t){return this.checkTreeExistence(t),this.getAllNodes().filter((e=>!this.getParent(e.id,t)))}getChildren(t,e){this.checkNodeExistence(t),this.checkTreeExistence(e);const r=this.treeIndices.get(e).childrenMap.get(t);return Array.from(r||[])}getParent(t,e){return this.checkNodeExistence(t),this.checkTreeExistence(e),this.treeIndices.get(e).parentMap.get(t)||null}getAncestors(t,e){const r=[];let n,o=this.getNode(t);for(;n=this.getParent(o.id,e);)r.push(n),o=n;return r}setParent(t,e,r){this.checkTreeExistence(r);const n=this.treeIndices.get(r),o=this.getNode(t),i=n.parentMap.get(t);if(i?.id===e)return;if(void 0===e)return i&&n.childrenMap.get(i.id)?.delete(o),void n.parentMap.delete(t);const s=this.getNode(e);n.parentMap.set(t,s),i&&n.childrenMap.get(i.id)?.delete(o);let a=n.childrenMap.get(s.id);a||(a=new Set,n.childrenMap.set(s.id,a)),a.add(o),this.batch((()=>{this.changes.push({type:"TreeStructureChanged",treeKey:r,nodeId:t,oldParentId:i?.id,newParentId:s.id})}))}dfsTree(t,e,r){return h(this.getNode(t),new Set,e,(t=>this.getChildren(t,r)))}bfsTree(t,e,r){return d([this.getNode(t)],new Set,e,(t=>this.getChildren(t,r)))}getAllNodes(){return Array.from(this.nodeMap.values())}getAllEdges(){return Array.from(this.edgeMap.values())}bfs(t,e,r="out"){const n={in:this.getPredecessors.bind(this),out:this.getSuccessors.bind(this),both:this.getNeighbors.bind(this)}[r];return d([this.getNode(t)],new Set,e,n)}dfs(t,e,r="out"){const n={in:this.getPredecessors.bind(this),out:this.getSuccessors.bind(this),both:this.getNeighbors.bind(this)}[r];return h(this.getNode(t),new Set,e,n)}clone(){const t=this.getAllNodes().map((t=>({...t,data:{...t.data}}))),e=this.getAllEdges().map((t=>({...t,data:{...t.data}}))),r=new f({nodes:t,edges:e});return this.treeIndices.forEach((({parentMap:t,childrenMap:e},n)=>{const o=new Map;t.forEach(((t,e)=>{o.set(e,r.getNode(t.id))}));const i=new Map;e.forEach(((t,e)=>{i.set(e,new Set(Array.from(t).map((t=>r.getNode(t.id)))))})),r.treeIndices.set(n,{parentMap:o,childrenMap:i})})),r}toJSON(){return JSON.stringify({nodes:this.getAllNodes(),edges:this.getAllEdges()})}createView(t){return new l({graph:this,...t})}}var g={}.toString;const p=function(t,e){return g.call(t)==="[object "+e+"]"},v=function(t){return p(t,"Number")},y=(t,e)=>{if("next"!==t&&"prev"!==t)return e},m=t=>{t.prev.next=t.next,t.next.prev=t.prev,delete t.next,delete t.prev};class w{constructor(){const t={};t.prev=t,t.next=t.prev,this.shortcut=t}dequeue(){const t=this.shortcut,e=t.prev;if(e&&e!==t)return m(e),e}enqueue(t){const e=this.shortcut;t.prev&&t.next&&m(t),t.next=e.next,e.next.prev=t,e.next=t,t.prev=e}toString(){const t=[],e=this.shortcut;let r=e.prev;for(;r!==e;)t.push(JSON.stringify(r,y)),r=null==r?void 0:r.prev;return`[${t.join(", ")}]`}}class x extends w{}const b=()=>1,E=(t,e,r,n,o)=>{var i,s;const a=[];return t.hasNode(n.v)&&(null===(i=t.getRelatedEdges(n.v,"in"))||void 0===i||i.forEach((n=>{const i=n.data.weight,s=t.getNode(n.source);o&&a.push({v:n.source,w:n.target,in:0,out:0}),void 0===s.data.out&&(s.data.out=0),s.data.out-=i,N(e,r,Object.assign({v:s.id},s.data))})),null===(s=t.getRelatedEdges(n.v,"out"))||void 0===s||s.forEach((n=>{const o=n.data.weight,i=n.target,s=t.getNode(i);void 0===s.data.in&&(s.data.in=0),s.data.in-=o,N(e,r,Object.assign({v:s.id},s.data))})),t.removeNode(n.v)),o?a:void 0},N=(t,e,r)=>{r.out?r.in?t[r.out-r.in+e].enqueue(r):t[t.length-1].enqueue(r):t[0].enqueue(r)},_=(t,e)=>{const r="greedy"===e?(t=>{var e;if(t.getAllNodes().length<=1)return[];const r=((t,e)=>{const r=new f;let n=0,o=0;t.getAllNodes().forEach((t=>{r.addNode({id:t.id,data:{v:t.id,in:0,out:0}})})),t.getAllEdges().forEach((t=>{const i=r.getRelatedEdges(t.source,"out").find((e=>e.target===t.target)),s=(null==e?void 0:e(t))||1;i?r.updateEdgeData(null==i?void 0:i.id,Object.assign(Object.assign({},i.data),{weight:i.data.weight+s})):r.addEdge({id:t.id,source:t.source,target:t.target,data:{weight:s}}),o=Math.max(o,r.getNode(t.source).data.out+=s),n=Math.max(n,r.getNode(t.target).data.in+=s)}));const i=[],s=o+n+3;for(let t=0;t<s;t++)i.push(new x);const a=n+1;return r.getAllNodes().forEach((t=>{N(i,a,Object.assign({v:t.id},r.getNode(t.id).data))})),{buckets:i,zeroIdx:a,graph:r}})(t,(t=>t.data.weight||1)||b);return null===(e=((t,e,r)=>{let n=[];const o=e[e.length-1],i=e[0];let s;for(;t.getAllNodes().length;){for(;s=i.dequeue();)E(t,e,r,s);for(;s=o.dequeue();)E(t,e,r,s);if(t.getAllNodes().length)for(let o=e.length-2;o>0;--o)if(s=e[o].dequeue(),s){n=n.concat(E(t,e,r,s,!0));break}}return n})(r.graph,r.buckets,r.zeroIdx).map((e=>t.getRelatedEdges(e.v,"out").filter((({target:t})=>t===e.w)))))||void 0===e?void 0:e.flat()})(t):M(t);null==r||r.forEach((e=>{const r=e.data;t.removeEdge(e.id),r.forwardName=e.data.name,r.reversed=!0,t.addEdge({id:e.id,source:e.target,target:e.source,data:Object.assign({},r)})}))},M=t=>{const e=[],r={},n={},o=i=>{n[i]||(n[i]=!0,r[i]=!0,t.getRelatedEdges(i,"out").forEach((t=>{r[t.target]?e.push(t):o(t.target)})),delete r[i])};return t.getAllNodes().forEach((t=>o(t.id))),e},k=(t,e,r,n)=>{let o;do{o=`${n}${Math.random()}`}while(t.hasNode(o));return r.dummy=e,t.addNode({id:o,data:r}),o},A=t=>{const e=new f;return t.getAllNodes().forEach((r=>{t.getChildren(r.id).length||e.addNode(Object.assign({},r))})),t.getAllEdges().forEach((t=>{e.addEdge(t)})),e},j=(t,e)=>{const r=Number(t.x),n=Number(t.y),o=Number(e.x)-r,i=Number(e.y)-n;let s,a,u=Number(t.width)/2,d=Number(t.height)/2;return o||i?(Math.abs(i)*u>Math.abs(o)*d?(i<0&&(d=-d),s=d*o/i,a=d):(o<0&&(u=-u),s=u,a=u*i/o),{x:r+s,y:n+a}):{x:0,y:0}},O=t=>{const e=[],r=z(t)+1;for(let t=0;t<r;t++)e.push([]);t.getAllNodes().forEach((t=>{const r=t.data.rank;void 0!==r&&e[r]&&e[r].push(t.id)}));for(let n=0;n<r;n++)e[n]=e[n].sort(((e,r)=>{return n=t.getNode(e).data.order,o=t.getNode(r).data.order,Number(n)-Number(o);var n,o}));return e},S=(t,e,r,n)=>{const o={width:0,height:0};return v(r)&&v(n)&&(o.rank=r,o.order=n),k(t,"border",o,e)},z=t=>{let e;return t.getAllNodes().forEach((t=>{const r=t.data.rank;void 0!==r&&(void 0===e||r>e)&&(e=r)})),e||(e=0),e},R=(t,e)=>t.reduce(((t,r)=>e(t)>e(r)?r:t)),I=(t,e,r,n,o,i)=>{n.includes(e.id)||(n.push(e.id),r||i.push(e.id),o(e.id).forEach((e=>I(t,e,r,n,o,i))),r&&i.push(e.id))},P=(t,e,r,n)=>{const o=Array.isArray(e)?e:[e],i=e=>n?t.getSuccessors(e):t.getNeighbors(e),s=[],a=[];return o.forEach((e=>{if(!t.hasNode(e.id))throw new Error(`Graph does not have node: ${e}`);I(t,e,"post"===r,a,i,s)})),s},C=(t,e,r,n,o,i)=>{const s={rank:i,borderType:e,width:0,height:0},a=o.data[e][i-1],u=k(t,"border",s,r);o.data[e][i]=u,t.setParent(u,n),a&&t.addEdge({id:`e${Math.random()}`,source:a,target:u,data:{weight:1}})},D=t=>{t.getAllNodes().forEach((t=>{T(t)})),t.getAllEdges().forEach((t=>{T(t)}))},T=t=>{const e=t.data.width;t.data.width=t.data.height,t.data.height=e},L=t=>{(null==t?void 0:t.y)&&(t.y=-t.y)},F=t=>{const e=t.x;t.x=t.y,t.y=e},q=(t,e,r,n,o,i,s)=>{const a=t.getChildren(s);if(!(null==a?void 0:a.length))return void(s!==e&&t.addEdge({id:`e${Math.random()}`,source:e,target:s,data:{weight:0,minlen:r}}));const u=S(t,"_bt"),d=S(t,"_bb"),h=t.getNode(s);t.setParent(u,s),h.data.borderTop=u,t.setParent(d,s),h.data.borderBottom=d,null==a||a.forEach((a=>{q(t,e,r,n,o,i,a.id);const h=a.data.borderTop?a.data.borderTop:a.id,c=a.data.borderBottom?a.data.borderBottom:a.id,l=a.data.borderTop?n:2*n,f=h!==c?1:o-i[s]+1;t.addEdge({id:`e${Math.random()}`,source:u,target:h,data:{minlen:f,weight:l,nestingEdge:!0}}),t.addEdge({id:`e${Math.random()}`,source:c,target:d,data:{minlen:f,weight:l,nestingEdge:!0}})})),t.getParent(s)||t.addEdge({id:`e${Math.random()}`,source:e,target:u,data:{weight:0,minlen:o+i[s]}})},V="edge-label",B=function(t){return Array.isArray?Array.isArray(t):p(t,"Array")};var $=function(t){if("object"!=typeof t||null===t)return t;var e;if(B(t)){e=[];for(var r=0,n=t.length;r<n;r++)"object"==typeof t[r]&&null!=t[r]?e[r]=$(t[r]):e[r]=t[r]}else for(var o in e={},t)"object"==typeof t[o]&&null!=t[o]?e[o]=$(t[o]):e[o]=t[o];return e};const G=$,U=(t,e,r)=>{const n=(i=r,s=r.map(((t,e)=>e)),null==i?void 0:i.reduce(((t,e,r)=>(t[e]=s[r],t)),{})),o=e.map((e=>{const r=t.getRelatedEdges(e,"out").map((t=>({pos:n[t.target]||0,weight:t.data.weight})));return null==r?void 0:r.sort(((t,e)=>t.pos-e.pos))})).flat().filter((t=>void 0!==t));var i,s;let a=1;for(;a<r.length;)a<<=1;const u=2*a-1;a-=1;const d=Array(u).fill(0,0,u);let h=0;return null==o||o.forEach((t=>{if(t){let e=t.pos+a;d[e]+=t.weight;let r=0;for(;e>0;)e%2&&(r+=d[e+1]),e=e-1>>1,d[e]+=t.weight;h+=t.weight*r}})),h},W=(t,e)=>{let r=0;for(let n=1;n<(null==e?void 0:e.length);n+=1)r+=U(t,e[n-1],e[n]);return r},Y=t=>{const e={},r=t.getAllNodes(),n=r.map((t=>{var e;return null!==(e=t.data.rank)&&void 0!==e?e:-1/0})),o=Math.max(...n),i=[];for(let t=0;t<o+1;t++)i.push([]);const s=r.sort(((e,r)=>t.getNode(e.id).data.rank-t.getNode(r.id).data.rank)),a=s.filter((e=>void 0!==t.getNode(e.id).data.fixorder)).sort(((e,r)=>t.getNode(e.id).data.fixorder-t.getNode(r.id).data.fixorder));return null==a||a.forEach((r=>{isNaN(t.getNode(r.id).data.rank)||i[t.getNode(r.id).data.rank].push(r.id),e[r.id]=!0})),null==s||s.forEach((r=>t.dfsTree(r.id,(t=>{if(e.hasOwnProperty(t.id))return!0;e[t.id]=!0,isNaN(t.data.rank)||i[t.data.rank].push(t.id)})))),i},K=(t,e)=>{var r;let n=0,o=0;t.weight&&(n+=t.barycenter*t.weight,o+=t.weight),e.weight&&(n+=e.barycenter*e.weight,o+=e.weight),t.vs=null===(r=e.vs)||void 0===r?void 0:r.concat(t.vs),t.barycenter=n/o,t.weight=o,t.i=Math.min(e.i,t.i),e.merged=!0},J=(t,e)=>{var r,n,o;const i={};null==t||t.forEach(((t,e)=>{i[t.v]={i:e,indegree:0,in:[],out:[],vs:[t.v]};const r=i[t.v];void 0!==t.barycenter&&(r.barycenter=t.barycenter,r.weight=t.weight)})),null===(r=e.getAllEdges())||void 0===r||r.forEach((t=>{const e=i[t.source],r=i[t.target];void 0!==e&&void 0!==r&&(r.indegree++,e.out.push(i[t.target]))}));return(t=>{var e,r;const n=[];for(;null==t?void 0:t.length;){const o=t.pop();n.push(o),null===(e=o.in.reverse())||void 0===e||e.forEach((t=>{return(e=o,t=>{t.merged||(void 0===t.barycenter||void 0===e.barycenter||t.barycenter>=e.barycenter)&&K(e,t)})(t);var e})),null===(r=o.out)||void 0===r||r.forEach((e=>{return(r=o,e=>{e.in.push(r),0==--e.indegree&&t.push(e)})(e);var r}))}const o=n.filter((t=>!t.merged)),i=["vs","i","barycenter","weight"];return o.map((t=>{const e={};return null==i||i.forEach((r=>{void 0!==t[r]&&(e[r]=t[r])})),e}))})(null===(o=(n=Object.values(i)).filter)||void 0===o?void 0:o.call(n,(t=>!t.indegree)))},H=(t,e,r)=>{let n,o=r;for(;e.length&&(n=e[e.length-1]).i<=o;)e.pop(),null==t||t.push(n.vs),o++;return o},X=(t,e,r,n,o,i)=>{var s,a,u,d;let h=t.getChildren(e).map((t=>t.id));const c=t.getNode(e),l=c?c.data.borderLeft:void 0,f=c?c.data.borderRight:void 0,g={};l&&(h=null==h?void 0:h.filter((t=>t!==l&&t!==f)));const p=((t,e)=>e.map((e=>{const r=t.getRelatedEdges(e,"in");if(!(null==r?void 0:r.length))return{v:e};const n={sum:0,weight:0};return null==r||r.forEach((e=>{const r=t.getNode(e.source);n.sum+=e.data.weight*r.data.order,n.weight+=e.data.weight})),{v:e,barycenter:n.sum/n.weight,weight:n.weight}})))(t,h||[]);null==p||p.forEach((e=>{var o;if(null===(o=t.getChildren(e.v))||void 0===o?void 0:o.length){const o=X(t,e.v,r,n,i);g[e.v]=o,o.hasOwnProperty("barycenter")&&Z(e,o)}}));const v=J(p,r);Q(v,g),null===(s=v.filter((t=>t.vs.length>0)))||void 0===s||s.forEach((e=>{const r=t.getNode(e.vs[0]);r&&(e.fixorder=r.data.fixorder,e.order=r.data.order)}));const y=((t,e,r,n)=>{const o=(t=>{const e={lhs:[],rhs:[]};return null==t||t.forEach((t=>{(t=>{const e=t.hasOwnProperty("fixorder")&&!isNaN(t.fixorder);return n?!e&&t.hasOwnProperty("barycenter"):e||t.hasOwnProperty("barycenter")})(t)?e.lhs.push(t):e.rhs.push(t)})),e})(t),i=o.lhs,s=o.rhs.sort(((t,e)=>-t.i- -e.i)),a=[];let u=0,d=0,h=0;null==i||i.sort(((t,e)=>(r,n)=>{if(void 0!==r.fixorder&&void 0!==n.fixorder)return r.fixorder-n.fixorder;if(r.barycenter<n.barycenter)return-1;if(r.barycenter>n.barycenter)return 1;if(e&&void 0!==r.order&&void 0!==n.order){if(r.order<n.order)return-1;if(r.order>n.order)return 1}return t?n.i-r.i:r.i-n.i})(!!e,!!r)),h=H(a,s,h),null==i||i.forEach((t=>{var e;h+=null===(e=t.vs)||void 0===e?void 0:e.length,a.push(t.vs),u+=t.barycenter*t.weight,d+=t.weight,h=H(a,s,h)}));const c={vs:a.flat()};return d&&(c.barycenter=u/d,c.weight=d),c})(v,n,o,i);if(l&&(y.vs=[l,y.vs,f].flat(),null===(a=t.getPredecessors(l))||void 0===a?void 0:a.length)){const e=t.getNode((null===(u=t.getPredecessors(l))||void 0===u?void 0:u[0].id)||""),r=t.getNode((null===(d=t.getPredecessors(f))||void 0===d?void 0:d[0].id)||"");y.hasOwnProperty("barycenter")||(y.barycenter=0,y.weight=0),y.barycenter=(y.barycenter*y.weight+e.data.order+r.data.order)/(y.weight+2),y.weight+=2}return y},Q=(t,e)=>{null==t||t.forEach((t=>{var r;const n=null===(r=t.vs)||void 0===r?void 0:r.map((t=>e[t]?e[t].vs:t));t.vs=n.flat()}))},Z=(t,e)=>{void 0!==t.barycenter?(t.barycenter=(t.barycenter*t.weight+e.barycenter*e.weight)/(t.weight+e.weight),t.weight+=e.weight):(t.barycenter=e.barycenter,t.weight=e.weight)},tt=(t,e,r)=>e.map((e=>((t,e,r)=>{const n=(t=>{let e;for(;t.hasNode(e=`_root${Math.random()}`););return e})(t),o=new f({tree:[{id:n,children:[],data:{}}]});return t.getAllNodes().forEach((i=>{const s=t.getParent(i.id);(i.data.rank===e||i.data.minRank<=e&&e<=i.data.maxRank)&&(o.hasNode(i.id)||o.addNode(Object.assign({},i)),(null==s?void 0:s.id)&&!o.hasNode(null==s?void 0:s.id)&&o.addNode(Object.assign({},s)),o.setParent(i.id,(null==s?void 0:s.id)||n),t.getRelatedEdges(i.id,r).forEach((e=>{const r=e.source===i.id?e.target:e.source;o.hasNode(r)||o.addNode(Object.assign({},t.getNode(r)));const n=o.getRelatedEdges(r,"out").find((({target:t})=>t===i.id)),s=void 0!==n?n.data.weight:0;n?o.updateEdgeData(n.id,Object.assign(Object.assign({},n.data),{weight:e.data.weight+s})):o.addEdge({id:e.id,source:r,target:i.id,data:{weight:e.data.weight+s}})})),i.data.hasOwnProperty("minRank")&&o.updateNodeData(i.id,Object.assign(Object.assign({},i.data),{borderLeft:i.data.borderLeft[e],borderRight:i.data.borderRight[e]})))})),o})(t,e,r))),et=(t,e,r,n)=>{const o=new f;null==t||t.forEach((t=>{var i;const s=t.getRoots()[0].id,a=X(t,s,o,e,r,n);for(let e=0;e<(null===(i=a.vs)||void 0===i?void 0:i.length);e++){const r=t.getNode(a.vs[e]);r&&(r.data.order=e)}((t,e,r)=>{const n={};let o;null==r||r.forEach((r=>{let i,s,a=t.getParent(r);for(;a;){if(i=t.getParent(a.id),i?(s=n[i.id],n[i.id]=a.id):(s=o,o=a.id),s&&s!==a.id)return e.hasNode(s)||e.addNode({id:s,data:{}}),e.hasNode(a.id)||e.addNode({id:a.id,data:{}}),void(e.hasEdge(`e${s}-${a.id}`)||e.addEdge({id:`e${s}-${a.id}`,source:s,target:a.id,data:{}}));a=i}}))})(t,o,a.vs)}))},rt=(t,e)=>{null==e||e.forEach((e=>{null==e||e.forEach(((e,r)=>{t.getNode(e).data.order=r}))}))},nt=(t,e)=>{var r,n;if(null===(r=t.getNode(e))||void 0===r?void 0:r.data.dummy)return null===(n=t.getPredecessors(e))||void 0===n?void 0:n.find((e=>t.getNode(e.id).data.dummy))},ot=(t,e,r)=>{let n=e,o=r;if(n>o){const t=n;n=o,o=t}let i=t[n];i||(t[n]=i={}),i[o]=!0},it=(t,e,r)=>{let n=e,o=r;return n>r&&(n=r,o=e),!!t[n]},st=(t,e,r,n,o,i)=>{const s=new f,a=at(n,o,i);return null==e||e.forEach((e=>{let n;null==e||e.forEach((e=>{const o=r[e];if(s.hasNode(o)||s.addNode({id:o,data:{}}),n){const i=r[n],u=s.getRelatedEdges(i,"out").find((t=>t.target===o));u?s.updateEdgeData(u.id,Object.assign(Object.assign({},u.data),{weight:Math.max(a(t,e,n),u.data.weight||0)})):s.addEdge({id:`e${Math.random()}`,source:i,target:o,data:{weight:Math.max(a(t,e,n),0)}})}n=e}))})),s};const at=(t,e,r)=>(n,o,i)=>{const s=n.getNode(o),a=n.getNode(i);let u=0,d=0;if(u+=s.data.width/2,s.data.hasOwnProperty("labelpos"))switch((s.data.labelpos||"").toLowerCase()){case"l":d=-s.data.width/2;break;case"r":d=s.data.width/2}if(d&&(u+=r?d:-d),d=0,u+=(s.data.dummy?e:t)/2,u+=(a.data.dummy?e:t)/2,u+=a.data.width/2,a.data.labelpos)switch((a.data.labelpos||"").toLowerCase()){case"l":d=a.data.width/2;break;case"r":d=-a.data.width/2}return d&&(u+=r?d:-d),d=0,u},ut=(t,e)=>t.getNode(e).data.width||0,dt=(t,e)=>{var r;const n=A(t);((t,e)=>{const{ranksep:r=0}=e||{},n=O(t);let o=0;null==n||n.forEach((e=>{const n=e.map((e=>t.getNode(e).data.height)),i=Math.max(...n,0);null==e||e.forEach((e=>{t.getNode(e).data.y=o+i/2})),o+=i+r}))})(n,e);const o=((t,e)=>{const{align:r,nodesep:n=0,edgesep:o=0}=e||{},i=O(t),s=Object.assign(((t,e)=>{const r={};return(null==e?void 0:e.length)&&e.reduce(((e,n)=>{let o=0,i=0;const s=e.length,a=null==n?void 0:n[(null==n?void 0:n.length)-1];return null==n||n.forEach(((e,u)=>{var d;const h=nt(t,e),c=h?t.getNode(h.id).data.order:s;(h||e===a)&&(null===(d=n.slice(i,u+1))||void 0===d||d.forEach((e=>{var n;null===(n=t.getPredecessors(e))||void 0===n||n.forEach((n=>{var i;const s=t.getNode(n.id),a=s.data.order;!(a<o||c<a)||s.data.dummy&&(null===(i=t.getNode(e))||void 0===i?void 0:i.data.dummy)||ot(r,n.id,e)}))})),i=u+1,o=c)})),n})),r})(t,i),((t,e)=>{const r={};function n(e,n){const o=function(t){return JSON.stringify(t.slice(1))}(e);n.get(o)||(function(e,n,o,i,s){var a,u;let d;for(let h=n;h<o;h++)d=e[h],(null===(a=t.getNode(d))||void 0===a?void 0:a.data.dummy)&&(null===(u=t.getPredecessors(d))||void 0===u||u.forEach((e=>{const n=t.getNode(e.id);n.data.dummy&&(n.data.order<i||n.data.order>s)&&ot(r,e.id,d)})))}(...e),n.set(o,!0))}return(null==e?void 0:e.length)&&e.reduce(((e,r)=>{let o,i=-1,s=0;const a=new Map;return null==r||r.forEach(((u,d)=>{var h;if("border"===(null===(h=t.getNode(u))||void 0===h?void 0:h.data.dummy)){const e=t.getPredecessors(u)||[];e.length&&(o=t.getNode(e[0].id).data.order,n([r,s,d,i,o],a),s=d,i=o)}n([r,s,r.length,o,e.length],a)})),r})),r})(t,i)),a={};let u=[];["u","d"].forEach((e=>{u="u"===e?i:Object.values(i).reverse(),["l","r"].forEach((r=>{"r"===r&&(u=u.map((t=>Object.values(t).reverse())));const i=("u"===e?t.getPredecessors:t.getSuccessors).bind(t),d=((t,e,r,n)=>{const o={},i={},s={};return null==e||e.forEach((t=>{null==t||t.forEach(((t,e)=>{o[t]=t,i[t]=t,s[t]=e}))})),null==e||e.forEach((t=>{let e=-1;null==t||t.forEach((t=>{let a=n(t).map((t=>t.id));if(a.length){a=a.sort(((t,e)=>s[t]-s[e]));const n=(a.length-1)/2;for(let u=Math.floor(n),d=Math.ceil(n);u<=d;++u){const n=a[u];i[t]===t&&e<s[n]&&!it(r,t,n)&&(i[n]=t,i[t]=o[t]=o[n],e=s[n])}}}))})),{root:o,align:i}})(0,u,s,i),h=((t,e,r,n,o,i,s)=>{var a;const u={},d=st(t,e,r,o,i,s),h=s?"borderLeft":"borderRight",c=(t,e)=>{let r=d.getAllNodes(),n=r.pop();const o={};for(;n;)o[n.id]?t(n.id):(o[n.id]=!0,r.push(n),r=r.concat(e(n.id))),n=r.pop()};return c((t=>{u[t]=(d.getRelatedEdges(t,"in")||[]).reduce(((t,e)=>Math.max(t,(u[e.source]||0)+e.data.weight)),0)}),d.getPredecessors.bind(d)),c((e=>{const r=(d.getRelatedEdges(e,"out")||[]).reduce(((t,e)=>Math.min(t,(u[e.target]||0)-e.data.weight)),Number.POSITIVE_INFINITY),n=t.getNode(e);r!==Number.POSITIVE_INFINITY&&n.data.borderType!==h&&(u[e]=Math.max(u[e],r))}),d.getSuccessors.bind(d)),null===(a=Object.values(n))||void 0===a||a.forEach((t=>{u[t]=u[r[t]]})),u})(t,u,d.root,d.align,n,o,"r"===r);"r"===r&&Object.keys(h).forEach((t=>h[t]=-h[t])),a[e+r]=h}))}));const d=((t,e)=>R(Object.values(e),(e=>{var r;let n=Number.NEGATIVE_INFINITY,o=Number.POSITIVE_INFINITY;return null===(r=Object.keys(e))||void 0===r||r.forEach((r=>{const i=e[r],s=ut(t,r)/2;n=Math.max(i+s,n),o=Math.min(i-s,o)})),n-o})))(t,a);return d&&function(t,e){const r=Object.values(e),n=Math.min(...r),o=Math.max(...r);["u","d"].forEach((r=>{["l","r"].forEach((i=>{const s=r+i,a=t[s];let u;if(a===e)return;const d=Object.values(a);u="l"===i?n-Math.min(...d):o-Math.max(...d),u&&(t[s]={},Object.keys(a).forEach((e=>{t[s][e]=a[e]+u})))}))}))}(a,d),((t,e)=>{const r={};return Object.keys(t.ul).forEach((n=>{if(e)r[n]=t[e.toLowerCase()][n];else{const e=Object.values(t).map((t=>t[n]));r[n]=(e[0]+e[1])/2}})),r})(a,r)})(n,e);null===(r=Object.keys(o))||void 0===r||r.forEach((t=>{n.getNode(t).data.x=o[t]}))},ht=t=>{const e={},r=n=>{var o;const i=t.getNode(n);if(!i)return 0;if(e[n])return i.data.rank;let s;return e[n]=!0,null===(o=t.getRelatedEdges(n,"out"))||void 0===o||o.forEach((t=>{const e=r(t.target)-t.data.minlen;e&&(void 0===s||e<s)&&(s=e)})),s||(s=0),i.data.rank=s,s};t.getAllNodes().filter((e=>0===t.getRelatedEdges(e.id,"in").length)).forEach((t=>r(t.id)))},ct=(t,e)=>t.getNode(e.target).data.rank-t.getNode(e.source).data.rank-e.data.minlen,lt=(t,e)=>{const r=n=>{e.getRelatedEdges(n,"both").forEach((o=>{const i=o.source,s=n===i?o.target:i;t.hasNode(s)||ct(e,o)||(t.addNode({id:s,data:{}}),t.addEdge({id:o.id,source:n,target:s,data:{}}),r(s))}))};return t.getAllNodes().forEach((t=>r(t.id))),t.getAllNodes().length},ft=(t,e)=>{const r=n=>{var o;null===(o=e.getRelatedEdges(n,"both"))||void 0===o||o.forEach((o=>{const i=o.source,s=n===i?o.target:i;t.hasNode(s)||void 0===e.getNode(s).data.layer&&ct(e,o)||(t.addNode({id:s,data:{}}),t.addEdge({id:o.id,source:n,target:s,data:{}}),r(s))}))};return t.getAllNodes().forEach((t=>r(t.id))),t.getAllNodes().length},gt=(t,e)=>R(e.getAllEdges(),(r=>t.hasNode(r.source)!==t.hasNode(r.target)?ct(e,r):1/0)),pt=(t,e,r)=>{t.getAllNodes().forEach((t=>{const n=e.getNode(t.id);n.data.rank||(n.data.rank=0),n.data.rank+=r}))},vt=(t,e)=>{let r=P(t,t.getAllNodes(),"post",!1);r=r.slice(0,(null==r?void 0:r.length)-1),r.forEach((r=>{yt(t,e,r)}))},yt=(t,e,r)=>{const n=t.getNode(r).data.parent;t.getRelatedEdges(r,"both").find((t=>t.target===n||t.source===n)).data.cutvalue=mt(t,e,r)},mt=(t,e,r)=>{const n=t.getNode(r).data.parent;let o=!0,i=e.getRelatedEdges(r,"out").find((t=>t.target===n)),s=0;return i||(o=!1,i=e.getRelatedEdges(n,"out").find((t=>t.target===r))),s=i.data.weight,e.getRelatedEdges(r,"both").forEach((e=>{const i=e.source===r,a=i?e.target:e.source;if(a!==n){const n=i===o,u=e.data.weight;if(s+=n?u:-u,Mt(t,r,a)){const e=t.getRelatedEdges(r,"both").find((t=>t.source===a||t.target===a)).data.cutvalue;s+=n?-e:e}}})),s},wt=(t,e=t.getAllNodes()[0].id)=>{xt(t,{},1,e)},xt=(t,e,r,n,o)=>{var i;const s=r;let a=r;const u=t.getNode(n);return e[n]=!0,null===(i=t.getNeighbors(n))||void 0===i||i.forEach((r=>{e[r.id]||(a=xt(t,e,a,r.id,n))})),u.data.low=s,u.data.lim=a++,o?u.data.parent=o:delete u.data.parent,a},bt=t=>t.getAllEdges().find((t=>t.data.cutvalue<0)),Et=(t,e,r)=>{let n=r.source,o=r.target;e.getRelatedEdges(n,"out").find((t=>t.target===o))||(n=r.target,o=r.source);const i=t.getNode(n),s=t.getNode(o);let a=i,u=!1;i.data.lim>s.data.lim&&(a=s,u=!0);const d=e.getAllEdges().filter((e=>u===kt(t.getNode(e.source),a)&&u!==kt(t.getNode(e.target),a)));return R(d,(t=>ct(e,t)))},Nt=(t,e,r,n)=>{const o=t.getRelatedEdges(r.source,"both").find((t=>t.source===r.target||t.target===r.target));o&&t.removeEdge(o.id),t.addEdge({id:`e${Math.random()}`,source:n.source,target:n.target,data:{}}),wt(t),vt(t,e),_t(t,e)},_t=(t,e)=>{const r=t.getAllNodes().find((t=>!t.data.parent));let n=P(t,r,"pre",!1);n=n.slice(1),n.forEach((r=>{const n=t.getNode(r).data.parent;let o=e.getRelatedEdges(r,"out").find((t=>t.target===n)),i=!1;!o&&e.hasNode(n)&&(o=e.getRelatedEdges(n,"out").find((t=>t.target===r)),i=!0),e.getNode(r).data.rank=(e.hasNode(n)&&e.getNode(n).data.rank||0)+(i?null==o?void 0:o.data.minlen:-(null==o?void 0:o.data.minlen))}))},Mt=(t,e,r)=>t.getRelatedEdges(e,"both").find((t=>t.source===r||t.target===r)),kt=(t,e)=>e.data.low<=t.data.lim&&t.data.lim<=e.data.lim,At=ht,jt=t=>{(t=>{const e=(t=>{const e=new f;return t.getAllNodes().forEach((t=>{e.addNode(Object.assign({},t))})),t.getAllEdges().forEach((t=>{const r=e.getRelatedEdges(t.source,"out").find((e=>e.target===t.target));r?e.updateEdgeData(null==r?void 0:r.id,Object.assign(Object.assign({},r.data),{weight:r.data.weight+t.data.weight||0,minlen:Math.max(r.data.minlen,t.data.minlen||1)})):e.addEdge({id:t.id,source:t.source,target:t.target,data:{weight:t.data.weight||0,minlen:t.data.minlen||1}})})),e})(t);ht(e);const r=(t=>{const e=new f({tree:[]}),r=t.getAllNodes()[0],n=t.getAllNodes().length;let o,i;for(e.addNode(r);lt(e,t)<n;)o=gt(e,t),i=e.hasNode(o.source)?ct(t,o):-ct(t,o),pt(e,t,i);return e})(e);let n,o;for(wt(r),vt(r,e);n=bt(r);)o=Et(r,e,n),Nt(r,e,n,o)})(t)},Ot=(t,e)=>{const{acyclicer:r,ranker:n,rankdir:o="tb",nodeOrder:i,keepNodeOrder:s,align:a,nodesep:u=50,edgesep:d=20,ranksep:h=50}=e;$t(t),_(t,r);const{nestingRoot:c,nodeRankFactor:l}=(t=>{const e=k(t,"root",{},"_root"),r=(t=>{const e={},r=(n,o)=>{const i=t.getChildren(n);null==i||i.forEach((t=>r(t.id,o+1))),e[n]=o};return t.getRoots().forEach((t=>r(t.id,1))),e})(t);let n=Math.max(...Object.values(r));Math.abs(n)===1/0&&(n=1);const o=n-1,i=2*o+1;t.getAllEdges().forEach((t=>{t.data.minlen*=i}));const s=(t=>{let e=0;return t.getAllEdges().forEach((t=>{e+=t.data.weight})),e})(t)+1;return t.getRoots().forEach((n=>{q(t,e,i,s,o,r,n.id)})),{nestingRoot:e,nodeRankFactor:i}})(t);((t,e)=>{switch(e){case"network-simplex":jt(t);break;case"tight-tree":default:(t=>{(t=>{const e={};let r;const n=o=>{var i;const s=t.getNode(o);if(!s)return 0;if(e[o])return s.data.rank;let a;return e[o]=!0,null===(i=t.getRelatedEdges(o,"out"))||void 0===i||i.forEach((t=>{const e=n(t.target)-t.data.minlen;e&&(void 0===a||e<a)&&(a=e)})),a||(a=0),(void 0===r||a<r)&&(r=a),s.data.rank=a,a};t.getAllNodes().filter((e=>0===t.getRelatedEdges(e.id,"in").length)).forEach((t=>{t&&n(t.id)})),void 0===r&&(r=0);const o={},i=(e,r)=>{var n;const s=t.getNode(e),a=isNaN(s.data.layer)?r:s.data.layer;(void 0===s.data.rank||s.data.rank<a)&&(s.data.rank=a),o[e]||(o[e]=!0,null===(n=t.getRelatedEdges(e,"out"))||void 0===n||n.forEach((t=>{i(t.target,a+t.data.minlen)})))};t.getAllNodes().forEach((t=>{const e=t.data;e&&(isNaN(e.layer)?e.rank-=r:i(t.id,e.layer))}))})(t),(t=>{const e=new f({tree:[]}),r=t.getAllNodes()[0],n=t.getAllNodes().length;let o,i;for(e.addNode(r);ft(e,t)<n;)o=gt(e,t),i=e.hasNode(o.source)?ct(t,o):-ct(t,o),pt(e,t,i)})(t)})(t);break;case"longest-path":At(t)}})(A(t),n),Ct(t),((t,e=0)=>{const r=t.getAllNodes(),n=r.filter((t=>void 0!==t.data.rank)).map((t=>t.data.rank)),o=Math.min(...n),i=[];r.forEach((t=>{const e=(t.data.rank||0)-o;i[e]||(i[e]=[]),i[e].push(t.id)}));let s=0;for(let r=0;r<i.length;r++){const n=i[r];void 0===n?r%e!=0&&(s-=1):s&&(null==n||n.forEach((e=>{const r=t.getNode(e);r&&(r.data.rank=r.data.rank||0,r.data.rank+=s)})))}})(t,l),((t,e)=>{e&&t.removeNode(e),t.getAllEdges().forEach((e=>{e.data.nestingEdge&&t.removeEdge(e.id)}))})(t,c),(t=>{const e=t.getAllNodes().filter((t=>void 0!==t.data.rank)).map((t=>t.data.rank)),r=Math.min(...e);t.getAllNodes().forEach((t=>{t.data.hasOwnProperty("rank")&&r!==1/0&&(t.data.rank-=r)}))})(t),Dt(t),Tt(t);const g=[];((t,e)=>{t.getAllEdges().forEach((r=>((t,e,r)=>{let n=e.source,o=t.getNode(n).data.rank;const i=e.target,s=t.getNode(i).data.rank,a=e.data.labelRank;if(s===o+1)return;let u,d,h;for(t.removeEdge(e.id),h=0,++o;o<s;++h,++o)e.data.points=[],d={originalEdge:e,width:0,height:0,rank:o},u=k(t,"edge",d,"_d"),o===a&&(d.width=e.data.width,d.height=e.data.height,d.dummy=V,d.labelpos=e.data.labelpos),t.addEdge({id:`e${Math.random()}`,source:n,target:u,data:{weight:e.data.weight}}),0===h&&r.push(u),n=u;t.addEdge({id:`e${Math.random()}`,source:n,target:i,data:{weight:e.data.weight}})})(t,r,e)))})(t,g),((t,e)=>{const r=(t=>{const e={};let r=0;const n=o=>{const i=r;t.getChildren(o).forEach((t=>n(t.id))),e[o]={low:i,lim:r++}};return t.getRoots().forEach((t=>n(t.id))),e})(t);e.forEach((e=>{var n,o;let i=e,s=t.getNode(i);const a=s.data.originalEdge;if(!a)return;const u=((t,e,r,n)=>{var o,i;const s=[],a=[],u=Math.min(e[r].low,e[n].low),d=Math.max(e[r].lim,e[n].lim);let h,c;h=r;do{h=null===(o=t.getParent(h))||void 0===o?void 0:o.id,s.push(h)}while(h&&(e[h].low>u||d>e[h].lim));for(c=h,h=n;h&&h!==c;)a.push(h),h=null===(i=t.getParent(h))||void 0===i?void 0:i.id;return{lca:c,path:s.concat(a.reverse())}})(t,r,a.source,a.target),d=u.path,h=u.lca;let c=0,l=d[c],f=!0;for(;i!==a.target;){if(s=t.getNode(i),f){for(;l!==h&&(null===(n=t.getNode(l))||void 0===n?void 0:n.data.maxRank)<s.data.rank;)c++,l=d[c];l===h&&(f=!1)}if(!f){for(;c<d.length-1&&(null===(o=t.getNode(d[c+1]))||void 0===o?void 0:o.data.minRank)<=s.data.rank;)c++;l=d[c]}t.hasNode(l)&&t.setParent(i,l),i=t.getSuccessors(i)[0].id}}))})(t,g),(t=>{const e=r=>{const n=t.getChildren(r),o=t.getNode(r);if((null==n?void 0:n.length)&&n.forEach((t=>e(t.id))),o.data.hasOwnProperty("minRank")){o.data.borderLeft=[],o.data.borderRight=[];for(let e=o.data.minRank,n=o.data.maxRank+1;e<n;e+=1)C(t,"borderLeft","_bl",r,o,e),C(t,"borderRight","_br",r,o,e)}};t.getRoots().forEach((t=>e(t.id)))})(t),s&&((t,e)=>{const r=t.getAllNodes().filter((e=>{var r;return!(null===(r=t.getChildren(e.id))||void 0===r?void 0:r.length)})).map((t=>t.data.rank)),n=Math.max(...r),o=[];for(let t=0;t<n+1;t++)o[t]=[];null==e||e.forEach((e=>{const r=t.getNode(e);r&&!r.data.dummy&&(isNaN(r.data.rank)||(r.data.fixorder=o[r.data.rank].length,o[r.data.rank].push(e)))}))})(t,i),((t,e)=>{const r=z(t),n=[],o=[];for(let t=1;t<r+1;t++)n.push(t);for(let t=r-1;t>-1;t--)o.push(t);const i=tt(t,n,"in"),s=tt(t,o,"out");let a=Y(t);rt(t,a);let u,d=Number.POSITIVE_INFINITY;for(let r=0,n=0;n<4;++r,++n){et(r%2?i:s,r%4>=2,!1,e),a=O(t);const o=W(t,a);o<d&&(n=0,u=G(a),d=o)}a=Y(t),rt(t,a);for(let r=0,n=0;n<4;++r,++n){et(r%2?i:s,r%4>=2,!0,e),a=O(t);const o=W(t,a);o<d&&(n=0,u=G(a),d=o)}rt(t,u)})(t,s),Gt(t),((t,e)=>{const r=e.toLowerCase();"lr"!==r&&"rl"!==r||D(t)})(t,o),dt(t,{align:a,nodesep:u,edgesep:d,ranksep:h}),Ut(t),Bt(t),((t,e)=>{e.forEach((e=>{let r=t.getNode(e);const{data:n}=r,o=n.originalEdge;let i;o&&t.addEdge(o);let s=e;for(;r.data.dummy;)i=t.getSuccessors(s)[0],t.removeNode(s),o.data.points.push({x:r.data.x,y:r.data.y}),r.data.dummy===V&&(o.data.x=r.data.x,o.data.y=r.data.y,o.data.width=r.data.width,o.data.height=r.data.height),s=i.id,r=t.getNode(s)}))})(t,g),qt(t),((t,e)=>{const r=e.toLowerCase();"bt"!==r&&"rl"!==r||(t=>{t.getAllNodes().forEach((t=>{L(t.data)})),t.getAllEdges().forEach((t=>{var e;null===(e=t.data.points)||void 0===e||e.forEach((t=>L(t))),t.data.hasOwnProperty("y")&&L(t.data)}))})(t),"lr"!==r&&"rl"!==r||((t=>{t.getAllNodes().forEach((t=>{F(t.data)})),t.getAllEdges().forEach((t=>{var e;null===(e=t.data.points)||void 0===e||e.forEach((t=>F(t))),t.data.hasOwnProperty("x")&&F(t.data)}))})(t),D(t))})(t,o);const{width:p,height:v}=Lt(t);return Ft(t),Vt(t),(t=>{t.getAllEdges().forEach((e=>{const r=e.data;if(r.reversed){t.removeEdge(e.id);const n=r.forwardName;delete r.reversed,delete r.forwardName,t.addEdge({id:e.id,source:e.target,target:e.source,data:Object.assign(Object.assign({},r),{forwardName:n})})}}))})(t),{width:p,height:v}},St=["width","height","layer","fixorder"],zt={width:0,height:0},Rt=["minlen","weight","width","height","labeloffset"],It={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},Pt=["labelpos"],Ct=t=>{t.getAllEdges().forEach((e=>{if(e.data.width&&e.data.height){const r=t.getNode(e.source),n={e,rank:(t.getNode(e.target).data.rank-r.data.rank)/2+r.data.rank};k(t,"edge-proxy",n,"_ep")}}))},Dt=t=>{let e=0;return t.getAllNodes().forEach((r=>{var n,o;r.data.borderTop&&(r.data.minRank=null===(n=t.getNode(r.data.borderTop))||void 0===n?void 0:n.data.rank,r.data.maxRank=null===(o=t.getNode(r.data.borderBottom))||void 0===o?void 0:o.data.rank,e=Math.max(e,r.data.maxRank||-1/0))})),e},Tt=t=>{t.getAllNodes().forEach((e=>{"edge-proxy"===e.data.dummy&&(t.getEdge(e.data.e.id).data.labelRank=e.data.rank,t.removeNode(e.id))}))},Lt=(t,e)=>{let r,n,o=0,i=0;const{marginx:s=0,marginy:a=0}=e||{},u=t=>{if(!t.data)return;const e=t.data.x,s=t.data.y,a=t.data.width,u=t.data.height;isNaN(e)||isNaN(a)||(void 0===r&&(r=e-a/2),r=Math.min(r,e-a/2),o=Math.max(o,e+a/2)),isNaN(s)||isNaN(u)||(void 0===n&&(n=s-u/2),n=Math.min(n,s-u/2),i=Math.max(i,s+u/2))};return t.getAllNodes().forEach((t=>{u(t)})),t.getAllEdges().forEach((t=>{(null==t?void 0:t.data.hasOwnProperty("x"))&&u(t)})),r-=s,n-=a,t.getAllNodes().forEach((t=>{t.data.x-=r,t.data.y-=n})),t.getAllEdges().forEach((t=>{var e;null===(e=t.data.points)||void 0===e||e.forEach((t=>{t.x-=r,t.y-=n})),t.data.hasOwnProperty("x")&&(t.data.x-=r),t.data.hasOwnProperty("y")&&(t.data.y-=n)})),{width:o-r+s,height:i-n+a}},Ft=t=>{t.getAllEdges().forEach((e=>{const r=t.getNode(e.source),n=t.getNode(e.target);let o,i;e.data.points?(o=e.data.points[0],i=e.data.points[e.data.points.length-1]):(e.data.points=[],o={x:n.data.x,y:n.data.y},i={x:r.data.x,y:r.data.y}),e.data.points.unshift(j(r.data,o)),e.data.points.push(j(n.data,i))}))},qt=t=>{t.getAllEdges().forEach((t=>{if(t.data.hasOwnProperty("x"))switch("l"!==t.data.labelpos&&"r"!==t.data.labelpos||(t.data.width-=t.data.labeloffset),t.data.labelpos){case"l":t.data.x-=t.data.width/2+t.data.labeloffset;break;case"r":t.data.x+=t.data.width/2+t.data.labeloffset}}))},Vt=t=>{t.getAllEdges().forEach((t=>{var e;t.data.reversed&&(null===(e=t.data.points)||void 0===e||e.reverse())}))},Bt=t=>{t.getAllNodes().forEach((e=>{var r,n,o;if(null===(r=t.getChildren(e.id))||void 0===r?void 0:r.length){const r=t.getNode(e.id),i=t.getNode(r.data.borderTop),s=t.getNode(r.data.borderBottom),a=t.getNode(r.data.borderLeft[(null===(n=r.data.borderLeft)||void 0===n?void 0:n.length)-1]),u=t.getNode(r.data.borderRight[(null===(o=r.data.borderRight)||void 0===o?void 0:o.length)-1]);r.data.width=Math.abs((null==u?void 0:u.data.x)-(null==a?void 0:a.data.x))||10,r.data.height=Math.abs((null==s?void 0:s.data.y)-(null==i?void 0:i.data.y))||10,r.data.x=((null==a?void 0:a.data.x)||0)+r.data.width/2,r.data.y=((null==i?void 0:i.data.y)||0)+r.data.height/2}})),t.getAllNodes().forEach((e=>{"border"===e.data.dummy&&t.removeNode(e.id)}))},$t=t=>{t.getAllEdges().forEach((e=>{if(e.source===e.target){const r=t.getNode(e.source);r.data.selfEdges||(r.data.selfEdges=[]),r.data.selfEdges.push(e),t.removeEdge(e.id)}}))},Gt=t=>{const e=O(t);null==e||e.forEach((e=>{let r=0;null==e||e.forEach(((e,n)=>{var o;const i=t.getNode(e);i.data.order=n+r,null===(o=i.data.selfEdges)||void 0===o||o.forEach((e=>{k(t,"selfedge",{width:e.data.width,height:e.data.height,rank:i.data.rank,order:n+ ++r,e},"_se")})),delete i.data.selfEdges}))}))},Ut=t=>{t.getAllNodes().forEach((e=>{const r=t.getNode(e.id);if("selfedge"===r.data.dummy){const n=t.getNode(r.data.e.source),o=n.data.x+n.data.width/2,i=n.data.y,s=r.data.x-o,a=n.data.height/2;t.hasEdge(r.data.e.id)?t.updateEdgeData(r.data.e.id,r.data.e.data):t.addEdge({id:r.data.e.id,source:r.data.e.source,target:r.data.e.target,data:r.data.e.data}),t.removeNode(e.id),r.data.e.data.points=[{x:o+2*s/3,y:i-a},{x:o+5*s/6,y:i-a},{y:i,x:o+s},{x:o+5*s/6,y:i+a},{x:o+2*s/3,y:i+a}],r.data.e.data.x=r.data.x,r.data.e.data.y=r.data.y}}))},Wt=(t,e)=>{const r={};return null==e||e.forEach((e=>{void 0!==t[e]&&(r[e]=+t[e])})),r},Yt=(t={})=>{const e={};return Object.keys(t).forEach((r=>{e[r.toLowerCase()]=t[r]})),e},Kt=function(t){return"function"==typeof t},Jt=function(t){var e=typeof t;return null!==t&&"object"===e||"function"===e};function Ht(t){if(!t)return[0,0,0];if(v(t))return[t,t,t];if(0===t.length)return[0,0,0];const[e,r=e,n=e]=t;return[e,r,n]}function Xt(t,e){let r;return r=Kt(e)?e:v(e)?()=>e:()=>t,r}function Qt(t,e,r=!0){return e||0===e?Kt(e)?e:v(e)?()=>e:Array.isArray(e)?()=>r?Math.max(...e)||t:e:Jt(e)&&e.width&&e.height?()=>r?Math.max(e.width,e.height)||t:[e.width,e.height]:()=>t:e=>{const{size:n}=e.data||{};return n?Array.isArray(n)?r?Math.max(...n)||t:n:Jt(n)&&n.width&&n.height?r?Math.max(n.width,n.height)||t:[n.width,n.height]:n:t}}const Zt=(t,e,r=10)=>{let n;const o="function"==typeof e?e:()=>e||0;return n=t?Array.isArray(t)?e=>t:Kt(t)?t:e=>t:t=>{var e,n,o;if(null===(e=t.data)||void 0===e?void 0:e.bboxSize)return null===(n=t.data)||void 0===n?void 0:n.bboxSize;if(null===(o=t.data)||void 0===o?void 0:o.size){const e=t.data.size;return Array.isArray(e)?e:Jt(e)?[e.width,e.height]:e}return r},t=>{const e=n(t),r=o(t);return Math.max(...Ht(e))+r}},te=t=>{if(null===t)return t;if(t instanceof Date)return new Date(t.getTime());if(t instanceof Array){const e=[];return t.forEach((t=>{e.push(t)})),e.map((t=>te(t)))}if("object"==typeof t){const e={};return Object.keys(t).forEach((r=>{e[r]=te(t[r])})),e}return t},ee=(t,e)=>{const r=te(t);return r.data=r.data||{},e&&(v(r.data.x)||(r.data.x=Math.random()*e[0]),v(r.data.y)||(r.data.y=Math.random()*e[1])),r},re={rankdir:"TB",nodesep:50,ranksep:50,edgeLabelSpace:!0,ranker:"tight-tree",controlPoints:!1,radial:!1,focusNode:null};class ne{constructor(t={}){this.options=t,this.id="antv-dagre",this.options=Object.assign(Object.assign({},re),t)}execute(t,r){return e(this,void 0,void 0,(function*(){return this.genericDagreLayout(!1,t,r)}))}assign(t,r){return e(this,void 0,void 0,(function*(){yield this.genericDagreLayout(!0,t,r)}))}genericDagreLayout(t,r,n){return e(this,void 0,void 0,(function*(){const e=Object.assign(Object.assign({},this.options),n),{nodeSize:o,align:i,rankdir:s="TB",ranksep:a,nodesep:u,ranksepFunc:d,nodesepFunc:h,edgeLabelSpace:c,ranker:l,nodeOrder:g,begin:p,controlPoints:y,radial:m,sortByCombo:w,preset:x}=e,b=new f({tree:[]}),E=Xt(a||50,d),N=Xt(u||50,h);let _=N,M=E;"LR"!==s&&"RL"!==s||(_=E,M=N);const k=Qt(10,o,!1),A=r.getAllNodes(),j=r.getAllEdges();let O;A.forEach((t=>{const e=Ht(k(t)),r=M(t),n=_(t),o=e[0]+2*n,i=e[1]+2*r,s=t.data.layer;v(s)?b.addNode({id:t.id,data:{width:o,height:i,layer:s}}):b.addNode({id:t.id,data:{width:o,height:i}})})),w&&(b.attachTreeStructure("combo"),A.forEach((t=>{const{parentId:e}=t.data;void 0!==e&&b.hasNode(e)&&b.setParent(t.id,e,"combo")}))),j.forEach((t=>{b.addEdge({id:t.id,source:t.source,target:t.target,data:{weight:t.data.weight||1}})})),(null==x?void 0:x.length)&&(O=new f({nodes:x})),((t,e)=>{const{edgeLabelSpace:r,keepNodeOrder:n,prevGraph:o,rankdir:i,ranksep:s}=e;var a,u;!n&&o&&(u=o,(a=t).getAllNodes().forEach((t=>{const e=a.getNode(t.id);if(u.hasNode(t.id)){const r=u.getNode(t.id);e.data.fixorder=r.data._order,delete r.data._order}else delete e.data.fixorder})));const d=(t=>{const e=new f({tree:[]});return t.getAllNodes().forEach((r=>{const n=Yt(t.getNode(r.id).data),o=Object.assign(Object.assign({},zt),n),i=Wt(o,St);e.hasNode(r.id)||e.addNode({id:r.id,data:Object.assign({},i)});const s=t.hasTreeStructure("combo")?t.getParent(r.id,"combo"):t.getParent(r.id);null==s||(e.hasNode(s.id)||e.addNode(Object.assign({},s)),e.setParent(r.id,s.id))})),t.getAllEdges().forEach((r=>{const n=Yt(t.getEdge(r.id).data),o={};null==Pt||Pt.forEach((t=>{void 0!==n[t]&&(o[t]=n[t])})),e.addEdge({id:r.id,source:r.source,target:r.target,data:Object.assign({},It,Wt(n,Rt),o)})})),e})(t);let h;r&&(e.ranksep=((t,e)=>{const{ranksep:r=0,rankdir:n}=e;return t.getAllNodes().forEach((t=>{isNaN(t.data.layer)||t.data.layer||(t.data.layer=0)})),t.getAllEdges().forEach((t=>{var e;t.data.minlen*=2,"c"!==(null===(e=t.data.labelpos)||void 0===e?void 0:e.toLowerCase())&&("TB"===n||"BT"===n?t.data.width+=t.data.labeloffset:t.data.height+=t.data.labeloffset)})),r/2})(d,{rankdir:i,ranksep:s}));try{h=Ot(d,e)}catch(t){if("Not possible to find intersection inside of the rectangle"===t.message)return void console.error("The following error may be caused by improper layer setting, please make sure your manual layer setting does not violate the graph's structure:\n",t);throw t}((t,e)=>{t.getAllNodes().forEach((r=>{var n;const o=t.getNode(r.id);if(o){const t=e.getNode(r.id);o.data.x=t.data.x,o.data.y=t.data.y,o.data._order=t.data.order,o.data._rank=t.data.rank,(null===(n=e.getChildren(r.id))||void 0===n?void 0:n.length)&&(o.data.width=t.data.width,o.data.height=t.data.height)}})),t.getAllEdges().forEach((r=>{const n=t.getEdge(r.id),o=e.getEdge(r.id);n.data.points=o?o.data.points:[],o&&o.data.hasOwnProperty("x")&&(n.data.x=o.data.x,n.data.y=o.data.y)}))})(t,d)})(b,{prevGraph:O,edgeLabelSpace:c,keepNodeOrder:!!g,nodeOrder:g||[],acyclicer:"greedy",ranker:l,rankdir:s,nodesep:u,align:i});const S=[0,0];if(p){let t=1/0,e=1/0;b.getAllNodes().forEach((r=>{t>r.data.x&&(t=r.data.x),e>r.data.y&&(e=r.data.y)})),b.getAllEdges().forEach((r=>{var n;null===(n=r.data.points)||void 0===n||n.forEach((r=>{t>r.x&&(t=r.x),e>r.y&&(e=r.y)}))})),S[0]=p[0]-t,S[1]=p[1]-e}const z="LR"===s||"RL"===s;if(m);else{const t=new Set,e="BT"===s||"RL"===s?(t,e)=>e-t:(t,e)=>t-e;b.getAllNodes().forEach((e=>{e.data.x=e.data.x+S[0],e.data.y=e.data.y+S[1],t.add(z?e.data.x:e.data.y)}));const r=Array.from(t).sort(e),n=z?(t,e)=>t.x!==e.x:(t,e)=>t.y!==e.y,o=z?(t,e,r)=>{const n=Math.max(e.y,r.y),o=Math.min(e.y,r.y);return t.filter((t=>t.y<=n&&t.y>=o))}:(t,e,r)=>{const n=Math.max(e.x,r.x),o=Math.min(e.x,r.x);return t.filter((t=>t.x<=n&&t.x>=o))};b.getAllEdges().forEach(((t,e)=>{var i;c&&y&&"loop"!==t.data.type&&(t.data.controlPoints=oe(null===(i=t.data.points)||void 0===i?void 0:i.map((({x:t,y:e})=>({x:t+S[0],y:e+S[1]}))),b.getNode(t.source),b.getNode(t.target),r,z,n,o))}))}let R=[];R=b.getAllNodes().map((t=>ee(t)));const I=b.getAllEdges();return t&&(R.forEach((t=>{r.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})})),I.forEach((t=>{r.mergeEdgeData(t.id,{controlPoints:t.data.controlPoints})}))),{nodes:R,edges:I}}))}}const oe=(t,e,r,n,o,i,s)=>{let a=(null==t?void 0:t.slice(1,t.length-1))||[];if(e&&r){let{x:t,y:u}=e.data,{x:d,y:h}=r.data;if(o&&(t=e.data.y,u=e.data.x,d=r.data.y,h=r.data.x),h!==u&&t!==d){const c=n.indexOf(u),l=n[c+1];if(l){const t=a[0],e=o?{x:(u+l)/2,y:(null==t?void 0:t.y)||d}:{x:(null==t?void 0:t.x)||d,y:(u+l)/2};t&&!i(t,e)||a.unshift(e)}const f=n.indexOf(h),g=Math.abs(f-c);if(1===g)a=s(a,e.data,r.data),a.length||a.push(o?{x:(u+h)/2,y:t}:{x:t,y:(u+h)/2});else if(g>1){const e=n[f-1];if(e){const r=a[a.length-1],n=o?{x:(h+e)/2,y:(null==r?void 0:r.y)||d}:{x:(null==r?void 0:r.x)||t,y:(h+e)/2};r&&!i(r,n)||a.push(n)}}}}return a},ie=(t,e,r)=>{const n=t.getAllNodes(),o=t.getAllEdges();return(null==n?void 0:n.length)?1===n.length?(e&&t.mergeNodeData(n[0].id,{x:r[0],y:r[1]}),{nodes:[Object.assign(Object.assign({},n[0]),{data:Object.assign(Object.assign({},n[0].data),{x:r[0],y:r[1]})})],edges:o}):void 0:{nodes:[],edges:o}},se={radius:null,startRadius:null,endRadius:null,startAngle:0,endAngle:2*Math.PI,clockwise:!0,divisions:1,ordering:null,angleRatio:1};class ae{constructor(t={}){this.options=t,this.id="circular",this.options=Object.assign(Object.assign({},se),t)}execute(t,r){return e(this,void 0,void 0,(function*(){return this.genericCircularLayout(!1,t,r)}))}assign(t,r){return e(this,void 0,void 0,(function*(){yield this.genericCircularLayout(!0,t,r)}))}genericCircularLayout(t,r,n){return e(this,void 0,void 0,(function*(){const e=Object.assign(Object.assign({},this.options),n),{width:o,height:i,center:s,divisions:a,startAngle:u=0,endAngle:d=2*Math.PI,angleRatio:h,ordering:c,clockwise:l,nodeSpacing:f,nodeSize:g}=e,p=r.getAllNodes(),v=r.getAllEdges(),[y,m,w]=de(o,i,s),x=null==p?void 0:p.length;if(!x||1===x)return ie(r,t,w);const b=(d-u)/x;let{radius:E,startRadius:N,endRadius:_}=e;if(f){const t=Xt(10,f),e=Qt(10,g);let r=-1/0;p.forEach((t=>{const n=e(t);r<n&&(r=n)}));let n=0;p.forEach(((e,o)=>{n+=0===o?r||10:(t(e)||0)+(r||10)})),E=n/(2*Math.PI)}else E||N||_?!N&&_?N=_:N&&!_&&(_=N):E=Math.min(m,y)/2;const M=b*h;let k=[];k="topology"===c?ue(r,p):"topology-directed"===c?ue(r,p,!0):"degree"===c?function(t,e){const r=[];return e.forEach(((t,e)=>{r.push(ee(t))})),r.sort(((e,r)=>t.getDegree(e.id,"both")-t.getDegree(r.id,"both"))),r}(r,p):p.map((t=>ee(t)));const A=Math.ceil(x/a);for(let t=0;t<x;++t){let e=E;e||null===N||null===_||(e=N+t*(_-N)/(x-1)),e||(e=10+100*t/(x-1));let r=u+t%A*M+2*Math.PI/a*Math.floor(t/A);l||(r=d-t%A*M-2*Math.PI/a*Math.floor(t/A)),k[t].data.x=w[0]+Math.cos(r)*e,k[t].data.y=w[1]+Math.sin(r)*e}return t&&k.forEach((t=>{r.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})})),{nodes:k,edges:v}}))}}const ue=(t,e,r=!1)=>{const n=[ee(e[0])],o={},i=e.length;o[e[0].id]=!0;let s=0;return e.forEach(((a,u)=>{if(0!==u)if(u!==i-1&&t.getDegree(a.id,"both")===t.getDegree(e[u+1].id,"both")&&!t.areNeighbors(n[s].id,a.id)||o[a.id]){const u=r?t.getSuccessors(n[s].id):t.getNeighbors(n[s].id);let d=!1;for(let e=0;e<u.length;e++){const r=u[e];if(t.getDegree(r.id)===t.getDegree(a.id)&&!o[r.id]){n.push(ee(r)),o[r.id]=!0,d=!0;break}}let h=0;for(;!d&&(o[e[h].id]||(n.push(ee(e[h])),o[e[h].id]=!0,d=!0),h++,h!==i););}else n.push(ee(a)),o[a.id]=!0,s++})),n},de=(t,e,r)=>{let n=t,o=e,i=r;return n||"undefined"==typeof window||(n=window.innerWidth),o||"undefined"==typeof window||(o=window.innerHeight),i||(i=[n/2,o/2]),[n,o,i]},he=function(t){return p(t,"String")},ce=Array.isArray,le={nodeSize:30,nodeSpacing:10,preventOverlap:!1,sweep:void 0,equidistant:!1,startAngle:1.5*Math.PI,clockwise:!0,maxLevelDiff:void 0,sortBy:"degree"};class fe{constructor(t={}){this.options=t,this.id="concentric",this.options=Object.assign(Object.assign({},le),t)}execute(t,r){return e(this,void 0,void 0,(function*(){return this.genericConcentricLayout(!1,t,r)}))}assign(t,r){return e(this,void 0,void 0,(function*(){yield this.genericConcentricLayout(!0,t,r)}))}genericConcentricLayout(t,r,n){return e(this,void 0,void 0,(function*(){const e=Object.assign(Object.assign({},this.options),n),{center:o,width:i,height:s,sortBy:a,maxLevelDiff:u,sweep:d,clockwise:h,equidistant:c,preventOverlap:l,startAngle:f=1.5*Math.PI,nodeSize:g,nodeSpacing:p}=e,y=r.getAllNodes(),m=r.getAllEdges(),w=i||"undefined"==typeof window?i:window.innerWidth,x=s||"undefined"==typeof window?s:window.innerHeight,b=o||[w/2,x/2];if(!(null==y?void 0:y.length)||1===y.length)return ie(r,t,b);const E=[];let N,_=0;ce(g)?N=Math.max(g[0],g[1]):Kt(g)?(N=-1/0,y.forEach((t=>{const e=Math.max(...Ht(g(t)));e>N&&(N=e)}))):N=g,ce(p)?_=Math.max(p[0],p[1]):v(p)&&(_=p),y.forEach((t=>{const e=ee(t);E.push(e);let r=N;const{data:n}=e;ce(n.size)?r=Math.max(n.size[0],n.size[1]):v(n.size)?r=n.size:Jt(n.size)&&(r=Math.max(n.size.width,n.size.height)),N=Math.max(N,r),Kt(p)&&(_=Math.max(p(t),_))}));const M={};E.forEach(((t,e)=>{M[t.id]=e}));let k=a;he(k)&&void 0!==E[0].data[k]||(k="degree"),"degree"===k?E.sort(((t,e)=>r.getDegree(e.id,"both")-r.getDegree(t.id,"both"))):E.sort(((t,e)=>e.data[k]-t.data[k]));const A=E[0],j=(u||("degree"===k?r.getDegree(A.id,"both"):A.data[k]))/4,O=[{nodes:[]}];let S=O[0];E.forEach((t=>{if(S.nodes.length>0){const e="degree"===k?Math.abs(r.getDegree(S.nodes[0].id,"both")-r.getDegree(t.id,"both")):Math.abs(S.nodes[0].data[k]-t.data[k]);j&&e>=j&&(S={nodes:[]},O.push(S))}S.nodes.push(t)}));let z=N+_;if(!l){const t=O.length>0&&O[0].nodes.length>1,e=(Math.min(w,x)/2-z)/(O.length+(t?1:0));z=Math.min(z,e)}let R=0;if(O.forEach((t=>{const e=void 0===d?2*Math.PI-2*Math.PI/t.nodes.length:d;if(t.dTheta=e/Math.max(1,t.nodes.length-1),t.nodes.length>1&&l){const e=Math.cos(t.dTheta)-Math.cos(0),r=Math.sin(t.dTheta)-Math.sin(0),n=Math.sqrt(z*z/(e*e+r*r));R=Math.max(n,R)}t.r=R,R+=z})),c){let t=0,e=0;for(let r=0;r<O.length;r++){const n=(O[r].r||0)-e;t=Math.max(t,n)}e=0,O.forEach(((r,n)=>{0===n&&(e=r.r||0),r.r=e,e+=t}))}return O.forEach((t=>{const e=t.dTheta||0,r=t.r||0;t.nodes.forEach(((t,n)=>{const o=f+(h?1:-1)*e*n;t.data.x=b[0]+r*Math.cos(o),t.data.y=b[1]+r*Math.sin(o)}))})),t&&E.forEach((t=>r.mergeNodeData(t.id,{x:t.data.x,y:t.data.y}))),{nodes:E,edges:m}}))}}function ge(t,e,r,n){if(isNaN(e)||isNaN(r))return t;var o,i,s,a,u,d,h,c,l,f=t._root,g={data:n},p=t._x0,v=t._y0,y=t._x1,m=t._y1;if(!f)return t._root=g,t;for(;f.length;)if((d=e>=(i=(p+y)/2))?p=i:y=i,(h=r>=(s=(v+m)/2))?v=s:m=s,o=f,!(f=f[c=h<<1|d]))return o[c]=g,t;if(a=+t._x.call(null,f.data),u=+t._y.call(null,f.data),e===a&&r===u)return g.next=f,o?o[c]=g:t._root=g,t;do{o=o?o[c]=new Array(4):t._root=new Array(4),(d=e>=(i=(p+y)/2))?p=i:y=i,(h=r>=(s=(v+m)/2))?v=s:m=s}while((c=h<<1|d)==(l=(u>=s)<<1|a>=i));return o[l]=f,o[c]=g,t}function pe(t,e,r,n,o){this.node=t,this.x0=e,this.y0=r,this.x1=n,this.y1=o}function ve(t){return t[0]}function ye(t){return t[1]}function me(t,e,r){var n=new we(null==e?ve:e,null==r?ye:r,NaN,NaN,NaN,NaN);return null==t?n:n.addAll(t)}function we(t,e,r,n,o,i){this._x=t,this._y=e,this._x0=r,this._y0=n,this._x1=o,this._y1=i,this._root=void 0}function xe(t){for(var e={data:t.data},r=e;t=t.next;)r=r.next={data:t.data};return e}var be=me.prototype=we.prototype;function Ee(t,e,r,n,o){if(isNaN(e)||isNaN(r)||isNaN(n))return t;var i,s,a,u,d,h,c,l,f,g,p,v,y=t._root,m={data:o},w=t._x0,x=t._y0,b=t._z0,E=t._x1,N=t._y1,_=t._z1;if(!y)return t._root=m,t;for(;y.length;)if((l=e>=(s=(w+E)/2))?w=s:E=s,(f=r>=(a=(x+N)/2))?x=a:N=a,(g=n>=(u=(b+_)/2))?b=u:_=u,i=y,!(y=y[p=g<<2|f<<1|l]))return i[p]=m,t;if(d=+t._x.call(null,y.data),h=+t._y.call(null,y.data),c=+t._z.call(null,y.data),e===d&&r===h&&n===c)return m.next=y,i?i[p]=m:t._root=m,t;do{i=i?i[p]=new Array(8):t._root=new Array(8),(l=e>=(s=(w+E)/2))?w=s:E=s,(f=r>=(a=(x+N)/2))?x=a:N=a,(g=n>=(u=(b+_)/2))?b=u:_=u}while((p=g<<2|f<<1|l)==(v=(c>=u)<<2|(h>=a)<<1|d>=s));return i[v]=y,i[p]=m,t}function Ne(t,e,r,n,o,i,s){this.node=t,this.x0=e,this.y0=r,this.z0=n,this.x1=o,this.y1=i,this.z1=s}function _e(t){return t[0]}function Me(t){return t[1]}function ke(t){return t[2]}function Ae(t,e,r,n){var o=new je(null==e?_e:e,null==r?Me:r,null==n?ke:n,NaN,NaN,NaN,NaN,NaN,NaN);return null==t?o:o.addAll(t)}function je(t,e,r,n,o,i,s,a,u){this._x=t,this._y=e,this._z=r,this._x0=n,this._y0=o,this._z0=i,this._x1=s,this._y1=a,this._z1=u,this._root=void 0}function Oe(t){for(var e={data:t.data},r=e;t=t.next;)r=r.next={data:t.data};return e}be.copy=function(){var t,e,r=new we(this._x,this._y,this._x0,this._y0,this._x1,this._y1),n=this._root;if(!n)return r;if(!n.length)return r._root=xe(n),r;for(t=[{source:n,target:r._root=new Array(4)}];n=t.pop();)for(var o=0;o<4;++o)(e=n.source[o])&&(e.length?t.push({source:e,target:n.target[o]=new Array(4)}):n.target[o]=xe(e));return r},be.add=function(t){const e=+this._x.call(null,t),r=+this._y.call(null,t);return ge(this.cover(e,r),e,r,t)},be.addAll=function(t){var e,r,n,o,i=t.length,s=new Array(i),a=new Array(i),u=1/0,d=1/0,h=-1/0,c=-1/0;for(r=0;r<i;++r)isNaN(n=+this._x.call(null,e=t[r]))||isNaN(o=+this._y.call(null,e))||(s[r]=n,a[r]=o,n<u&&(u=n),n>h&&(h=n),o<d&&(d=o),o>c&&(c=o));if(u>h||d>c)return this;for(this.cover(u,d).cover(h,c),r=0;r<i;++r)ge(this,s[r],a[r],t[r]);return this},be.cover=function(t,e){if(isNaN(t=+t)||isNaN(e=+e))return this;var r=this._x0,n=this._y0,o=this._x1,i=this._y1;if(isNaN(r))o=(r=Math.floor(t))+1,i=(n=Math.floor(e))+1;else{for(var s,a,u=o-r||1,d=this._root;r>t||t>=o||n>e||e>=i;)switch(a=(e<n)<<1|t<r,(s=new Array(4))[a]=d,d=s,u*=2,a){case 0:o=r+u,i=n+u;break;case 1:r=o-u,i=n+u;break;case 2:o=r+u,n=i-u;break;case 3:r=o-u,n=i-u}this._root&&this._root.length&&(this._root=d)}return this._x0=r,this._y0=n,this._x1=o,this._y1=i,this},be.data=function(){var t=[];return this.visit((function(e){if(!e.length)do{t.push(e.data)}while(e=e.next)})),t},be.extent=function(t){return arguments.length?this.cover(+t[0][0],+t[0][1]).cover(+t[1][0],+t[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]},be.find=function(t,e,r){var n,o,i,s,a,u,d,h=this._x0,c=this._y0,l=this._x1,f=this._y1,g=[],p=this._root;for(p&&g.push(new pe(p,h,c,l,f)),null==r?r=1/0:(h=t-r,c=e-r,l=t+r,f=e+r,r*=r);u=g.pop();)if(!(!(p=u.node)||(o=u.x0)>l||(i=u.y0)>f||(s=u.x1)<h||(a=u.y1)<c))if(p.length){var v=(o+s)/2,y=(i+a)/2;g.push(new pe(p[3],v,y,s,a),new pe(p[2],o,y,v,a),new pe(p[1],v,i,s,y),new pe(p[0],o,i,v,y)),(d=(e>=y)<<1|t>=v)&&(u=g[g.length-1],g[g.length-1]=g[g.length-1-d],g[g.length-1-d]=u)}else{var m=t-+this._x.call(null,p.data),w=e-+this._y.call(null,p.data),x=m*m+w*w;if(x<r){var b=Math.sqrt(r=x);h=t-b,c=e-b,l=t+b,f=e+b,n=p.data}}return n},be.remove=function(t){if(isNaN(i=+this._x.call(null,t))||isNaN(s=+this._y.call(null,t)))return this;var e,r,n,o,i,s,a,u,d,h,c,l,f=this._root,g=this._x0,p=this._y0,v=this._x1,y=this._y1;if(!f)return this;if(f.length)for(;;){if((d=i>=(a=(g+v)/2))?g=a:v=a,(h=s>=(u=(p+y)/2))?p=u:y=u,e=f,!(f=f[c=h<<1|d]))return this;if(!f.length)break;(e[c+1&3]||e[c+2&3]||e[c+3&3])&&(r=e,l=c)}for(;f.data!==t;)if(n=f,!(f=f.next))return this;return(o=f.next)&&delete f.next,n?(o?n.next=o:delete n.next,this):e?(o?e[c]=o:delete e[c],(f=e[0]||e[1]||e[2]||e[3])&&f===(e[3]||e[2]||e[1]||e[0])&&!f.length&&(r?r[l]=f:this._root=f),this):(this._root=o,this)},be.removeAll=function(t){for(var e=0,r=t.length;e<r;++e)this.remove(t[e]);return this},be.root=function(){return this._root},be.size=function(){var t=0;return this.visit((function(e){if(!e.length)do{++t}while(e=e.next)})),t},be.visit=function(t){var e,r,n,o,i,s,a=[],u=this._root;for(u&&a.push(new pe(u,this._x0,this._y0,this._x1,this._y1));e=a.pop();)if(!t(u=e.node,n=e.x0,o=e.y0,i=e.x1,s=e.y1)&&u.length){var d=(n+i)/2,h=(o+s)/2;(r=u[3])&&a.push(new pe(r,d,h,i,s)),(r=u[2])&&a.push(new pe(r,n,h,d,s)),(r=u[1])&&a.push(new pe(r,d,o,i,h)),(r=u[0])&&a.push(new pe(r,n,o,d,h))}return this},be.visitAfter=function(t){var e,r=[],n=[];for(this._root&&r.push(new pe(this._root,this._x0,this._y0,this._x1,this._y1));e=r.pop();){var o=e.node;if(o.length){var i,s=e.x0,a=e.y0,u=e.x1,d=e.y1,h=(s+u)/2,c=(a+d)/2;(i=o[0])&&r.push(new pe(i,s,a,h,c)),(i=o[1])&&r.push(new pe(i,h,a,u,c)),(i=o[2])&&r.push(new pe(i,s,c,h,d)),(i=o[3])&&r.push(new pe(i,h,c,u,d))}n.push(e)}for(;e=n.pop();)t(e.node,e.x0,e.y0,e.x1,e.y1);return this},be.x=function(t){return arguments.length?(this._x=t,this):this._x},be.y=function(t){return arguments.length?(this._y=t,this):this._y};var Se=Ae.prototype=je.prototype;function ze(t){let e=0,r=0,n=0,o=0,i=0;const s=t.length;if(s){for(let a=0;a<s;a++){const s=t[a];s&&s.weight&&(e+=s.weight,r+=s.x*s.weight,n+=s.y*s.weight,o+=s.z*s.weight,i+=s.size*s.weight)}t.x=r/e,t.y=n/e,t.z=o/e,t.size=i/e,t.weight=e}else{const e=t;t.x=e.data.x,t.y=e.data.y,t.z=e.data.z,t.size=e.data.size,t.weight=e.data.weight}}Se.copy=function(){var t,e,r=new je(this._x,this._y,this._z,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1),n=this._root;if(!n)return r;if(!n.length)return r._root=Oe(n),r;for(t=[{source:n,target:r._root=new Array(8)}];n=t.pop();)for(var o=0;o<8;++o)(e=n.source[o])&&(e.length?t.push({source:e,target:n.target[o]=new Array(8)}):n.target[o]=Oe(e));return r},Se.add=function(t){const e=+this._x.call(null,t),r=+this._y.call(null,t),n=+this._z.call(null,t);return Ee(this.cover(e,r,n),e,r,n,t)},Se.addAll=function(t){Array.isArray(t)||(t=Array.from(t));const e=t.length,r=new Float64Array(e),n=new Float64Array(e),o=new Float64Array(e);let i=1/0,s=1/0,a=1/0,u=-1/0,d=-1/0,h=-1/0;for(let c,l,f,g,p=0;p<e;++p)isNaN(l=+this._x.call(null,c=t[p]))||isNaN(f=+this._y.call(null,c))||isNaN(g=+this._z.call(null,c))||(r[p]=l,n[p]=f,o[p]=g,l<i&&(i=l),l>u&&(u=l),f<s&&(s=f),f>d&&(d=f),g<a&&(a=g),g>h&&(h=g));if(i>u||s>d||a>h)return this;this.cover(i,s,a).cover(u,d,h);for(let i=0;i<e;++i)Ee(this,r[i],n[i],o[i],t[i]);return this},Se.cover=function(t,e,r){if(isNaN(t=+t)||isNaN(e=+e)||isNaN(r=+r))return this;var n=this._x0,o=this._y0,i=this._z0,s=this._x1,a=this._y1,u=this._z1;if(isNaN(n))s=(n=Math.floor(t))+1,a=(o=Math.floor(e))+1,u=(i=Math.floor(r))+1;else{for(var d,h,c=s-n||1,l=this._root;n>t||t>=s||o>e||e>=a||i>r||r>=u;)switch(h=(r<i)<<2|(e<o)<<1|t<n,(d=new Array(8))[h]=l,l=d,c*=2,h){case 0:s=n+c,a=o+c,u=i+c;break;case 1:n=s-c,a=o+c,u=i+c;break;case 2:s=n+c,o=a-c,u=i+c;break;case 3:n=s-c,o=a-c,u=i+c;break;case 4:s=n+c,a=o+c,i=u-c;break;case 5:n=s-c,a=o+c,i=u-c;break;case 6:s=n+c,o=a-c,i=u-c;break;case 7:n=s-c,o=a-c,i=u-c}this._root&&this._root.length&&(this._root=l)}return this._x0=n,this._y0=o,this._z0=i,this._x1=s,this._y1=a,this._z1=u,this},Se.data=function(){var t=[];return this.visit((function(e){if(!e.length)do{t.push(e.data)}while(e=e.next)})),t},Se.extent=function(t){return arguments.length?this.cover(+t[0][0],+t[0][1],+t[0][2]).cover(+t[1][0],+t[1][1],+t[1][2]):isNaN(this._x0)?void 0:[[this._x0,this._y0,this._z0],[this._x1,this._y1,this._z1]]},Se.find=function(t,e,r,n){var o,i,s,a,u,d,h,c,l,f=this._x0,g=this._y0,p=this._z0,v=this._x1,y=this._y1,m=this._z1,w=[],x=this._root;for(x&&w.push(new Ne(x,f,g,p,v,y,m)),null==n?n=1/0:(f=t-n,g=e-n,p=r-n,v=t+n,y=e+n,m=r+n,n*=n);c=w.pop();)if(!(!(x=c.node)||(i=c.x0)>v||(s=c.y0)>y||(a=c.z0)>m||(u=c.x1)<f||(d=c.y1)<g||(h=c.z1)<p))if(x.length){var b=(i+u)/2,E=(s+d)/2,N=(a+h)/2;w.push(new Ne(x[7],b,E,N,u,d,h),new Ne(x[6],i,E,N,b,d,h),new Ne(x[5],b,s,N,u,E,h),new Ne(x[4],i,s,N,b,E,h),new Ne(x[3],b,E,a,u,d,N),new Ne(x[2],i,E,a,b,d,N),new Ne(x[1],b,s,a,u,E,N),new Ne(x[0],i,s,a,b,E,N)),(l=(r>=N)<<2|(e>=E)<<1|t>=b)&&(c=w[w.length-1],w[w.length-1]=w[w.length-1-l],w[w.length-1-l]=c)}else{var _=t-+this._x.call(null,x.data),M=e-+this._y.call(null,x.data),k=r-+this._z.call(null,x.data),A=_*_+M*M+k*k;if(A<n){var j=Math.sqrt(n=A);f=t-j,g=e-j,p=r-j,v=t+j,y=e+j,m=r+j,o=x.data}}return o},Se.remove=function(t){if(isNaN(i=+this._x.call(null,t))||isNaN(s=+this._y.call(null,t))||isNaN(a=+this._z.call(null,t)))return this;var e,r,n,o,i,s,a,u,d,h,c,l,f,g,p,v=this._root,y=this._x0,m=this._y0,w=this._z0,x=this._x1,b=this._y1,E=this._z1;if(!v)return this;if(v.length)for(;;){if((c=i>=(u=(y+x)/2))?y=u:x=u,(l=s>=(d=(m+b)/2))?m=d:b=d,(f=a>=(h=(w+E)/2))?w=h:E=h,e=v,!(v=v[g=f<<2|l<<1|c]))return this;if(!v.length)break;(e[g+1&7]||e[g+2&7]||e[g+3&7]||e[g+4&7]||e[g+5&7]||e[g+6&7]||e[g+7&7])&&(r=e,p=g)}for(;v.data!==t;)if(n=v,!(v=v.next))return this;return(o=v.next)&&delete v.next,n?(o?n.next=o:delete n.next,this):e?(o?e[g]=o:delete e[g],(v=e[0]||e[1]||e[2]||e[3]||e[4]||e[5]||e[6]||e[7])&&v===(e[7]||e[6]||e[5]||e[4]||e[3]||e[2]||e[1]||e[0])&&!v.length&&(r?r[p]=v:this._root=v),this):(this._root=o,this)},Se.removeAll=function(t){for(var e=0,r=t.length;e<r;++e)this.remove(t[e]);return this},Se.root=function(){return this._root},Se.size=function(){var t=0;return this.visit((function(e){if(!e.length)do{++t}while(e=e.next)})),t},Se.visit=function(t){var e,r,n,o,i,s,a,u,d=[],h=this._root;for(h&&d.push(new Ne(h,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));e=d.pop();)if(!t(h=e.node,n=e.x0,o=e.y0,i=e.z0,s=e.x1,a=e.y1,u=e.z1)&&h.length){var c=(n+s)/2,l=(o+a)/2,f=(i+u)/2;(r=h[7])&&d.push(new Ne(r,c,l,f,s,a,u)),(r=h[6])&&d.push(new Ne(r,n,l,f,c,a,u)),(r=h[5])&&d.push(new Ne(r,c,o,f,s,l,u)),(r=h[4])&&d.push(new Ne(r,n,o,f,c,l,u)),(r=h[3])&&d.push(new Ne(r,c,l,i,s,a,f)),(r=h[2])&&d.push(new Ne(r,n,l,i,c,a,f)),(r=h[1])&&d.push(new Ne(r,c,o,i,s,l,f)),(r=h[0])&&d.push(new Ne(r,n,o,i,c,l,f))}return this},Se.visitAfter=function(t){var e,r=[],n=[];for(this._root&&r.push(new Ne(this._root,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));e=r.pop();){var o=e.node;if(o.length){var i,s=e.x0,a=e.y0,u=e.z0,d=e.x1,h=e.y1,c=e.z1,l=(s+d)/2,f=(a+h)/2,g=(u+c)/2;(i=o[0])&&r.push(new Ne(i,s,a,u,l,f,g)),(i=o[1])&&r.push(new Ne(i,l,a,u,d,f,g)),(i=o[2])&&r.push(new Ne(i,s,f,u,l,h,g)),(i=o[3])&&r.push(new Ne(i,l,f,u,d,h,g)),(i=o[4])&&r.push(new Ne(i,s,a,g,l,f,c)),(i=o[5])&&r.push(new Ne(i,l,a,g,d,f,c)),(i=o[6])&&r.push(new Ne(i,s,f,g,l,h,c)),(i=o[7])&&r.push(new Ne(i,l,f,g,d,h,c))}n.push(e)}for(;e=n.pop();)t(e.node,e.x0,e.y0,e.z0,e.x1,e.y1,e.z1);return this},Se.x=function(t){return arguments.length?(this._x=t,this):this._x},Se.y=function(t){return arguments.length?(this._y=t,this):this._y},Se.z=function(t){return arguments.length?(this._z=t,this):this._z};const Re=(t,e,r,n,o,i,s)=>{var a;if((null===(a=t.data)||void 0===a?void 0:a.id)===i.id)return;const u=[r,n,o][s-1],d=i.x-t.x||.1,h=i.y-t.y||.1,c=i.z-t.z||.1,l=[d,h,c],f=u-e;let g=0;for(let t=0;t<s;t++)g+=l[t]*l[t];const p=Math.sqrt(g)*g;if(f*f*.81<g){const e=t.weight/p;return i.vx+=d*e,i.vy+=h*e,i.vz+=c*e,!0}if(t.length)return!1;if(t.data!==i){const e=t.data.weight/p;i.vx+=d*e,i.vy+=h*e,i.vz+=c*e}},Ie={dimensions:2,maxIteration:500,gravity:10,factor:1,edgeStrength:50,nodeStrength:1e3,coulombDisScale:.005,damping:.9,maxSpeed:200,minMovement:.4,interval:.02,linkDistance:200,clusterNodeStrength:20,preventOverlap:!0,distanceThresholdMode:"mean"};class Pe{constructor(t={}){this.options=t,this.id="force",this.timeInterval=0,this.judgingDistance=0,this.running=!1,this.options=Object.assign(Object.assign({},Ie),t)}execute(t,r){return e(this,void 0,void 0,(function*(){return this.genericForceLayout(!1,t,r)}))}assign(t,r){return e(this,void 0,void 0,(function*(){yield this.genericForceLayout(!0,t,r)}))}stop(){this.timeInterval&&"undefined"!=typeof window&&window.clearInterval(this.timeInterval),this.running=!1}tick(t=this.options.maxIteration||1){if(this.lastResult)return this.lastResult;for(let e=0;(this.judgingDistance>this.lastOptions.minMovement||e<1)&&e<t;e++)this.runOneStep(this.lastCalcGraph,this.lastGraph,e,this.lastVelMap,this.lastOptions),this.updatePosition(this.lastGraph,this.lastCalcGraph,this.lastVelMap,this.lastOptions);const e={nodes:this.lastLayoutNodes,edges:this.lastLayoutEdges};return this.lastAssign&&e.nodes.forEach((t=>this.lastGraph.mergeNodeData(t.id,{x:t.data.x,y:t.data.y,z:3===this.options.dimensions?t.data.z:void 0}))),e}genericForceLayout(t,r,n){return e(this,void 0,void 0,(function*(){const e=Object.assign(Object.assign({},this.options),n),o=r.getAllNodes(),i=r.getAllEdges(),s=this.formatOptions(e,r),{dimensions:a,width:u,height:d,nodeSize:h,getMass:c,nodeStrength:l,edgeStrength:g,linkDistance:p}=s,y=o.map(((t,e)=>Object.assign(Object.assign({},t),{data:Object.assign(Object.assign({},t.data),{x:v(t.data.x)?t.data.x:Math.random()*u,y:v(t.data.y)?t.data.y:Math.random()*d,z:v(t.data.z)?t.data.z:Math.random()*Math.sqrt(u*d),size:h(t)||30,mass:c(t),nodeStrength:l(t)})}))),m=i.map((t=>Object.assign(Object.assign({},t),{data:Object.assign(Object.assign({},t.data),{edgeStrength:g(t),linkDistance:p(t,r.getNode(t.source),r.getNode(t.target))})})));if(!(null==o?void 0:o.length))return this.lastResult={nodes:[],edges:i},{nodes:[],edges:i};const w={};o.forEach(((t,e)=>{w[t.id]={x:0,y:0,z:0}}));const x=new f({nodes:y,edges:m});this.formatCentripetal(s,x);const{maxIteration:b,minMovement:E,onTick:N}=s;if(this.lastLayoutNodes=y,this.lastLayoutEdges=m,this.lastAssign=t,this.lastGraph=r,this.lastCalcGraph=x,this.lastOptions=s,this.lastVelMap=w,"undefined"==typeof window)return;let _=0;return new Promise((e=>{this.timeInterval=window.setInterval((()=>{o&&this.running||e({nodes:Fe(r,y),edges:i}),this.runOneStep(x,r,_,w,s),this.updatePosition(r,x,w,s),t&&y.forEach((t=>r.mergeNodeData(t.id,{x:t.data.x,y:t.data.y,z:3===a?t.data.z:void 0}))),null==N||N({nodes:Fe(r,y),edges:i}),_++,(_>=b||this.judgingDistance<E)&&(window.clearInterval(this.timeInterval),e({nodes:Fe(r,y),edges:i}))}),0),this.running=!0}))}))}formatOptions(t,e){const r=Object.assign({},t),{width:n,height:o,getMass:i}=t;r.width=n||"undefined"==typeof window?n:window.innerWidth,r.height=o||"undefined"==typeof window?o:window.innerHeight,t.center||(r.center=[r.width/2,r.height/2]),i||(r.getMass=t=>{let r=1;v(null==t?void 0:t.data.mass)&&(r=null==t?void 0:t.data.mass);const n=e.getDegree(t.id,"both");return!n||n<5?r:5*n*r}),r.nodeSize=Zt(t.nodeSize,t.nodeSpacing);const s=t.linkDistance?Xt(1,t.linkDistance):t=>1+r.nodeSize(e.getNode(t.source))+r.nodeSize(e.getNode(t.target));return r.linkDistance=s,r.nodeStrength=Xt(1,t.nodeStrength),r.edgeStrength=Xt(1,t.edgeStrength),r}formatCentripetal(t,e){const{dimensions:r,centripetalOptions:n,center:o,clusterNodeStrength:i,leafCluster:s,clustering:a,nodeClusterBy:u}=t,d=e.getAllNodes(),h=n||{leaf:2,single:2,others:1,center:t=>({x:o[0],y:o[1],z:3===r?o[2]:void 0})};let c,l;if("function"!=typeof i&&(t.clusterNodeStrength=t=>i),s&&u&&(c=Ce(e,u),l=Array.from(new Set(null==d?void 0:d.map((t=>t.data[u]))))||[],t.centripetalOptions=Object.assign(h,{single:100,leaf:e=>{const{siblingLeaves:r,sameTypeLeaves:n}=c[e.id]||{};return(null==n?void 0:n.length)===(null==r?void 0:r.length)||1===(null==l?void 0:l.length)?1:t.clusterNodeStrength(e)},others:1,center:t=>{const r=e.getDegree(t.id,"both");if(!r)return{x:100,y:100,z:0};let n;if(1===r){const{sameTypeLeaves:e=[]}=c[t.id]||{};1===e.length?n=void 0:e.length>1&&(n=Le(e))}else n=void 0;return{x:null==n?void 0:n.x,y:null==n?void 0:n.y,z:null==n?void 0:n.z}}})),a&&u){c||(c=Ce(e,u)),l||(l=Array.from(new Set(d.map((t=>t.data[u]))))),l=l.filter((t=>void 0!==t));const r={};l.forEach((t=>{const n=d.filter((e=>e.data[u]===t)).map((t=>e.getNode(t.id)));r[t]=Le(n)})),t.centripetalOptions=Object.assign(h,{single:e=>t.clusterNodeStrength(e),leaf:e=>t.clusterNodeStrength(e),others:e=>t.clusterNodeStrength(e),center:t=>{const e=r[t.data[u]];return{x:null==e?void 0:e.x,y:null==e?void 0:e.y,z:null==e?void 0:e.z}}})}const{leaf:f,single:g,others:p}=t.centripetalOptions||{};f&&"function"!=typeof f&&(t.centripetalOptions.leaf=()=>f),g&&"function"!=typeof g&&(t.centripetalOptions.single=()=>g),p&&"function"!=typeof p&&(t.centripetalOptions.others=()=>p)}runOneStep(t,e,r,n,o){const i={},s=t.getAllNodes(),a=t.getAllEdges();if(!(null==s?void 0:s.length))return;const{monitor:u}=o;this.calRepulsive(t,i,o),a&&this.calAttractive(t,i,o),this.calGravity(t,e,i,o),this.updateVelocity(t,i,n,o),u&&u({energy:this.calTotalEnergy(i,s),nodes:e.getAllNodes(),edges:e.getAllEdges(),iterations:r})}calTotalEnergy(t,e){if(!(null==e?void 0:e.length))return 0;let r=0;return e.forEach(((e,n)=>{const o=t[e.id].x,i=t[e.id].y,s=3===this.options.dimensions?t[e.id].z:0,a=o*o+i*i+s*s,{mass:u=1}=e.data;r+=u*a*.5})),r}calRepulsive(t,e,r){const{dimensions:n,factor:o,coulombDisScale:i}=r;!function(t,e,r,n,o=2){const i=e/r,s=t.getAllNodes(),a=s.map(((t,e)=>{const{nodeStrength:r,x:n,y:o,z:s,size:a}=t.data;return{x:n,y:o,z:s,size:a,index:e,id:t.id,vx:0,vy:0,vz:0,weight:i*r}})),u=(2===o?me(a,(t=>t.x),(t=>t.y)):Ae(a,(t=>t.x),(t=>t.y),(t=>t.z))).visitAfter(ze),d=new Map;a.forEach((t=>{d.set(t.id,t),function(t,e,r){e.visit(((e,n,o,i,s)=>Re(e,n,o,i,s,t,r)))}(t,u,o)})),a.map(((t,e)=>{const{id:r,data:o}=s[e],{mass:i=1}=o;n[r]={x:t.vx/i,y:t.vy/i,z:t.vz/i}}))}(t,o,i*i,e,n)}calAttractive(t,e,r){const{dimensions:n,nodeSize:o}=r;t.getAllEdges().forEach(((r,i)=>{const{source:s,target:a}=r,u=t.getNode(s),d=t.getNode(a);if(!u||!d)return;let h=d.data.x-u.data.x,c=d.data.y-u.data.y,l=3===n?d.data.z-u.data.z:0;h||c||(h=.01*Math.random(),c=.01*Math.random(),3!==n||l||(l=.01*Math.random()));const f=Math.sqrt(h*h+c*c+l*l);if(f<o(u)+o(d))return;const g=h/f,p=c/f,v=l/f,{linkDistance:y=200,edgeStrength:m=200}=r.data||{},w=(y-f)*m,x=1/(u.data.mass||1),b=1/(d.data.mass||1),E=g*w,N=p*w,_=v*w;e[s].x-=E*x,e[s].y-=N*x,e[s].z-=_*x,e[a].x+=E*b,e[a].y+=N*b,e[a].z+=_*b}))}calGravity(t,e,r,n){const{getCenter:o}=n,i=t.getAllNodes(),s=e.getAllNodes(),a=e.getAllEdges(),{width:u,height:d,center:h,gravity:c,centripetalOptions:l}=n;i&&i.forEach((n=>{const{id:i,data:f}=n,{mass:g,x:p,y,z:m}=f,w=e.getNode(i);let x=0,b=0,E=0,N=c;const _=t.getDegree(i,"in"),M=t.getDegree(i,"out"),k=t.getDegree(i,"both"),A=null==o?void 0:o(w,k);if(A){const[t,e,r]=A;x=p-t,b=y-e,N=r}else x=p-h[0],b=y-h[1],E=m-h[2];if(N&&(r[i].x-=N*x/g,r[i].y-=N*b/g,r[i].z-=N*E/g),l){const{leaf:t,single:e,others:n,center:o}=l,{x:h,y:c,z:f,centerStrength:x}=(null==o?void 0:o(w,s,a,u,d))||{x:0,y:0,z:0,centerStrength:0};if(!v(h)||!v(c))return;const b=(p-h)/g,E=(y-c)/g,N=(m-f)/g;if(x&&(r[i].x-=x*b,r[i].y-=x*E,r[i].z-=x*N),0===k){const t=e(w);if(!t)return;return r[i].x-=t*b,r[i].y-=t*E,void(r[i].z-=t*N)}if(0===_||0===M){const e=t(w,s,a);if(!e)return;return r[i].x-=e*b,r[i].y-=e*E,void(r[i].z-=e*N)}const A=n(w);if(!A)return;r[i].x-=A*b,r[i].y-=A*E,r[i].z-=A*N}}))}updateVelocity(t,e,r,n){const{damping:o,maxSpeed:i,interval:s,dimensions:a}=n,u=t.getAllNodes();(null==u?void 0:u.length)&&u.forEach((t=>{const{id:n}=t;let u=(r[n].x+e[n].x*s)*o||.01,d=(r[n].y+e[n].y*s)*o||.01,h=3===a?(r[n].z+e[n].z*s)*o||.01:0;const c=Math.sqrt(u*u+d*d+h*h);if(c>i){const t=i/c;u*=t,d*=t,h*=t}r[n]={x:u,y:d,z:h}}))}updatePosition(t,e,r,n){const{distanceThresholdMode:o,interval:i,dimensions:s}=n,a=e.getAllNodes();if(!(null==a?void 0:a.length))return void(this.judgingDistance=0);let u=0;"max"===o?this.judgingDistance=-1/0:"min"===o&&(this.judgingDistance=1/0),a.forEach((n=>{const{id:a}=n,d=t.getNode(a);if(v(d.data.fx)&&v(d.data.fy))return void e.mergeNodeData(a,{x:d.data.fx,y:d.data.fy,z:3===s?d.data.fz:void 0});const h=r[a].x*i,c=r[a].y*i,l=3===s?r[a].z*i:0;e.mergeNodeData(a,{x:n.data.x+h,y:n.data.y+c,z:n.data.z+l});const f=Math.sqrt(h*h+c*c+l*l);switch(o){case"max":this.judgingDistance<f&&(this.judgingDistance=f);break;case"min":this.judgingDistance>f&&(this.judgingDistance=f);break;default:u+=f}})),o&&"mean"!==o||(this.judgingDistance=u/a.length)}}const Ce=(t,e)=>{const r=t.getAllNodes();if(!(null==r?void 0:r.length))return{};const n={};return r.forEach(((r,o)=>{1===t.getDegree(r.id,"both")&&(n[r.id]=De(t,"leaf",r,e))})),n},De=(t,e,r,n)=>{const o=t.getDegree(r.id,"in"),i=t.getDegree(r.id,"out");let s=r,a=[];return 0===o?(s=t.getSuccessors(r.id)[0],a=t.getNeighbors(s.id)):0===i&&(s=t.getPredecessors(r.id)[0],a=t.getNeighbors(s.id)),a=a.filter((e=>0===t.getDegree(e.id,"in")||0===t.getDegree(e.id,"out"))),{coreNode:s,siblingLeaves:a,sameTypeLeaves:Te(t,e,n,r,a)}},Te=(t,e,r,n,o)=>{const i=n.data[r]||"";let s=(null==o?void 0:o.filter((t=>t.data[r]===i)))||[];return"leaf"===e&&(s=s.filter((e=>0===t.getDegree(e.id,"in")||0===t.getDegree(e.id,"out")))),s},Le=t=>{const e={x:0,y:0};t.forEach((t=>{const{x:r,y:n}=t.data;e.x+=r||0,e.y+=n||0}));const r=t.length||1;return{x:e.x/r,y:e.y/r}},Fe=(t,e)=>e.map((e=>{const{id:r,data:n}=e,o=t.getNode(r);return Object.assign(Object.assign({},o),{data:Object.assign(Object.assign({},o.data),{x:n.x,y:n.y,z:n.z})})})),qe=Object.prototype.toString;function Ve(t){const e=qe.call(t);return e.endsWith("Array]")&&!e.includes("Big")}function Be(t){var e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!Ve(t))throw new TypeError("input must be an array");if(0===t.length)throw new TypeError("input must not be empty");if(void 0!==r.output){if(!Ve(r.output))throw new TypeError("output option must be an array if specified");e=r.output}else e=new Array(t.length);var n=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!Ve(t))throw new TypeError("input must be an array");if(0===t.length)throw new TypeError("input must not be empty");var r=e.fromIndex,n=void 0===r?0:r,o=e.toIndex,i=void 0===o?t.length:o;if(n<0||n>=t.length||!Number.isInteger(n))throw new Error("fromIndex must be a positive integer smaller than length");if(i<=n||i>t.length||!Number.isInteger(i))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var s=t[n],a=n+1;a<i;a++)t[a]<s&&(s=t[a]);return s}(t),o=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!Ve(t))throw new TypeError("input must be an array");if(0===t.length)throw new TypeError("input must not be empty");var r=e.fromIndex,n=void 0===r?0:r,o=e.toIndex,i=void 0===o?t.length:o;if(n<0||n>=t.length||!Number.isInteger(n))throw new Error("fromIndex must be a positive integer smaller than length");if(i<=n||i>t.length||!Number.isInteger(i))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var s=t[n],a=n+1;a<i;a++)t[a]>s&&(s=t[a]);return s}(t);if(n===o)throw new RangeError("minimum and maximum input values are equal. Cannot rescale a constant array");var i=r.min,s=void 0===i?r.autoMinMax?n:0:i,a=r.max,u=void 0===a?r.autoMinMax?o:1:a;if(s>=u)throw new RangeError("min option must be smaller than max option");for(var d=(u-s)/(o-n),h=0;h<t.length;h++)e[h]=(t[h]-n)*d+s;return e}const $e=" ".repeat(2),Ge=" ".repeat(4);function Ue(t,e={}){const{maxRows:r=15,maxColumns:n=10,maxNumSize:o=8,padMinus:i="auto"}=e;return`${t.constructor.name} {\n${$e}[\n${Ge}${function(t,e,r,n,o){const{rows:i,columns:s}=t,a=Math.min(i,e),u=Math.min(s,r),d=[];if("auto"===o){o=!1;t:for(let e=0;e<a;e++)for(let r=0;r<u;r++)if(t.get(e,r)<0){o=!0;break t}}for(let e=0;e<a;e++){let r=[];for(let i=0;i<u;i++)r.push(We(t.get(e,i),n,o));d.push(`${r.join(" ")}`)}return u!==s&&(d[d.length-1]+=` ... ${s-r} more columns`),a!==i&&d.push(`... ${i-e} more rows`),d.join(`\n${Ge}`)}(t,r,n,o,i)}\n${$e}]\n${$e}rows: ${t.rows}\n${$e}columns: ${t.columns}\n}`}function We(t,e,r){return(t>=0&&r?` ${Ye(t,e-1)}`:Ye(t,e)).padEnd(e)}function Ye(t,e){let r=t.toString();if(r.length<=e)return r;let n=t.toFixed(e);if(n.length>e&&(n=t.toFixed(Math.max(0,e-(n.length-e)))),n.length<=e&&!n.startsWith("0.000")&&!n.startsWith("-0.000"))return n;let o=t.toExponential(e);return o.length>e&&(o=t.toExponential(Math.max(0,e-(o.length-e)))),o.slice(0)}function Ke(t,e,r){let n=r?t.rows:t.rows-1;if(e<0||e>n)throw new RangeError("Row index out of range")}function Je(t,e,r){let n=r?t.columns:t.columns-1;if(e<0||e>n)throw new RangeError("Column index out of range")}function He(t,e){if(e.to1DArray&&(e=e.to1DArray()),e.length!==t.columns)throw new RangeError("vector size must be the same as the number of columns");return e}function Xe(t,e){if(e.to1DArray&&(e=e.to1DArray()),e.length!==t.rows)throw new RangeError("vector size must be the same as the number of rows");return e}function Qe(t,e,r,n,o){if(5!==arguments.length)throw new RangeError("expected 4 arguments");if(tr("startRow",e),tr("endRow",r),tr("startColumn",n),tr("endColumn",o),e>r||n>o||e<0||e>=t.rows||r<0||r>=t.rows||n<0||n>=t.columns||o<0||o>=t.columns)throw new RangeError("Submatrix indices are out of range")}function Ze(t,e=0){let r=[];for(let n=0;n<t;n++)r.push(e);return r}function tr(t,e){if("number"!=typeof e)throw new TypeError(`${t} must be a number`)}function er(t){if(t.isEmpty())throw new Error("Empty matrix has no elements to index")}class rr{static from1DArray(t,e,r){if(t*e!==r.length)throw new RangeError("data length does not match given dimensions");let n=new or(t,e);for(let o=0;o<t;o++)for(let t=0;t<e;t++)n.set(o,t,r[o*e+t]);return n}static rowVector(t){let e=new or(1,t.length);for(let r=0;r<t.length;r++)e.set(0,r,t[r]);return e}static columnVector(t){let e=new or(t.length,1);for(let r=0;r<t.length;r++)e.set(r,0,t[r]);return e}static zeros(t,e){return new or(t,e)}static ones(t,e){return new or(t,e).fill(1)}static rand(t,e,r={}){if("object"!=typeof r)throw new TypeError("options must be an object");const{random:n=Math.random}=r;let o=new or(t,e);for(let r=0;r<t;r++)for(let t=0;t<e;t++)o.set(r,t,n());return o}static randInt(t,e,r={}){if("object"!=typeof r)throw new TypeError("options must be an object");const{min:n=0,max:o=1e3,random:i=Math.random}=r;if(!Number.isInteger(n))throw new TypeError("min must be an integer");if(!Number.isInteger(o))throw new TypeError("max must be an integer");if(n>=o)throw new RangeError("min must be smaller than max");let s=o-n,a=new or(t,e);for(let r=0;r<t;r++)for(let t=0;t<e;t++){let e=n+Math.round(i()*s);a.set(r,t,e)}return a}static eye(t,e,r){void 0===e&&(e=t),void 0===r&&(r=1);let n=Math.min(t,e),o=this.zeros(t,e);for(let t=0;t<n;t++)o.set(t,t,r);return o}static diag(t,e,r){let n=t.length;void 0===e&&(e=n),void 0===r&&(r=e);let o=Math.min(n,e,r),i=this.zeros(e,r);for(let e=0;e<o;e++)i.set(e,e,t[e]);return i}static min(t,e){t=this.checkMatrix(t),e=this.checkMatrix(e);let r=t.rows,n=t.columns,o=new or(r,n);for(let i=0;i<r;i++)for(let r=0;r<n;r++)o.set(i,r,Math.min(t.get(i,r),e.get(i,r)));return o}static max(t,e){t=this.checkMatrix(t),e=this.checkMatrix(e);let r=t.rows,n=t.columns,o=new this(r,n);for(let i=0;i<r;i++)for(let r=0;r<n;r++)o.set(i,r,Math.max(t.get(i,r),e.get(i,r)));return o}static checkMatrix(t){return rr.isMatrix(t)?t:new or(t)}static isMatrix(t){return null!=t&&"Matrix"===t.klass}get size(){return this.rows*this.columns}apply(t){if("function"!=typeof t)throw new TypeError("callback must be a function");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)t.call(this,e,r);return this}to1DArray(){let t=[];for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)t.push(this.get(e,r));return t}to2DArray(){let t=[];for(let e=0;e<this.rows;e++){t.push([]);for(let r=0;r<this.columns;r++)t[e].push(this.get(e,r))}return t}toJSON(){return this.to2DArray()}isRowVector(){return 1===this.rows}isColumnVector(){return 1===this.columns}isVector(){return 1===this.rows||1===this.columns}isSquare(){return this.rows===this.columns}isEmpty(){return 0===this.rows||0===this.columns}isSymmetric(){if(this.isSquare()){for(let t=0;t<this.rows;t++)for(let e=0;e<=t;e++)if(this.get(t,e)!==this.get(e,t))return!1;return!0}return!1}isEchelonForm(){let t=0,e=0,r=-1,n=!0,o=!1;for(;t<this.rows&&n;){for(e=0,o=!1;e<this.columns&&!1===o;)0===this.get(t,e)?e++:1===this.get(t,e)&&e>r?(o=!0,r=e):(n=!1,o=!0);t++}return n}isReducedEchelonForm(){let t=0,e=0,r=-1,n=!0,o=!1;for(;t<this.rows&&n;){for(e=0,o=!1;e<this.columns&&!1===o;)0===this.get(t,e)?e++:1===this.get(t,e)&&e>r?(o=!0,r=e):(n=!1,o=!0);for(let r=e+1;r<this.rows;r++)0!==this.get(t,r)&&(n=!1);t++}return n}echelonForm(){let t=this.clone(),e=0,r=0;for(;e<t.rows&&r<t.columns;){let n=e;for(let o=e;o<t.rows;o++)t.get(o,r)>t.get(n,r)&&(n=o);if(0===t.get(n,r))r++;else{t.swapRows(e,n);let o=t.get(e,r);for(let n=r;n<t.columns;n++)t.set(e,n,t.get(e,n)/o);for(let n=e+1;n<t.rows;n++){let o=t.get(n,r)/t.get(e,r);t.set(n,r,0);for(let i=r+1;i<t.columns;i++)t.set(n,i,t.get(n,i)-t.get(e,i)*o)}e++,r++}}return t}reducedEchelonForm(){let t=this.echelonForm(),e=t.columns,r=t.rows,n=r-1;for(;n>=0;)if(0===t.maxRow(n))n--;else{let o=0,i=!1;for(;o<r&&!1===i;)1===t.get(n,o)?i=!0:o++;for(let r=0;r<n;r++){let i=t.get(r,o);for(let s=o;s<e;s++){let e=t.get(r,s)-i*t.get(n,s);t.set(r,s,e)}}n--}return t}set(){throw new Error("set method is unimplemented")}get(){throw new Error("get method is unimplemented")}repeat(t={}){if("object"!=typeof t)throw new TypeError("options must be an object");const{rows:e=1,columns:r=1}=t;if(!Number.isInteger(e)||e<=0)throw new TypeError("rows must be a positive integer");if(!Number.isInteger(r)||r<=0)throw new TypeError("columns must be a positive integer");let n=new or(this.rows*e,this.columns*r);for(let t=0;t<e;t++)for(let e=0;e<r;e++)n.setSubMatrix(this,this.rows*t,this.columns*e);return n}fill(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,t);return this}neg(){return this.mulS(-1)}getRow(t){Ke(this,t);let e=[];for(let r=0;r<this.columns;r++)e.push(this.get(t,r));return e}getRowVector(t){return or.rowVector(this.getRow(t))}setRow(t,e){Ke(this,t),e=He(this,e);for(let r=0;r<this.columns;r++)this.set(t,r,e[r]);return this}swapRows(t,e){Ke(this,t),Ke(this,e);for(let r=0;r<this.columns;r++){let n=this.get(t,r);this.set(t,r,this.get(e,r)),this.set(e,r,n)}return this}getColumn(t){Je(this,t);let e=[];for(let r=0;r<this.rows;r++)e.push(this.get(r,t));return e}getColumnVector(t){return or.columnVector(this.getColumn(t))}setColumn(t,e){Je(this,t),e=Xe(this,e);for(let r=0;r<this.rows;r++)this.set(r,t,e[r]);return this}swapColumns(t,e){Je(this,t),Je(this,e);for(let r=0;r<this.rows;r++){let n=this.get(r,t);this.set(r,t,this.get(r,e)),this.set(r,e,n)}return this}addRowVector(t){t=He(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)+t[r]);return this}subRowVector(t){t=He(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)-t[r]);return this}mulRowVector(t){t=He(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)*t[r]);return this}divRowVector(t){t=He(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)/t[r]);return this}addColumnVector(t){t=Xe(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)+t[e]);return this}subColumnVector(t){t=Xe(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)-t[e]);return this}mulColumnVector(t){t=Xe(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)*t[e]);return this}divColumnVector(t){t=Xe(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)/t[e]);return this}mulRow(t,e){Ke(this,t);for(let r=0;r<this.columns;r++)this.set(t,r,this.get(t,r)*e);return this}mulColumn(t,e){Je(this,t);for(let r=0;r<this.rows;r++)this.set(r,t,this.get(r,t)*e);return this}max(t){if(this.isEmpty())return NaN;switch(t){case"row":{const t=new Array(this.rows).fill(Number.NEGATIVE_INFINITY);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.get(e,r)>t[e]&&(t[e]=this.get(e,r));return t}case"column":{const t=new Array(this.columns).fill(Number.NEGATIVE_INFINITY);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.get(e,r)>t[r]&&(t[r]=this.get(e,r));return t}case void 0:{let t=this.get(0,0);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.get(e,r)>t&&(t=this.get(e,r));return t}default:throw new Error(`invalid option: ${t}`)}}maxIndex(){er(this);let t=this.get(0,0),e=[0,0];for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.get(r,n)>t&&(t=this.get(r,n),e[0]=r,e[1]=n);return e}min(t){if(this.isEmpty())return NaN;switch(t){case"row":{const t=new Array(this.rows).fill(Number.POSITIVE_INFINITY);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.get(e,r)<t[e]&&(t[e]=this.get(e,r));return t}case"column":{const t=new Array(this.columns).fill(Number.POSITIVE_INFINITY);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.get(e,r)<t[r]&&(t[r]=this.get(e,r));return t}case void 0:{let t=this.get(0,0);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.get(e,r)<t&&(t=this.get(e,r));return t}default:throw new Error(`invalid option: ${t}`)}}minIndex(){er(this);let t=this.get(0,0),e=[0,0];for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.get(r,n)<t&&(t=this.get(r,n),e[0]=r,e[1]=n);return e}maxRow(t){if(Ke(this,t),this.isEmpty())return NaN;let e=this.get(t,0);for(let r=1;r<this.columns;r++)this.get(t,r)>e&&(e=this.get(t,r));return e}maxRowIndex(t){Ke(this,t),er(this);let e=this.get(t,0),r=[t,0];for(let n=1;n<this.columns;n++)this.get(t,n)>e&&(e=this.get(t,n),r[1]=n);return r}minRow(t){if(Ke(this,t),this.isEmpty())return NaN;let e=this.get(t,0);for(let r=1;r<this.columns;r++)this.get(t,r)<e&&(e=this.get(t,r));return e}minRowIndex(t){Ke(this,t),er(this);let e=this.get(t,0),r=[t,0];for(let n=1;n<this.columns;n++)this.get(t,n)<e&&(e=this.get(t,n),r[1]=n);return r}maxColumn(t){if(Je(this,t),this.isEmpty())return NaN;let e=this.get(0,t);for(let r=1;r<this.rows;r++)this.get(r,t)>e&&(e=this.get(r,t));return e}maxColumnIndex(t){Je(this,t),er(this);let e=this.get(0,t),r=[0,t];for(let n=1;n<this.rows;n++)this.get(n,t)>e&&(e=this.get(n,t),r[0]=n);return r}minColumn(t){if(Je(this,t),this.isEmpty())return NaN;let e=this.get(0,t);for(let r=1;r<this.rows;r++)this.get(r,t)<e&&(e=this.get(r,t));return e}minColumnIndex(t){Je(this,t),er(this);let e=this.get(0,t),r=[0,t];for(let n=1;n<this.rows;n++)this.get(n,t)<e&&(e=this.get(n,t),r[0]=n);return r}diag(){let t=Math.min(this.rows,this.columns),e=[];for(let r=0;r<t;r++)e.push(this.get(r,r));return e}norm(t="frobenius"){let e=0;if("max"===t)return this.max();if("frobenius"===t){for(let t=0;t<this.rows;t++)for(let r=0;r<this.columns;r++)e+=this.get(t,r)*this.get(t,r);return Math.sqrt(e)}throw new RangeError(`unknown norm type: ${t}`)}cumulativeSum(){let t=0;for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)t+=this.get(e,r),this.set(e,r,t);return this}dot(t){rr.isMatrix(t)&&(t=t.to1DArray());let e=this.to1DArray();if(e.length!==t.length)throw new RangeError("vectors do not have the same size");let r=0;for(let n=0;n<e.length;n++)r+=e[n]*t[n];return r}mmul(t){t=or.checkMatrix(t);let e=this.rows,r=this.columns,n=t.columns,o=new or(e,n),i=new Float64Array(r);for(let s=0;s<n;s++){for(let e=0;e<r;e++)i[e]=t.get(e,s);for(let t=0;t<e;t++){let e=0;for(let n=0;n<r;n++)e+=this.get(t,n)*i[n];o.set(t,s,e)}}return o}strassen2x2(t){t=or.checkMatrix(t);let e=new or(2,2);const r=this.get(0,0),n=t.get(0,0),o=this.get(0,1),i=t.get(0,1),s=this.get(1,0),a=t.get(1,0),u=this.get(1,1),d=t.get(1,1),h=(r+u)*(n+d),c=(s+u)*n,l=r*(i-d),f=u*(a-n),g=(r+o)*d,p=h+f-g+(o-u)*(a+d),v=l+g,y=c+f,m=h-c+l+(s-r)*(n+i);return e.set(0,0,p),e.set(0,1,v),e.set(1,0,y),e.set(1,1,m),e}strassen3x3(t){t=or.checkMatrix(t);let e=new or(3,3);const r=this.get(0,0),n=this.get(0,1),o=this.get(0,2),i=this.get(1,0),s=this.get(1,1),a=this.get(1,2),u=this.get(2,0),d=this.get(2,1),h=this.get(2,2),c=t.get(0,0),l=t.get(0,1),f=t.get(0,2),g=t.get(1,0),p=t.get(1,1),v=t.get(1,2),y=t.get(2,0),m=t.get(2,1),w=t.get(2,2),x=(r-i)*(-l+p),b=(-r+i+s)*(c-l+p),E=(i+s)*(-c+l),N=r*c,_=(-r+u+d)*(c-f+v),M=(-r+u)*(f-v),k=(u+d)*(-c+f),A=(-o+d+h)*(p+y-m),j=(o-h)*(p-m),O=o*y,S=(d+h)*(-y+m),z=(-o+s+a)*(v+y-w),R=(o-a)*(v-w),I=(s+a)*(-y+w),P=N+O+n*g,C=(r+n+o-i-s-d-h)*p+b+E+N+A+O+S,D=N+_+k+(r+n+o-s-a-u-d)*v+O+z+I,T=x+s*(-c+l+g-p-v-y+w)+b+N+O+z+R,L=x+b+E+N+a*m,F=O+z+R+I+i*f,q=N+_+M+d*(-c+f+g-p-v-y+m)+A+j+O,V=A+j+O+S+u*l,B=N+_+M+k+h*w;return e.set(0,0,P),e.set(0,1,C),e.set(0,2,D),e.set(1,0,T),e.set(1,1,L),e.set(1,2,F),e.set(2,0,q),e.set(2,1,V),e.set(2,2,B),e}mmulStrassen(t){t=or.checkMatrix(t);let e=this.clone(),r=e.rows,n=e.columns,o=t.rows,i=t.columns;function s(t,e,r){let n=t.rows,o=t.columns;if(n===e&&o===r)return t;{let n=rr.zeros(e,r);return n=n.setSubMatrix(t,0,0),n}}n!==o&&console.warn(`Multiplying ${r} x ${n} and ${o} x ${i} matrix: dimensions do not match.`);let a=Math.max(r,o),u=Math.max(n,i);return e=s(e,a,u),function t(e,r,n,o){if(n<=512||o<=512)return e.mmul(r);n%2==1&&o%2==1?(e=s(e,n+1,o+1),r=s(r,n+1,o+1)):n%2==1?(e=s(e,n+1,o),r=s(r,n+1,o)):o%2==1&&(e=s(e,n,o+1),r=s(r,n,o+1));let i=parseInt(e.rows/2,10),a=parseInt(e.columns/2,10),u=e.subMatrix(0,i-1,0,a-1),d=r.subMatrix(0,i-1,0,a-1),h=e.subMatrix(0,i-1,a,e.columns-1),c=r.subMatrix(0,i-1,a,r.columns-1),l=e.subMatrix(i,e.rows-1,0,a-1),f=r.subMatrix(i,r.rows-1,0,a-1),g=e.subMatrix(i,e.rows-1,a,e.columns-1),p=r.subMatrix(i,r.rows-1,a,r.columns-1),v=t(rr.add(u,g),rr.add(d,p),i,a),y=t(rr.add(l,g),d,i,a),m=t(u,rr.sub(c,p),i,a),w=t(g,rr.sub(f,d),i,a),x=t(rr.add(u,h),p,i,a),b=t(rr.sub(l,u),rr.add(d,c),i,a),E=t(rr.sub(h,g),rr.add(f,p),i,a),N=rr.add(v,w);N.sub(x),N.add(E);let _=rr.add(m,x),M=rr.add(y,w),k=rr.sub(v,y);k.add(m),k.add(b);let A=rr.zeros(2*N.rows,2*N.columns);return A=A.setSubMatrix(N,0,0),A=A.setSubMatrix(_,N.rows,0),A=A.setSubMatrix(M,0,N.columns),A=A.setSubMatrix(k,N.rows,N.columns),A.subMatrix(0,n-1,0,o-1)}(e,t=s(t,a,u),a,u)}scaleRows(t={}){if("object"!=typeof t)throw new TypeError("options must be an object");const{min:e=0,max:r=1}=t;if(!Number.isFinite(e))throw new TypeError("min must be a number");if(!Number.isFinite(r))throw new TypeError("max must be a number");if(e>=r)throw new RangeError("min must be smaller than max");let n=new or(this.rows,this.columns);for(let t=0;t<this.rows;t++){const o=this.getRow(t);o.length>0&&Be(o,{min:e,max:r,output:o}),n.setRow(t,o)}return n}scaleColumns(t={}){if("object"!=typeof t)throw new TypeError("options must be an object");const{min:e=0,max:r=1}=t;if(!Number.isFinite(e))throw new TypeError("min must be a number");if(!Number.isFinite(r))throw new TypeError("max must be a number");if(e>=r)throw new RangeError("min must be smaller than max");let n=new or(this.rows,this.columns);for(let t=0;t<this.columns;t++){const o=this.getColumn(t);o.length&&Be(o,{min:e,max:r,output:o}),n.setColumn(t,o)}return n}flipRows(){const t=Math.ceil(this.columns/2);for(let e=0;e<this.rows;e++)for(let r=0;r<t;r++){let t=this.get(e,r),n=this.get(e,this.columns-1-r);this.set(e,r,n),this.set(e,this.columns-1-r,t)}return this}flipColumns(){const t=Math.ceil(this.rows/2);for(let e=0;e<this.columns;e++)for(let r=0;r<t;r++){let t=this.get(r,e),n=this.get(this.rows-1-r,e);this.set(r,e,n),this.set(this.rows-1-r,e,t)}return this}kroneckerProduct(t){t=or.checkMatrix(t);let e=this.rows,r=this.columns,n=t.rows,o=t.columns,i=new or(e*n,r*o);for(let s=0;s<e;s++)for(let e=0;e<r;e++)for(let r=0;r<n;r++)for(let a=0;a<o;a++)i.set(n*s+r,o*e+a,this.get(s,e)*t.get(r,a));return i}kroneckerSum(t){if(t=or.checkMatrix(t),!this.isSquare()||!t.isSquare())throw new Error("Kronecker Sum needs two Square Matrices");let e=this.rows,r=t.rows,n=this.kroneckerProduct(or.eye(r,r)),o=or.eye(e,e).kroneckerProduct(t);return n.add(o)}transpose(){let t=new or(this.columns,this.rows);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)t.set(r,e,this.get(e,r));return t}sortRows(t=nr){for(let e=0;e<this.rows;e++)this.setRow(e,this.getRow(e).sort(t));return this}sortColumns(t=nr){for(let e=0;e<this.columns;e++)this.setColumn(e,this.getColumn(e).sort(t));return this}subMatrix(t,e,r,n){Qe(this,t,e,r,n);let o=new or(e-t+1,n-r+1);for(let i=t;i<=e;i++)for(let e=r;e<=n;e++)o.set(i-t,e-r,this.get(i,e));return o}subMatrixRow(t,e,r){if(void 0===e&&(e=0),void 0===r&&(r=this.columns-1),e>r||e<0||e>=this.columns||r<0||r>=this.columns)throw new RangeError("Argument out of range");let n=new or(t.length,r-e+1);for(let o=0;o<t.length;o++)for(let i=e;i<=r;i++){if(t[o]<0||t[o]>=this.rows)throw new RangeError(`Row index out of range: ${t[o]}`);n.set(o,i-e,this.get(t[o],i))}return n}subMatrixColumn(t,e,r){if(void 0===e&&(e=0),void 0===r&&(r=this.rows-1),e>r||e<0||e>=this.rows||r<0||r>=this.rows)throw new RangeError("Argument out of range");let n=new or(r-e+1,t.length);for(let o=0;o<t.length;o++)for(let i=e;i<=r;i++){if(t[o]<0||t[o]>=this.columns)throw new RangeError(`Column index out of range: ${t[o]}`);n.set(i-e,o,this.get(i,t[o]))}return n}setSubMatrix(t,e,r){if((t=or.checkMatrix(t)).isEmpty())return this;Qe(this,e,e+t.rows-1,r,r+t.columns-1);for(let n=0;n<t.rows;n++)for(let o=0;o<t.columns;o++)this.set(e+n,r+o,t.get(n,o));return this}selection(t,e){!function(t,e){if(!Ve(e))throw new TypeError("row indices must be an array");for(let r=0;r<e.length;r++)if(e[r]<0||e[r]>=t.rows)throw new RangeError("row indices are out of range")}(this,t),function(t,e){if(!Ve(e))throw new TypeError("column indices must be an array");for(let r=0;r<e.length;r++)if(e[r]<0||e[r]>=t.columns)throw new RangeError("column indices are out of range")}(this,e);let r=new or(t.length,e.length);for(let n=0;n<t.length;n++){let o=t[n];for(let t=0;t<e.length;t++){let i=e[t];r.set(n,t,this.get(o,i))}}return r}trace(){let t=Math.min(this.rows,this.columns),e=0;for(let r=0;r<t;r++)e+=this.get(r,r);return e}clone(){let t=new or(this.rows,this.columns);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)t.set(e,r,this.get(e,r));return t}sum(t){switch(t){case"row":return function(t){let e=Ze(t.rows);for(let r=0;r<t.rows;++r)for(let n=0;n<t.columns;++n)e[r]+=t.get(r,n);return e}(this);case"column":return function(t){let e=Ze(t.columns);for(let r=0;r<t.rows;++r)for(let n=0;n<t.columns;++n)e[n]+=t.get(r,n);return e}(this);case void 0:return function(t){let e=0;for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)e+=t.get(r,n);return e}(this);default:throw new Error(`invalid option: ${t}`)}}product(t){switch(t){case"row":return function(t){let e=Ze(t.rows,1);for(let r=0;r<t.rows;++r)for(let n=0;n<t.columns;++n)e[r]*=t.get(r,n);return e}(this);case"column":return function(t){let e=Ze(t.columns,1);for(let r=0;r<t.rows;++r)for(let n=0;n<t.columns;++n)e[n]*=t.get(r,n);return e}(this);case void 0:return function(t){let e=1;for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)e*=t.get(r,n);return e}(this);default:throw new Error(`invalid option: ${t}`)}}mean(t){const e=this.sum(t);switch(t){case"row":for(let t=0;t<this.rows;t++)e[t]/=this.columns;return e;case"column":for(let t=0;t<this.columns;t++)e[t]/=this.rows;return e;case void 0:return e/this.size;default:throw new Error(`invalid option: ${t}`)}}variance(t,e={}){if("object"==typeof t&&(e=t,t=void 0),"object"!=typeof e)throw new TypeError("options must be an object");const{unbiased:r=!0,mean:n=this.mean(t)}=e;if("boolean"!=typeof r)throw new TypeError("unbiased must be a boolean");switch(t){case"row":if(!Ve(n))throw new TypeError("mean must be an array");return function(t,e,r){const n=t.rows,o=t.columns,i=[];for(let s=0;s<n;s++){let n=0,a=0,u=0;for(let e=0;e<o;e++)u=t.get(s,e)-r[s],n+=u,a+=u*u;e?i.push((a-n*n/o)/(o-1)):i.push((a-n*n/o)/o)}return i}(this,r,n);case"column":if(!Ve(n))throw new TypeError("mean must be an array");return function(t,e,r){const n=t.rows,o=t.columns,i=[];for(let s=0;s<o;s++){let o=0,a=0,u=0;for(let e=0;e<n;e++)u=t.get(e,s)-r[s],o+=u,a+=u*u;e?i.push((a-o*o/n)/(n-1)):i.push((a-o*o/n)/n)}return i}(this,r,n);case void 0:if("number"!=typeof n)throw new TypeError("mean must be a number");return function(t,e,r){const n=t.rows,o=t.columns,i=n*o;let s=0,a=0,u=0;for(let e=0;e<n;e++)for(let n=0;n<o;n++)u=t.get(e,n)-r,s+=u,a+=u*u;return e?(a-s*s/i)/(i-1):(a-s*s/i)/i}(this,r,n);default:throw new Error(`invalid option: ${t}`)}}standardDeviation(t,e){"object"==typeof t&&(e=t,t=void 0);const r=this.variance(t,e);if(void 0===t)return Math.sqrt(r);for(let t=0;t<r.length;t++)r[t]=Math.sqrt(r[t]);return r}center(t,e={}){if("object"==typeof t&&(e=t,t=void 0),"object"!=typeof e)throw new TypeError("options must be an object");const{center:r=this.mean(t)}=e;switch(t){case"row":if(!Ve(r))throw new TypeError("center must be an array");return function(t,e){for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)t.set(r,n,t.get(r,n)-e[r])}(this,r),this;case"column":if(!Ve(r))throw new TypeError("center must be an array");return function(t,e){for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)t.set(r,n,t.get(r,n)-e[n])}(this,r),this;case void 0:if("number"!=typeof r)throw new TypeError("center must be a number");return function(t,e){for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)t.set(r,n,t.get(r,n)-e)}(this,r),this;default:throw new Error(`invalid option: ${t}`)}}scale(t,e={}){if("object"==typeof t&&(e=t,t=void 0),"object"!=typeof e)throw new TypeError("options must be an object");let r=e.scale;switch(t){case"row":if(void 0===r)r=function(t){const e=[];for(let r=0;r<t.rows;r++){let n=0;for(let e=0;e<t.columns;e++)n+=Math.pow(t.get(r,e),2)/(t.columns-1);e.push(Math.sqrt(n))}return e}(this);else if(!Ve(r))throw new TypeError("scale must be an array");return function(t,e){for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)t.set(r,n,t.get(r,n)/e[r])}(this,r),this;case"column":if(void 0===r)r=function(t){const e=[];for(let r=0;r<t.columns;r++){let n=0;for(let e=0;e<t.rows;e++)n+=Math.pow(t.get(e,r),2)/(t.rows-1);e.push(Math.sqrt(n))}return e}(this);else if(!Ve(r))throw new TypeError("scale must be an array");return function(t,e){for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)t.set(r,n,t.get(r,n)/e[n])}(this,r),this;case void 0:if(void 0===r)r=function(t){const e=t.size-1;let r=0;for(let n=0;n<t.columns;n++)for(let o=0;o<t.rows;o++)r+=Math.pow(t.get(o,n),2)/e;return Math.sqrt(r)}(this);else if("number"!=typeof r)throw new TypeError("scale must be a number");return function(t,e){for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)t.set(r,n,t.get(r,n)/e)}(this,r),this;default:throw new Error(`invalid option: ${t}`)}}toString(t){return Ue(this,t)}}function nr(t,e){return t-e}rr.prototype.klass="Matrix","undefined"!=typeof Symbol&&(rr.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return Ue(this)}),rr.random=rr.rand,rr.randomInt=rr.randInt,rr.diagonal=rr.diag,rr.prototype.diagonal=rr.prototype.diag,rr.identity=rr.eye,rr.prototype.negate=rr.prototype.neg,rr.prototype.tensorProduct=rr.prototype.kroneckerProduct;class or extends rr{constructor(t,e){if(super(),or.isMatrix(t))return t.clone();if(Number.isInteger(t)&&t>=0){if(this.data=[],!(Number.isInteger(e)&&e>=0))throw new TypeError("nColumns must be a positive integer");for(let r=0;r<t;r++)this.data.push(new Float64Array(e))}else{if(!Ve(t))throw new TypeError("First argument must be a positive number or an array");{const r=t;if("number"!=typeof(e=(t=r.length)?r[0].length:0))throw new TypeError("Data must be a 2D array with at least one element");this.data=[];for(let n=0;n<t;n++){if(r[n].length!==e)throw new RangeError("Inconsistent array dimensions");if(!r[n].every((t=>"number"==typeof t)))throw new TypeError("Input data contains non-numeric values");this.data.push(Float64Array.from(r[n]))}}}this.rows=t,this.columns=e}set(t,e,r){return this.data[t][e]=r,this}get(t,e){return this.data[t][e]}removeRow(t){return Ke(this,t),this.data.splice(t,1),this.rows-=1,this}addRow(t,e){return void 0===e&&(e=t,t=this.rows),Ke(this,t,!0),e=Float64Array.from(He(this,e)),this.data.splice(t,0,e),this.rows+=1,this}removeColumn(t){Je(this,t);for(let e=0;e<this.rows;e++){const r=new Float64Array(this.columns-1);for(let n=0;n<t;n++)r[n]=this.data[e][n];for(let n=t+1;n<this.columns;n++)r[n-1]=this.data[e][n];this.data[e]=r}return this.columns-=1,this}addColumn(t,e){void 0===e&&(e=t,t=this.columns),Je(this,t,!0),e=Xe(this,e);for(let r=0;r<this.rows;r++){const n=new Float64Array(this.columns+1);let o=0;for(;o<t;o++)n[o]=this.data[r][o];for(n[o++]=e[r];o<this.columns+1;o++)n[o]=this.data[r][o-1];this.data[r]=n}return this.columns+=1,this}}!function(t,e){t.prototype.add=function(t){return"number"==typeof t?this.addS(t):this.addM(t)},t.prototype.addS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)+t);return this},t.prototype.addM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)+t.get(e,r));return this},t.add=function(t,r){return new e(t).add(r)},t.prototype.sub=function(t){return"number"==typeof t?this.subS(t):this.subM(t)},t.prototype.subS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)-t);return this},t.prototype.subM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)-t.get(e,r));return this},t.sub=function(t,r){return new e(t).sub(r)},t.prototype.subtract=t.prototype.sub,t.prototype.subtractS=t.prototype.subS,t.prototype.subtractM=t.prototype.subM,t.subtract=t.sub,t.prototype.mul=function(t){return"number"==typeof t?this.mulS(t):this.mulM(t)},t.prototype.mulS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)*t);return this},t.prototype.mulM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)*t.get(e,r));return this},t.mul=function(t,r){return new e(t).mul(r)},t.prototype.multiply=t.prototype.mul,t.prototype.multiplyS=t.prototype.mulS,t.prototype.multiplyM=t.prototype.mulM,t.multiply=t.mul,t.prototype.div=function(t){return"number"==typeof t?this.divS(t):this.divM(t)},t.prototype.divS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)/t);return this},t.prototype.divM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)/t.get(e,r));return this},t.div=function(t,r){return new e(t).div(r)},t.prototype.divide=t.prototype.div,t.prototype.divideS=t.prototype.divS,t.prototype.divideM=t.prototype.divM,t.divide=t.div,t.prototype.mod=function(t){return"number"==typeof t?this.modS(t):this.modM(t)},t.prototype.modS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)%t);return this},t.prototype.modM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)%t.get(e,r));return this},t.mod=function(t,r){return new e(t).mod(r)},t.prototype.modulus=t.prototype.mod,t.prototype.modulusS=t.prototype.modS,t.prototype.modulusM=t.prototype.modM,t.modulus=t.mod,t.prototype.and=function(t){return"number"==typeof t?this.andS(t):this.andM(t)},t.prototype.andS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)&t);return this},t.prototype.andM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)&t.get(e,r));return this},t.and=function(t,r){return new e(t).and(r)},t.prototype.or=function(t){return"number"==typeof t?this.orS(t):this.orM(t)},t.prototype.orS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)|t);return this},t.prototype.orM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)|t.get(e,r));return this},t.or=function(t,r){return new e(t).or(r)},t.prototype.xor=function(t){return"number"==typeof t?this.xorS(t):this.xorM(t)},t.prototype.xorS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)^t);return this},t.prototype.xorM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)^t.get(e,r));return this},t.xor=function(t,r){return new e(t).xor(r)},t.prototype.leftShift=function(t){return"number"==typeof t?this.leftShiftS(t):this.leftShiftM(t)},t.prototype.leftShiftS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)<<t);return this},t.prototype.leftShiftM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)<<t.get(e,r));return this},t.leftShift=function(t,r){return new e(t).leftShift(r)},t.prototype.signPropagatingRightShift=function(t){return"number"==typeof t?this.signPropagatingRightShiftS(t):this.signPropagatingRightShiftM(t)},t.prototype.signPropagatingRightShiftS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)>>t);return this},t.prototype.signPropagatingRightShiftM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)>>t.get(e,r));return this},t.signPropagatingRightShift=function(t,r){return new e(t).signPropagatingRightShift(r)},t.prototype.rightShift=function(t){return"number"==typeof t?this.rightShiftS(t):this.rightShiftM(t)},t.prototype.rightShiftS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)>>>t);return this},t.prototype.rightShiftM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)>>>t.get(e,r));return this},t.rightShift=function(t,r){return new e(t).rightShift(r)},t.prototype.zeroFillRightShift=t.prototype.rightShift,t.prototype.zeroFillRightShiftS=t.prototype.rightShiftS,t.prototype.zeroFillRightShiftM=t.prototype.rightShiftM,t.zeroFillRightShift=t.rightShift,t.prototype.not=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,~this.get(t,e));return this},t.not=function(t){return new e(t).not()},t.prototype.abs=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.abs(this.get(t,e)));return this},t.abs=function(t){return new e(t).abs()},t.prototype.acos=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.acos(this.get(t,e)));return this},t.acos=function(t){return new e(t).acos()},t.prototype.acosh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.acosh(this.get(t,e)));return this},t.acosh=function(t){return new e(t).acosh()},t.prototype.asin=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.asin(this.get(t,e)));return this},t.asin=function(t){return new e(t).asin()},t.prototype.asinh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.asinh(this.get(t,e)));return this},t.asinh=function(t){return new e(t).asinh()},t.prototype.atan=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.atan(this.get(t,e)));return this},t.atan=function(t){return new e(t).atan()},t.prototype.atanh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.atanh(this.get(t,e)));return this},t.atanh=function(t){return new e(t).atanh()},t.prototype.cbrt=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.cbrt(this.get(t,e)));return this},t.cbrt=function(t){return new e(t).cbrt()},t.prototype.ceil=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.ceil(this.get(t,e)));return this},t.ceil=function(t){return new e(t).ceil()},t.prototype.clz32=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.clz32(this.get(t,e)));return this},t.clz32=function(t){return new e(t).clz32()},t.prototype.cos=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.cos(this.get(t,e)));return this},t.cos=function(t){return new e(t).cos()},t.prototype.cosh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.cosh(this.get(t,e)));return this},t.cosh=function(t){return new e(t).cosh()},t.prototype.exp=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.exp(this.get(t,e)));return this},t.exp=function(t){return new e(t).exp()},t.prototype.expm1=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.expm1(this.get(t,e)));return this},t.expm1=function(t){return new e(t).expm1()},t.prototype.floor=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.floor(this.get(t,e)));return this},t.floor=function(t){return new e(t).floor()},t.prototype.fround=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.fround(this.get(t,e)));return this},t.fround=function(t){return new e(t).fround()},t.prototype.log=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.log(this.get(t,e)));return this},t.log=function(t){return new e(t).log()},t.prototype.log1p=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.log1p(this.get(t,e)));return this},t.log1p=function(t){return new e(t).log1p()},t.prototype.log10=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.log10(this.get(t,e)));return this},t.log10=function(t){return new e(t).log10()},t.prototype.log2=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.log2(this.get(t,e)));return this},t.log2=function(t){return new e(t).log2()},t.prototype.round=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.round(this.get(t,e)));return this},t.round=function(t){return new e(t).round()},t.prototype.sign=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.sign(this.get(t,e)));return this},t.sign=function(t){return new e(t).sign()},t.prototype.sin=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.sin(this.get(t,e)));return this},t.sin=function(t){return new e(t).sin()},t.prototype.sinh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.sinh(this.get(t,e)));return this},t.sinh=function(t){return new e(t).sinh()},t.prototype.sqrt=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.sqrt(this.get(t,e)));return this},t.sqrt=function(t){return new e(t).sqrt()},t.prototype.tan=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.tan(this.get(t,e)));return this},t.tan=function(t){return new e(t).tan()},t.prototype.tanh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.tanh(this.get(t,e)));return this},t.tanh=function(t){return new e(t).tanh()},t.prototype.trunc=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.trunc(this.get(t,e)));return this},t.trunc=function(t){return new e(t).trunc()},t.pow=function(t,r){return new e(t).pow(r)},t.prototype.pow=function(t){return"number"==typeof t?this.powS(t):this.powM(t)},t.prototype.powS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,Math.pow(this.get(e,r),t));return this},t.prototype.powM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,Math.pow(this.get(e,r),t.get(e,r)));return this}}(rr,or);class ir extends rr{constructor(t){super(),this.data=t,this.rows=t.length,this.columns=t[0].length}set(t,e,r){return this.data[t][e]=r,this}get(t,e){return this.data[t][e]}}function sr(t,e){let r=0;return Math.abs(t)>Math.abs(e)?(r=e/t,Math.abs(t)*Math.sqrt(1+r*r)):0!==e?(r=t/e,Math.abs(e)*Math.sqrt(1+r*r)):0}class ar{constructor(t,e={}){if((t=ir.checkMatrix(t)).isEmpty())throw new Error("Matrix must be non-empty");let r=t.rows,n=t.columns;const{computeLeftSingularVectors:o=!0,computeRightSingularVectors:i=!0,autoTranspose:s=!1}=e;let a,u=Boolean(o),d=Boolean(i),h=!1;if(r<n)if(s){a=t.transpose(),r=a.rows,n=a.columns,h=!0;let e=u;u=d,d=e}else a=t.clone(),console.warn("Computing SVD on a matrix with more columns than rows. Consider enabling autoTranspose");else a=t.clone();let c=Math.min(r,n),l=Math.min(r+1,n),f=new Float64Array(l),g=new or(r,c),p=new or(n,n),v=new Float64Array(n),y=new Float64Array(r),m=new Float64Array(l);for(let t=0;t<l;t++)m[t]=t;let w=Math.min(r-1,n),x=Math.max(0,Math.min(n-2,r)),b=Math.max(w,x);for(let t=0;t<b;t++){if(t<w){f[t]=0;for(let e=t;e<r;e++)f[t]=sr(f[t],a.get(e,t));if(0!==f[t]){a.get(t,t)<0&&(f[t]=-f[t]);for(let e=t;e<r;e++)a.set(e,t,a.get(e,t)/f[t]);a.set(t,t,a.get(t,t)+1)}f[t]=-f[t]}for(let e=t+1;e<n;e++){if(t<w&&0!==f[t]){let n=0;for(let o=t;o<r;o++)n+=a.get(o,t)*a.get(o,e);n=-n/a.get(t,t);for(let o=t;o<r;o++)a.set(o,e,a.get(o,e)+n*a.get(o,t))}v[e]=a.get(t,e)}if(u&&t<w)for(let e=t;e<r;e++)g.set(e,t,a.get(e,t));if(t<x){v[t]=0;for(let e=t+1;e<n;e++)v[t]=sr(v[t],v[e]);if(0!==v[t]){v[t+1]<0&&(v[t]=0-v[t]);for(let e=t+1;e<n;e++)v[e]/=v[t];v[t+1]+=1}if(v[t]=-v[t],t+1<r&&0!==v[t]){for(let e=t+1;e<r;e++)y[e]=0;for(let e=t+1;e<r;e++)for(let r=t+1;r<n;r++)y[e]+=v[r]*a.get(e,r);for(let e=t+1;e<n;e++){let n=-v[e]/v[t+1];for(let o=t+1;o<r;o++)a.set(o,e,a.get(o,e)+n*y[o])}}if(d)for(let e=t+1;e<n;e++)p.set(e,t,v[e])}}let E=Math.min(n,r+1);if(w<n&&(f[w]=a.get(w,w)),r<E&&(f[E-1]=0),x+1<E&&(v[x]=a.get(x,E-1)),v[E-1]=0,u){for(let t=w;t<c;t++){for(let e=0;e<r;e++)g.set(e,t,0);g.set(t,t,1)}for(let t=w-1;t>=0;t--)if(0!==f[t]){for(let e=t+1;e<c;e++){let n=0;for(let o=t;o<r;o++)n+=g.get(o,t)*g.get(o,e);n=-n/g.get(t,t);for(let o=t;o<r;o++)g.set(o,e,g.get(o,e)+n*g.get(o,t))}for(let e=t;e<r;e++)g.set(e,t,-g.get(e,t));g.set(t,t,1+g.get(t,t));for(let e=0;e<t-1;e++)g.set(e,t,0)}else{for(let e=0;e<r;e++)g.set(e,t,0);g.set(t,t,1)}}if(d)for(let t=n-1;t>=0;t--){if(t<x&&0!==v[t])for(let e=t+1;e<n;e++){let r=0;for(let o=t+1;o<n;o++)r+=p.get(o,t)*p.get(o,e);r=-r/p.get(t+1,t);for(let o=t+1;o<n;o++)p.set(o,e,p.get(o,e)+r*p.get(o,t))}for(let e=0;e<n;e++)p.set(e,t,0);p.set(t,t,1)}let N=E-1,_=0,M=Number.EPSILON;for(;E>0;){let t,e;for(t=E-2;t>=-1&&-1!==t;t--){const e=Number.MIN_VALUE+M*Math.abs(f[t]+Math.abs(f[t+1]));if(Math.abs(v[t])<=e||Number.isNaN(v[t])){v[t]=0;break}}if(t===E-2)e=4;else{let r;for(r=E-1;r>=t&&r!==t;r--){let e=(r!==E?Math.abs(v[r]):0)+(r!==t+1?Math.abs(v[r-1]):0);if(Math.abs(f[r])<=M*e){f[r]=0;break}}r===t?e=3:r===E-1?e=1:(e=2,t=r)}switch(t++,e){case 1:{let e=v[E-2];v[E-2]=0;for(let r=E-2;r>=t;r--){let o=sr(f[r],e),i=f[r]/o,s=e/o;if(f[r]=o,r!==t&&(e=-s*v[r-1],v[r-1]=i*v[r-1]),d)for(let t=0;t<n;t++)o=i*p.get(t,r)+s*p.get(t,E-1),p.set(t,E-1,-s*p.get(t,r)+i*p.get(t,E-1)),p.set(t,r,o)}break}case 2:{let e=v[t-1];v[t-1]=0;for(let n=t;n<E;n++){let o=sr(f[n],e),i=f[n]/o,s=e/o;if(f[n]=o,e=-s*v[n],v[n]=i*v[n],u)for(let e=0;e<r;e++)o=i*g.get(e,n)+s*g.get(e,t-1),g.set(e,t-1,-s*g.get(e,n)+i*g.get(e,t-1)),g.set(e,n,o)}break}case 3:{const e=Math.max(Math.abs(f[E-1]),Math.abs(f[E-2]),Math.abs(v[E-2]),Math.abs(f[t]),Math.abs(v[t])),o=f[E-1]/e,i=f[E-2]/e,s=v[E-2]/e,a=f[t]/e,h=v[t]/e,c=((i+o)*(i-o)+s*s)/2,l=o*s*(o*s);let y=0;0===c&&0===l||(y=c<0?0-Math.sqrt(c*c+l):Math.sqrt(c*c+l),y=l/(c+y));let m=(a+o)*(a-o)+y,w=a*h;for(let e=t;e<E-1;e++){let o=sr(m,w);0===o&&(o=Number.MIN_VALUE);let i=m/o,s=w/o;if(e!==t&&(v[e-1]=o),m=i*f[e]+s*v[e],v[e]=i*v[e]-s*f[e],w=s*f[e+1],f[e+1]=i*f[e+1],d)for(let t=0;t<n;t++)o=i*p.get(t,e)+s*p.get(t,e+1),p.set(t,e+1,-s*p.get(t,e)+i*p.get(t,e+1)),p.set(t,e,o);if(o=sr(m,w),0===o&&(o=Number.MIN_VALUE),i=m/o,s=w/o,f[e]=o,m=i*v[e]+s*f[e+1],f[e+1]=-s*v[e]+i*f[e+1],w=s*v[e+1],v[e+1]=i*v[e+1],u&&e<r-1)for(let t=0;t<r;t++)o=i*g.get(t,e)+s*g.get(t,e+1),g.set(t,e+1,-s*g.get(t,e)+i*g.get(t,e+1)),g.set(t,e,o)}v[E-2]=m,_+=1;break}case 4:if(f[t]<=0&&(f[t]=f[t]<0?-f[t]:0,d))for(let e=0;e<=N;e++)p.set(e,t,-p.get(e,t));for(;t<N&&!(f[t]>=f[t+1]);){let e=f[t];if(f[t]=f[t+1],f[t+1]=e,d&&t<n-1)for(let r=0;r<n;r++)e=p.get(r,t+1),p.set(r,t+1,p.get(r,t)),p.set(r,t,e);if(u&&t<r-1)for(let n=0;n<r;n++)e=g.get(n,t+1),g.set(n,t+1,g.get(n,t)),g.set(n,t,e);t++}_=0,E--}}if(h){let t=p;p=g,g=t}this.m=r,this.n=n,this.s=f,this.U=g,this.V=p}solve(t){let e=t,r=this.threshold,n=this.s.length,o=or.zeros(n,n);for(let t=0;t<n;t++)Math.abs(this.s[t])<=r?o.set(t,t,0):o.set(t,t,1/this.s[t]);let i=this.U,s=this.rightSingularVectors,a=s.mmul(o),u=s.rows,d=i.rows,h=or.zeros(u,d);for(let t=0;t<u;t++)for(let e=0;e<d;e++){let r=0;for(let o=0;o<n;o++)r+=a.get(t,o)*i.get(e,o);h.set(t,e,r)}return h.mmul(e)}solveForDiagonal(t){return this.solve(or.diag(t))}inverse(){let t=this.V,e=this.threshold,r=t.rows,n=t.columns,o=new or(r,this.s.length);for(let i=0;i<r;i++)for(let r=0;r<n;r++)Math.abs(this.s[r])>e&&o.set(i,r,t.get(i,r)/this.s[r]);let i=this.U,s=i.rows,a=i.columns,u=new or(r,s);for(let t=0;t<r;t++)for(let e=0;e<s;e++){let r=0;for(let n=0;n<a;n++)r+=o.get(t,n)*i.get(e,n);u.set(t,e,r)}return u}get condition(){return this.s[0]/this.s[Math.min(this.m,this.n)-1]}get norm2(){return this.s[0]}get rank(){let t=Math.max(this.m,this.n)*this.s[0]*Number.EPSILON,e=0,r=this.s;for(let n=0,o=r.length;n<o;n++)r[n]>t&&e++;return e}get diagonal(){return Array.from(this.s)}get threshold(){return Number.EPSILON/2*Math.max(this.m,this.n)*this.s[0]}get leftSingularVectors(){return this.U}get rightSingularVectors(){return this.V}get diagonalMatrix(){return or.diag(this.s)}}const ur=t=>{const e=[],r=t.length;for(let n=0;n<r;n+=1){e[n]=[];for(let o=0;o<r;o+=1)n===o?e[n][o]=0:0!==t[n][o]&&t[n][o]?e[n][o]=t[n][o]:e[n][o]=1/0}for(let t=0;t<r;t+=1)for(let n=0;n<r;n+=1)for(let o=0;o<r;o+=1)e[n][o]>e[n][t]+e[t][o]&&(e[n][o]=e[n][t]+e[t][o]);return e},dr=(t,e)=>{const{nodes:r,edges:n}=t,o=[],i={};if(!r)throw new Error("invalid nodes data!");return r&&r.forEach(((t,e)=>{i[t.id]=e,o.push([])})),null==n||n.forEach((t=>{const{source:r,target:n}=t,s=i[r],a=i[n];void 0!==s&&void 0!==a&&(o[s][a]=1,e||(o[a][s]=1))})),o},hr=(t,e)=>{const r=[];return t.forEach((t=>{const n=[];t.forEach((t=>{n.push(t*e)})),r.push(n)})),r},cr=t=>{let e=1/0,r=1/0,n=-1/0,o=-1/0;return t.forEach((t=>{let i=t.data.size;ce(i)?1===i.length&&(i=[i[0],i[0]]):v(i)?i=[i,i]:(void 0===i||isNaN(i))&&(i=[30,30]);const s=[i[0]/2,i[1]/2],a=t.data.x-s[0],u=t.data.x+s[0],d=t.data.y-s[1],h=t.data.y+s[1];e>a&&(e=a),r>d&&(r=d),n<u&&(n=u),o<h&&(o=h)})),{minX:e,minY:r,maxX:n,maxY:o}},lr=(t,e)=>Math.sqrt((t.x-e.x)*(t.x-e.x)+(t.y-e.y)*(t.y-e.y)),fr=(t,e,r,n="TB",o,i={})=>{if(!(null==e?void 0:e.length))return;const{stopBranchFn:s,stopAllFn:a}=i;for(let u=0;u<e.length;u++){const d=e[u];if(t.hasNode(d.id)&&!(null==s?void 0:s(d))){if(null==a?void 0:a(d))return;"TB"===n&&r(d),fr(t,t.getChildren(d.id,o),r,n,o,i),"TB"!==n&&r(d)}}},gr={center:[0,0],linkDistance:50};class pr{constructor(t={}){this.options=t,this.id="mds",this.options=Object.assign(Object.assign({},gr),t)}execute(t,r){return e(this,void 0,void 0,(function*(){return this.genericMDSLayout(!1,t,r)}))}assign(t,r){return e(this,void 0,void 0,(function*(){yield this.genericMDSLayout(!0,t,r)}))}genericMDSLayout(t,r,n){return e(this,void 0,void 0,(function*(){const e=Object.assign(Object.assign({},this.options),n),{center:o=[0,0],linkDistance:i=50}=e,s=r.getAllNodes(),a=r.getAllEdges();if(!(null==s?void 0:s.length)||1===s.length)return ie(r,t,o);const u=dr({nodes:s,edges:a},!1),d=ur(u);vr(d);const h=hr(d,i),c=yr(h),l=[];return c.forEach(((t,e)=>{const r=ee(s[e]);r.data.x=t[0]+o[0],r.data.y=t[1]+o[1],l.push(r)})),t&&l.forEach((t=>r.mergeNodeData(t.id,{x:t.data.x,y:t.data.y}))),{nodes:l,edges:a}}))}}const vr=t=>{let e=-999999;t.forEach((t=>{t.forEach((t=>{t!==1/0&&e<t&&(e=t)}))})),t.forEach(((r,n)=>{r.forEach(((r,o)=>{r===1/0&&(t[n][o]=e)}))}))},yr=t=>{const e=or.mul(or.pow(t,2),-.5),r=e.mean("row"),n=e.mean("column"),o=e.mean();e.add(o).subRowVector(r).subColumnVector(n);const i=new ar(e),s=or.sqrt(i.diagonalMatrix).diagonal();return i.leftSingularVectors.toJSON().map((t=>or.mul([t],[s]).toJSON()[0].splice(0,2)))};function mr(t){return!!t.tick&&!!t.stop}const wr={gForce:!0,force2:!0,d3force:!0,fruchterman:!0,forceAtlas2:!0,force:!0,"graphin-force":!0},xr={center:[0,0],comboPadding:10,treeKey:"combo"};class br{constructor(t={}){this.options=t,this.id="comboCombined",this.options=Object.assign(Object.assign({},xr),t)}execute(t,r){return e(this,void 0,void 0,(function*(){return this.genericComboCombinedLayout(!1,t,r)}))}assign(t,r){return e(this,void 0,void 0,(function*(){yield this.genericComboCombinedLayout(!0,t,r)}))}genericComboCombinedLayout(t,r,n){return e(this,void 0,void 0,(function*(){const e=this.initVals(Object.assign(Object.assign({},this.options),n)),{center:o,treeKey:i,outerLayout:s}=e,a=r.getAllNodes().filter((t=>!t.data._isCombo)),u=r.getAllNodes().filter((t=>t.data._isCombo)),d=r.getAllEdges(),h=null==a?void 0:a.length;if(!h||1===h)return ie(r,t,o);const c=[],l=new Map;a.forEach((t=>{l.set(t.id,t)}));const g=new Map;u.forEach((t=>{g.set(t.id,t)}));const p=new Map,v=this.getInnerGraphs(r,i,l,g,d,e,p);yield Promise.all(v);const y=new Map,m=[],w=new Map;let x=!0;r.getRoots(i).forEach((t=>{const e=p.get(t.id),n=g.get(t.id)||l.get(t.id),o={id:t.id,data:Object.assign(Object.assign({},t.data),{x:e.data.x||n.data.x,y:e.data.y||n.data.y,fx:e.data.fx||n.data.fx,fy:e.data.fy||n.data.fy,mass:e.data.mass||n.data.mass,size:e.data.size})};m.push(o),y.set(t.id,!0),isNaN(o.data.x)||0===o.data.x||isNaN(o.data.y)||0===o.data.y?(o.data.x=100*Math.random(),o.data.y=100*Math.random()):x=!1,fr(r,[t],(e=>{e.id!==t.id&&w.set(e.id,t.id)}),"TB",i)}));const b=[];let E;if(d.forEach((t=>{const e=w.get(t.source)||t.source,r=w.get(t.target)||t.target;e!==r&&y.has(e)&&y.has(r)&&b.push({id:t.id,source:e,target:r,data:{}})})),null==m?void 0:m.length){if(1===m.length)m[0].data.x=o[0],m[0].data.y=o[1];else{const t=new f({nodes:m,edges:b}),e=s||new Pe;if(x&&wr[e.id]){const e=m.length<100?new pr:new fe;yield e.assign(t)}const r=Object.assign({center:o,kg:5,preventOverlap:!0,animate:!1},"force"===e.id?{gravity:1,factor:4,linkDistance:(t,e,r)=>(Math.max(...e.data.size)||32)/2+(Math.max(...r.data.size)||32)/2+200}:{});E=yield Er(e,t,r)}p.forEach((t=>{var e;const r=E.nodes.find((e=>e.id===t.id));if(r){const{x:e,y:n}=r.data;t.data.visited=!0,t.data.x=e,t.data.y=n,c.push({id:t.id,data:{x:e,y:n}})}const{x:n,y:o}=t.data;null===(e=t.data.nodes)||void 0===e||e.forEach((t=>{c.push({id:t.id,data:{x:t.data.x+n,y:t.data.y+o}})}))})),p.forEach((({data:t})=>{const{x:e,y:r,visited:n,nodes:o}=t;null==o||o.forEach((t=>{if(!n){const n=c.find((e=>e.id===t.id));n.data.x+=e||0,n.data.y+=r||0}}))}))}return t&&c.forEach((t=>{r.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})})),{nodes:c,edges:d}}))}initVals(t){const e=Object.assign({},t),{nodeSize:r,spacing:n,comboPadding:o}=t;let i,s,a;if(s=v(n)?()=>n:Kt(n)?n:()=>0,e.spacing=s,r)if(Kt(r))i=t=>{const e=r(t),n=s(t);return ce(t.size)?((t.size[0]>t.size[1]?t.size[0]:t.size[1])+n)/2:((e||32)+n)/2};else if(ce(r)){const t=(r[0]>r[1]?r[0]:r[1])/2;i=e=>t+s(e)/2}else{const t=r/2;i=e=>t+s(e)/2}else i=t=>{const e=s(t);return t.size?ce(t.size)?((t.size[0]>t.size[1]?t.size[0]:t.size[1])+e)/2:Jt(t.size)?((t.size.width>t.size.height?t.size.width:t.size.height)+e)/2:(t.size+e)/2:32+e/2};return e.nodeSize=i,a=v(o)?()=>o:ce(o)?()=>Math.max.apply(null,o):Kt(o)?o:()=>0,e.comboPadding=a,e}getInnerGraphs(t,r,n,o,i,s,a){const{nodeSize:u,comboPadding:d,spacing:h,innerLayout:c}=s,l=c||new fe({}),g={center:[0,0],preventOverlap:!0,nodeSpacing:h},p=[],y=t=>{let e=(null==d?void 0:d(t))||10;return ce(e)&&(e=Math.max(...e)),{size:e?[2*e,2*e]:[30,30],padding:e}};return t.getRoots(r).forEach((s=>{a.set(s.id,{id:s.id,data:{nodes:[],size:y(s).size}});let d=Promise.resolve();fr(t,[s],(s=>{var h;if(!s.data._isCombo)return;const{size:c,padding:p}=y(s);if(null===(h=t.getChildren(s.id,r))||void 0===h?void 0:h.length){const h=a.get(s.id);a.set(s.id,{id:s.id,data:Object.assign({nodes:[]},null==h?void 0:h.data)});const c=new Map,y=t.getChildren(s.id,r).map((t=>{if(t.data._isCombo)return a.has(t.id)||a.set(t.id,{id:t.id,data:Object.assign({},t.data)}),c.set(t.id,!0),a.get(t.id);const e=n.get(t.id)||o.get(t.id);return c.set(t.id,!0),{id:t.id,data:Object.assign(Object.assign({},e.data),t.data)}})),m={nodes:y,edges:i.filter((t=>c.has(t.source)&&c.has(t.target)))};let w=1/0;y.forEach((t=>{var e;let{size:r}=t.data;r||(r=(null===(e=a.get(t.id))||void 0===e?void 0:e.data.size)||(null==u?void 0:u(t))||[30,30]),v(r)&&(r=[r,r]);const[n,o]=r;w>n&&(w=n),w>o&&(w=o),t.data.size=r})),d=d.then((()=>e(this,void 0,void 0,(function*(){const t=new f(m);yield Er(l,t,g,!0);const{minX:e,minY:r,maxX:n,maxY:o}=cr(y),i=(n+e)/2,u=(o+r)/2;m.nodes.forEach((t=>{t.data.x-=i,t.data.y-=u}));const d=[Math.max(n-e,w)+2*p,Math.max(o-r,w)+2*p];a.get(s.id).data.size=d,a.get(s.id).data.nodes=y}))))}else a.set(s.id,{id:s.id,data:Object.assign(Object.assign({},s.data),{size:c})});return!0}),"BT",r),p.push(d)})),p}}function Er(t,r,n,o){var i;return e(this,void 0,void 0,(function*(){return mr(t)?(t.execute(r,n),t.stop(),t.tick(null!==(i=n.iterations)&&void 0!==i?i:300)):o?yield t.assign(r,n):yield t.execute(r,n)}))}const Nr=function(t){if(!function(t){return"object"==typeof t&&null!==t}(t)||!p(t,"Object"))return!1;if(null===Object.getPrototypeOf(t))return!0;for(var e=t;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e};function _r(t,e,r,n){for(var o in r=r||0,n=n||5,e)if(e.hasOwnProperty(o)){var i=e[o];null!==i&&Nr(i)?(Nr(t[o])||(t[o]={}),r<n?_r(t[o],i,r+1,n):t[o]=e[o]):B(i)?(t[o]=[],t[o]=t[o].concat(i)):void 0!==i&&(t[o]=i)}}const Mr=function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];for(var n=0;n<e.length;n+=1)_r(t,e[n]);return t};var kr=Object.prototype.hasOwnProperty;const Ar=function(t,e){if(null===t||!Nr(t))return{};var r={};return function(t,e){if(t)if(B(t))for(var r=0,n=t.length;r<n&&!1!==e(t[r],r);r++);else if(Jt(t))for(var o in t)if(t.hasOwnProperty(o)&&!1===e(t[o],o))break}(e,(function(e){kr.call(t,e)&&(r[e]=t[e])})),r};function jr(t){return function(){return t}}function Or(t){return 1e-6*(t()-.5)}function Sr(t){return t.index}function zr(t,e){var r=t.get(e);if(!r)throw new Error("node not found: "+e);return r}function Rr(t){var e,r,n,o,i,s,a=Sr,u=function(t){return 1/Math.min(o[t.source.index],o[t.target.index])},d=jr(30),h=1;function c(n){for(var o=0,a=t.length;o<h;++o)for(var u,d,c,l,f,g,p,v=0;v<a;++v)d=(u=t[v]).source,l=(c=u.target).x+c.vx-d.x-d.vx||Or(s),f=c.y+c.vy-d.y-d.vy||Or(s),l*=g=((g=Math.sqrt(l*l+f*f))-r[v])/g*n*e[v],f*=g,c.vx-=l*(p=i[v]),c.vy-=f*p,d.vx+=l*(p=1-p),d.vy+=f*p}function l(){if(n){var s,u,d=n.length,h=t.length,c=new Map(n.map(((t,e)=>[a(t,e,n),t])));for(s=0,o=new Array(d);s<h;++s)(u=t[s]).index=s,"object"!=typeof u.source&&(u.source=zr(c,u.source)),"object"!=typeof u.target&&(u.target=zr(c,u.target)),o[u.source.index]=(o[u.source.index]||0)+1,o[u.target.index]=(o[u.target.index]||0)+1;for(s=0,i=new Array(h);s<h;++s)u=t[s],i[s]=o[u.source.index]/(o[u.source.index]+o[u.target.index]);e=new Array(h),f(),r=new Array(h),g()}}function f(){if(n)for(var r=0,o=t.length;r<o;++r)e[r]=+u(t[r],r,t)}function g(){if(n)for(var e=0,o=t.length;e<o;++e)r[e]=+d(t[e],e,t)}return null==t&&(t=[]),c.initialize=function(t,e){n=t,s=e,l()},c.links=function(e){return arguments.length?(t=e,l(),c):t},c.id=function(t){return arguments.length?(a=t,c):a},c.iterations=function(t){return arguments.length?(h=+t,c):h},c.strength=function(t){return arguments.length?(u="function"==typeof t?t:jr(+t),f(),c):u},c.distance=function(t){return arguments.length?(d="function"==typeof t?t:jr(+t),g(),c):d},c}var Ir={value:()=>{}};function Pr(){for(var t,e=0,r=arguments.length,n={};e<r;++e){if(!(t=arguments[e]+"")||t in n||/[\s.]/.test(t))throw new Error("illegal type: "+t);n[t]=[]}return new Cr(n)}function Cr(t){this._=t}function Dr(t,e){for(var r,n=0,o=t.length;n<o;++n)if((r=t[n]).name===e)return r.value}function Tr(t,e,r){for(var n=0,o=t.length;n<o;++n)if(t[n].name===e){t[n]=Ir,t=t.slice(0,n).concat(t.slice(n+1));break}return null!=r&&t.push({name:e,value:r}),t}Cr.prototype=Pr.prototype={constructor:Cr,on:function(t,e){var r,n,o=this._,i=(n=o,(t+"").trim().split(/^|\s+/).map((function(t){var e="",r=t.indexOf(".");if(r>=0&&(e=t.slice(r+1),t=t.slice(0,r)),t&&!n.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}}))),s=-1,a=i.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++s<a;)if(r=(t=i[s]).type)o[r]=Tr(o[r],t.name,e);else if(null==e)for(r in o)o[r]=Tr(o[r],t.name,null);return this}for(;++s<a;)if((r=(t=i[s]).type)&&(r=Dr(o[r],t.name)))return r},copy:function(){var t={},e=this._;for(var r in e)t[r]=e[r].slice();return new Cr(t)},call:function(t,e){if((r=arguments.length-2)>0)for(var r,n,o=new Array(r),i=0;i<r;++i)o[i]=arguments[i+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(i=0,r=(n=this._[t]).length;i<r;++i)n[i].value.apply(e,o)},apply:function(t,e,r){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var n=this._[t],o=0,i=n.length;o<i;++o)n[o].value.apply(e,r)}};const Lr=Pr;var Fr,qr,Vr=0,Br=0,$r=0,Gr=0,Ur=0,Wr=0,Yr="object"==typeof performance&&performance.now?performance:Date,Kr="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function Jr(){return Ur||(Kr(Hr),Ur=Yr.now()+Wr)}function Hr(){Ur=0}function Xr(){this._call=this._time=this._next=null}function Qr(t,e,r){var n=new Xr;return n.restart(t,e,r),n}function Zr(){Ur=(Gr=Yr.now())+Wr,Vr=Br=0;try{!function(){Jr(),++Vr;for(var t,e=Fr;e;)(t=Ur-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Vr}()}finally{Vr=0,function(){for(var t,e,r=Fr,n=1/0;r;)r._call?(n>r._time&&(n=r._time),t=r,r=r._next):(e=r._next,r._next=null,r=t?t._next=e:Fr=e);qr=t,en(n)}(),Ur=0}}function tn(){var t=Yr.now(),e=t-Gr;e>1e3&&(Wr-=e,Gr=t)}function en(t){Vr||(Br&&(Br=clearTimeout(Br)),t-Ur>24?(t<1/0&&(Br=setTimeout(Zr,t-Yr.now()-Wr)),$r&&($r=clearInterval($r))):($r||(Gr=Yr.now(),$r=setInterval(tn,1e3)),Vr=1,Kr(Zr)))}Xr.prototype=Qr.prototype={constructor:Xr,restart:function(t,e,r){if("function"!=typeof t)throw new TypeError("callback is not a function");r=(null==r?Jr():+r)+(null==e?0:+e),this._next||qr===this||(qr?qr._next=this:Fr=this,qr=this),this._call=t,this._time=r,en()},stop:function(){this._call&&(this._call=null,this._time=1/0,en())}};const rn=4294967296;function nn(t){return t.x}function on(t){return t.y}var sn=Math.PI*(3-Math.sqrt(5));function an(){var t,e,r,n,o,i=jr(-30),s=1,a=1/0,u=.81;function d(r){var o,i=t.length,s=me(t,nn,on).visitAfter(c);for(n=r,o=0;o<i;++o)e=t[o],s.visit(l)}function h(){if(t){var e,r,n=t.length;for(o=new Array(n),e=0;e<n;++e)r=t[e],o[r.index]=+i(r,e,t)}}function c(t){var e,r,n,i,s,a=0,u=0;if(t.length){for(n=i=s=0;s<4;++s)(e=t[s])&&(r=Math.abs(e.value))&&(a+=e.value,u+=r,n+=r*e.x,i+=r*e.y);t.x=n/u,t.y=i/u}else{(e=t).x=e.data.x,e.y=e.data.y;do{a+=o[e.data.index]}while(e=e.next)}t.value=a}function l(t,i,d,h){if(!t.value)return!0;var c=t.x-e.x,l=t.y-e.y,f=h-i,g=c*c+l*l;if(f*f/u<g)return g<a&&(0===c&&(g+=(c=Or(r))*c),0===l&&(g+=(l=Or(r))*l),g<s&&(g=Math.sqrt(s*g)),e.vx+=c*t.value*n/g,e.vy+=l*t.value*n/g),!0;if(!(t.length||g>=a)){(t.data!==e||t.next)&&(0===c&&(g+=(c=Or(r))*c),0===l&&(g+=(l=Or(r))*l),g<s&&(g=Math.sqrt(s*g)));do{t.data!==e&&(f=o[t.data.index]*n/g,e.vx+=c*f,e.vy+=l*f)}while(t=t.next)}}return d.initialize=function(e,n){t=e,r=n,h()},d.strength=function(t){return arguments.length?(i="function"==typeof t?t:jr(+t),h(),d):i},d.distanceMin=function(t){return arguments.length?(s=t*t,d):Math.sqrt(s)},d.distanceMax=function(t){return arguments.length?(a=t*t,d):Math.sqrt(a)},d.theta=function(t){return arguments.length?(u=t*t,d):Math.sqrt(u)},d}function un(t,e){var r,n=1;function o(){var o,i,s=r.length,a=0,u=0;for(o=0;o<s;++o)a+=(i=r[o]).x,u+=i.y;for(a=(a/s-t)*n,u=(u/s-e)*n,o=0;o<s;++o)(i=r[o]).x-=a,i.y-=u}return null==t&&(t=0),null==e&&(e=0),o.initialize=function(t){r=t},o.x=function(e){return arguments.length?(t=+e,o):t},o.y=function(t){return arguments.length?(e=+t,o):e},o.strength=function(t){return arguments.length?(n=+t,o):n},o}function dn(t){return t.x+t.vx}function hn(t){return t.y+t.vy}function cn(t){var e,r,n,o=1,i=1;function s(){for(var t,s,u,d,h,c,l,f=e.length,g=0;g<i;++g)for(s=me(e,dn,hn).visitAfter(a),t=0;t<f;++t)u=e[t],c=r[u.index],l=c*c,d=u.x+u.vx,h=u.y+u.vy,s.visit(p);function p(t,e,r,i,s){var a=t.data,f=t.r,g=c+f;if(!a)return e>d+g||i<d-g||r>h+g||s<h-g;if(a.index>u.index){var p=d-a.x-a.vx,v=h-a.y-a.vy,y=p*p+v*v;y<g*g&&(0===p&&(y+=(p=Or(n))*p),0===v&&(y+=(v=Or(n))*v),y=(g-(y=Math.sqrt(y)))/y*o,u.vx+=(p*=y)*(g=(f*=f)/(l+f)),u.vy+=(v*=y)*g,a.vx-=p*(g=1-g),a.vy-=v*g)}}}function a(t){if(t.data)return t.r=r[t.data.index];for(var e=t.r=0;e<4;++e)t[e]&&t[e].r>t.r&&(t.r=t[e].r)}function u(){if(e){var n,o,i=e.length;for(r=new Array(i),n=0;n<i;++n)o=e[n],r[o.index]=+t(o,n,e)}}return"function"!=typeof t&&(t=jr(null==t?1:+t)),s.initialize=function(t,r){e=t,n=r,u()},s.iterations=function(t){return arguments.length?(i=+t,s):i},s.strength=function(t){return arguments.length?(o=+t,s):o},s.radius=function(e){return arguments.length?(t="function"==typeof e?e:jr(+e),u(),s):t},s}function ln(t,e,r){var n,o,i,s=jr(.1);function a(t){for(var s=0,a=n.length;s<a;++s){var u=n[s],d=u.x-e||1e-6,h=u.y-r||1e-6,c=Math.sqrt(d*d+h*h),l=(i[s]-c)*o[s]*t/c;u.vx+=d*l,u.vy+=h*l}}function u(){if(n){var e,r=n.length;for(o=new Array(r),i=new Array(r),e=0;e<r;++e)i[e]=+t(n[e],e,n),o[e]=isNaN(i[e])?0:+s(n[e],e,n)}}return"function"!=typeof t&&(t=jr(+t)),null==e&&(e=0),null==r&&(r=0),a.initialize=function(t){n=t,u()},a.strength=function(t){return arguments.length?(s="function"==typeof t?t:jr(+t),u(),a):s},a.radius=function(e){return arguments.length?(t="function"==typeof e?e:jr(+e),u(),a):t},a.x=function(t){return arguments.length?(e=+t,a):e},a.y=function(t){return arguments.length?(r=+t,a):r},a}function fn(t){var e,r,n,o=jr(.1);function i(t){for(var o,i=0,s=e.length;i<s;++i)(o=e[i]).vx+=(n[i]-o.x)*r[i]*t}function s(){if(e){var i,s=e.length;for(r=new Array(s),n=new Array(s),i=0;i<s;++i)r[i]=isNaN(n[i]=+t(e[i],i,e))?0:+o(e[i],i,e)}}return"function"!=typeof t&&(t=jr(null==t?0:+t)),i.initialize=function(t){e=t,s()},i.strength=function(t){return arguments.length?(o="function"==typeof t?t:jr(+t),s(),i):o},i.x=function(e){return arguments.length?(t="function"==typeof e?e:jr(+e),s(),i):t},i}function gn(t){var e,r,n,o=jr(.1);function i(t){for(var o,i=0,s=e.length;i<s;++i)(o=e[i]).vy+=(n[i]-o.y)*r[i]*t}function s(){if(e){var i,s=e.length;for(r=new Array(s),n=new Array(s),i=0;i<s;++i)r[i]=isNaN(n[i]=+t(e[i],i,e))?0:+o(e[i],i,e)}}return"function"!=typeof t&&(t=jr(null==t?0:+t)),i.initialize=function(t){e=t,s()},i.strength=function(t){return arguments.length?(o="function"==typeof t?t:jr(+t),s(),i):o},i.y=function(e){return arguments.length?(t="function"==typeof e?e:jr(+e),s(),i):t},i}class pn{constructor(t){this.id="d3-force",this.config={inputNodeAttrs:["x","y","vx","vy","fx","fy"],outputNodeAttrs:["x","y","vx","vy"],simulationAttrs:["alpha","alphaMin","alphaDecay","alphaTarget","velocityDecay","randomSource"]},this.forceMap={link:Rr,manyBody:an,center:un,collide:cn,radial:ln,x:fn,y:gn},this.options={link:{id:t=>t.id},manyBody:{},center:{x:0,y:0}},this.context={options:{},assign:!1,nodes:[],edges:[]},Mr(this.options,t),this.options.forceSimulation&&(this.simulation=this.options.forceSimulation)}execute(t,r){return e(this,void 0,void 0,(function*(){return this.genericLayout(!1,t,r)}))}assign(t,r){return e(this,void 0,void 0,(function*(){yield this.genericLayout(!0,t,r)}))}stop(){this.simulation.stop()}tick(t){return this.simulation.tick(t),this.getResult()}restart(){this.simulation.restart()}setFixedPosition(t,e){const r=this.context.nodes.find((e=>e.id===t));r&&e.forEach(((t,e)=>{"number"!=typeof t&&null!==t||(r[["fx","fy","fz"][e]]=t)}))}getOptions(t){var e,r;const n=Mr({},this.options,t);return n.collide&&void 0===(null===(e=n.collide)||void 0===e?void 0:e.radius)&&(n.collide=n.collide||{},n.collide.radius=null!==(r=n.nodeSize)&&void 0!==r?r:10),void 0===n.iterations&&(n.link&&void 0===n.link.iterations&&(n.iterations=n.link.iterations),n.collide&&void 0===n.collide.iterations&&(n.iterations=n.collide.iterations)),this.context.options=n,n}genericLayout(t,r,n){var o;return e(this,void 0,void 0,(function*(){const e=this.getOptions(n),i=r.getAllNodes().map((({id:t,data:e})=>Object.assign(Object.assign({id:t},e),Ar(e.data,this.config.inputNodeAttrs)))),s=r.getAllEdges().map((t=>Object.assign({},t)));Object.assign(this.context,{assign:t,nodes:i,edges:s,graph:r});const a=new Promise((t=>{this.resolver=t})),u=this.setSimulation(e);return u.nodes(i),null===(o=u.force("link"))||void 0===o||o.links(s),a}))}getResult(){const{assign:t,nodes:e,edges:r,graph:n}=this.context,o=e.map((t=>({id:t.id,data:Object.assign(Object.assign({},t.data),Ar(t,this.config.outputNodeAttrs))}))),i=r.map((({id:t,source:e,target:r,data:n})=>({id:t,source:"object"==typeof e?e.id:e,target:"object"==typeof r?r.id:r,data:n})));return t&&o.forEach((t=>n.mergeNodeData(t.id,t.data))),{nodes:o,edges:i}}initSimulation(){return function(t){var e,r=1,n=.001,o=1-Math.pow(n,1/300),i=0,s=.6,a=new Map,u=Qr(c),d=Lr("tick","end"),h=function(){let t=1;return()=>(t=(1664525*t+1013904223)%rn)/rn}();function c(){l(),d.call("tick",e),r<n&&(u.stop(),d.call("end",e))}function l(n){var u,d,h=t.length;void 0===n&&(n=1);for(var c=0;c<n;++c)for(r+=(i-r)*o,a.forEach((function(t){t(r)})),u=0;u<h;++u)null==(d=t[u]).fx?d.x+=d.vx*=s:(d.x=d.fx,d.vx=0),null==d.fy?d.y+=d.vy*=s:(d.y=d.fy,d.vy=0);return e}function f(){for(var e,r=0,n=t.length;r<n;++r){if((e=t[r]).index=r,null!=e.fx&&(e.x=e.fx),null!=e.fy&&(e.y=e.fy),isNaN(e.x)||isNaN(e.y)){var o=10*Math.sqrt(.5+r),i=r*sn;e.x=o*Math.cos(i),e.y=o*Math.sin(i)}(isNaN(e.vx)||isNaN(e.vy))&&(e.vx=e.vy=0)}}function g(e){return e.initialize&&e.initialize(t,h),e}return null==t&&(t=[]),f(),e={tick:l,restart:function(){return u.restart(c),e},stop:function(){return u.stop(),e},nodes:function(r){return arguments.length?(t=r,f(),a.forEach(g),e):t},alpha:function(t){return arguments.length?(r=+t,e):r},alphaMin:function(t){return arguments.length?(n=+t,e):n},alphaDecay:function(t){return arguments.length?(o=+t,e):+o},alphaTarget:function(t){return arguments.length?(i=+t,e):i},velocityDecay:function(t){return arguments.length?(s=1-t,e):1-s},randomSource:function(t){return arguments.length?(h=t,a.forEach(g),e):h},force:function(t,r){return arguments.length>1?(null==r?a.delete(t):a.set(t,g(r)),e):a.get(t)},find:function(e,r,n){var o,i,s,a,u,d=0,h=t.length;for(null==n?n=1/0:n*=n,d=0;d<h;++d)(s=(o=e-(a=t[d]).x)*o+(i=r-a.y)*i)<n&&(u=a,n=s);return u},on:function(t,r){return arguments.length>1?(d.on(t,r),e):d.on(t)}}}()}setSimulation(t){const e=this.simulation||this.options.forceSimulation||this.initSimulation();return this.simulation||(this.simulation=e.on("tick",(()=>{var e;return null===(e=t.onTick)||void 0===e?void 0:e.call(t,this.getResult())})).on("end",(()=>{var t;return null===(t=this.resolver)||void 0===t?void 0:t.call(this,this.getResult())}))),vn(e,this.config.simulationAttrs.map((e=>[e,t[e]]))),Object.entries(this.forceMap).forEach((([r,n])=>{const o=r;if(t[r]){let r=e.force(o);r||(r=n(),e.force(o,r)),vn(r,Object.entries(t[o]))}else e.force(o,null)})),e}}const vn=(t,e)=>e.reduce(((e,[r,n])=>e[r]&&void 0!==n?e[r].call(t,n):e),t);function yn(t){return function(){return t}}function mn(t){return 1e-6*(t()-.5)}function wn(t){return t.index}function xn(t,e){var r=t.get(e);if(!r)throw new Error("node not found: "+e);return r}function bn(t){var e,r,n,o,i,s,a,u=wn,d=function(t){return 1/Math.min(i[t.source.index],i[t.target.index])},h=yn(30),c=1;function l(n){for(var i=0,u=t.length;i<c;++i)for(var d,h,l,f,g,p=0,v=0,y=0,m=0;p<u;++p)h=(d=t[p]).source,v=(l=d.target).x+l.vx-h.x-h.vx||mn(a),o>1&&(y=l.y+l.vy-h.y-h.vy||mn(a)),o>2&&(m=l.z+l.vz-h.z-h.vz||mn(a)),v*=f=((f=Math.sqrt(v*v+y*y+m*m))-r[p])/f*n*e[p],y*=f,m*=f,l.vx-=v*(g=s[p]),o>1&&(l.vy-=y*g),o>2&&(l.vz-=m*g),h.vx+=v*(g=1-g),o>1&&(h.vy+=y*g),o>2&&(h.vz+=m*g)}function f(){if(n){var o,a,d=n.length,h=t.length,c=new Map(n.map(((t,e)=>[u(t,e,n),t])));for(o=0,i=new Array(d);o<h;++o)(a=t[o]).index=o,"object"!=typeof a.source&&(a.source=xn(c,a.source)),"object"!=typeof a.target&&(a.target=xn(c,a.target)),i[a.source.index]=(i[a.source.index]||0)+1,i[a.target.index]=(i[a.target.index]||0)+1;for(o=0,s=new Array(h);o<h;++o)a=t[o],s[o]=i[a.source.index]/(i[a.source.index]+i[a.target.index]);e=new Array(h),g(),r=new Array(h),p()}}function g(){if(n)for(var r=0,o=t.length;r<o;++r)e[r]=+d(t[r],r,t)}function p(){if(n)for(var e=0,o=t.length;e<o;++e)r[e]=+h(t[e],e,t)}return null==t&&(t=[]),l.initialize=function(t,...e){n=t,a=e.find((t=>"function"==typeof t))||Math.random,o=e.find((t=>[1,2,3].includes(t)))||2,f()},l.links=function(e){return arguments.length?(t=e,f(),l):t},l.id=function(t){return arguments.length?(u=t,l):u},l.iterations=function(t){return arguments.length?(c=+t,l):c},l.strength=function(t){return arguments.length?(d="function"==typeof t?t:yn(+t),g(),l):d},l.distance=function(t){return arguments.length?(h="function"==typeof t?t:yn(+t),p(),l):h},l}function En(t,e,r){if(isNaN(e))return t;var n,o,i,s,a,u,d=t._root,h={data:r},c=t._x0,l=t._x1;if(!d)return t._root=h,t;for(;d.length;)if((s=e>=(o=(c+l)/2))?c=o:l=o,n=d,!(d=d[a=+s]))return n[a]=h,t;if(e===(i=+t._x.call(null,d.data)))return h.next=d,n?n[a]=h:t._root=h,t;do{n=n?n[a]=new Array(2):t._root=new Array(2),(s=e>=(o=(c+l)/2))?c=o:l=o}while((a=+s)==(u=+(i>=o)));return n[u]=d,n[a]=h,t}function Nn(t,e,r){this.node=t,this.x0=e,this.x1=r}function _n(t){return t[0]}function Mn(t,e){var r=new kn(null==e?_n:e,NaN,NaN);return null==t?r:r.addAll(t)}function kn(t,e,r){this._x=t,this._x0=e,this._x1=r,this._root=void 0}function An(t){for(var e={data:t.data},r=e;t=t.next;)r=r.next={data:t.data};return e}var jn=Mn.prototype=kn.prototype;jn.copy=function(){var t,e,r=new kn(this._x,this._x0,this._x1),n=this._root;if(!n)return r;if(!n.length)return r._root=An(n),r;for(t=[{source:n,target:r._root=new Array(2)}];n=t.pop();)for(var o=0;o<2;++o)(e=n.source[o])&&(e.length?t.push({source:e,target:n.target[o]=new Array(2)}):n.target[o]=An(e));return r},jn.add=function(t){const e=+this._x.call(null,t);return En(this.cover(e),e,t)},jn.addAll=function(t){Array.isArray(t)||(t=Array.from(t));const e=t.length,r=new Float64Array(e);let n=1/0,o=-1/0;for(let i,s=0;s<e;++s)isNaN(i=+this._x.call(null,t[s]))||(r[s]=i,i<n&&(n=i),i>o&&(o=i));if(n>o)return this;this.cover(n).cover(o);for(let n=0;n<e;++n)En(this,r[n],t[n]);return this},jn.cover=function(t){if(isNaN(t=+t))return this;var e=this._x0,r=this._x1;if(isNaN(e))r=(e=Math.floor(t))+1;else{for(var n,o,i=r-e||1,s=this._root;e>t||t>=r;)switch(o=+(t<e),(n=new Array(2))[o]=s,s=n,i*=2,o){case 0:r=e+i;break;case 1:e=r-i}this._root&&this._root.length&&(this._root=s)}return this._x0=e,this._x1=r,this},jn.data=function(){var t=[];return this.visit((function(e){if(!e.length)do{t.push(e.data)}while(e=e.next)})),t},jn.extent=function(t){return arguments.length?this.cover(+t[0][0]).cover(+t[1][0]):isNaN(this._x0)?void 0:[[this._x0],[this._x1]]},jn.find=function(t,e){var r,n,o,i,s,a=this._x0,u=this._x1,d=[],h=this._root;for(h&&d.push(new Nn(h,a,u)),null==e?e=1/0:(a=t-e,u=t+e);i=d.pop();)if(!(!(h=i.node)||(n=i.x0)>u||(o=i.x1)<a))if(h.length){var c=(n+o)/2;d.push(new Nn(h[1],c,o),new Nn(h[0],n,c)),(s=+(t>=c))&&(i=d[d.length-1],d[d.length-1]=d[d.length-1-s],d[d.length-1-s]=i)}else{var l=Math.abs(t-+this._x.call(null,h.data));l<e&&(e=l,a=t-l,u=t+l,r=h.data)}return r},jn.remove=function(t){if(isNaN(i=+this._x.call(null,t)))return this;var e,r,n,o,i,s,a,u,d,h=this._root,c=this._x0,l=this._x1;if(!h)return this;if(h.length)for(;;){if((a=i>=(s=(c+l)/2))?c=s:l=s,e=h,!(h=h[u=+a]))return this;if(!h.length)break;e[u+1&1]&&(r=e,d=u)}for(;h.data!==t;)if(n=h,!(h=h.next))return this;return(o=h.next)&&delete h.next,n?(o?n.next=o:delete n.next,this):e?(o?e[u]=o:delete e[u],(h=e[0]||e[1])&&h===(e[1]||e[0])&&!h.length&&(r?r[d]=h:this._root=h),this):(this._root=o,this)},jn.removeAll=function(t){for(var e=0,r=t.length;e<r;++e)this.remove(t[e]);return this},jn.root=function(){return this._root},jn.size=function(){var t=0;return this.visit((function(e){if(!e.length)do{++t}while(e=e.next)})),t},jn.visit=function(t){var e,r,n,o,i=[],s=this._root;for(s&&i.push(new Nn(s,this._x0,this._x1));e=i.pop();)if(!t(s=e.node,n=e.x0,o=e.x1)&&s.length){var a=(n+o)/2;(r=s[1])&&i.push(new Nn(r,a,o)),(r=s[0])&&i.push(new Nn(r,n,a))}return this},jn.visitAfter=function(t){var e,r=[],n=[];for(this._root&&r.push(new Nn(this._root,this._x0,this._x1));e=r.pop();){var o=e.node;if(o.length){var i,s=e.x0,a=e.x1,u=(s+a)/2;(i=o[0])&&r.push(new Nn(i,s,u)),(i=o[1])&&r.push(new Nn(i,u,a))}n.push(e)}for(;e=n.pop();)t(e.node,e.x0,e.x1);return this},jn.x=function(t){return arguments.length?(this._x=t,this):this._x};const On=4294967296;function Sn(t){return t.x}function zn(t){return t.y}function Rn(t){return t.z}var In=Math.PI*(3-Math.sqrt(5)),Pn=20*Math.PI/(9+Math.sqrt(221));function Cn(){var t,e,r,n,o,i,s=yn(-30),a=1,u=1/0,d=.81;function h(n){var i,s=t.length,a=(1===e?Mn(t,Sn):2===e?me(t,Sn,zn):3===e?Ae(t,Sn,zn,Rn):null).visitAfter(l);for(o=n,i=0;i<s;++i)r=t[i],a.visit(f)}function c(){if(t){var e,r,n=t.length;for(i=new Array(n),e=0;e<n;++e)r=t[e],i[r.index]=+s(r,e,t)}}function l(t){var r,n,o,s,a,u,d=0,h=0,c=t.length;if(c){for(o=s=a=u=0;u<c;++u)(r=t[u])&&(n=Math.abs(r.value))&&(d+=r.value,h+=n,o+=n*(r.x||0),s+=n*(r.y||0),a+=n*(r.z||0));d*=Math.sqrt(4/c),t.x=o/h,e>1&&(t.y=s/h),e>2&&(t.z=a/h)}else{(r=t).x=r.data.x,e>1&&(r.y=r.data.y),e>2&&(r.z=r.data.z);do{d+=i[r.data.index]}while(r=r.next)}t.value=d}function f(t,s,h,c,l){if(!t.value)return!0;var f=[h,c,l][e-1],g=t.x-r.x,p=e>1?t.y-r.y:0,v=e>2?t.z-r.z:0,y=f-s,m=g*g+p*p+v*v;if(y*y/d<m)return m<u&&(0===g&&(m+=(g=mn(n))*g),e>1&&0===p&&(m+=(p=mn(n))*p),e>2&&0===v&&(m+=(v=mn(n))*v),m<a&&(m=Math.sqrt(a*m)),r.vx+=g*t.value*o/m,e>1&&(r.vy+=p*t.value*o/m),e>2&&(r.vz+=v*t.value*o/m)),!0;if(!(t.length||m>=u)){(t.data!==r||t.next)&&(0===g&&(m+=(g=mn(n))*g),e>1&&0===p&&(m+=(p=mn(n))*p),e>2&&0===v&&(m+=(v=mn(n))*v),m<a&&(m=Math.sqrt(a*m)));do{t.data!==r&&(y=i[t.data.index]*o/m,r.vx+=g*y,e>1&&(r.vy+=p*y),e>2&&(r.vz+=v*y))}while(t=t.next)}}return h.initialize=function(r,...o){t=r,n=o.find((t=>"function"==typeof t))||Math.random,e=o.find((t=>[1,2,3].includes(t)))||2,c()},h.strength=function(t){return arguments.length?(s="function"==typeof t?t:yn(+t),c(),h):s},h.distanceMin=function(t){return arguments.length?(a=t*t,h):Math.sqrt(a)},h.distanceMax=function(t){return arguments.length?(u=t*t,h):Math.sqrt(u)},h.theta=function(t){return arguments.length?(d=t*t,h):Math.sqrt(d)},h}function Dn(t,e,r){var n,o=1;function i(){var i,s,a=n.length,u=0,d=0,h=0;for(i=0;i<a;++i)u+=(s=n[i]).x||0,d+=s.y||0,h+=s.z||0;for(u=(u/a-t)*o,d=(d/a-e)*o,h=(h/a-r)*o,i=0;i<a;++i)s=n[i],u&&(s.x-=u),d&&(s.y-=d),h&&(s.z-=h)}return null==t&&(t=0),null==e&&(e=0),null==r&&(r=0),i.initialize=function(t){n=t},i.x=function(e){return arguments.length?(t=+e,i):t},i.y=function(t){return arguments.length?(e=+t,i):e},i.z=function(t){return arguments.length?(r=+t,i):r},i.strength=function(t){return arguments.length?(o=+t,i):o},i}function Tn(t){return t.x+t.vx}function Ln(t){return t.y+t.vy}function Fn(t){return t.z+t.vz}function qn(t){var e,r,n,o,i=1,s=1;function a(){for(var t,a,d,h,c,l,f,g,p=e.length,v=0;v<s;++v)for(a=(1===r?Mn(e,Tn):2===r?me(e,Tn,Ln):3===r?Ae(e,Tn,Ln,Fn):null).visitAfter(u),t=0;t<p;++t)d=e[t],f=n[d.index],g=f*f,h=d.x+d.vx,r>1&&(c=d.y+d.vy),r>2&&(l=d.z+d.vz),a.visit(y);function y(t,e,n,s,a,u,p){var v=[e,n,s,a,u,p],y=v[0],m=v[1],w=v[2],x=v[r],b=v[r+1],E=v[r+2],N=t.data,_=t.r,M=f+_;if(!N)return y>h+M||x<h-M||r>1&&(m>c+M||b<c-M)||r>2&&(w>l+M||E<l-M);if(N.index>d.index){var k=h-N.x-N.vx,A=r>1?c-N.y-N.vy:0,j=r>2?l-N.z-N.vz:0,O=k*k+A*A+j*j;O<M*M&&(0===k&&(O+=(k=mn(o))*k),r>1&&0===A&&(O+=(A=mn(o))*A),r>2&&0===j&&(O+=(j=mn(o))*j),O=(M-(O=Math.sqrt(O)))/O*i,d.vx+=(k*=O)*(M=(_*=_)/(g+_)),r>1&&(d.vy+=(A*=O)*M),r>2&&(d.vz+=(j*=O)*M),N.vx-=k*(M=1-M),r>1&&(N.vy-=A*M),r>2&&(N.vz-=j*M))}}}function u(t){if(t.data)return t.r=n[t.data.index];for(var e=t.r=0;e<Math.pow(2,r);++e)t[e]&&t[e].r>t.r&&(t.r=t[e].r)}function d(){if(e){var r,o,i=e.length;for(n=new Array(i),r=0;r<i;++r)o=e[r],n[o.index]=+t(o,r,e)}}return"function"!=typeof t&&(t=yn(null==t?1:+t)),a.initialize=function(t,...n){e=t,o=n.find((t=>"function"==typeof t))||Math.random,r=n.find((t=>[1,2,3].includes(t)))||2,d()},a.iterations=function(t){return arguments.length?(s=+t,a):s},a.strength=function(t){return arguments.length?(i=+t,a):i},a.radius=function(e){return arguments.length?(t="function"==typeof e?e:yn(+e),d(),a):t},a}function Vn(t,e,r,n){var o,i,s,a,u=yn(.1);function d(t){for(var u=0,d=o.length;u<d;++u){var h=o[u],c=h.x-e||1e-6,l=(h.y||0)-r||1e-6,f=(h.z||0)-n||1e-6,g=Math.sqrt(c*c+l*l+f*f),p=(a[u]-g)*s[u]*t/g;h.vx+=c*p,i>1&&(h.vy+=l*p),i>2&&(h.vz+=f*p)}}function h(){if(o){var e,r=o.length;for(s=new Array(r),a=new Array(r),e=0;e<r;++e)a[e]=+t(o[e],e,o),s[e]=isNaN(a[e])?0:+u(o[e],e,o)}}return"function"!=typeof t&&(t=yn(+t)),null==e&&(e=0),null==r&&(r=0),null==n&&(n=0),d.initialize=function(t,...e){o=t,i=e.find((t=>[1,2,3].includes(t)))||2,h()},d.strength=function(t){return arguments.length?(u="function"==typeof t?t:yn(+t),h(),d):u},d.radius=function(e){return arguments.length?(t="function"==typeof e?e:yn(+e),h(),d):t},d.x=function(t){return arguments.length?(e=+t,d):e},d.y=function(t){return arguments.length?(r=+t,d):r},d.z=function(t){return arguments.length?(n=+t,d):n},d}function Bn(t){var e,r,n,o=yn(.1);function i(t){for(var o,i=0,s=e.length;i<s;++i)(o=e[i]).vx+=(n[i]-o.x)*r[i]*t}function s(){if(e){var i,s=e.length;for(r=new Array(s),n=new Array(s),i=0;i<s;++i)r[i]=isNaN(n[i]=+t(e[i],i,e))?0:+o(e[i],i,e)}}return"function"!=typeof t&&(t=yn(null==t?0:+t)),i.initialize=function(t){e=t,s()},i.strength=function(t){return arguments.length?(o="function"==typeof t?t:yn(+t),s(),i):o},i.x=function(e){return arguments.length?(t="function"==typeof e?e:yn(+e),s(),i):t},i}function $n(t){var e,r,n,o=yn(.1);function i(t){for(var o,i=0,s=e.length;i<s;++i)(o=e[i]).vy+=(n[i]-o.y)*r[i]*t}function s(){if(e){var i,s=e.length;for(r=new Array(s),n=new Array(s),i=0;i<s;++i)r[i]=isNaN(n[i]=+t(e[i],i,e))?0:+o(e[i],i,e)}}return"function"!=typeof t&&(t=yn(null==t?0:+t)),i.initialize=function(t){e=t,s()},i.strength=function(t){return arguments.length?(o="function"==typeof t?t:yn(+t),s(),i):o},i.y=function(e){return arguments.length?(t="function"==typeof e?e:yn(+e),s(),i):t},i}function Gn(t){var e,r,n,o=yn(.1);function i(t){for(var o,i=0,s=e.length;i<s;++i)(o=e[i]).vz+=(n[i]-o.z)*r[i]*t}function s(){if(e){var i,s=e.length;for(r=new Array(s),n=new Array(s),i=0;i<s;++i)r[i]=isNaN(n[i]=+t(e[i],i,e))?0:+o(e[i],i,e)}}return"function"!=typeof t&&(t=yn(null==t?0:+t)),i.initialize=function(t){e=t,s()},i.strength=function(t){return arguments.length?(o="function"==typeof t?t:yn(+t),s(),i):o},i.z=function(e){return arguments.length?(t="function"==typeof e?e:yn(+e),s(),i):t},i}class Un extends pn{constructor(){super(...arguments),this.id="d3-force-3d",this.config={inputNodeAttrs:["x","y","z","vx","vy","vz","fx","fy","fz"],outputNodeAttrs:["x","y","z","vx","vy","vz"],simulationAttrs:["alpha","alphaMin","alphaDecay","alphaTarget","velocityDecay","randomSource","numDimensions"]},this.forceMap={link:bn,manyBody:Cn,center:Dn,collide:qn,radial:Vn,x:Bn,y:$n,z:Gn},this.options={numDimensions:3,link:{id:t=>t.id},manyBody:{},center:{x:0,y:0,z:0}}}initSimulation(){return function(t,e){e=e||2;var r,n=Math.min(3,Math.max(1,Math.round(e))),o=1,i=.001,s=1-Math.pow(i,1/300),a=0,u=.6,d=new Map,h=Qr(f),c=Lr("tick","end"),l=function(){let t=1;return()=>(t=(1664525*t+1013904223)%On)/On}();function f(){g(),c.call("tick",r),o<i&&(h.stop(),c.call("end",r))}function g(e){var i,h,c=t.length;void 0===e&&(e=1);for(var l=0;l<e;++l)for(o+=(a-o)*s,d.forEach((function(t){t(o)})),i=0;i<c;++i)null==(h=t[i]).fx?h.x+=h.vx*=u:(h.x=h.fx,h.vx=0),n>1&&(null==h.fy?h.y+=h.vy*=u:(h.y=h.fy,h.vy=0)),n>2&&(null==h.fz?h.z+=h.vz*=u:(h.z=h.fz,h.vz=0));return r}function p(){for(var e,r=0,o=t.length;r<o;++r){if((e=t[r]).index=r,null!=e.fx&&(e.x=e.fx),null!=e.fy&&(e.y=e.fy),null!=e.fz&&(e.z=e.fz),isNaN(e.x)||n>1&&isNaN(e.y)||n>2&&isNaN(e.z)){var i=10*(n>2?Math.cbrt(.5+r):n>1?Math.sqrt(.5+r):r),s=r*In,a=r*Pn;1===n?e.x=i:2===n?(e.x=i*Math.cos(s),e.y=i*Math.sin(s)):(e.x=i*Math.sin(s)*Math.cos(a),e.y=i*Math.cos(s),e.z=i*Math.sin(s)*Math.sin(a))}(isNaN(e.vx)||n>1&&isNaN(e.vy)||n>2&&isNaN(e.vz))&&(e.vx=0,n>1&&(e.vy=0),n>2&&(e.vz=0))}}function v(e){return e.initialize&&e.initialize(t,l,n),e}return null==t&&(t=[]),p(),r={tick:g,restart:function(){return h.restart(f),r},stop:function(){return h.stop(),r},numDimensions:function(t){return arguments.length?(n=Math.min(3,Math.max(1,Math.round(t))),d.forEach(v),r):n},nodes:function(e){return arguments.length?(t=e,p(),d.forEach(v),r):t},alpha:function(t){return arguments.length?(o=+t,r):o},alphaMin:function(t){return arguments.length?(i=+t,r):i},alphaDecay:function(t){return arguments.length?(s=+t,r):+s},alphaTarget:function(t){return arguments.length?(a=+t,r):a},velocityDecay:function(t){return arguments.length?(u=1-t,r):1-u},randomSource:function(t){return arguments.length?(l=t,d.forEach(v),r):l},force:function(t,e){return arguments.length>1?(null==e?d.delete(t):d.set(t,v(e)),r):d.get(t)},find:function(){var e,r,o,i,s,a,u=Array.prototype.slice.call(arguments),d=u.shift()||0,h=(n>1?u.shift():null)||0,c=(n>2?u.shift():null)||0,l=u.shift()||1/0,f=0,g=t.length;for(l*=l,f=0;f<g;++f)(i=(e=d-(s=t[f]).x)*e+(r=h-(s.y||0))*r+(o=c-(s.z||0))*o)<l&&(a=s,l=i);return a},on:function(t,e){return arguments.length>1?(c.on(t,e),r):c.on(t)}}}()}}var Wn=r(5439),Yn=r.n(Wn);class Kn{constructor(t){this.id="dagre",this.options={},Object.assign(this.options,Kn.defaultOptions,t)}execute(t,r){return e(this,void 0,void 0,(function*(){return this.genericDagreLayout(!1,t,Object.assign(Object.assign({},this.options),r))}))}assign(t,r){return e(this,void 0,void 0,(function*(){yield this.genericDagreLayout(!0,t,Object.assign(Object.assign({},this.options),r))}))}genericDagreLayout(r,n,o){return e(this,void 0,void 0,(function*(){const{nodeSize:e}=o,i=new Wn.graphlib.Graph;i.setGraph(o),i.setDefaultEdgeLabel((()=>({}))),[...n.getAllNodes(),...n.getAllEdges()].some((({id:t})=>v(t)))&&console.error("Dagre layout only support string id, it will convert number to string."),n.getAllNodes().forEach((t=>{const{id:r}=t,n=Object.assign({},t.data);if(void 0!==e){const[r,o]=Ht(Kt(e)?e(t):e);Object.assign(n,{width:r,height:o})}i.setNode(r.toString(),n)})),n.getAllEdges().forEach((({id:t,source:e,target:r})=>{i.setEdge(e.toString(),r.toString(),{id:t})})),Yn().layout(i);const s={nodes:[],edges:[]};return i.nodes().forEach((t=>{const e=i.node(t);s.nodes.push({id:t,data:e}),r&&n.mergeNodeData(t,e)})),i.edges().forEach((e=>{const o=i.edge(e),{id:a}=o,u=t(o,["id"]),{v:d,w:h}=e;s.edges.push({id:a,source:d,target:h,data:u}),r&&n.mergeEdgeData(a,u)})),s}))}}Kn.defaultOptions={};class Jn{constructor(t){this.id=t.id||0,this.rx=t.rx,this.ry=t.ry,this.fx=0,this.fy=0,this.mass=t.mass,this.degree=t.degree,this.g=t.g||0}distanceTo(t){const e=this.rx-t.rx,r=this.ry-t.ry;return Math.hypot(e,r)}setPos(t,e){this.rx=t,this.ry=e}resetForce(){this.fx=0,this.fy=0}addForce(t){const e=t.rx-this.rx,r=t.ry-this.ry;let n=Math.hypot(e,r);n=n<1e-4?1e-4:n;const o=this.g*(this.degree+1)*(t.degree+1)/n;this.fx+=o*e/n,this.fy+=o*r/n}in(t){return t.contains(this.rx,this.ry)}add(t){const e=this.mass+t.mass,r=(this.rx*this.mass+t.rx*t.mass)/e,n=(this.ry*this.mass+t.ry*t.mass)/e,o=this.degree+t.degree;return new Jn({rx:r,ry:n,mass:e,degree:o})}}class Hn{constructor(t){this.xmid=t.xmid,this.ymid=t.ymid,this.length=t.length,this.massCenter=t.massCenter||[0,0],this.mass=t.mass||1}getLength(){return this.length}contains(t,e){const r=this.length/2;return t<=this.xmid+r&&t>=this.xmid-r&&e<=this.ymid+r&&e>=this.ymid-r}NW(){const t=this.xmid-this.length/4,e=this.ymid+this.length/4,r=this.length/2;return new Hn({xmid:t,ymid:e,length:r})}NE(){const t=this.xmid+this.length/4,e=this.ymid+this.length/4,r=this.length/2;return new Hn({xmid:t,ymid:e,length:r})}SW(){const t=this.xmid-this.length/4,e=this.ymid-this.length/4,r=this.length/2;return new Hn({xmid:t,ymid:e,length:r})}SE(){const t=this.xmid+this.length/4,e=this.ymid-this.length/4,r=this.length/2;return new Hn({xmid:t,ymid:e,length:r})}}class Xn{constructor(t){this.body=null,this.quad=null,this.NW=null,this.NE=null,this.SW=null,this.SE=null,this.theta=.5,null!=t&&(this.quad=t)}insert(t){null!=this.body?this._isExternal()?(this.quad&&(this.NW=new Xn(this.quad.NW()),this.NE=new Xn(this.quad.NE()),this.SW=new Xn(this.quad.SW()),this.SE=new Xn(this.quad.SE())),this._putBody(this.body),this._putBody(t),this.body=this.body.add(t)):(this.body=this.body.add(t),this._putBody(t)):this.body=t}_putBody(t){this.quad&&(t.in(this.quad.NW())&&this.NW?this.NW.insert(t):t.in(this.quad.NE())&&this.NE?this.NE.insert(t):t.in(this.quad.SW())&&this.SW?this.SW.insert(t):t.in(this.quad.SE())&&this.SE&&this.SE.insert(t))}_isExternal(){return null==this.NW&&null==this.NE&&null==this.SW&&null==this.SE}updateForce(t){null!=this.body&&t!==this.body&&(this._isExternal()||(this.quad?this.quad.getLength():0)/this.body.distanceTo(t)<this.theta?t.addForce(this.body):(this.NW&&this.NW.updateForce(t),this.NE&&this.NE.updateForce(t),this.SW&&this.SW.updateForce(t),this.SE&&this.SE.updateForce(t)))}}const Qn={center:[0,0],width:300,height:300,kr:5,kg:1,mode:"normal",preventOverlap:!1,dissuadeHubs:!1,maxIteration:0,ks:.1,ksmax:10,tao:.1};class Zn{constructor(t={}){this.options=t,this.id="forceAtlas2",this.options=Object.assign(Object.assign({},Qn),t)}execute(t,r){return e(this,void 0,void 0,(function*(){return this.genericForceAtlas2Layout(!1,t,r)}))}assign(t,r){return e(this,void 0,void 0,(function*(){yield this.genericForceAtlas2Layout(!0,t,r)}))}genericForceAtlas2Layout(t,r,n){return e(this,void 0,void 0,(function*(){const e=r.getAllEdges(),o=r.getAllNodes(),i=this.formatOptions(n,o.length),{width:s,height:a,prune:u,maxIteration:d,nodeSize:h,center:c}=i;if(!(null==o?void 0:o.length)||1===o.length)return ie(r,t,c);const l=o.map((t=>ee(t,[s,a]))),g=e.filter((t=>{const{source:e,target:r}=t;return e!==r})),p=new f({nodes:l,edges:g}),v=this.getSizes(p,h);if(this.run(p,r,d,v,t,i),u){for(let t=0;t<g.length;t+=1){const{source:e,target:r}=g[t],n=p.getDegree(e),o=p.getDegree(e);if(n<=1){const t=p.getNode(r);p.mergeNodeData(e,{x:t.data.x,y:t.data.y})}else if(o<=1){const t=p.getNode(e);p.mergeNodeData(r,{x:t.data.x,y:t.data.y})}}const e=Object.assign(Object.assign({},i),{prune:!1,barnesHut:!1});this.run(p,r,100,v,t,e)}return{nodes:l,edges:e}}))}getSizes(t,e){const r=t.getAllNodes(),n={};for(let t=0;t<r.length;t+=1){const o=r[t];n[o.id]=Zt(e,void 0)(o)}return n}formatOptions(t={},e){const r=Object.assign(Object.assign({},this.options),t),{center:n,width:o,height:i,barnesHut:s,prune:a,maxIteration:u,kr:d,kg:h}=r;return r.width=o||"undefined"==typeof window?o:window.innerWidth,r.height=i||"undefined"==typeof window?i:window.innerHeight,r.center=n||[r.width/2,r.height/2],void 0===s&&e>250&&(r.barnesHut=!0),void 0===a&&e>100&&(r.prune=!0),0!==u||a?0===u&&a&&(r.maxIteration=100,e<=200&&e>100?r.maxIteration=500:e>200&&(r.maxIteration=950)):(r.maxIteration=250,e<=200&&e>100?r.maxIteration=1e3:e>200&&(r.maxIteration=1200)),d||(r.kr=50,e>100&&e<=500?r.kr=20:e>500&&(r.kr=1)),h||(r.kg=20,e>100&&e<=500?r.kg=10:e>500&&(r.kg=1)),r}run(t,e,r,n,o,i){const{kr:s,barnesHut:a,onTick:u}=i,d=t.getAllNodes();let h=0,c=r;const l={},f={},g={};for(let e=0;e<d.length;e+=1){const{data:r,id:n}=d[e];if(l[n]=[0,0],a){const o={id:e,rx:r.x,ry:r.y,mass:1,g:s,degree:t.getDegree(n)};g[n]=new Jn(o)}}for(;c>0;)h=this.oneStep(t,{iter:c,preventOverlapIters:50,krPrime:100,sg:h,forces:l,preForces:f,bodies:g,sizes:n},i),c--,null==u||u({nodes:d,edges:e.getAllEdges()});return t}oneStep(t,e,r){const{iter:n,preventOverlapIters:o,krPrime:i,sg:s,preForces:a,bodies:u,sizes:d}=e;let{forces:h}=e;const{preventOverlap:c,barnesHut:l}=r,f=t.getAllNodes();for(let t=0;t<f.length;t+=1){const{id:e}=f[t];a[e]=[...h[e]],h[e]=[0,0]}return h=this.getAttrForces(t,n,o,d,h,r),h=l&&(c&&n>o||!c)?this.getOptRepGraForces(t,h,u,r):this.getRepGraForces(t,n,o,h,i,d,r),this.updatePos(t,h,a,s,r)}getAttrForces(t,e,r,n,o,i){const{preventOverlap:s,dissuadeHubs:a,mode:u,prune:d}=i,h=t.getAllEdges();for(let i=0;i<h.length;i+=1){const{source:c,target:l}=h[i],f=t.getNode(c),g=t.getNode(l),p=t.getDegree(c),v=t.getDegree(l);if(d&&(p<=1||v<=1))continue;const y=[g.data.x-f.data.x,g.data.y-f.data.y];let m=Math.hypot(y[0],y[1]);m=m<1e-4?1e-4:m,y[0]=y[0]/m,y[1]=y[1]/m,s&&e<r&&(m=m-n[c]-n[l]);let w=m,x=w;"linlog"===u&&(w=Math.log(1+m),x=w),a&&(w=m/p,x=m/v),s&&e<r&&m<=0?(w=0,x=0):s&&e<r&&m>0&&(w=m,x=m),o[c][0]+=w*y[0],o[l][0]-=x*y[0],o[c][1]+=w*y[1],o[l][1]-=x*y[1]}return o}getOptRepGraForces(t,e,r,n){const{kg:o,center:i,prune:s}=n,a=t.getAllNodes(),u=a.length;let d=9e10,h=-9e10,c=9e10,l=-9e10;for(let e=0;e<u;e+=1){const{id:n,data:o}=a[e];s&&t.getDegree(n)<=1||(r[n].setPos(o.x,o.y),o.x>=h&&(h=o.x),o.x<=d&&(d=o.x),o.y>=l&&(l=o.y),o.y<=c&&(c=o.y))}const f=Math.max(h-d,l-c),g=new Hn({xmid:(h+d)/2,ymid:(l+c)/2,length:f,massCenter:i,mass:u}),p=new Xn(g);for(let e=0;e<u;e+=1){const{id:n}=a[e];s&&t.getDegree(n)<=1||r[n].in(g)&&p.insert(r[n])}for(let n=0;n<u;n+=1){const{id:u,data:d}=a[n],h=t.getDegree(u);if(s&&h<=1)continue;r[u].resetForce(),p.updateForce(r[u]),e[u][0]-=r[u].fx,e[u][1]-=r[u].fy;const c=[d.x-i[0],d.y-i[1]];let l=Math.hypot(c[0],c[1]);l=l<1e-4?1e-4:l,c[0]=c[0]/l,c[1]=c[1]/l;const f=o*(h+1);e[u][0]-=f*c[0],e[u][1]-=f*c[1]}return e}getRepGraForces(t,e,r,n,o,i,s){const{preventOverlap:a,kr:u,kg:d,center:h,prune:c}=s,l=t.getAllNodes(),f=l.length;for(let s=0;s<f;s+=1){const g=l[s],p=t.getDegree(g.id);for(let d=s+1;d<f;d+=1){const s=l[d],h=t.getDegree(s.id);if(c&&(p<=1||h<=1))continue;const f=[s.data.x-g.data.x,s.data.y-g.data.y];let v=Math.hypot(f[0],f[1]);v=v<1e-4?1e-4:v,f[0]=f[0]/v,f[1]=f[1]/v,a&&e<r&&(v=v-i[g.id]-i[s.id]);let y=u*(p+1)*(h+1)/v;a&&e<r&&v<0?y=o*(p+1)*(h+1):a&&e<r&&0===v?y=0:a&&e<r&&v>0&&(y=u*(p+1)*(h+1)/v),n[g.id][0]-=y*f[0],n[s.id][0]+=y*f[0],n[g.id][1]-=y*f[1],n[s.id][1]+=y*f[1]}const v=[g.data.x-h[0],g.data.y-h[1]],y=Math.hypot(v[0],v[1]);v[0]=v[0]/y,v[1]=v[1]/y;const m=d*(p+1);n[g.id][0]-=m*v[0],n[g.id][1]-=m*v[1]}return n}updatePos(t,e,r,n,o){const{ks:i,tao:s,prune:a,ksmax:u}=o,d=t.getAllNodes(),h=d.length,c=[],l=[];let f=0,g=0,p=n;for(let n=0;n<h;n+=1){const{id:o}=d[n],i=t.getDegree(o);if(a&&i<=1)continue;const s=[e[o][0]-r[o][0],e[o][1]-r[o][1]],u=Math.hypot(s[0],s[1]),h=[e[o][0]+r[o][0],e[o][1]+r[o][1]],p=Math.hypot(h[0],h[1]);c[n]=u,l[n]=p/2,f+=(i+1)*c[n],g+=(i+1)*l[n]}const y=p;p=s*g/f,0!==y&&(p=p>1.5*y?1.5*y:p);for(let r=0;r<h;r+=1){const{id:n,data:o}=d[r],s=t.getDegree(n);if(a&&s<=1)continue;if(v(o.fx)&&v(o.fy))continue;let h=i*p/(1+p*Math.sqrt(c[r])),l=Math.hypot(e[n][0],e[n][1]);l=l<1e-4?1e-4:l;const f=u/l;h=h>f?f:h;const g=h*e[n][0],y=h*e[n][1];t.mergeNodeData(n,{x:o.x+g,y:o.y+y})}return p}}const to={maxIteration:1e3,gravity:10,speed:5,clustering:!1,clusterGravity:10,width:300,height:300,nodeClusterBy:"cluster"};class eo{constructor(t={}){this.options=t,this.id="fruchterman",this.timeInterval=0,this.running=!1,this.options=Object.assign(Object.assign({},to),t)}execute(t,r){return e(this,void 0,void 0,(function*(){return this.genericFruchtermanLayout(!1,t,r)}))}assign(t,r){return e(this,void 0,void 0,(function*(){yield this.genericFruchtermanLayout(!0,t,r)}))}stop(){this.timeInterval&&"undefined"!=typeof window&&window.clearInterval(this.timeInterval),this.running=!1}tick(t=this.options.maxIteration||1){if(this.lastResult)return this.lastResult;for(let e=0;e<t;e++)this.runOneStep(this.lastGraph,this.lastClusterMap,this.lastOptions);const e={nodes:this.lastLayoutNodes,edges:this.lastLayoutEdges};return this.lastAssign&&e.nodes.forEach((t=>this.lastGraph.mergeNodeData(t.id,{x:t.data.x,y:t.data.y,z:3===this.options.dimensions?t.data.z:void 0}))),e}genericFruchtermanLayout(t,r,n){return e(this,void 0,void 0,(function*(){if(this.running)return;const e=this.formatOptions(n),{dimensions:o,width:i,height:s,center:a,clustering:u,nodeClusterBy:d,maxIteration:h,onTick:c}=e,l=r.getAllNodes(),g=r.getAllEdges();if(!(null==l?void 0:l.length)){const t={nodes:[],edges:g};return this.lastResult=t,t}if(1===l.length){t&&r.mergeNodeData(l[0].id,{x:a[0],y:a[1],z:3===o?a[2]:void 0});const e={nodes:[Object.assign(Object.assign({},l[0]),{data:Object.assign(Object.assign({},l[0].data),{x:a[0],y:a[1],z:3===o?a[2]:void 0})})],edges:g};return this.lastResult=e,e}const p=l.map((t=>ee(t,[i,s]))),v=new f({nodes:p,edges:g}),y={};if(u&&p.forEach((t=>{const e=t.data[d];y[e]||(y[e]={name:e,cx:0,cy:0,count:0})})),this.lastLayoutNodes=p,this.lastLayoutEdges=g,this.lastAssign=t,this.lastGraph=v,this.lastOptions=e,this.lastClusterMap=y,"undefined"==typeof window)return;let m=0;return new Promise((n=>{this.timeInterval=window.setInterval((()=>{this.running?(this.runOneStep(v,y,e),t&&p.forEach((({id:t,data:e})=>r.mergeNodeData(t,{x:e.x,y:e.y,z:3===o?e.z:void 0}))),null==c||c({nodes:p,edges:g}),m++,m>=h&&(window.clearInterval(this.timeInterval),n({nodes:p,edges:g}))):n({nodes:p,edges:g})}),0),this.running=!0}))}))}formatOptions(t={}){const e=Object.assign(Object.assign({},this.options),t),{clustering:r,nodeClusterBy:n}=e,{center:o,width:i,height:s}=e;return e.width=i||"undefined"==typeof window?i:window.innerWidth,e.height=s||"undefined"==typeof window?s:window.innerHeight,e.center=o||[e.width/2,e.height/2],e.clustering=r&&!!n,e}runOneStep(t,e,r){const{dimensions:n,height:o,width:i,gravity:s,center:a,speed:u,clustering:d,nodeClusterBy:h,clusterGravity:c}=r,l=o*i,f=Math.sqrt(l)/10,g=t.getAllNodes(),p=l/(g.length+1),y=Math.sqrt(p),m={};if(this.applyCalculate(t,m,y,p),d){for(const t in e)e[t].cx=0,e[t].cy=0,e[t].count=0;g.forEach((t=>{const{data:r}=t,n=e[r[h]];v(r.x)&&(n.cx+=r.x),v(r.y)&&(n.cy+=r.y),n.count++}));for(const t in e)e[t].cx/=e[t].count,e[t].cy/=e[t].count;const t=c||s;g.forEach(((r,n)=>{const{id:o,data:i}=r;if(!v(i.x)||!v(i.y))return;const s=e[i[h]],a=Math.sqrt((i.x-s.cx)*(i.x-s.cx)+(i.y-s.cy)*(i.y-s.cy)),u=y*t;m[o].x-=u*(i.x-s.cx)/a,m[o].y-=u*(i.y-s.cy)/a}))}g.forEach(((t,e)=>{const{id:r,data:o}=t;if(!v(o.x)||!v(o.y))return;const i=.01*y*s;m[r].x-=i*(o.x-a[0]),m[r].y-=i*(o.y-a[1]),3===n&&(m[r].z-=i*(o.z-a[2]))})),g.forEach(((e,r)=>{const{id:o,data:i}=e;if(v(i.fx)&&v(i.fy))return i.x=i.fx,i.y=i.fy,void(3===n&&(i.z=i.fz));if(!v(i.x)||!v(i.y))return;const s=Math.sqrt(m[o].x*m[o].x+m[o].y*m[o].y+(3===n?m[o].z*m[o].z:0));if(s>0){const e=Math.min(f*(u/800),s);t.mergeNodeData(o,{x:i.x+m[o].x/s*e,y:i.y+m[o].y/s*e,z:3===n?i.z+m[o].z/s*e:void 0})}}))}applyCalculate(t,e,r,n){this.calRepulsive(t,e,n),this.calAttractive(t,e,r)}calRepulsive(t,e,r){const n=t.getAllNodes();n.forEach((({data:t,id:o},i)=>{e[o]={x:0,y:0,z:0},n.forEach((({data:n,id:s},a)=>{if(i<=a||!v(t.x)||!v(n.x)||!v(t.y)||!v(n.y))return;let u=t.x-n.x,d=t.y-n.y,h=3===this.options.dimensions?t.z-n.z:0,c=u*u+d*d+h*h;0===c&&(c=1,u=.01,d=.01,h=.01);const l=r/c,f=u*l,g=d*l,p=h*l;e[o].x+=f,e[o].y+=g,e[s].x-=f,e[s].y-=g,3===this.options.dimensions&&(e[o].z+=p,e[s].z-=p)}))}))}calAttractive(t,e,r){t.getAllEdges().forEach((n=>{const{source:o,target:i}=n;if(!o||!i||o===i)return;const{data:s}=t.getNode(o),{data:a}=t.getNode(i);if(!(v(a.x)&&v(s.x)&&v(a.y)&&v(s.y)))return;const u=a.x-s.x,d=a.y-s.y,h=3===this.options.dimensions?a.z-s.z:0,c=Math.sqrt(u*u+d*d+h*h)/r,l=u*c,f=d*c,g=h*c;e[o].x+=l,e[o].y+=f,e[i].x-=l,e[i].y-=f,3===this.options.dimensions&&(e[o].z+=g,e[i].z-=g)}))}}const ro={begin:[0,0],preventOverlap:!0,preventOverlapPadding:10,condense:!1,rows:void 0,cols:void 0,position:void 0,sortBy:"degree",nodeSize:30,width:300,height:300};class no{constructor(t={}){this.options=t,this.id="grid",this.options=Object.assign(Object.assign({},ro),t)}execute(t,r){return e(this,void 0,void 0,(function*(){return this.genericGridLayout(!1,t,r)}))}assign(t,r){return e(this,void 0,void 0,(function*(){yield this.genericGridLayout(!0,t,r)}))}genericGridLayout(t,r,n){return e(this,void 0,void 0,(function*(){const e=Object.assign(Object.assign({},this.options),n),{begin:o=[0,0],condense:i,preventOverlapPadding:s,preventOverlap:a,rows:u,cols:d,nodeSpacing:h,nodeSize:c,width:l,height:f,position:g}=e;let{sortBy:p}=e;const y=r.getAllNodes(),m=r.getAllEdges(),w=null==y?void 0:y.length;if(!w||1===w)return ie(r,t,o);const x=y.map((t=>ee(t)));"id"===p||he(p)&&void 0!==x[0].data[p]||(p="degree"),"degree"===p?x.sort(((t,e)=>r.getDegree(e.id,"both")-r.getDegree(t.id,"both"))):"id"===p?x.sort(((t,e)=>v(e.id)&&v(t.id)?e.id-t.id:`${t.id}`.localeCompare(`${e.id}`))):x.sort(((t,e)=>e.data[p]-t.data[p]));const b=l||"undefined"==typeof window?l:window.innerWidth,E=f||"undefined"==typeof window?f:window.innerHeight,N=w,_={rows:u,cols:d};if(null!=u&&null!=d)_.rows=u,_.cols=d;else if(null!=u&&null==d)_.rows=u,_.cols=Math.ceil(N/_.rows);else if(null==u&&null!=d)_.cols=d,_.rows=Math.ceil(N/_.cols);else{const t=Math.sqrt(N*E/b);_.rows=Math.round(t),_.cols=Math.round(b/E*t)}if(_.rows=Math.max(_.rows,1),_.cols=Math.max(_.cols,1),_.cols*_.rows>N){const t=oo(_),e=io(_);(t-1)*e>=N?oo(_,t-1):(e-1)*t>=N&&io(_,e-1)}else for(;_.cols*_.rows<N;){const t=oo(_),e=io(_);(e+1)*t>=N?io(_,e+1):oo(_,t+1)}let M=i?0:b/_.cols,k=i?0:E/_.rows;if(a||h){const t=Xt(10,h),e=Qt(30,c,!1);x.forEach((n=>{n.data.x&&n.data.y||(n.data.x=0,n.data.y=0);const o=r.getNode(n.id),[i,a]=Ht(e(o)||30),u=void 0!==t?t(n):s,d=i+u,h=a+u;M=Math.max(M,d),k=Math.max(k,h)}))}const A={},j={row:0,col:0},O={};for(let t=0;t<x.length;t++){const e=x[t];let n;if(g&&(n=g(r.getNode(e.id))),n&&(void 0!==n.row||void 0!==n.col)){const t={row:n.row,col:n.col};if(void 0===t.col)for(t.col=0;so(A,t);)t.col++;else if(void 0===t.row)for(t.row=0;so(A,t);)t.row++;O[e.id]=t,ao(A,t)}ho(e,o,M,k,O,_,j,A)}const S={nodes:x,edges:m};return t&&x.forEach((t=>{r.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})})),S}))}}const oo=(t,e)=>{let r;const n=t.rows||5,o=t.cols||5;return null==e?r=Math.min(n,o):Math.min(n,o)===t.rows?t.rows=e:t.cols=e,r},io=(t,e)=>{let r;const n=t.rows||5,o=t.cols||5;return null==e?r=Math.max(n,o):Math.max(n,o)===t.rows?t.rows=e:t.cols=e,r},so=(t,e)=>t[`c-${e.row}-${e.col}`]||!1,ao=(t,e)=>t[`c-${e.row}-${e.col}`]=!0,uo=(t,e)=>{const r=t.cols||5;e.col++,e.col>=r&&(e.col=0,e.row++)},ho=(t,e,r,n,o,i,s,a)=>{let u,d;const h=o[t.id];if(h)u=h.col*r+r/2+e[0],d=h.row*n+n/2+e[1];else{for(;so(a,s);)uo(i,s);u=s.col*r+r/2+e[0],d=s.row*n+n/2+e[1],ao(a,s),uo(i,s)}t.data.x=u,t.data.y=d},co={iterations:10,height:10,width:10,speed:100,gravity:10,k:5},lo=(t,e,r,n,o,i)=>{e.forEach(((s,a)=>{r[a]={x:0,y:0},e.forEach(((e,u)=>{if(a===u)return;if(o[a]!==o[u])return;let d=s.x-e.x,h=s.y-e.y,c=Math.sqrt(d*d+h*h);if(0===c){c=1;const t=a>u?1:-1;d=.01*t,h=.01*t}if(c<i(t[a])/2+i(t[u])/2){const t=n*n/c;r[a].x+=d/c*t,r[a].y+=h/c*t}}))}))},fo=(t,e,r,n,o,i,s,a)=>{const u=i||s/10;return n&&e.forEach(((e,r)=>{const n=t[r].x-t[o].x,i=t[r].y-t[o].y,s=Math.sqrt(n*n+i*i);let a=i/s,u=-n/s;const d=Math.sqrt(e.x*e.x+e.y*e.y);let h=Math.acos((a*e.x+u*e.y)/d);h>Math.PI/2&&(h-=Math.PI/2,a*=-1,u*=-1);const c=Math.cos(h)*d;e.x=a*c,e.y=u*c})),t.forEach(((i,s)=>{if(s===o)return;const d=Math.sqrt(e[s].x*e[s].x+e[s].y*e[s].y);if(d>0&&s!==o){const h=Math.min(u*(r/800),d);if(i.x+=e[s].x/d*h,i.y+=e[s].y/d*h,n){let e=i.x-t[o].x,r=i.y-t[o].y;const n=Math.sqrt(e*e+r*r);e=e/n*a[s],r=r/n*a[s],i.x=t[o].x+e,i.y=t[o].y+r}}})),t},go={maxIteration:1e3,focusNode:null,unitRadius:null,linkDistance:50,preventOverlap:!1,strictRadial:!0,maxPreventOverlapIteration:200,sortStrength:10};class po{constructor(t={}){this.options=t,this.id="radial",this.options=Object.assign(Object.assign({},go),t)}execute(t,r){return e(this,void 0,void 0,(function*(){return this.genericRadialLayout(!1,t,r)}))}assign(t,r){return e(this,void 0,void 0,(function*(){yield this.genericRadialLayout(!0,t,r)}))}genericRadialLayout(t,r,n){return e(this,void 0,void 0,(function*(){const e=Object.assign(Object.assign({},this.options),n),{width:o,height:i,center:s,focusNode:a,unitRadius:u,nodeSize:d,nodeSpacing:h,strictRadial:c,preventOverlap:l,maxPreventOverlapIteration:f,sortBy:g,linkDistance:p=50,sortStrength:v=10,maxIteration:y=1e3}=e,m=r.getAllNodes(),w=r.getAllEdges(),x=o||"undefined"==typeof window?o:window.innerWidth,b=i||"undefined"==typeof window?i:window.innerHeight,E=s||[x/2,b/2];if(!(null==m?void 0:m.length)||1===m.length)return ie(r,t,E);let N=m[0];if(he(a)){for(let t=0;t<m.length;t++)if(m[t].id===a){N=m[t];break}}else N=a||m[0];const _=mo(m,N.id),M=dr({nodes:m,edges:w},!1),k=ur(M),A=xo(k,_);wo(k,_,A+1);const j=k[_];let O=x-E[0]>E[0]?E[0]:x-E[0],S=b-E[1]>E[1]?E[1]:b-E[1];0===O&&(O=x/2),0===S&&(S=b/2);const z=Math.min(O,S),R=Math.max(...j),I=[],P=u||z/R;j.forEach(((t,e)=>{I[e]=t*P}));const C=vo(m,k,p,I,P,g,v),D=yo(C),T=((t,e,r)=>{try{const r=or.mul(or.pow(e,2),-.5),n=r.mean("row"),o=r.mean("column"),i=r.mean();r.add(i).subRowVector(n).subColumnVector(o);const s=new ar(r),a=or.sqrt(s.diagonalMatrix).diagonal();return s.leftSingularVectors.toJSON().map((e=>or.mul([e],[a]).toJSON()[0].splice(0,t)))}catch(t){const n=[];for(let t=0;t<e.length;t++){const t=Math.random()*r,e=Math.random()*r;n.push([t,e])}return n}})(p,C,p);let L,F=T.map((([t,e])=>({x:(isNaN(t)?Math.random()*p:t)-T[_][0],y:(isNaN(e)?Math.random()*p:e)-T[_][1]})));if(this.run(y,F,D,C,I,_),l){L=Zt(d,h);const t={nodes:m,nodeSizeFunc:L,positions:F,radii:I,height:b,width:x,strictRadial:Boolean(c),focusIdx:_,iterations:f||200,k:F.length/4.5};F=((t,e)=>{const r=Object.assign(Object.assign({},co),e),{positions:n,iterations:o,width:i,k:s,speed:a=100,strictRadial:u,focusIdx:d,radii:h=[],nodeSizeFunc:c}=r,l=t.getAllNodes(),f=[],g=i/10;for(let t=0;t<o;t++)n.forEach(((t,e)=>{f[e]={x:0,y:0}})),lo(l,n,f,s,h,c),fo(n,f,a,u,d,g,i,h);return n})(r,t)}const q=[];return F.forEach(((t,e)=>{const r=ee(m[e]);r.data.x=t.x+E[0],r.data.y=t.y+E[1],q.push(r)})),t&&q.forEach((t=>r.mergeNodeData(t.id,{x:t.data.x,y:t.data.y}))),{nodes:q,edges:w}}))}run(t,e,r,n,o,i){for(let s=0;s<=t;s++){const a=s/t;this.oneIteration(a,e,o,n,r,i)}}oneIteration(t,e,r,n,o,i){const s=1-t;e.forEach(((a,u)=>{const d=lr(a,{x:0,y:0}),h=0===d?0:1/d;if(u===i)return;let c=0,l=0,f=0;e.forEach(((t,e)=>{if(u===e)return;const r=lr(a,t),i=0===r?0:1/r,s=n[e][u];f+=o[u][e],c+=o[u][e]*(t.x+s*(a.x-t.x)*i),l+=o[u][e]*(t.y+s*(a.y-t.y)*i)}));const g=0===r[u]?0:1/r[u];f*=s,f+=t*g*g,c*=s,c+=t*g*a.x*h,a.x=c/f,l*=s,l+=t*g*a.y*h,a.y=l/f}))}}const vo=(t,e,r,n,o,i,s)=>{if(!t)return[];const a=[];if(e){const u={};e.forEach(((e,d)=>{const h=[];e.forEach(((e,a)=>{var c,l;if(d===a)h.push(0);else if(n[d]===n[a])if("data"===i)h.push(e*(Math.abs(d-a)*s)/(n[d]/o));else if(i){let r,f;if(u[t[d].id])r=u[t[d].id];else{const e=("id"===i?t[d].id:null===(c=t[d].data)||void 0===c?void 0:c[i])||0;r=he(e)?e.charCodeAt(0):e,u[t[d].id]=r}if(u[t[a].id])f=u[t[a].id];else{const e=("id"===i?t[a].id:null===(l=t[a].data)||void 0===l?void 0:l[i])||0;f=he(e)?e.charCodeAt(0):e,u[t[a].id]=f}h.push(e*(Math.abs(r-f)*s)/(n[d]/o))}else h.push(e*r/(n[d]/o));else{const t=(r+o)/2;h.push(e*t)}})),a.push(h)}))}return a},yo=t=>{const e=t.length,r=t[0].length,n=[];for(let o=0;o<e;o++){const e=[];for(let n=0;n<r;n++)0!==t[o][n]?e.push(1/(t[o][n]*t[o][n])):e.push(0);n.push(e)}return n},mo=(t,e)=>{let r=-1;return t.forEach(((t,n)=>{t.id===e&&(r=n)})),Math.max(r,0)},wo=(t,e,r)=>{const n=t.length;for(let o=0;o<n;o++)if(t[e][o]===1/0){t[e][o]=r,t[o][e]=r;for(let i=0;i<n;i++)t[o][i]!==1/0&&t[e][i]===1/0&&(t[e][i]=r+t[o][i],t[i][e]=r+t[o][i])}for(let r=0;r<n;r++)if(r!==e)for(let o=0;o<n;o++)if(t[r][o]===1/0){let n=Math.abs(t[e][r]-t[e][o]);n=0===n?1:n,t[r][o]=n}},xo=(t,e)=>{let r=0;for(let n=0;n<t[e].length;n++)t[e][n]!==1/0&&(r=t[e][n]>r?t[e][n]:r);return r},bo={center:[0,0],width:300,height:300};class Eo{constructor(t={}){this.options=t,this.id="random",this.options=Object.assign(Object.assign({},bo),t)}execute(t,r){return e(this,void 0,void 0,(function*(){return this.genericRandomLayout(!1,t,r)}))}assign(t,r){return e(this,void 0,void 0,(function*(){yield this.genericRandomLayout(!0,t,r)}))}genericRandomLayout(t,r,n){return e(this,void 0,void 0,(function*(){const e=Object.assign(Object.assign({},this.options),n),{center:o,width:i,height:s}=e,a=r.getAllNodes(),u=i||"undefined"==typeof window?i:window.innerWidth,d=s||"undefined"==typeof window?s:window.innerHeight,h=o||[u/2,d/2],c=[];return a&&a.forEach((t=>{c.push({id:t.id,data:{x:.9*(Math.random()-.5)*u+h[0],y:.9*(Math.random()-.5)*d+h[1]}})})),t&&c.forEach((t=>r.mergeNodeData(t.id,{x:t.data.x,y:t.data.y}))),{nodes:c,edges:r.getAllEdges()}}))}}const No={circular:ae,concentric:fe,mds:pr,random:Eo,grid:no,radial:po,force:Pe,d3force:pn,"d3-force-3d":Un,fruchterman:eo,forceAtlas2:Zn,dagre:Kn,antvDagre:ne,comboCombined:br}})(),n})()}));
|
|
2
|
-
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).Layout={})}(this,function(t){"use strict";var e="undefined"!=typeof document?document.currentScript:null;function r(t,e,r,n){return new(r||(r=Promise))(function(o,i){function s(t){try{u(n.next(t))}catch(t){i(t)}}function a(t){try{u(n.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r(function(t){t(e)})).then(s,a)}u((n=n.apply(t,e||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;function n(t){return"function"==typeof t}function o(t){return null==t}function i(t){return Array.isArray(t)}var s=function(t){var e=typeof t;return null!==t&&"object"===e||"function"===e};var a={}.toString,u=function(t,e){return a.call(t)==="[object "+e+"]"},c=function(t){if(!function(t){return"object"==typeof t&&null!==t}(t)||!u(t,"Object"))return!1;if(null===Object.getPrototypeOf(t))return!0;for(var e=t;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e};function h(t){return"string"==typeof t}function l(t){return"number"==typeof t}var d={}.toString,f=Object.prototype,g=function(t){if("object"!=typeof t||null===t)return t;var e;if(i(t)){e=[];for(var r=0,n=t.length;r<n;r++)"object"==typeof t[r]&&null!=t[r]?e[r]=g(t[r]):e[r]=t[r]}else for(var o in e={},t)"object"==typeof t[o]&&null!=t[o]?e[o]=g(t[o]):e[o]=t[o];return e};function p(t,e){if(Object.hasOwn)return Object.hasOwn(t,e);if(null==t)throw new TypeError("Cannot convert undefined or null to object");return Object.prototype.hasOwnProperty.call(Object(t),e)}function v(t,e,r,n){for(var o in r=r||0,n=n||5,e)if(p(e,o)){var s=e[o];null!==s&&c(s)?(c(t[o])||(t[o]={}),r<n?v(t[o],s,r+1,n):t[o]=e[o]):i(s)?(t[o]=[],t[o]=t[o].concat(s)):void 0!==s&&(t[o]=s)}}var m=Object.prototype.hasOwnProperty;function y(t){if(o(t))return!0;if(function(t){return null!==t&&"function"!=typeof t&&isFinite(t.length)}(t))return!t.length;var e=function(t){return d.call(t).replace(/^\[object /,"").replace(/]$/,"")}(t);if("Map"===e||"Set"===e)return!t.size;if(function(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||f)}(t))return!Object.keys(t).length;for(var r in t)if(m.call(t,r))return!1;return!0}var w=Object.prototype.hasOwnProperty,x=function(t,e){if(null===t||!c(t))return{};var r={};return function(t,e){if(t)if(i(t))for(var r=0,n=t.length;r<n&&!1!==e(t[r],r);r++);else if(s(t))for(var o in t)if(t.hasOwnProperty(o)&&!1===e(t[o],o))break}(e,function(e){w.call(t,e)&&(r[e]=t[e])}),r};class b{constructor(t,e={}){this.edgeIdCounter=new Map,this.nodeMap=function(t,e){if(!t)throw new Error("Data.nodes is required");const r=new Map;for(const n of t){const t={_original:n};for(const e of E){const r=n[e];o(r)||(t[e]=r)}if(e){const r=e(n);for(const e in r){const n=r[e];o(n)||(t[e]=n)}}if(o(t.id))throw new Error("Node is missing id field");r.set(t.id,t)}return r}(t.nodes,e.node),this.edgeMap=function(t,e,r){const n=new Map;for(const i of t){const t={_original:i};for(const e of M){const r=i[e];o(r)||(t[e]=r)}if(e){const r=e(i);for(const e in r){const n=r[e];o(n)||(t[e]=n)}}if(o(t.source)||o(t.target))throw new Error("Edge is missing source or target field");o(t.id)&&(t.id=null==r?void 0:r(i)),n.set(t.id,t)}return n}(t.edges||[],e.edge,this.getEdgeId.bind(this))}data(){return{nodes:this.nodeMap,edges:this.edgeMap}}replace(t){this.nodeMap=t.nodes,this.edgeMap=t.edges,this.clearCache()}nodes(){return Array.from(this.nodeMap.values())}node(t){return this.nodeMap.get(t)}nodeAt(t){this.indexNodeCache||this.buildNodeIndexCache();const e=this.indexNodeCache.get(t);return e?this.nodeMap.get(e):void 0}nodeIndexOf(t){var e;return this.nodeIndexCache||this.buildNodeIndexCache(),null!==(e=this.nodeIndexCache.get(t))&&void 0!==e?e:-1}firstNode(){return this.nodeMap.values().next().value}forEachNode(t){let e=0;this.nodeMap.forEach(r=>t(r,e++))}originalNode(t){const e=this.nodeMap.get(t);return null==e?void 0:e._original}nodeCount(){return this.nodeMap.size}edges(){return Array.from(this.edgeMap.values())}edge(t){return this.edgeMap.get(t)}firstEdge(){return this.edgeMap.values().next().value}forEachEdge(t){let e=0;this.edgeMap.forEach(r=>t(r,e++))}originalEdge(t){const e=this.edgeMap.get(t);return null==e?void 0:e._original}edgeCount(){return this.edgeMap.size}getEdgeId(t){if(t.id)return t.id;const e=`${t.source}-${t.target}`,r=this.edgeIdCounter.get(e)||0,n=0===r?e:`${e}-${r}`;return this.edgeIdCounter.set(e,r+1),n}degree(t,e="both"){this.degreeCache||this.buildDegreeCache();const r=this.degreeCache.get(t);return r?r[e]:0}neighbors(t,e="both"){if(this.outAdjacencyCache&&this.inAdjacencyCache||this.buildAdjacencyCache(),"out"===e)return Array.from(this.outAdjacencyCache.get(t)||[]);if("in"===e)return Array.from(this.inAdjacencyCache.get(t)||[]);if(this.bothAdjacencyCache)return Array.from(this.bothAdjacencyCache.get(t)||[]);const r=this.inAdjacencyCache.get(t),n=this.outAdjacencyCache.get(t);if(!r&&!n)return[];if(!r)return Array.from(n);if(!n)return Array.from(r);const o=new Set;return r.forEach(t=>o.add(t)),n.forEach(t=>o.add(t)),Array.from(o)}successors(t){return this.neighbors(t,"out")}predecessors(t){return this.neighbors(t,"in")}setNodeOrder(t){const e=new Map;for(const r of t)e.set(r.id,r);this.nodeMap=e,this.nodeIndexCache=void 0,this.indexNodeCache=void 0}clearCache(){this.degreeCache=void 0,this.inAdjacencyCache=void 0,this.outAdjacencyCache=void 0,this.bothAdjacencyCache=void 0,this.nodeIndexCache=void 0,this.indexNodeCache=void 0}buildDegreeCache(){this.degreeCache=new Map;for(const t of this.edges()){const{source:e,target:r}=t;if(t.source===t.target)continue;this.degreeCache.has(e)||this.degreeCache.set(e,{in:0,out:0,both:0});const n=this.degreeCache.get(t.source);n&&(n.out++,n.both++),this.degreeCache.has(r)||this.degreeCache.set(r,{in:0,out:0,both:0});const o=this.degreeCache.get(t.target);o&&(o.in++,o.both++)}}buildAdjacencyCache(){this.inAdjacencyCache=new Map,this.outAdjacencyCache=new Map;for(const t of this.edges())this.nodeMap.has(t.source)&&this.nodeMap.has(t.target)&&(this.outAdjacencyCache.has(t.source)||this.outAdjacencyCache.set(t.source,new Set),this.outAdjacencyCache.get(t.source).add(t.target),this.inAdjacencyCache.has(t.target)||this.inAdjacencyCache.set(t.target,new Set),this.inAdjacencyCache.get(t.target).add(t.source))}buildNodeIndexCache(){this.nodeIndexCache=new Map,this.indexNodeCache=new Map;let t=0;this.nodeMap.forEach((e,r)=>{this.nodeIndexCache.set(r,t),this.indexNodeCache.set(t,r),t++})}destroy(){this.clearCache(),this.nodeMap.clear(),this.edgeMap.clear(),this.edgeIdCounter.clear()}}const E=["id","x","y","z","vx","vy","vz","fx","fy","fz","parentId"],M=["id","source","target","points"];function N(t,e,r,n=2){t.forEachNode(t=>{o(t.x)&&(t.x=Math.random()*e),o(t.y)&&(t.y=Math.random()*r),3===n&&o(t.z)&&(t.z=Math.random()*Math.min(e,r))})}class _{constructor(t,e={}){this.graph=new b(t,e)}export(){return this.graph.data()}replace(t){this.graph.replace(t)}forEachNode(t){this.graph.forEachNode(t)}forEachEdge(t){this.graph.forEachEdge((e,r)=>{e.sourceNode=this.graph.node(e.source),e.targetNode=this.graph.node(e.target),t(e,r)})}destroy(){this.graph.destroy()}}
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright 2019 Google LLC
|
|
5
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
6
|
+
*/const k=Symbol("Comlink.proxy"),S=Symbol("Comlink.endpoint"),z=Symbol("Comlink.releaseProxy"),A=Symbol("Comlink.finalizer"),O=Symbol("Comlink.thrown"),j=t=>"object"==typeof t&&null!==t||"function"==typeof t,C=new Map([["proxy",{canHandle:t=>j(t)&&t[k],serialize(t){const{port1:e,port2:r}=new MessageChannel;return I(t,e),[r,[r]]},deserialize:t=>(t.start(),P(t))}],["throw",{canHandle:t=>j(t)&&O in t,serialize({value:t}){let e;return e=t instanceof Error?{isError:!0,value:{message:t.message,name:t.name,stack:t.stack}}:{isError:!1,value:t},[e,[]]},deserialize(t){if(t.isError)throw Object.assign(new Error(t.value.message),t.value);throw t.value}}]]);function I(t,e=globalThis,r=["*"]){e.addEventListener("message",function n(o){if(!o||!o.data)return;if(!function(t,e){for(const r of t){if(e===r||"*"===r)return!0;if(r instanceof RegExp&&r.test(e))return!0}return!1}(r,o.origin))return void console.warn(`Invalid origin '${o.origin}' for comlink proxy`);const{id:i,type:s,path:a}=Object.assign({path:[]},o.data),u=(o.data.argumentList||[]).map(G);let c;try{const e=a.slice(0,-1).reduce((t,e)=>t[e],t),r=a.reduce((t,e)=>t[e],t);switch(s){case"GET":c=r;break;case"SET":e[a.slice(-1)[0]]=G(o.data.value),c=!0;break;case"APPLY":c=r.apply(e,u);break;case"CONSTRUCT":c=function(t){return Object.assign(t,{[k]:!0})}(new r(...u));break;case"ENDPOINT":{const{port1:e,port2:r}=new MessageChannel;I(t,r),c=function(t,e){return B.set(t,e),t}(e,[e])}break;case"RELEASE":c=void 0;break;default:return}}catch(t){c={value:t,[O]:0}}Promise.resolve(c).catch(t=>({value:t,[O]:0})).then(r=>{const[o,a]=$(r);e.postMessage(Object.assign(Object.assign({},o),{id:i}),a),"RELEASE"===s&&(e.removeEventListener("message",n),R(e),A in t&&"function"==typeof t[A]&&t[A]())}).catch(t=>{const[r,n]=$({value:new TypeError("Unserializable return value"),[O]:0});e.postMessage(Object.assign(Object.assign({},r),{id:i}),n)})}),e.start&&e.start()}function R(t){(function(t){return"MessagePort"===t.constructor.name})(t)&&t.close()}function P(t,e){const r=new Map;return t.addEventListener("message",function(t){const{data:e}=t;if(!e||!e.id)return;const n=r.get(e.id);if(n)try{n(e)}finally{r.delete(e.id)}}),q(t,r,[],e)}function T(t){if(t)throw new Error("Proxy has been released and is not useable")}function F(t){return U(t,new Map,{type:"RELEASE"}).then(()=>{R(t)})}const L=new WeakMap,D="FinalizationRegistry"in globalThis&&new FinalizationRegistry(t=>{const e=(L.get(t)||0)-1;L.set(t,e),0===e&&F(t)});function q(t,e,r=[],n=function(){}){let o=!1;const i=new Proxy(n,{get(n,s){if(T(o),s===z)return()=>{!function(t){D&&D.unregister(t)}(i),F(t),e.clear(),o=!0};if("then"===s){if(0===r.length)return{then:()=>i};const n=U(t,e,{type:"GET",path:r.map(t=>t.toString())}).then(G);return n.then.bind(n)}return q(t,e,[...r,s])},set(n,i,s){T(o);const[a,u]=$(s);return U(t,e,{type:"SET",path:[...r,i].map(t=>t.toString()),value:a},u).then(G)},apply(n,i,s){T(o);const a=r[r.length-1];if(a===S)return U(t,e,{type:"ENDPOINT"}).then(G);if("bind"===a)return q(t,e,r.slice(0,-1));const[u,c]=V(s);return U(t,e,{type:"APPLY",path:r.map(t=>t.toString()),argumentList:u},c).then(G)},construct(n,i){T(o);const[s,a]=V(i);return U(t,e,{type:"CONSTRUCT",path:r.map(t=>t.toString()),argumentList:s},a).then(G)}});return function(t,e){const r=(L.get(e)||0)+1;L.set(e,r),D&&D.register(t,e,t)}(i,t),i}function V(t){const e=t.map($);return[e.map(t=>t[0]),(r=e.map(t=>t[1]),Array.prototype.concat.apply([],r))];var r}const B=new WeakMap;function $(t){for(const[e,r]of C)if(r.canHandle(t)){const[n,o]=r.serialize(t);return[{type:"HANDLER",name:e,value:n},o]}return[{type:"RAW",value:t},B.get(t)||[]]}function G(t){switch(t.type){case"HANDLER":return C.get(t.name).deserialize(t.value);case"RAW":return t.value}}function U(t,e,r,n){return new Promise(o=>{const i=new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-");e.set(i,o),t.start&&t.start(),t.postMessage(Object.assign({id:i},r),n)})}class W{constructor(){this.worker=null,this.workerApi=null}execute(t,e,n){return r(this,void 0,void 0,function*(){if(this.worker||(yield this.initWorker()),!this.workerApi)throw new Error("Worker API not initialized");return yield this.workerApi.execute(t,e,n)})}destroy(){this.workerApi&&this.workerApi.destroy(),this.worker&&(this.worker.terminate(),this.worker=null,this.workerApi=null)}initWorker(){return r(this,void 0,void 0,function*(){const t=this.resolveWorkerPath(),e=t.includes("/lib/")||t.endsWith(".mjs")?"module":"classic";this.worker=new Worker(t,{type:e}),this.workerApi=P(this.worker)})}resolveWorkerPath(){if(void 0!=={url:"undefined"==typeof document&&"undefined"==typeof location?require("url").pathToFileURL(__filename).href:"undefined"==typeof document?location.href:e&&"SCRIPT"===e.tagName.toUpperCase()&&e.src||new URL("index.min.js",document.baseURI).href}&&("undefined"==typeof document&&"undefined"==typeof location?require("url").pathToFileURL(__filename).href:"undefined"==typeof document?location.href:e&&"SCRIPT"===e.tagName.toUpperCase()&&e.src||new URL("index.min.js",document.baseURI).href)){const t=new URL("undefined"==typeof document&&"undefined"==typeof location?require("url").pathToFileURL(__filename).href:"undefined"==typeof document?location.href:e&&"SCRIPT"===e.tagName.toUpperCase()&&e.src||new URL("index.min.js",document.baseURI).href),r=t.href.replace(/\/runtime\/[^/]+\.js$/,"/worker.js");return r!==t.href?r:t.href.replace(/\/[^/]+\.js$/,"/worker.js")}if("undefined"!=typeof document){const t=document.getElementsByTagName("script");for(let e=t.length-1;e>=0;e--){const r=t[e].src;if(r&&(r.includes("index.js")||r.includes("index.min.js")))return r.replace(/index(\.min)?\.js/,"worker.js")}}return"./worker.js"}}const Y=Array.isArray;function H(t,e,r=2){if(1===t.nodeCount()){const n=t.firstNode();n.x=e[0],n.y=e[1],3===r&&(n.z=e[2]||0)}}const X=(t,e)=>{const r=t.nodeCount(),n=Array.from({length:r},()=>[]),o={};let i=0;return t.forEachNode(t=>{o[t.id]=i++}),t.forEachEdge(t=>{const r=o[t.source],i=o[t.target];null!=r&&null!=i&&(n[r].push(i),e||n[i].push(r))}),n},Q=(t,e)=>{const r=t.length,n=new Array(r);for(let o=0;o<r;o++){const r=t[o],i=r.length,s=new Array(i);for(let t=0;t<i;t++)s[t]=r[t]*e;n[o]=s}return n},J=(t,e,r,n="TB",o,i={})=>{if(!(null==e?void 0:e.length))return;const{stopBranchFn:s,stopAllFn:a}=i;for(let u=0;u<e.length;u++){const c=e[u];if(t.hasNode(c.id)&&!(null==s?void 0:s(c))){if(null==a?void 0:a(c))return;"TB"===n&&r(c),J(t,t.getChildren(c.id,o),r,n,o,i),"TB"!==n&&r(c)}}};function K(t){const e=t.length;new Array(e).fill(0);const r=Array.from({length:e},()=>new Array(e).fill(1/0));for(let n=0;n<e;n++)r[n]=Z(t,n);return r}function Z(t,e){const r=t.length,n=new Array(r).fill(1/0);n[e]=0;const o=new tt;for(o.push([0,e]);!o.empty();){const[e,r]=o.pop();if(e!==n[r])continue;const i=t[r];for(let t=0;t<i.length;t++){const r=i[t],s=e+1;s<n[r]&&(n[r]=s,o.push([s,r]))}}return n}class tt{constructor(){this.data=[]}push(t){this.data.push(t),this.bubbleUp(this.data.length-1)}pop(){const t=this.data[0],e=this.data.pop();return this.data.length>0&&(this.data[0]=e,this.bubbleDown(0)),t}empty(){return 0===this.data.length}bubbleUp(t){const e=this.data;for(;t>0;){const r=t-1>>1;if(e[r][0]<=e[t][0])break;[e[r],e[t]]=[e[t],e[r]],t=r}}bubbleDown(t){const e=this.data,r=e.length;for(;;){const n=2*t+1,o=2*t+2;let i=t;if(n<r&&e[n][0]<e[i][0]&&(i=n),o<r&&e[o][0]<e[i][0]&&(i=o),i===t)break;[e[t],e[i]]=[e[i],e[t]],t=i}}}function et(t,e){return function(t,e,r){for(var n=0,o=h(e)?e.split("."):e;t&&n<o.length;)t=t[o[n++]];return void 0===t||n<o.length?r:t}(t,String(e).split("."))}function rt(t,...e){return e.forEach(e=>{e&&Object.keys(e).forEach(r=>{const n=e[r];void 0!==n&&(t[r]=n)})}),t}function nt(t,e){return Object.assign({},t,e||{})}function ot(t,e){const r=t.nodes();return r.sort(e),t.setNodeOrder(r),t}function it(t){return ot(t,(e,r)=>{const n=t.degree(e.id);return t.degree(r.id)-n})}function st(t){return ot(t,(t,e)=>{const r=t.id,n=e.id;return"number"==typeof r&&"number"==typeof n?r-n:String(r).localeCompare(String(n))})}function at(t,e){return ot(t,(r,n)=>{const o=t.originalNode(r.id),i=t.originalNode(n.id);return e(o,i)})}function ut(t,e=!1){const r=t.nodeCount();if(0===r)return t;const n=t.nodes(),o=[n[0]],i={};i[n[0].id]=!0;let s=0,a=0;return t.forEachNode(u=>{if(0!==a){const c=t.degree(u.id,"both"),h=a<r-1?t.degree(n[a+1].id,"both"):0,l=o[s].id,d=t.neighbors(l,"both").includes(u.id);if(a!==r-1&&c===h&&!d||i[u.id]){const s=e?t.successors(l):t.neighbors(l);let a=!1;for(let e=0;e<s.length;e++){const r=s[e],n=t.node(r);if(n&&t.degree(r)===t.degree(u.id)&&!i[r]){o.push(n),i[r]=!0,a=!0;break}}let c=0;for(;!a&&(i[n[c].id]||(o.push(n[c]),i[n[c].id]=!0,a=!0),c++,c!==r););}else o.push(u),i[u.id]=!0,s++}a++}),t.setNodeOrder(o),t}function ct(t){var e;return[t.x,t.y,null!==(e=t.z)&&void 0!==e?e:0]}function ht(t){if(!t)return[0,0,0];if(l(t))return[t,t,t];if(Array.isArray(t)&&0===t.length)return[0,0,0];const[e,r=e,n=e]=t;return[e,r,n]}const lt=t=>{const{width:e,height:r,center:n}=t,o=null!=e?e:"undefined"!=typeof window?window.innerWidth:0,i=null!=r?r:"undefined"!=typeof window?window.innerHeight:0;return{width:o,height:i,center:null!=n?n:[o/2,i/2]}};class dt{constructor(t){this.supervisor=null,this.initialOptions=nt(this.getDefaultOptions(),t)}get options(){return this.runtimeOptions||this.initialOptions}execute(t,e){return r(this,void 0,void 0,function*(){this.runtimeOptions=nt(this.initialOptions,e);const{node:r,edge:n,enableWorker:o}=this.runtimeOptions;this.context=new _(t,{node:r,edge:n}),this.model=this.context.graph;o&&"undefined"!=typeof Worker?yield this.layoutInWorker(t,this.runtimeOptions):yield this.layout(this.runtimeOptions)})}layoutInWorker(t,e){var n;return r(this,void 0,void 0,function*(){try{this.supervisor||(this.supervisor=new W);const r=yield this.supervisor.execute(this.id,t,e);null===(n=this.context)||void 0===n||n.replace(r)}catch(t){console.error("Layout in worker failed, fallback to main thread layout.",t),yield this.layout(e)}})}forEachNode(t){this.context.forEachNode(t)}forEachEdge(t){this.context.forEachEdge(t)}destroy(){var t;null===(t=this.context)||void 0===t||t.destroy(),this.model=null,this.context=null,this.supervisor&&(this.supervisor.destroy(),this.supervisor=null)}}class ft extends dt{}function gt(t){return!!t.tick&&!!t.stop}function pt(t,e){return n(t)?t:l(t)?()=>t:()=>e}function vt(t,e=10){return t?n(t)?t:l(t)||Array.isArray(t)?()=>t:s(t)&&t.width&&t.height?()=>[t.width,t.height]:()=>e:()=>e}const mt=(t,e,r=10)=>{const n=pt(e,0),o=vt(t,r);return t=>{const e=o(t),r=n(t);return Math.max(...ht(e))+r}};class yt{constructor(t={}){this.options=t,this.nodes=new Map,this.edges=new Map,this.inEdges=new Map,this.outEdges=new Map,this.parentMap=new Map,this.childrenMap=new Map,t.tree&&Array.isArray(t.tree)&&t.tree.length>0&&("string"==typeof t.tree[0]?t.tree.forEach(t=>{this.parentMap.set(t,new Map),this.childrenMap.set(t,new Map)}):(this.attachTreeStructure("default"),this.addTree(t.tree))),t.nodes&&t.nodes.forEach(t=>this.addNode(t)),t.edges&&t.edges.forEach(t=>this.addEdge(t))}addNode(t){this.nodes.has(t.id)||(this.nodes.set(t.id,t),this.inEdges.set(t.id,new Set),this.outEdges.set(t.id,new Set))}addNodes(t){t.forEach(t=>this.addNode(t))}getNode(t){return this.nodes.get(t)}hasNode(t){return this.nodes.has(t)}removeNode(t){if(!this.nodes.has(t))return;const e=Array.from(this.inEdges.get(t)||[]),r=Array.from(this.outEdges.get(t)||[]);e.forEach(t=>this.removeEdge(t)),r.forEach(t=>this.removeEdge(t)),this.nodes.delete(t),this.inEdges.delete(t),this.outEdges.delete(t),this.parentMap.forEach(e=>{e.delete(t)}),this.childrenMap.forEach(e=>{e.delete(t)})}getAllNodes(){return Array.from(this.nodes.values())}addEdge(t){if(!this.nodes.has(t.source)||!this.nodes.has(t.target))throw new Error(`Cannot add edge ${t.id}: source ${t.source} or target ${t.target} does not exist`);this.edges.set(t.id,t),this.outEdges.get(t.source).add(t.id),this.inEdges.get(t.target).add(t.id)}addEdges(t){t.forEach(t=>this.addEdge(t))}getEdge(t){return this.edges.get(t)}hasEdge(t){return this.edges.has(t)}removeEdge(t){var e,r;const n=this.edges.get(t);n&&(this.edges.delete(t),null===(e=this.outEdges.get(n.source))||void 0===e||e.delete(t),null===(r=this.inEdges.get(n.target))||void 0===r||r.delete(t))}getAllEdges(){return Array.from(this.edges.values())}updateEdgeData(t,e){const r=this.edges.get(t);r&&Object.assign(r.data,e)}updateNodeData(t,e){const r=this.nodes.get(t);r&&Object.assign(r.data,e)}getRelatedEdges(t,e="both"){const r=[];if("in"===e||"both"===e){const e=this.inEdges.get(t);e&&e.forEach(t=>{const e=this.edges.get(t);e&&r.push(e)})}if("out"===e||"both"===e){const e=this.outEdges.get(t);e&&e.forEach(t=>{const e=this.edges.get(t);e&&r.push(e)})}return r}getSuccessors(t){const e=this.outEdges.get(t);if(!e||0===e.size)return[];const r=[];return e.forEach(t=>{const e=this.edges.get(t);if(e){const t=this.nodes.get(e.target);t&&r.push(t)}}),r.length>0?r:[]}getPredecessors(t){const e=this.inEdges.get(t);if(!e||0===e.size)return[];const r=[];return e.forEach(t=>{const e=this.edges.get(t);if(e){const t=this.nodes.get(e.source);t&&r.push(t)}}),r.length>0?r:[]}getNeighbors(t){const e=[...this.getSuccessors(t)||[],...this.getPredecessors(t)||[]],r=Array.from(new Map(e.map(t=>[t.id,t])).values());return r.length>0?r:[]}attachTreeStructure(t){this.parentMap.has(t)||(this.parentMap.set(t,new Map),this.childrenMap.set(t,new Map))}addTree(t,e){var r,n;const o=e||(null!==(n=null===(r=this.options.tree)||void 0===r?void 0:r[0])&&void 0!==n?n:"default");this.hasTreeStructure(o)||this.attachTreeStructure(o);const i=Array.isArray(t)?t:[t],s=(t,e)=>{this.addNode({id:t.id,data:t.data}),void 0!==e&&this.setParent(t.id,e,o),t.children&&t.children.length>0&&t.children.forEach(e=>{s(e,t.id)})};i.forEach(t=>s(t))}hasTreeStructure(t){return this.parentMap.has(t)}setParent(t,e,r){var n,o,i;const s=r||(null!==(o=null===(n=this.options.tree)||void 0===n?void 0:n[0])&&void 0!==o?o:"default");this.parentMap.has(s)||this.attachTreeStructure(s);const a=this.parentMap.get(s),u=this.childrenMap.get(s),c=a.get(t);void 0!==c&&(null===(i=u.get(c))||void 0===i||i.delete(t)),a.set(t,e),u.has(e)||u.set(e,new Set),u.get(e).add(t)}getParent(t,e){var r,n;const o=e||(null!==(n=null===(r=this.options.tree)||void 0===r?void 0:r[0])&&void 0!==n?n:"default");this.parentMap.has(o)||this.attachTreeStructure(o);const i=this.parentMap.get(o);if(!i)return;const s=i.get(t);return void 0===s?null:this.nodes.get(s)}getChildren(t,e){var r,n;const o=e||(null!==(n=null===(r=this.options.tree)||void 0===r?void 0:r[0])&&void 0!==n?n:"default"),i=this.childrenMap.get(o);if(!i)return[];const s=i.get(t);return s?Array.from(s).map(t=>this.nodes.get(t)).filter(t=>void 0!==t):[]}getRoots(t){var e,r;const n=t||(null!==(r=null===(e=this.options.tree)||void 0===e?void 0:e[0])&&void 0!==r?r:"default"),o=this.parentMap.get(n),i=[];return this.nodes.forEach(t=>{o&&void 0!==o.get(t.id)||i.push(t)}),i}dfsTree(t,e){const r=[t],n=new Set;for(;r.length>0;){const t=r.pop();if(n.has(t))continue;const o=this.getNode(t);if(o){n.add(t);if(!0===e(o))continue;const i=this.getChildren(t);for(let t=i.length-1;t>=0;t--)n.has(i[t].id)||r.push(i[t].id)}}}}const wt=(t,e)=>{if("next"!==t&&"prev"!==t)return e},xt=t=>{t.prev.next=t.next,t.next.prev=t.prev,delete t.next,delete t.prev};let bt=class{constructor(){const t={};t.prev=t,t.next=t.prev,this.shortcut=t}dequeue(){const t=this.shortcut,e=t.prev;if(e&&e!==t)return xt(e),e}enqueue(t){const e=this.shortcut;t.prev&&t.next&&xt(t),t.next=e.next,e.next.prev=t,e.next=t,t.prev=e}toString(){const t=[],e=this.shortcut;let r=e.prev;for(;r!==e;)t.push(JSON.stringify(r,wt)),r=null==r?void 0:r.prev;return`[${t.join(", ")}]`}};class Et extends bt{}const Mt=()=>1,Nt=(t,e,r)=>{let n=[];const o=e[e.length-1],i=e[0];let s;for(;t.getAllNodes().length;){for(;s=i.dequeue();)_t(t,e,r,s);for(;s=o.dequeue();)_t(t,e,r,s);if(t.getAllNodes().length)for(let o=e.length-2;o>0;--o)if(s=e[o].dequeue(),s){n=n.concat(_t(t,e,r,s,!0));break}}return n},_t=(t,e,r,n,o)=>{var i,s;const a=[];return t.hasNode(n.v)&&(null===(i=t.getRelatedEdges(n.v,"in"))||void 0===i||i.forEach(n=>{const i=n.data.weight,s=t.getNode(n.source);o&&a.push({v:n.source,w:n.target,in:0,out:0}),void 0===s.data.out&&(s.data.out=0),s.data.out-=i,St(e,r,Object.assign({v:s.id},s.data))}),null===(s=t.getRelatedEdges(n.v,"out"))||void 0===s||s.forEach(n=>{const o=n.data.weight,i=n.target,s=t.getNode(i);void 0===s.data.in&&(s.data.in=0),s.data.in-=o,St(e,r,Object.assign({v:s.id},s.data))}),t.removeNode(n.v)),o?a:void 0},kt=(t,e)=>{const r=new yt;let n=0,o=0;t.getAllNodes().forEach(t=>{r.addNode({id:t.id,data:{v:t.id,in:0,out:0}})}),t.getAllEdges().forEach(t=>{const i=r.getRelatedEdges(t.source,"out").find(e=>e.target===t.target),s=(null==e?void 0:e(t))||1;i?r.updateEdgeData(null==i?void 0:i.id,Object.assign(Object.assign({},i.data),{weight:i.data.weight+s})):r.addEdge({id:t.id,source:t.source,target:t.target,data:{weight:s}}),o=Math.max(o,r.getNode(t.source).data.out+=s),n=Math.max(n,r.getNode(t.target).data.in+=s)});const i=[],s=o+n+3;for(let t=0;t<s;t++)i.push(new Et);const a=n+1;return r.getAllNodes().forEach(t=>{St(i,a,Object.assign({v:t.id},r.getNode(t.id).data))}),{buckets:i,zeroIdx:a,graph:r}},St=(t,e,r)=>{r.out?r.in?t[r.out-r.in+e].enqueue(r):t[t.length-1].enqueue(r):t[0].enqueue(r)},zt=(t,e)=>{const r=((t,e)=>{var r;if(t.getAllNodes().length<=1)return[];const n=kt(t,e||Mt);return null===(r=Nt(n.graph,n.buckets,n.zeroIdx).map(e=>t.getRelatedEdges(e.v,"out").filter(({target:t})=>t===e.w)))||void 0===r?void 0:r.flat()})(t,t=>t.data.weight||1);null==r||r.forEach(e=>{const r=e.data;t.removeEdge(e.id),r.forwardName=e.data.name,r.reversed=!0,t.addEdge({id:e.id,source:e.target,target:e.source,data:Object.assign({},r)})})},At=(t,e,r,n)=>{let o;do{o=`${n}${Math.random()}`}while(t.hasNode(o));return r.dummy=e,t.addNode({id:o,data:r}),o},Ot=t=>{const e=new yt;return t.getAllNodes().forEach(r=>{t.getChildren(r.id).length||e.addNode(Object.assign({},r))}),t.getAllEdges().forEach(t=>{e.addEdge(t)}),e},jt=(t,e)=>{const r=Number(t.x),n=Number(t.y),o=Number(e.x)-r,i=Number(e.y)-n;let s,a,u=Number(t.width)/2,c=Number(t.height)/2;return o||i?(Math.abs(i)*u>Math.abs(o)*c?(i<0&&(c=-c),s=c*o/i,a=c):(o<0&&(u=-u),s=u,a=u*i/o),{x:r+s,y:n+a}):{x:0,y:0}},Ct=t=>{const e=[],r=Rt(t)+1;for(let t=0;t<r;t++)e.push([]);t.getAllNodes().forEach(t=>{const r=t.data.rank;void 0!==r&&e[r]&&e[r].push(t.id)});for(let n=0;n<r;n++)e[n]=e[n].sort((e,r)=>{return n=t.getNode(e).data.order,o=t.getNode(r).data.order,Number(n)-Number(o);var n,o});return e},It=(t,e,r,n)=>{const o={width:0,height:0};return l(r)&&l(n)&&(o.rank=r,o.order=n),At(t,"border",o,e)},Rt=t=>{let e;return t.getAllNodes().forEach(t=>{const r=t.data.rank;void 0!==r&&(void 0===e||r>e)&&(e=r)}),e||(e=0),e},Pt=(t,e)=>t.reduce((t,r)=>e(t)>e(r)?r:t),Tt=(t,e,r,n,o,i)=>{if(!n.includes(e.id)){n.push(e.id),r||i.push(e.id);const s=o(e.id);s&&s.forEach(e=>Tt(t,e,r,n,o,i)),r&&i.push(e.id)}},Ft=(t,e,r,n)=>{const o=Array.isArray(e)?e:[e],i=e=>t.getNeighbors(e),s=[],a=[];return o.forEach(e=>{if(!t.hasNode(e.id))throw new Error(`Graph does not have node: ${e}`);Tt(t,e,"post"===r,a,i,s)}),s},Lt=(t,e,r,n,o,i)=>{const s={rank:i,borderType:e,width:0,height:0},a=i-o.data.minRank,u=o.data[e][a-1],c=At(t,"border",s,r);o.data[e][a]=c,t.setParent(c,n),u&&t.addEdge({id:`e${Math.random()}`,source:u,target:c,data:{weight:1}})},Dt=t=>{t.getAllNodes().forEach(t=>{qt(t)}),t.getAllEdges().forEach(t=>{qt(t)})},qt=t=>{const e=t.data.width;t.data.width=t.data.height,t.data.height=e},Vt=t=>{t.getAllNodes().forEach(t=>{Bt(t.data)}),t.getAllEdges().forEach(t=>{var e;null===(e=t.data.points)||void 0===e||e.forEach(t=>Bt(t)),t.data.hasOwnProperty("y")&&Bt(t.data)})},Bt=t=>{(null==t?void 0:t.y)&&(t.y=-t.y)},$t=t=>{t.getAllNodes().forEach(t=>{Gt(t.data)}),t.getAllEdges().forEach(t=>{var e;null===(e=t.data.points)||void 0===e||e.forEach(t=>Gt(t)),t.data.hasOwnProperty("x")&&Gt(t.data)})},Gt=t=>{const e=t.x;t.x=t.y,t.y=e},Ut=(t,e,r,n,o,i,s)=>{const a=t.getChildren(s);if(!(null==a?void 0:a.length))return void(s!==e&&t.addEdge({id:`e${Math.random()}`,source:e,target:s,data:{weight:0,minlen:r}}));const u=It(t,"_bt"),c=It(t,"_bb"),h=t.getNode(s);t.setParent(u,s),h.data.borderTop=u,t.setParent(c,s),h.data.borderBottom=c,null==a||a.forEach(a=>{Ut(t,e,r,n,o,i,a.id);const h=a.data.borderTop?a.data.borderTop:a.id,l=a.data.borderBottom?a.data.borderBottom:a.id,d=a.data.borderTop?n:2*n,f=h!==l?1:o-i[s]+1;t.addEdge({id:`e${Math.random()}`,source:u,target:h,data:{minlen:f,weight:d,nestingEdge:!0}}),t.addEdge({id:`e${Math.random()}`,source:l,target:c,data:{minlen:f,weight:d,nestingEdge:!0}})}),t.getParent(s)||t.addEdge({id:`e${Math.random()}`,source:e,target:u,data:{weight:0,minlen:o+i[s]}})},Wt=t=>{const e={},r=(n,o)=>{const i=t.getChildren(n);null==i||i.forEach(t=>r(t.id,o+1)),e[n]=o};return t.getRoots().forEach(t=>r(t.id,1)),e},Yt=t=>{let e=0;return t.getAllEdges().forEach(t=>{e+=t.data.weight}),e},Ht="edge-label",Xt=(t,e,r)=>{let n=e.source,o=t.getNode(n).data.rank;const i=e.target,s=t.getNode(i).data.rank,a=e.data.labelRank;if(s===o+1)return;let u,c,h;for(t.removeEdge(e.id),h=0,++o;o<s;++h,++o)e.data.points=[],c={originalEdge:e,width:0,height:0,rank:o},u=At(t,"edge",c,"_d"),o===a&&(c.width=e.data.width,c.height=e.data.height,c.dummy=Ht,c.labelpos=e.data.labelpos),t.addEdge({id:`e${Math.random()}`,source:n,target:u,data:{weight:e.data.weight}}),0===h&&r.push(u),n=u;t.addEdge({id:`e${Math.random()}`,source:n,target:i,data:{weight:e.data.weight}})},Qt=t=>{let e;for(;t.hasNode(e=`_root${Math.random()}`););return e},Jt=(t,e,r)=>{const n=(o=r,i=r.map((t,e)=>e),null==o?void 0:o.reduce((t,e,r)=>(t[e]=i[r],t),{}));var o,i;const s=e.map(e=>{const r=t.getRelatedEdges(e,"out").map(t=>({pos:n[t.target]||0,weight:t.data.weight}));return null==r?void 0:r.sort((t,e)=>t.pos-e.pos)}),a=s.flat().filter(t=>void 0!==t);let u=1;for(;u<r.length;)u<<=1;const c=2*u-1;u-=1;const h=Array(c).fill(0,0,c);let l=0;return null==a||a.forEach(t=>{if(t){let e=t.pos+u;h[e]+=t.weight;let r=0;for(;e>0;)e%2&&(r+=h[e+1]),e=e-1>>1,h[e]+=t.weight;l+=t.weight*r}}),l},Kt=(t,e)=>{let r=0;for(let n=1;n<(null==e?void 0:e.length);n+=1)r+=Jt(t,e[n-1],e[n]);return r},Zt=t=>{const e={},r=t.getAllNodes(),n=r.map(t=>{var e;return null!==(e=t.data.rank)&&void 0!==e?e:-1/0}),o=Math.max(...n),i=[];for(let t=0;t<o+1;t++)i.push([]);const s=r.sort((e,r)=>t.getNode(e.id).data.rank-t.getNode(r.id).data.rank),a=s.filter(e=>void 0!==t.getNode(e.id).data.fixorder).sort((e,r)=>t.getNode(e.id).data.fixorder-t.getNode(r.id).data.fixorder);return null==a||a.forEach(r=>{isNaN(t.getNode(r.id).data.rank)||i[t.getNode(r.id).data.rank].push(r.id),e[r.id]=!0}),null==s||s.forEach(r=>t.dfsTree(r.id,t=>{if(e.hasOwnProperty(t.id))return!0;e[t.id]=!0,isNaN(t.data.rank)||i[t.data.rank].push(t.id)})),i},te=t=>{var e,r;const n=[];for(;null==t?void 0:t.length;){const o=t.pop();n.push(o),null===(e=o.in.reverse())||void 0===e||e.forEach(t=>{return(e=o,t=>{t.merged||(void 0===t.barycenter||void 0===e.barycenter||t.barycenter>=e.barycenter)&&ee(e,t)})(t);var e}),null===(r=o.out)||void 0===r||r.forEach(e=>{return(r=o,e=>{e.in.push(r),0===--e.indegree&&t.push(e)})(e);var r})}const o=n.filter(t=>!t.merged),i=["vs","i","barycenter","weight"];return o.map(t=>{const e={};return null==i||i.forEach(r=>{void 0!==t[r]&&(e[r]=t[r])}),e})},ee=(t,e)=>{var r;let n=0,o=0;t.weight&&(n+=t.barycenter*t.weight,o+=t.weight),e.weight&&(n+=e.barycenter*e.weight,o+=e.weight),t.vs=null===(r=e.vs)||void 0===r?void 0:r.concat(t.vs),t.barycenter=n/o,t.weight=o,t.i=Math.min(e.i,t.i),e.merged=!0},re=(t,e,r)=>{let n,o=r;for(;e.length&&(n=e[e.length-1]).i<=o;)e.pop(),null==t||t.push(n.vs),o++;return o},ne=(t,e)=>(r,n)=>{if(void 0!==r.fixorder&&void 0!==n.fixorder)return r.fixorder-n.fixorder;if(r.barycenter<n.barycenter)return-1;if(r.barycenter>n.barycenter)return 1;if(e&&void 0!==r.order&&void 0!==n.order){if(r.order<n.order)return-1;if(r.order>n.order)return 1}return t?n.i-r.i:r.i-n.i},oe=(t,e,r,n,o,i)=>{var s,a,u,c;let h=t.getChildren(e).map(t=>t.id);const l=t.getNode(e),d=l?l.data.borderLeft:void 0,f=l?l.data.borderRight:void 0,g={};d&&(h=null==h?void 0:h.filter(t=>t!==d&&t!==f));const p=((t,e)=>e.map(e=>{const r=t.getRelatedEdges(e,"in");if(!(null==r?void 0:r.length))return{v:e};const n={sum:0,weight:0};return null==r||r.forEach(e=>{const r=t.getNode(e.source);n.sum+=e.data.weight*r.data.order,n.weight+=e.data.weight}),{v:e,barycenter:n.sum/n.weight,weight:n.weight}}))(t,h||[]);null==p||p.forEach(e=>{var o;if(null===(o=t.getChildren(e.v))||void 0===o?void 0:o.length){const o=oe(t,e.v,r,n,i);g[e.v]=o,o.hasOwnProperty("barycenter")&&se(e,o)}});const v=((t,e)=>{var r,n,o;const i={};null==t||t.forEach((t,e)=>{i[t.v]={i:e,indegree:0,in:[],out:[],vs:[t.v]};const r=i[t.v];void 0!==t.barycenter&&(r.barycenter=t.barycenter,r.weight=t.weight)}),null===(r=e.getAllEdges())||void 0===r||r.forEach(t=>{const e=i[t.source],r=i[t.target];void 0!==e&&void 0!==r&&(r.indegree++,e.out.push(i[t.target]))});const s=null===(o=(n=Object.values(i)).filter)||void 0===o?void 0:o.call(n,t=>!t.indegree);return te(s)})(p,r);ie(v,g),null===(s=v.filter(t=>t.vs.length>0))||void 0===s||s.forEach(e=>{const r=t.getNode(e.vs[0]);r&&(e.fixorder=r.data.fixorder,e.order=r.data.order)});const m=((t,e,r,n)=>{const o=((t,e)=>{const r={lhs:[],rhs:[]};return null==t||t.forEach(t=>{e(t)?r.lhs.push(t):r.rhs.push(t)}),r})(t,t=>{const e=t.hasOwnProperty("fixorder")&&!isNaN(t.fixorder);return n?!e&&t.hasOwnProperty("barycenter"):e||t.hasOwnProperty("barycenter")}),i=o.lhs,s=o.rhs.sort((t,e)=>-t.i- -e.i),a=[];let u=0,c=0,h=0;null==i||i.sort(ne(!!e,!!r)),h=re(a,s,h),null==i||i.forEach(t=>{var e;h+=null===(e=t.vs)||void 0===e?void 0:e.length,a.push(t.vs),u+=t.barycenter*t.weight,c+=t.weight,h=re(a,s,h)});const l={vs:a.flat()};return c&&(l.barycenter=u/c,l.weight=c),l})(v,n,o,i);if(d&&(m.vs=[d,m.vs,f].flat(),null===(a=t.getPredecessors(d))||void 0===a?void 0:a.length)){const e=t.getNode((null===(u=t.getPredecessors(d))||void 0===u?void 0:u[0].id)||""),r=t.getNode((null===(c=t.getPredecessors(f))||void 0===c?void 0:c[0].id)||"");m.hasOwnProperty("barycenter")||(m.barycenter=0,m.weight=0),m.barycenter=(m.barycenter*m.weight+e.data.order+r.data.order)/(m.weight+2),m.weight+=2}return m},ie=(t,e)=>{null==t||t.forEach(t=>{var r;const n=null===(r=t.vs)||void 0===r?void 0:r.map(t=>e[t]?e[t].vs:t);t.vs=n.flat()})},se=(t,e)=>{void 0!==t.barycenter?(t.barycenter=(t.barycenter*t.weight+e.barycenter*e.weight)/(t.weight+e.weight),t.weight+=e.weight):(t.barycenter=e.barycenter,t.weight=e.weight)},ae=(t,e,r)=>e.map(e=>((t,e,r)=>{const n=Qt(t),o=new yt;return o.addNode({id:n,data:{}}),t.getAllNodes().forEach(i=>{var s,a;const u=t.getParent(i.id);(i.data.rank===e||i.data.minRank<=e&&e<=i.data.maxRank)&&(o.hasNode(i.id)||o.addNode(Object.assign({},i)),(null==u?void 0:u.id)&&!o.hasNode(null==u?void 0:u.id)&&o.addNode(Object.assign({},u)),o.setParent(i.id,(null==u?void 0:u.id)||n),t.getRelatedEdges(i.id,r).forEach(e=>{const r=e.source===i.id?e.target:e.source;o.hasNode(r)||o.addNode(Object.assign({},t.getNode(r)));const n=o.getRelatedEdges(r,"out").find(({target:t})=>t===i.id),s=void 0!==n?n.data.weight:0;n?o.updateEdgeData(n.id,Object.assign(Object.assign({},n.data),{weight:e.data.weight+s})):o.addEdge({id:e.id,source:r,target:i.id,data:{weight:e.data.weight+s}})}),i.data.hasOwnProperty("minRank")&&o.updateNodeData(i.id,Object.assign(Object.assign({},i.data),{borderLeft:[null===(s=i.data.borderLeft)||void 0===s?void 0:s[e-i.data.minRank]],borderRight:[null===(a=i.data.borderRight)||void 0===a?void 0:a[e-i.data.minRank]]})))}),o})(t,e,r)),ue=(t,e,r,n)=>{const o=new yt;null==t||t.forEach(t=>{var i;const s=t.getRoots()[0].id,a=oe(t,s,o,e,r,n);for(let e=0;e<(null===(i=a.vs)||void 0===i?void 0:i.length);e++){const r=t.getNode(a.vs[e]);r&&(r.data.order=e)}((t,e,r)=>{const n={};let o;null==r||r.forEach(r=>{let i,s,a=t.getParent(r);for(;a;){if(i=t.getParent(a.id),i?(s=n[i.id],n[i.id]=a.id):(s=o,o=a.id),s&&s!==a.id)return e.hasNode(s)||e.addNode({id:s,data:{}}),e.hasNode(a.id)||e.addNode({id:a.id,data:{}}),void(e.hasEdge(`e${s}-${a.id}`)||e.addEdge({id:`e${s}-${a.id}`,source:s,target:a.id,data:{}}));a=i}})})(t,o,a.vs)})},ce=(t,e)=>{null==e||e.forEach(e=>{null==e||e.forEach((e,r)=>{t.getNode(e).data.order=r})})},he=(t,e)=>{const r=(t=>{const e={};let r=0;const n=o=>{const i=r;t.getChildren(o).forEach(t=>n(t.id)),e[o]={low:i,lim:r++}};return t.getRoots().forEach(t=>n(t.id)),e})(t);e.forEach(e=>{var n,o;let i=e,s=t.getNode(i);const a=s.data.originalEdge;if(!a)return;const u=((t,e,r,n)=>{var o,i;const s=[],a=[],u=Math.min(e[r].low,e[n].low),c=Math.max(e[r].lim,e[n].lim);let h,l;h=r;do{h=null===(o=t.getParent(h))||void 0===o?void 0:o.id,s.push(h)}while(h&&(e[h].low>u||c>e[h].lim));for(l=h,h=n;h&&h!==l;)a.push(h),h=null===(i=t.getParent(h))||void 0===i?void 0:i.id;return{lca:l,path:s.concat(a.reverse())}})(t,r,a.source,a.target),c=u.path,h=u.lca;let l=0,d=c[l],f=!0;for(;i!==a.target;){if(s=t.getNode(i),f){for(;d!==h&&(null===(n=t.getNode(d))||void 0===n?void 0:n.data.maxRank)<s.data.rank;)l++,d=c[l];d===h&&(f=!1)}if(!f){for(;l<c.length-1&&(null===(o=t.getNode(c[l+1]))||void 0===o?void 0:o.data.minRank)<=s.data.rank;)l++;d=c[l]}t.hasNode(d)&&t.setParent(i,d),i=t.getSuccessors(i)[0].id}})},le=(t,e)=>{const r={};function n(e,n){const o=function(t){return JSON.stringify(t.slice(1))}(e);n.get(o)||(!function(e,n,o,i,s){var a,u;let c;for(let h=n;h<o;h++)c=e[h],(null===(a=t.getNode(c))||void 0===a?void 0:a.data.dummy)&&(null===(u=t.getPredecessors(c))||void 0===u||u.forEach(e=>{const n=t.getNode(e.id);n.data.dummy&&(n.data.order<i||n.data.order>s)&&fe(r,e.id,c)}))}(...e),n.set(o,!0))}const o=(e,r)=>{let o,i=-1,s=0;const a=new Map;return null==r||r.forEach((u,c)=>{var h;if("border"===(null===(h=t.getNode(u))||void 0===h?void 0:h.data.dummy)){const e=t.getPredecessors(u)||[];e.length&&(o=t.getNode(e[0].id).data.order,n([r,s,c,i,o],a),s=c,i=o)}n([r,s,r.length,o,e.length],a)}),r};return(null==e?void 0:e.length)&&e.reduce(o),r},de=(t,e)=>{var r,n;if(null===(r=t.getNode(e))||void 0===r?void 0:r.data.dummy)return null===(n=t.getPredecessors(e))||void 0===n?void 0:n.find(e=>t.getNode(e.id).data.dummy)},fe=(t,e,r)=>{let n=e,o=r;if(n>o){const t=n;n=o,o=t}let i=t[n];i||(t[n]=i={}),i[o]=!0},ge=(t,e,r)=>{let n=e,o=r;if(n>r){n=r,o=e}return!!t[n]},pe=(t,e,r,n,o,i)=>{const s=new yt,a=ve(n,o,i);return null==e||e.forEach(e=>{let n;null==e||e.forEach(e=>{const o=r[e];if(s.hasNode(o)||s.addNode({id:o,data:{}}),n){const i=r[n],u=s.getRelatedEdges(i,"out").find(t=>t.target===o);u?s.updateEdgeData(u.id,Object.assign(Object.assign({},u.data),{weight:Math.max(a(t,e,n),u.data.weight||0)})):s.addEdge({id:`e${Math.random()}`,source:i,target:o,data:{weight:Math.max(a(t,e,n),0)}})}n=e})}),s};const ve=(t,e,r)=>(n,o,i)=>{const s=n.getNode(o),a=n.getNode(i);let u=0,c=0;if(u+=s.data.width/2,s.data.hasOwnProperty("labelpos"))switch((s.data.labelpos||"").toLowerCase()){case"l":c=-s.data.width/2;break;case"r":c=s.data.width/2}if(c&&(u+=r?c:-c),c=0,u+=(s.data.dummy?e:t)/2,u+=(a.data.dummy?e:t)/2,u+=a.data.width/2,a.data.labelpos)switch((a.data.labelpos||"").toLowerCase()){case"l":c=a.data.width/2;break;case"r":c=-a.data.width/2}return c&&(u+=r?c:-c),c=0,u},me=(t,e)=>t.getNode(e).data.width||0,ye=(t,e)=>{const{align:r,nodesep:n=0,edgesep:o=0}=e||{},i=Ct(t),s=Object.assign(((t,e)=>{const r={},n=(e,n)=>{let o=0,i=0;const s=e.length,a=null==n?void 0:n[(null==n?void 0:n.length)-1];return null==n||n.forEach((e,u)=>{var c;const h=de(t,e),l=h?t.getNode(h.id).data.order:s;(h||e===a)&&(null===(c=n.slice(i,u+1))||void 0===c||c.forEach(e=>{var n;null===(n=t.getPredecessors(e))||void 0===n||n.forEach(n=>{var i;const s=t.getNode(n.id),a=s.data.order;!(a<o||l<a)||s.data.dummy&&(null===(i=t.getNode(e))||void 0===i?void 0:i.data.dummy)||fe(r,n.id,e)})}),i=u+1,o=l)}),n};return(null==e?void 0:e.length)&&e.reduce(n),r})(t,i),le(t,i)),a={};let u=[];["u","d"].forEach(e=>{u="u"===e?i:Object.values(i).reverse(),["l","r"].forEach(r=>{"r"===r&&(u=u.map(t=>Object.values(t).reverse()));const i=("u"===e?t.getPredecessors:t.getSuccessors).bind(t),c=((t,e,r,n)=>{const o={},i={},s={};return null==e||e.forEach(t=>{null==t||t.forEach((t,e)=>{o[t]=t,i[t]=t,s[t]=e})}),null==e||e.forEach(t=>{let e=-1;null==t||t.forEach(t=>{let a=n(t).map(t=>t.id);if(a.length){a=a.sort((t,e)=>s[t]-s[e]);const n=(a.length-1)/2;for(let u=Math.floor(n),c=Math.ceil(n);u<=c;++u){const n=a[u];i[t]===t&&e<s[n]&&!ge(r,t,n)&&(i[n]=t,i[t]=o[t]=o[n],e=s[n])}}})}),{root:o,align:i}})(0,u,s,i),h=((t,e,r,n,o,i,s)=>{var a;const u={},c=pe(t,e,r,o,i,s),h=s?"borderLeft":"borderRight",l=(t,e)=>{let r=c.getAllNodes(),n=r.pop();const o={};for(;n;)o[n.id]?t(n.id):(o[n.id]=!0,r.push(n),r=r.concat(e(n.id))),n=r.pop()};return l(t=>{u[t]=(c.getRelatedEdges(t,"in")||[]).reduce((t,e)=>Math.max(t,(u[e.source]||0)+e.data.weight),0)},c.getPredecessors.bind(c)),l(e=>{const r=(c.getRelatedEdges(e,"out")||[]).reduce((t,e)=>Math.min(t,(u[e.target]||0)-e.data.weight),Number.POSITIVE_INFINITY),n=t.getNode(e);r!==Number.POSITIVE_INFINITY&&n.data.borderType!==h&&(u[e]=Math.max(u[e],r))},c.getSuccessors.bind(c)),null===(a=Object.values(n))||void 0===a||a.forEach(t=>{u[t]=u[r[t]]}),u})(t,u,c.root,c.align,n,o,"r"===r);"r"===r&&Object.keys(h).forEach(t=>h[t]=-h[t]),a[e+r]=h})});const c=((t,e)=>Pt(Object.values(e),e=>{var r;let n=Number.NEGATIVE_INFINITY,o=Number.POSITIVE_INFINITY;return null===(r=Object.keys(e))||void 0===r||r.forEach(r=>{const i=e[r],s=me(t,r)/2;n=Math.max(i+s,n),o=Math.min(i-s,o)}),n-o}))(t,a);return c&&function(t,e){const r=Object.values(e),n=Math.min(...r),o=Math.max(...r);["u","d"].forEach(r=>{["l","r"].forEach(i=>{const s=r+i,a=t[s];let u;if(a===e)return;const c=Object.values(a);u="l"===i?n-Math.min(...c):o-Math.max(...c),u&&(t[s]={},Object.keys(a).forEach(e=>{t[s][e]=a[e]+u}))})})}(a,c),((t,e)=>{const r={};return Object.keys(t.ul).forEach(n=>{if(e)r[n]=t[e.toLowerCase()][n];else{const e=Object.values(t).map(t=>t[n]);r[n]=(e[0]+e[1])/2}}),r})(a,r)},we=(t,e)=>{var r;const n=Ot(t);((t,e)=>{const{ranksep:r=0}=e||{},n=Ct(t);let o=0;null==n||n.forEach(e=>{const n=e.map(e=>t.getNode(e).data.height),i=Math.max(...n,0);null==e||e.forEach(e=>{t.getNode(e).data.y=o+i/2}),o+=i+r})})(n,e);const o=ye(n,e);null===(r=Object.keys(o))||void 0===r||r.forEach(t=>{n.getNode(t).data.x=o[t]})},xe=t=>{const e={},r=n=>{var o;const i=t.getNode(n);if(!i)return 0;if(e[n])return i.data.rank;let s;return e[n]=!0,null===(o=t.getRelatedEdges(n,"out"))||void 0===o||o.forEach(t=>{const e=r(t.target)-t.data.minlen;e&&(void 0===s||e<s)&&(s=e)}),s||(s=0),i.data.rank=s,s};t.getAllNodes().filter(e=>0===t.getRelatedEdges(e.id,"in").length).forEach(t=>r(t.id))},be=(t,e)=>t.getNode(e.target).data.rank-t.getNode(e.source).data.rank-e.data.minlen,Ee=(t,e)=>{const r=n=>{e.getRelatedEdges(n,"both").forEach(o=>{const i=o.source,s=n===i?o.target:i;t.hasNode(s)||be(e,o)||(t.addNode({id:s,data:{}}),t.addEdge({id:o.id,source:n,target:s,data:{}}),r(s))})};return t.getAllNodes().forEach(t=>r(t.id)),t.getAllNodes().length},Me=(t,e)=>{const r=n=>{var o;null===(o=e.getRelatedEdges(n,"both"))||void 0===o||o.forEach(o=>{const i=o.source,s=n===i?o.target:i;t.hasNode(s)||void 0===e.getNode(s).data.layer&&be(e,o)||(t.addNode({id:s,data:{}}),t.addEdge({id:o.id,source:n,target:s,data:{}}),r(s))})};return t.getAllNodes().forEach(t=>r(t.id)),t.getAllNodes().length},Ne=(t,e)=>Pt(e.getAllEdges(),r=>t.hasNode(r.source)!==t.hasNode(r.target)?be(e,r):1/0),_e=(t,e,r)=>{t.getAllNodes().forEach(t=>{const n=e.getNode(t.id);n.data.rank||(n.data.rank=0),n.data.rank+=r})},ke=t=>{const e=(t=>{const e=new yt;return t.getAllNodes().forEach(t=>{e.addNode(Object.assign({},t))}),t.getAllEdges().forEach(t=>{const r=e.getRelatedEdges(t.source,"out").find(e=>e.target===t.target);r?e.updateEdgeData(null==r?void 0:r.id,Object.assign(Object.assign({},r.data),{weight:r.data.weight+t.data.weight||0,minlen:Math.max(r.data.minlen,t.data.minlen||1)})):e.addEdge({id:t.id,source:t.source,target:t.target,data:{weight:t.data.weight||0,minlen:t.data.minlen||1}})}),e})(t);xe(e);const r=(t=>{const e=new yt({tree:[]}),r=t.getAllNodes()[0],n=t.getAllNodes().length;let o,i;for(e.addNode(r);Ee(e,t)<n;)o=Ne(e,t),i=e.hasNode(o.source)?be(t,o):-be(t,o),_e(e,t,i);return e})(e);let n,o;for(Oe(r),Se(r,e);n=Ce(r);)o=Ie(r,e,n),Re(r,e,n,o)},Se=(t,e)=>{let r=Ft(t,t.getAllNodes(),"post");r=r.slice(0,(null==r?void 0:r.length)-1),r.forEach(r=>{ze(t,e,r)})},ze=(t,e,r)=>{const n=t.getNode(r).data.parent;t.getRelatedEdges(r,"both").find(t=>t.target===n||t.source===n).data.cutvalue=Ae(t,e,r)},Ae=(t,e,r)=>{const n=t.getNode(r).data.parent;let o=!0,i=e.getRelatedEdges(r,"out").find(t=>t.target===n),s=0;return i||(o=!1,i=e.getRelatedEdges(n,"out").find(t=>t.target===r)),s=i.data.weight,e.getRelatedEdges(r,"both").forEach(e=>{const i=e.source===r,a=i?e.target:e.source;if(a!==n){const n=i===o,u=e.data.weight;if(s+=n?u:-u,Te(t,r,a)){const e=t.getRelatedEdges(r,"both").find(t=>t.source===a||t.target===a).data.cutvalue;s+=n?-e:e}}}),s},Oe=(t,e=t.getAllNodes()[0].id)=>{je(t,{},1,e)},je=(t,e,r,n,o)=>{var i;const s=r;let a=r;const u=t.getNode(n);return e[n]=!0,null===(i=t.getNeighbors(n))||void 0===i||i.forEach(r=>{e[r.id]||(a=je(t,e,a,r.id,n))}),u.data.low=s,u.data.lim=a++,o?u.data.parent=o:delete u.data.parent,a},Ce=t=>t.getAllEdges().find(t=>t.data.cutvalue<0),Ie=(t,e,r)=>{let n=r.source,o=r.target;e.getRelatedEdges(n,"out").find(t=>t.target===o)||(n=r.target,o=r.source);const i=t.getNode(n),s=t.getNode(o);let a=i,u=!1;i.data.lim>s.data.lim&&(a=s,u=!0);const c=e.getAllEdges().filter(e=>u===Fe(t.getNode(e.source),a)&&u!==Fe(t.getNode(e.target),a));return Pt(c,t=>be(e,t))},Re=(t,e,r,n)=>{const o=t.getRelatedEdges(r.source,"both").find(t=>t.source===r.target||t.target===r.target);o&&t.removeEdge(o.id),t.addEdge({id:`e${Math.random()}`,source:n.source,target:n.target,data:{}}),Oe(t),Se(t,e),Pe(t,e)},Pe=(t,e)=>{const r=t.getAllNodes().find(t=>!t.data.parent);let n=Ft(t,r,"pre");n=n.slice(1),n.forEach(r=>{const n=t.getNode(r).data.parent;let o=e.getRelatedEdges(r,"out").find(t=>t.target===n),i=!1;!o&&e.hasNode(n)&&(o=e.getRelatedEdges(n,"out").find(t=>t.target===r),i=!0),e.getNode(r).data.rank=(e.hasNode(n)&&e.getNode(n).data.rank||0)+(i?null==o?void 0:o.data.minlen:-(null==o?void 0:o.data.minlen))})},Te=(t,e,r)=>t.getRelatedEdges(e,"both").find(t=>t.source===r||t.target===r),Fe=(t,e)=>e.data.low<=t.data.lim&&t.data.lim<=e.data.lim,Le=xe,De=t=>{(t=>{const e={};let r;const n=o=>{var i;const s=t.getNode(o);if(!s)return 0;if(e[o])return s.data.rank;let a;return e[o]=!0,null===(i=t.getRelatedEdges(o,"out"))||void 0===i||i.forEach(t=>{const e=n(t.target)-t.data.minlen;e&&(void 0===a||e<a)&&(a=e)}),a||(a=0),(void 0===r||a<r)&&(r=a),s.data.rank=a,a};t.getAllNodes().filter(e=>0===t.getRelatedEdges(e.id,"in").length).forEach(t=>{t&&n(t.id)}),void 0===r&&(r=0);const o={},i=(e,r)=>{var n;const s=t.getNode(e),a=isNaN(s.data.layer)?r:s.data.layer;(void 0===s.data.rank||s.data.rank<a)&&(s.data.rank=a),o[e]||(o[e]=!0,null===(n=t.getRelatedEdges(e,"out"))||void 0===n||n.forEach(t=>{i(t.target,a+t.data.minlen)}))};t.getAllNodes().forEach(t=>{const e=t.data;e&&(isNaN(e.layer)?e.rank-=r:i(t.id,e.layer))})})(t),(t=>{const e=new yt({tree:[]}),r=t.getAllNodes()[0],n=t.getAllNodes().length;let o,i;for(e.addNode(r);Me(e,t)<n;)o=Ne(e,t),i=e.hasNode(o.source)?be(t,o):-be(t,o),_e(e,t,i)})(t)},qe=t=>{ke(t)},Ve=(t,e)=>{const{ranker:r,rankdir:n="tb",nodeOrder:o,keepNodeOrder:i,align:s,nodesep:a=50,edgesep:u=20,ranksep:c=50}=e;ir(t),zt(t);const{nestingRoot:h,nodeRankFactor:l}=(t=>{const e=At(t,"root",{},"_root"),r=Wt(t);let n=Math.max(...Object.values(r));Math.abs(n)===1/0&&(n=1);const o=n-1,i=2*o+1;t.getAllEdges().forEach(t=>{t.data.minlen*=i});const s=Yt(t)+1;return t.getRoots().forEach(n=>{Ut(t,e,i,s,o,r,n.id)}),{nestingRoot:e,nodeRankFactor:i}})(t);((t,e)=>{switch(e){case"network-simplex":qe(t);break;case"tight-tree":default:De(t);break;case"longest-path":Le(t)}})(Ot(t),r),Je(t),((t,e=0)=>{const r=t.getAllNodes(),n=r.filter(t=>void 0!==t.data.rank).map(t=>t.data.rank),o=Math.min(...n),i=[];r.forEach(t=>{const e=(t.data.rank||0)-o;i[e]||(i[e]=[]),i[e].push(t.id)});let s=0;for(let r=0;r<i.length;r++){const n=i[r];void 0===n?r%e!==0&&(s-=1):s&&(null==n||n.forEach(e=>{const r=t.getNode(e);r&&(r.data.rank=r.data.rank||0,r.data.rank+=s)}))}})(t,l),((t,e)=>{e&&t.removeNode(e),t.getAllEdges().forEach(e=>{e.data.nestingEdge&&t.removeEdge(e.id)})})(t,h),(t=>{const e=t.getAllNodes().filter(t=>void 0!==t.data.rank).map(t=>t.data.rank),r=Math.min(...e);t.getAllNodes().forEach(t=>{t.data.hasOwnProperty("rank")&&r!==1/0&&(t.data.rank-=r)})})(t),Ke(t),Ze(t);const d=[];((t,e)=>{t.getAllEdges().forEach(r=>Xt(t,r,e))})(t,d),he(t,d),(t=>{const e=r=>{const n=t.getChildren(r),o=t.getNode(r);if((null==n?void 0:n.length)&&n.forEach(t=>e(t.id)),o.data.hasOwnProperty("minRank")){o.data.borderLeft=[],o.data.borderRight=[];for(let e=o.data.minRank,n=o.data.maxRank+1;e<n;e+=1)Lt(t,"borderLeft","_bl",r,o,e),Lt(t,"borderRight","_br",r,o,e)}};t.getRoots().forEach(t=>e(t.id))})(t),i&&((t,e)=>{const r=t.getAllNodes().filter(e=>{var r;return!(null===(r=t.getChildren(e.id))||void 0===r?void 0:r.length)}).map(t=>t.data.rank),n=Math.max(...r),o=[];for(let t=0;t<n+1;t++)o[t]=[];null==e||e.forEach(e=>{const r=t.getNode(e);r&&!r.data.dummy&&(isNaN(r.data.rank)||(r.data.fixorder=o[r.data.rank].length,o[r.data.rank].push(e)))})})(t,o),((t,e)=>{const r=Rt(t),n=[],o=[];for(let t=1;t<r+1;t++)n.push(t);for(let t=r-1;t>-1;t--)o.push(t);const i=ae(t,n,"in"),s=ae(t,o,"out");let a=Zt(t);ce(t,a);let u,c=Number.POSITIVE_INFINITY;for(let r=0,n=0;n<4;++r,++n){ue(r%2?i:s,r%4>=2,!1,e),a=Ct(t);const o=Kt(t,a);o<c&&(n=0,u=g(a),c=o)}a=Zt(t),ce(t,a);for(let r=0,n=0;n<4;++r,++n){ue(r%2?i:s,r%4>=2,!0,e),a=Ct(t);const o=Kt(t,a);o<c&&(n=0,u=g(a),c=o)}ce(t,u)})(t,i),sr(t),((t,e)=>{const r=e.toLowerCase();"lr"!==r&&"rl"!==r||Dt(t)})(t,n),we(t,{align:s,nodesep:a,edgesep:u,ranksep:c}),ar(t),or(t),((t,e)=>{e.forEach(e=>{let r=t.getNode(e);const{data:n}=r,o=n.originalEdge;let i;o&&t.addEdge(o);let s=e;for(;r.data.dummy;)i=t.getSuccessors(s)[0],t.removeNode(s),o.data.points.push({x:r.data.x,y:r.data.y}),r.data.dummy===Ht&&(o.data.x=r.data.x,o.data.y=r.data.y,o.data.width=r.data.width,o.data.height=r.data.height),s=i.id,r=t.getNode(s)})})(t,d),rr(t),((t,e)=>{const r=e.toLowerCase();"bt"!==r&&"rl"!==r||Vt(t),"lr"!==r&&"rl"!==r||($t(t),Dt(t))})(t,n);const{width:f,height:p}=tr(t);return er(t),nr(t),(t=>{t.getAllEdges().forEach(e=>{const r=e.data;if(r.reversed){t.removeEdge(e.id);const n=r.forwardName;delete r.reversed,delete r.forwardName,t.addEdge({id:e.id,source:e.target,target:e.source,data:Object.assign(Object.assign({},r),{forwardName:n})})}})})(t),{width:f,height:p}},Be=(t,e)=>{t.getAllNodes().forEach(r=>{const n=t.getNode(r.id);if(e.hasNode(r.id)){const t=e.getNode(r.id);n.data.fixorder=t.data._order,delete t.data._order}else delete n.data.fixorder})},$e=(t,e)=>{t.getAllNodes().forEach(r=>{var n;const o=t.getNode(r.id);if(o){const t=e.getNode(r.id);o.data.x=t.data.x,o.data.y=t.data.y,o.data._order=t.data.order,o.data._rank=t.data.rank,(null===(n=e.getChildren(r.id))||void 0===n?void 0:n.length)&&(o.data.width=t.data.width,o.data.height=t.data.height)}}),t.getAllEdges().forEach(r=>{const n=t.getEdge(r.id),o=e.getEdge(r.id);n.data.points=o?o.data.points:[],o&&o.data.hasOwnProperty("x")&&(n.data.x=o.data.x,n.data.y=o.data.y)})},Ge=["width","height","layer","fixorder"],Ue={width:0,height:0},We=["minlen","weight","width","height","labeloffset"],Ye={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},He=["labelpos"],Xe=t=>{const e=new yt({tree:[]});return t.getAllNodes().forEach(r=>{const n=cr(t.getNode(r.id).data),i=Object.assign(Object.assign({},Ue),n),s=ur(i,Ge);e.hasNode(r.id)||e.addNode({id:r.id,data:Object.assign({},s)});const a=t.hasTreeStructure("combo")?t.getParent(r.id,"combo"):t.getParent(r.id);o(a)||(e.hasNode(a.id)||e.addNode(Object.assign({},a)),e.setParent(r.id,a.id))}),t.getAllEdges().forEach(r=>{const n=cr(t.getEdge(r.id).data),o={};null==He||He.forEach(t=>{void 0!==n[t]&&(o[t]=n[t])}),e.addEdge({id:r.id,source:r.source,target:r.target,data:Object.assign({},Ye,ur(n,We),o)})}),e},Qe=(t,e)=>{const{ranksep:r=0,rankdir:n}=e;return t.getAllNodes().forEach(t=>{isNaN(t.data.layer)||t.data.layer||(t.data.layer=0)}),t.getAllEdges().forEach(t=>{var e;t.data.minlen*=2,"c"!==(null===(e=t.data.labelpos)||void 0===e?void 0:e.toLowerCase())&&("TB"===n||"BT"===n?t.data.width+=t.data.labeloffset:t.data.height+=t.data.labeloffset)}),r/2},Je=t=>{t.getAllEdges().forEach(e=>{if(e.data.width&&e.data.height){const r=t.getNode(e.source),n={e:e,rank:(t.getNode(e.target).data.rank-r.data.rank)/2+r.data.rank};At(t,"edge-proxy",n,"_ep")}})},Ke=t=>{let e=0;return t.getAllNodes().forEach(r=>{var n,o;r.data.borderTop&&(r.data.minRank=null===(n=t.getNode(r.data.borderTop))||void 0===n?void 0:n.data.rank,r.data.maxRank=null===(o=t.getNode(r.data.borderBottom))||void 0===o?void 0:o.data.rank,e=Math.max(e,r.data.maxRank||-1/0))}),e},Ze=t=>{t.getAllNodes().forEach(e=>{"edge-proxy"===e.data.dummy&&(t.getEdge(e.data.e.id).data.labelRank=e.data.rank,t.removeNode(e.id))})},tr=(t,e)=>{let r,n,o=0,i=0;const{marginx:s=0,marginy:a=0}={},u=t=>{if(!t.data)return;const e=t.data.x,s=t.data.y,a=t.data.width,u=t.data.height;isNaN(e)||isNaN(a)||(void 0===r&&(r=e-a/2),r=Math.min(r,e-a/2),o=Math.max(o,e+a/2)),isNaN(s)||isNaN(u)||(void 0===n&&(n=s-u/2),n=Math.min(n,s-u/2),i=Math.max(i,s+u/2))};return t.getAllNodes().forEach(t=>{u(t)}),t.getAllEdges().forEach(t=>{(null==t?void 0:t.data.hasOwnProperty("x"))&&u(t)}),r-=s,n-=a,t.getAllNodes().forEach(t=>{t.data.x-=r,t.data.y-=n}),t.getAllEdges().forEach(t=>{var e;null===(e=t.data.points)||void 0===e||e.forEach(t=>{t.x-=r,t.y-=n}),t.data.hasOwnProperty("x")&&(t.data.x-=r),t.data.hasOwnProperty("y")&&(t.data.y-=n)}),{width:o-r+s,height:i-n+a}},er=t=>{t.getAllEdges().forEach(e=>{const r=t.getNode(e.source),n=t.getNode(e.target);let o,i;e.data.points?(o=e.data.points[0],i=e.data.points[e.data.points.length-1]):(e.data.points=[],o={x:n.data.x,y:n.data.y},i={x:r.data.x,y:r.data.y}),e.data.points.unshift(jt(r.data,o)),e.data.points.push(jt(n.data,i))})},rr=t=>{t.getAllEdges().forEach(t=>{if(t.data.hasOwnProperty("x"))switch("l"!==t.data.labelpos&&"r"!==t.data.labelpos||(t.data.width-=t.data.labeloffset),t.data.labelpos){case"l":t.data.x-=t.data.width/2+t.data.labeloffset;break;case"r":t.data.x+=t.data.width/2+t.data.labeloffset}})},nr=t=>{t.getAllEdges().forEach(t=>{var e;t.data.reversed&&(null===(e=t.data.points)||void 0===e||e.reverse())})},or=t=>{t.getAllNodes().forEach(e=>{var r,n,o;if(null===(r=t.getChildren(e.id))||void 0===r?void 0:r.length){const r=t.getNode(e.id),i=t.getNode(r.data.borderTop),s=t.getNode(r.data.borderBottom),a=t.getNode(r.data.borderLeft[(null===(n=r.data.borderLeft)||void 0===n?void 0:n.length)-1]),u=t.getNode(r.data.borderRight[(null===(o=r.data.borderRight)||void 0===o?void 0:o.length)-1]);r.data.width=Math.abs((null==u?void 0:u.data.x)-(null==a?void 0:a.data.x))||10,r.data.height=Math.abs((null==s?void 0:s.data.y)-(null==i?void 0:i.data.y))||10,r.data.x=((null==a?void 0:a.data.x)||0)+r.data.width/2,r.data.y=((null==i?void 0:i.data.y)||0)+r.data.height/2}}),t.getAllNodes().forEach(e=>{"border"===e.data.dummy&&t.removeNode(e.id)})},ir=t=>{t.getAllEdges().forEach(e=>{if(e.source===e.target){const r=t.getNode(e.source);r.data.selfEdges||(r.data.selfEdges=[]),r.data.selfEdges.push(e),t.removeEdge(e.id)}})},sr=t=>{const e=Ct(t);null==e||e.forEach(e=>{let r=0;null==e||e.forEach((e,n)=>{var o;const i=t.getNode(e);i.data.order=n+r,null===(o=i.data.selfEdges)||void 0===o||o.forEach(e=>{At(t,"selfedge",{width:e.data.width,height:e.data.height,rank:i.data.rank,order:n+ ++r,e:e},"_se")}),delete i.data.selfEdges})})},ar=t=>{t.getAllNodes().forEach(e=>{const r=t.getNode(e.id);if("selfedge"===r.data.dummy){const n=t.getNode(r.data.e.source),o=n.data.x+n.data.width/2,i=n.data.y,s=r.data.x-o,a=n.data.height/2;t.hasEdge(r.data.e.id)?t.updateEdgeData(r.data.e.id,r.data.e.data):t.addEdge({id:r.data.e.id,source:r.data.e.source,target:r.data.e.target,data:r.data.e.data}),t.removeNode(e.id),r.data.e.data.points=[{x:o+2*s/3,y:i-a},{x:o+5*s/6,y:i-a},{y:i,x:o+s},{x:o+5*s/6,y:i+a},{x:o+2*s/3,y:i+a}],r.data.e.data.x=r.data.x,r.data.e.data.y=r.data.y}})},ur=(t,e)=>{const r={};return null==e||e.forEach(e=>{void 0!==t[e]&&(r[e]=+t[e])}),r},cr=(t={})=>{const e={};return Object.keys(t).forEach(r=>{e[r.toLowerCase()]=t[r]}),e},hr={nodeSize:10,rankdir:"TB",nodesep:50,ranksep:50,edgeLabelSpace:!0,ranker:"tight-tree",controlPoints:!1,radial:!1,focusNode:null};class lr extends dt{constructor(){super(...arguments),this.id="antv-dagre"}getDefaultOptions(){return hr}layout(t){return r(this,void 0,void 0,function*(){const{nodeSize:e,align:r,rankdir:n="TB",ranksep:o,nodesep:i,edgeLabelSpace:s,ranker:a="tight-tree",nodeOrder:u,begin:c,controlPoints:h,radial:d,sortByCombo:f,preset:g}=t,p=pt(o,hr.ranksep),v=pt(i,hr.nodesep);let m=v,y=p;"LR"!==n&&"RL"!==n||(m=p,y=v);const w=vt(e,hr.nodeSize),x=new yt({tree:[]}),b=this.model.nodes(),E=this.model.edges();b.forEach(t=>{var e;const r=ht(w(t)),n=y(t),o=m(t),i=r[0]+2*o,s=r[1]+2*n,a=null===(e=t.data)||void 0===e?void 0:e.layer;l(a)?x.addNode({id:t.id,data:{width:i,height:s,layer:a,originalWidth:r[0],originalHeight:r[1]}}):x.addNode({id:t.id,data:{width:i,height:s,originalWidth:r[0],originalHeight:r[1]}})}),E.forEach(t=>{x.addEdge({id:t.id,source:t.source,target:t.target,data:{}})}),f&&(x.attachTreeStructure("combo"),b.forEach(t=>{const e=null==t?void 0:t.parentId;void 0!==e&&x.hasNode(e)&&x.setParent(t.id,e,"combo")}));let M=null;(null==g?void 0:g.length)&&(M=new yt,g.forEach(t=>{M.addNode({id:t.id,data:t.data})})),((t,e)=>{const{edgeLabelSpace:r,keepNodeOrder:n,prevGraph:o,rankdir:i,ranksep:s}=e;!n&&o&&Be(t,o);const a=Xe(t);let u;r&&(e.ranksep=Qe(a,{rankdir:i,ranksep:s}));try{u=Ve(a,e)}catch(t){if("Not possible to find intersection inside of the rectangle"===t.message)return void console.error("The following error may be caused by improper layer setting, please make sure your manual layer setting does not violate the graph's structure:\n",t);throw t}$e(t,a)})(x,{prevGraph:M,edgeLabelSpace:s,keepNodeOrder:!!u,nodeOrder:u||[],acyclicer:"greedy",ranker:a,rankdir:n,align:r});const N=[0,0];if(c){let t=1/0,e=1/0;x.getAllNodes().forEach(r=>{t>r.data.x&&(t=r.data.x),e>r.data.y&&(e=r.data.y)}),x.getAllEdges().forEach(r=>{var n;null===(n=r.data.points)||void 0===n||n.forEach(r=>{t>r.x&&(t=r.x),e>r.y&&(e=r.y)})}),N[0]=c[0]-t,N[1]=c[1]-e}const _="LR"===n||"RL"===n;if(d);else{const t=new Set,e="BT"===n||"RL"===n?(t,e)=>e-t:(t,e)=>t-e;x.getAllNodes().forEach(e=>{e.data.x=e.data.x+N[0],e.data.y=e.data.y+N[1],t.add(_?e.data.x:e.data.y)});const r=Array.from(t).sort(e),o=_?(t,e)=>t.x!==e.x:(t,e)=>t.y!==e.y,i=_?(t,e,r)=>{const n=Math.max(e.y,r.y),o=Math.min(e.y,r.y);return t.filter(t=>t.y<=n&&t.y>=o)}:(t,e,r)=>{const n=Math.max(e.x,r.x),o=Math.min(e.x,r.x);return t.filter(t=>t.x<=n&&t.x>=o)};x.getAllEdges().forEach((t,e)=>{var n;s&&h&&"loop"!==t.data.type&&(t.data.controlPoints=dr(null===(n=t.data.points)||void 0===n?void 0:n.map(({x:t,y:e})=>({x:t+N[0],y:e+N[1]})),x.getNode(t.source),x.getNode(t.target),r,_,o,i))})}this.model.forEachNode(t=>{const e=x.getNode(t.id);if(e){const{x:r,y:n,width:o,height:i,originalWidth:s,originalHeight:a}=e.data,u=f?x.getChildren(t.id,"combo"):x.getChildren(t.id);if(u.length>0){let e=1/0,r=-1/0,n=1/0,o=-1/0;u.forEach(t=>{const i=t.id,s=x.getNode(i);if(null==s?void 0:s.data){const t=s.data.x,i=s.data.y,a=s.data.originalWidth||s.data.width||0,u=s.data.originalHeight||s.data.height||0;e=Math.min(e,t-a/2),r=Math.max(r,t+a/2),n=Math.min(n,i-u/2),o=Math.max(o,i+u/2)}});const i=20,s=(r-e||0)+2*i,a=(o-n||0)+2*i;t.x=(e+r)/2,t.y=(n+o)/2,t.size=[s,a]}else t.x=r,t.y=n,t.size=[s,a]}}),this.model.forEachEdge(t=>{const e=x.getEdge(t.id);e&&e.data.controlPoints&&(t.points=e.data.controlPoints.map(ct))})})}}const dr=(t,e,r,n,o,i,s)=>{let a=(null==t?void 0:t.slice(1,t.length-1))||[];if(e&&r){let{x:t,y:u}=e.data,{x:c,y:h}=r.data;if(o&&(t=e.data.y,u=e.data.x,c=r.data.y,h=r.data.x),h!==u&&t!==c){const l=n.indexOf(u),d=n[l+1];if(d){const t=a[0],e=o?{x:(u+d)/2,y:(null==t?void 0:t.y)||c}:{x:(null==t?void 0:t.x)||c,y:(u+d)/2};t&&!i(t,e)||a.unshift(e)}const f=n.indexOf(h),g=Math.abs(f-l);if(1===g)a=s(a,e.data,r.data),a.length||a.push(o?{x:(u+h)/2,y:t}:{x:t,y:(u+h)/2});else if(g>1){const e=n[f-1];if(e){const r=a[a.length-1],n=o?{x:(h+e)/2,y:(null==r?void 0:r.y)||c}:{x:(null==r?void 0:r.x)||t,y:(h+e)/2};r&&!i(r,n)||a.push(n)}}}}return a},fr={radius:null,startRadius:null,endRadius:null,startAngle:0,endAngle:2*Math.PI,clockwise:!0,divisions:1,ordering:null,angleRatio:1,nodeSize:10};class gr extends dt{constructor(){super(...arguments),this.id="circular"}getDefaultOptions(){return fr}layout(){return r(this,void 0,void 0,function*(){const{width:t,height:e,center:r}=lt(this.options),n=this.model.nodeCount();if(!n||1===n)return void H(this.model,r);const{ordering:i,nodeSpacing:s,nodeSize:a,endAngle:u=2*Math.PI,startAngle:c=0,divisions:h,angleRatio:l,clockwise:d}=this.options;"topology"===i?ut(this.model,!1):"topology-directed"===i?ut(this.model,!0):"degree"===i&&it(this.model);let{radius:f,startRadius:g,endRadius:p}=this.options;const v=this.model.nodes(),m=mt(a,s,fr.nodeSize);if(o(s))f||g||p?!g&&p?g=p:g&&!p&&(p=g):f=Math.min(e,t)/2;else{let t=0;for(const e of v)t+=m(e._original);f=t/(2*Math.PI)}const y=(u-c)/n*l,w=Math.ceil(n/h),x=2*Math.PI/h;for(let t=0;t<n;){const e=v[t];let o=f;o||null===g||null===p||(o=g+t*(p-g)/(n-1)),o||(o=10+100*t/(n-1));const i=t%w*y+x*Math.floor(t/w);let s=c+i;d||(s=u-i),e.x=r[0]+Math.cos(s)*o,e.y=r[1]+Math.sin(s)*o,t++}})}}const pr={nodeSize:30,nodeSpacing:10,preventOverlap:!1,sweep:void 0,equidistant:!1,startAngle:1.5*Math.PI,clockwise:!0,maxLevelDiff:void 0,sortBy:"degree"};class vr extends dt{constructor(){super(...arguments),this.id="concentric"}getDefaultOptions(){return pr}layout(){return r(this,void 0,void 0,function*(){const{width:t,height:e,center:r}=lt(this.options),n=this.model.nodeCount();if(!n||1===n)return void H(this.model,r);const{sortBy:o,maxLevelDiff:i,sweep:s,clockwise:a,equidistant:u,preventOverlap:c,startAngle:h=pr.startAngle,nodeSize:l=pr.nodeSize,nodeSpacing:d}=this.options;let f=o;if(o&&"function"==typeof o){"number"!=typeof o(this.model.firstNode()._original)&&(f="degree")}else f="degree";if("degree"===f)it(this.model);else{const t=(t,e)=>{const r=f(t),n=f(e);return r===n?0:r>n?-1:1};at(this.model,t)}const g=this.model.nodes(),p=new Map;for(const t of g){const e="degree"===f?this.model.degree(t.id):null==f?void 0:f(t._original);p.set(t.id,e)}const v=this.model.firstNode(),m=i||p.get(v.id)/4,y=mt(l,d),w=new Map;for(const t of g)w.set(t.id,y(t._original));const x=[{nodes:[]}];let b=x[0];for(let t=0;t<n;t++){const e=g[t];if(b.nodes.length>0){const t=b.nodes[0],r=Math.abs(p.get(t.id)-p.get(e.id));m&&r>=m&&(b={nodes:[]},x.push(b))}b.nodes.push(e)}for(const t of x){const e=t.nodes.map(t=>w.get(t.id));t.nodeSizes=e,t.maxNodeSize=Math.max(...e)}if(x.forEach(t=>{const e=void 0===s?2*Math.PI-2*Math.PI/t.nodes.length:s;t.dTheta=e/Math.max(1,t.nodes.length-1)}),c){let t=0;for(let e=0;e<x.length;e++){const r=x[e];if(r.nodes.length>1){const e=r.nodeSizes||[];let n=0;for(let t=0;t<e.length-1;t++)n=Math.max(n,(e[t]+e[t+1])/2);const o=Math.cos(r.dTheta)-Math.cos(0),i=Math.sin(r.dTheta)-Math.sin(0),s=Math.sqrt(o*o+i*i),a=s>0?n/s:0;t=Math.max(a,t)}if(r.r=t,e<x.length-1){const n=x[e+1],o=((r.maxNodeSize||0)+(n.maxNodeSize||0))/2;t+=Math.max(0,o)}}}else{let r=0;x[0].r=0;for(let t=0;t<x.length-1;t++){const e=x[t],n=x[t+1],o=((e.maxNodeSize||0)+(n.maxNodeSize||0))/2;r+=Math.max(0,o),n.r=r}const n=Math.min(t,e)/2;let o=1;for(const t of x){const e=t.r||0;if(e<=0)continue;const r=n-(t.maxNodeSize||0);if(r<=0){o=0;break}o=Math.min(o,r/e)}if(o=Math.max(0,Math.min(1,o)),1!==o)for(const t of x)t.r=(t.r||0)*o}if(u){let t=0,e=0;for(let r=0;r<x.length;r++){const n=(x[r].r||0)-e;t=Math.max(t,n)}e=0,x.forEach((r,n)=>{0===n&&(e=r.r||0),r.r=e,e+=t})}x.forEach(t=>{const e=t.dTheta||0,n=t.r||0;t.nodes.forEach((t,o)=>{const i=h+(a?1:-1)*e*o;t.x=r[0]+n*Math.cos(i),t.y=r[1]+n*Math.sin(i)})})})}}function mr(t,e,r,n){if(isNaN(e)||isNaN(r))return t;var o,i,s,a,u,c,h,l,d,f=t._root,g={data:n},p=t._x0,v=t._y0,m=t._x1,y=t._y1;if(!f)return t._root=g,t;for(;f.length;)if((c=e>=(i=(p+m)/2))?p=i:m=i,(h=r>=(s=(v+y)/2))?v=s:y=s,o=f,!(f=f[l=h<<1|c]))return o[l]=g,t;if(a=+t._x.call(null,f.data),u=+t._y.call(null,f.data),e===a&&r===u)return g.next=f,o?o[l]=g:t._root=g,t;do{o=o?o[l]=new Array(4):t._root=new Array(4),(c=e>=(i=(p+m)/2))?p=i:m=i,(h=r>=(s=(v+y)/2))?v=s:y=s}while((l=h<<1|c)==(d=(u>=s)<<1|a>=i));return o[d]=f,o[l]=g,t}function yr(t,e,r,n,o){this.node=t,this.x0=e,this.y0=r,this.x1=n,this.y1=o}function wr(t){return t[0]}function xr(t){return t[1]}function br(t,e,r){var n=new Er(null==e?wr:e,null==r?xr:r,NaN,NaN,NaN,NaN);return null==t?n:n.addAll(t)}function Er(t,e,r,n,o,i){this._x=t,this._y=e,this._x0=r,this._y0=n,this._x1=o,this._y1=i,this._root=void 0}function Mr(t){for(var e={data:t.data},r=e;t=t.next;)r=r.next={data:t.data};return e}var Nr=br.prototype=Er.prototype;function _r(t){return function(){return t}}function kr(t){return 1e-6*(t()-.5)}function Sr(t){return t.x+t.vx}function zr(t){return t.y+t.vy}function Ar(t){var e,r,n,o=1,i=1;function s(){for(var t,s,u,c,h,l,d,f=e.length,g=0;g<i;++g)for(s=br(e,Sr,zr).visitAfter(a),t=0;t<f;++t)u=e[t],l=r[u.index],d=l*l,c=u.x+u.vx,h=u.y+u.vy,s.visit(p);function p(t,e,r,i,s){var a=t.data,f=t.r,g=l+f;if(!a)return e>c+g||i<c-g||r>h+g||s<h-g;if(a.index>u.index){var p=c-a.x-a.vx,v=h-a.y-a.vy,m=p*p+v*v;m<g*g&&(0===p&&(m+=(p=kr(n))*p),0===v&&(m+=(v=kr(n))*v),m=(g-(m=Math.sqrt(m)))/m*o,u.vx+=(p*=m)*(g=(f*=f)/(d+f)),u.vy+=(v*=m)*g,a.vx-=p*(g=1-g),a.vy-=v*g)}}}function a(t){if(t.data)return t.r=r[t.data.index];for(var e=t.r=0;e<4;++e)t[e]&&t[e].r>t.r&&(t.r=t[e].r)}function u(){if(e){var n,o,i=e.length;for(r=new Array(i),n=0;n<i;++n)o=e[n],r[o.index]=+t(o,n,e)}}return"function"!=typeof t&&(t=_r(null==t?1:+t)),s.initialize=function(t,r){e=t,n=r,u()},s.iterations=function(t){return arguments.length?(i=+t,s):i},s.strength=function(t){return arguments.length?(o=+t,s):o},s.radius=function(e){return arguments.length?(t="function"==typeof e?e:_r(+e),u(),s):t},s}function Or(t){return t.index}function jr(t,e){var r=t.get(e);if(!r)throw new Error("node not found: "+e);return r}function Cr(t){var e,r,n,o,i,s,a=Or,u=function(t){return 1/Math.min(o[t.source.index],o[t.target.index])},c=_r(30),h=1;function l(n){for(var o=0,a=t.length;o<h;++o)for(var u,c,l,d,f,g,p,v=0;v<a;++v)c=(u=t[v]).source,d=(l=u.target).x+l.vx-c.x-c.vx||kr(s),f=l.y+l.vy-c.y-c.vy||kr(s),d*=g=((g=Math.sqrt(d*d+f*f))-r[v])/g*n*e[v],f*=g,l.vx-=d*(p=i[v]),l.vy-=f*p,c.vx+=d*(p=1-p),c.vy+=f*p}function d(){if(n){var s,u,c=n.length,h=t.length,l=new Map(n.map((t,e)=>[a(t,e,n),t]));for(s=0,o=new Array(c);s<h;++s)(u=t[s]).index=s,"object"!=typeof u.source&&(u.source=jr(l,u.source)),"object"!=typeof u.target&&(u.target=jr(l,u.target)),o[u.source.index]=(o[u.source.index]||0)+1,o[u.target.index]=(o[u.target.index]||0)+1;for(s=0,i=new Array(h);s<h;++s)u=t[s],i[s]=o[u.source.index]/(o[u.source.index]+o[u.target.index]);e=new Array(h),f(),r=new Array(h),g()}}function f(){if(n)for(var r=0,o=t.length;r<o;++r)e[r]=+u(t[r],r,t)}function g(){if(n)for(var e=0,o=t.length;e<o;++e)r[e]=+c(t[e],e,t)}return null==t&&(t=[]),l.initialize=function(t,e){n=t,s=e,d()},l.links=function(e){return arguments.length?(t=e,d(),l):t},l.id=function(t){return arguments.length?(a=t,l):a},l.iterations=function(t){return arguments.length?(h=+t,l):h},l.strength=function(t){return arguments.length?(u="function"==typeof t?t:_r(+t),f(),l):u},l.distance=function(t){return arguments.length?(c="function"==typeof t?t:_r(+t),g(),l):c},l}Nr.copy=function(){var t,e,r=new Er(this._x,this._y,this._x0,this._y0,this._x1,this._y1),n=this._root;if(!n)return r;if(!n.length)return r._root=Mr(n),r;for(t=[{source:n,target:r._root=new Array(4)}];n=t.pop();)for(var o=0;o<4;++o)(e=n.source[o])&&(e.length?t.push({source:e,target:n.target[o]=new Array(4)}):n.target[o]=Mr(e));return r},Nr.add=function(t){const e=+this._x.call(null,t),r=+this._y.call(null,t);return mr(this.cover(e,r),e,r,t)},Nr.addAll=function(t){var e,r,n,o,i=t.length,s=new Array(i),a=new Array(i),u=1/0,c=1/0,h=-1/0,l=-1/0;for(r=0;r<i;++r)isNaN(n=+this._x.call(null,e=t[r]))||isNaN(o=+this._y.call(null,e))||(s[r]=n,a[r]=o,n<u&&(u=n),n>h&&(h=n),o<c&&(c=o),o>l&&(l=o));if(u>h||c>l)return this;for(this.cover(u,c).cover(h,l),r=0;r<i;++r)mr(this,s[r],a[r],t[r]);return this},Nr.cover=function(t,e){if(isNaN(t=+t)||isNaN(e=+e))return this;var r=this._x0,n=this._y0,o=this._x1,i=this._y1;if(isNaN(r))o=(r=Math.floor(t))+1,i=(n=Math.floor(e))+1;else{for(var s,a,u=o-r||1,c=this._root;r>t||t>=o||n>e||e>=i;)switch(a=(e<n)<<1|t<r,(s=new Array(4))[a]=c,c=s,u*=2,a){case 0:o=r+u,i=n+u;break;case 1:r=o-u,i=n+u;break;case 2:o=r+u,n=i-u;break;case 3:r=o-u,n=i-u}this._root&&this._root.length&&(this._root=c)}return this._x0=r,this._y0=n,this._x1=o,this._y1=i,this},Nr.data=function(){var t=[];return this.visit(function(e){if(!e.length)do{t.push(e.data)}while(e=e.next)}),t},Nr.extent=function(t){return arguments.length?this.cover(+t[0][0],+t[0][1]).cover(+t[1][0],+t[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]},Nr.find=function(t,e,r){var n,o,i,s,a,u,c,h=this._x0,l=this._y0,d=this._x1,f=this._y1,g=[],p=this._root;for(p&&g.push(new yr(p,h,l,d,f)),null==r?r=1/0:(h=t-r,l=e-r,d=t+r,f=e+r,r*=r);u=g.pop();)if(!(!(p=u.node)||(o=u.x0)>d||(i=u.y0)>f||(s=u.x1)<h||(a=u.y1)<l))if(p.length){var v=(o+s)/2,m=(i+a)/2;g.push(new yr(p[3],v,m,s,a),new yr(p[2],o,m,v,a),new yr(p[1],v,i,s,m),new yr(p[0],o,i,v,m)),(c=(e>=m)<<1|t>=v)&&(u=g[g.length-1],g[g.length-1]=g[g.length-1-c],g[g.length-1-c]=u)}else{var y=t-+this._x.call(null,p.data),w=e-+this._y.call(null,p.data),x=y*y+w*w;if(x<r){var b=Math.sqrt(r=x);h=t-b,l=e-b,d=t+b,f=e+b,n=p.data}}return n},Nr.remove=function(t){if(isNaN(i=+this._x.call(null,t))||isNaN(s=+this._y.call(null,t)))return this;var e,r,n,o,i,s,a,u,c,h,l,d,f=this._root,g=this._x0,p=this._y0,v=this._x1,m=this._y1;if(!f)return this;if(f.length)for(;;){if((c=i>=(a=(g+v)/2))?g=a:v=a,(h=s>=(u=(p+m)/2))?p=u:m=u,e=f,!(f=f[l=h<<1|c]))return this;if(!f.length)break;(e[l+1&3]||e[l+2&3]||e[l+3&3])&&(r=e,d=l)}for(;f.data!==t;)if(n=f,!(f=f.next))return this;return(o=f.next)&&delete f.next,n?(o?n.next=o:delete n.next,this):e?(o?e[l]=o:delete e[l],(f=e[0]||e[1]||e[2]||e[3])&&f===(e[3]||e[2]||e[1]||e[0])&&!f.length&&(r?r[d]=f:this._root=f),this):(this._root=o,this)},Nr.removeAll=function(t){for(var e=0,r=t.length;e<r;++e)this.remove(t[e]);return this},Nr.root=function(){return this._root},Nr.size=function(){var t=0;return this.visit(function(e){if(!e.length)do{++t}while(e=e.next)}),t},Nr.visit=function(t){var e,r,n,o,i,s,a=[],u=this._root;for(u&&a.push(new yr(u,this._x0,this._y0,this._x1,this._y1));e=a.pop();)if(!t(u=e.node,n=e.x0,o=e.y0,i=e.x1,s=e.y1)&&u.length){var c=(n+i)/2,h=(o+s)/2;(r=u[3])&&a.push(new yr(r,c,h,i,s)),(r=u[2])&&a.push(new yr(r,n,h,c,s)),(r=u[1])&&a.push(new yr(r,c,o,i,h)),(r=u[0])&&a.push(new yr(r,n,o,c,h))}return this},Nr.visitAfter=function(t){var e,r=[],n=[];for(this._root&&r.push(new yr(this._root,this._x0,this._y0,this._x1,this._y1));e=r.pop();){var o=e.node;if(o.length){var i,s=e.x0,a=e.y0,u=e.x1,c=e.y1,h=(s+u)/2,l=(a+c)/2;(i=o[0])&&r.push(new yr(i,s,a,h,l)),(i=o[1])&&r.push(new yr(i,h,a,u,l)),(i=o[2])&&r.push(new yr(i,s,l,h,c)),(i=o[3])&&r.push(new yr(i,h,l,u,c))}n.push(e)}for(;e=n.pop();)t(e.node,e.x0,e.y0,e.x1,e.y1);return this},Nr.x=function(t){return arguments.length?(this._x=t,this):this._x},Nr.y=function(t){return arguments.length?(this._y=t,this):this._y};var Ir={value:()=>{}};function Rr(){for(var t,e=0,r=arguments.length,n={};e<r;++e){if(!(t=arguments[e]+"")||t in n||/[\s.]/.test(t))throw new Error("illegal type: "+t);n[t]=[]}return new Pr(n)}function Pr(t){this._=t}function Tr(t,e){for(var r,n=0,o=t.length;n<o;++n)if((r=t[n]).name===e)return r.value}function Fr(t,e,r){for(var n=0,o=t.length;n<o;++n)if(t[n].name===e){t[n]=Ir,t=t.slice(0,n).concat(t.slice(n+1));break}return null!=r&&t.push({name:e,value:r}),t}Pr.prototype=Rr.prototype={constructor:Pr,on:function(t,e){var r,n,o=this._,i=(n=o,(t+"").trim().split(/^|\s+/).map(function(t){var e="",r=t.indexOf(".");if(r>=0&&(e=t.slice(r+1),t=t.slice(0,r)),t&&!n.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}})),s=-1,a=i.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++s<a;)if(r=(t=i[s]).type)o[r]=Fr(o[r],t.name,e);else if(null==e)for(r in o)o[r]=Fr(o[r],t.name,null);return this}for(;++s<a;)if((r=(t=i[s]).type)&&(r=Tr(o[r],t.name)))return r},copy:function(){var t={},e=this._;for(var r in e)t[r]=e[r].slice();return new Pr(t)},call:function(t,e){if((r=arguments.length-2)>0)for(var r,n,o=new Array(r),i=0;i<r;++i)o[i]=arguments[i+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(i=0,r=(n=this._[t]).length;i<r;++i)n[i].value.apply(e,o)},apply:function(t,e,r){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var n=this._[t],o=0,i=n.length;o<i;++o)n[o].value.apply(e,r)}};var Lr,Dr,qr=0,Vr=0,Br=0,$r=0,Gr=0,Ur=0,Wr="object"==typeof performance&&performance.now?performance:Date,Yr="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function Hr(){return Gr||(Yr(Xr),Gr=Wr.now()+Ur)}function Xr(){Gr=0}function Qr(){this._call=this._time=this._next=null}function Jr(t,e,r){var n=new Qr;return n.restart(t,e,r),n}function Kr(){Gr=($r=Wr.now())+Ur,qr=Vr=0;try{!function(){Hr(),++qr;for(var t,e=Lr;e;)(t=Gr-e._time)>=0&&e._call.call(void 0,t),e=e._next;--qr}()}finally{qr=0,function(){var t,e,r=Lr,n=1/0;for(;r;)r._call?(n>r._time&&(n=r._time),t=r,r=r._next):(e=r._next,r._next=null,r=t?t._next=e:Lr=e);Dr=t,tn(n)}(),Gr=0}}function Zr(){var t=Wr.now(),e=t-$r;e>1e3&&(Ur-=e,$r=t)}function tn(t){qr||(Vr&&(Vr=clearTimeout(Vr)),t-Gr>24?(t<1/0&&(Vr=setTimeout(Kr,t-Wr.now()-Ur)),Br&&(Br=clearInterval(Br))):(Br||($r=Wr.now(),Br=setInterval(Zr,1e3)),qr=1,Yr(Kr)))}Qr.prototype=Jr.prototype={constructor:Qr,restart:function(t,e,r){if("function"!=typeof t)throw new TypeError("callback is not a function");r=(null==r?Hr():+r)+(null==e?0:+e),this._next||Dr===this||(Dr?Dr._next=this:Lr=this,Dr=this),this._call=t,this._time=r,tn()},stop:function(){this._call&&(this._call=null,this._time=1/0,tn())}};const en=4294967296;function rn(t){return t.x}function nn(t){return t.y}var on=Math.PI*(3-Math.sqrt(5));function sn(t){var e,r=1,n=.001,o=1-Math.pow(n,1/300),i=0,s=.6,a=new Map,u=Jr(l),c=Rr("tick","end"),h=function(){let t=1;return()=>(t=(1664525*t+1013904223)%en)/en}();function l(){d(),c.call("tick",e),r<n&&(u.stop(),c.call("end",e))}function d(n){var u,c,h=t.length;void 0===n&&(n=1);for(var l=0;l<n;++l)for(r+=(i-r)*o,a.forEach(function(t){t(r)}),u=0;u<h;++u)null==(c=t[u]).fx?c.x+=c.vx*=s:(c.x=c.fx,c.vx=0),null==c.fy?c.y+=c.vy*=s:(c.y=c.fy,c.vy=0);return e}function f(){for(var e,r=0,n=t.length;r<n;++r){if((e=t[r]).index=r,null!=e.fx&&(e.x=e.fx),null!=e.fy&&(e.y=e.fy),isNaN(e.x)||isNaN(e.y)){var o=10*Math.sqrt(.5+r),i=r*on;e.x=o*Math.cos(i),e.y=o*Math.sin(i)}(isNaN(e.vx)||isNaN(e.vy))&&(e.vx=e.vy=0)}}function g(e){return e.initialize&&e.initialize(t,h),e}return null==t&&(t=[]),f(),e={tick:d,restart:function(){return u.restart(l),e},stop:function(){return u.stop(),e},nodes:function(r){return arguments.length?(t=r,f(),a.forEach(g),e):t},alpha:function(t){return arguments.length?(r=+t,e):r},alphaMin:function(t){return arguments.length?(n=+t,e):n},alphaDecay:function(t){return arguments.length?(o=+t,e):+o},alphaTarget:function(t){return arguments.length?(i=+t,e):i},velocityDecay:function(t){return arguments.length?(s=1-t,e):1-s},randomSource:function(t){return arguments.length?(h=t,a.forEach(g),e):h},force:function(t,r){return arguments.length>1?(null==r?a.delete(t):a.set(t,g(r)),e):a.get(t)},find:function(e,r,n){var o,i,s,a,u,c=0,h=t.length;for(null==n?n=1/0:n*=n,c=0;c<h;++c)(s=(o=e-(a=t[c]).x)*o+(i=r-a.y)*i)<n&&(u=a,n=s);return u},on:function(t,r){return arguments.length>1?(c.on(t,r),e):c.on(t)}}}function an(){var t,e,r,n,o,i=_r(-30),s=1,a=1/0,u=.81;function c(r){var o,i=t.length,s=br(t,rn,nn).visitAfter(l);for(n=r,o=0;o<i;++o)e=t[o],s.visit(d)}function h(){if(t){var e,r,n=t.length;for(o=new Array(n),e=0;e<n;++e)r=t[e],o[r.index]=+i(r,e,t)}}function l(t){var e,r,n,i,s,a=0,u=0;if(t.length){for(n=i=s=0;s<4;++s)(e=t[s])&&(r=Math.abs(e.value))&&(a+=e.value,u+=r,n+=r*e.x,i+=r*e.y);t.x=n/u,t.y=i/u}else{(e=t).x=e.data.x,e.y=e.data.y;do{a+=o[e.data.index]}while(e=e.next)}t.value=a}function d(t,i,c,h){if(!t.value)return!0;var l=t.x-e.x,d=t.y-e.y,f=h-i,g=l*l+d*d;if(f*f/u<g)return g<a&&(0===l&&(g+=(l=kr(r))*l),0===d&&(g+=(d=kr(r))*d),g<s&&(g=Math.sqrt(s*g)),e.vx+=l*t.value*n/g,e.vy+=d*t.value*n/g),!0;if(!(t.length||g>=a)){(t.data!==e||t.next)&&(0===l&&(g+=(l=kr(r))*l),0===d&&(g+=(d=kr(r))*d),g<s&&(g=Math.sqrt(s*g)));do{t.data!==e&&(f=o[t.data.index]*n/g,e.vx+=l*f,e.vy+=d*f)}while(t=t.next)}}return c.initialize=function(e,n){t=e,r=n,h()},c.strength=function(t){return arguments.length?(i="function"==typeof t?t:_r(+t),h(),c):i},c.distanceMin=function(t){return arguments.length?(s=t*t,c):Math.sqrt(s)},c.distanceMax=function(t){return arguments.length?(a=t*t,c):Math.sqrt(a)},c.theta=function(t){return arguments.length?(u=t*t,c):Math.sqrt(u)},c}function un(t){var e,r,n,o=_r(.1);function i(t){for(var o,i=0,s=e.length;i<s;++i)(o=e[i]).vx+=(n[i]-o.x)*r[i]*t}function s(){if(e){var i,s=e.length;for(r=new Array(s),n=new Array(s),i=0;i<s;++i)r[i]=isNaN(n[i]=+t(e[i],i,e))?0:+o(e[i],i,e)}}return"function"!=typeof t&&(t=_r(null==t?0:+t)),i.initialize=function(t){e=t,s()},i.strength=function(t){return arguments.length?(o="function"==typeof t?t:_r(+t),s(),i):o},i.x=function(e){return arguments.length?(t="function"==typeof e?e:_r(+e),s(),i):t},i}function cn(t){var e,r,n,o=_r(.1);function i(t){for(var o,i=0,s=e.length;i<s;++i)(o=e[i]).vy+=(n[i]-o.y)*r[i]*t}function s(){if(e){var i,s=e.length;for(r=new Array(s),n=new Array(s),i=0;i<s;++i)r[i]=isNaN(n[i]=+t(e[i],i,e))?0:+o(e[i],i,e)}}return"function"!=typeof t&&(t=_r(null==t?0:+t)),i.initialize=function(t){e=t,s()},i.strength=function(t){return arguments.length?(o="function"==typeof t?t:_r(+t),s(),i):o},i.y=function(e){return arguments.length?(t="function"==typeof e?e:_r(+e),s(),i):t},i}const hn=(t,e)=>t[e];function ln(){function t(t){return()=>t}let e,r=t=>t.cluster,n=t(1),o=t(-1),i=t(100),s=t(.1),a=[0,0],u=[],c={},h=[],l=100,d=100,f={none:{x:0,y:0}},g=[],p="force",v=!0,m=.1;function y(t){if(!v)return y;e.tick(),x();for(let e,n=0,o=u.length,i=t*m;n<o;++n)e=u[n],e.vx||(e.vx=0),e.vy||(e.vy=0),e.vx+=(f[r(e._original)].x-e.x)*i,e.vy+=(f[r(e._original)].y-e.y)*i}function w(){u&&function(){if(!u||!u.length)return;const t=u[0];if(void 0===r(t._original))throw Error("Couldnt find the grouping attribute for the nodes. Make sure to set it up with forceInABox.groupBy('clusterAttr') before calling .links()");const a=function(){const t=[],e=[],o={};let i=[],s={},a=[];return s=function(t){const e={};return t.forEach(t=>{const n=r(t._original);e[n]||(e[n]={count:0,sumforceNodeSize:0})}),t.forEach(t=>{const o=r(t._original),i=n(t._original),s=e[o];s.count=s.count+1,s.sumforceNodeSize=s.sumforceNodeSize+Math.PI*(i*i)*1.3,e[o]=s}),e}(u),a=function(t){const e={},n=[];t.forEach(t=>{const n=function(t){const e=hn(t,"source"),n=hn(t,"target"),o=r(c[e]._original),i=r(c[n]._original);return o<=i?`${o}~${i}`:`${i}~${o}`}(t);let o=0;void 0!==e[n]&&(o=e[n]),o+=1,e[n]=o});return Object.entries(e).forEach(([t,e])=>{const r=t.split("~")[0],o=t.split("~")[1];void 0!==r&&void 0!==o&&n.push({source:r,target:o,count:e})}),n}(h),i=Object.keys(s),i.forEach((e,r)=>{const n=s[e];t.push({id:e,size:n.count,r:Math.sqrt(n.sumforceNodeSize/Math.PI)}),o[e]=r}),a.forEach(t=>{const r=hn(t,"source"),n=hn(t,"target"),i=o[r],s=o[n];void 0!==i&&void 0!==s&&e.push({source:i,target:s,count:t.count})}),{nodes:t,links:e}}();e=sn(a.nodes).force("x",un(l).strength(.1)).force("y",cn(d).strength(.1)).force("collide",Ar(t=>t.r).iterations(4)).force("charge",an().strength(o)).force("links",Cr(a.nodes.length?a.links:[]).distance(i).strength(s)),g=e.nodes(),x()}()}function x(){return f={none:{x:0,y:0}},g.forEach(t=>{f[t.id]={x:t.x-a[0],y:t.y-a[1]}}),f}return y.initialize=t=>{u=t,w()},y.template=function(t){return arguments.length?(p=t,w(),y):p},y.groupBy=function(t){return arguments.length?"string"==typeof t?(r=e=>e[t],y):(r=t,y):r},y.enableGrouping=function(t){return arguments.length?(v=t,y):v},y.strength=function(t){return arguments.length?(m=t,y):m},y.centerX=function(t){return arguments.length?(l=t,y):l},y.centerY=function(t){return arguments.length?(d=t,y):d},y.nodes=function(t){return arguments.length?(function(t){c={},t.forEach(t=>{c[t.id]=t})}(t||[]),u=t||[],y):u},y.links=function(t){return arguments.length?(h=t||[],w(),y):h},y.forceNodeSize=function(e){return arguments.length?(n="function"==typeof e?e:t(+e),w(),y):n},y.nodeSize=y.forceNodeSize,y.forceCharge=function(e){return arguments.length?(o="function"==typeof e?e:t(+e),w(),y):o},y.forceLinkDistance=function(e){return arguments.length?(i="function"==typeof e?e:t(+e),w(),y):i},y.forceLinkStrength=function(e){return arguments.length?(s="function"==typeof e?e:t(+e),w(),y):s},y.offset=function(t){return arguments.length?(a=t,y):a},y.getFocis=x,y}const dn={centerStrength:1,edgeId:t=>String(t.id),linkDistance:30,edgeStrength:void 0,edgeIterations:1,preventOverlap:!1,nodeSize:10,nodeSpacing:0,collideStrength:1,collideIterations:1,nodeStrength:-30,distanceMin:void 0,distanceMax:void 0,theta:void 0,alpha:1,alphaMin:.001,alphaDecay:1-Math.pow(.001,1/300),alphaTarget:0,velocityDecay:.4,clustering:!1,clusterNodeStrength:-1,clusterEdgeStrength:.1,clusterEdgeDistance:100,clusterFociStrength:.8,clusterNodeSize:10};class fn extends ft{getDefaultOptions(){return dn}mergeOptions(t,e){return function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];for(var n=0;n<e.length;n+=1)v(t,e[n]);return t}({},t,e)}constructor(t){super(t),this.id="d3-force",this.d3Nodes=[],this.d3Edges=[],this.config={simulationAttrs:["alpha","alphaMin","alphaDecay","alphaTarget","velocityDecay","randomSource"]},this.options.forceSimulation&&(this.simulation=this.options.forceSimulation)}stop(){return this.simulation&&this.simulation.stop(),this}tick(t=1){var e,r;if(this.simulation){for(let e=0;e<t;e++)this.simulation.tick();this.syncPositionsFromD3(),null===(r=(e=this.options).onTick)||void 0===r||r.call(e,this)}return this}restart(t){return this.simulation&&(void 0!==t&&this.simulation.alpha(t),this.simulation.restart()),this}reheat(){return this.restart(1)}getAlpha(){var t,e;return null!==(e=null===(t=this.simulation)||void 0===t?void 0:t.alpha())&&void 0!==e?e:0}setAlpha(t){return this.simulation&&this.simulation.alpha(t),this}getForce(t){var e;return null===(e=this.simulation)||void 0===e?void 0:e.force(t)}force(t,e){return this.simulation&&this.simulation.force(t,e),this}nodes(){var t,e;return null!==(e=null===(t=this.simulation)||void 0===t?void 0:t.nodes())&&void 0!==e?e:[]}find(t,e,r){if(this.simulation)return this.simulation.find(t,e,r)}setFixedPosition(t,e){const r=this.d3Nodes.find(e=>e.id===t),n=this.model.node(t);if(!n||!r)return;const o=["fx","fy","fz"];null!==e?e.forEach((t,e)=>{e<o.length&&("number"==typeof t||null===t)&&(n[o[e]]=t,r[o[e]]=t)}):o.forEach(t=>{delete n[t],delete r[t]})}parseOptions(t){var e,r;const n=t;return n.collide&&void 0===(null===(e=n.collide)||void 0===e?void 0:e.radius)&&(n.collide=n.collide||{},n.collide.radius=null!==(r=n.nodeSize)&&void 0!==r?r:10),void 0===n.iterations&&(n.link&&void 0===n.link.iterations&&(n.iterations=n.link.iterations),n.collide&&void 0===n.collide.iterations&&(n.iterations=n.collide.iterations)),n}layout(){var t;return r(this,void 0,void 0,function*(){const e=this.parseOptions(this.options||{});this.createD3Copies();const r=this.setSimulation(e);return r.nodes(this.d3Nodes),null===(t=r.force("link"))||void 0===t||t.links(this.d3Edges),new Promise(t=>{r.on("end",()=>{this.syncPositionsFromD3(),t()})})})}createD3Copies(){this.d3Nodes=[],this.d3Edges=[],this.model.forEachNode(t=>{this.d3Nodes.push(Object.assign({},t))}),this.model.forEachEdge(t=>{this.d3Edges.push(Object.assign({},t))})}syncPositionsFromD3(){this.d3Nodes.forEach(t=>{const e=this.model.node(t.id);e&&(e.x=t.x,e.y=t.y,void 0!==t.z&&(e.z=t.z),void 0!==t.fx&&(e.fx=t.fx),void 0!==t.fy&&(e.fy=t.fy),void 0!==t.fz&&(e.fz=t.fz),void 0!==t.vx&&(e.vx=t.vx),void 0!==t.vy&&(e.vy=t.vy),void 0!==t.vz&&(e.vz=t.vz))})}initSimulation(){return sn()}setSimulation(t){const e=this.simulation||this.options.forceSimulation||this.initSimulation();return this.simulation||(this.simulation=e.on("tick",()=>{var e;this.syncPositionsFromD3(),null===(e=t.onTick)||void 0===e||e.call(t,this)})),gn(e,this.config.simulationAttrs.map(e=>[e,t[e]])),this.setupForces(e,t),e}setupForces(t,e){this.setupLinkForce(t,e),this.setupManyBodyForce(t,e),this.setupCenterForce(t,e),this.setupCollisionForce(t,e),this.setupXForce(t,e),this.setupYForce(t,e),this.setupRadialForce(t,e),this.setupClusterForce(t,e)}getCenterOptions(t){if(!t.width||!t.height||void 0!==t.centerStrength){const e=lt({width:t.width,height:t.height});return rt({},t.center||{},{x:e.width/2,y:e.height/2,strength:t.centerStrength})}}setupCenterForce(t,e){const r=this.getCenterOptions(e);if(r){let e=t.force("center");e||(e=function(t,e){var r,n=1;function o(){var o,i,s=r.length,a=0,u=0;for(o=0;o<s;++o)a+=(i=r[o]).x,u+=i.y;for(a=(a/s-t)*n,u=(u/s-e)*n,o=0;o<s;++o)(i=r[o]).x-=a,i.y-=u}return null==t&&(t=0),null==e&&(e=0),o.initialize=function(t){r=t},o.x=function(e){return arguments.length?(t=+e,o):t},o.y=function(t){return arguments.length?(e=+t,o):e},o.strength=function(t){return arguments.length?(n=+t,o):n},o}(r.x,r.y),t.force("center",e));const n=[];void 0!==r.x&&n.push(["x",r.x]),void 0!==r.y&&n.push(["y",r.y]),void 0!==r.strength&&n.push(["strength",r.strength]),gn(e,n)}else t.force("center",null)}getManyBodyOptions(t){if(void 0!==t.manyBody||void 0!==t.nodeStrength||void 0!==t.distanceMin||void 0!==t.distanceMax||void 0!==t.theta)return rt({},t.manyBody||{},{strength:t.nodeStrength,distanceMin:t.distanceMin,distanceMax:t.distanceMax,theta:t.theta})}setupManyBodyForce(t,e){const r=this.getManyBodyOptions(e);if(r){let e=t.force("charge");e||(e=an(),t.force("charge",e));const n=[];void 0!==r.strength&&n.push(["strength",r.strength]),void 0!==r.distanceMin&&n.push(["distanceMin",r.distanceMin]),void 0!==r.distanceMax&&n.push(["distanceMax",r.distanceMax]),void 0!==r.theta&&n.push(["theta",r.theta]),gn(e,n)}else t.force("charge",null)}getLinkOptions(t){if(t.link||void 0!==t.edgeId||void 0!==t.linkDistance||void 0!==t.edgeStrength||void 0!==t.edgeIterations)return rt({},t.link||{},{id:t.edgeId,distance:t.linkDistance,strength:t.edgeStrength,iterations:t.edgeIterations})}setupLinkForce(t,e){const r=this.model.edges(),n=this.getLinkOptions(e);if(r.length>0&&n){let e=t.force("link");e||(e=Cr(),t.force("link",e));const r=[];void 0!==n.id&&r.push(["id",n.id]),void 0!==n.distance&&r.push(["distance",n.distance]),void 0!==n.strength&&r.push(["strength",n.strength]),void 0!==n.iterations&&r.push(["iterations",n.iterations]),gn(e,r)}else t.force("link",null)}getCollisionOptions(t){if(t.preventOverlap&&(void 0!==t.collide||void 0!==t.nodeSize||void 0!==t.nodeSpacing||void 0!==t.collideStrength||void 0!==t.collideIterations)){const e=t.nodeSize||t.nodeSpacing?e=>mt(t.nodeSize,t.nodeSpacing)(e._original)/2:void 0;return rt({},t.collide||{},{radius:e,strength:t.collideStrength,iterations:t.collideIterations})}}setupCollisionForce(t,e){const r=this.getCollisionOptions(e);if(r){let e=t.force("collide");e||(e=Ar(),t.force("collide",e));const n=[];void 0!==r.radius&&n.push(["radius",r.radius]),void 0!==r.strength&&n.push(["strength",r.strength]),void 0!==r.iterations&&n.push(["iterations",r.iterations]),gn(e,n)}else t.force("collide",null)}getXForceOptions(t){var e;if(void 0!==t.x||void 0!==t.forceXPosition||void 0!==t.forceXStrength||void 0!==t.width||void 0!==t.height){const r=this.getCenterOptions(t);return rt({},t.x||{},{x:null!==(e=t.forceXPosition)&&void 0!==e?e:r&&r.x,strength:t.forceXStrength})}}setupXForce(t,e){const r=this.getXForceOptions(e);if(r){let e=t.force("x");e||(e=un(),t.force("x",e));const n=[];void 0!==r.x&&n.push(["x",r.x]),void 0!==r.strength&&n.push(["strength",r.strength]),gn(e,n)}else t.force("x",null)}getYForceOptions(t){var e;if(void 0!==t.y||void 0!==t.forceYPosition||void 0!==t.forceYStrength||void 0!==t.width||void 0!==t.height){const r=this.getCenterOptions(t);return rt({},t.y||{},{y:null!==(e=t.forceYPosition)&&void 0!==e?e:r&&r.y,strength:t.forceYStrength})}}setupYForce(t,e){const r=this.getYForceOptions(e);if(r){let e=t.force("y");e||(e=cn(),t.force("y",e));const n=[];void 0!==r.y&&n.push(["y",r.y]),void 0!==r.strength&&n.push(["strength",r.strength]),gn(e,n)}else t.force("y",null)}getRadialOptions(t){var e,r,n;if(void 0!==t.radial||void 0!==t.radialStrength||void 0!==t.radialRadius||void 0!==t.radialX||void 0!==t.radialY){const o=this.getCenterOptions(t);return rt({},t.radial||{},{strength:t.radialStrength,radius:null!==(e=t.radialRadius)&&void 0!==e?e:100,x:null!==(r=t.radialX)&&void 0!==r?r:o&&o.x,y:null!==(n=t.radialY)&&void 0!==n?n:o&&o.y})}}setupRadialForce(t,e){const r=this.getRadialOptions(e);if(r){let e=t.force("radial");e||(e=function(t,e,r){var n,o,i,s=_r(.1);function a(t){for(var s=0,a=n.length;s<a;++s){var u=n[s],c=u.x-e||1e-6,h=u.y-r||1e-6,l=Math.sqrt(c*c+h*h),d=(i[s]-l)*o[s]*t/l;u.vx+=c*d,u.vy+=h*d}}function u(){if(n){var e,r=n.length;for(o=new Array(r),i=new Array(r),e=0;e<r;++e)i[e]=+t(n[e],e,n),o[e]=isNaN(i[e])?0:+s(n[e],e,n)}}return"function"!=typeof t&&(t=_r(+t)),null==e&&(e=0),null==r&&(r=0),a.initialize=function(t){n=t,u()},a.strength=function(t){return arguments.length?(s="function"==typeof t?t:_r(+t),u(),a):s},a.radius=function(e){return arguments.length?(t="function"==typeof e?e:_r(+e),u(),a):t},a.x=function(t){return arguments.length?(e=+t,a):e},a.y=function(t){return arguments.length?(r=+t,a):r},a}(r.radius||100,r.x,r.y),t.force("radial",e));const n=[];void 0!==r.radius&&n.push(["radius",r.radius]),void 0!==r.strength&&n.push(["strength",r.strength]),void 0!==r.x&&n.push(["x",r.x]),void 0!==r.y&&n.push(["y",r.y]),gn(e,n)}else t.force("radial",null)}setupClusterForce(t,e){const{clustering:r}=e;if(r){const{clusterFociStrength:r,clusterEdgeDistance:n,clusterEdgeStrength:o,clusterNodeStrength:i,clusterNodeSize:s,clusterBy:a}=e,u=this.getCenterOptions(e);let c=t.force("group");c||(c=ln(),t.force("group",c)),gn(c,[["centerX",u&&u.x],["centerY",u&&u.y],["template","force"],["strength",r],["groupBy",a],["nodes",this.model.nodes()],["links",this.model.edges()],["forceLinkDistance",n],["forceLinkStrength",o],["forceCharge",i],["forceNodeSize",s]])}else t.force("group",null)}}const gn=(t,e)=>e.reduce((e,[r,n])=>e[r]&&void 0!==n?e[r].call(t,n):e,t);function pn(t,e,r){var n,o=1;function i(){var i,s,a=n.length,u=0,c=0,h=0;for(i=0;i<a;++i)u+=(s=n[i]).x||0,c+=s.y||0,h+=s.z||0;for(u=(u/a-t)*o,c=(c/a-e)*o,h=(h/a-r)*o,i=0;i<a;++i)s=n[i],u&&(s.x-=u),c&&(s.y-=c),h&&(s.z-=h)}return null==t&&(t=0),null==e&&(e=0),null==r&&(r=0),i.initialize=function(t){n=t},i.x=function(e){return arguments.length?(t=+e,i):t},i.y=function(t){return arguments.length?(e=+t,i):e},i.z=function(t){return arguments.length?(r=+t,i):r},i.strength=function(t){return arguments.length?(o=+t,i):o},i}function vn(t,e,r){if(isNaN(e))return t;var n,o,i,s,a,u,c=t._root,h={data:r},l=t._x0,d=t._x1;if(!c)return t._root=h,t;for(;c.length;)if((s=e>=(o=(l+d)/2))?l=o:d=o,n=c,!(c=c[a=+s]))return n[a]=h,t;if(e===(i=+t._x.call(null,c.data)))return h.next=c,n?n[a]=h:t._root=h,t;do{n=n?n[a]=new Array(2):t._root=new Array(2),(s=e>=(o=(l+d)/2))?l=o:d=o}while((a=+s)===(u=+(i>=o)));return n[u]=c,n[a]=h,t}function mn(t,e,r){this.node=t,this.x0=e,this.x1=r}function yn(t){return t[0]}function wn(t,e){var r=new xn(null==e?yn:e,NaN,NaN);return null==t?r:r.addAll(t)}function xn(t,e,r){this._x=t,this._x0=e,this._x1=r,this._root=void 0}function bn(t){for(var e={data:t.data},r=e;t=t.next;)r=r.next={data:t.data};return e}var En=wn.prototype=xn.prototype;function Mn(t,e,r,n,o){if(isNaN(e)||isNaN(r)||isNaN(n))return t;var i,s,a,u,c,h,l,d,f,g,p,v,m=t._root,y={data:o},w=t._x0,x=t._y0,b=t._z0,E=t._x1,M=t._y1,N=t._z1;if(!m)return t._root=y,t;for(;m.length;)if((d=e>=(s=(w+E)/2))?w=s:E=s,(f=r>=(a=(x+M)/2))?x=a:M=a,(g=n>=(u=(b+N)/2))?b=u:N=u,i=m,!(m=m[p=g<<2|f<<1|d]))return i[p]=y,t;if(c=+t._x.call(null,m.data),h=+t._y.call(null,m.data),l=+t._z.call(null,m.data),e===c&&r===h&&n===l)return y.next=m,i?i[p]=y:t._root=y,t;do{i=i?i[p]=new Array(8):t._root=new Array(8),(d=e>=(s=(w+E)/2))?w=s:E=s,(f=r>=(a=(x+M)/2))?x=a:M=a,(g=n>=(u=(b+N)/2))?b=u:N=u}while((p=g<<2|f<<1|d)==(v=(l>=u)<<2|(h>=a)<<1|c>=s));return i[v]=m,i[p]=y,t}function Nn(t,e,r,n,o,i,s){this.node=t,this.x0=e,this.y0=r,this.z0=n,this.x1=o,this.y1=i,this.z1=s}En.copy=function(){var t,e,r=new xn(this._x,this._x0,this._x1),n=this._root;if(!n)return r;if(!n.length)return r._root=bn(n),r;for(t=[{source:n,target:r._root=new Array(2)}];n=t.pop();)for(var o=0;o<2;++o)(e=n.source[o])&&(e.length?t.push({source:e,target:n.target[o]=new Array(2)}):n.target[o]=bn(e));return r},En.add=function(t){const e=+this._x.call(null,t);return vn(this.cover(e),e,t)},En.addAll=function(t){Array.isArray(t)||(t=Array.from(t));const e=t.length,r=new Float64Array(e);let n=1/0,o=-1/0;for(let i,s=0;s<e;++s)isNaN(i=+this._x.call(null,t[s]))||(r[s]=i,i<n&&(n=i),i>o&&(o=i));if(n>o)return this;this.cover(n).cover(o);for(let n=0;n<e;++n)vn(this,r[n],t[n]);return this},En.cover=function(t){if(isNaN(t=+t))return this;var e=this._x0,r=this._x1;if(isNaN(e))r=(e=Math.floor(t))+1;else{for(var n,o,i=r-e||1,s=this._root;e>t||t>=r;)switch(o=+(t<e),(n=new Array(2))[o]=s,s=n,i*=2,o){case 0:r=e+i;break;case 1:e=r-i}this._root&&this._root.length&&(this._root=s)}return this._x0=e,this._x1=r,this},En.data=function(){var t=[];return this.visit(function(e){if(!e.length)do{t.push(e.data)}while(e=e.next)}),t},En.extent=function(t){return arguments.length?this.cover(+t[0][0]).cover(+t[1][0]):isNaN(this._x0)?void 0:[[this._x0],[this._x1]]},En.find=function(t,e){var r,n,o,i,s,a=this._x0,u=this._x1,c=[],h=this._root;for(h&&c.push(new mn(h,a,u)),null==e?e=1/0:(a=t-e,u=t+e);i=c.pop();)if(!(!(h=i.node)||(n=i.x0)>u||(o=i.x1)<a))if(h.length){var l=(n+o)/2;c.push(new mn(h[1],l,o),new mn(h[0],n,l)),(s=+(t>=l))&&(i=c[c.length-1],c[c.length-1]=c[c.length-1-s],c[c.length-1-s]=i)}else{var d=Math.abs(t-+this._x.call(null,h.data));d<e&&(e=d,a=t-d,u=t+d,r=h.data)}return r},En.remove=function(t){if(isNaN(i=+this._x.call(null,t)))return this;var e,r,n,o,i,s,a,u,c,h=this._root,l=this._x0,d=this._x1;if(!h)return this;if(h.length)for(;;){if((a=i>=(s=(l+d)/2))?l=s:d=s,e=h,!(h=h[u=+a]))return this;if(!h.length)break;e[u+1&1]&&(r=e,c=u)}for(;h.data!==t;)if(n=h,!(h=h.next))return this;return(o=h.next)&&delete h.next,n?(o?n.next=o:delete n.next,this):e?(o?e[u]=o:delete e[u],(h=e[0]||e[1])&&h===(e[1]||e[0])&&!h.length&&(r?r[c]=h:this._root=h),this):(this._root=o,this)},En.removeAll=function(t){for(var e=0,r=t.length;e<r;++e)this.remove(t[e]);return this},En.root=function(){return this._root},En.size=function(){var t=0;return this.visit(function(e){if(!e.length)do{++t}while(e=e.next)}),t},En.visit=function(t){var e,r,n,o,i=[],s=this._root;for(s&&i.push(new mn(s,this._x0,this._x1));e=i.pop();)if(!t(s=e.node,n=e.x0,o=e.x1)&&s.length){var a=(n+o)/2;(r=s[1])&&i.push(new mn(r,a,o)),(r=s[0])&&i.push(new mn(r,n,a))}return this},En.visitAfter=function(t){var e,r=[],n=[];for(this._root&&r.push(new mn(this._root,this._x0,this._x1));e=r.pop();){var o=e.node;if(o.length){var i,s=e.x0,a=e.x1,u=(s+a)/2;(i=o[0])&&r.push(new mn(i,s,u)),(i=o[1])&&r.push(new mn(i,u,a))}n.push(e)}for(;e=n.pop();)t(e.node,e.x0,e.x1);return this},En.x=function(t){return arguments.length?(this._x=t,this):this._x};const _n=(t,e,r,n,o,i)=>Math.sqrt((t-n)**2+(e-o)**2+(r-i)**2);function kn(t){return t[0]}function Sn(t){return t[1]}function zn(t){return t[2]}function An(t,e,r,n){var o=new On(null==e?kn:e,null==r?Sn:r,null==n?zn:n,NaN,NaN,NaN,NaN,NaN,NaN);return null==t?o:o.addAll(t)}function On(t,e,r,n,o,i,s,a,u){this._x=t,this._y=e,this._z=r,this._x0=n,this._y0=o,this._z0=i,this._x1=s,this._y1=a,this._z1=u,this._root=void 0}function jn(t){for(var e={data:t.data},r=e;t=t.next;)r=r.next={data:t.data};return e}var Cn=An.prototype=On.prototype;function In(t){return function(){return t}}function Rn(t){return 1e-6*(t()-.5)}function Pn(t){return t.x+t.vx}function Tn(t){return t.y+t.vy}function Fn(t){return t.z+t.vz}function Ln(t){var e,r,n,o,i=1,s=1;function a(){for(var t,a,c,h,l,d,f,g,p=e.length,v=0;v<s;++v)for(a=(1===r?wn(e,Pn):2===r?br(e,Pn,Tn):3===r?An(e,Pn,Tn,Fn):null).visitAfter(u),t=0;t<p;++t)c=e[t],f=n[c.index],g=f*f,h=c.x+c.vx,r>1&&(l=c.y+c.vy),r>2&&(d=c.z+c.vz),a.visit(m);function m(t,e,n,s,a,u,p){var v=[e,n,s,a,u,p],m=v[0],y=v[1],w=v[2],x=v[r],b=v[r+1],E=v[r+2],M=t.data,N=t.r,_=f+N;if(!M)return m>h+_||x<h-_||r>1&&(y>l+_||b<l-_)||r>2&&(w>d+_||E<d-_);if(M.index>c.index){var k=h-M.x-M.vx,S=r>1?l-M.y-M.vy:0,z=r>2?d-M.z-M.vz:0,A=k*k+S*S+z*z;A<_*_&&(0===k&&(A+=(k=Rn(o))*k),r>1&&0===S&&(A+=(S=Rn(o))*S),r>2&&0===z&&(A+=(z=Rn(o))*z),A=(_-(A=Math.sqrt(A)))/A*i,c.vx+=(k*=A)*(_=(N*=N)/(g+N)),r>1&&(c.vy+=(S*=A)*_),r>2&&(c.vz+=(z*=A)*_),M.vx-=k*(_=1-_),r>1&&(M.vy-=S*_),r>2&&(M.vz-=z*_))}}}function u(t){if(t.data)return t.r=n[t.data.index];for(var e=t.r=0;e<Math.pow(2,r);++e)t[e]&&t[e].r>t.r&&(t.r=t[e].r)}function c(){if(e){var r,o,i=e.length;for(n=new Array(i),r=0;r<i;++r)o=e[r],n[o.index]=+t(o,r,e)}}return"function"!=typeof t&&(t=In(null==t?1:+t)),a.initialize=function(t,...n){e=t,o=n.find(t=>"function"==typeof t)||Math.random,r=n.find(t=>[1,2,3].includes(t))||2,c()},a.iterations=function(t){return arguments.length?(s=+t,a):s},a.strength=function(t){return arguments.length?(i=+t,a):i},a.radius=function(e){return arguments.length?(t="function"==typeof e?e:In(+e),c(),a):t},a}function Dn(t){return t.index}function qn(t,e){var r=t.get(e);if(!r)throw new Error("node not found: "+e);return r}function Vn(t){var e,r,n,o,i,s,a,u=Dn,c=function(t){return 1/Math.min(i[t.source.index],i[t.target.index])},h=In(30),l=1;function d(n){for(var i=0,u=t.length;i<l;++i)for(var c,h,d,f,g,p=0,v=0,m=0,y=0;p<u;++p)h=(c=t[p]).source,v=(d=c.target).x+d.vx-h.x-h.vx||Rn(a),o>1&&(m=d.y+d.vy-h.y-h.vy||Rn(a)),o>2&&(y=d.z+d.vz-h.z-h.vz||Rn(a)),v*=f=((f=Math.sqrt(v*v+m*m+y*y))-r[p])/f*n*e[p],m*=f,y*=f,d.vx-=v*(g=s[p]),o>1&&(d.vy-=m*g),o>2&&(d.vz-=y*g),h.vx+=v*(g=1-g),o>1&&(h.vy+=m*g),o>2&&(h.vz+=y*g)}function f(){if(n){var o,a,c=n.length,h=t.length,l=new Map(n.map((t,e)=>[u(t,e,n),t]));for(o=0,i=new Array(c);o<h;++o)(a=t[o]).index=o,"object"!=typeof a.source&&(a.source=qn(l,a.source)),"object"!=typeof a.target&&(a.target=qn(l,a.target)),i[a.source.index]=(i[a.source.index]||0)+1,i[a.target.index]=(i[a.target.index]||0)+1;for(o=0,s=new Array(h);o<h;++o)a=t[o],s[o]=i[a.source.index]/(i[a.source.index]+i[a.target.index]);e=new Array(h),g(),r=new Array(h),p()}}function g(){if(n)for(var r=0,o=t.length;r<o;++r)e[r]=+c(t[r],r,t)}function p(){if(n)for(var e=0,o=t.length;e<o;++e)r[e]=+h(t[e],e,t)}return null==t&&(t=[]),d.initialize=function(t,...e){n=t,a=e.find(t=>"function"==typeof t)||Math.random,o=e.find(t=>[1,2,3].includes(t))||2,f()},d.links=function(e){return arguments.length?(t=e,f(),d):t},d.id=function(t){return arguments.length?(u=t,d):u},d.iterations=function(t){return arguments.length?(l=+t,d):l},d.strength=function(t){return arguments.length?(c="function"==typeof t?t:In(+t),g(),d):c},d.distance=function(t){return arguments.length?(h="function"==typeof t?t:In(+t),p(),d):h},d}Cn.copy=function(){var t,e,r=new On(this._x,this._y,this._z,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1),n=this._root;if(!n)return r;if(!n.length)return r._root=jn(n),r;for(t=[{source:n,target:r._root=new Array(8)}];n=t.pop();)for(var o=0;o<8;++o)(e=n.source[o])&&(e.length?t.push({source:e,target:n.target[o]=new Array(8)}):n.target[o]=jn(e));return r},Cn.add=function(t){const e=+this._x.call(null,t),r=+this._y.call(null,t),n=+this._z.call(null,t);return Mn(this.cover(e,r,n),e,r,n,t)},Cn.addAll=function(t){Array.isArray(t)||(t=Array.from(t));const e=t.length,r=new Float64Array(e),n=new Float64Array(e),o=new Float64Array(e);let i=1/0,s=1/0,a=1/0,u=-1/0,c=-1/0,h=-1/0;for(let l,d,f,g,p=0;p<e;++p)isNaN(d=+this._x.call(null,l=t[p]))||isNaN(f=+this._y.call(null,l))||isNaN(g=+this._z.call(null,l))||(r[p]=d,n[p]=f,o[p]=g,d<i&&(i=d),d>u&&(u=d),f<s&&(s=f),f>c&&(c=f),g<a&&(a=g),g>h&&(h=g));if(i>u||s>c||a>h)return this;this.cover(i,s,a).cover(u,c,h);for(let i=0;i<e;++i)Mn(this,r[i],n[i],o[i],t[i]);return this},Cn.cover=function(t,e,r){if(isNaN(t=+t)||isNaN(e=+e)||isNaN(r=+r))return this;var n=this._x0,o=this._y0,i=this._z0,s=this._x1,a=this._y1,u=this._z1;if(isNaN(n))s=(n=Math.floor(t))+1,a=(o=Math.floor(e))+1,u=(i=Math.floor(r))+1;else{for(var c,h,l=s-n||1,d=this._root;n>t||t>=s||o>e||e>=a||i>r||r>=u;)switch(h=(r<i)<<2|(e<o)<<1|t<n,(c=new Array(8))[h]=d,d=c,l*=2,h){case 0:s=n+l,a=o+l,u=i+l;break;case 1:n=s-l,a=o+l,u=i+l;break;case 2:s=n+l,o=a-l,u=i+l;break;case 3:n=s-l,o=a-l,u=i+l;break;case 4:s=n+l,a=o+l,i=u-l;break;case 5:n=s-l,a=o+l,i=u-l;break;case 6:s=n+l,o=a-l,i=u-l;break;case 7:n=s-l,o=a-l,i=u-l}this._root&&this._root.length&&(this._root=d)}return this._x0=n,this._y0=o,this._z0=i,this._x1=s,this._y1=a,this._z1=u,this},Cn.data=function(){var t=[];return this.visit(function(e){if(!e.length)do{t.push(e.data)}while(e=e.next)}),t},Cn.extent=function(t){return arguments.length?this.cover(+t[0][0],+t[0][1],+t[0][2]).cover(+t[1][0],+t[1][1],+t[1][2]):isNaN(this._x0)?void 0:[[this._x0,this._y0,this._z0],[this._x1,this._y1,this._z1]]},Cn.find=function(t,e,r,n){var o,i,s,a,u,c,h,l,d,f=this._x0,g=this._y0,p=this._z0,v=this._x1,m=this._y1,y=this._z1,w=[],x=this._root;for(x&&w.push(new Nn(x,f,g,p,v,m,y)),null==n?n=1/0:(f=t-n,g=e-n,p=r-n,v=t+n,m=e+n,y=r+n,n*=n);l=w.pop();)if(!(!(x=l.node)||(i=l.x0)>v||(s=l.y0)>m||(a=l.z0)>y||(u=l.x1)<f||(c=l.y1)<g||(h=l.z1)<p))if(x.length){var b=(i+u)/2,E=(s+c)/2,M=(a+h)/2;w.push(new Nn(x[7],b,E,M,u,c,h),new Nn(x[6],i,E,M,b,c,h),new Nn(x[5],b,s,M,u,E,h),new Nn(x[4],i,s,M,b,E,h),new Nn(x[3],b,E,a,u,c,M),new Nn(x[2],i,E,a,b,c,M),new Nn(x[1],b,s,a,u,E,M),new Nn(x[0],i,s,a,b,E,M)),(d=(r>=M)<<2|(e>=E)<<1|t>=b)&&(l=w[w.length-1],w[w.length-1]=w[w.length-1-d],w[w.length-1-d]=l)}else{var N=t-+this._x.call(null,x.data),_=e-+this._y.call(null,x.data),k=r-+this._z.call(null,x.data),S=N*N+_*_+k*k;if(S<n){var z=Math.sqrt(n=S);f=t-z,g=e-z,p=r-z,v=t+z,m=e+z,y=r+z,o=x.data}}return o},Cn.findAllWithinRadius=function(t,e,r,n){const o=[],i=t-n,s=e-n,a=r-n,u=t+n,c=e+n,h=r+n;return this.visit((l,d,f,g,p,v,m)=>{if(!l.length)do{const i=l.data;_n(t,e,r,this._x(i),this._y(i),this._z(i))<=n&&o.push(i)}while(l=l.next);return d>u||f>c||g>h||p<i||v<s||m<a}),o},Cn.remove=function(t){if(isNaN(i=+this._x.call(null,t))||isNaN(s=+this._y.call(null,t))||isNaN(a=+this._z.call(null,t)))return this;var e,r,n,o,i,s,a,u,c,h,l,d,f,g,p,v=this._root,m=this._x0,y=this._y0,w=this._z0,x=this._x1,b=this._y1,E=this._z1;if(!v)return this;if(v.length)for(;;){if((l=i>=(u=(m+x)/2))?m=u:x=u,(d=s>=(c=(y+b)/2))?y=c:b=c,(f=a>=(h=(w+E)/2))?w=h:E=h,e=v,!(v=v[g=f<<2|d<<1|l]))return this;if(!v.length)break;(e[g+1&7]||e[g+2&7]||e[g+3&7]||e[g+4&7]||e[g+5&7]||e[g+6&7]||e[g+7&7])&&(r=e,p=g)}for(;v.data!==t;)if(n=v,!(v=v.next))return this;return(o=v.next)&&delete v.next,n?(o?n.next=o:delete n.next,this):e?(o?e[g]=o:delete e[g],(v=e[0]||e[1]||e[2]||e[3]||e[4]||e[5]||e[6]||e[7])&&v===(e[7]||e[6]||e[5]||e[4]||e[3]||e[2]||e[1]||e[0])&&!v.length&&(r?r[p]=v:this._root=v),this):(this._root=o,this)},Cn.removeAll=function(t){for(var e=0,r=t.length;e<r;++e)this.remove(t[e]);return this},Cn.root=function(){return this._root},Cn.size=function(){var t=0;return this.visit(function(e){if(!e.length)do{++t}while(e=e.next)}),t},Cn.visit=function(t){var e,r,n,o,i,s,a,u,c=[],h=this._root;for(h&&c.push(new Nn(h,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));e=c.pop();)if(!t(h=e.node,n=e.x0,o=e.y0,i=e.z0,s=e.x1,a=e.y1,u=e.z1)&&h.length){var l=(n+s)/2,d=(o+a)/2,f=(i+u)/2;(r=h[7])&&c.push(new Nn(r,l,d,f,s,a,u)),(r=h[6])&&c.push(new Nn(r,n,d,f,l,a,u)),(r=h[5])&&c.push(new Nn(r,l,o,f,s,d,u)),(r=h[4])&&c.push(new Nn(r,n,o,f,l,d,u)),(r=h[3])&&c.push(new Nn(r,l,d,i,s,a,f)),(r=h[2])&&c.push(new Nn(r,n,d,i,l,a,f)),(r=h[1])&&c.push(new Nn(r,l,o,i,s,d,f)),(r=h[0])&&c.push(new Nn(r,n,o,i,l,d,f))}return this},Cn.visitAfter=function(t){var e,r=[],n=[];for(this._root&&r.push(new Nn(this._root,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));e=r.pop();){var o=e.node;if(o.length){var i,s=e.x0,a=e.y0,u=e.z0,c=e.x1,h=e.y1,l=e.z1,d=(s+c)/2,f=(a+h)/2,g=(u+l)/2;(i=o[0])&&r.push(new Nn(i,s,a,u,d,f,g)),(i=o[1])&&r.push(new Nn(i,d,a,u,c,f,g)),(i=o[2])&&r.push(new Nn(i,s,f,u,d,h,g)),(i=o[3])&&r.push(new Nn(i,d,f,u,c,h,g)),(i=o[4])&&r.push(new Nn(i,s,a,g,d,f,l)),(i=o[5])&&r.push(new Nn(i,d,a,g,c,f,l)),(i=o[6])&&r.push(new Nn(i,s,f,g,d,h,l)),(i=o[7])&&r.push(new Nn(i,d,f,g,c,h,l))}n.push(e)}for(;e=n.pop();)t(e.node,e.x0,e.y0,e.z0,e.x1,e.y1,e.z1);return this},Cn.x=function(t){return arguments.length?(this._x=t,this):this._x},Cn.y=function(t){return arguments.length?(this._y=t,this):this._y},Cn.z=function(t){return arguments.length?(this._z=t,this):this._z};const Bn=4294967296;function $n(t){return t.x}function Gn(t){return t.y}function Un(t){return t.z}var Wn=Math.PI*(3-Math.sqrt(5)),Yn=20*Math.PI/(9+Math.sqrt(221));function Hn(t,e){e=e||2;var r,n=Math.min(3,Math.max(1,Math.round(e))),o=1,i=.001,s=1-Math.pow(i,1/300),a=0,u=.6,c=new Map,h=Jr(f),l=Rr("tick","end"),d=function(){let t=1;return()=>(t=(1664525*t+1013904223)%Bn)/Bn}();function f(){g(),l.call("tick",r),o<i&&(h.stop(),l.call("end",r))}function g(e){var i,h,l=t.length;void 0===e&&(e=1);for(var d=0;d<e;++d)for(o+=(a-o)*s,c.forEach(function(t){t(o)}),i=0;i<l;++i)null==(h=t[i]).fx?h.x+=h.vx*=u:(h.x=h.fx,h.vx=0),n>1&&(null==h.fy?h.y+=h.vy*=u:(h.y=h.fy,h.vy=0)),n>2&&(null==h.fz?h.z+=h.vz*=u:(h.z=h.fz,h.vz=0));return r}function p(){for(var e,r=0,o=t.length;r<o;++r){if((e=t[r]).index=r,null!=e.fx&&(e.x=e.fx),null!=e.fy&&(e.y=e.fy),null!=e.fz&&(e.z=e.fz),isNaN(e.x)||n>1&&isNaN(e.y)||n>2&&isNaN(e.z)){var i=10*(n>2?Math.cbrt(.5+r):n>1?Math.sqrt(.5+r):r),s=r*Wn,a=r*Yn;1===n?e.x=i:2===n?(e.x=i*Math.cos(s),e.y=i*Math.sin(s)):(e.x=i*Math.sin(s)*Math.cos(a),e.y=i*Math.cos(s),e.z=i*Math.sin(s)*Math.sin(a))}(isNaN(e.vx)||n>1&&isNaN(e.vy)||n>2&&isNaN(e.vz))&&(e.vx=0,n>1&&(e.vy=0),n>2&&(e.vz=0))}}function v(e){return e.initialize&&e.initialize(t,d,n),e}return null==t&&(t=[]),p(),r={tick:g,restart:function(){return h.restart(f),r},stop:function(){return h.stop(),r},numDimensions:function(t){return arguments.length?(n=Math.min(3,Math.max(1,Math.round(t))),c.forEach(v),r):n},nodes:function(e){return arguments.length?(t=e,p(),c.forEach(v),r):t},alpha:function(t){return arguments.length?(o=+t,r):o},alphaMin:function(t){return arguments.length?(i=+t,r):i},alphaDecay:function(t){return arguments.length?(s=+t,r):+s},alphaTarget:function(t){return arguments.length?(a=+t,r):a},velocityDecay:function(t){return arguments.length?(u=1-t,r):1-u},randomSource:function(t){return arguments.length?(d=t,c.forEach(v),r):d},force:function(t,e){return arguments.length>1?(null==e?c.delete(t):c.set(t,v(e)),r):c.get(t)},find:function(){var e,r,o,i,s,a,u=Array.prototype.slice.call(arguments),c=u.shift()||0,h=(n>1?u.shift():null)||0,l=(n>2?u.shift():null)||0,d=u.shift()||1/0,f=0,g=t.length;for(d*=d,f=0;f<g;++f)(i=(e=c-(s=t[f]).x)*e+(r=h-(s.y||0))*r+(o=l-(s.z||0))*o)<d&&(a=s,d=i);return a},on:function(t,e){return arguments.length>1?(l.on(t,e),r):l.on(t)}}}function Xn(){var t,e,r,n,o,i,s=In(-30),a=1,u=1/0,c=.81;function h(n){var i,s=t.length,a=(1===e?wn(t,$n):2===e?br(t,$n,Gn):3===e?An(t,$n,Gn,Un):null).visitAfter(d);for(o=n,i=0;i<s;++i)r=t[i],a.visit(f)}function l(){if(t){var e,r,n=t.length;for(i=new Array(n),e=0;e<n;++e)r=t[e],i[r.index]=+s(r,e,t)}}function d(t){var r,n,o,s,a,u,c=0,h=0,l=t.length;if(l){for(o=s=a=u=0;u<l;++u)(r=t[u])&&(n=Math.abs(r.value))&&(c+=r.value,h+=n,o+=n*(r.x||0),s+=n*(r.y||0),a+=n*(r.z||0));c*=Math.sqrt(4/l),t.x=o/h,e>1&&(t.y=s/h),e>2&&(t.z=a/h)}else{(r=t).x=r.data.x,e>1&&(r.y=r.data.y),e>2&&(r.z=r.data.z);do{c+=i[r.data.index]}while(r=r.next)}t.value=c}function f(t,s,h,l,d){if(!t.value)return!0;var f=[h,l,d][e-1],g=t.x-r.x,p=e>1?t.y-r.y:0,v=e>2?t.z-r.z:0,m=f-s,y=g*g+p*p+v*v;if(m*m/c<y)return y<u&&(0===g&&(y+=(g=Rn(n))*g),e>1&&0===p&&(y+=(p=Rn(n))*p),e>2&&0===v&&(y+=(v=Rn(n))*v),y<a&&(y=Math.sqrt(a*y)),r.vx+=g*t.value*o/y,e>1&&(r.vy+=p*t.value*o/y),e>2&&(r.vz+=v*t.value*o/y)),!0;if(!(t.length||y>=u)){(t.data!==r||t.next)&&(0===g&&(y+=(g=Rn(n))*g),e>1&&0===p&&(y+=(p=Rn(n))*p),e>2&&0===v&&(y+=(v=Rn(n))*v),y<a&&(y=Math.sqrt(a*y)));do{t.data!==r&&(m=i[t.data.index]*o/y,r.vx+=g*m,e>1&&(r.vy+=p*m),e>2&&(r.vz+=v*m))}while(t=t.next)}}return h.initialize=function(r,...o){t=r,n=o.find(t=>"function"==typeof t)||Math.random,e=o.find(t=>[1,2,3].includes(t))||2,l()},h.strength=function(t){return arguments.length?(s="function"==typeof t?t:In(+t),l(),h):s},h.distanceMin=function(t){return arguments.length?(a=t*t,h):Math.sqrt(a)},h.distanceMax=function(t){return arguments.length?(u=t*t,h):Math.sqrt(u)},h.theta=function(t){return arguments.length?(c=t*t,h):Math.sqrt(c)},h}function Qn(t,e,r,n){var o,i,s,a,u=In(.1);function c(t){for(var u=0,c=o.length;u<c;++u){var h=o[u],l=h.x-e||1e-6,d=(h.y||0)-r||1e-6,f=(h.z||0)-n||1e-6,g=Math.sqrt(l*l+d*d+f*f),p=(a[u]-g)*s[u]*t/g;h.vx+=l*p,i>1&&(h.vy+=d*p),i>2&&(h.vz+=f*p)}}function h(){if(o){var e,r=o.length;for(s=new Array(r),a=new Array(r),e=0;e<r;++e)a[e]=+t(o[e],e,o),s[e]=isNaN(a[e])?0:+u(o[e],e,o)}}return"function"!=typeof t&&(t=In(+t)),null==e&&(e=0),null==r&&(r=0),null==n&&(n=0),c.initialize=function(t,...e){o=t,i=e.find(t=>[1,2,3].includes(t))||2,h()},c.strength=function(t){return arguments.length?(u="function"==typeof t?t:In(+t),h(),c):u},c.radius=function(e){return arguments.length?(t="function"==typeof e?e:In(+e),h(),c):t},c.x=function(t){return arguments.length?(e=+t,c):e},c.y=function(t){return arguments.length?(r=+t,c):r},c.z=function(t){return arguments.length?(n=+t,c):n},c}function Jn(t){var e,r,n,o=In(.1);function i(t){for(var o,i=0,s=e.length;i<s;++i)(o=e[i]).vx+=(n[i]-o.x)*r[i]*t}function s(){if(e){var i,s=e.length;for(r=new Array(s),n=new Array(s),i=0;i<s;++i)r[i]=isNaN(n[i]=+t(e[i],i,e))?0:+o(e[i],i,e)}}return"function"!=typeof t&&(t=In(null==t?0:+t)),i.initialize=function(t){e=t,s()},i.strength=function(t){return arguments.length?(o="function"==typeof t?t:In(+t),s(),i):o},i.x=function(e){return arguments.length?(t="function"==typeof e?e:In(+e),s(),i):t},i}function Kn(t){var e,r,n,o=In(.1);function i(t){for(var o,i=0,s=e.length;i<s;++i)(o=e[i]).vy+=(n[i]-o.y)*r[i]*t}function s(){if(e){var i,s=e.length;for(r=new Array(s),n=new Array(s),i=0;i<s;++i)r[i]=isNaN(n[i]=+t(e[i],i,e))?0:+o(e[i],i,e)}}return"function"!=typeof t&&(t=In(null==t?0:+t)),i.initialize=function(t){e=t,s()},i.strength=function(t){return arguments.length?(o="function"==typeof t?t:In(+t),s(),i):o},i.y=function(e){return arguments.length?(t="function"==typeof e?e:In(+e),s(),i):t},i}function Zn(t){var e,r,n,o=In(.1);function i(t){for(var o,i=0,s=e.length;i<s;++i)(o=e[i]).vz+=(n[i]-o.z)*r[i]*t}function s(){if(e){var i,s=e.length;for(r=new Array(s),n=new Array(s),i=0;i<s;++i)r[i]=isNaN(n[i]=+t(e[i],i,e))?0:+o(e[i],i,e)}}return"function"!=typeof t&&(t=In(null==t?0:+t)),i.initialize=function(t){e=t,s()},i.strength=function(t){return arguments.length?(o="function"==typeof t?t:In(+t),s(),i):o},i.z=function(e){return arguments.length?(t="function"==typeof e?e:In(+e),s(),i):t},i}class to extends fn{constructor(){super(...arguments),this.id="d3-force-3d",this.config={simulationAttrs:["alpha","alphaMin","alphaDecay","alphaTarget","velocityDecay","randomSource","numDimensions"]},this.forceMap={link:Vn,manyBody:Xn,center:pn,collide:Ln,radial:Qn,x:Jn,y:Kn,z:Zn}}getDefaultOptions(){return{numDimensions:3,link:{id:t=>String(t.id)},manyBody:{},center:{x:0,y:0,z:0}}}initSimulation(){return Hn()}setupForces(t,e){Object.entries(this.forceMap).forEach(([r,n])=>{const o=r;if(e[r]){let r=t.force(o);r||(r=n(),t.force(o,r)),gn(r,Object.entries(e[o]))}else t.force(o,null)})}}var eo,ro,no,oo,io,so,ao,uo,co,ho,lo,fo,go,po,vo,mo,yo,wo,xo,bo,Eo,Mo,No,_o,ko,So,zo,Ao,Oo,jo,Co,Io,Ro,Po,To,Fo,Lo,Do,qo,Vo,Bo,$o,Go,Uo,Wo,Yo,Ho,Xo,Qo,Jo,Ko,Zo,ti,ei,ri,ni,oi,ii,si,ai,ui,ci,hi,li,di,fi,gi,pi,vi,mi,yi,wi,xi,bi,Ei,Mi,Ni,_i,ki,Si,zi,Ai,Oi,ji,Ci,Ii,Ri,Pi,Ti,Fi,Li,Di,qi,Vi,Bi,$i,Gi,Ui,Wi,Yi,Hi,Xi,Qi,Ji,Ki,Zi,ts,es,rs="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function ns(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function os(t){if(Object.prototype.hasOwnProperty.call(t,"__esModule"))return t;var e=t.default;if("function"==typeof e){var r=function t(){var r=!1;try{r=this instanceof t}catch{}return r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(e){var n=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(r,e,n.get?n:{enumerable:!0,get:function(){return t[e]}})}),r}function is(){if(oo)return no;return oo=1,no=function(t,e){return t===e||t!=t&&e!=e}}function ss(){if(so)return io;so=1;var t=is();return io=function(e,r){for(var n=e.length;n--;)if(t(e[n][0],r))return n;return-1}}function as(){if(mo)return vo;mo=1;var t=ro?eo:(ro=1,eo=function(){this.__data__=[],this.size=0}),e=function(){if(uo)return ao;uo=1;var t=ss(),e=Array.prototype.splice;return ao=function(r){var n=this.__data__,o=t(n,r);return!(o<0||(o==n.length-1?n.pop():e.call(n,o,1),--this.size,0))},ao}(),r=function(){if(ho)return co;ho=1;var t=ss();return co=function(e){var r=this.__data__,n=t(r,e);return n<0?void 0:r[n][1]},co}(),n=function(){if(fo)return lo;fo=1;var t=ss();return lo=function(e){return t(this.__data__,e)>-1}}(),o=function(){if(po)return go;po=1;var t=ss();return go=function(e,r){var n=this.__data__,o=t(n,e);return o<0?(++this.size,n.push([e,r])):n[o][1]=r,this},go}();function i(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}return i.prototype.clear=t,i.prototype.delete=e,i.prototype.get=r,i.prototype.has=n,i.prototype.set=o,vo=i}function us(){if(So)return ko;So=1;var t="object"==typeof rs&&rs&&rs.Object===Object&&rs;return ko=t}function cs(){if(Ao)return zo;Ao=1;var t=us(),e="object"==typeof self&&self&&self.Object===Object&&self,r=t||e||Function("return this")();return zo=r}function hs(){if(jo)return Oo;jo=1;var t=cs().Symbol;return Oo=t}function ls(){if(Fo)return To;Fo=1;var t=hs(),e=function(){if(Io)return Co;Io=1;var t=hs(),e=Object.prototype,r=e.hasOwnProperty,n=e.toString,o=t?t.toStringTag:void 0;return Co=function(t){var e=r.call(t,o),i=t[o];try{t[o]=void 0;var s=!0}catch(t){}var a=n.call(t);return s&&(e?t[o]=i:delete t[o]),a}}(),r=function(){if(Po)return Ro;Po=1;var t=Object.prototype.toString;return Ro=function(e){return t.call(e)}}(),n=t?t.toStringTag:void 0;return To=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":n&&n in Object(t)?e(t):r(t)}}function ds(){if(Do)return Lo;return Do=1,Lo=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}}function fs(){if(Vo)return qo;Vo=1;var t=ls(),e=ds();return qo=function(r){if(!e(r))return!1;var n=t(r);return"[object Function]"==n||"[object GeneratorFunction]"==n||"[object AsyncFunction]"==n||"[object Proxy]"==n}}function gs(){if(Uo)return Go;Uo=1;var t,e=function(){if($o)return Bo;$o=1;var t=cs()["__core-js_shared__"];return Bo=t}(),r=(t=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||""))?"Symbol(src)_1."+t:"";return Go=function(t){return!!r&&r in t}}function ps(){if(Yo)return Wo;Yo=1;var t=Function.prototype.toString;return Wo=function(e){if(null!=e){try{return t.call(e)}catch(t){}try{return e+""}catch(t){}}return""}}function vs(){if(Zo)return Ko;Zo=1;var t=function(){if(Xo)return Ho;Xo=1;var t=fs(),e=gs(),r=ds(),n=ps(),o=/^\[object .+?Constructor\]$/,i=Function.prototype,s=Object.prototype,a=i.toString,u=s.hasOwnProperty,c=RegExp("^"+a.call(u).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");return Ho=function(i){return!(!r(i)||e(i))&&(t(i)?c:o).test(n(i))}}(),e=Jo?Qo:(Jo=1,Qo=function(t,e){return null==t?void 0:t[e]});return Ko=function(r,n){var o=e(r,n);return t(o)?o:void 0}}function ms(){if(ei)return ti;ei=1;var t=vs()(cs(),"Map");return ti=t}function ys(){if(ni)return ri;ni=1;var t=vs()(Object,"create");return ri=t}function ws(){if(pi)return gi;pi=1;var t=function(){if(ii)return oi;ii=1;var t=ys();return oi=function(){this.__data__=t?t(null):{},this.size=0}}(),e=ai?si:(ai=1,si=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}),r=function(){if(ci)return ui;ci=1;var t=ys(),e=Object.prototype.hasOwnProperty;return ui=function(r){var n=this.__data__;if(t){var o=n[r];return"__lodash_hash_undefined__"===o?void 0:o}return e.call(n,r)?n[r]:void 0}}(),n=function(){if(li)return hi;li=1;var t=ys(),e=Object.prototype.hasOwnProperty;return hi=function(r){var n=this.__data__;return t?void 0!==n[r]:e.call(n,r)}}(),o=function(){if(fi)return di;fi=1;var t=ys();return di=function(e,r){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=t&&void 0===r?"__lodash_hash_undefined__":r,this}}();function i(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}return i.prototype.clear=t,i.prototype.delete=e,i.prototype.get=r,i.prototype.has=n,i.prototype.set=o,gi=i}function xs(){if(bi)return xi;bi=1;var t=wi?yi:(wi=1,yi=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t});return xi=function(e,r){var n=e.__data__;return t(r)?n["string"==typeof r?"string":"hash"]:n.map}}function bs(){if(ji)return Oi;ji=1;var t=function(){if(mi)return vi;mi=1;var t=ws(),e=as(),r=ms();return vi=function(){this.size=0,this.__data__={hash:new t,map:new(r||e),string:new t}}}(),e=function(){if(Mi)return Ei;Mi=1;var t=xs();return Ei=function(e){var r=t(this,e).delete(e);return this.size-=r?1:0,r}}(),r=function(){if(_i)return Ni;_i=1;var t=xs();return Ni=function(e){return t(this,e).get(e)}}(),n=function(){if(Si)return ki;Si=1;var t=xs();return ki=function(e){return t(this,e).has(e)}}(),o=function(){if(Ai)return zi;Ai=1;var t=xs();return zi=function(e,r){var n=t(this,e),o=n.size;return n.set(e,r),this.size+=n.size==o?0:1,this}}();function i(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}return i.prototype.clear=t,i.prototype.delete=e,i.prototype.get=r,i.prototype.has=n,i.prototype.set=o,Oi=i}function Es(){if(Pi)return Ri;Pi=1;var t=as(),e=function(){if(wo)return yo;wo=1;var t=as();return yo=function(){this.__data__=new t,this.size=0}}(),r=bo?xo:(bo=1,xo=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}),n=Mo?Eo:(Mo=1,Eo=function(t){return this.__data__.get(t)}),o=_o?No:(_o=1,No=function(t){return this.__data__.has(t)}),i=function(){if(Ii)return Ci;Ii=1;var t=as(),e=ms(),r=bs();return Ci=function(n,o){var i=this.__data__;if(i instanceof t){var s=i.__data__;if(!e||s.length<199)return s.push([n,o]),this.size=++i.size,this;i=this.__data__=new r(s)}return i.set(n,o),this.size=i.size,this}}();function s(e){var r=this.__data__=new t(e);this.size=r.size}return s.prototype.clear=e,s.prototype.delete=r,s.prototype.get=n,s.prototype.has=o,s.prototype.set=i,Ri=s}function Ms(){if(Fi)return Ti;return Fi=1,Ti=function(t,e){for(var r=-1,n=null==t?0:t.length;++r<n&&!1!==e(t[r],r,t););return t},Ti}function Ns(){if(Di)return Li;Di=1;var t=vs(),e=function(){try{var e=t(Object,"defineProperty");return e({},"",{}),e}catch(t){}}();return Li=e}function _s(){if(Vi)return qi;Vi=1;var t=Ns();return qi=function(e,r,n){"__proto__"==r&&t?t(e,r,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[r]=n}}function ks(){if($i)return Bi;$i=1;var t=_s(),e=is(),r=Object.prototype.hasOwnProperty;return Bi=function(n,o,i){var s=n[o];r.call(n,o)&&e(s,i)&&(void 0!==i||o in n)||t(n,o,i)}}function Ss(){if(Ui)return Gi;Ui=1;var t=ks(),e=_s();return Gi=function(r,n,o,i){var s=!o;o||(o={});for(var a=-1,u=n.length;++a<u;){var c=n[a],h=i?i(o[c],r[c],c,o,r):void 0;void 0===h&&(h=r[c]),s?e(o,c,h):t(o,c,h)}return o},Gi}function zs(){if(Xi)return Hi;return Xi=1,Hi=function(t){return null!=t&&"object"==typeof t}}function As(){if(Zi)return Ki;Zi=1;var t=function(){if(Ji)return Qi;Ji=1;var t=ls(),e=zs();return Qi=function(r){return e(r)&&"[object Arguments]"==t(r)}}(),e=zs(),r=Object.prototype,n=r.hasOwnProperty,o=r.propertyIsEnumerable,i=t(function(){return arguments}())?t:function(t){return e(t)&&n.call(t,"callee")&&!o.call(t,"callee")};return Ki=i}function Os(){if(es)return ts;es=1;var t=Array.isArray;return ts=t}var js,Cs,Is,Rs,Ps,Ts,Fs,Ls,Ds,qs,Vs,Bs={exports:{}};function $s(){return Is||(Is=1,function(t,e){var r=cs(),n=Cs?js:(Cs=1,js=function(){return!1}),o=e&&!e.nodeType&&e,i=o&&t&&!t.nodeType&&t,s=i&&i.exports===o?r.Buffer:void 0,a=(s?s.isBuffer:void 0)||n;t.exports=a}(Bs,Bs.exports)),Bs.exports}function Gs(){if(Ps)return Rs;Ps=1;var t=/^(?:0|[1-9]\d*)$/;return Rs=function(e,r){var n=typeof e;return!!(r=null==r?9007199254740991:r)&&("number"==n||"symbol"!=n&&t.test(e))&&e>-1&&e%1==0&&e<r}}function Us(){if(Fs)return Ts;Fs=1;return Ts=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}}function Ws(){if(Vs)return qs;return Vs=1,qs=function(t){return function(e){return t(e)}}}var Ys,Hs,Xs,Qs,Js,Ks,Zs,ta,ea,ra,na,oa,ia,sa,aa,ua,ca,ha,la,da,fa,ga,pa,va,ma,ya,wa,xa={exports:{}};function ba(){return Ys||(Ys=1,function(t,e){var r=us(),n=e&&!e.nodeType&&e,o=n&&t&&!t.nodeType&&t,i=o&&o.exports===n&&r.process,s=function(){try{var t=o&&o.require&&o.require("util").types;return t||i&&i.binding&&i.binding("util")}catch(t){}}();t.exports=s}(xa,xa.exports)),xa.exports}function Ea(){if(Xs)return Hs;Xs=1;var t=function(){if(Ds)return Ls;Ds=1;var t=ls(),e=Us(),r=zs(),n={};return n["[object Float32Array]"]=n["[object Float64Array]"]=n["[object Int8Array]"]=n["[object Int16Array]"]=n["[object Int32Array]"]=n["[object Uint8Array]"]=n["[object Uint8ClampedArray]"]=n["[object Uint16Array]"]=n["[object Uint32Array]"]=!0,n["[object Arguments]"]=n["[object Array]"]=n["[object ArrayBuffer]"]=n["[object Boolean]"]=n["[object DataView]"]=n["[object Date]"]=n["[object Error]"]=n["[object Function]"]=n["[object Map]"]=n["[object Number]"]=n["[object Object]"]=n["[object RegExp]"]=n["[object Set]"]=n["[object String]"]=n["[object WeakMap]"]=!1,Ls=function(o){return r(o)&&e(o.length)&&!!n[t(o)]}}(),e=Ws(),r=ba(),n=r&&r.isTypedArray,o=n?e(n):t;return Hs=o}function Ma(){if(Js)return Qs;Js=1;var t=(Yi||(Yi=1,Wi=function(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}),Wi),e=As(),r=Os(),n=$s(),o=Gs(),i=Ea(),s=Object.prototype.hasOwnProperty;return Qs=function(a,u){var c=r(a),h=!c&&e(a),l=!c&&!h&&n(a),d=!c&&!h&&!l&&i(a),f=c||h||l||d,g=f?t(a.length,String):[],p=g.length;for(var v in a)!u&&!s.call(a,v)||f&&("length"==v||l&&("offset"==v||"parent"==v)||d&&("buffer"==v||"byteLength"==v||"byteOffset"==v)||o(v,p))||g.push(v);return g},Qs}function Na(){if(Zs)return Ks;Zs=1;var t=Object.prototype;return Ks=function(e){var r=e&&e.constructor;return e===("function"==typeof r&&r.prototype||t)}}function _a(){if(ea)return ta;return ea=1,ta=function(t,e){return function(r){return t(e(r))}}}function ka(){if(ia)return oa;ia=1;var t=Na(),e=function(){if(na)return ra;na=1;var t=_a()(Object.keys,Object);return ra=t}(),r=Object.prototype.hasOwnProperty;return oa=function(n){if(!t(n))return e(n);var o=[];for(var i in Object(n))r.call(n,i)&&"constructor"!=i&&o.push(i);return o}}function Sa(){if(aa)return sa;aa=1;var t=fs(),e=Us();return sa=function(r){return null!=r&&e(r.length)&&!t(r)}}function za(){if(ca)return ua;ca=1;var t=Ma(),e=ka(),r=Sa();return ua=function(n){return r(n)?t(n):e(n)}}function Aa(){if(pa)return ga;pa=1;var t=ds(),e=Na(),r=fa?da:(fa=1,da=function(t){var e=[];if(null!=t)for(var r in Object(t))e.push(r);return e}),n=Object.prototype.hasOwnProperty;return ga=function(o){if(!t(o))return r(o);var i=e(o),s=[];for(var a in o)("constructor"!=a||!i&&n.call(o,a))&&s.push(a);return s}}function Oa(){if(ma)return va;ma=1;var t=Ma(),e=Aa(),r=Sa();return va=function(n){return r(n)?t(n,!0):e(n)}}var ja,Ca,Ia,Ra,Pa,Ta,Fa,La,Da,qa,Va,Ba,$a,Ga,Ua,Wa,Ya,Ha,Xa,Qa,Ja,Ka,Za,tu,eu,ru,nu,ou,iu,su,au,uu,cu,hu,lu,du,fu,gu,pu,vu,mu,yu,wu,xu,bu,Eu,Mu,Nu,_u,ku,Su,zu,Au,Ou,ju,Cu,Iu,Ru,Pu,Tu,Fu,Lu,Du,qu,Vu,Bu,$u,Gu,Uu,Wu,Yu,Hu,Xu,Qu,Ju,Ku,Zu,tc,ec,rc,nc,oc,ic,sc,ac,uc,cc,hc,lc,dc,fc,gc,pc,vc,mc,yc,wc,xc,bc,Ec,Mc,Nc,_c,kc,Sc,zc,Ac,Oc,jc,Cc,Ic,Rc,Pc,Tc,Fc,Lc,Dc,qc,Vc,Bc,$c,Gc,Uc,Wc,Yc,Hc,Xc,Qc,Jc,Kc,Zc,th,eh,rh,nh,oh,ih,sh,ah,uh,ch,hh,lh,dh,fh,gh,ph,vh,mh,yh,wh,xh,bh,Eh,Mh,Nh,_h,kh,Sh,zh,Ah,Oh,jh,Ch,Ih,Rh,Ph,Th,Fh,Lh,Dh,qh,Vh,Bh,$h,Gh,Uh,Wh,Yh,Hh,Xh,Qh,Jh,Kh,Zh,tl,el,rl,nl,ol,il,sl,al,ul,cl,hl,ll,dl,fl,gl,pl,vl,ml,yl,wl,xl,bl,El,Ml,Nl,_l,kl,Sl,zl,Al,Ol,jl,Cl,Il,Rl,Pl,Tl,Fl,Ll,Dl,ql,Vl,Bl,$l,Gl,Ul,Wl,Yl,Hl,Xl,Ql,Jl,Kl,Zl,td,ed,rd,nd,od,id,sd,ad,ud,cd,hd,ld,dd,fd,gd,pd,vd,md,yd,wd,xd,bd,Ed,Md,Nd,_d,kd,Sd,zd,Ad,Od,jd,Cd,Id,Rd,Pd,Td,Fd,Ld,Dd,qd,Vd,Bd,$d,Gd,Ud,Wd,Yd,Hd,Xd,Qd,Jd,Kd,Zd,tf,ef,rf,nf,of,sf,af,uf,cf,hf,lf,df,ff,gf,pf,vf,mf,yf,wf,xf,bf,Ef,Mf,Nf,_f,kf,Sf,zf,Af,Of,jf,Cf,If,Rf,Pf,Tf,Ff,Lf,Df,qf,Vf,Bf,$f,Gf,Uf,Wf,Yf,Hf,Xf,Qf,Jf,Kf,Zf,tg,eg,rg,ng,og,ig,sg,ag,ug,cg,hg,lg,dg,fg,gg,pg,vg,mg,yg,wg,xg,bg,Eg,Mg,Ng,_g,kg,Sg,zg,Ag,Og,jg,Cg,Ig,Rg,Pg,Tg,Fg,Lg,Dg,qg,Vg,Bg,$g,Gg,Ug,Wg,Yg,Hg,Xg,Qg,Jg,Kg,Zg,tp,ep,rp,np,op,ip,sp,ap,up,cp,hp,lp,dp,fp,gp,pp,vp,mp,yp,wp,xp,bp,Ep,Mp,Np,_p,kp,Sp,zp,Ap,Op,jp={exports:{}};function Cp(){return ja||(ja=1,function(t,e){var r=cs(),n=e&&!e.nodeType&&e,o=n&&t&&!t.nodeType&&t,i=o&&o.exports===n?r.Buffer:void 0,s=i?i.allocUnsafe:void 0;t.exports=function(t,e){if(e)return t.slice();var r=t.length,n=s?s(r):new t.constructor(r);return t.copy(n),n}}(jp,jp.exports)),jp.exports}function Ip(){if(Ia)return Ca;return Ia=1,Ca=function(t,e){var r=-1,n=t.length;for(e||(e=Array(n));++r<n;)e[r]=t[r];return e},Ca}function Rp(){if(Pa)return Ra;return Pa=1,Ra=function(t,e){for(var r=-1,n=null==t?0:t.length,o=0,i=[];++r<n;){var s=t[r];e(s,r,t)&&(i[o++]=s)}return i},Ra}function Pp(){if(Fa)return Ta;return Fa=1,Ta=function(){return[]}}function Tp(){if(Da)return La;Da=1;var t=Rp(),e=Pp(),r=Object.prototype.propertyIsEnumerable,n=Object.getOwnPropertySymbols;return La=n?function(e){return null==e?[]:(e=Object(e),t(n(e),function(t){return r.call(e,t)}))}:e}function Fp(){if($a)return Ba;return $a=1,Ba=function(t,e){for(var r=-1,n=e.length,o=t.length;++r<n;)t[o+r]=e[r];return t},Ba}function Lp(){if(Ua)return Ga;Ua=1;var t=_a()(Object.getPrototypeOf,Object);return Ga=t}function Dp(){if(Ya)return Wa;Ya=1;var t=Fp(),e=Lp(),r=Tp(),n=Pp(),o=Object.getOwnPropertySymbols;return Wa=o?function(n){for(var o=[];n;)t(o,r(n)),n=e(n);return o}:n}function qp(){if(Ja)return Qa;Ja=1;var t=Fp(),e=Os();return Qa=function(r,n,o){var i=n(r);return e(r)?i:t(i,o(r))}}function Vp(){if(Za)return Ka;Za=1;var t=qp(),e=Tp(),r=za();return Ka=function(n){return t(n,r,e)}}function Bp(){if(au)return su;au=1;var t=vs()(cs(),"Set");return su=t}function $p(){if(lu)return hu;lu=1;var t=function(){if(nu)return ru;nu=1;var t=vs()(cs(),"DataView");return ru=t}(),e=ms(),r=function(){if(iu)return ou;iu=1;var t=vs()(cs(),"Promise");return ou=t}(),n=Bp(),o=function(){if(cu)return uu;cu=1;var t=vs()(cs(),"WeakMap");return uu=t}(),i=ls(),s=ps(),a="[object Map]",u="[object Promise]",c="[object Set]",h="[object WeakMap]",l="[object DataView]",d=s(t),f=s(e),g=s(r),p=s(n),v=s(o),m=i;return(t&&m(new t(new ArrayBuffer(1)))!=l||e&&m(new e)!=a||r&&m(r.resolve())!=u||n&&m(new n)!=c||o&&m(new o)!=h)&&(m=function(t){var e=i(t),r="[object Object]"==e?t.constructor:void 0,n=r?s(r):"";if(n)switch(n){case d:return l;case f:return a;case g:return u;case p:return c;case v:return h}return e}),hu=m}function Gp(){if(pu)return gu;pu=1;var t=cs().Uint8Array;return gu=t}function Up(){if(mu)return vu;mu=1;var t=Gp();return vu=function(e){var r=new e.constructor(e.byteLength);return new t(r).set(new t(e)),r}}function Wp(){if(_u)return Nu;_u=1;var t=Up();return Nu=function(e,r){var n=r?t(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}}function Yp(){if(Su)return ku;Su=1;var t=Up(),e=function(){if(wu)return yu;wu=1;var t=Up();return yu=function(e,r){var n=r?t(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}}(),r=function(){if(bu)return xu;bu=1;var t=/\w*$/;return xu=function(e){var r=new e.constructor(e.source,t.exec(e));return r.lastIndex=e.lastIndex,r}}(),n=function(){if(Mu)return Eu;Mu=1;var t=hs(),e=t?t.prototype:void 0,r=e?e.valueOf:void 0;return Eu=function(t){return r?Object(r.call(t)):{}}}(),o=Wp();return ku=function(i,s,a){var u=i.constructor;switch(s){case"[object ArrayBuffer]":return t(i);case"[object Boolean]":case"[object Date]":return new u(+i);case"[object DataView]":return e(i,a);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return o(i,a);case"[object Map]":case"[object Set]":return new u;case"[object Number]":case"[object String]":return new u(i);case"[object RegExp]":return r(i);case"[object Symbol]":return n(i)}}}function Hp(){if(Au)return zu;Au=1;var t=ds(),e=Object.create,r=function(){function r(){}return function(n){if(!t(n))return{};if(e)return e(n);r.prototype=n;var o=new r;return r.prototype=void 0,o}}();return zu=r}function Xp(){if(ju)return Ou;ju=1;var t=Hp(),e=Lp(),r=Na();return Ou=function(n){return"function"!=typeof n.constructor||r(n)?{}:t(e(n))}}function Qp(){if(Pu)return Ru;Pu=1;var t=function(){if(Iu)return Cu;Iu=1;var t=$p(),e=zs();return Cu=function(r){return e(r)&&"[object Map]"==t(r)}}(),e=Ws(),r=ba(),n=r&&r.isMap,o=n?e(n):t;return Ru=o}function Jp(){if(Du)return Lu;Du=1;var t=function(){if(Fu)return Tu;Fu=1;var t=$p(),e=zs();return Tu=function(r){return e(r)&&"[object Set]"==t(r)}}(),e=Ws(),r=ba(),n=r&&r.isSet,o=n?e(n):t;return Lu=o}function Kp(){if(Vu)return qu;Vu=1;var t=Es(),e=Ms(),r=ks(),n=function(){if(la)return ha;la=1;var t=Ss(),e=za();return ha=function(r,n){return r&&t(n,e(n),r)}}(),o=function(){if(wa)return ya;wa=1;var t=Ss(),e=Oa();return ya=function(r,n){return r&&t(n,e(n),r)}}(),i=Cp(),s=Ip(),a=function(){if(Va)return qa;Va=1;var t=Ss(),e=Tp();return qa=function(r,n){return t(r,e(r),n)}}(),u=function(){if(Xa)return Ha;Xa=1;var t=Ss(),e=Dp();return Ha=function(r,n){return t(r,e(r),n)}}(),c=Vp(),h=function(){if(eu)return tu;eu=1;var t=qp(),e=Dp(),r=Oa();return tu=function(n){return t(n,r,e)}}(),l=$p(),d=function(){if(fu)return du;fu=1;var t=Object.prototype.hasOwnProperty;return du=function(e){var r=e.length,n=new e.constructor(r);return r&&"string"==typeof e[0]&&t.call(e,"index")&&(n.index=e.index,n.input=e.input),n}}(),f=Yp(),g=Xp(),p=Os(),v=$s(),m=Qp(),y=ds(),w=Jp(),x=za(),b=Oa(),E="[object Arguments]",M="[object Function]",N="[object Object]",_={};return _[E]=_["[object Array]"]=_["[object ArrayBuffer]"]=_["[object DataView]"]=_["[object Boolean]"]=_["[object Date]"]=_["[object Float32Array]"]=_["[object Float64Array]"]=_["[object Int8Array]"]=_["[object Int16Array]"]=_["[object Int32Array]"]=_["[object Map]"]=_["[object Number]"]=_[N]=_["[object RegExp]"]=_["[object Set]"]=_["[object String]"]=_["[object Symbol]"]=_["[object Uint8Array]"]=_["[object Uint8ClampedArray]"]=_["[object Uint16Array]"]=_["[object Uint32Array]"]=!0,_["[object Error]"]=_[M]=_["[object WeakMap]"]=!1,qu=function k(S,z,A,O,j,C){var I,R=1&z,P=2&z,T=4&z;if(A&&(I=j?A(S,O,j,C):A(S)),void 0!==I)return I;if(!y(S))return S;var F=p(S);if(F){if(I=d(S),!R)return s(S,I)}else{var L=l(S),D=L==M||"[object GeneratorFunction]"==L;if(v(S))return i(S,R);if(L==N||L==E||D&&!j){if(I=P||D?{}:g(S),!R)return P?u(S,o(I,S)):a(S,n(I,S))}else{if(!_[L])return j?S:{};I=f(S,L,R)}}C||(C=new t);var q=C.get(S);if(q)return q;C.set(S,I),w(S)?S.forEach(function(t){I.add(k(t,z,A,t,S,C))}):m(S)&&S.forEach(function(t,e){I.set(e,k(t,z,A,e,S,C))});var V=F?void 0:(T?P?h:c:P?b:x)(S);return e(V||S,function(t,e){V&&(t=S[e=t]),r(I,e,k(t,z,A,e,S,C))}),I},qu}function Zp(){if($u)return Bu;$u=1;var t=Kp();return Bu=function(e){return t(e,4)}}function tv(){if(Uu)return Gu;return Uu=1,Gu=function(t){return function(){return t}}}function ev(){if(Xu)return Hu;Xu=1;var t=(Yu||(Yu=1,Wu=function(t){return function(e,r,n){for(var o=-1,i=Object(e),s=n(e),a=s.length;a--;){var u=s[t?a:++o];if(!1===r(i[u],u,i))break}return e}}),Wu),e=t();return Hu=e}function rv(){if(Ju)return Qu;Ju=1;var t=ev(),e=za();return Qu=function(r,n){return r&&t(r,n,e)}}function nv(){if(ec)return tc;ec=1;var t=rv(),e=function(){if(Zu)return Ku;Zu=1;var t=Sa();return Ku=function(e,r){return function(n,o){if(null==n)return n;if(!t(n))return e(n,o);for(var i=n.length,s=r?i:-1,a=Object(n);(r?s--:++s<i)&&!1!==o(a[s],s,a););return n}},Ku}(),r=e(t);return tc=r}function ov(){if(nc)return rc;return nc=1,rc=function(t){return t}}function iv(){if(ic)return oc;ic=1;var t=ov();return oc=function(e){return"function"==typeof e?e:t}}function sv(){if(ac)return sc;ac=1;var t=Ms(),e=nv(),r=iv(),n=Os();return sc=function(o,i){return(n(o)?t:e)(o,r(i))}}function av(){return cc?uc:(cc=1,uc=sv())}function uv(){if(mc)return vc;mc=1;var t=bs(),e=fc?dc:(fc=1,dc=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this}),r=pc?gc:(pc=1,gc=function(t){return this.__data__.has(t)});function n(e){var r=-1,n=null==e?0:e.length;for(this.__data__=new t;++r<n;)this.add(e[r])}return n.prototype.add=n.prototype.push=e,n.prototype.has=r,vc=n}function cv(){if(bc)return xc;return bc=1,xc=function(t,e){return t.has(e)}}function hv(){if(Mc)return Ec;Mc=1;var t=uv(),e=(wc||(wc=1,yc=function(t,e){for(var r=-1,n=null==t?0:t.length;++r<n;)if(e(t[r],r,t))return!0;return!1}),yc),r=cv();return Ec=function(n,o,i,s,a,u){var c=1&i,h=n.length,l=o.length;if(h!=l&&!(c&&l>h))return!1;var d=u.get(n),f=u.get(o);if(d&&f)return d==o&&f==n;var g=-1,p=!0,v=2&i?new t:void 0;for(u.set(n,o),u.set(o,n);++g<h;){var m=n[g],y=o[g];if(s)var w=c?s(y,m,g,o,n,u):s(m,y,g,n,o,u);if(void 0!==w){if(w)continue;p=!1;break}if(v){if(!e(o,function(t,e){if(!r(v,e)&&(m===t||a(m,t,i,s,u)))return v.push(e)})){p=!1;break}}else if(m!==y&&!a(m,y,i,s,u)){p=!1;break}}return u.delete(n),u.delete(o),p},Ec}function lv(){if(Sc)return kc;return Sc=1,kc=function(t){var e=-1,r=Array(t.size);return t.forEach(function(t){r[++e]=t}),r},kc}function dv(){if(Ac)return zc;Ac=1;var t=hs(),e=Gp(),r=is(),n=hv(),o=(_c||(_c=1,Nc=function(t){var e=-1,r=Array(t.size);return t.forEach(function(t,n){r[++e]=[n,t]}),r}),Nc),i=lv(),s=t?t.prototype:void 0,a=s?s.valueOf:void 0;return zc=function(t,s,u,c,h,l,d){switch(u){case"[object DataView]":if(t.byteLength!=s.byteLength||t.byteOffset!=s.byteOffset)return!1;t=t.buffer,s=s.buffer;case"[object ArrayBuffer]":return!(t.byteLength!=s.byteLength||!l(new e(t),new e(s)));case"[object Boolean]":case"[object Date]":case"[object Number]":return r(+t,+s);case"[object Error]":return t.name==s.name&&t.message==s.message;case"[object RegExp]":case"[object String]":return t==s+"";case"[object Map]":var f=o;case"[object Set]":var g=1&c;if(f||(f=i),t.size!=s.size&&!g)return!1;var p=d.get(t);if(p)return p==s;c|=2,d.set(t,s);var v=n(f(t),f(s),c,h,l,d);return d.delete(t),v;case"[object Symbol]":if(a)return a.call(t)==a.call(s)}return!1}}function fv(){if(Ic)return Cc;Ic=1;var t=Es(),e=hv(),r=dv(),n=function(){if(jc)return Oc;jc=1;var t=Vp(),e=Object.prototype.hasOwnProperty;return Oc=function(r,n,o,i,s,a){var u=1&o,c=t(r),h=c.length;if(h!=t(n).length&&!u)return!1;for(var l=h;l--;){var d=c[l];if(!(u?d in n:e.call(n,d)))return!1}var f=a.get(r),g=a.get(n);if(f&&g)return f==n&&g==r;var p=!0;a.set(r,n),a.set(n,r);for(var v=u;++l<h;){var m=r[d=c[l]],y=n[d];if(i)var w=u?i(y,m,d,n,r,a):i(m,y,d,r,n,a);if(!(void 0===w?m===y||s(m,y,o,i,a):w)){p=!1;break}v||(v="constructor"==d)}if(p&&!v){var x=r.constructor,b=n.constructor;x==b||!("constructor"in r)||!("constructor"in n)||"function"==typeof x&&x instanceof x&&"function"==typeof b&&b instanceof b||(p=!1)}return a.delete(r),a.delete(n),p},Oc}(),o=$p(),i=Os(),s=$s(),a=Ea(),u="[object Arguments]",c="[object Array]",h="[object Object]",l=Object.prototype.hasOwnProperty;return Cc=function(d,f,g,p,v,m){var y=i(d),w=i(f),x=y?c:o(d),b=w?c:o(f),E=(x=x==u?h:x)==h,M=(b=b==u?h:b)==h,N=x==b;if(N&&s(d)){if(!s(f))return!1;y=!0,E=!1}if(N&&!E)return m||(m=new t),y||a(d)?e(d,f,g,p,v,m):r(d,f,x,g,p,v,m);if(!(1&g)){var _=E&&l.call(d,"__wrapped__"),k=M&&l.call(f,"__wrapped__");if(_||k){var S=_?d.value():d,z=k?f.value():f;return m||(m=new t),v(S,z,g,p,m)}}return!!N&&(m||(m=new t),n(d,f,g,p,v,m))}}function gv(){if(Pc)return Rc;Pc=1;var t=fv(),e=zs();return Rc=function r(n,o,i,s,a){return n===o||(null==n||null==o||!e(n)&&!e(o)?n!=n&&o!=o:t(n,o,i,s,r,a))},Rc}function pv(){if(Dc)return Lc;Dc=1;var t=ds();return Lc=function(e){return e==e&&!t(e)}}function vv(){if($c)return Bc;return $c=1,Bc=function(t,e){return function(r){return null!=r&&(r[t]===e&&(void 0!==e||t in Object(r)))}}}function mv(){if(Uc)return Gc;Uc=1;var t=function(){if(Fc)return Tc;Fc=1;var t=Es(),e=gv();return Tc=function(r,n,o,i){var s=o.length,a=s,u=!i;if(null==r)return!a;for(r=Object(r);s--;){var c=o[s];if(u&&c[2]?c[1]!==r[c[0]]:!(c[0]in r))return!1}for(;++s<a;){var h=(c=o[s])[0],l=r[h],d=c[1];if(u&&c[2]){if(void 0===l&&!(h in r))return!1}else{var f=new t;if(i)var g=i(l,d,h,r,n,f);if(!(void 0===g?e(d,l,3,i,f):g))return!1}}return!0},Tc}(),e=function(){if(Vc)return qc;Vc=1;var t=pv(),e=za();return qc=function(r){for(var n=e(r),o=n.length;o--;){var i=n[o],s=r[i];n[o]=[i,s,t(s)]}return n}}(),r=vv();return Gc=function(n){var o=e(n);return 1==o.length&&o[0][2]?r(o[0][0],o[0][1]):function(e){return e===n||t(e,n,o)}}}function yv(){if(Yc)return Wc;Yc=1;var t=ls(),e=zs();return Wc=function(r){return"symbol"==typeof r||e(r)&&"[object Symbol]"==t(r)}}function wv(){if(Xc)return Hc;Xc=1;var t=Os(),e=yv(),r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,n=/^\w*$/;return Hc=function(o,i){if(t(o))return!1;var s=typeof o;return!("number"!=s&&"symbol"!=s&&"boolean"!=s&&null!=o&&!e(o))||(n.test(o)||!r.test(o)||null!=i&&o in Object(i))}}function xv(){if(Zc)return Kc;Zc=1;var t=function(){if(Jc)return Qc;Jc=1;var t=bs();function e(r,n){if("function"!=typeof r||null!=n&&"function"!=typeof n)throw new TypeError("Expected a function");var o=function(){var t=arguments,e=n?n.apply(this,t):t[0],i=o.cache;if(i.has(e))return i.get(e);var s=r.apply(this,t);return o.cache=i.set(e,s)||i,s};return o.cache=new(e.Cache||t),o}return e.Cache=t,Qc=e}();return Kc=function(e){var r=t(e,function(t){return 500===n.size&&n.clear(),t}),n=r.cache;return r}}function bv(){if(nh)return rh;return nh=1,rh=function(t,e){for(var r=-1,n=null==t?0:t.length,o=Array(n);++r<n;)o[r]=e(t[r],r,t);return o},rh}function Ev(){if(ah)return sh;ah=1;var t=function(){if(ih)return oh;ih=1;var t=hs(),e=bv(),r=Os(),n=yv(),o=t?t.prototype:void 0,i=o?o.toString:void 0;return oh=function t(o){if("string"==typeof o)return o;if(r(o))return e(o,t)+"";if(n(o))return i?i.call(o):"";var s=o+"";return"0"==s&&1/o==-1/0?"-0":s},oh}();return sh=function(e){return null==e?"":t(e)}}function Mv(){if(ch)return uh;ch=1;var t=Os(),e=wv(),r=function(){if(eh)return th;eh=1;var t=xv(),e=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,r=/\\(\\)?/g,n=t(function(t){var n=[];return 46===t.charCodeAt(0)&&n.push(""),t.replace(e,function(t,e,o,i){n.push(o?i.replace(r,"$1"):e||t)}),n});return th=n}(),n=Ev();return uh=function(o,i){return t(o)?o:e(o,i)?[o]:r(n(o))}}function Nv(){if(lh)return hh;lh=1;var t=yv();return hh=function(e){if("string"==typeof e||t(e))return e;var r=e+"";return"0"==r&&1/e==-1/0?"-0":r}}function _v(){if(fh)return dh;fh=1;var t=Mv(),e=Nv();return dh=function(r,n){for(var o=0,i=(n=t(n,r)).length;null!=r&&o<i;)r=r[e(n[o++])];return o&&o==i?r:void 0},dh}function kv(){if(wh)return yh;wh=1;var t=Mv(),e=As(),r=Os(),n=Gs(),o=Us(),i=Nv();return yh=function(s,a,u){for(var c=-1,h=(a=t(a,s)).length,l=!1;++c<h;){var d=i(a[c]);if(!(l=null!=s&&u(s,d)))break;s=s[d]}return l||++c!=h?l:!!(h=null==s?0:s.length)&&o(h)&&n(d,h)&&(r(s)||e(s))},yh}function Sv(){if(bh)return xh;bh=1;var t=mh?vh:(mh=1,vh=function(t,e){return null!=t&&e in Object(t)}),e=kv();return xh=function(r,n){return null!=r&&e(r,n,t)}}function zv(){if(Mh)return Eh;Mh=1;var t=gv(),e=function(){if(ph)return gh;ph=1;var t=_v();return gh=function(e,r,n){var o=null==e?void 0:t(e,r);return void 0===o?n:o}}(),r=Sv(),n=wv(),o=pv(),i=vv(),s=Nv();return Eh=function(a,u){return n(a)&&o(u)?i(s(a),u):function(n){var o=e(n,a);return void 0===o&&o===u?r(n,a):t(u,o,3)}}}function Av(){if(_h)return Nh;return _h=1,Nh=function(t){return function(e){return null==e?void 0:e[t]}}}function Ov(){if(Ah)return zh;Ah=1;var t=Av(),e=function(){if(Sh)return kh;Sh=1;var t=_v();return kh=function(e){return function(r){return t(r,e)}}}(),r=wv(),n=Nv();return zh=function(o){return r(o)?t(n(o)):e(o)}}function jv(){if(jh)return Oh;jh=1;var t=mv(),e=zv(),r=ov(),n=Os(),o=Ov();return Oh=function(i){return"function"==typeof i?i:null==i?r:"object"==typeof i?n(i)?e(i[0],i[1]):t(i):o(i)}}function Cv(){if(Ih)return Ch;Ih=1;var t=Rp(),e=function(){if(lc)return hc;lc=1;var t=nv();return hc=function(e,r){var n=[];return t(e,function(t,e,o){r(t,e,o)&&n.push(t)}),n},hc}(),r=jv(),n=Os();return Ch=function(o,i){return(n(o)?t:e)(o,r(i,3))}}function Iv(){if(Fh)return Th;Fh=1;var t=function(){if(Ph)return Rh;Ph=1;var t=Object.prototype.hasOwnProperty;return Rh=function(e,r){return null!=e&&t.call(e,r)}}(),e=kv();return Th=function(r,n){return null!=r&&e(r,n,t)}}function Rv(){if(Dh)return Lh;Dh=1;var t=ka(),e=$p(),r=As(),n=Os(),o=Sa(),i=$s(),s=Na(),a=Ea(),u=Object.prototype.hasOwnProperty;return Lh=function(c){if(null==c)return!0;if(o(c)&&(n(c)||"string"==typeof c||"function"==typeof c.splice||i(c)||a(c)||r(c)))return!c.length;var h=e(c);if("[object Map]"==h||"[object Set]"==h)return!c.size;if(s(c))return!t(c).length;for(var l in c)if(u.call(c,l))return!1;return!0}}function Pv(){if(Vh)return qh;return Vh=1,qh=function(t){return void 0===t}}function Tv(){if($h)return Bh;$h=1;var t=nv(),e=Sa();return Bh=function(r,n){var o=-1,i=e(r)?Array(r.length):[];return t(r,function(t,e,r){i[++o]=n(t,e,r)}),i},Bh}function Fv(){if(Uh)return Gh;Uh=1;var t=bv(),e=jv(),r=Tv(),n=Os();return Gh=function(o,i){return(n(o)?t:r)(o,e(i,3))}}function Lv(){if(Jh)return Qh;Jh=1;var t=(Yh||(Yh=1,Wh=function(t,e,r,n){var o=-1,i=null==t?0:t.length;for(n&&i&&(r=t[++o]);++o<i;)r=e(r,t[o],o,t);return r}),Wh),e=nv(),r=jv(),n=(Xh||(Xh=1,Hh=function(t,e,r,n,o){return o(t,function(t,o,i){r=n?(n=!1,t):e(r,t,o,i)}),r}),Hh),o=Os();return Qh=function(i,s,a){var u=o(i)?t:n,c=arguments.length<3;return u(i,r(s,4),a,c,e)},Qh}function Dv(){if(al)return sl;al=1;var t=function(){if(el)return tl;el=1;var t=Av()("length");return tl=t}(),e=function(){if(nl)return rl;nl=1;var t=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");return rl=function(e){return t.test(e)}}(),r=function(){if(il)return ol;il=1;var t="\\ud800-\\udfff",e="["+t+"]",r="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",n="\\ud83c[\\udffb-\\udfff]",o="[^"+t+"]",i="(?:\\ud83c[\\udde6-\\uddff]){2}",s="[\\ud800-\\udbff][\\udc00-\\udfff]",a="(?:"+r+"|"+n+")?",u="[\\ufe0e\\ufe0f]?",c=u+a+"(?:\\u200d(?:"+[o,i,s].join("|")+")"+u+a+")*",h="(?:"+[o+r+"?",r,i,s,e].join("|")+")",l=RegExp(n+"(?="+n+")|"+h+c,"g");return ol=function(t){for(var e=l.lastIndex=0;l.test(t);)++e;return e}}();return sl=function(n){return e(n)?r(n):t(n)}}function qv(){if(cl)return ul;cl=1;var t=ka(),e=$p(),r=Sa(),n=function(){if(Zh)return Kh;Zh=1;var t=ls(),e=Os(),r=zs();return Kh=function(n){return"string"==typeof n||!e(n)&&r(n)&&"[object String]"==t(n)}}(),o=Dv();return ul=function(i){if(null==i)return 0;if(r(i))return n(i)?o(i):i.length;var s=e(i);return"[object Map]"==s||"[object Set]"==s?i.size:t(i).length}}function Vv(){if(ll)return hl;ll=1;var t=Ms(),e=Hp(),r=rv(),n=jv(),o=Lp(),i=Os(),s=$s(),a=fs(),u=ds(),c=Ea();return hl=function(h,l,d){var f=i(h),g=f||s(h)||c(h);if(l=n(l,4),null==d){var p=h&&h.constructor;d=g?f?new p:[]:u(h)&&a(p)?e(o(h)):{}}return(g?t:r)(h,function(t,e,r){return l(d,t,e,r)}),d},hl}function Bv(){if(pl)return gl;pl=1;var t=Fp(),e=function(){if(fl)return dl;fl=1;var t=hs(),e=As(),r=Os(),n=t?t.isConcatSpreadable:void 0;return dl=function(t){return r(t)||e(t)||!!(n&&t&&t[n])}}();return gl=function r(n,o,i,s,a){var u=-1,c=n.length;for(i||(i=e),a||(a=[]);++u<c;){var h=n[u];o>0&&i(h)?o>1?r(h,o-1,i,s,a):t(a,h):s||(a[a.length]=h)}return a},gl}function $v(){if(wl)return yl;wl=1;var t=ml?vl:(ml=1,vl=function(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}),e=Math.max;return yl=function(r,n,o){return n=e(void 0===n?r.length-1:n,0),function(){for(var i=arguments,s=-1,a=e(i.length-n,0),u=Array(a);++s<a;)u[s]=i[n+s];s=-1;for(var c=Array(n+1);++s<n;)c[s]=i[s];return c[n]=o(u),t(r,this,c)}},yl}function Gv(){if(_l)return Nl;_l=1;var t=function(){if(bl)return xl;bl=1;var t=tv(),e=Ns(),r=ov();return xl=e?function(r,n){return e(r,"toString",{configurable:!0,enumerable:!1,value:t(n),writable:!0})}:r}(),e=function(){if(Ml)return El;Ml=1;var t=Date.now;return El=function(e){var r=0,n=0;return function(){var o=t(),i=16-(o-n);if(n=o,i>0){if(++r>=800)return arguments[0]}else r=0;return e.apply(void 0,arguments)}},El}(),r=e(t);return Nl=r}function Uv(){if(Sl)return kl;Sl=1;var t=ov(),e=$v(),r=Gv();return kl=function(n,o){return r(e(n,o,t),n+"")}}function Wv(){if(Al)return zl;return Al=1,zl=function(t,e,r,n){for(var o=t.length,i=r+(n?1:-1);n?i--:++i<o;)if(e(t[i],i,t))return i;return-1},zl}function Yv(){if(Pl)return Rl;Pl=1;var t=Wv(),e=jl?Ol:(jl=1,Ol=function(t){return t!=t}),r=(Il||(Il=1,Cl=function(t,e,r){for(var n=r-1,o=t.length;++n<o;)if(t[n]===e)return n;return-1}),Cl);return Rl=function(n,o,i){return o==o?r(n,o,i):t(n,e,i)}}function Hv(){if($l)return Bl;$l=1;var t=Bp(),e=Vl?ql:(Vl=1,ql=function(){}),r=lv(),n=t&&1/r(new t([,-0]))[1]==1/0?function(e){return new t(e)}:e;return Bl=n}function Xv(){if(Ul)return Gl;Ul=1;var t=uv(),e=function(){if(Fl)return Tl;Fl=1;var t=Yv();return Tl=function(e,r){return!(null==e||!e.length)&&t(e,r,0)>-1}}(),r=(Dl||(Dl=1,Ll=function(t,e,r){for(var n=-1,o=null==t?0:t.length;++n<o;)if(r(e,t[n]))return!0;return!1}),Ll),n=cv(),o=Hv(),i=lv();return Gl=function(s,a,u){var c=-1,h=e,l=s.length,d=!0,f=[],g=f;if(u)d=!1,h=r;else if(l>=200){var p=a?null:o(s);if(p)return i(p);d=!1,h=n,g=new t}else g=a?[]:f;t:for(;++c<l;){var v=s[c],m=a?a(v):v;if(v=u||0!==v?v:0,d&&m==m){for(var y=g.length;y--;)if(g[y]===m)continue t;a&&g.push(m),f.push(v)}else h(g,m,u)||(g!==f&&g.push(m),f.push(v))}return f},Gl}function Qv(){if(Yl)return Wl;Yl=1;var t=Sa(),e=zs();return Wl=function(r){return e(r)&&t(r)}}function Jv(){if(Xl)return Hl;Xl=1;var t=Bv(),e=Uv(),r=Xv(),n=Qv(),o=e(function(e){return r(t(e,1,n,!0))});return Hl=o}function Kv(){if(Zl)return Kl;Zl=1;var t=function(){if(Jl)return Ql;Jl=1;var t=bv();return Ql=function(e,r){return t(r,function(t){return e[t]})}}(),e=za();return Kl=function(r){return null==r?[]:t(r,e(r))}}function Zv(){if(ed)return td;var t;ed=1;try{t={clone:Zp(),constant:tv(),each:av(),filter:Cv(),has:Iv(),isArray:Os(),isEmpty:Rv(),isFunction:fs(),isUndefined:Pv(),keys:za(),map:Fv(),reduce:Lv(),size:qv(),transform:Vv(),union:Jv(),values:Kv()}}catch(t){}return t||(t=window._),td=t}function tm(){if(nd)return rd;nd=1;var t=Zv();rd=r;var e="\0";function r(r){this._isDirected=!t.has(r,"directed")||r.directed,this._isMultigraph=!!t.has(r,"multigraph")&&r.multigraph,this._isCompound=!!t.has(r,"compound")&&r.compound,this._label=void 0,this._defaultNodeLabelFn=t.constant(void 0),this._defaultEdgeLabelFn=t.constant(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[e]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}function n(t,e){t[e]?t[e]++:t[e]=1}function o(t,e){--t[e]||delete t[e]}function i(e,r,n,o){var i=""+r,s=""+n;if(!e&&i>s){var a=i;i=s,s=a}return i+""+s+""+(t.isUndefined(o)?"\0":o)}function s(t,e){return i(t,e.v,e.w,e.name)}return r.prototype._nodeCount=0,r.prototype._edgeCount=0,r.prototype.isDirected=function(){return this._isDirected},r.prototype.isMultigraph=function(){return this._isMultigraph},r.prototype.isCompound=function(){return this._isCompound},r.prototype.setGraph=function(t){return this._label=t,this},r.prototype.graph=function(){return this._label},r.prototype.setDefaultNodeLabel=function(e){return t.isFunction(e)||(e=t.constant(e)),this._defaultNodeLabelFn=e,this},r.prototype.nodeCount=function(){return this._nodeCount},r.prototype.nodes=function(){return t.keys(this._nodes)},r.prototype.sources=function(){var e=this;return t.filter(this.nodes(),function(r){return t.isEmpty(e._in[r])})},r.prototype.sinks=function(){var e=this;return t.filter(this.nodes(),function(r){return t.isEmpty(e._out[r])})},r.prototype.setNodes=function(e,r){var n=arguments,o=this;return t.each(e,function(t){n.length>1?o.setNode(t,r):o.setNode(t)}),this},r.prototype.setNode=function(r,n){return t.has(this._nodes,r)?(arguments.length>1&&(this._nodes[r]=n),this):(this._nodes[r]=arguments.length>1?n:this._defaultNodeLabelFn(r),this._isCompound&&(this._parent[r]=e,this._children[r]={},this._children[e][r]=!0),this._in[r]={},this._preds[r]={},this._out[r]={},this._sucs[r]={},++this._nodeCount,this)},r.prototype.node=function(t){return this._nodes[t]},r.prototype.hasNode=function(e){return t.has(this._nodes,e)},r.prototype.removeNode=function(e){var r=this;if(t.has(this._nodes,e)){var n=function(t){r.removeEdge(r._edgeObjs[t])};delete this._nodes[e],this._isCompound&&(this._removeFromParentsChildList(e),delete this._parent[e],t.each(this.children(e),function(t){r.setParent(t)}),delete this._children[e]),t.each(t.keys(this._in[e]),n),delete this._in[e],delete this._preds[e],t.each(t.keys(this._out[e]),n),delete this._out[e],delete this._sucs[e],--this._nodeCount}return this},r.prototype.setParent=function(r,n){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(t.isUndefined(n))n=e;else{for(var o=n+="";!t.isUndefined(o);o=this.parent(o))if(o===r)throw new Error("Setting "+n+" as parent of "+r+" would create a cycle");this.setNode(n)}return this.setNode(r),this._removeFromParentsChildList(r),this._parent[r]=n,this._children[n][r]=!0,this},r.prototype._removeFromParentsChildList=function(t){delete this._children[this._parent[t]][t]},r.prototype.parent=function(t){if(this._isCompound){var r=this._parent[t];if(r!==e)return r}},r.prototype.children=function(r){if(t.isUndefined(r)&&(r=e),this._isCompound){var n=this._children[r];if(n)return t.keys(n)}else{if(r===e)return this.nodes();if(this.hasNode(r))return[]}},r.prototype.predecessors=function(e){var r=this._preds[e];if(r)return t.keys(r)},r.prototype.successors=function(e){var r=this._sucs[e];if(r)return t.keys(r)},r.prototype.neighbors=function(e){var r=this.predecessors(e);if(r)return t.union(r,this.successors(e))},r.prototype.isLeaf=function(t){return 0===(this.isDirected()?this.successors(t):this.neighbors(t)).length},r.prototype.filterNodes=function(e){var r=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});r.setGraph(this.graph());var n=this;t.each(this._nodes,function(t,n){e(n)&&r.setNode(n,t)}),t.each(this._edgeObjs,function(t){r.hasNode(t.v)&&r.hasNode(t.w)&&r.setEdge(t,n.edge(t))});var o={};function i(t){var e=n.parent(t);return void 0===e||r.hasNode(e)?(o[t]=e,e):e in o?o[e]:i(e)}return this._isCompound&&t.each(r.nodes(),function(t){r.setParent(t,i(t))}),r},r.prototype.setDefaultEdgeLabel=function(e){return t.isFunction(e)||(e=t.constant(e)),this._defaultEdgeLabelFn=e,this},r.prototype.edgeCount=function(){return this._edgeCount},r.prototype.edges=function(){return t.values(this._edgeObjs)},r.prototype.setPath=function(e,r){var n=this,o=arguments;return t.reduce(e,function(t,e){return o.length>1?n.setEdge(t,e,r):n.setEdge(t,e),e}),this},r.prototype.setEdge=function(){var e,r,o,s,a=!1,u=arguments[0];"object"==typeof u&&null!==u&&"v"in u?(e=u.v,r=u.w,o=u.name,2===arguments.length&&(s=arguments[1],a=!0)):(e=u,r=arguments[1],o=arguments[3],arguments.length>2&&(s=arguments[2],a=!0)),e=""+e,r=""+r,t.isUndefined(o)||(o=""+o);var c=i(this._isDirected,e,r,o);if(t.has(this._edgeLabels,c))return a&&(this._edgeLabels[c]=s),this;if(!t.isUndefined(o)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(e),this.setNode(r),this._edgeLabels[c]=a?s:this._defaultEdgeLabelFn(e,r,o);var h=function(t,e,r,n){var o=""+e,i=""+r;if(!t&&o>i){var s=o;o=i,i=s}var a={v:o,w:i};n&&(a.name=n);return a}(this._isDirected,e,r,o);return e=h.v,r=h.w,Object.freeze(h),this._edgeObjs[c]=h,n(this._preds[r],e),n(this._sucs[e],r),this._in[r][c]=h,this._out[e][c]=h,this._edgeCount++,this},r.prototype.edge=function(t,e,r){var n=1===arguments.length?s(this._isDirected,arguments[0]):i(this._isDirected,t,e,r);return this._edgeLabels[n]},r.prototype.hasEdge=function(e,r,n){var o=1===arguments.length?s(this._isDirected,arguments[0]):i(this._isDirected,e,r,n);return t.has(this._edgeLabels,o)},r.prototype.removeEdge=function(t,e,r){var n=1===arguments.length?s(this._isDirected,arguments[0]):i(this._isDirected,t,e,r),a=this._edgeObjs[n];return a&&(t=a.v,e=a.w,delete this._edgeLabels[n],delete this._edgeObjs[n],o(this._preds[e],t),o(this._sucs[t],e),delete this._in[e][n],delete this._out[t][n],this._edgeCount--),this},r.prototype.inEdges=function(e,r){var n=this._in[e];if(n){var o=t.values(n);return r?t.filter(o,function(t){return t.v===r}):o}},r.prototype.outEdges=function(e,r){var n=this._out[e];if(n){var o=t.values(n);return r?t.filter(o,function(t){return t.w===r}):o}},r.prototype.nodeEdges=function(t,e){var r=this.inEdges(t,e);if(r)return r.concat(this.outEdges(t,e))},rd}function em(){return ad?sd:(ad=1,sd={Graph:tm(),version:id?od:(id=1,od="2.1.8")})}function rm(){if(cd)return ud;cd=1;var t=Zv(),e=tm();function r(e){return t.map(e.nodes(),function(r){var n=e.node(r),o=e.parent(r),i={v:r};return t.isUndefined(n)||(i.value=n),t.isUndefined(o)||(i.parent=o),i})}function n(e){return t.map(e.edges(),function(r){var n=e.edge(r),o={v:r.v,w:r.w};return t.isUndefined(r.name)||(o.name=r.name),t.isUndefined(n)||(o.value=n),o})}return ud={write:function(e){var o={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:r(e),edges:n(e)};t.isUndefined(e.graph())||(o.value=t.clone(e.graph()));return o},read:function(r){var n=new e(r.options).setGraph(r.value);return t.each(r.nodes,function(t){n.setNode(t.v,t.value),t.parent&&n.setParent(t.v,t.parent)}),t.each(r.edges,function(t){n.setEdge({v:t.v,w:t.w,name:t.name},t.value)}),n}}}function nm(){if(ld)return hd;ld=1;var t=Zv();return hd=function(e){var r,n={},o=[];function i(o){t.has(n,o)||(n[o]=!0,r.push(o),t.each(e.successors(o),i),t.each(e.predecessors(o),i))}return t.each(e.nodes(),function(t){r=[],i(t),r.length&&o.push(r)}),o},hd}function om(){if(fd)return dd;fd=1;var t=Zv();function e(){this._arr=[],this._keyIndices={}}return dd=e,e.prototype.size=function(){return this._arr.length},e.prototype.keys=function(){return this._arr.map(function(t){return t.key})},e.prototype.has=function(e){return t.has(this._keyIndices,e)},e.prototype.priority=function(t){var e=this._keyIndices[t];if(void 0!==e)return this._arr[e].priority},e.prototype.min=function(){if(0===this.size())throw new Error("Queue underflow");return this._arr[0].key},e.prototype.add=function(e,r){var n=this._keyIndices;if(e=String(e),!t.has(n,e)){var o=this._arr,i=o.length;return n[e]=i,o.push({key:e,priority:r}),this._decrease(i),!0}return!1},e.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var t=this._arr.pop();return delete this._keyIndices[t.key],this._heapify(0),t.key},e.prototype.decrease=function(t,e){var r=this._keyIndices[t];if(e>this._arr[r].priority)throw new Error("New priority is greater than current priority. Key: "+t+" Old: "+this._arr[r].priority+" New: "+e);this._arr[r].priority=e,this._decrease(r)},e.prototype._heapify=function(t){var e=this._arr,r=2*t,n=r+1,o=t;r<e.length&&(o=e[r].priority<e[o].priority?r:o,n<e.length&&(o=e[n].priority<e[o].priority?n:o),o!==t&&(this._swap(t,o),this._heapify(o)))},e.prototype._decrease=function(t){for(var e,r=this._arr,n=r[t].priority;0!==t&&!(r[e=t>>1].priority<n);)this._swap(t,e),t=e},e.prototype._swap=function(t,e){var r=this._arr,n=this._keyIndices,o=r[t],i=r[e];r[t]=i,r[e]=o,n[i.key]=t,n[o.key]=e},dd}function im(){if(pd)return gd;pd=1;var t=Zv(),e=om();gd=function(t,n,o,i){return function(t,r,n,o){var i,s,a={},u=new e,c=function(t){var e=t.v!==i?t.v:t.w,r=a[e],o=n(t),c=s.distance+o;if(o<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+t+" Weight: "+o);c<r.distance&&(r.distance=c,r.predecessor=i,u.decrease(e,c))};t.nodes().forEach(function(t){var e=t===r?0:Number.POSITIVE_INFINITY;a[t]={distance:e},u.add(t,e)});for(;u.size()>0&&(i=u.removeMin(),(s=a[i]).distance!==Number.POSITIVE_INFINITY);)o(i).forEach(c);return a}(t,String(n),o||r,i||function(e){return t.outEdges(e)})};var r=t.constant(1);return gd}function sm(){if(md)return vd;md=1;var t=im(),e=Zv();return vd=function(r,n,o){return e.transform(r.nodes(),function(e,i){e[i]=t(r,i,n,o)},{})}}function am(){if(wd)return yd;wd=1;var t=Zv();return yd=function(e){var r=0,n=[],o={},i=[];function s(a){var u=o[a]={onStack:!0,lowlink:r,index:r++};if(n.push(a),e.successors(a).forEach(function(e){t.has(o,e)?o[e].onStack&&(u.lowlink=Math.min(u.lowlink,o[e].index)):(s(e),u.lowlink=Math.min(u.lowlink,o[e].lowlink))}),u.lowlink===u.index){var c,h=[];do{c=n.pop(),o[c].onStack=!1,h.push(c)}while(a!==c);i.push(h)}}return e.nodes().forEach(function(e){t.has(o,e)||s(e)}),i},yd}function um(){if(bd)return xd;bd=1;var t=Zv(),e=am();return xd=function(r){return t.filter(e(r),function(t){return t.length>1||1===t.length&&r.hasEdge(t[0],t[0])})}}function cm(){if(Md)return Ed;Md=1;var t=Zv();Ed=function(t,r,n){return function(t,e,r){var n={},o=t.nodes();return o.forEach(function(t){n[t]={},n[t][t]={distance:0},o.forEach(function(e){t!==e&&(n[t][e]={distance:Number.POSITIVE_INFINITY})}),r(t).forEach(function(r){var o=r.v===t?r.w:r.v,i=e(r);n[t][o]={distance:i,predecessor:t}})}),o.forEach(function(t){var e=n[t];o.forEach(function(r){var i=n[r];o.forEach(function(r){var n=i[t],o=e[r],s=i[r],a=n.distance+o.distance;a<s.distance&&(s.distance=a,s.predecessor=o.predecessor)})})}),n}(t,r||e,n||function(e){return t.outEdges(e)})};var e=t.constant(1);return Ed}function hm(){if(_d)return Nd;_d=1;var t=Zv();function e(e){var n={},o={},i=[];if(t.each(e.sinks(),function s(a){if(t.has(o,a))throw new r;t.has(n,a)||(o[a]=!0,n[a]=!0,t.each(e.predecessors(a),s),delete o[a],i.push(a))}),t.size(n)!==e.nodeCount())throw new r;return i}function r(){}return Nd=e,e.CycleException=r,r.prototype=new Error,Nd}function lm(){if(Sd)return kd;Sd=1;var t=hm();return kd=function(e){try{t(e)}catch(e){if(e instanceof t.CycleException)return!1;throw e}return!0}}function dm(){if(Ad)return zd;Ad=1;var t=Zv();function e(r,n,o,i,s,a){t.has(i,n)||(i[n]=!0,o||a.push(n),t.each(s(n),function(t){e(r,t,o,i,s,a)}),o&&a.push(n))}return zd=function(r,n,o){t.isArray(n)||(n=[n]);var i=(r.isDirected()?r.successors:r.neighbors).bind(r),s=[],a={};return t.each(n,function(t){if(!r.hasNode(t))throw new Error("Graph does not have node: "+t);e(r,t,"post"===o,a,i,s)}),s},zd}function fm(){if(jd)return Od;jd=1;var t=dm();return Od=function(e,r){return t(e,r,"post")}}function gm(){if(Id)return Cd;Id=1;var t=dm();return Cd=function(e,r){return t(e,r,"pre")}}function pm(){if(Pd)return Rd;Pd=1;var t=Zv(),e=tm(),r=om();return Rd=function(n,o){var i,s=new e,a={},u=new r;function c(t){var e=t.v===i?t.w:t.v,r=u.priority(e);if(void 0!==r){var n=o(t);n<r&&(a[e]=i,u.decrease(e,n))}}if(0===n.nodeCount())return s;t.each(n.nodes(),function(t){u.add(t,Number.POSITIVE_INFINITY),s.setNode(t)}),u.decrease(n.nodes()[0],0);var h=!1;for(;u.size()>0;){if(i=u.removeMin(),t.has(a,i))s.setEdge(i,a[i]);else{if(h)throw new Error("Input graph is not connected: "+n);h=!0}n.nodeEdges(i).forEach(c)}return s}}function vm(){if(Dd)return Ld;Dd=1;var t=em();return Ld={Graph:t.Graph,json:rm(),alg:Fd?Td:(Fd=1,Td={components:nm(),dijkstra:im(),dijkstraAll:sm(),findCycles:um(),floydWarshall:cm(),isAcyclic:lm(),postorder:fm(),preorder:gm(),prim:pm(),tarjan:am(),topsort:hm()}),version:t.version}}function mm(){if(Vd)return qd;var t;Vd=1;try{t=vm()}catch(t){}return t||(t=window.graphlib),qd=t}function ym(){if($d)return Bd;$d=1;var t=Kp();return Bd=function(e){return t(e,5)}}function wm(){if(Ud)return Gd;Ud=1;var t=is(),e=Sa(),r=Gs(),n=ds();return Gd=function(o,i,s){if(!n(s))return!1;var a=typeof i;return!!("number"==a?e(s)&&r(i,s.length):"string"==a&&i in s)&&t(s[i],o)},Gd}function xm(){if(Yd)return Wd;Yd=1;var t=Uv(),e=is(),r=wm(),n=Oa(),o=Object.prototype,i=o.hasOwnProperty,s=t(function(t,s){t=Object(t);var a=-1,u=s.length,c=u>2?s[2]:void 0;for(c&&r(s[0],s[1],c)&&(u=1);++a<u;)for(var h=s[a],l=n(h),d=-1,f=l.length;++d<f;){var g=l[d],p=t[g];(void 0===p||e(p,o[g])&&!i.call(t,g))&&(t[g]=h[g])}return t});return Wd=s}function bm(){if(Zd)return Kd;Zd=1;var t=function(){if(Jd)return Qd;Jd=1;var t=/\s/;return Qd=function(e){for(var r=e.length;r--&&t.test(e.charAt(r)););return r},Qd}(),e=/^\s+/;return Kd=function(r){return r?r.slice(0,t(r)+1).replace(e,""):r}}function Em(){if(nf)return rf;nf=1;var t=function(){if(ef)return tf;ef=1;var t=bm(),e=ds(),r=yv(),n=/^[-+]0x[0-9a-f]+$/i,o=/^0b[01]+$/i,i=/^0o[0-7]+$/i,s=parseInt;return tf=function(a){if("number"==typeof a)return a;if(r(a))return NaN;if(e(a)){var u="function"==typeof a.valueOf?a.valueOf():a;a=e(u)?u+"":u}if("string"!=typeof a)return 0===a?a:+a;a=t(a);var c=o.test(a);return c||i.test(a)?s(a.slice(2),c?2:8):n.test(a)?NaN:+a}}(),e=1/0;return rf=function(r){return r?(r=t(r))===e||r===-1/0?17976931348623157e292*(r<0?-1:1):r==r?r:0:0===r?r:0}}function Mm(){if(uf)return af;uf=1;var t=Wv(),e=jv(),r=function(){if(sf)return of;sf=1;var t=Em();return of=function(e){var r=t(e),n=r%1;return r==r?n?r-n:r:0}}(),n=Math.max;return af=function(o,i,s){var a=null==o?0:o.length;if(!a)return-1;var u=null==s?0:r(s);return u<0&&(u=n(a+u,0)),t(o,e(i,3),u)},af}function Nm(){if(hf)return cf;hf=1;var t=function(){if(Xd)return Hd;Xd=1;var t=jv(),e=Sa(),r=za();return Hd=function(n){return function(o,i,s){var a=Object(o);if(!e(o)){var u=t(i,3);o=r(o),i=function(t){return u(a[t],t,a)}}var c=n(o,i,s);return c>-1?a[u?o[c]:c]:void 0}},Hd}(),e=t(Mm());return cf=e}function _m(){if(df)return lf;df=1;var t=Bv();return lf=function(e){return(null==e?0:e.length)?t(e,1):[]}}function km(){if(gf)return ff;gf=1;var t=ev(),e=iv(),r=Oa();return ff=function(n,o){return null==n?n:t(n,e(o),r)}}function Sm(){if(vf)return pf;return vf=1,pf=function(t){var e=null==t?0:t.length;return e?t[e-1]:void 0}}function zm(){if(yf)return mf;yf=1;var t=_s(),e=rv(),r=jv();return mf=function(n,o){var i={};return o=r(o,3),e(n,function(e,r,n){t(i,r,o(e,r,n))}),i}}function Am(){if(xf)return wf;xf=1;var t=yv();return wf=function(e,r,n){for(var o=-1,i=e.length;++o<i;){var s=e[o],a=r(s);if(null!=a&&(void 0===u?a==a&&!t(a):n(a,u)))var u=a,c=s}return c},wf}function Om(){if(Nf)return Mf;Nf=1;var t=Am(),e=Ef?bf:(Ef=1,bf=function(t,e){return t>e}),r=ov();return Mf=function(n){return n&&n.length?t(n,r,e):void 0}}function jm(){if(kf)return _f;kf=1;var t=_s(),e=is();return _f=function(r,n,o){(void 0!==o&&!e(r[n],o)||void 0===o&&!(n in r))&&t(r,n,o)}}function Cm(){if(Of)return Af;return Of=1,Af=function(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}}function Im(){if(Rf)return If;Rf=1;var t=jm(),e=Cp(),r=Wp(),n=Ip(),o=Xp(),i=As(),s=Os(),a=Qv(),u=$s(),c=fs(),h=ds(),l=function(){if(zf)return Sf;zf=1;var t=ls(),e=Lp(),r=zs(),n=Function.prototype,o=Object.prototype,i=n.toString,s=o.hasOwnProperty,a=i.call(Object);return Sf=function(n){if(!r(n)||"[object Object]"!=t(n))return!1;var o=e(n);if(null===o)return!0;var u=s.call(o,"constructor")&&o.constructor;return"function"==typeof u&&u instanceof u&&i.call(u)==a}}(),d=Ea(),f=Cm(),g=function(){if(Cf)return jf;Cf=1;var t=Ss(),e=Oa();return jf=function(r){return t(r,e(r))}}();return If=function(p,v,m,y,w,x,b){var E=f(p,m),M=f(v,m),N=b.get(M);if(N)t(p,m,N);else{var _=x?x(E,M,m+"",p,v,b):void 0,k=void 0===_;if(k){var S=s(M),z=!S&&u(M),A=!S&&!z&&d(M);_=M,S||z||A?s(E)?_=E:a(E)?_=n(E):z?(k=!1,_=e(M,!0)):A?(k=!1,_=r(M,!0)):_=[]:l(M)||i(M)?(_=E,i(E)?_=g(E):h(E)&&!c(E)||(_=o(M))):k=!1}k&&(b.set(M,_),w(_,M,y,x,b),b.delete(M)),t(p,m,_)}}}function Rm(){if(qf)return Df;qf=1;var t=function(){if(Tf)return Pf;Tf=1;var t=Es(),e=jm(),r=ev(),n=Im(),o=ds(),i=Oa(),s=Cm();return Pf=function a(u,c,h,l,d){u!==c&&r(c,function(r,i){if(d||(d=new t),o(r))n(u,c,i,h,a,l,d);else{var f=l?l(s(u,i),r,i+"",u,c,d):void 0;void 0===f&&(f=r),e(u,i,f)}},i)},Pf}(),e=function(){if(Lf)return Ff;Lf=1;var t=Uv(),e=wm();return Ff=function(r){return t(function(t,n){var o=-1,i=n.length,s=i>1?n[i-1]:void 0,a=i>2?n[2]:void 0;for(s=r.length>3&&"function"==typeof s?(i--,s):void 0,a&&e(n[0],n[1],a)&&(s=i<3?void 0:s,i=1),t=Object(t);++o<i;){var u=n[o];u&&r(t,u,o,s)}return t})},Ff}(),r=e(function(e,r,n){t(e,r,n)});return Df=r}function Pm(){if(Bf)return Vf;return Bf=1,Vf=function(t,e){return t<e}}function Tm(){if(Gf)return $f;Gf=1;var t=Am(),e=Pm(),r=ov();return $f=function(n){return n&&n.length?t(n,r,e):void 0}}function Fm(){if(Wf)return Uf;Wf=1;var t=Am(),e=jv(),r=Pm();return Uf=function(n,o){return n&&n.length?t(n,e(o,2),r):void 0}}function Lm(){if(Hf)return Yf;Hf=1;var t=cs();return Yf=function(){return t.Date.now()}}function Dm(){if(Kf)return Jf;Kf=1;var t=_v(),e=function(){if(Qf)return Xf;Qf=1;var t=ks(),e=Mv(),r=Gs(),n=ds(),o=Nv();return Xf=function(i,s,a,u){if(!n(i))return i;for(var c=-1,h=(s=e(s,i)).length,l=h-1,d=i;null!=d&&++c<h;){var f=o(s[c]),g=a;if("__proto__"===f||"constructor"===f||"prototype"===f)return i;if(c!=l){var p=d[f];void 0===(g=u?u(p,f,d):void 0)&&(g=n(p)?p:r(s[c+1])?[]:{})}t(d,f,g),d=d[f]}return i},Xf}(),r=Mv();return Jf=function(n,o,i){for(var s=-1,a=o.length,u={};++s<a;){var c=o[s],h=t(n,c);i(h,c)&&e(u,r(c,n),h)}return u},Jf}function qm(){if(og)return ng;og=1;var t=function(){if(tg)return Zf;tg=1;var t=Dm(),e=Sv();return Zf=function(r,n){return t(r,n,function(t,n){return e(r,n)})}}(),e=function(){if(rg)return eg;rg=1;var t=_m(),e=$v(),r=Gv();return eg=function(n){return r(e(n,void 0,t),n+"")}}()(function(e,r){return null==e?{}:t(e,r)});return ng=e}function Vm(){if(ug)return ag;ug=1;var t=function(){if(sg)return ig;sg=1;var t=Math.ceil,e=Math.max;return ig=function(r,n,o,i){for(var s=-1,a=e(t((n-r)/(o||1)),0),u=Array(a);a--;)u[i?a:++s]=r,r+=o;return u},ig}(),e=wm(),r=Em();return ag=function(n){return function(o,i,s){return s&&"number"!=typeof s&&e(o,i,s)&&(i=s=void 0),o=r(o),void 0===i?(i=o,o=0):i=r(i),s=void 0===s?o<i?1:-1:r(s),t(o,i,s,n)}}}function Bm(){if(hg)return cg;hg=1;var t=Vm()();return cg=t}function $m(){if(vg)return pg;vg=1;var t=function(){if(gg)return fg;gg=1;var t=yv();return fg=function(e,r){if(e!==r){var n=void 0!==e,o=null===e,i=e==e,s=t(e),a=void 0!==r,u=null===r,c=r==r,h=t(r);if(!u&&!h&&!s&&e>r||s&&a&&c&&!u&&!h||o&&a&&c||!n&&c||!i)return 1;if(!o&&!s&&!h&&e<r||h&&n&&i&&!o&&!s||u&&n&&i||!a&&i||!c)return-1}return 0}}();return pg=function(e,r,n){for(var o=-1,i=e.criteria,s=r.criteria,a=i.length,u=n.length;++o<a;){var c=t(i[o],s[o]);if(c)return o>=u?c:c*("desc"==n[o]?-1:1)}return e.index-r.index},pg}function Gm(){if(yg)return mg;yg=1;var t=bv(),e=_v(),r=jv(),n=Tv(),o=dg?lg:(dg=1,lg=function(t,e){var r=t.length;for(t.sort(e);r--;)t[r]=t[r].value;return t}),i=Ws(),s=$m(),a=ov(),u=Os();return mg=function(c,h,l){h=h.length?t(h,function(t){return u(t)?function(r){return e(r,1===t.length?t[0]:t)}:t}):[a];var d=-1;h=t(h,i(r));var f=n(c,function(e,r,n){return{criteria:t(h,function(t){return t(e)}),index:++d,value:e}});return o(f,function(t,e){return s(t,e,l)})},mg}function Um(){if(xg)return wg;xg=1;var t=Bv(),e=Gm(),r=Uv(),n=wm(),o=r(function(r,o){if(null==r)return[];var i=o.length;return i>1&&n(r,o[0],o[1])?o=[]:i>2&&n(o[0],o[1],o[2])&&(o=[o[0]]),e(r,t(o,1),[])});return wg=o}function Wm(){if(Eg)return bg;Eg=1;var t=Ev(),e=0;return bg=function(r){var n=++e;return t(r)+n}}function Ym(){if(kg)return _g;kg=1;var t=ks(),e=(Ng||(Ng=1,Mg=function(t,e,r){for(var n=-1,o=t.length,i=e.length,s={};++n<o;){var a=n<i?e[n]:void 0;r(s,t[n],a)}return s}),Mg);return _g=function(r,n){return e(r||[],n||[],t)}}function Hm(){if(zg)return Sg;var t;zg=1;try{t={cloneDeep:ym(),constant:tv(),defaults:xm(),each:av(),filter:Cv(),find:Nm(),flatten:_m(),forEach:sv(),forIn:km(),has:Iv(),isUndefined:Pv(),last:Sm(),map:Fv(),mapValues:zm(),max:Om(),merge:Rm(),min:Tm(),minBy:Fm(),now:Lm(),pick:qm(),range:Bm(),reduce:Lv(),sortBy:Um(),uniqueId:Wm(),values:Kv(),zipObject:Ym()}}catch(t){}return t||(t=window._),Sg=t}function Xm(){if(Cg)return jg;Cg=1;var t=Hm(),e=mm().Graph,r=function(){if(Og)return Ag;function t(){var t={};t._next=t._prev=t,this._sentinel=t}function e(t){t._prev._next=t._next,t._next._prev=t._prev,delete t._next,delete t._prev}function r(t,e){if("_next"!==t&&"_prev"!==t)return e}return Og=1,Ag=t,t.prototype.dequeue=function(){var t=this._sentinel,r=t._prev;if(r!==t)return e(r),r},t.prototype.enqueue=function(t){var r=this._sentinel;t._prev&&t._next&&e(t),t._next=r._next,r._next._prev=t,r._next=t,t._prev=r},t.prototype.toString=function(){for(var t=[],e=this._sentinel,n=e._prev;n!==e;)t.push(JSON.stringify(n,r)),n=n._prev;return"["+t.join(", ")+"]"},Ag}();jg=function(s,a){if(s.nodeCount()<=1)return[];var u=function(n,o){var s=new e,a=0,u=0;t.forEach(n.nodes(),function(t){s.setNode(t,{v:t,in:0,out:0})}),t.forEach(n.edges(),function(t){var e=s.edge(t.v,t.w)||0,r=o(t),n=e+r;s.setEdge(t.v,t.w,n),u=Math.max(u,s.node(t.v).out+=r),a=Math.max(a,s.node(t.w).in+=r)});var c=t.range(u+a+3).map(function(){return new r}),h=a+1;return t.forEach(s.nodes(),function(t){i(c,h,s.node(t))}),{graph:s,buckets:c,zeroIdx:h}}(s,a||n),c=function(t,e,r){var n,i=[],s=e[e.length-1],a=e[0];for(;t.nodeCount();){for(;n=a.dequeue();)o(t,e,r,n);for(;n=s.dequeue();)o(t,e,r,n);if(t.nodeCount())for(var u=e.length-2;u>0;--u)if(n=e[u].dequeue()){i=i.concat(o(t,e,r,n,!0));break}}return i}(u.graph,u.buckets,u.zeroIdx);return t.flatten(t.map(c,function(t){return s.outEdges(t.v,t.w)}),!0)};var n=t.constant(1);function o(e,r,n,o,s){var a=s?[]:void 0;return t.forEach(e.inEdges(o.v),function(t){var o=e.edge(t),u=e.node(t.v);s&&a.push({v:t.v,w:t.w}),u.out-=o,i(r,n,u)}),t.forEach(e.outEdges(o.v),function(t){var o=e.edge(t),s=t.w,a=e.node(s);a.in-=o,i(r,n,a)}),e.removeNode(o.v),a}function i(t,e,r){r.out?r.in?t[r.out-r.in+e].enqueue(r):t[t.length-1].enqueue(r):t[0].enqueue(r)}return jg}function Qm(){if(Rg)return Ig;Rg=1;var t=Hm(),e=Xm();return Ig={run:function(r){var n="greedy"===r.graph().acyclicer?e(r,function(t){return function(e){return t.edge(e).weight}}(r)):function(e){var r=[],n={},o={};function i(s){t.has(o,s)||(o[s]=!0,n[s]=!0,t.forEach(e.outEdges(s),function(e){t.has(n,e.w)?r.push(e):i(e.w)}),delete n[s])}return t.forEach(e.nodes(),i),r}(r);t.forEach(n,function(e){var n=r.edge(e);r.removeEdge(e),n.forwardName=e.name,n.reversed=!0,r.setEdge(e.w,e.v,n,t.uniqueId("rev"))})},undo:function(e){t.forEach(e.edges(),function(t){var r=e.edge(t);if(r.reversed){e.removeEdge(t);var n=r.forwardName;delete r.reversed,delete r.forwardName,e.setEdge(t.w,t.v,r,n)}})}},Ig}function Jm(){if(Tg)return Pg;Tg=1;var t=Hm(),e=mm().Graph;function r(e,r,n,o){var i;do{i=t.uniqueId(o)}while(e.hasNode(i));return n.dummy=r,e.setNode(i,n),i}function n(e){return t.max(t.map(e.nodes(),function(r){var n=e.node(r).rank;if(!t.isUndefined(n))return n}))}return Pg={addDummyNode:r,simplify:function(r){var n=(new e).setGraph(r.graph());return t.forEach(r.nodes(),function(t){n.setNode(t,r.node(t))}),t.forEach(r.edges(),function(t){var e=n.edge(t.v,t.w)||{weight:0,minlen:1},o=r.edge(t);n.setEdge(t.v,t.w,{weight:e.weight+o.weight,minlen:Math.max(e.minlen,o.minlen)})}),n},asNonCompoundGraph:function(r){var n=new e({multigraph:r.isMultigraph()}).setGraph(r.graph());return t.forEach(r.nodes(),function(t){r.children(t).length||n.setNode(t,r.node(t))}),t.forEach(r.edges(),function(t){n.setEdge(t,r.edge(t))}),n},successorWeights:function(e){var r=t.map(e.nodes(),function(r){var n={};return t.forEach(e.outEdges(r),function(t){n[t.w]=(n[t.w]||0)+e.edge(t).weight}),n});return t.zipObject(e.nodes(),r)},predecessorWeights:function(e){var r=t.map(e.nodes(),function(r){var n={};return t.forEach(e.inEdges(r),function(t){n[t.v]=(n[t.v]||0)+e.edge(t).weight}),n});return t.zipObject(e.nodes(),r)},intersectRect:function(t,e){var r,n,o=t.x,i=t.y,s=e.x-o,a=e.y-i,u=t.width/2,c=t.height/2;if(!s&&!a)throw new Error("Not possible to find intersection inside of the rectangle");Math.abs(a)*u>Math.abs(s)*c?(a<0&&(c=-c),r=c*s/a,n=c):(s<0&&(u=-u),r=u,n=u*a/s);return{x:o+r,y:i+n}},buildLayerMatrix:function(e){var r=t.map(t.range(n(e)+1),function(){return[]});return t.forEach(e.nodes(),function(n){var o=e.node(n),i=o.rank;t.isUndefined(i)||(r[i][o.order]=n)}),r},normalizeRanks:function(e){var r=t.min(t.map(e.nodes(),function(t){return e.node(t).rank}));t.forEach(e.nodes(),function(n){var o=e.node(n);t.has(o,"rank")&&(o.rank-=r)})},removeEmptyRanks:function(e){var r=t.min(t.map(e.nodes(),function(t){return e.node(t).rank})),n=[];t.forEach(e.nodes(),function(t){var o=e.node(t).rank-r;n[o]||(n[o]=[]),n[o].push(t)});var o=0,i=e.graph().nodeRankFactor;t.forEach(n,function(r,n){t.isUndefined(r)&&n%i!==0?--o:o&&t.forEach(r,function(t){e.node(t).rank+=o})})},addBorderNode:function(t,e,n,o){var i={width:0,height:0};arguments.length>=4&&(i.rank=n,i.order=o);return r(t,"border",i,e)},maxRank:n,partition:function(e,r){var n={lhs:[],rhs:[]};return t.forEach(e,function(t){r(t)?n.lhs.push(t):n.rhs.push(t)}),n},time:function(e,r){var n=t.now();try{return r()}finally{console.log(e+" time: "+(t.now()-n)+"ms")}},notime:function(t,e){return e()}},Pg}function Km(){if(Lg)return Fg;Lg=1;var t=Hm(),e=Jm();return Fg={run:function(r){r.graph().dummyChains=[],t.forEach(r.edges(),function(t){!function(t,r){var n,o,i,s=r.v,a=t.node(s).rank,u=r.w,c=t.node(u).rank,h=r.name,l=t.edge(r),d=l.labelRank;if(c===a+1)return;for(t.removeEdge(r),i=0,++a;a<c;++i,++a)l.points=[],o={width:0,height:0,edgeLabel:l,edgeObj:r,rank:a},n=e.addDummyNode(t,"edge",o,"_d"),a===d&&(o.width=l.width,o.height=l.height,o.dummy="edge-label",o.labelpos=l.labelpos),t.setEdge(s,n,{weight:l.weight},h),0===i&&t.graph().dummyChains.push(n),s=n;t.setEdge(s,u,{weight:l.weight},h)}(r,t)})},undo:function(e){t.forEach(e.graph().dummyChains,function(t){var r,n=e.node(t),o=n.edgeLabel;for(e.setEdge(n.edgeObj,o);n.dummy;)r=e.successors(t)[0],e.removeNode(t),o.points.push({x:n.x,y:n.y}),"edge-label"===n.dummy&&(o.x=n.x,o.y=n.y,o.width=n.width,o.height=n.height),t=r,n=e.node(t)})}}}function Zm(){if(qg)return Dg;qg=1;var t=Hm();return Dg={longestPath:function(e){var r={};t.forEach(e.sources(),function n(o){var i=e.node(o);if(t.has(r,o))return i.rank;r[o]=!0;var s=t.min(t.map(e.outEdges(o),function(t){return n(t.w)-e.edge(t).minlen}));return s!==Number.POSITIVE_INFINITY&&null!=s||(s=0),i.rank=s})},slack:function(t,e){return t.node(e.w).rank-t.node(e.v).rank-t.edge(e).minlen}},Dg}function ty(){if(Bg)return Vg;Bg=1;var t=Hm(),e=mm().Graph,r=Zm().slack;function n(e,n){return t.forEach(e.nodes(),function o(i){t.forEach(n.nodeEdges(i),function(t){var s=t.v,a=i===s?t.w:s;e.hasNode(a)||r(n,t)||(e.setNode(a,{}),e.setEdge(i,a,{}),o(a))})}),e.nodeCount()}function o(e,n){return t.minBy(n.edges(),function(t){if(e.hasNode(t.v)!==e.hasNode(t.w))return r(n,t)})}function i(e,r,n){t.forEach(e.nodes(),function(t){r.node(t).rank+=n})}return Vg=function(t){var s,a,u=new e({directed:!1}),c=t.nodes()[0],h=t.nodeCount();u.setNode(c,{});for(;n(u,t)<h;)s=o(u,t),a=u.hasNode(s.v)?r(t,s):-r(t,s),i(u,t,a);return u}}function ey(){if(Gg)return $g;Gg=1;var t=Hm(),e=ty(),r=Zm().slack,n=Zm().longestPath,o=mm().alg.preorder,i=mm().alg.postorder,s=Jm().simplify;function a(t){t=s(t),n(t);var r,o=e(t);for(h(o),u(o,t);r=d(o);)g(o,t,r,f(o,t,r))}function u(e,r){var n=i(e,e.nodes());n=n.slice(0,n.length-1),t.forEach(n,function(t){!function(t,e,r){var n=t.node(r),o=n.parent;t.edge(r,o).cutvalue=c(t,e,r)}(e,r,t)})}function c(e,r,n){var o=e.node(n).parent,i=!0,s=r.edge(n,o),a=0;return s||(i=!1,s=r.edge(o,n)),a=s.weight,t.forEach(r.nodeEdges(n),function(t){var s,u,c=t.v===n,h=c?t.w:t.v;if(h!==o){var l=c===i,d=r.edge(t).weight;if(a+=l?d:-d,s=n,u=h,e.hasEdge(s,u)){var f=e.edge(n,h).cutvalue;a+=l?-f:f}}}),a}function h(t,e){arguments.length<2&&(e=t.nodes()[0]),l(t,{},1,e)}function l(e,r,n,o,i){var s=n,a=e.node(o);return r[o]=!0,t.forEach(e.neighbors(o),function(i){t.has(r,i)||(n=l(e,r,n,i,o))}),a.low=s,a.lim=n++,i?a.parent=i:delete a.parent,n}function d(e){return t.find(e.edges(),function(t){return e.edge(t).cutvalue<0})}function f(e,n,o){var i=o.v,s=o.w;n.hasEdge(i,s)||(i=o.w,s=o.v);var a=e.node(i),u=e.node(s),c=a,h=!1;a.lim>u.lim&&(c=u,h=!0);var l=t.filter(n.edges(),function(t){return h===p(e,e.node(t.v),c)&&h!==p(e,e.node(t.w),c)});return t.minBy(l,function(t){return r(n,t)})}function g(e,r,n,i){var s=n.v,a=n.w;e.removeEdge(s,a),e.setEdge(i.v,i.w,{}),h(e),u(e,r),function(e,r){var n=t.find(e.nodes(),function(t){return!r.node(t).parent}),i=o(e,n);i=i.slice(1),t.forEach(i,function(t){var n=e.node(t).parent,o=r.edge(t,n),i=!1;o||(o=r.edge(n,t),i=!0),r.node(t).rank=r.node(n).rank+(i?o.minlen:-o.minlen)})}(e,r)}function p(t,e,r){return r.low<=e.lim&&e.lim<=r.lim}return $g=a,a.initLowLimValues=h,a.initCutValues=u,a.calcCutValue=c,a.leaveEdge=d,a.enterEdge=f,a.exchangeEdges=g,$g}function ry(){if(Wg)return Ug;Wg=1;var t=Zm().longestPath,e=ty(),r=ey();Ug=function(r){switch(r.graph().ranker){case"network-simplex":default:o(r);break;case"tight-tree":!function(r){t(r),e(r)}(r);break;case"longest-path":n(r)}};var n=t;function o(t){r(t)}return Ug}function ny(){if(Hg)return Yg;Hg=1;var t=Hm();return Yg=function(e){var r=function(e){var r={},n=0;function o(i){var s=n;t.forEach(e.children(i),o),r[i]={low:s,lim:n++}}return t.forEach(e.children(),o),r}(e);t.forEach(e.graph().dummyChains,function(t){for(var n=e.node(t),o=n.edgeObj,i=function(t,e,r,n){var o,i,s=[],a=[],u=Math.min(e[r].low,e[n].low),c=Math.max(e[r].lim,e[n].lim);o=r;do{o=t.parent(o),s.push(o)}while(o&&(e[o].low>u||c>e[o].lim));i=o,o=n;for(;(o=t.parent(o))!==i;)a.push(o);return{path:s.concat(a.reverse()),lca:i}}(e,r,o.v,o.w),s=i.path,a=i.lca,u=0,c=s[u],h=!0;t!==o.w;){if(n=e.node(t),h){for(;(c=s[u])!==a&&e.node(c).maxRank<n.rank;)u++;c===a&&(h=!1)}if(!h){for(;u<s.length-1&&e.node(c=s[u+1]).minRank<=n.rank;)u++;c=s[u]}e.setParent(t,c),t=e.successors(t)[0]}})},Yg}function oy(){if(Qg)return Xg;Qg=1;var t=Hm(),e=Jm();function r(n,o,i,s,a,u,c){var h=n.children(c);if(h.length){var l=e.addBorderNode(n,"_bt"),d=e.addBorderNode(n,"_bb"),f=n.node(c);n.setParent(l,c),f.borderTop=l,n.setParent(d,c),f.borderBottom=d,t.forEach(h,function(t){r(n,o,i,s,a,u,t);var e=n.node(t),h=e.borderTop?e.borderTop:t,f=e.borderBottom?e.borderBottom:t,g=e.borderTop?s:2*s,p=h!==f?1:a-u[c]+1;n.setEdge(l,h,{weight:g,minlen:p,nestingEdge:!0}),n.setEdge(f,d,{weight:g,minlen:p,nestingEdge:!0})}),n.parent(c)||n.setEdge(o,l,{weight:0,minlen:a+u[c]})}else c!==o&&n.setEdge(o,c,{weight:0,minlen:i})}return Xg={run:function(n){var o=e.addDummyNode(n,"root",{},"_root"),i=function(e){var r={};function n(o,i){var s=e.children(o);s&&s.length&&t.forEach(s,function(t){n(t,i+1)}),r[o]=i}return t.forEach(e.children(),function(t){n(t,1)}),r}(n),s=t.max(t.values(i))-1,a=2*s+1;n.graph().nestingRoot=o,t.forEach(n.edges(),function(t){n.edge(t).minlen*=a});var u=function(e){return t.reduce(e.edges(),function(t,r){return t+e.edge(r).weight},0)}(n)+1;t.forEach(n.children(),function(t){r(n,o,a,u,s,i,t)}),n.graph().nodeRankFactor=a},cleanup:function(e){var r=e.graph();e.removeNode(r.nestingRoot),delete r.nestingRoot,t.forEach(e.edges(),function(t){e.edge(t).nestingEdge&&e.removeEdge(t)})}},Xg}function iy(){if(tp)return Zg;tp=1;var t=Hm();function e(e){t.forEach(e.nodes(),function(t){r(e.node(t))}),t.forEach(e.edges(),function(t){r(e.edge(t))})}function r(t){var e=t.width;t.width=t.height,t.height=e}function n(t){t.y=-t.y}function o(t){var e=t.x;t.x=t.y,t.y=e}return Zg={adjust:function(t){var r=t.graph().rankdir.toLowerCase();"lr"!==r&&"rl"!==r||e(t)},undo:function(r){var i=r.graph().rankdir.toLowerCase();"bt"!==i&&"rl"!==i||function(e){t.forEach(e.nodes(),function(t){n(e.node(t))}),t.forEach(e.edges(),function(r){var o=e.edge(r);t.forEach(o.points,n),t.has(o,"y")&&n(o)})}(r);"lr"!==i&&"rl"!==i||(!function(e){t.forEach(e.nodes(),function(t){o(e.node(t))}),t.forEach(e.edges(),function(r){var n=e.edge(r);t.forEach(n.points,o),t.has(n,"x")&&o(n)})}(r),e(r))}}}function sy(){if(up)return ap;up=1;var t=Hm();return ap=function(e,r){var n={};return t.forEach(e,function(e,r){var o=n[e.v]={indegree:0,in:[],out:[],vs:[e.v],i:r};t.isUndefined(e.barycenter)||(o.barycenter=e.barycenter,o.weight=e.weight)}),t.forEach(r.edges(),function(e){var r=n[e.v],o=n[e.w];t.isUndefined(r)||t.isUndefined(o)||(o.indegree++,r.out.push(n[e.w]))}),function(e){var r=[];function n(e){return function(r){r.merged||(t.isUndefined(r.barycenter)||t.isUndefined(e.barycenter)||r.barycenter>=e.barycenter)&&function(t,e){var r=0,n=0;t.weight&&(r+=t.barycenter*t.weight,n+=t.weight);e.weight&&(r+=e.barycenter*e.weight,n+=e.weight);t.vs=e.vs.concat(t.vs),t.barycenter=r/n,t.weight=n,t.i=Math.min(e.i,t.i),e.merged=!0}(e,r)}}function o(t){return function(r){r.in.push(t),0===--r.indegree&&e.push(r)}}for(;e.length;){var i=e.pop();r.push(i),t.forEach(i.in.reverse(),n(i)),t.forEach(i.out,o(i))}return t.map(t.filter(r,function(t){return!t.merged}),function(e){return t.pick(e,["vs","i","barycenter","weight"])})}(t.filter(n,function(t){return!t.indegree}))}}function ay(){if(dp)return lp;dp=1;var t=Hm(),e=function(){if(sp)return ip;sp=1;var t=Hm();return ip=function(e,r){return t.map(r,function(r){var n=e.inEdges(r);if(n.length){var o=t.reduce(n,function(t,r){var n=e.edge(r),o=e.node(r.v);return{sum:t.sum+n.weight*o.order,weight:t.weight+n.weight}},{sum:0,weight:0});return{v:r,barycenter:o.sum/o.weight,weight:o.weight}}return{v:r}})}}(),r=sy(),n=function(){if(hp)return cp;hp=1;var t=Hm(),e=Jm();function r(e,r,n){for(var o;r.length&&(o=t.last(r)).i<=n;)r.pop(),e.push(o.vs),n++;return n}return cp=function(n,o){var i,s=e.partition(n,function(e){return t.has(e,"barycenter")}),a=s.lhs,u=t.sortBy(s.rhs,function(t){return-t.i}),c=[],h=0,l=0,d=0;a.sort((i=!!o,function(t,e){return t.barycenter<e.barycenter?-1:t.barycenter>e.barycenter?1:i?e.i-t.i:t.i-e.i})),d=r(c,u,d),t.forEach(a,function(t){d+=t.vs.length,c.push(t.vs),h+=t.barycenter*t.weight,l+=t.weight,d=r(c,u,d)});var f={vs:t.flatten(c,!0)};return l&&(f.barycenter=h/l,f.weight=l),f}}();return lp=function o(i,s,a,u){var c=i.children(s),h=i.node(s),l=h?h.borderLeft:void 0,d=h?h.borderRight:void 0,f={};l&&(c=t.filter(c,function(t){return t!==l&&t!==d}));var g=e(i,c);t.forEach(g,function(e){if(i.children(e.v).length){var r=o(i,e.v,a,u);f[e.v]=r,t.has(r,"barycenter")&&(n=e,s=r,t.isUndefined(n.barycenter)?(n.barycenter=s.barycenter,n.weight=s.weight):(n.barycenter=(n.barycenter*n.weight+s.barycenter*s.weight)/(n.weight+s.weight),n.weight+=s.weight))}var n,s});var p=r(g,a);!function(e,r){t.forEach(e,function(e){e.vs=t.flatten(e.vs.map(function(t){return r[t]?r[t].vs:t}),!0)})}(p,f);var v=n(p,u);if(l&&(v.vs=t.flatten([l,v.vs,d],!0),i.predecessors(l).length)){var m=i.node(i.predecessors(l)[0]),y=i.node(i.predecessors(d)[0]);t.has(v,"barycenter")||(v.barycenter=0,v.weight=0),v.barycenter=(v.barycenter*v.weight+m.order+y.order)/(v.weight+2),v.weight+=2}return v},lp}function uy(){if(gp)return fp;gp=1;var t=Hm(),e=mm().Graph;return fp=function(r,n,o){var i=function(e){var r;for(;e.hasNode(r=t.uniqueId("_root")););return r}(r),s=new e({compound:!0}).setGraph({root:i}).setDefaultNodeLabel(function(t){return r.node(t)});return t.forEach(r.nodes(),function(e){var a=r.node(e),u=r.parent(e);(a.rank===n||a.minRank<=n&&n<=a.maxRank)&&(s.setNode(e),s.setParent(e,u||i),t.forEach(r[o](e),function(n){var o=n.v===e?n.w:n.v,i=s.edge(o,e),a=t.isUndefined(i)?0:i.weight;s.setEdge(o,e,{weight:r.edge(n).weight+a})}),t.has(a,"minRank")&&s.setNode(e,{borderLeft:a.borderLeft[n],borderRight:a.borderRight[n]}))}),s},fp}function cy(){if(yp)return mp;yp=1;var t=Hm(),e=function(){if(rp)return ep;rp=1;var t=Hm();return ep=function(e){var r={},n=t.filter(e.nodes(),function(t){return!e.children(t).length}),o=t.max(t.map(n,function(t){return e.node(t).rank})),i=t.map(t.range(o+1),function(){return[]});function s(n){if(!t.has(r,n)){r[n]=!0;var o=e.node(n);i[o.rank].push(n),t.forEach(e.successors(n),s)}}var a=t.sortBy(n,function(t){return e.node(t).rank});return t.forEach(a,s),i},ep}(),r=function(){if(op)return np;op=1;var t=Hm();function e(e,r,n){for(var o=t.zipObject(n,t.map(n,function(t,e){return e})),i=t.flatten(t.map(r,function(r){return t.sortBy(t.map(e.outEdges(r),function(t){return{pos:o[t.w],weight:e.edge(t).weight}}),"pos")}),!0),s=1;s<n.length;)s<<=1;var a=2*s-1;s-=1;var u=t.map(new Array(a),function(){return 0}),c=0;return t.forEach(i.forEach(function(t){var e=t.pos+s;u[e]+=t.weight;for(var r=0;e>0;)e%2&&(r+=u[e+1]),u[e=e-1>>1]+=t.weight;c+=t.weight*r})),c}return np=function(t,r){for(var n=0,o=1;o<r.length;++o)n+=e(t,r[o-1],r[o]);return n}}(),n=ay(),o=uy(),i=function(){if(vp)return pp;vp=1;var t=Hm();return pp=function(e,r,n){var o,i={};t.forEach(n,function(t){for(var n,s,a=e.parent(t);a;){if((n=e.parent(a))?(s=i[n],i[n]=a):(s=o,o=a),s&&s!==a)return void r.setEdge(s,a);a=n}})}}(),s=mm().Graph,a=Jm();function u(e,r,n){return t.map(r,function(t){return o(e,t,n)})}function c(e,r){var o=new s;t.forEach(e,function(e){var s=e.graph().root,a=n(e,s,o,r);t.forEach(a.vs,function(t,r){e.node(t).order=r}),i(e,o,a.vs)})}function h(e,r){t.forEach(r,function(r){t.forEach(r,function(t,r){e.node(t).order=r})})}return mp=function(n){var o=a.maxRank(n),i=u(n,t.range(1,o+1),"inEdges"),s=u(n,t.range(o-1,-1,-1),"outEdges"),l=e(n);h(n,l);for(var d,f=Number.POSITIVE_INFINITY,g=0,p=0;p<4;++g,++p){c(g%2?i:s,g%4>=2),l=a.buildLayerMatrix(n);var v=r(n,l);v<f&&(p=0,d=t.cloneDeep(l),f=v)}h(n,d)},mp}function hy(){if(xp)return wp;xp=1;var t=Hm(),e=mm().Graph,r=Jm();function n(e,r){var n={};return t.reduce(r,function(r,o){var s=0,a=0,u=r.length,c=t.last(o);return t.forEach(o,function(r,h){var l=function(e,r){if(e.node(r).dummy)return t.find(e.predecessors(r),function(t){return e.node(t).dummy})}(e,r),d=l?e.node(l).order:u;(l||r===c)&&(t.forEach(o.slice(a,h+1),function(r){t.forEach(e.predecessors(r),function(t){var o=e.node(t),a=o.order;!(a<s||d<a)||o.dummy&&e.node(r).dummy||i(n,t,r)})}),a=h+1,s=d)}),o}),n}function o(e,r){var n={};function o(r,o,s,a,u){var c;t.forEach(t.range(o,s),function(o){c=r[o],e.node(c).dummy&&t.forEach(e.predecessors(c),function(t){var r=e.node(t);r.dummy&&(r.order<a||r.order>u)&&i(n,t,c)})})}return t.reduce(r,function(r,n){var i,s=-1,a=0;return t.forEach(n,function(t,u){if("border"===e.node(t).dummy){var c=e.predecessors(t);c.length&&(i=e.node(c[0]).order,o(n,a,u,s,i),a=u,s=i)}o(n,a,n.length,i,r.length)}),n}),n}function i(t,e,r){if(e>r){var n=e;e=r,r=n}var o=t[e];o||(t[e]=o={}),o[r]=!0}function s(e,r,n){if(r>n){var o=r;r=n,n=o}return t.has(e[r],n)}function a(e,r,n,o){var i={},a={},u={};return t.forEach(r,function(e){t.forEach(e,function(t,e){i[t]=t,a[t]=t,u[t]=e})}),t.forEach(r,function(e){var r=-1;t.forEach(e,function(e){var c=o(e);if(c.length){c=t.sortBy(c,function(t){return u[t]});for(var h=(c.length-1)/2,l=Math.floor(h),d=Math.ceil(h);l<=d;++l){var f=c[l];a[e]===e&&r<u[f]&&!s(n,e,f)&&(a[f]=e,a[e]=i[e]=i[f],r=u[f])}}})}),{root:i,align:a}}function u(r,n,o,i,s){var a={},u=function(r,n,o,i){var s=new e,a=r.graph(),u=function(e,r,n){return function(o,i,s){var a,u=o.node(i),c=o.node(s),h=0;if(h+=u.width/2,t.has(u,"labelpos"))switch(u.labelpos.toLowerCase()){case"l":a=-u.width/2;break;case"r":a=u.width/2}if(a&&(h+=n?a:-a),a=0,h+=(u.dummy?r:e)/2,h+=(c.dummy?r:e)/2,h+=c.width/2,t.has(c,"labelpos"))switch(c.labelpos.toLowerCase()){case"l":a=c.width/2;break;case"r":a=-c.width/2}return a&&(h+=n?a:-a),a=0,h}}(a.nodesep,a.edgesep,i);return t.forEach(n,function(e){var n;t.forEach(e,function(t){var e=o[t];if(s.setNode(e),n){var i=o[n],a=s.edge(i,e);s.setEdge(i,e,Math.max(u(r,t,n),a||0))}n=t})}),s}(r,n,o,s),c=s?"borderLeft":"borderRight";function h(t,e){for(var r=u.nodes(),n=r.pop(),o={};n;)o[n]?t(n):(o[n]=!0,r.push(n),r=r.concat(e(n))),n=r.pop()}return h(function(t){a[t]=u.inEdges(t).reduce(function(t,e){return Math.max(t,a[e.v]+u.edge(e))},0)},u.predecessors.bind(u)),h(function(t){var e=u.outEdges(t).reduce(function(t,e){return Math.min(t,a[e.w]-u.edge(e))},Number.POSITIVE_INFINITY),n=r.node(t);e!==Number.POSITIVE_INFINITY&&n.borderType!==c&&(a[t]=Math.max(a[t],e))},u.successors.bind(u)),t.forEach(i,function(t){a[t]=a[o[t]]}),a}function c(e,r){return t.minBy(t.values(r),function(r){var n=Number.NEGATIVE_INFINITY,o=Number.POSITIVE_INFINITY;return t.forIn(r,function(t,r){var i=function(t,e){return t.node(e).width}(e,r)/2;n=Math.max(t+i,n),o=Math.min(t-i,o)}),n-o})}function h(e,r){var n=t.values(r),o=t.min(n),i=t.max(n);t.forEach(["u","d"],function(n){t.forEach(["l","r"],function(s){var a,u=n+s,c=e[u];if(c!==r){var h=t.values(c);(a="l"===s?o-t.min(h):i-t.max(h))&&(e[u]=t.mapValues(c,function(t){return t+a}))}})})}function l(e,r){return t.mapValues(e.ul,function(n,o){if(r)return e[r.toLowerCase()][o];var i=t.sortBy(t.map(e,o));return(i[1]+i[2])/2})}return wp={positionX:function(e){var i,s=r.buildLayerMatrix(e),d=t.merge(n(e,s),o(e,s)),f={};t.forEach(["u","d"],function(r){i="u"===r?s:t.values(s).reverse(),t.forEach(["l","r"],function(n){"r"===n&&(i=t.map(i,function(e){return t.values(e).reverse()}));var o=("u"===r?e.predecessors:e.successors).bind(e),s=a(e,i,d,o),c=u(e,i,s.root,s.align,"r"===n);"r"===n&&(c=t.mapValues(c,function(t){return-t})),f[r+n]=c})});var g=c(e,f);return h(f,g),l(f,e.graph().align)},findType1Conflicts:n,findType2Conflicts:o,addConflict:i,hasConflict:s,verticalAlignment:a,horizontalCompaction:u,alignCoordinates:h,findSmallestWidthAlignment:c,balance:l},wp}function ly(){if(Ep)return bp;Ep=1;var t=Hm(),e=Jm(),r=hy().positionX;return bp=function(n){(function(r){var n=e.buildLayerMatrix(r),o=r.graph().ranksep,i=0;t.forEach(n,function(e){var n=t.max(t.map(e,function(t){return r.node(t).height}));t.forEach(e,function(t){r.node(t).y=i+n/2}),i+=n+o})})(n=e.asNonCompoundGraph(n)),t.forEach(r(n),function(t,e){n.node(e).x=t})},bp}function dy(){if(Np)return Mp;Np=1;var t=Hm(),e=Qm(),r=Km(),n=ry(),o=Jm().normalizeRanks,i=ny(),s=Jm().removeEmptyRanks,a=oy(),u=function(){if(Kg)return Jg;Kg=1;var t=Hm(),e=Jm();function r(t,r,n,o,i,s){var a={width:0,height:0,rank:s,borderType:r},u=i[r][s-1],c=e.addDummyNode(t,"border",a,n);i[r][s]=c,t.setParent(c,o),u&&t.setEdge(u,c,{weight:1})}return Jg=function(e){t.forEach(e.children(),function n(o){var i=e.children(o),s=e.node(o);if(i.length&&t.forEach(i,n),t.has(s,"minRank")){s.borderLeft=[],s.borderRight=[];for(var a=s.minRank,u=s.maxRank+1;a<u;++a)r(e,"borderLeft","_bl",o,s,a),r(e,"borderRight","_br",o,s,a)}})},Jg}(),c=iy(),h=cy(),l=ly(),d=Jm(),f=mm().Graph;Mp=function(N,_){var k=_&&_.debugTiming?d.time:d.notime;k("layout",function(){var _=k(" buildLayoutGraph",function(){return function(e){var r=new f({multigraph:!0,compound:!0}),n=M(e.graph());return r.setGraph(t.merge({},p,E(n,g),t.pick(n,v))),t.forEach(e.nodes(),function(n){var o=M(e.node(n));r.setNode(n,t.defaults(E(o,m),y)),r.setParent(n,e.parent(n))}),t.forEach(e.edges(),function(n){var o=M(e.edge(n));r.setEdge(n,t.merge({},x,E(o,w),t.pick(o,b)))}),r}(N)});k(" runLayout",function(){!function(f,g){g(" makeSpaceForEdgeLabels",function(){!function(e){var r=e.graph();r.ranksep/=2,t.forEach(e.edges(),function(t){var n=e.edge(t);n.minlen*=2,"c"!==n.labelpos.toLowerCase()&&("TB"===r.rankdir||"BT"===r.rankdir?n.width+=n.labeloffset:n.height+=n.labeloffset)})}(f)}),g(" removeSelfEdges",function(){!function(e){t.forEach(e.edges(),function(t){if(t.v===t.w){var r=e.node(t.v);r.selfEdges||(r.selfEdges=[]),r.selfEdges.push({e:t,label:e.edge(t)}),e.removeEdge(t)}})}(f)}),g(" acyclic",function(){e.run(f)}),g(" nestingGraph.run",function(){a.run(f)}),g(" rank",function(){n(d.asNonCompoundGraph(f))}),g(" injectEdgeLabelProxies",function(){!function(e){t.forEach(e.edges(),function(t){var r=e.edge(t);if(r.width&&r.height){var n=e.node(t.v),o={rank:(e.node(t.w).rank-n.rank)/2+n.rank,e:t};d.addDummyNode(e,"edge-proxy",o,"_ep")}})}(f)}),g(" removeEmptyRanks",function(){s(f)}),g(" nestingGraph.cleanup",function(){a.cleanup(f)}),g(" normalizeRanks",function(){o(f)}),g(" assignRankMinMax",function(){!function(e){var r=0;t.forEach(e.nodes(),function(n){var o=e.node(n);o.borderTop&&(o.minRank=e.node(o.borderTop).rank,o.maxRank=e.node(o.borderBottom).rank,r=t.max(r,o.maxRank))}),e.graph().maxRank=r}(f)}),g(" removeEdgeLabelProxies",function(){!function(e){t.forEach(e.nodes(),function(t){var r=e.node(t);"edge-proxy"===r.dummy&&(e.edge(r.e).labelRank=r.rank,e.removeNode(t))})}(f)}),g(" normalize.run",function(){r.run(f)}),g(" parentDummyChains",function(){i(f)}),g(" addBorderSegments",function(){u(f)}),g(" order",function(){h(f)}),g(" insertSelfEdges",function(){!function(e){var r=d.buildLayerMatrix(e);t.forEach(r,function(r){var n=0;t.forEach(r,function(r,o){var i=e.node(r);i.order=o+n,t.forEach(i.selfEdges,function(t){d.addDummyNode(e,"selfedge",{width:t.label.width,height:t.label.height,rank:i.rank,order:o+ ++n,e:t.e,label:t.label},"_se")}),delete i.selfEdges})})}(f)}),g(" adjustCoordinateSystem",function(){c.adjust(f)}),g(" position",function(){l(f)}),g(" positionSelfEdges",function(){!function(e){t.forEach(e.nodes(),function(t){var r=e.node(t);if("selfedge"===r.dummy){var n=e.node(r.e.v),o=n.x+n.width/2,i=n.y,s=r.x-o,a=n.height/2;e.setEdge(r.e,r.label),e.removeNode(t),r.label.points=[{x:o+2*s/3,y:i-a},{x:o+5*s/6,y:i-a},{x:o+s,y:i},{x:o+5*s/6,y:i+a},{x:o+2*s/3,y:i+a}],r.label.x=r.x,r.label.y=r.y}})}(f)}),g(" removeBorderNodes",function(){!function(e){t.forEach(e.nodes(),function(r){if(e.children(r).length){var n=e.node(r),o=e.node(n.borderTop),i=e.node(n.borderBottom),s=e.node(t.last(n.borderLeft)),a=e.node(t.last(n.borderRight));n.width=Math.abs(a.x-s.x),n.height=Math.abs(i.y-o.y),n.x=s.x+n.width/2,n.y=o.y+n.height/2}}),t.forEach(e.nodes(),function(t){"border"===e.node(t).dummy&&e.removeNode(t)})}(f)}),g(" normalize.undo",function(){r.undo(f)}),g(" fixupEdgeLabelCoords",function(){!function(e){t.forEach(e.edges(),function(r){var n=e.edge(r);if(t.has(n,"x"))switch("l"!==n.labelpos&&"r"!==n.labelpos||(n.width-=n.labeloffset),n.labelpos){case"l":n.x-=n.width/2+n.labeloffset;break;case"r":n.x+=n.width/2+n.labeloffset}})}(f)}),g(" undoCoordinateSystem",function(){c.undo(f)}),g(" translateGraph",function(){!function(e){var r=Number.POSITIVE_INFINITY,n=0,o=Number.POSITIVE_INFINITY,i=0,s=e.graph(),a=s.marginx||0,u=s.marginy||0;function c(t){var e=t.x,s=t.y,a=t.width,u=t.height;r=Math.min(r,e-a/2),n=Math.max(n,e+a/2),o=Math.min(o,s-u/2),i=Math.max(i,s+u/2)}t.forEach(e.nodes(),function(t){c(e.node(t))}),t.forEach(e.edges(),function(r){var n=e.edge(r);t.has(n,"x")&&c(n)}),r-=a,o-=u,t.forEach(e.nodes(),function(t){var n=e.node(t);n.x-=r,n.y-=o}),t.forEach(e.edges(),function(n){var i=e.edge(n);t.forEach(i.points,function(t){t.x-=r,t.y-=o}),t.has(i,"x")&&(i.x-=r),t.has(i,"y")&&(i.y-=o)}),s.width=n-r+a,s.height=i-o+u}(f)}),g(" assignNodeIntersects",function(){!function(e){t.forEach(e.edges(),function(t){var r,n,o=e.edge(t),i=e.node(t.v),s=e.node(t.w);o.points?(r=o.points[0],n=o.points[o.points.length-1]):(o.points=[],r=s,n=i),o.points.unshift(d.intersectRect(i,r)),o.points.push(d.intersectRect(s,n))})}(f)}),g(" reversePoints",function(){!function(e){t.forEach(e.edges(),function(t){var r=e.edge(t);r.reversed&&r.points.reverse()})}(f)}),g(" acyclic.undo",function(){e.undo(f)})}(_,k)}),k(" updateInputGraph",function(){!function(e,r){t.forEach(e.nodes(),function(t){var n=e.node(t),o=r.node(t);n&&(n.x=o.x,n.y=o.y,r.children(t).length&&(n.width=o.width,n.height=o.height))}),t.forEach(e.edges(),function(n){var o=e.edge(n),i=r.edge(n);o.points=i.points,t.has(i,"x")&&(o.x=i.x,o.y=i.y)}),e.graph().width=r.graph().width,e.graph().height=r.graph().height}(N,_)})})};var g=["nodesep","edgesep","ranksep","marginx","marginy"],p={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},v=["acyclicer","ranker","rankdir","align"],m=["width","height"],y={width:0,height:0},w=["minlen","weight","width","height","labeloffset"],x={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},b=["labelpos"];function E(e,r){return t.mapValues(t.pick(e,r),Number)}function M(e){var r={};return t.forEach(e,function(t,e){r[e.toLowerCase()]=t}),r}return Mp}function fy(){if(kp)return _p;kp=1;var t=Hm(),e=Jm(),r=mm().Graph;return _p={debugOrdering:function(n){var o=e.buildLayerMatrix(n),i=new r({compound:!0,multigraph:!0}).setGraph({});return t.forEach(n.nodes(),function(t){i.setNode(t,{label:t}),i.setParent(t,"layer"+n.node(t).rank)}),t.forEach(n.edges(),function(t){i.setEdge(t.v,t.w,{},t.name)}),t.forEach(o,function(e,r){var n="layer"+r;i.setNode(n,{rank:"same"}),t.reduce(e,function(t,e){return i.setEdge(t,e,{style:"invis"}),e})}),i}}}var gy=Op?Ap:(Op=1,Ap={graphlib:mm(),layout:dy(),debug:fy(),util:{time:Jm().time,notime:Jm().notime},version:zp?Sp:(zp=1,Sp="0.8.5")}),py=ns(gy);class vy extends dt{constructor(){super(...arguments),this.id="dagre",this.isCompoundGraph=null,this.config={graphAttributes:["rankdir","align","nodesep","edgesep","ranksep","marginx","marginy","acyclicer","ranker"],nodeAttributes:["width","height"],edgeAttributes:["minlen","weight","width","height","labelpos","labeloffset"]}}getDefaultOptions(){return{directed:!0,multigraph:!0,rankdir:"TB",align:void 0,nodesep:50,edgesep:10,ranksep:50,marginx:0,marginy:0,acyclicer:void 0,ranker:"network-simplex",nodeSize:[0,0],edgeMinLen:1,edgeWeight:1,edgeLabelSize:[0,0],edgeLabelPos:"r",edgeLabelOffset:10}}layout(){return r(this,void 0,void 0,function*(){const t=new gy.graphlib.Graph({directed:!!this.options.directed,multigraph:!!this.options.multigraph,compound:this.isCompound()});t.setGraph(x(this.options,this.config.graphAttributes)),t.setDefaultEdgeLabel(()=>({}));const e=vt(this.options.nodeSize,0);this.model.forEachNode(r=>{const n=r._original,[i,s]=ht(e(n)),a={width:i,height:s};if(t.setNode(String(r.id),a),this.isCompound()){if(o(r.parentId))return;t.setParent(String(r.id),String(r.parentId))}});const{edgeLabelSize:r,edgeLabelOffset:n,edgeLabelPos:i,edgeMinLen:s,edgeWeight:a}=this.options,u=vt(r,0),c=pt(n,10),h="function"==typeof i?i:()=>i,l=pt(s,1),d=pt(a,1);this.model.forEachEdge(e=>{const r=e._original,[n,o]=ht(u(r)),i={width:n,height:o,labelpos:h(r),labeloffset:c(r),minlen:l(r),weight:d(r)};t.setEdge(String(e.source),String(e.target),i,String(e.id))}),py.layout(t),this.model.forEachNode(e=>{const r=t.node(String(e.id));r&&(e.x=r.x,e.y=r.y,e.size=[r.width,r.height])}),this.model.forEachEdge(e=>{const r=t.edge(String(e.source),String(e.target),String(e.id));if(!r)return;const{width:n,height:o,weight:i,minlen:s,labelpos:a,labeloffset:u,points:c}=r;e.labelSize=[n,o],e.weight=i,e.minLen=s,e.labelPos=a,e.labelOffset=u,e.points=c.map(ct)})})}isCompound(){return null!==this.isCompoundGraph?this.isCompoundGraph:(t=this.options.compound,u(t,"Boolean")?this.isCompoundGraph=this.options.compound:(this.isCompoundGraph=this.model.nodes().some(t=>!o(t.parentId)),this.isCompoundGraph));var t}}const my=1e-6;function yy(t){var e;let r=0;if(t.length)for(let e=0;e<t.length;e++){const n=t[e];n&&n.r>r&&(r=n.r)}else if(t.data){r=t.data.r||0;let n=t.next;for(;n;)r=Math.max(r,(null===(e=n.data)||void 0===e?void 0:e.r)||0),n=n.next}t.r=r}function wy(t=1,e=.005,r=2){function n(n,o){!function(t,e,r,n,o=2){const i=e/r,s=t.nodes(),a=s.map((t,e)=>{const{nodeStrength:r,x:n,y:o,z:s,size:a,mass:u}=t;return{x:n,y:o,z:s,size:a,index:e,id:t.id,vx:0,vy:0,vz:0,weight:i*r,mass:u||1}}),u=(2===o?br(a,t=>t.x,t=>t.y):An(a,t=>t.x,t=>t.y,t=>t.z)).visitAfter(xy),c=new Map;a.forEach(t=>{c.set(t.id,t),function(t,e,r){e.visit((e,n,o,i,s,a,u)=>by(e,n,o,i,s,a,u,t,r))}(t,u,o)}),a.map(t=>{const e=t.id;n[e]={x:t.vx/t.mass,y:t.vy/t.mass,z:t.vz/t.mass}})}(n,t,e*e,o,r)}return n.factor=function(e){return arguments.length?(t=e,n):t},n.coulombDisScale=function(t){return arguments.length?(e=t,n):e},n.dimensions=function(t){return arguments.length?(r=t,n):r},n}function xy(t){let e=0,r=0,n=0,o=0,i=0;const s=t.length;if(s){for(let a=0;a<s;a++){const s=t[a];s&&s.weight&&(e+=s.weight,r+=s.x*s.weight,n+=s.y*s.weight,o+=s.z*s.weight,i+=s.size*s.weight)}t.x=r/e,t.y=n/e,t.z=o/e,t.size=i/e,t.weight=e}else{const e=t;t.x=e.data.x,t.y=e.data.y,t.z=e.data.z,t.size=e.data.size,t.weight=e.data.weight}}const by=(t,e,r,n,o,i,s,a,u)=>{var c;if((null===(c=t.data)||void 0===c?void 0:c.id)===a.id)return;const h=2===u?n:3===u?i:r,l=a.x-t.x||.1,d=a.y-t.y||.1,f=a.z-t.z||.1,g=[l,d,f],p=h-e;let v=0;for(let t=0;t<u;t++)v+=g[t]*g[t];const m=Math.sqrt(v)*v;if(p*p*.81<v){const e=t.weight/m;return a.vx+=l*e,a.vy+=d*e,a.vz+=f*e,!0}if(t.length)return!1;if(t.data!==a){const e=t.data.weight/m;a.vx+=l*e,a.vy+=d*e,a.vz+=f*e}};var Ey=function(){function t(){this._events={}}return t.prototype.on=function(t,e,r){return this._events[t]||(this._events[t]=[]),this._events[t].push({callback:e,once:!!r}),this},t.prototype.once=function(t,e){return this.on(t,e,!0)},t.prototype.emit=function(t){for(var e=this,r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];var o=this._events[t]||[],i=this._events["*"]||[],s=function(n){for(var o=n.length,i=0;i<o;i++)if(n[i]){var s=n[i],a=s.callback;s.once&&(n.splice(i,1),0===n.length&&delete e._events[t],o--,i--),a.apply(e,r)}};s(o),s(i)},t.prototype.off=function(t,e){if(t)if(e){for(var r=this._events[t]||[],n=r.length,o=0;o<n;o++)r[o].callback===e&&(r.splice(o,1),n--,o--);0===r.length&&delete this._events[t]}else delete this._events[t];else this._events={};return this},t.prototype.getEvents=function(){return this._events},t}();class My extends Ey{constructor(){super(...arguments),this.iteration=0,this.judgingDistance=1/0,this.running=!1,this.tickCallback=null,this.endCallback=null,this.timer=0}initialize(t){this.options=t,this.iteration=0,this.judgingDistance=1/0}on(t,e){return"tick"===t&&(this.tickCallback=e),"end"===t&&(this.endCallback=e),this}tick(t=1){var e;for(let r=0;r<t;r++){const t=this.runOneStep();this.judgingDistance=t,this.iteration++,null===(e=this.tickCallback)||void 0===e||e.call(this)}return this}restart(){if(this.running)return this;const{maxIteration:t=500,minMovement:e=0,animate:r=!0}=this.options;if(!r||"undefined"==typeof window){for(;this.iteration<t&&(this.judgingDistance>e||this.iteration<1);)this.tick(1);return Promise.resolve().then(()=>{var t;null===(t=this.endCallback)||void 0===t||t.call(this)}),this}return this.running=!0,this.timer=window.setInterval(()=>{var r;this.tick(1),(this.iteration>=t||this.judgingDistance<e)&&(this.stop(),null===(r=this.endCallback)||void 0===r||r.call(this))},0),this}stop(){return this.running=!1,this.timer&&(clearInterval(this.timer),this.timer=0),this}}class Ny extends My{constructor(){super(...arguments),this.forces=new Map,this.velMap={}}data(t){return this.model=t,t.forEachNode(t=>{this.velMap[t.id]={x:0,y:0,z:0}}),this}force(t,e){return 1===arguments.length?this.forces.get(t)||null:(null===e?this.forces.delete(t):e&&this.forces.set(t,e),e||null)}runOneStep(){const t={},e=this.model.nodes();if(!e.length)return 0;e.forEach(e=>{t[e.id]={x:0,y:0,z:0}}),this.forces.forEach(e=>{e(this.model,t)}),this.updateVelocity(t);const r=this.updatePosition();return this.monitor(t,e),r}setFixedPosition(t,e){const r=this.model.node(t);if(!r)return;const n=["fx","fy","fz"];if(null===e)return void n.forEach(t=>delete r[t]);e.forEach((t,e)=>{e<n.length&&("number"==typeof t||null===t)&&(r[n[e]]=t)});const o=this.velMap[t];o&&(o.x=0,o.y=0,o.z=0)}updateVelocity(t){const{damping:e=.9,maxSpeed:r=100,interval:n=.02,dimensions:o=2}=this.options;this.model.nodes().forEach(i=>{const s=i.id;let a=(this.velMap[s].x+t[s].x*n)*e,u=(this.velMap[s].y+t[s].y*n)*e,c=3===o?(this.velMap[s].z+t[s].z*n)*e:0;const h=Math.sqrt(a*a+u*u+c*c);if(h>r){const t=r/h;a*=t,u*=t,c*=t}this.velMap[s]={x:a,y:u,z:c}})}updatePosition(){const{distanceThresholdMode:t="mean",interval:e=.02,dimensions:r=2}=this.options,n=this.model.nodes();let o=0,i="max"===t?-1/0:"min"===t?1/0:0;return n.forEach(n=>{const s=n.id;if(l(n.fx)&&l(n.fy))return n.x=n.fx,n.y=n.fy,void(3===r&&l(n.fz)&&(n.z=n.fz));const a=this.velMap[s].x*e,u=this.velMap[s].y*e,c=3===r?this.velMap[s].z*e:0;n.x+=a,n.y+=u,3===r&&(n.z=(n.z||0)+c);const h=Math.sqrt(a*a+u*u+c*c);"max"===t?i=Math.max(i,h):"min"===t?i=Math.min(i,h):o+=h}),"mean"===t?o/n.length:i}monitor(t,e){const{monitor:r,dimensions:n=2}=this.options;if(!r)return;let o=0;e.forEach(e=>{const r=t[e.id],i=r.x*r.x+r.y*r.y+(3===n?r.z*r.z:0);o+=(e.mass||1)*i*.5}),r({energy:o,nodes:e,edges:this.model.edges(),iterations:this.iteration})}}const _y={nodeSize:30,dimensions:2,maxIteration:500,gravity:10,factor:1,edgeStrength:50,nodeStrength:1e3,coulombDisScale:.005,damping:.9,maxSpeed:200,minMovement:.4,interval:.02,linkDistance:200,clusterNodeStrength:20,collideStrength:1,preventOverlap:!0,distanceThresholdMode:"mean"};class ky extends ft{constructor(){super(...arguments),this.id="force",this.simulation=null}getDefaultOptions(){return _y}layout(){var t;return r(this,void 0,void 0,function*(){const e=this.parseOptions(this.options),{width:r,height:n,dimensions:o}=e;if(this.initializePhysicsData(this.model,e),N(this.model,r,n,o),!(null===(t=this.model.nodes())||void 0===t?void 0:t.length))return;const i=this.setSimulation(e);return i.data(this.model),i.initialize(e),i.restart(),new Promise(t=>{i.on("end",()=>t())})})}initializePhysicsData(t,e){const{nodeSize:r,getMass:n,nodeStrength:o,edgeStrength:i,linkDistance:s}=e;t.forEachNode(t=>{const e=t._original;t.size=r(e),t.mass=n(e),t.nodeStrength=o(e)}),t.forEachEdge(e=>{const r=e._original;e.edgeStrength=i(r),e.linkDistance=s(r,t.originalNode(e.source),t.originalNode(e.target))})}setSimulation(t){const e=this.simulation||new Ny;return this.simulation||(this.simulation=e.on("tick",()=>{var e;null===(e=t.onTick)||void 0===e||e.call(t,this)})),this.setupRepulsiveForce(e,t),this.setupAttractiveForce(e,t),this.setupCollideForce(e,t),this.setupGravityForce(e,t),this.setupCentripetalForce(e,t),e}setupRepulsiveForce(t,e){const{factor:r,coulombDisScale:n,dimensions:o}=e;let i=t.force("repulsive");i||(i=wy(r,n,o),t.force("repulsive",i)),i.factor&&i.factor(r),i.coulombDisScale&&i.coulombDisScale(n),i.dimensions&&i.dimensions(o)}setupAttractiveForce(t,e){const{dimensions:r,preventOverlap:n}=e;if((this.model.edges()||[]).length>0){let e=t.force("attractive");e||(e=function(t=2){let e=!1;function r(e,r){e.forEachEdge(n=>{var o,i;const{source:s,target:a}=n,u=e.node(s),c=e.node(a);if(!u||!c)return;let h=c.x-u.x,l=c.y-u.y,d=3===t?(null!==(o=c.z)&&void 0!==o?o:0)-(null!==(i=u.z)&&void 0!==i?i:0):0;h||l||(h=.01,l=.01,3!==t||d||(d=.01));const f=Math.sqrt(h*h+l*l+d*d);if(f<Number(u.size)+Number(c.size))return;const g=h/f,p=l/f,v=d/f,{linkDistance:m=200,edgeStrength:y=200}=n,w=(m-f)*y,x=1/(u.mass||1),b=1/(c.mass||1),E=g*w,M=p*w,N=v*w;r[s].x-=E*x,r[s].y-=M*x,r[s].z-=N*x,r[a].x+=E*b,r[a].y+=M*b,r[a].z+=N*b})}return r.dimensions=function(e){return arguments.length?(t=e,r):t},r.preventOverlap=function(t){return arguments.length?(e=t,r):e},r}(r),t.force("attractive",e)),e.dimensions&&e.dimensions(r),e.preventOverlap&&e.preventOverlap(n)}else t.force("attractive",null)}setupGravityForce(t,e){const{center:r,gravity:n,getCenter:o}=e;if(n){let e=t.force("gravity");e||(e=function(t=[0,0,0],e=10){let r;function n(n,o){n.nodes()&&n.forEachNode(i=>{const{id:s,mass:a,x:u,y:c,z:h=0}=i;let l=0,d=0,f=0,g=e;const p=n.degree(s),v=null==r?void 0:r(i,p);if(v){const[t,e,r]=v;l=u-t,d=c-e,g=r}else l=u-t[0],d=c-t[1],f=h-(t[2]||0);g&&(o[s].x-=g*l/a,o[s].y-=g*d/a,o[s].z-=g*f/a)})}return n.center=function(e){return arguments.length?(t=e,n):t},n.gravity=function(t){return arguments.length?(e=t,n):e},n.getCenter=function(t){return arguments.length?(r=t,n):r},n}(r,n),t.force("gravity",e)),e.center&&e.center(r),e.gravity&&e.gravity(n),e.getCenter&&e.getCenter(o)}else t.force("gravity",null)}setupCollideForce(t,e){const{preventOverlap:r,collideStrength:n=1,dimensions:o}=e;if(r&&n){let e=t.force("collide");e||(e=function(t=2){let e=1;function r(r,n){const o=r.nodes();if(o.length<2||e<=0)return;if(2===t){const t=o.map((t,e)=>({id:t.id,index:e,x:t.x,y:t.y,r:Number(t.size)/2,mass:t.mass||1,fx:t.fx,fy:t.fy})),e=br(t,t=>t.x,t=>t.y).visitAfter(yy);for(const r of t)e.visit((t,e,o,s,a)=>{const u=t.r||0,c=r.r+u;if(e>r.x+c||s<r.x-c||o>r.y+c||a<r.y-c)return!0;if(!t.data)return!1;let h=t;do{const t=h.data;t&&t.index>r.index&&i(r,t,n),h=h.next}while(h);return!1});return}const a=o.map((t,e)=>{var r;return{id:t.id,index:e,x:t.x,y:t.y,z:null!==(r=t.z)&&void 0!==r?r:0,r:Number(t.size)/2,mass:t.mass||1,fx:t.fx,fy:t.fy,fz:t.fz}});for(let t=0;t<a.length;t++)for(let e=t+1;e<a.length;e++)s(a[t],a[e],n)}function n(t){return l(t.fx)&&l(t.fy)?0:1/(t.mass||1)}function o(t){return l(t.fx)&&l(t.fy)&&l(t.fz)?0:1/(t.mass||1)}function i(t,r,o){let i=t.x-r.x,s=t.y-r.y,a=Math.hypot(i,s);const u=t.r+r.r;if(a>=u)return;a<my&&(i=t.index<r.index?my:-my,s=0,a=Math.abs(i));const c=i/a,h=s/a,l=(u-a)*e*500,d=n(t),f=n(r);d&&(o[t.id].x+=c*l*d,o[t.id].y+=h*l*d),f&&(o[r.id].x-=c*l*f,o[r.id].y-=h*l*f)}function s(t,r,n){let i=t.x-r.x,s=t.y-r.y,a=t.z-r.z,u=Math.sqrt(i*i+s*s+a*a);const c=t.r+r.r;if(u>=c)return;u<my&&(i=t.index<r.index?my:-my,s=0,a=0,u=Math.abs(i));const h=i/u,l=s/u,d=a/u,f=(c-u)*e*500,g=o(t),p=o(r);g&&(n[t.id].x+=h*f*g,n[t.id].y+=l*f*g,n[t.id].z+=d*f*g),p&&(n[r.id].x-=h*f*p,n[r.id].y-=l*f*p,n[r.id].z-=d*f*p)}return r.dimensions=function(e){return arguments.length?(t=e,r):t},r.strength=function(t){return arguments.length?(e=t,r):e},r}(o),t.force("collide",e)),e.strength&&e.strength(n),e.dimensions&&e.dimensions(o)}else t.force("collide",null)}setupCentripetalForce(t,e){const{centripetalOptions:r,width:n,height:o}=e;if(r){let e=t.force("centripetal");e||(e=function(){let t,e=800,r=600;function n(n,o){if(!t)return;const{leaf:i,single:s,others:a,center:u}=t,c=n.nodes(),h=n.edges(),d=c.map(t=>Object.assign(Object.assign({},t),{data:t.data||{}})),f=h.map(t=>Object.assign(Object.assign({},t),{data:t.data||{}}));n.forEachNode(t=>{const{id:c,mass:h,x:g,y:p,z:v=0,data:m}=t,y=n.degree(c,"in"),w=n.degree(c,"out"),x=n.degree(c,"both"),b=Object.assign(Object.assign({},t),{data:m||{}}),{x:E,y:M,z:N,centerStrength:_}=(null==u?void 0:u(b,d,f,e,r))||{x:0,y:0,z:0,centerStrength:0};if(!l(E)||!l(M))return;const k=(g-E)/h,S=(p-M)/h,z=(v-(N||0))/h;if(_&&(o[c].x-=_*k,o[c].y-=_*S,o[c].z-=_*z),0===x){const t=s(b);if(!t)return;return o[c].x-=t*k,o[c].y-=t*S,void(o[c].z-=t*z)}if(0===y||0===w){const t=i(b,d,f);if(!t)return;return o[c].x-=t*k,o[c].y-=t*S,void(o[c].z-=t*z)}const A=a(b);A&&(o[c].x-=A*k,o[c].y-=A*S,o[c].z-=A*z)})}return n.options=function(e){return arguments.length?(t=e,n):t},n.width=function(t){return arguments.length?(e=t,n):e},n.height=function(t){return arguments.length?(r=t,n):r},n}(),t.force("centripetal",e)),e.options&&e.options(r),e.width&&e.width(n),e.height&&e.height(o)}else t.force("centripetal",null)}parseOptions(t){const e=Object.assign(Object.assign({},t),lt(t));return t.getMass||(e.getMass=t=>{if(!t)return 1;const e=this.model.degree(t.id,"both");return!e||e<5?1:5*e*1}),e.nodeSize=mt(t.nodeSize,t.nodeSpacing),e.linkDistance=t.linkDistance?pt(t.linkDistance,1):t=>1+e.nodeSize(this.model.node(t.source)._original)+e.nodeSize(this.model.node(t.target)._original),e.nodeStrength=pt(t.nodeStrength,1),e.edgeStrength=pt(t.edgeStrength,1),this.formatCentripetal(e),e}formatCentripetal(t){var e;const{dimensions:r,centripetalOptions:n,center:o,clusterNodeStrength:i,leafCluster:s,clustering:a,nodeClusterBy:u}=t,c=n||{leaf:2,single:2,others:1,center:t=>({x:o[0],y:o[1],z:3===r?o[2]:void 0})};let h,l;if("function"!=typeof i&&(t.clusterNodeStrength=()=>i),s&&u&&(h=this.getSameTypeLeafMap(u),l=Array.from(new Set(null===(e=this.model.nodes())||void 0===e?void 0:e.map(t=>u(t._original))))||[],t.centripetalOptions=Object.assign({},c,{single:()=>100,leaf:e=>{const{siblingLeaves:r,sameTypeLeaves:n}=h[e.id]||{};return(null==n?void 0:n.length)===(null==r?void 0:r.length)||1===(null==l?void 0:l.length)?1:t.clusterNodeStrength(e)},others:()=>1,center:t=>{const e=this.model.degree(t.id,"both");if(!e)return{x:100,y:100,z:0};let r;if(1===e){const{sameTypeLeaves:e=[]}=h[t.id]||{};1===e.length?r=void 0:e.length>1&&(r=this.getAvgNodePosition(e))}else r=void 0;return{x:null==r?void 0:r.x,y:null==r?void 0:r.y,z:null==r?void 0:r.z}}})),a&&u){h||(h=this.getSameTypeLeafMap(u));let e=[];y(e)&&this.model.forEachNode(t=>{const r=u(t._original);r&&!e.includes(r)&&e.push(r)});const r={};e.forEach(t=>{const e=this.model.nodes().filter(e=>u(e._original)===t);r[t]=this.getAvgNodePosition(e)}),t.centripetalOptions=Object.assign(c,{single:e=>t.clusterNodeStrength(e),leaf:e=>t.clusterNodeStrength(e),others:e=>t.clusterNodeStrength(e),center:t=>{const e=r[u(t._original)];return{x:null==e?void 0:e.x,y:null==e?void 0:e.y,z:null==e?void 0:e.z}}})}const{leaf:d,single:f,others:g}=t.centripetalOptions||{};d&&"function"!=typeof d&&(t.centripetalOptions.leaf=()=>d),f&&"function"!=typeof f&&(t.centripetalOptions.single=()=>f),g&&"function"!=typeof g&&(t.centripetalOptions.others=()=>g)}getSameTypeLeafMap(t){const e={};return this.model.forEachNode(r=>{1===this.model.degree(r.id,"both")&&(e[r.id]=this.getCoreNodeAndSiblingLeaves(r,t))}),e}getCoreNodeAndSiblingLeaves(t,e){const r=this.model.degree(t.id,"in"),n=this.model.degree(t.id,"out");let o=t,i=[];if(0===r){const e=this.model.successors(t.id);o=this.model.node(e[0]),i=this.model.neighbors(o.id).map(t=>this.model.node(t))}else if(0===n){const e=this.model.predecessors(t.id);o=this.model.node(e[0]),i=this.model.neighbors(o.id).map(t=>this.model.node(t))}i=i.filter(t=>0===this.model.degree(t.id,"in")||0===this.model.degree(t.id,"out"));const s=e(t._original)||"",a=i.filter(t=>e(t._original)===s&&(0===this.model.degree(t.id,"in")||0===this.model.degree(t.id,"out")));return{coreNode:o,siblingLeaves:i,sameTypeLeaves:a}}getAvgNodePosition(t){const e={x:0,y:0};t.forEach(t=>{e.x+=t.x||0,e.y+=t.y||0});const r=t.length||1;return{x:e.x/r,y:e.y/r}}tick(t=1){return this.simulation&&this.simulation.tick(t),this}stop(){return this.simulation&&this.simulation.stop(),this}restart(){return this.simulation&&this.simulation.restart(),this}setFixedPosition(t,e){return this.simulation&&this.simulation.setFixedPosition(t,e),this}}class Sy{constructor(t){this.id=t.id||0,this.rx=t.rx,this.ry=t.ry,this.fx=0,this.fy=0,this.mass=t.mass,this.degree=t.degree,this.g=t.g||0}distanceTo(t){const e=this.rx-t.rx,r=this.ry-t.ry;return Math.hypot(e,r)}setPos(t,e){this.rx=t,this.ry=e}resetForce(){this.fx=0,this.fy=0}addForce(t){const e=t.rx-this.rx,r=t.ry-this.ry;let n=Math.hypot(e,r);n=n<1e-4?1e-4:n;const o=this.g*(this.degree+1)*(t.degree+1)/n;this.fx+=o*e/n,this.fy+=o*r/n}in(t){return t.contains(this.rx,this.ry)}add(t){const e=this.mass+t.mass,r=(this.rx*this.mass+t.rx*t.mass)/e,n=(this.ry*this.mass+t.ry*t.mass)/e,o=this.degree+t.degree;return new Sy({rx:r,ry:n,mass:e,degree:o})}}class zy{constructor(t){this.xmid=t.xmid,this.ymid=t.ymid,this.length=t.length,this.massCenter=t.massCenter||[0,0],this.mass=t.mass||1}getLength(){return this.length}contains(t,e){const r=this.length/2;return t<=this.xmid+r&&t>=this.xmid-r&&e<=this.ymid+r&&e>=this.ymid-r}NW(){const t=this.xmid-this.length/4,e=this.ymid+this.length/4,r=this.length/2;return new zy({xmid:t,ymid:e,length:r})}NE(){const t=this.xmid+this.length/4,e=this.ymid+this.length/4,r=this.length/2;return new zy({xmid:t,ymid:e,length:r})}SW(){const t=this.xmid-this.length/4,e=this.ymid-this.length/4,r=this.length/2;return new zy({xmid:t,ymid:e,length:r})}SE(){const t=this.xmid+this.length/4,e=this.ymid-this.length/4,r=this.length/2;return new zy({xmid:t,ymid:e,length:r})}}class Ay{constructor(t){this.body=null,this.quad=null,this.NW=null,this.NE=null,this.SW=null,this.SE=null,this.theta=.5,null!=t&&(this.quad=t)}insert(t){null!=this.body?this._isExternal()?(this.quad&&(this.NW=new Ay(this.quad.NW()),this.NE=new Ay(this.quad.NE()),this.SW=new Ay(this.quad.SW()),this.SE=new Ay(this.quad.SE())),this._putBody(this.body),this._putBody(t),this.body=this.body.add(t)):(this.body=this.body.add(t),this._putBody(t)):this.body=t}_putBody(t){this.quad&&(t.in(this.quad.NW())&&this.NW?this.NW.insert(t):t.in(this.quad.NE())&&this.NE?this.NE.insert(t):t.in(this.quad.SW())&&this.SW?this.SW.insert(t):t.in(this.quad.SE())&&this.SE&&this.SE.insert(t))}_isExternal(){return null==this.NW&&null==this.NE&&null==this.SW&&null==this.SE}updateForce(t){if(null!=this.body&&t!==this.body)if(this._isExternal())t.addForce(this.body);else{(this.quad?this.quad.getLength():0)/this.body.distanceTo(t)<this.theta?t.addForce(this.body):(this.NW&&this.NW.updateForce(t),this.NE&&this.NE.updateForce(t),this.SW&&this.SW.updateForce(t),this.SE&&this.SE.updateForce(t))}}}let Oy=class extends My{constructor(){super(...arguments),this.sg=0,this.forces={},this.preForces={},this.bodies={},this.sizes={},this.maxIteration=0}data(t,e){return this.model=t,this.sizes=e,this}initialize(t){super.initialize(t),this.maxIteration=t.maxIteration,this.sg=0,this.initForces()}initForces(){const{model:t,options:e}=this,{kr:r,barnesHut:n}=e,o=t.nodes();this.forces={},this.preForces={},this.bodies={};for(let e=0;e<o.length;e+=1){const i=o[e];if(this.forces[i.id]=[0,0],this.preForces[i.id]=[0,0],n){const n={id:e,rx:i.x,ry:i.y,mass:1,g:r,degree:t.degree(i.id)};this.bodies[i.id]=new Sy(n)}}}setFixedPosition(t,e){const r=this.model.node(t);if(!r)return;const n=["fx","fy","fz"];null!==e?e.forEach((t,e)=>{e<n.length&&("number"==typeof t||null===t)&&(r[n[e]]=t)}):n.forEach(t=>{delete r[t]})}isNodeFixed(t){return l(t.fx)&&l(t.fy)}syncFixedPositions(){this.model.forEachNode(t=>{this.isNodeFixed(t)&&(t.x=t.fx,t.y=t.fy)})}runOneStep(){const{model:t,options:e}=this,{preventOverlap:r,barnesHut:n}=e,o=this.maxIteration-this.iteration,i=t.nodes();for(let t=0;t<i.length;t+=1){const{id:e}=i[t];this.preForces[e]=[...this.forces[e]||[0,0]],this.forces[e]=[0,0]}return this.syncFixedPositions(),this.calculateAttractive(o),n&&!r?this.calculateOptRepulsiveGravity():this.calculateRepulsiveGravity(o,100),this.updatePositions()}calculateAttractive(t){const{model:e,options:r}=this,{preventOverlap:n,dissuadeHubs:o,mode:i,prune:s}=r,a=e.edges();for(let t=0;t<a.length;t+=1){const{source:r,target:u}=a[t],c=e.node(r),h=e.node(u),l=e.degree(r),d=e.degree(u);if(s&&(l<=1||d<=1))continue;const f=h.x-c.x,g=h.y-c.y;let p=Math.hypot(f,g);p=p<1e-4?1e-4:p;const v=f/p,m=g/p;let y=p;n&&(y=Math.max(0,p-this.sizes[r]-this.sizes[u]));let w=y,x=y;"linlog"===i&&(w=Math.log(1+y),x=w),o&&(w=y/l,x=y/d),this.forces[r][0]+=w*v,this.forces[r][1]+=w*m,this.forces[u][0]-=x*v,this.forces[u][1]-=x*m}}calculateOptRepulsiveGravity(){const{model:t,options:e}=this,{kg:r,center:n,prune:o,kr:i}=e,s=t.nodes(),a=s.length;let u=Number.POSITIVE_INFINITY,c=Number.NEGATIVE_INFINITY,h=Number.POSITIVE_INFINITY,l=Number.NEGATIVE_INFINITY;for(let e=0;e<a;e+=1){const r=s[e],{id:n,x:i,y:a}=r;if(o&&t.degree(n)<=1)continue;const d=this.bodies[n];d&&(d.setPos(i,a),i<u&&(u=i),i>c&&(c=i),a<h&&(h=a),a>l&&(l=a))}let d=Math.max(c-u,l-h);(!isFinite(d)||d<=0)&&(d=1);const f=new zy({xmid:(c+u)/2,ymid:(l+h)/2,length:d,massCenter:n,mass:a}),g=new Ay(f);for(let e=0;e<a;e+=1){const{id:r}=s[e];if(o&&t.degree(r)<=1)continue;const n=this.bodies[r];n&&n.in(f)&&g.insert(n)}for(let e=0;e<a;e+=1){const i=s[e],{id:a,x:u,y:c}=i,h=t.degree(a);if(o&&h<=1)continue;const l=this.bodies[a];if(!l)continue;l.resetForce(),g.updateForce(l),this.forces[a][0]-=l.fx,this.forces[a][1]-=l.fy;const d=u-n[0],f=c-n[1];let p=Math.hypot(d,f);p=p<1e-4?1e-4:p;const v=d/p,m=f/p,y=r*(h+1);this.forces[a][0]-=y*v,this.forces[a][1]-=y*m}}calculateRepulsiveGravity(t,e){const{model:r,options:n}=this,{preventOverlap:o,kr:i,kg:s,center:a,prune:u}=n,c=r.nodes(),h=c.length;for(let t=0;t<h;t+=1){const n=c[t],l=r.degree(n.id);for(let s=t+1;s<h;s+=1){const t=c[s],a=r.degree(t.id);if(u&&(l<=1||a<=1))continue;const h=t.x-n.x,d=t.y-n.y;let f=Math.hypot(h,d);f=f<1e-4?1e-4:f;const g=h/f,p=d/f;let v,m=f;if(o){const r=f-this.sizes[n.id]-this.sizes[t.id];r<0?v=e*(l+1)*(a+1):0===r?v=0:(m=r,v=i*(l+1)*(a+1)/m)}else v=i*(l+1)*(a+1)/m;this.forces[n.id][0]-=v*g,this.forces[n.id][1]-=v*p,this.forces[t.id][0]+=v*g,this.forces[t.id][1]+=v*p}const d=n.x-a[0],f=n.y-a[1];let g=Math.hypot(d,f);g=g<1e-4?1e-4:g;const p=d/g,v=f/g,m=s*(l+1);this.forces[n.id][0]-=m*p,this.forces[n.id][1]-=m*v}}updatePositions(){const{model:t,options:e}=this,{ks:r,tao:n,prune:o,ksmax:i,distanceThresholdMode:s="max"}=e,a=t.nodes(),u=a.length,c={},h={};let l=0,d=0;for(let e=0;e<u;e+=1){const{id:r}=a[e],n=t.degree(r);if(o&&n<=1)continue;const i=this.preForces[r]||[0,0],s=this.forces[r]||[0,0],u=s[0]-i[0],f=s[1]-i[1],g=Math.hypot(u,f),p=s[0]+i[0],v=s[1]+i[1],m=Math.hypot(p,v);c[r]=g,h[r]=m/2,l+=(n+1)*c[r],d+=(n+1)*h[r]}let f=this.sg;const g=this.sg;l<=0?f=g>0?g:1:(f=n*d/l,0!==g&&(f=f>1.5*g?1.5*g:f)),this.sg=f;let p=0,v=1/0,m=0,y=0;for(let e=0;e<u;e+=1){const n=a[e],s=n.id,u=t.degree(s);if(o&&u<=1)continue;if(this.isNodeFixed(n))continue;const h=c[s]||0;let l=r*f/(1+f*Math.sqrt(h)),d=Math.hypot(this.forces[s][0],this.forces[s][1]);d=d<1e-4?1e-4:d;const g=i/d;l>g&&(l=g);const w=l*this.forces[s][0],x=l*this.forces[s][1];n.x+=w,n.y+=x;const b=Math.hypot(w,x);b>0&&(y++,m+=b,b>p&&(p=b),b<v&&(v=b))}switch(s){case"min":return v;case"mean":return y>0?m/y:0;default:return p}}destroy(){this.stop(),this.forces={},this.preForces={},this.bodies={},this.sizes={},this.off()}};const jy={nodeSize:10,nodeSpacing:0,width:300,height:300,kr:5,kg:1,mode:"normal",preventOverlap:!1,dissuadeHubs:!1,maxIteration:0,ks:.1,ksmax:10,tao:.1};class Cy extends ft{constructor(){super(...arguments),this.id="force-atlas2",this.simulation=null}getDefaultOptions(){return jy}layout(t){return r(this,void 0,void 0,function*(){const e=this.parseOptions(t),{width:r,height:n,prune:o,center:i}=e,s=this.model.nodeCount();if(!s||1===s)return H(this.model,i);N(this.model,r,n);const a=this.getSizes(e.nodeSize,e.nodeSpacing),u=this.setSimulation();u.data(this.model,a),u.initialize(e),u.restart();const c=()=>new Promise(t=>{u.on("end",t)});if(!o)return c();if(yield c(),o){const t=this.model.edges();for(let e=0;e<t.length;e+=1){const{source:r,target:n}=t[e],o=this.model.degree(r),i=this.model.degree(n),s=this.model.node(r),a=this.model.node(n);o<=1?(s.x=a.x,s.y=a.y):i<=1&&(a.x=s.x,a.y=s.y)}u.initialize(Object.assign(Object.assign({},e),{prune:!1,barnesHut:!1})),u.tick(100)}})}getSizes(t,e){const r={};return this.model.forEachNode(n=>{const o=mt(t,e);r[n.id]=o(n._original)}),r}setSimulation(){const t=this.simulation||new Oy;return this.simulation||(this.simulation=t.on("tick",()=>{var t,e;return null===(e=(t=this.options).onTick)||void 0===e?void 0:e.call(t,this)})),this.simulation}parseOptions(t={}){const{barnesHut:e,prune:r,maxIteration:n,kr:o,kg:i,nodeSize:s,nodeSpacing:a}=t,u={},c=this.model.nodeCount();return void 0===e&&c>250&&(u.barnesHut=!0),void 0===r&&c>100&&(u.prune=!0),0!==n||r?0===n&&r&&(u.maxIteration=100,c<=200&&c>100?u.maxIteration=500:c>200&&(u.maxIteration=950)):(u.maxIteration=250,c<=200&&c>100?u.maxIteration=1e3:c>200&&(u.maxIteration=1200)),o||(u.kr=50,c>100&&c<=500?u.kr=20:c>500&&(u.kr=1)),i||(u.kg=20,c>100&&c<=500?u.kg=10:c>500&&(u.kg=1)),Object.assign(Object.assign(Object.assign(Object.assign({},t),u),lt(t)),{nodeSize:vt(s,jy.nodeSize),nodeSpacing:pt(a,jy.nodeSpacing)})}stop(){var t;null===(t=this.simulation)||void 0===t||t.stop()}tick(t=1){var e;null===(e=this.simulation)||void 0===e||e.tick(t)}restart(){var t;null===(t=this.simulation)||void 0===t||t.restart()}setFixedPosition(t,e){var r;null===(r=this.simulation)||void 0===r||r.setFixedPosition(t,e)}destroy(){var t;super.destroy(),this.stop(),null===(t=this.simulation)||void 0===t||t.destroy(),this.simulation=null}}class Iy extends My{constructor(){super(...arguments),this.displacements=null,this.clusterMap=null}data(t){return this.model=t,this}initialize(t){super.initialize(t),this.recomputeConstants(),this.displacements=null,this.clusterMap=null,this.initDisplacements()}recomputeConstants(){const{model:t,options:e}=this,{width:r,height:n}=lt(e),o=r*n;this.k2=o/(t.nodeCount()+1),this.k=Math.sqrt(this.k2),this.maxDisplace=Math.sqrt(o)/10}runOneStep(){return this.syncFixedPositions(),this.initDisplacements(),this.calculateRepulsive(),this.calculateAttractive(),this.applyClusterGravity(),this.applyGlobalGravity(),this.updatePositions()}setFixedPosition(t,e){const r=this.model.node(t);if(!r)return;const n=["fx","fy","fz"];null!==e?e.forEach((t,e)=>{e<n.length&&("number"==typeof t||null===t)&&(r[n[e]]=t)}):n.forEach(t=>{delete r[t]})}isNodeFixed(t){return!o(t.fx)&&!o(t.fy)}syncFixedPositions(){const{model:t,options:e}=this,r=3===e.dimensions;t.forEachNode(t=>{this.isNodeFixed(t)&&(t.x=t.fx,t.y=t.fy,r&&void 0!==t.fz&&(t.z=t.fz))})}initDisplacements(){this.displacements||(this.displacements=new Map,this.model.forEachNode(t=>{this.displacements.set(t.id,{x:0,y:0,z:0})})),this.displacements.forEach(t=>{t.x=0,t.y=0,t.z=0})}calculateRepulsive(){const{model:t,options:e}=this,r=3===e.dimensions,n=t.nodes();for(let t=0;t<n.length;t++){const e=n[t],o=this.displacements.get(e.id),i=this.isNodeFixed(e);for(let s=t+1;s<n.length;s++){const t=n[s],a=this.displacements.get(t.id),u=this.isNodeFixed(t);let c=e.x-t.x,h=e.y-t.y,l=r?e.z-t.z:0,d=c*c+h*h+l*l;0===d&&(d=1,c=.01,h=.01,l=.01);const f=this.k2/d,g=c*f,p=h*f,v=l*f;i||u?i&&!u?(a.x-=2*g,a.y-=2*p,r&&(a.z-=2*v)):!i&&u&&(o.x+=2*g,o.y+=2*p,r&&(o.z+=2*v)):(o.x+=g,o.y+=p,a.x-=g,a.y-=p,r&&(o.z+=v,a.z-=v))}}}calculateAttractive(){const{model:t,options:e}=this,r=3===e.dimensions;t.forEachEdge(e=>{const{source:n,target:o}=e;if(!n||!o||n===o)return;const i=t.node(n),s=t.node(o),a=this.displacements.get(n),u=this.displacements.get(o),c=this.isNodeFixed(i),h=this.isNodeFixed(s),l=s.x-i.x,d=s.y-i.y,f=r?s.z-i.z:0,g=Math.sqrt(l*l+d*d+f*f);if(0===g)return;const p=g/this.k,v=l*p,m=d*p,y=f*p;c||h?c&&!h?(u.x-=2*v,u.y-=2*m,r&&(u.z-=2*y)):!c&&h&&(a.x+=2*v,a.y+=2*m,r&&(a.z+=2*y)):(a.x+=v,a.y+=m,u.x-=v,u.y-=m,r&&(a.z+=y,u.z-=y))})}applyClusterGravity(){const{model:t,options:e}=this,{nodeClusterBy:r,clusterGravity:n,dimensions:o,clustering:i}=e;if(!i)return;if(this.clusterMap||(this.clusterMap=new Map,t.forEachNode(e=>{const n=r(t.originalNode(e.id));this.clusterMap.has(n)||this.clusterMap.set(n,{name:n,cx:0,cy:0,cz:0,count:0})})),0===this.clusterMap.size)return;const s=3===o;this.clusterMap.forEach(t=>{t.cx=0,t.cy=0,t.cz=0,t.count=0}),t.forEachNode(e=>{const n=r(t.originalNode(e.id)),o=this.clusterMap.get(n);o&&(o.cx+=e.x,o.cy+=e.y,s&&(o.cz+=e.z),o.count++)}),this.clusterMap.forEach(t=>{t.count>0&&(t.cx/=t.count,t.cy/=t.count,t.cz/=t.count)}),t.forEachNode(e=>{const{id:o}=e;if(this.isNodeFixed(e))return;const i=r(t.originalNode(o)),a=this.clusterMap.get(i);if(!a)return;const u=this.displacements.get(o),c=e.x-a.cx,h=e.y-a.cy,l=s?e.z-a.cz:0,d=Math.sqrt(c*c+h*h+l*l);if(0===d)return;const f=this.k*n;u.x-=f*c/d,u.y-=f*h/d,s&&(u.z-=f*l/d)})}applyGlobalGravity(){const{model:t,options:e}=this,{gravity:r,center:n,dimensions:o}=e,i=3===o,s=.01*this.k*r;t.forEachNode(t=>{const{id:e}=t;if(this.isNodeFixed(t))return;const r=this.displacements.get(e);r.x-=s*(t.x-n[0]),r.y-=s*(t.y-n[1]),i&&(r.z-=s*(t.z-(n[2]||0)))})}updatePositions(){const{model:t,options:e}=this,{speed:r,dimensions:n,distanceThresholdMode:o="max"}=e,i=3===n;let s=0,a=1/0,u=0,c=0;if(t.forEachNode(t=>{const{id:e}=t;if(this.isNodeFixed(t))return;const n=this.displacements.get(e),o=Math.sqrt(n.x*n.x+n.y*n.y+(i?n.z*n.z:0));if(0===o)return;const h=Math.min(this.maxDisplace*(r/800),o),l=h/o;t.x+=n.x*l,t.y+=n.y*l,i&&(t.z=t.z+n.z*l),s=Math.max(s,h),a=Math.min(a,h),u+=h,c++}),0===c)return 0;switch(o){case"min":return a===1/0?0:a;case"mean":return u/c;default:return s}}destroy(){var t,e;this.stop(),null===(t=this.displacements)||void 0===t||t.clear(),null===(e=this.clusterMap)||void 0===e||e.clear()}}const Ry={maxIteration:1e3,gravity:10,speed:5,clustering:!1,clusterGravity:10,width:300,height:300,nodeClusterBy:"data.cluster",dimensions:2};class Py extends ft{constructor(){super(...arguments),this.id="fruchterman",this.simulation=null}getDefaultOptions(){return Ry}parseOptions(t){const{clustering:e,nodeClusterBy:r}=this.options,n=e&&!!r,o="string"==typeof r?t=>et(t,r):r;return Object.assign(t||(t={}),lt(t),{clustering:n,nodeClusterBy:o}),t}layout(){return r(this,void 0,void 0,function*(){const t=this.parseOptions(this.options),{dimensions:e,center:r,width:n,height:o}=t,i=this.model.nodeCount();if(!i||1===i)return void H(this.model,r,e);N(this.model,n,o,e);const s=this.setSimulation();return s.data(this.model),s.initialize(t),s.restart(),new Promise(t=>{s.on("end",()=>t())})})}setSimulation(){const t=this.simulation||new Iy;return this.simulation||(this.simulation=t.on("tick",()=>{var t,e;return null===(e=(t=this.options).onTick)||void 0===e?void 0:e.call(t,this)})),this.simulation}restart(){var t;null===(t=this.simulation)||void 0===t||t.restart()}stop(){var t;null===(t=this.simulation)||void 0===t||t.stop()}tick(t=1){var e;null===(e=this.simulation)||void 0===e||e.tick(t)}setFixedPosition(t,e){var r;null===(r=this.simulation)||void 0===r||r.setFixedPosition(t,e)}destroy(){var t;super.destroy(),this.stop(),null===(t=this.simulation)||void 0===t||t.destroy(),this.simulation=null}}class Ty extends dt{constructor(){super(...arguments),this.id="grid"}getDefaultOptions(){return{begin:[0,0],preventOverlap:!0,preventOverlapPadding:10,condense:!1,rows:void 0,cols:void 0,position:void 0,sortBy:"degree",nodeSize:30,width:300,height:300}}normalizeOptions(t={},e){var r;const{rows:n,cols:o}=t,{width:i,height:s,center:a}=lt(t);let u=t.rows,c=t.cols;const h=e.nodeCount();if(null!=n&&null!=o)u=n,c=o;else if(null!=n&&null==o)u=n,c=Math.ceil(h/u);else if(null==n&&null!=o)c=o,u=Math.ceil(h/c);else{const t=Math.sqrt(h*s/i);u=Math.round(t),c=Math.round(i/s*t)}u=Math.max(u,1),c=Math.max(c,1);const l={rows:u,cols:c};if(l.cols*l.rows>h){const t=Fy(l),e=Ly(l);(t-1)*e>=h?Fy(l,t-1):(e-1)*t>=h&&Ly(l,e-1)}else for(;l.cols*l.rows<h;){const t=Fy(l),e=Ly(l);(e+1)*t>=h?Ly(l,e+1):Fy(l,t+1)}const d=t.preventOverlap||void 0!==t.nodeSpacing,f=pt(t.nodeSpacing,10),g=vt(t.nodeSize,30);return Object.assign(Object.assign({},t),{begin:t.begin||[0,0],sortBy:t.sortBy||"degree",preventOverlapPadding:null!==(r=t.preventOverlapPadding)&&void 0!==r?r:0,preventOverlap:d,nodeSpacing:f,nodeSize:g,rcs:l,center:a,width:i,height:s})}layout(){return r(this,void 0,void 0,function*(){const{begin:t,rcs:e,sortBy:r,width:n,height:o,condense:i,preventOverlapPadding:s,preventOverlap:a,nodeSpacing:u,nodeSize:c,position:h}=this.normalizeOptions(this.options,this.model),l=this.model.nodeCount();if(!l||1===l)return void H(this.model,t);"degree"===r?it(this.model):"id"===r?st(this.model):at(this.model,r);let d=i?0:n/e.cols,f=i?0:o/e.rows;a&&this.model.forEachNode(t=>{const e=t._original,[r,n]=ht(c(e)||30),o=void 0!==u?u(e):s,i=r+o,a=n+o;d=Math.max(d,i),f=Math.max(f,a)});const g={},p={row:0,col:0},v={};this.model.forEachNode(r=>{const n=r._original;let o;if(h&&(o=h(n)),o&&(void 0!==o.row||void 0!==o.col)){const t={row:o.row,col:o.col};if(void 0===t.col)for(t.col=0;Dy(g,t);)t.col++;else if(void 0===t.row)for(t.row=0;Dy(g,t);)t.row++;v[r.id]=t,qy(g,t)}By(r,t,d,f,v,e,p,g)})})}}const Fy=(t,e)=>{let r;const n=t.rows||5,o=t.cols||5;if(null==e)r=Math.min(n,o);else{Math.min(n,o)===t.rows?t.rows=e:t.cols=e}return r},Ly=(t,e)=>{let r;const n=t.rows||5,o=t.cols||5;if(null==e)r=Math.max(n,o);else{Math.max(n,o)===t.rows?t.rows=e:t.cols=e}return r},Dy=(t,e)=>t[`c-${e.row}-${e.col}`]||!1,qy=(t,e)=>t[`c-${e.row}-${e.col}`]=!0,Vy=(t,e)=>{const r=t.cols||5;e.col++,e.col>=r&&(e.col=0,e.row++)},By=(t,e,r,n,o,i,s,a)=>{let u,c;const h=o[t.id];if(h)u=h.col*r+r/2+e[0],c=h.row*n+n/2+e[1];else{for(;Dy(a,s);)Vy(i,s);u=s.col*r+r/2+e[0],c=s.row*n+n/2+e[1],qy(a,s),Vy(i,s)}t.x=u,t.y=c};var $y={};const Gy=Object.prototype.toString;function Uy(t){const e=Gy.call(t);return e.endsWith("Array]")&&!e.includes("Big")}var Wy=os(Object.freeze({__proto__:null,isAnyArray:Uy}));var Yy,Hy=Object.freeze({__proto__:null,default:function(t){var e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!Uy(t))throw new TypeError("input must be an array");if(0===t.length)throw new TypeError("input must not be empty");if(void 0!==r.output){if(!Uy(r.output))throw new TypeError("output option must be an array if specified");e=r.output}else e=new Array(t.length);var n=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!Uy(t))throw new TypeError("input must be an array");if(0===t.length)throw new TypeError("input must not be empty");var r=e.fromIndex,n=void 0===r?0:r,o=e.toIndex,i=void 0===o?t.length:o;if(n<0||n>=t.length||!Number.isInteger(n))throw new Error("fromIndex must be a positive integer smaller than length");if(i<=n||i>t.length||!Number.isInteger(i))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var s=t[n],a=n+1;a<i;a++)t[a]<s&&(s=t[a]);return s}(t),o=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!Uy(t))throw new TypeError("input must be an array");if(0===t.length)throw new TypeError("input must not be empty");var r=e.fromIndex,n=void 0===r?0:r,o=e.toIndex,i=void 0===o?t.length:o;if(n<0||n>=t.length||!Number.isInteger(n))throw new Error("fromIndex must be a positive integer smaller than length");if(i<=n||i>t.length||!Number.isInteger(i))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var s=t[n],a=n+1;a<i;a++)t[a]>s&&(s=t[a]);return s}(t);if(n===o)throw new RangeError("minimum and maximum input values are equal. Cannot rescale a constant array");var i=r.min,s=void 0===i?r.autoMinMax?n:0:i,a=r.max,u=void 0===a?r.autoMinMax?o:1:a;if(s>=u)throw new RangeError("min option must be smaller than max option");for(var c=(u-s)/(o-n),h=0;h<t.length;h++)e[h]=(t[h]-n)*c+s;return e}}),Xy=os(Hy);function Qy(){if(Yy)return $y;Yy=1,Object.defineProperty($y,"__esModule",{value:!0});var t=Wy,e=Xy;const r=" ".repeat(2),n=" ".repeat(4);function o(t,e={}){const{maxRows:o=15,maxColumns:s=10,maxNumSize:a=8,padMinus:u="auto"}=e;return`${t.constructor.name} {\n${r}[\n${n}${function(t,e,r,o,s){const{rows:a,columns:u}=t,c=Math.min(a,e),h=Math.min(u,r),l=[];if("auto"===s){s=!1;t:for(let e=0;e<c;e++)for(let r=0;r<h;r++)if(t.get(e,r)<0){s=!0;break t}}for(let e=0;e<c;e++){let r=[];for(let n=0;n<h;n++)r.push(i(t.get(e,n),o,s));l.push(`${r.join(" ")}`)}h!==u&&(l[l.length-1]+=` ... ${u-r} more columns`);c!==a&&l.push(`... ${a-e} more rows`);return l.join(`\n${n}`)}(t,o,s,a,u)}\n${r}]\n${r}rows: ${t.rows}\n${r}columns: ${t.columns}\n}`}function i(t,e,r){return(t>=0&&r?` ${s(t,e-1)}`:s(t,e)).padEnd(e)}function s(t,e){let r=t.toString();if(r.length<=e)return r;let n=t.toFixed(e);if(n.length>e&&(n=t.toFixed(Math.max(0,e-(n.length-e)))),n.length<=e&&!n.startsWith("0.000")&&!n.startsWith("-0.000"))return n;let o=t.toExponential(e);return o.length>e&&(o=t.toExponential(Math.max(0,e-(o.length-e)))),o.slice(0)}function a(t,e,r){let n=r?t.rows:t.rows-1;if(e<0||e>n)throw new RangeError("Row index out of range")}function u(t,e,r){let n=r?t.columns:t.columns-1;if(e<0||e>n)throw new RangeError("Column index out of range")}function c(t,e){if(e.to1DArray&&(e=e.to1DArray()),e.length!==t.columns)throw new RangeError("vector size must be the same as the number of columns");return e}function h(t,e){if(e.to1DArray&&(e=e.to1DArray()),e.length!==t.rows)throw new RangeError("vector size must be the same as the number of rows");return e}function l(e,r){if(!t.isAnyArray(r))throw new TypeError("row indices must be an array");for(let t=0;t<r.length;t++)if(r[t]<0||r[t]>=e.rows)throw new RangeError("row indices are out of range")}function d(e,r){if(!t.isAnyArray(r))throw new TypeError("column indices must be an array");for(let t=0;t<r.length;t++)if(r[t]<0||r[t]>=e.columns)throw new RangeError("column indices are out of range")}function f(t,e,r,n,o){if(5!==arguments.length)throw new RangeError("expected 4 arguments");if(p("startRow",e),p("endRow",r),p("startColumn",n),p("endColumn",o),e>r||n>o||e<0||e>=t.rows||r<0||r>=t.rows||n<0||n>=t.columns||o<0||o>=t.columns)throw new RangeError("Submatrix indices are out of range")}function g(t,e=0){let r=[];for(let n=0;n<t;n++)r.push(e);return r}function p(t,e){if("number"!=typeof e)throw new TypeError(`${t} must be a number`)}function v(t){if(t.isEmpty())throw new Error("Empty matrix has no elements to index")}class m{static from1DArray(t,e,r){if(t*e!==r.length)throw new RangeError("data length does not match given dimensions");let n=new x(t,e);for(let o=0;o<t;o++)for(let t=0;t<e;t++)n.set(o,t,r[o*e+t]);return n}static rowVector(t){let e=new x(1,t.length);for(let r=0;r<t.length;r++)e.set(0,r,t[r]);return e}static columnVector(t){let e=new x(t.length,1);for(let r=0;r<t.length;r++)e.set(r,0,t[r]);return e}static zeros(t,e){return new x(t,e)}static ones(t,e){return new x(t,e).fill(1)}static rand(t,e,r={}){if("object"!=typeof r)throw new TypeError("options must be an object");const{random:n=Math.random}=r;let o=new x(t,e);for(let r=0;r<t;r++)for(let t=0;t<e;t++)o.set(r,t,n());return o}static randInt(t,e,r={}){if("object"!=typeof r)throw new TypeError("options must be an object");const{min:n=0,max:o=1e3,random:i=Math.random}=r;if(!Number.isInteger(n))throw new TypeError("min must be an integer");if(!Number.isInteger(o))throw new TypeError("max must be an integer");if(n>=o)throw new RangeError("min must be smaller than max");let s=o-n,a=new x(t,e);for(let r=0;r<t;r++)for(let t=0;t<e;t++){let e=n+Math.round(i()*s);a.set(r,t,e)}return a}static eye(t,e,r){void 0===e&&(e=t),void 0===r&&(r=1);let n=Math.min(t,e),o=this.zeros(t,e);for(let t=0;t<n;t++)o.set(t,t,r);return o}static diag(t,e,r){let n=t.length;void 0===e&&(e=n),void 0===r&&(r=e);let o=Math.min(n,e,r),i=this.zeros(e,r);for(let e=0;e<o;e++)i.set(e,e,t[e]);return i}static min(t,e){t=this.checkMatrix(t),e=this.checkMatrix(e);let r=t.rows,n=t.columns,o=new x(r,n);for(let i=0;i<r;i++)for(let r=0;r<n;r++)o.set(i,r,Math.min(t.get(i,r),e.get(i,r)));return o}static max(t,e){t=this.checkMatrix(t),e=this.checkMatrix(e);let r=t.rows,n=t.columns,o=new this(r,n);for(let i=0;i<r;i++)for(let r=0;r<n;r++)o.set(i,r,Math.max(t.get(i,r),e.get(i,r)));return o}static checkMatrix(t){return m.isMatrix(t)?t:new x(t)}static isMatrix(t){return null!=t&&"Matrix"===t.klass}get size(){return this.rows*this.columns}apply(t){if("function"!=typeof t)throw new TypeError("callback must be a function");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)t.call(this,e,r);return this}to1DArray(){let t=[];for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)t.push(this.get(e,r));return t}to2DArray(){let t=[];for(let e=0;e<this.rows;e++){t.push([]);for(let r=0;r<this.columns;r++)t[e].push(this.get(e,r))}return t}toJSON(){return this.to2DArray()}isRowVector(){return 1===this.rows}isColumnVector(){return 1===this.columns}isVector(){return 1===this.rows||1===this.columns}isSquare(){return this.rows===this.columns}isEmpty(){return 0===this.rows||0===this.columns}isSymmetric(){if(this.isSquare()){for(let t=0;t<this.rows;t++)for(let e=0;e<=t;e++)if(this.get(t,e)!==this.get(e,t))return!1;return!0}return!1}isDistance(){if(!this.isSymmetric())return!1;for(let t=0;t<this.rows;t++)if(0!==this.get(t,t))return!1;return!0}isEchelonForm(){let t=0,e=0,r=-1,n=!0,o=!1;for(;t<this.rows&&n;){for(e=0,o=!1;e<this.columns&&!1===o;)0===this.get(t,e)?e++:1===this.get(t,e)&&e>r?(o=!0,r=e):(n=!1,o=!0);t++}return n}isReducedEchelonForm(){let t=0,e=0,r=-1,n=!0,o=!1;for(;t<this.rows&&n;){for(e=0,o=!1;e<this.columns&&!1===o;)0===this.get(t,e)?e++:1===this.get(t,e)&&e>r?(o=!0,r=e):(n=!1,o=!0);for(let r=e+1;r<this.rows;r++)0!==this.get(t,r)&&(n=!1);t++}return n}echelonForm(){let t=this.clone(),e=0,r=0;for(;e<t.rows&&r<t.columns;){let n=e;for(let o=e;o<t.rows;o++)t.get(o,r)>t.get(n,r)&&(n=o);if(0===t.get(n,r))r++;else{t.swapRows(e,n);let o=t.get(e,r);for(let n=r;n<t.columns;n++)t.set(e,n,t.get(e,n)/o);for(let n=e+1;n<t.rows;n++){let o=t.get(n,r)/t.get(e,r);t.set(n,r,0);for(let i=r+1;i<t.columns;i++)t.set(n,i,t.get(n,i)-t.get(e,i)*o)}e++,r++}}return t}reducedEchelonForm(){let t=this.echelonForm(),e=t.columns,r=t.rows,n=r-1;for(;n>=0;)if(0===t.maxRow(n))n--;else{let o=0,i=!1;for(;o<r&&!1===i;)1===t.get(n,o)?i=!0:o++;for(let r=0;r<n;r++){let i=t.get(r,o);for(let s=o;s<e;s++){let e=t.get(r,s)-i*t.get(n,s);t.set(r,s,e)}}n--}return t}set(){throw new Error("set method is unimplemented")}get(){throw new Error("get method is unimplemented")}repeat(t={}){if("object"!=typeof t)throw new TypeError("options must be an object");const{rows:e=1,columns:r=1}=t;if(!Number.isInteger(e)||e<=0)throw new TypeError("rows must be a positive integer");if(!Number.isInteger(r)||r<=0)throw new TypeError("columns must be a positive integer");let n=new x(this.rows*e,this.columns*r);for(let t=0;t<e;t++)for(let e=0;e<r;e++)n.setSubMatrix(this,this.rows*t,this.columns*e);return n}fill(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,t);return this}neg(){return this.mulS(-1)}getRow(t){a(this,t);let e=[];for(let r=0;r<this.columns;r++)e.push(this.get(t,r));return e}getRowVector(t){return x.rowVector(this.getRow(t))}setRow(t,e){a(this,t),e=c(this,e);for(let r=0;r<this.columns;r++)this.set(t,r,e[r]);return this}swapRows(t,e){a(this,t),a(this,e);for(let r=0;r<this.columns;r++){let n=this.get(t,r);this.set(t,r,this.get(e,r)),this.set(e,r,n)}return this}getColumn(t){u(this,t);let e=[];for(let r=0;r<this.rows;r++)e.push(this.get(r,t));return e}getColumnVector(t){return x.columnVector(this.getColumn(t))}setColumn(t,e){u(this,t),e=h(this,e);for(let r=0;r<this.rows;r++)this.set(r,t,e[r]);return this}swapColumns(t,e){u(this,t),u(this,e);for(let r=0;r<this.rows;r++){let n=this.get(r,t);this.set(r,t,this.get(r,e)),this.set(r,e,n)}return this}addRowVector(t){t=c(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)+t[r]);return this}subRowVector(t){t=c(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)-t[r]);return this}mulRowVector(t){t=c(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)*t[r]);return this}divRowVector(t){t=c(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)/t[r]);return this}addColumnVector(t){t=h(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)+t[e]);return this}subColumnVector(t){t=h(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)-t[e]);return this}mulColumnVector(t){t=h(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)*t[e]);return this}divColumnVector(t){t=h(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)/t[e]);return this}mulRow(t,e){a(this,t);for(let r=0;r<this.columns;r++)this.set(t,r,this.get(t,r)*e);return this}mulColumn(t,e){u(this,t);for(let r=0;r<this.rows;r++)this.set(r,t,this.get(r,t)*e);return this}max(t){if(this.isEmpty())return NaN;switch(t){case"row":{const t=new Array(this.rows).fill(Number.NEGATIVE_INFINITY);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.get(e,r)>t[e]&&(t[e]=this.get(e,r));return t}case"column":{const t=new Array(this.columns).fill(Number.NEGATIVE_INFINITY);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.get(e,r)>t[r]&&(t[r]=this.get(e,r));return t}case void 0:{let t=this.get(0,0);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.get(e,r)>t&&(t=this.get(e,r));return t}default:throw new Error(`invalid option: ${t}`)}}maxIndex(){v(this);let t=this.get(0,0),e=[0,0];for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.get(r,n)>t&&(t=this.get(r,n),e[0]=r,e[1]=n);return e}min(t){if(this.isEmpty())return NaN;switch(t){case"row":{const t=new Array(this.rows).fill(Number.POSITIVE_INFINITY);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.get(e,r)<t[e]&&(t[e]=this.get(e,r));return t}case"column":{const t=new Array(this.columns).fill(Number.POSITIVE_INFINITY);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.get(e,r)<t[r]&&(t[r]=this.get(e,r));return t}case void 0:{let t=this.get(0,0);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.get(e,r)<t&&(t=this.get(e,r));return t}default:throw new Error(`invalid option: ${t}`)}}minIndex(){v(this);let t=this.get(0,0),e=[0,0];for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.get(r,n)<t&&(t=this.get(r,n),e[0]=r,e[1]=n);return e}maxRow(t){if(a(this,t),this.isEmpty())return NaN;let e=this.get(t,0);for(let r=1;r<this.columns;r++)this.get(t,r)>e&&(e=this.get(t,r));return e}maxRowIndex(t){a(this,t),v(this);let e=this.get(t,0),r=[t,0];for(let n=1;n<this.columns;n++)this.get(t,n)>e&&(e=this.get(t,n),r[1]=n);return r}minRow(t){if(a(this,t),this.isEmpty())return NaN;let e=this.get(t,0);for(let r=1;r<this.columns;r++)this.get(t,r)<e&&(e=this.get(t,r));return e}minRowIndex(t){a(this,t),v(this);let e=this.get(t,0),r=[t,0];for(let n=1;n<this.columns;n++)this.get(t,n)<e&&(e=this.get(t,n),r[1]=n);return r}maxColumn(t){if(u(this,t),this.isEmpty())return NaN;let e=this.get(0,t);for(let r=1;r<this.rows;r++)this.get(r,t)>e&&(e=this.get(r,t));return e}maxColumnIndex(t){u(this,t),v(this);let e=this.get(0,t),r=[0,t];for(let n=1;n<this.rows;n++)this.get(n,t)>e&&(e=this.get(n,t),r[0]=n);return r}minColumn(t){if(u(this,t),this.isEmpty())return NaN;let e=this.get(0,t);for(let r=1;r<this.rows;r++)this.get(r,t)<e&&(e=this.get(r,t));return e}minColumnIndex(t){u(this,t),v(this);let e=this.get(0,t),r=[0,t];for(let n=1;n<this.rows;n++)this.get(n,t)<e&&(e=this.get(n,t),r[0]=n);return r}diag(){let t=Math.min(this.rows,this.columns),e=[];for(let r=0;r<t;r++)e.push(this.get(r,r));return e}norm(t="frobenius"){switch(t){case"max":return this.max();case"frobenius":return Math.sqrt(this.dot(this));default:throw new RangeError(`unknown norm type: ${t}`)}}cumulativeSum(){let t=0;for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)t+=this.get(e,r),this.set(e,r,t);return this}dot(t){m.isMatrix(t)&&(t=t.to1DArray());let e=this.to1DArray();if(e.length!==t.length)throw new RangeError("vectors do not have the same size");let r=0;for(let n=0;n<e.length;n++)r+=e[n]*t[n];return r}mmul(t){t=x.checkMatrix(t);let e=this.rows,r=this.columns,n=t.columns,o=new x(e,n),i=new Float64Array(r);for(let s=0;s<n;s++){for(let e=0;e<r;e++)i[e]=t.get(e,s);for(let t=0;t<e;t++){let e=0;for(let n=0;n<r;n++)e+=this.get(t,n)*i[n];o.set(t,s,e)}}return o}mpow(t){if(!this.isSquare())throw new RangeError("Matrix must be square");if(!Number.isInteger(t)||t<0)throw new RangeError("Exponent must be a non-negative integer");let e=x.eye(this.rows),r=this;for(let n=t;n>=1;n/=2)1&n&&(e=e.mmul(r)),r=r.mmul(r);return e}strassen2x2(t){t=x.checkMatrix(t);let e=new x(2,2);const r=this.get(0,0),n=t.get(0,0),o=this.get(0,1),i=t.get(0,1),s=this.get(1,0),a=t.get(1,0),u=this.get(1,1),c=t.get(1,1),h=(r+u)*(n+c),l=(s+u)*n,d=r*(i-c),f=u*(a-n),g=(r+o)*c,p=h+f-g+(o-u)*(a+c),v=d+g,m=l+f,y=h-l+d+(s-r)*(n+i);return e.set(0,0,p),e.set(0,1,v),e.set(1,0,m),e.set(1,1,y),e}strassen3x3(t){t=x.checkMatrix(t);let e=new x(3,3);const r=this.get(0,0),n=this.get(0,1),o=this.get(0,2),i=this.get(1,0),s=this.get(1,1),a=this.get(1,2),u=this.get(2,0),c=this.get(2,1),h=this.get(2,2),l=t.get(0,0),d=t.get(0,1),f=t.get(0,2),g=t.get(1,0),p=t.get(1,1),v=t.get(1,2),m=t.get(2,0),y=t.get(2,1),w=t.get(2,2),b=(r-i)*(-d+p),E=(-r+i+s)*(l-d+p),M=(i+s)*(-l+d),N=r*l,_=(-r+u+c)*(l-f+v),k=(-r+u)*(f-v),S=(u+c)*(-l+f),z=(-o+c+h)*(p+m-y),A=(o-h)*(p-y),O=o*m,j=(c+h)*(-m+y),C=(-o+s+a)*(v+m-w),I=(o-a)*(v-w),R=(s+a)*(-m+w),P=N+O+n*g,T=(r+n+o-i-s-c-h)*p+E+M+N+z+O+j,F=N+_+S+(r+n+o-s-a-u-c)*v+O+C+R,L=b+s*(-l+d+g-p-v-m+w)+E+N+O+C+I,D=b+E+M+N+a*y,q=O+C+I+R+i*f,V=N+_+k+c*(-l+f+g-p-v-m+y)+z+A+O,B=z+A+O+j+u*d,$=N+_+k+S+h*w;return e.set(0,0,P),e.set(0,1,T),e.set(0,2,F),e.set(1,0,L),e.set(1,1,D),e.set(1,2,q),e.set(2,0,V),e.set(2,1,B),e.set(2,2,$),e}mmulStrassen(t){t=x.checkMatrix(t);let e=this.clone(),r=e.rows,n=e.columns,o=t.rows,i=t.columns;function s(t,e,r){let n=t.rows,o=t.columns;if(n===e&&o===r)return t;{let n=m.zeros(e,r);return n=n.setSubMatrix(t,0,0),n}}n!==o&&console.warn(`Multiplying ${r} x ${n} and ${o} x ${i} matrix: dimensions do not match.`);let a=Math.max(r,o),u=Math.max(n,i);return e=s(e,a,u),function t(e,r,n,o){if(n<=512||o<=512)return e.mmul(r);n%2==1&&o%2==1?(e=s(e,n+1,o+1),r=s(r,n+1,o+1)):n%2==1?(e=s(e,n+1,o),r=s(r,n+1,o)):o%2==1&&(e=s(e,n,o+1),r=s(r,n,o+1));let i=parseInt(e.rows/2,10),a=parseInt(e.columns/2,10),u=e.subMatrix(0,i-1,0,a-1),c=r.subMatrix(0,i-1,0,a-1),h=e.subMatrix(0,i-1,a,e.columns-1),l=r.subMatrix(0,i-1,a,r.columns-1),d=e.subMatrix(i,e.rows-1,0,a-1),f=r.subMatrix(i,r.rows-1,0,a-1),g=e.subMatrix(i,e.rows-1,a,e.columns-1),p=r.subMatrix(i,r.rows-1,a,r.columns-1),v=t(m.add(u,g),m.add(c,p),i,a),y=t(m.add(d,g),c,i,a),w=t(u,m.sub(l,p),i,a),x=t(g,m.sub(f,c),i,a),b=t(m.add(u,h),p,i,a),E=t(m.sub(d,u),m.add(c,l),i,a),M=t(m.sub(h,g),m.add(f,p),i,a),N=m.add(v,x);N.sub(b),N.add(M);let _=m.add(w,b),k=m.add(y,x),S=m.sub(v,y);S.add(w),S.add(E);let z=m.zeros(2*N.rows,2*N.columns);return z=z.setSubMatrix(N,0,0),z=z.setSubMatrix(_,N.rows,0),z=z.setSubMatrix(k,0,N.columns),z=z.setSubMatrix(S,N.rows,N.columns),z.subMatrix(0,n-1,0,o-1)}(e,t=s(t,a,u),a,u)}scaleRows(t={}){if("object"!=typeof t)throw new TypeError("options must be an object");const{min:r=0,max:n=1}=t;if(!Number.isFinite(r))throw new TypeError("min must be a number");if(!Number.isFinite(n))throw new TypeError("max must be a number");if(r>=n)throw new RangeError("min must be smaller than max");let o=new x(this.rows,this.columns);for(let t=0;t<this.rows;t++){const i=this.getRow(t);i.length>0&&e(i,{min:r,max:n,output:i}),o.setRow(t,i)}return o}scaleColumns(t={}){if("object"!=typeof t)throw new TypeError("options must be an object");const{min:r=0,max:n=1}=t;if(!Number.isFinite(r))throw new TypeError("min must be a number");if(!Number.isFinite(n))throw new TypeError("max must be a number");if(r>=n)throw new RangeError("min must be smaller than max");let o=new x(this.rows,this.columns);for(let t=0;t<this.columns;t++){const i=this.getColumn(t);i.length&&e(i,{min:r,max:n,output:i}),o.setColumn(t,i)}return o}flipRows(){const t=Math.ceil(this.columns/2);for(let e=0;e<this.rows;e++)for(let r=0;r<t;r++){let t=this.get(e,r),n=this.get(e,this.columns-1-r);this.set(e,r,n),this.set(e,this.columns-1-r,t)}return this}flipColumns(){const t=Math.ceil(this.rows/2);for(let e=0;e<this.columns;e++)for(let r=0;r<t;r++){let t=this.get(r,e),n=this.get(this.rows-1-r,e);this.set(r,e,n),this.set(this.rows-1-r,e,t)}return this}kroneckerProduct(t){t=x.checkMatrix(t);let e=this.rows,r=this.columns,n=t.rows,o=t.columns,i=new x(e*n,r*o);for(let s=0;s<e;s++)for(let e=0;e<r;e++)for(let r=0;r<n;r++)for(let a=0;a<o;a++)i.set(n*s+r,o*e+a,this.get(s,e)*t.get(r,a));return i}kroneckerSum(t){if(t=x.checkMatrix(t),!this.isSquare()||!t.isSquare())throw new Error("Kronecker Sum needs two Square Matrices");let e=this.rows,r=t.rows,n=this.kroneckerProduct(x.eye(r,r)),o=x.eye(e,e).kroneckerProduct(t);return n.add(o)}transpose(){let t=new x(this.columns,this.rows);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)t.set(r,e,this.get(e,r));return t}sortRows(t=y){for(let e=0;e<this.rows;e++)this.setRow(e,this.getRow(e).sort(t));return this}sortColumns(t=y){for(let e=0;e<this.columns;e++)this.setColumn(e,this.getColumn(e).sort(t));return this}subMatrix(t,e,r,n){f(this,t,e,r,n);let o=new x(e-t+1,n-r+1);for(let i=t;i<=e;i++)for(let e=r;e<=n;e++)o.set(i-t,e-r,this.get(i,e));return o}subMatrixRow(t,e,r){if(void 0===e&&(e=0),void 0===r&&(r=this.columns-1),e>r||e<0||e>=this.columns||r<0||r>=this.columns)throw new RangeError("Argument out of range");let n=new x(t.length,r-e+1);for(let o=0;o<t.length;o++)for(let i=e;i<=r;i++){if(t[o]<0||t[o]>=this.rows)throw new RangeError(`Row index out of range: ${t[o]}`);n.set(o,i-e,this.get(t[o],i))}return n}subMatrixColumn(t,e,r){if(void 0===e&&(e=0),void 0===r&&(r=this.rows-1),e>r||e<0||e>=this.rows||r<0||r>=this.rows)throw new RangeError("Argument out of range");let n=new x(r-e+1,t.length);for(let o=0;o<t.length;o++)for(let i=e;i<=r;i++){if(t[o]<0||t[o]>=this.columns)throw new RangeError(`Column index out of range: ${t[o]}`);n.set(i-e,o,this.get(i,t[o]))}return n}setSubMatrix(t,e,r){if((t=x.checkMatrix(t)).isEmpty())return this;f(this,e,e+t.rows-1,r,r+t.columns-1);for(let n=0;n<t.rows;n++)for(let o=0;o<t.columns;o++)this.set(e+n,r+o,t.get(n,o));return this}selection(t,e){l(this,t),d(this,e);let r=new x(t.length,e.length);for(let n=0;n<t.length;n++){let o=t[n];for(let t=0;t<e.length;t++){let i=e[t];r.set(n,t,this.get(o,i))}}return r}trace(){let t=Math.min(this.rows,this.columns),e=0;for(let r=0;r<t;r++)e+=this.get(r,r);return e}clone(){return this.constructor.copy(this,new x(this.rows,this.columns))}static copy(t,e){for(const[r,n,o]of t.entries())e.set(r,n,o);return e}sum(t){switch(t){case"row":return function(t){let e=g(t.rows);for(let r=0;r<t.rows;++r)for(let n=0;n<t.columns;++n)e[r]+=t.get(r,n);return e}(this);case"column":return function(t){let e=g(t.columns);for(let r=0;r<t.rows;++r)for(let n=0;n<t.columns;++n)e[n]+=t.get(r,n);return e}(this);case void 0:return function(t){let e=0;for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)e+=t.get(r,n);return e}(this);default:throw new Error(`invalid option: ${t}`)}}product(t){switch(t){case"row":return function(t){let e=g(t.rows,1);for(let r=0;r<t.rows;++r)for(let n=0;n<t.columns;++n)e[r]*=t.get(r,n);return e}(this);case"column":return function(t){let e=g(t.columns,1);for(let r=0;r<t.rows;++r)for(let n=0;n<t.columns;++n)e[n]*=t.get(r,n);return e}(this);case void 0:return function(t){let e=1;for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)e*=t.get(r,n);return e}(this);default:throw new Error(`invalid option: ${t}`)}}mean(t){const e=this.sum(t);switch(t){case"row":for(let t=0;t<this.rows;t++)e[t]/=this.columns;return e;case"column":for(let t=0;t<this.columns;t++)e[t]/=this.rows;return e;case void 0:return e/this.size;default:throw new Error(`invalid option: ${t}`)}}variance(e,r={}){if("object"==typeof e&&(r=e,e=void 0),"object"!=typeof r)throw new TypeError("options must be an object");const{unbiased:n=!0,mean:o=this.mean(e)}=r;if("boolean"!=typeof n)throw new TypeError("unbiased must be a boolean");switch(e){case"row":if(!t.isAnyArray(o))throw new TypeError("mean must be an array");return function(t,e,r){const n=t.rows,o=t.columns,i=[];for(let s=0;s<n;s++){let n=0,a=0,u=0;for(let e=0;e<o;e++)u=t.get(s,e)-r[s],n+=u,a+=u*u;e?i.push((a-n*n/o)/(o-1)):i.push((a-n*n/o)/o)}return i}(this,n,o);case"column":if(!t.isAnyArray(o))throw new TypeError("mean must be an array");return function(t,e,r){const n=t.rows,o=t.columns,i=[];for(let s=0;s<o;s++){let o=0,a=0,u=0;for(let e=0;e<n;e++)u=t.get(e,s)-r[s],o+=u,a+=u*u;e?i.push((a-o*o/n)/(n-1)):i.push((a-o*o/n)/n)}return i}(this,n,o);case void 0:if("number"!=typeof o)throw new TypeError("mean must be a number");return function(t,e,r){const n=t.rows,o=t.columns,i=n*o;let s=0,a=0,u=0;for(let e=0;e<n;e++)for(let n=0;n<o;n++)u=t.get(e,n)-r,s+=u,a+=u*u;return e?(a-s*s/i)/(i-1):(a-s*s/i)/i}(this,n,o);default:throw new Error(`invalid option: ${e}`)}}standardDeviation(t,e){"object"==typeof t&&(e=t,t=void 0);const r=this.variance(t,e);if(void 0===t)return Math.sqrt(r);for(let t=0;t<r.length;t++)r[t]=Math.sqrt(r[t]);return r}center(e,r={}){if("object"==typeof e&&(r=e,e=void 0),"object"!=typeof r)throw new TypeError("options must be an object");const{center:n=this.mean(e)}=r;switch(e){case"row":if(!t.isAnyArray(n))throw new TypeError("center must be an array");return function(t,e){for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)t.set(r,n,t.get(r,n)-e[r])}(this,n),this;case"column":if(!t.isAnyArray(n))throw new TypeError("center must be an array");return function(t,e){for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)t.set(r,n,t.get(r,n)-e[n])}(this,n),this;case void 0:if("number"!=typeof n)throw new TypeError("center must be a number");return function(t,e){for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)t.set(r,n,t.get(r,n)-e)}(this,n),this;default:throw new Error(`invalid option: ${e}`)}}scale(e,r={}){if("object"==typeof e&&(r=e,e=void 0),"object"!=typeof r)throw new TypeError("options must be an object");let n=r.scale;switch(e){case"row":if(void 0===n)n=function(t){const e=[];for(let r=0;r<t.rows;r++){let n=0;for(let e=0;e<t.columns;e++)n+=t.get(r,e)**2/(t.columns-1);e.push(Math.sqrt(n))}return e}(this);else if(!t.isAnyArray(n))throw new TypeError("scale must be an array");return function(t,e){for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)t.set(r,n,t.get(r,n)/e[r])}(this,n),this;case"column":if(void 0===n)n=function(t){const e=[];for(let r=0;r<t.columns;r++){let n=0;for(let e=0;e<t.rows;e++)n+=t.get(e,r)**2/(t.rows-1);e.push(Math.sqrt(n))}return e}(this);else if(!t.isAnyArray(n))throw new TypeError("scale must be an array");return function(t,e){for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)t.set(r,n,t.get(r,n)/e[n])}(this,n),this;case void 0:if(void 0===n)n=function(t){const e=t.size-1;let r=0;for(let n=0;n<t.columns;n++)for(let o=0;o<t.rows;o++)r+=t.get(o,n)**2/e;return Math.sqrt(r)}(this);else if("number"!=typeof n)throw new TypeError("scale must be a number");return function(t,e){for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)t.set(r,n,t.get(r,n)/e)}(this,n),this;default:throw new Error(`invalid option: ${e}`)}}toString(t){return o(this,t)}[Symbol.iterator](){return this.entries()}*entries(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)yield[t,e,this.get(t,e)]}*values(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)yield this.get(t,e)}}function y(t,e){return t-e}function w(t){return t.every(t=>"number"==typeof t)}m.prototype.klass="Matrix","undefined"!=typeof Symbol&&(m.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return o(this)}),m.random=m.rand,m.randomInt=m.randInt,m.diagonal=m.diag,m.prototype.diagonal=m.prototype.diag,m.identity=m.eye,m.prototype.negate=m.prototype.neg,m.prototype.tensorProduct=m.prototype.kroneckerProduct;class x extends m{data;#t(t,e){if(this.data=[],!(Number.isInteger(e)&&e>=0))throw new TypeError("nColumns must be a positive integer");for(let r=0;r<t;r++)this.data.push(new Float64Array(e));this.rows=t,this.columns=e}constructor(e,r){if(super(),x.isMatrix(e))this.#t(e.rows,e.columns),x.copy(e,this);else if(Number.isInteger(e)&&e>=0)this.#t(e,r);else{if(!t.isAnyArray(e))throw new TypeError("First argument must be a positive number or an array");{const t=e;if("number"!=typeof(r=(e=t.length)?t[0].length:0))throw new TypeError("Data must be a 2D array with at least one element");this.data=[];for(let n=0;n<e;n++){if(t[n].length!==r)throw new RangeError("Inconsistent array dimensions");if(!w(t[n]))throw new TypeError("Input data contains non-numeric values");this.data.push(Float64Array.from(t[n]))}this.rows=e,this.columns=r}}}set(t,e,r){return this.data[t][e]=r,this}get(t,e){return this.data[t][e]}removeRow(t){return a(this,t),this.data.splice(t,1),this.rows-=1,this}addRow(t,e){return void 0===e&&(e=t,t=this.rows),a(this,t,!0),e=Float64Array.from(c(this,e)),this.data.splice(t,0,e),this.rows+=1,this}removeColumn(t){u(this,t);for(let e=0;e<this.rows;e++){const r=new Float64Array(this.columns-1);for(let n=0;n<t;n++)r[n]=this.data[e][n];for(let n=t+1;n<this.columns;n++)r[n-1]=this.data[e][n];this.data[e]=r}return this.columns-=1,this}addColumn(t,e){void 0===e&&(e=t,t=this.columns),u(this,t,!0),e=h(this,e);for(let r=0;r<this.rows;r++){const n=new Float64Array(this.columns+1);let o=0;for(;o<t;o++)n[o]=this.data[r][o];for(n[o++]=e[r];o<this.columns+1;o++)n[o]=this.data[r][o-1];this.data[r]=n}return this.columns+=1,this}}!function(t,e){t.prototype.add=function(t){return"number"==typeof t?this.addS(t):this.addM(t)},t.prototype.addS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)+t);return this},t.prototype.addM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)+t.get(e,r));return this},t.add=function(t,r){return new e(t).add(r)},t.prototype.sub=function(t){return"number"==typeof t?this.subS(t):this.subM(t)},t.prototype.subS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)-t);return this},t.prototype.subM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)-t.get(e,r));return this},t.sub=function(t,r){return new e(t).sub(r)},t.prototype.subtract=t.prototype.sub,t.prototype.subtractS=t.prototype.subS,t.prototype.subtractM=t.prototype.subM,t.subtract=t.sub,t.prototype.mul=function(t){return"number"==typeof t?this.mulS(t):this.mulM(t)},t.prototype.mulS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)*t);return this},t.prototype.mulM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)*t.get(e,r));return this},t.mul=function(t,r){return new e(t).mul(r)},t.prototype.multiply=t.prototype.mul,t.prototype.multiplyS=t.prototype.mulS,t.prototype.multiplyM=t.prototype.mulM,t.multiply=t.mul,t.prototype.div=function(t){return"number"==typeof t?this.divS(t):this.divM(t)},t.prototype.divS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)/t);return this},t.prototype.divM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)/t.get(e,r));return this},t.div=function(t,r){return new e(t).div(r)},t.prototype.divide=t.prototype.div,t.prototype.divideS=t.prototype.divS,t.prototype.divideM=t.prototype.divM,t.divide=t.div,t.prototype.mod=function(t){return"number"==typeof t?this.modS(t):this.modM(t)},t.prototype.modS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)%t);return this},t.prototype.modM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)%t.get(e,r));return this},t.mod=function(t,r){return new e(t).mod(r)},t.prototype.modulus=t.prototype.mod,t.prototype.modulusS=t.prototype.modS,t.prototype.modulusM=t.prototype.modM,t.modulus=t.mod,t.prototype.and=function(t){return"number"==typeof t?this.andS(t):this.andM(t)},t.prototype.andS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)&t);return this},t.prototype.andM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)&t.get(e,r));return this},t.and=function(t,r){return new e(t).and(r)},t.prototype.or=function(t){return"number"==typeof t?this.orS(t):this.orM(t)},t.prototype.orS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)|t);return this},t.prototype.orM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)|t.get(e,r));return this},t.or=function(t,r){return new e(t).or(r)},t.prototype.xor=function(t){return"number"==typeof t?this.xorS(t):this.xorM(t)},t.prototype.xorS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)^t);return this},t.prototype.xorM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)^t.get(e,r));return this},t.xor=function(t,r){return new e(t).xor(r)},t.prototype.leftShift=function(t){return"number"==typeof t?this.leftShiftS(t):this.leftShiftM(t)},t.prototype.leftShiftS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)<<t);return this},t.prototype.leftShiftM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)<<t.get(e,r));return this},t.leftShift=function(t,r){return new e(t).leftShift(r)},t.prototype.signPropagatingRightShift=function(t){return"number"==typeof t?this.signPropagatingRightShiftS(t):this.signPropagatingRightShiftM(t)},t.prototype.signPropagatingRightShiftS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)>>t);return this},t.prototype.signPropagatingRightShiftM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)>>t.get(e,r));return this},t.signPropagatingRightShift=function(t,r){return new e(t).signPropagatingRightShift(r)},t.prototype.rightShift=function(t){return"number"==typeof t?this.rightShiftS(t):this.rightShiftM(t)},t.prototype.rightShiftS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)>>>t);return this},t.prototype.rightShiftM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)>>>t.get(e,r));return this},t.rightShift=function(t,r){return new e(t).rightShift(r)},t.prototype.zeroFillRightShift=t.prototype.rightShift,t.prototype.zeroFillRightShiftS=t.prototype.rightShiftS,t.prototype.zeroFillRightShiftM=t.prototype.rightShiftM,t.zeroFillRightShift=t.rightShift,t.prototype.not=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,~this.get(t,e));return this},t.not=function(t){return new e(t).not()},t.prototype.abs=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.abs(this.get(t,e)));return this},t.abs=function(t){return new e(t).abs()},t.prototype.acos=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.acos(this.get(t,e)));return this},t.acos=function(t){return new e(t).acos()},t.prototype.acosh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.acosh(this.get(t,e)));return this},t.acosh=function(t){return new e(t).acosh()},t.prototype.asin=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.asin(this.get(t,e)));return this},t.asin=function(t){return new e(t).asin()},t.prototype.asinh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.asinh(this.get(t,e)));return this},t.asinh=function(t){return new e(t).asinh()},t.prototype.atan=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.atan(this.get(t,e)));return this},t.atan=function(t){return new e(t).atan()},t.prototype.atanh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.atanh(this.get(t,e)));return this},t.atanh=function(t){return new e(t).atanh()},t.prototype.cbrt=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.cbrt(this.get(t,e)));return this},t.cbrt=function(t){return new e(t).cbrt()},t.prototype.ceil=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.ceil(this.get(t,e)));return this},t.ceil=function(t){return new e(t).ceil()},t.prototype.clz32=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.clz32(this.get(t,e)));return this},t.clz32=function(t){return new e(t).clz32()},t.prototype.cos=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.cos(this.get(t,e)));return this},t.cos=function(t){return new e(t).cos()},t.prototype.cosh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.cosh(this.get(t,e)));return this},t.cosh=function(t){return new e(t).cosh()},t.prototype.exp=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.exp(this.get(t,e)));return this},t.exp=function(t){return new e(t).exp()},t.prototype.expm1=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.expm1(this.get(t,e)));return this},t.expm1=function(t){return new e(t).expm1()},t.prototype.floor=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.floor(this.get(t,e)));return this},t.floor=function(t){return new e(t).floor()},t.prototype.fround=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.fround(this.get(t,e)));return this},t.fround=function(t){return new e(t).fround()},t.prototype.log=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.log(this.get(t,e)));return this},t.log=function(t){return new e(t).log()},t.prototype.log1p=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.log1p(this.get(t,e)));return this},t.log1p=function(t){return new e(t).log1p()},t.prototype.log10=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.log10(this.get(t,e)));return this},t.log10=function(t){return new e(t).log10()},t.prototype.log2=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.log2(this.get(t,e)));return this},t.log2=function(t){return new e(t).log2()},t.prototype.round=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.round(this.get(t,e)));return this},t.round=function(t){return new e(t).round()},t.prototype.sign=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.sign(this.get(t,e)));return this},t.sign=function(t){return new e(t).sign()},t.prototype.sin=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.sin(this.get(t,e)));return this},t.sin=function(t){return new e(t).sin()},t.prototype.sinh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.sinh(this.get(t,e)));return this},t.sinh=function(t){return new e(t).sinh()},t.prototype.sqrt=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.sqrt(this.get(t,e)));return this},t.sqrt=function(t){return new e(t).sqrt()},t.prototype.tan=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.tan(this.get(t,e)));return this},t.tan=function(t){return new e(t).tan()},t.prototype.tanh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.tanh(this.get(t,e)));return this},t.tanh=function(t){return new e(t).tanh()},t.prototype.trunc=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.trunc(this.get(t,e)));return this},t.trunc=function(t){return new e(t).trunc()},t.pow=function(t,r){return new e(t).pow(r)},t.prototype.pow=function(t){return"number"==typeof t?this.powS(t):this.powM(t)},t.prototype.powS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)**t);return this},t.prototype.powM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)**t.get(e,r));return this}}(m,x);class b extends m{#e;get size(){return this.#e.size}get rows(){return this.#e.rows}get columns(){return this.#e.columns}get diagonalSize(){return this.rows}static isSymmetricMatrix(t){return x.isMatrix(t)&&"SymmetricMatrix"===t.klassType}static zeros(t){return new this(t)}static ones(t){return new this(t).fill(1)}constructor(t){if(super(),x.isMatrix(t)){if(!t.isSymmetric())throw new TypeError("not symmetric data");this.#e=x.copy(t,new x(t.rows,t.rows))}else if(Number.isInteger(t)&&t>=0)this.#e=new x(t,t);else if(this.#e=new x(t),!this.isSymmetric())throw new TypeError("not symmetric data")}clone(){const t=new b(this.diagonalSize);for(const[e,r,n]of this.upperRightEntries())t.set(e,r,n);return t}toMatrix(){return new x(this)}get(t,e){return this.#e.get(t,e)}set(t,e,r){return this.#e.set(t,e,r),this.#e.set(e,t,r),this}removeCross(t){return this.#e.removeRow(t),this.#e.removeColumn(t),this}addCross(t,e){void 0===e&&(e=t,t=this.diagonalSize);const r=e.slice();return r.splice(t,1),this.#e.addRow(t,r),this.#e.addColumn(t,e),this}applyMask(t){if(t.length!==this.diagonalSize)throw new RangeError("Mask size do not match with matrix size");const e=[];for(const[r,n]of t.entries())n||e.push(r);e.reverse();for(const t of e)this.removeCross(t);return this}toCompact(){const{diagonalSize:t}=this,e=new Array(t*(t+1)/2);for(let r=0,n=0,o=0;o<e.length;o++)e[o]=this.get(n,r),++r>=t&&(r=++n);return e}static fromCompact(t){const e=t.length,r=(Math.sqrt(8*e+1)-1)/2;if(!Number.isInteger(r))throw new TypeError(`This array is not a compact representation of a Symmetric Matrix, ${JSON.stringify(t)}`);const n=new b(r);for(let o=0,i=0,s=0;s<e;s++)n.set(o,i,t[s]),++o>=r&&(o=++i);return n}*upperRightEntries(){for(let t=0,e=0;t<this.diagonalSize;void 0){const r=this.get(t,e);yield[t,e,r],++e>=this.diagonalSize&&(e=++t)}}*upperRightValues(){for(let t=0,e=0;t<this.diagonalSize;void 0){const r=this.get(t,e);yield r,++e>=this.diagonalSize&&(e=++t)}}}b.prototype.klassType="SymmetricMatrix";class E extends b{static isDistanceMatrix(t){return b.isSymmetricMatrix(t)&&"DistanceMatrix"===t.klassSubType}constructor(t){if(super(t),!this.isDistance())throw new TypeError("Provided arguments do no produce a distance matrix")}set(t,e,r){return t===e&&(r=0),super.set(t,e,r)}addCross(t,e){return void 0===e&&(e=t,t=this.diagonalSize),(e=e.slice())[t]=0,super.addCross(t,e)}toSymmetricMatrix(){return new b(this)}clone(){const t=new E(this.diagonalSize);for(const[e,r,n]of this.upperRightEntries())e!==r&&t.set(e,r,n);return t}toCompact(){const{diagonalSize:t}=this,e=new Array((t-1)*t/2);for(let r=1,n=0,o=0;o<e.length;o++)e[o]=this.get(n,r),++r>=t&&(r=1+ ++n);return e}static fromCompact(t){const e=t.length;if(0===e)return new this(0);const r=(Math.sqrt(8*e+1)+1)/2;if(!Number.isInteger(r))throw new TypeError(`This array is not a compact representation of a DistanceMatrix, ${JSON.stringify(t)}`);const n=new this(r);for(let o=1,i=0,s=0;s<e;s++)n.set(o,i,t[s]),++o>=r&&(o=1+ ++i);return n}}E.prototype.klassSubType="DistanceMatrix";class M extends m{constructor(t,e,r){super(),this.matrix=t,this.rows=e,this.columns=r}}class N extends M{constructor(t,e,r){l(t,e),d(t,r),super(t,e.length,r.length),this.rowIndices=e,this.columnIndices=r}set(t,e,r){return this.matrix.set(this.rowIndices[t],this.columnIndices[e],r),this}get(t,e){return this.matrix.get(this.rowIndices[t],this.columnIndices[e])}}class _ extends m{constructor(t,e={}){const{rows:r=1}=e;if(t.length%r!==0)throw new Error("the data length is not divisible by the number of rows");super(),this.rows=r,this.columns=t.length/r,this.data=t}set(t,e,r){let n=this._calculateIndex(t,e);return this.data[n]=r,this}get(t,e){let r=this._calculateIndex(t,e);return this.data[r]}_calculateIndex(t,e){return t*this.columns+e}}class k extends m{constructor(t){super(),this.data=t,this.rows=t.length,this.columns=t[0].length}set(t,e,r){return this.data[t][e]=r,this}get(t,e){return this.data[t][e]}}class S{constructor(t){let e,r,n,o,i,s,a,u,c,h=(t=k.checkMatrix(t)).clone(),l=h.rows,d=h.columns,f=new Float64Array(l),g=1;for(e=0;e<l;e++)f[e]=e;for(u=new Float64Array(l),r=0;r<d;r++){for(e=0;e<l;e++)u[e]=h.get(e,r);for(e=0;e<l;e++){for(c=Math.min(e,r),i=0,n=0;n<c;n++)i+=h.get(e,n)*u[n];u[e]-=i,h.set(e,r,u[e])}for(o=r,e=r+1;e<l;e++)Math.abs(u[e])>Math.abs(u[o])&&(o=e);if(o!==r){for(n=0;n<d;n++)s=h.get(o,n),h.set(o,n,h.get(r,n)),h.set(r,n,s);a=f[o],f[o]=f[r],f[r]=a,g=-g}if(r<l&&0!==h.get(r,r))for(e=r+1;e<l;e++)h.set(e,r,h.get(e,r)/h.get(r,r))}this.LU=h,this.pivotVector=f,this.pivotSign=g}isSingular(){let t=this.LU,e=t.columns;for(let r=0;r<e;r++)if(0===t.get(r,r))return!0;return!1}solve(t){t=x.checkMatrix(t);let e=this.LU;if(e.rows!==t.rows)throw new Error("Invalid matrix dimensions");if(this.isSingular())throw new Error("LU matrix is singular");let r,n,o,i=t.columns,s=t.subMatrixRow(this.pivotVector,0,i-1),a=e.columns;for(o=0;o<a;o++)for(r=o+1;r<a;r++)for(n=0;n<i;n++)s.set(r,n,s.get(r,n)-s.get(o,n)*e.get(r,o));for(o=a-1;o>=0;o--){for(n=0;n<i;n++)s.set(o,n,s.get(o,n)/e.get(o,o));for(r=0;r<o;r++)for(n=0;n<i;n++)s.set(r,n,s.get(r,n)-s.get(o,n)*e.get(r,o))}return s}get determinant(){let t=this.LU;if(!t.isSquare())throw new Error("Matrix must be square");let e=this.pivotSign,r=t.columns;for(let n=0;n<r;n++)e*=t.get(n,n);return e}get lowerTriangularMatrix(){let t=this.LU,e=t.rows,r=t.columns,n=new x(e,r);for(let o=0;o<e;o++)for(let e=0;e<r;e++)o>e?n.set(o,e,t.get(o,e)):o===e?n.set(o,e,1):n.set(o,e,0);return n}get upperTriangularMatrix(){let t=this.LU,e=t.rows,r=t.columns,n=new x(e,r);for(let o=0;o<e;o++)for(let e=0;e<r;e++)o<=e?n.set(o,e,t.get(o,e)):n.set(o,e,0);return n}get pivotPermutationVector(){return Array.from(this.pivotVector)}}function z(t,e){let r=0;return Math.abs(t)>Math.abs(e)?(r=e/t,Math.abs(t)*Math.sqrt(1+r*r)):0!==e?(r=t/e,Math.abs(e)*Math.sqrt(1+r*r)):0}class A{constructor(t){let e,r,n,o,i=(t=k.checkMatrix(t)).clone(),s=t.rows,a=t.columns,u=new Float64Array(a);for(n=0;n<a;n++){let t=0;for(e=n;e<s;e++)t=z(t,i.get(e,n));if(0!==t){for(i.get(n,n)<0&&(t=-t),e=n;e<s;e++)i.set(e,n,i.get(e,n)/t);for(i.set(n,n,i.get(n,n)+1),r=n+1;r<a;r++){for(o=0,e=n;e<s;e++)o+=i.get(e,n)*i.get(e,r);for(o=-o/i.get(n,n),e=n;e<s;e++)i.set(e,r,i.get(e,r)+o*i.get(e,n))}}u[n]=-t}this.QR=i,this.Rdiag=u}solve(t){t=x.checkMatrix(t);let e=this.QR,r=e.rows;if(t.rows!==r)throw new Error("Matrix row dimensions must agree");if(!this.isFullRank())throw new Error("Matrix is rank deficient");let n,o,i,s,a=t.columns,u=t.clone(),c=e.columns;for(i=0;i<c;i++)for(o=0;o<a;o++){for(s=0,n=i;n<r;n++)s+=e.get(n,i)*u.get(n,o);for(s=-s/e.get(i,i),n=i;n<r;n++)u.set(n,o,u.get(n,o)+s*e.get(n,i))}for(i=c-1;i>=0;i--){for(o=0;o<a;o++)u.set(i,o,u.get(i,o)/this.Rdiag[i]);for(n=0;n<i;n++)for(o=0;o<a;o++)u.set(n,o,u.get(n,o)-u.get(i,o)*e.get(n,i))}return u.subMatrix(0,c-1,0,a-1)}isFullRank(){let t=this.QR.columns;for(let e=0;e<t;e++)if(0===this.Rdiag[e])return!1;return!0}get upperTriangularMatrix(){let t,e,r=this.QR,n=r.columns,o=new x(n,n);for(t=0;t<n;t++)for(e=0;e<n;e++)t<e?o.set(t,e,r.get(t,e)):t===e?o.set(t,e,this.Rdiag[t]):o.set(t,e,0);return o}get orthogonalMatrix(){let t,e,r,n,o=this.QR,i=o.rows,s=o.columns,a=new x(i,s);for(r=s-1;r>=0;r--){for(t=0;t<i;t++)a.set(t,r,0);for(a.set(r,r,1),e=r;e<s;e++)if(0!==o.get(r,r)){for(n=0,t=r;t<i;t++)n+=o.get(t,r)*a.get(t,e);for(n=-n/o.get(r,r),t=r;t<i;t++)a.set(t,e,a.get(t,e)+n*o.get(t,r))}}return a}}class O{constructor(t,e={}){if((t=k.checkMatrix(t)).isEmpty())throw new Error("Matrix must be non-empty");let r=t.rows,n=t.columns;const{computeLeftSingularVectors:o=!0,computeRightSingularVectors:i=!0,autoTranspose:s=!1}=e;let a,u=Boolean(o),c=Boolean(i),h=!1;if(r<n)if(s){a=t.transpose(),r=a.rows,n=a.columns,h=!0;let e=u;u=c,c=e}else a=t.clone(),console.warn("Computing SVD on a matrix with more columns than rows. Consider enabling autoTranspose");else a=t.clone();let l=Math.min(r,n),d=Math.min(r+1,n),f=new Float64Array(d),g=new x(r,l),p=new x(n,n),v=new Float64Array(n),m=new Float64Array(r),y=new Float64Array(d);for(let t=0;t<d;t++)y[t]=t;let w=Math.min(r-1,n),b=Math.max(0,Math.min(n-2,r)),E=Math.max(w,b);for(let t=0;t<E;t++){if(t<w){f[t]=0;for(let e=t;e<r;e++)f[t]=z(f[t],a.get(e,t));if(0!==f[t]){a.get(t,t)<0&&(f[t]=-f[t]);for(let e=t;e<r;e++)a.set(e,t,a.get(e,t)/f[t]);a.set(t,t,a.get(t,t)+1)}f[t]=-f[t]}for(let e=t+1;e<n;e++){if(t<w&&0!==f[t]){let n=0;for(let o=t;o<r;o++)n+=a.get(o,t)*a.get(o,e);n=-n/a.get(t,t);for(let o=t;o<r;o++)a.set(o,e,a.get(o,e)+n*a.get(o,t))}v[e]=a.get(t,e)}if(u&&t<w)for(let e=t;e<r;e++)g.set(e,t,a.get(e,t));if(t<b){v[t]=0;for(let e=t+1;e<n;e++)v[t]=z(v[t],v[e]);if(0!==v[t]){v[t+1]<0&&(v[t]=0-v[t]);for(let e=t+1;e<n;e++)v[e]/=v[t];v[t+1]+=1}if(v[t]=-v[t],t+1<r&&0!==v[t]){for(let e=t+1;e<r;e++)m[e]=0;for(let e=t+1;e<r;e++)for(let r=t+1;r<n;r++)m[e]+=v[r]*a.get(e,r);for(let e=t+1;e<n;e++){let n=-v[e]/v[t+1];for(let o=t+1;o<r;o++)a.set(o,e,a.get(o,e)+n*m[o])}}if(c)for(let e=t+1;e<n;e++)p.set(e,t,v[e])}}let M=Math.min(n,r+1);if(w<n&&(f[w]=a.get(w,w)),r<M&&(f[M-1]=0),b+1<M&&(v[b]=a.get(b,M-1)),v[M-1]=0,u){for(let t=w;t<l;t++){for(let e=0;e<r;e++)g.set(e,t,0);g.set(t,t,1)}for(let t=w-1;t>=0;t--)if(0!==f[t]){for(let e=t+1;e<l;e++){let n=0;for(let o=t;o<r;o++)n+=g.get(o,t)*g.get(o,e);n=-n/g.get(t,t);for(let o=t;o<r;o++)g.set(o,e,g.get(o,e)+n*g.get(o,t))}for(let e=t;e<r;e++)g.set(e,t,-g.get(e,t));g.set(t,t,1+g.get(t,t));for(let e=0;e<t-1;e++)g.set(e,t,0)}else{for(let e=0;e<r;e++)g.set(e,t,0);g.set(t,t,1)}}if(c)for(let t=n-1;t>=0;t--){if(t<b&&0!==v[t])for(let e=t+1;e<n;e++){let r=0;for(let o=t+1;o<n;o++)r+=p.get(o,t)*p.get(o,e);r=-r/p.get(t+1,t);for(let o=t+1;o<n;o++)p.set(o,e,p.get(o,e)+r*p.get(o,t))}for(let e=0;e<n;e++)p.set(e,t,0);p.set(t,t,1)}let N=M-1,_=Number.EPSILON;for(;M>0;){let t,e;for(t=M-2;t>=-1&&-1!==t;t--){const e=Number.MIN_VALUE+_*Math.abs(f[t]+Math.abs(f[t+1]));if(Math.abs(v[t])<=e||Number.isNaN(v[t])){v[t]=0;break}}if(t===M-2)e=4;else{let r;for(r=M-1;r>=t&&r!==t;r--){let e=(r!==M?Math.abs(v[r]):0)+(r!==t+1?Math.abs(v[r-1]):0);if(Math.abs(f[r])<=_*e){f[r]=0;break}}r===t?e=3:r===M-1?e=1:(e=2,t=r)}switch(t++,e){case 1:{let e=v[M-2];v[M-2]=0;for(let r=M-2;r>=t;r--){let o=z(f[r],e),i=f[r]/o,s=e/o;if(f[r]=o,r!==t&&(e=-s*v[r-1],v[r-1]=i*v[r-1]),c)for(let t=0;t<n;t++)o=i*p.get(t,r)+s*p.get(t,M-1),p.set(t,M-1,-s*p.get(t,r)+i*p.get(t,M-1)),p.set(t,r,o)}break}case 2:{let e=v[t-1];v[t-1]=0;for(let n=t;n<M;n++){let o=z(f[n],e),i=f[n]/o,s=e/o;if(f[n]=o,e=-s*v[n],v[n]=i*v[n],u)for(let e=0;e<r;e++)o=i*g.get(e,n)+s*g.get(e,t-1),g.set(e,t-1,-s*g.get(e,n)+i*g.get(e,t-1)),g.set(e,n,o)}break}case 3:{const e=Math.max(Math.abs(f[M-1]),Math.abs(f[M-2]),Math.abs(v[M-2]),Math.abs(f[t]),Math.abs(v[t])),o=f[M-1]/e,i=f[M-2]/e,s=v[M-2]/e,a=f[t]/e,h=v[t]/e,l=((i+o)*(i-o)+s*s)/2,d=o*s*(o*s);let m=0;0===l&&0===d||(m=l<0?0-Math.sqrt(l*l+d):Math.sqrt(l*l+d),m=d/(l+m));let y=(a+o)*(a-o)+m,w=a*h;for(let e=t;e<M-1;e++){let o=z(y,w);0===o&&(o=Number.MIN_VALUE);let i=y/o,s=w/o;if(e!==t&&(v[e-1]=o),y=i*f[e]+s*v[e],v[e]=i*v[e]-s*f[e],w=s*f[e+1],f[e+1]=i*f[e+1],c)for(let t=0;t<n;t++)o=i*p.get(t,e)+s*p.get(t,e+1),p.set(t,e+1,-s*p.get(t,e)+i*p.get(t,e+1)),p.set(t,e,o);if(o=z(y,w),0===o&&(o=Number.MIN_VALUE),i=y/o,s=w/o,f[e]=o,y=i*v[e]+s*f[e+1],f[e+1]=-s*v[e]+i*f[e+1],w=s*v[e+1],v[e+1]=i*v[e+1],u&&e<r-1)for(let t=0;t<r;t++)o=i*g.get(t,e)+s*g.get(t,e+1),g.set(t,e+1,-s*g.get(t,e)+i*g.get(t,e+1)),g.set(t,e,o)}v[M-2]=y;break}case 4:if(f[t]<=0&&(f[t]=f[t]<0?-f[t]:0,c))for(let e=0;e<=N;e++)p.set(e,t,-p.get(e,t));for(;t<N&&!(f[t]>=f[t+1]);){let e=f[t];if(f[t]=f[t+1],f[t+1]=e,c&&t<n-1)for(let r=0;r<n;r++)e=p.get(r,t+1),p.set(r,t+1,p.get(r,t)),p.set(r,t,e);if(u&&t<r-1)for(let n=0;n<r;n++)e=g.get(n,t+1),g.set(n,t+1,g.get(n,t)),g.set(n,t,e);t++}M--}}if(h){let t=p;p=g,g=t}this.m=r,this.n=n,this.s=f,this.U=g,this.V=p}solve(t){let e=t,r=this.threshold,n=this.s.length,o=x.zeros(n,n);for(let t=0;t<n;t++)Math.abs(this.s[t])<=r?o.set(t,t,0):o.set(t,t,1/this.s[t]);let i=this.U,s=this.rightSingularVectors,a=s.mmul(o),u=s.rows,c=i.rows,h=x.zeros(u,c);for(let t=0;t<u;t++)for(let e=0;e<c;e++){let r=0;for(let o=0;o<n;o++)r+=a.get(t,o)*i.get(e,o);h.set(t,e,r)}return h.mmul(e)}solveForDiagonal(t){return this.solve(x.diag(t))}inverse(){let t=this.V,e=this.threshold,r=t.rows,n=t.columns,o=new x(r,this.s.length);for(let i=0;i<r;i++)for(let r=0;r<n;r++)Math.abs(this.s[r])>e&&o.set(i,r,t.get(i,r)/this.s[r]);let i=this.U,s=i.rows,a=i.columns,u=new x(r,s);for(let t=0;t<r;t++)for(let e=0;e<s;e++){let r=0;for(let n=0;n<a;n++)r+=o.get(t,n)*i.get(e,n);u.set(t,e,r)}return u}get condition(){return this.s[0]/this.s[Math.min(this.m,this.n)-1]}get norm2(){return this.s[0]}get rank(){let t=Math.max(this.m,this.n)*this.s[0]*Number.EPSILON,e=0,r=this.s;for(let n=0,o=r.length;n<o;n++)r[n]>t&&e++;return e}get diagonal(){return Array.from(this.s)}get threshold(){return Number.EPSILON/2*Math.max(this.m,this.n)*this.s[0]}get leftSingularVectors(){return this.U}get rightSingularVectors(){return this.V}get diagonalMatrix(){return x.diag(this.s)}}function j(t,e,r=!1){return t=k.checkMatrix(t),e=k.checkMatrix(e),r?new O(t).solve(e):t.isSquare()?new S(t).solve(e):new A(t).solve(e)}function C(t,e){let r=[];for(let n=0;n<t;n++)n!==e&&r.push(n);return r}function I(t,e,r,n=1e-9,o=1e-9){if(t>o)return new Array(e.rows+1).fill(0);{let t=e.addRow(r,[0]);for(let e=0;e<t.rows;e++)Math.abs(t.get(e,0))<n&&t.set(e,0,0);return t.to1DArray()}}class R{constructor(t,e={}){const{assumeSymmetric:r=!1}=e;if(!(t=k.checkMatrix(t)).isSquare())throw new Error("Matrix is not a square matrix");if(t.isEmpty())throw new Error("Matrix must be non-empty");let n,o,i=t.columns,s=new x(i,i),a=new Float64Array(i),u=new Float64Array(i),c=t,h=!1;if(h=!!r||t.isSymmetric(),h){for(n=0;n<i;n++)for(o=0;o<i;o++)s.set(n,o,c.get(n,o));!function(t,e,r,n){let o,i,s,a,u,c,h,l;for(u=0;u<t;u++)r[u]=n.get(t-1,u);for(a=t-1;a>0;a--){for(l=0,s=0,c=0;c<a;c++)l+=Math.abs(r[c]);if(0===l)for(e[a]=r[a-1],u=0;u<a;u++)r[u]=n.get(a-1,u),n.set(a,u,0),n.set(u,a,0);else{for(c=0;c<a;c++)r[c]/=l,s+=r[c]*r[c];for(o=r[a-1],i=Math.sqrt(s),o>0&&(i=-i),e[a]=l*i,s-=o*i,r[a-1]=o-i,u=0;u<a;u++)e[u]=0;for(u=0;u<a;u++){for(o=r[u],n.set(u,a,o),i=e[u]+n.get(u,u)*o,c=u+1;c<=a-1;c++)i+=n.get(c,u)*r[c],e[c]+=n.get(c,u)*o;e[u]=i}for(o=0,u=0;u<a;u++)e[u]/=s,o+=e[u]*r[u];for(h=o/(s+s),u=0;u<a;u++)e[u]-=h*r[u];for(u=0;u<a;u++){for(o=r[u],i=e[u],c=u;c<=a-1;c++)n.set(c,u,n.get(c,u)-(o*e[c]+i*r[c]));r[u]=n.get(a-1,u),n.set(a,u,0)}}r[a]=s}for(a=0;a<t-1;a++){if(n.set(t-1,a,n.get(a,a)),n.set(a,a,1),s=r[a+1],0!==s){for(c=0;c<=a;c++)r[c]=n.get(c,a+1)/s;for(u=0;u<=a;u++){for(i=0,c=0;c<=a;c++)i+=n.get(c,a+1)*n.get(c,u);for(c=0;c<=a;c++)n.set(c,u,n.get(c,u)-i*r[c])}}for(c=0;c<=a;c++)n.set(c,a+1,0)}for(u=0;u<t;u++)r[u]=n.get(t-1,u),n.set(t-1,u,0);n.set(t-1,t-1,1),e[0]=0}(i,u,a,s),function(t,e,r,n){let o,i,s,a,u,c,h,l,d,f,g,p,v,m,y,w;for(s=1;s<t;s++)e[s-1]=e[s];e[t-1]=0;let x=0,b=0,E=Number.EPSILON;for(c=0;c<t;c++){for(b=Math.max(b,Math.abs(r[c])+Math.abs(e[c])),h=c;h<t&&!(Math.abs(e[h])<=E*b);)h++;if(h>c)do{for(o=r[c],l=(r[c+1]-o)/(2*e[c]),d=z(l,1),l<0&&(d=-d),r[c]=e[c]/(l+d),r[c+1]=e[c]*(l+d),f=r[c+1],i=o-r[c],s=c+2;s<t;s++)r[s]-=i;for(x+=i,l=r[h],g=1,p=g,v=g,m=e[c+1],y=0,w=0,s=h-1;s>=c;s--)for(v=p,p=g,w=y,o=g*e[s],i=g*l,d=z(l,e[s]),e[s+1]=y*d,y=e[s]/d,g=l/d,l=g*r[s]-y*o,r[s+1]=i+y*(g*o+y*r[s]),u=0;u<t;u++)i=n.get(u,s+1),n.set(u,s+1,y*n.get(u,s)+g*i),n.set(u,s,g*n.get(u,s)-y*i);l=-y*w*v*m*e[c]/f,e[c]=y*l,r[c]=g*l}while(Math.abs(e[c])>E*b);r[c]=r[c]+x,e[c]=0}for(s=0;s<t-1;s++){for(u=s,l=r[s],a=s+1;a<t;a++)r[a]<l&&(u=a,l=r[a]);if(u!==s)for(r[u]=r[s],r[s]=l,a=0;a<t;a++)l=n.get(a,s),n.set(a,s,n.get(a,u)),n.set(a,u,l)}}(i,u,a,s)}else{let t=new x(i,i),e=new Float64Array(i);for(o=0;o<i;o++)for(n=0;n<i;n++)t.set(n,o,c.get(n,o));!function(t,e,r,n){let o,i,s,a,u,c,h,l=0,d=t-1;for(c=l+1;c<=d-1;c++){for(h=0,a=c;a<=d;a++)h+=Math.abs(e.get(a,c-1));if(0!==h){for(s=0,a=d;a>=c;a--)r[a]=e.get(a,c-1)/h,s+=r[a]*r[a];for(i=Math.sqrt(s),r[c]>0&&(i=-i),s-=r[c]*i,r[c]=r[c]-i,u=c;u<t;u++){for(o=0,a=d;a>=c;a--)o+=r[a]*e.get(a,u);for(o/=s,a=c;a<=d;a++)e.set(a,u,e.get(a,u)-o*r[a])}for(a=0;a<=d;a++){for(o=0,u=d;u>=c;u--)o+=r[u]*e.get(a,u);for(o/=s,u=c;u<=d;u++)e.set(a,u,e.get(a,u)-o*r[u])}r[c]=h*r[c],e.set(c,c-1,h*i)}}for(a=0;a<t;a++)for(u=0;u<t;u++)n.set(a,u,a===u?1:0);for(c=d-1;c>=l+1;c--)if(0!==e.get(c,c-1)){for(a=c+1;a<=d;a++)r[a]=e.get(a,c-1);for(u=c;u<=d;u++){for(i=0,a=c;a<=d;a++)i+=r[a]*n.get(a,u);for(i=i/r[c]/e.get(c,c-1),a=c;a<=d;a++)n.set(a,u,n.get(a,u)+i*r[a])}}}(i,t,e,s),function(t,e,r,n,o){let i,s,a,u,c,h,l,d,f,g,p,v,m,y,w,x=t-1,b=0,E=t-1,M=Number.EPSILON,N=0,_=0,k=0,S=0,z=0,A=0,O=0,j=0;for(i=0;i<t;i++)for((i<b||i>E)&&(r[i]=o.get(i,i),e[i]=0),s=Math.max(i-1,0);s<t;s++)_+=Math.abs(o.get(i,s));for(;x>=b;){for(u=x;u>b&&(A=Math.abs(o.get(u-1,u-1))+Math.abs(o.get(u,u)),0===A&&(A=_),!(Math.abs(o.get(u,u-1))<M*A));)u--;if(u===x)o.set(x,x,o.get(x,x)+N),r[x]=o.get(x,x),e[x]=0,x--,j=0;else if(u===x-1){if(l=o.get(x,x-1)*o.get(x-1,x),k=(o.get(x-1,x-1)-o.get(x,x))/2,S=k*k+l,O=Math.sqrt(Math.abs(S)),o.set(x,x,o.get(x,x)+N),o.set(x-1,x-1,o.get(x-1,x-1)+N),d=o.get(x,x),S>=0){for(O=k>=0?k+O:k-O,r[x-1]=d+O,r[x]=r[x-1],0!==O&&(r[x]=d-l/O),e[x-1]=0,e[x]=0,d=o.get(x,x-1),A=Math.abs(d)+Math.abs(O),k=d/A,S=O/A,z=Math.sqrt(k*k+S*S),k/=z,S/=z,s=x-1;s<t;s++)O=o.get(x-1,s),o.set(x-1,s,S*O+k*o.get(x,s)),o.set(x,s,S*o.get(x,s)-k*O);for(i=0;i<=x;i++)O=o.get(i,x-1),o.set(i,x-1,S*O+k*o.get(i,x)),o.set(i,x,S*o.get(i,x)-k*O);for(i=b;i<=E;i++)O=n.get(i,x-1),n.set(i,x-1,S*O+k*n.get(i,x)),n.set(i,x,S*n.get(i,x)-k*O)}else r[x-1]=d+k,r[x]=d+k,e[x-1]=O,e[x]=-O;x-=2,j=0}else{if(d=o.get(x,x),f=0,l=0,u<x&&(f=o.get(x-1,x-1),l=o.get(x,x-1)*o.get(x-1,x)),10===j){for(N+=d,i=b;i<=x;i++)o.set(i,i,o.get(i,i)-d);A=Math.abs(o.get(x,x-1))+Math.abs(o.get(x-1,x-2)),d=f=.75*A,l=-.4375*A*A}if(30===j&&(A=(f-d)/2,A=A*A+l,A>0)){for(A=Math.sqrt(A),f<d&&(A=-A),A=d-l/((f-d)/2+A),i=b;i<=x;i++)o.set(i,i,o.get(i,i)-A);N+=A,d=f=l=.964}for(j+=1,c=x-2;c>=u&&(O=o.get(c,c),z=d-O,A=f-O,k=(z*A-l)/o.get(c+1,c)+o.get(c,c+1),S=o.get(c+1,c+1)-O-z-A,z=o.get(c+2,c+1),A=Math.abs(k)+Math.abs(S)+Math.abs(z),k/=A,S/=A,z/=A,c!==u)&&!(Math.abs(o.get(c,c-1))*(Math.abs(S)+Math.abs(z))<M*(Math.abs(k)*(Math.abs(o.get(c-1,c-1))+Math.abs(O)+Math.abs(o.get(c+1,c+1)))));)c--;for(i=c+2;i<=x;i++)o.set(i,i-2,0),i>c+2&&o.set(i,i-3,0);for(a=c;a<=x-1&&(y=a!==x-1,a!==c&&(k=o.get(a,a-1),S=o.get(a+1,a-1),z=y?o.get(a+2,a-1):0,d=Math.abs(k)+Math.abs(S)+Math.abs(z),0!==d&&(k/=d,S/=d,z/=d)),0!==d);a++)if(A=Math.sqrt(k*k+S*S+z*z),k<0&&(A=-A),0!==A){for(a!==c?o.set(a,a-1,-A*d):u!==c&&o.set(a,a-1,-o.get(a,a-1)),k+=A,d=k/A,f=S/A,O=z/A,S/=k,z/=k,s=a;s<t;s++)k=o.get(a,s)+S*o.get(a+1,s),y&&(k+=z*o.get(a+2,s),o.set(a+2,s,o.get(a+2,s)-k*O)),o.set(a,s,o.get(a,s)-k*d),o.set(a+1,s,o.get(a+1,s)-k*f);for(i=0;i<=Math.min(x,a+3);i++)k=d*o.get(i,a)+f*o.get(i,a+1),y&&(k+=O*o.get(i,a+2),o.set(i,a+2,o.get(i,a+2)-k*z)),o.set(i,a,o.get(i,a)-k),o.set(i,a+1,o.get(i,a+1)-k*S);for(i=b;i<=E;i++)k=d*n.get(i,a)+f*n.get(i,a+1),y&&(k+=O*n.get(i,a+2),n.set(i,a+2,n.get(i,a+2)-k*z)),n.set(i,a,n.get(i,a)-k),n.set(i,a+1,n.get(i,a+1)-k*S)}}}if(0===_)return;for(x=t-1;x>=0;x--)if(k=r[x],S=e[x],0===S)for(u=x,o.set(x,x,1),i=x-1;i>=0;i--){for(l=o.get(i,i)-k,z=0,s=u;s<=x;s++)z+=o.get(i,s)*o.get(s,x);if(e[i]<0)O=l,A=z;else if(u=i,0===e[i]?o.set(i,x,0!==l?-z/l:-z/(M*_)):(d=o.get(i,i+1),f=o.get(i+1,i),S=(r[i]-k)*(r[i]-k)+e[i]*e[i],h=(d*A-O*z)/S,o.set(i,x,h),o.set(i+1,x,Math.abs(d)>Math.abs(O)?(-z-l*h)/d:(-A-f*h)/O)),h=Math.abs(o.get(i,x)),M*h*h>1)for(s=i;s<=x;s++)o.set(s,x,o.get(s,x)/h)}else if(S<0)for(u=x-1,Math.abs(o.get(x,x-1))>Math.abs(o.get(x-1,x))?(o.set(x-1,x-1,S/o.get(x,x-1)),o.set(x-1,x,-(o.get(x,x)-k)/o.get(x,x-1))):(w=P(0,-o.get(x-1,x),o.get(x-1,x-1)-k,S),o.set(x-1,x-1,w[0]),o.set(x-1,x,w[1])),o.set(x,x-1,0),o.set(x,x,1),i=x-2;i>=0;i--){for(g=0,p=0,s=u;s<=x;s++)g+=o.get(i,s)*o.get(s,x-1),p+=o.get(i,s)*o.get(s,x);if(l=o.get(i,i)-k,e[i]<0)O=l,z=g,A=p;else if(u=i,0===e[i]?(w=P(-g,-p,l,S),o.set(i,x-1,w[0]),o.set(i,x,w[1])):(d=o.get(i,i+1),f=o.get(i+1,i),v=(r[i]-k)*(r[i]-k)+e[i]*e[i]-S*S,m=2*(r[i]-k)*S,0===v&&0===m&&(v=M*_*(Math.abs(l)+Math.abs(S)+Math.abs(d)+Math.abs(f)+Math.abs(O))),w=P(d*z-O*g+S*p,d*A-O*p-S*g,v,m),o.set(i,x-1,w[0]),o.set(i,x,w[1]),Math.abs(d)>Math.abs(O)+Math.abs(S)?(o.set(i+1,x-1,(-g-l*o.get(i,x-1)+S*o.get(i,x))/d),o.set(i+1,x,(-p-l*o.get(i,x)-S*o.get(i,x-1))/d)):(w=P(-z-f*o.get(i,x-1),-A-f*o.get(i,x),O,S),o.set(i+1,x-1,w[0]),o.set(i+1,x,w[1]))),h=Math.max(Math.abs(o.get(i,x-1)),Math.abs(o.get(i,x))),M*h*h>1)for(s=i;s<=x;s++)o.set(s,x-1,o.get(s,x-1)/h),o.set(s,x,o.get(s,x)/h)}for(i=0;i<t;i++)if(i<b||i>E)for(s=i;s<t;s++)n.set(i,s,o.get(i,s));for(s=t-1;s>=b;s--)for(i=b;i<=E;i++){for(O=0,a=b;a<=Math.min(s,E);a++)O+=n.get(i,a)*o.get(a,s);n.set(i,s,O)}}(i,u,a,s,t)}this.n=i,this.e=u,this.d=a,this.V=s}get realEigenvalues(){return Array.from(this.d)}get imaginaryEigenvalues(){return Array.from(this.e)}get eigenvectorMatrix(){return this.V}get diagonalMatrix(){let t,e,r=this.n,n=this.e,o=this.d,i=new x(r,r);for(t=0;t<r;t++){for(e=0;e<r;e++)i.set(t,e,0);i.set(t,t,o[t]),n[t]>0?i.set(t,t+1,n[t]):n[t]<0&&i.set(t,t-1,n[t])}return i}}function P(t,e,r,n){let o,i;return Math.abs(r)>Math.abs(n)?(o=n/r,i=r+o*n,[(t+o*e)/i,(e-o*t)/i]):(o=r/n,i=n+o*r,[(o*t+e)/i,(o*e-t)/i])}class T{constructor(t){if(!(t=k.checkMatrix(t)).isSymmetric())throw new Error("Matrix is not symmetric");let e,r,n,o=t,i=o.rows,s=new x(i,i),a=!0;for(r=0;r<i;r++){let t=0;for(n=0;n<r;n++){let i=0;for(e=0;e<n;e++)i+=s.get(n,e)*s.get(r,e);i=(o.get(r,n)-i)/s.get(n,n),s.set(r,n,i),t+=i*i}for(t=o.get(r,r)-t,a&&=t>0,s.set(r,r,Math.sqrt(Math.max(t,0))),n=r+1;n<i;n++)s.set(r,n,0)}this.L=s,this.positiveDefinite=a}isPositiveDefinite(){return this.positiveDefinite}solve(t){t=k.checkMatrix(t);let e=this.L,r=e.rows;if(t.rows!==r)throw new Error("Matrix dimensions do not match");if(!1===this.isPositiveDefinite())throw new Error("Matrix is not positive definite");let n,o,i,s=t.columns,a=t.clone();for(i=0;i<r;i++)for(o=0;o<s;o++){for(n=0;n<i;n++)a.set(i,o,a.get(i,o)-a.get(n,o)*e.get(i,n));a.set(i,o,a.get(i,o)/e.get(i,i))}for(i=r-1;i>=0;i--)for(o=0;o<s;o++){for(n=i+1;n<r;n++)a.set(i,o,a.get(i,o)-a.get(n,o)*e.get(n,i));a.set(i,o,a.get(i,o)/e.get(i,i))}return a}get lowerTriangularMatrix(){return this.L}}class F{constructor(e,r={}){e=k.checkMatrix(e);let{Y:n}=r;const{scaleScores:o=!1,maxIterations:i=1e3,terminationCriteria:s=1e-10}=r;let a;if(n){if(n=t.isAnyArray(n)&&"number"==typeof n[0]?x.columnVector(n):k.checkMatrix(n),n.rows!==e.rows)throw new Error("Y should have the same number of rows as X");a=n.getColumnVector(0)}else a=e.getColumnVector(0);let u,c,h,l,d=1;for(let t=0;t<i&&d>s;t++)h=e.transpose().mmul(a).div(a.transpose().mmul(a).get(0,0)),h=h.div(h.norm()),u=e.mmul(h).div(h.transpose().mmul(h).get(0,0)),t>0&&(d=u.clone().sub(l).pow(2).sum()),l=u.clone(),n?(c=n.transpose().mmul(u).div(u.transpose().mmul(u).get(0,0)),c=c.div(c.norm()),a=n.mmul(c).div(c.transpose().mmul(c).get(0,0))):a=u;if(n){let t=e.transpose().mmul(u).div(u.transpose().mmul(u).get(0,0));t=t.div(t.norm());let r=e.clone().sub(u.clone().mmul(t.transpose())),o=a.transpose().mmul(u).div(u.transpose().mmul(u).get(0,0)),i=n.clone().sub(u.clone().mulS(o.get(0,0)).mmul(c.transpose()));this.t=u,this.p=t.transpose(),this.w=h.transpose(),this.q=c,this.u=a,this.s=u.transpose().mmul(u),this.xResidual=r,this.yResidual=i,this.betas=o}else this.w=h.transpose(),this.s=u.transpose().mmul(u).sqrt(),this.t=o?u.clone().div(this.s.get(0,0)):u,this.xResidual=e.sub(u.mmul(h.transpose()))}}return $y.AbstractMatrix=m,$y.CHO=T,$y.CholeskyDecomposition=T,$y.DistanceMatrix=E,$y.EVD=R,$y.EigenvalueDecomposition=R,$y.LU=S,$y.LuDecomposition=S,$y.Matrix=x,$y.MatrixColumnSelectionView=class extends M{constructor(t,e){d(t,e),super(t,t.rows,e.length),this.columnIndices=e}set(t,e,r){return this.matrix.set(t,this.columnIndices[e],r),this}get(t,e){return this.matrix.get(t,this.columnIndices[e])}},$y.MatrixColumnView=class extends M{constructor(t,e){u(t,e),super(t,t.rows,1),this.column=e}set(t,e,r){return this.matrix.set(t,this.column,r),this}get(t){return this.matrix.get(t,this.column)}},$y.MatrixFlipColumnView=class extends M{constructor(t){super(t,t.rows,t.columns)}set(t,e,r){return this.matrix.set(t,this.columns-e-1,r),this}get(t,e){return this.matrix.get(t,this.columns-e-1)}},$y.MatrixFlipRowView=class extends M{constructor(t){super(t,t.rows,t.columns)}set(t,e,r){return this.matrix.set(this.rows-t-1,e,r),this}get(t,e){return this.matrix.get(this.rows-t-1,e)}},$y.MatrixRowSelectionView=class extends M{constructor(t,e){l(t,e),super(t,e.length,t.columns),this.rowIndices=e}set(t,e,r){return this.matrix.set(this.rowIndices[t],e,r),this}get(t,e){return this.matrix.get(this.rowIndices[t],e)}},$y.MatrixRowView=class extends M{constructor(t,e){a(t,e),super(t,1,t.columns),this.row=e}set(t,e,r){return this.matrix.set(this.row,e,r),this}get(t,e){return this.matrix.get(this.row,e)}},$y.MatrixSelectionView=N,$y.MatrixSubView=class extends M{constructor(t,e,r,n,o){f(t,e,r,n,o),super(t,r-e+1,o-n+1),this.startRow=e,this.startColumn=n}set(t,e,r){return this.matrix.set(this.startRow+t,this.startColumn+e,r),this}get(t,e){return this.matrix.get(this.startRow+t,this.startColumn+e)}},$y.MatrixTransposeView=class extends M{constructor(t){super(t,t.columns,t.rows)}set(t,e,r){return this.matrix.set(e,t,r),this}get(t,e){return this.matrix.get(e,t)}},$y.NIPALS=F,$y.Nipals=F,$y.QR=A,$y.QrDecomposition=A,$y.SVD=O,$y.SingularValueDecomposition=O,$y.SymmetricMatrix=b,$y.WrapperMatrix1D=_,$y.WrapperMatrix2D=k,$y.correlation=function(e,r=e,n={}){e=new x(e);let o=!1;if("object"!=typeof r||x.isMatrix(r)||t.isAnyArray(r)?r=new x(r):(n=r,r=e,o=!0),e.rows!==r.rows)throw new TypeError("Both matrices must have the same number of rows");const{center:i=!0,scale:s=!0}=n;i&&(e.center("column"),o||r.center("column")),s&&(e.scale("column"),o||r.scale("column"));const a=e.standardDeviation("column",{unbiased:!0}),u=o?a:r.standardDeviation("column",{unbiased:!0}),c=e.transpose().mmul(r);for(let t=0;t<c.rows;t++)for(let r=0;r<c.columns;r++)c.set(t,r,c.get(t,r)*(1/(a[t]*u[r]))*(1/(e.rows-1)));return c},$y.covariance=function(e,r=e,n={}){e=new x(e);let o=!1;if("object"!=typeof r||x.isMatrix(r)||t.isAnyArray(r)?r=new x(r):(n=r,r=e,o=!0),e.rows!==r.rows)throw new TypeError("Both matrices must have the same number of rows");const{center:i=!0}=n;i&&(e=e.center("column"),o||(r=r.center("column")));const s=e.transpose().mmul(r);for(let t=0;t<s.rows;t++)for(let r=0;r<s.columns;r++)s.set(t,r,s.get(t,r)*(1/(e.rows-1)));return s},$y.default=x,$y.determinant=function t(e){if((e=x.checkMatrix(e)).isSquare()){if(0===e.columns)return 1;let r,n,o,i;if(2===e.columns)return r=e.get(0,0),n=e.get(0,1),o=e.get(1,0),i=e.get(1,1),r*i-n*o;if(3===e.columns){let i,s,a;return i=new N(e,[1,2],[1,2]),s=new N(e,[1,2],[0,2]),a=new N(e,[1,2],[0,1]),r=e.get(0,0),n=e.get(0,1),o=e.get(0,2),r*t(i)-n*t(s)+o*t(a)}return new S(e).determinant}throw Error("determinant can only be calculated for a square matrix")},$y.inverse=function(t,e=!1){return t=k.checkMatrix(t),e?new O(t).inverse():j(t,x.eye(t.rows))},$y.linearDependencies=function(t,e={}){const{thresholdValue:r=1e-9,thresholdError:n=1e-9}=e;let o=(t=x.checkMatrix(t)).rows,i=new x(o,o);for(let e=0;e<o;e++){let s=x.columnVector(t.getRow(e)),a=t.subMatrixRow(C(o,e)).transpose(),u=new O(a).solve(s),c=x.sub(s,a.mmul(u)).abs().max();i.setRow(e,I(c,u,e,r,n))}return i},$y.pseudoInverse=function(t,e=Number.EPSILON){if((t=x.checkMatrix(t)).isEmpty())return t.transpose();let r=new O(t,{autoTranspose:!0}),n=r.leftSingularVectors,o=r.rightSingularVectors,i=r.diagonal;for(let t=0;t<i.length;t++)Math.abs(i[t])>e?i[t]=1/i[t]:i[t]=0;return o.mmul(x.diag(i).mmul(n.transpose()))},$y.solve=j,$y.wrap=function(e,r){if(t.isAnyArray(e))return e[0]&&t.isAnyArray(e[0])?new k(e):new _(e,r);throw new Error("the argument is not an array")},$y}var Jy=Qy(),Ky=ns(Jy);const Zy=Jy.Matrix,tw=Jy.SingularValueDecomposition;Ky.Matrix?Ky.Matrix:Jy.Matrix;const ew={center:[0,0],linkDistance:50};class rw extends dt{constructor(){super(...arguments),this.id="mds"}getDefaultOptions(){return ew}layout(){return r(this,void 0,void 0,function*(){const{linkDistance:t=ew.linkDistance}=this.options,{center:e}=lt(this.options),r=this.model.nodeCount();if(0===r||1===r)return void H(this.model,e);const n=K(X(this.model,!1));nw(n);const o=Q(n,t),i=ow(o);let s=0;this.model.forEachNode(t=>{const r=i[s++];t.x=r[0]+e[0],t.y=r[1]+e[1]})})}}const nw=t=>{let e=Number.NEGATIVE_INFINITY;const r=[],n=t.length;for(let o=0;o<n;o++){const n=t[o],i=n.length;for(let t=0;t<i;t++){const i=n[t];i===1/0?r.push([o,t]):e<i&&(e=i)}}for(let n=0;n<r.length;n++){const[o,i]=r[n];t[o][i]=e}},ow=(t,e=2,r=ew.linkDistance)=>{try{const r=t.length,n=new Zy(r,r);for(let e=0;e<r;e++)for(let o=0;o<r;o++){const r=t[e][o];n.set(e,o,-.5*r*r)}const o=n.mean("row"),i=n.mean("column"),s=n.mean();n.add(s).subRowVector(o).subColumnVector(i);const a=new tw(n),u=Zy.sqrt(a.diagonalMatrix).diagonal(),c=a.leftSingularVectors,h=u,l=[];for(let t=0;t<c.rows;t++){const r=[];for(let n=0;n<e;n++)r.push(c.get(t,n)*h[n]);l.push(r)}return l}catch(e){const n=[];for(let e=0;e<t.length;e++){const t=Math.random()*r,e=Math.random()*r;n.push([t,e])}return n}},iw={maxIteration:10,width:10,speed:100,gravity:10,k:5},sw=(t,e,r,n,o)=>{let i=0;t.forEachNode(s=>{let a=0;t.forEachNode(t=>{if(a<=i)return void a++;if(s.id===t.id)return;if(n.get(s.id)!==n.get(t.id))return;let u=s.x-t.x,c=s.y-t.y,h=Math.sqrt(u*u+c*c);if(0===h){h=1;const t=i>a?1:-1;u=.01*t,c=.01*t}const l=Math.max(...ht(o(s._original)));if(h<Math.max(...ht(o(t._original)))/2+l/2){const n=r*r/h,o=e.get(s.id),i=e.get(t.id),a=u/h*n,l=c/h*n;e.set(s.id,{x:o.x+a,y:o.y+l}),e.set(t.id,{x:i.x-a,y:i.y-l})}a++}),i++})},aw=(t,e,r,n,o,i,s)=>{n&&t.forEachNode(t=>{const r=t.x-o.x,n=t.y-o.y,i=Math.sqrt(r*r+n*n);let s=n/i,a=-r/i;const u=e.get(t.id),c=Math.sqrt(u.x*u.x+u.y*u.y);let h=Math.acos((s*u.x+a*u.y)/c);h>Math.PI/2&&(h-=Math.PI/2,s*=-1,a*=-1);const l=Math.cos(h)*c;e.set(t.id,{x:s*l,y:a*l})});let a=0,u=0;return t.forEachNode(t=>{if(t.id===o.id)return;const c=e.get(t.id),h=Math.sqrt(c.x*c.x+c.y*c.y);if(h>0){const e=Math.min(i*(r/800),h);if(t.x+=c.x/h*e,t.y+=c.y/h*e,n){let e=t.x-o.x,r=t.y-o.y;const n=Math.sqrt(e*e+r*r);e=e/n*s.get(t.id),r=r/n*s.get(t.id),t.x=o.x+e,t.y=o.y+r}a+=e,u++}}),u>0?a/u:0},uw={focusNode:null,linkDistance:50,maxIteration:1e3,maxPreventOverlapIteration:200,preventOverlap:!1,sortStrength:10,strictRadial:!0,unitRadius:null};class cw extends dt{constructor(){super(...arguments),this.id="radial"}getDefaultOptions(){return uw}layout(){return r(this,void 0,void 0,function*(){const{width:t,height:e,center:r}=lt(this.options),n=this.model.nodeCount();if(!n||1===n)return H(this.model,r);const{focusNode:o,linkDistance:i=uw.linkDistance,maxIteration:s=uw.maxIteration,maxPreventOverlapIteration:a=uw.maxPreventOverlapIteration,nodeSize:u,nodeSpacing:c,preventOverlap:h,sortBy:l,sortStrength:d=uw.sortStrength,strictRadial:f,unitRadius:g}=this.options,p=o&&this.model.node(o)||this.model.firstNode(),v=this.model.nodeIndexOf(p.id),m=K(X(this.model,!1)),y=fw(m,v);dw(m,v,y+1);const w=m[v],x=(t-r[0]>r[0]?r[0]:t-r[0])||t/2,b=(e-r[1]>r[1]?r[1]:e-r[1])||e/2,E=Math.min(x,b),M=Math.max(...w),N=[],_=new Map,k=null!=g?g:E/M;w.forEach((t,e)=>{const r=t*k;N.push(r),_.set(this.model.nodeAt(e).id,r)});const S=hw(this.model,m,i,N,k,l,d),z=ow(S,2,i),A=z[v];let O=0;if(this.model.forEachNode(t=>{const e=z[O];t.x=e[0]-A[0],t.y=e[1]-A[1],O++}),this.run(s,S,N,v),this.model.forEachNode(t=>{t.x+=r[0],t.y+=r[1]}),h){const e={nodeSizeFunc:mt(u,c),radiiMap:_,width:t,strictRadial:Boolean(f),focusNode:p,maxIteration:a,k:n/4.5};((t,e)=>{const r=Object.assign(Object.assign({},iw),e),{maxIteration:n,width:o,k:i,speed:s=iw.speed,strictRadial:a,focusNode:u,radiiMap:c,nodeSizeFunc:h}=r,l=.002*i,d=new Map,f=o/10;for(let e=0;e<n&&(t.forEachNode(t=>{d.set(t.id,{x:0,y:0})}),sw(t,d,i,c,h),!(aw(t,d,s,a,u,f,c)<l));e++);})(this.model,e)}})}run(t,e,r,n){const o=lw(e),i=this.model.nodeCount(),s=this.model.nodes(),a=new Float64Array(i),u=new Float64Array(i);for(let t=0;t<i;t++)a[t]=s[t].x,u[t]=s[t].y;for(let c=0;c<=t;c++){const h=c/t,l=1-h;for(let t=0;t<i;t++){if(t===n)continue;const c=a[t],d=u[t],f=Math.sqrt(c*c+d*d),g=0===f?0:1/f;let p=0,v=0,m=0;for(let r=0;r<i;r++){if(t===r)continue;const n=a[r],i=u[r],s=Math.sqrt((c-n)*(c-n)+(d-i)*(d-i)),h=0===s?0:1/s,l=e[r][t];m+=o[t][r],p+=o[t][r]*(n+l*(c-n)*h),v+=o[t][r]*(i+l*(d-i)*h)}const y=0===r[t]?0:1/r[t];m*=l,m+=h*y*y,p*=l,p+=h*y*c*g,v*=l,v+=h*y*d*g,a[t]=p/m,u[t]=v/m,s[t].x=a[t],s[t].y=u[t]}}}}const hw=(t,e,r,n,o,i,s)=>{const a=e.length,u=new Array(a),c=new Array(a);for(let t=0;t<a;t++)c[t]=n[t]/o;const h=(r+o)/2,l=new Map,d="function"==typeof i?i:null,f="data"===i;for(let o=0;o<a;o++){const i=e[o],g=new Array(a);u[o]=g;const p=c[o]||1;for(let e=0;e<a;e++){if(o===e){g[e]=0;continue}const a=i[e];if(n[o]===n[e])if(f)g[e]=a*Math.abs(o-e)*s/p;else if(d){const r=t.nodeAt(o),n=t.nodeAt(e);let i=l.get(r.id);if(void 0===i){const t=d(r._original)||0;i="string"==typeof t?t.charCodeAt(0):Number(t||0),l.set(r.id,i)}let u=l.get(n.id);if(void 0===u){const t=d(n._original)||0;u="string"==typeof t?t.charCodeAt(0):Number(t||0),l.set(n.id,u)}g[e]=a*Math.abs(i-u)*s/p}else g[e]=a*r/p;else g[e]=a*h}}return u},lw=t=>{const e=t.length,r=t[0].length,n=[];for(let o=0;o<e;o++){const e=[];for(let n=0;n<r;n++)0!==t[o][n]?e.push(1/(t[o][n]*t[o][n])):e.push(0);n.push(e)}return n},dw=(t,e,r)=>{const n=t.length;for(let o=0;o<n;o++)if(t[e][o]===1/0){t[e][o]=r,t[o][e]=r;for(let i=0;i<n;i++)t[o][i]!==1/0&&t[e][i]===1/0&&(t[e][i]=r+t[o][i],t[i][e]=r+t[o][i])}for(let r=0;r<n;r++)if(r!==e)for(let o=0;o<n;o++)if(t[r][o]===1/0){let n=Math.abs(t[e][r]-t[e][o]);n=0===n?1:n,t[r][o]=n}},fw=(t,e)=>{const r=t[e];let n=0;for(let t=0;t<r.length;t++)r[t]!==1/0&&(n=Math.max(n,r[t]));return n};class gw extends dt{constructor(){super(...arguments),this.id="random"}getDefaultOptions(){return{center:[0,0],width:300,height:300}}layout(){return r(this,void 0,void 0,function*(){const{width:t,height:e,center:r}=lt(this.options);this.model.forEachNode(n=>{n.x=pw(t)+r[0],n.y=pw(e)+r[1]})})}}const pw=t=>.9*(Math.random()-.5)*t,vw={"antv-dagre":lr,"d3-force-3d":to,"d3-force":fn,"force-atlas2":Cy,circular:gr,concentric:vr,dagre:vy,force:ky,fruchterman:Py,grid:Ty,mds:rw,radial:cw,random:gw},mw={layout:t=>t?{type:"concentric",preventOverlap:!0}:{type:"force",preventOverlap:!0},nodeSize:20,nodeSpacing:10,comboPadding:20,comboSpacing:80},yw="root";t.AntVDagreLayout=lr,t.BaseLayout=dt,t.CircularLayout=gr,t.ComboCombinedLayout=class extends dt{constructor(){super(...arguments),this.id="combo-combined",this.relativePositions=new Map,this.getParentId=t=>t.parentId||yw}getDefaultOptions(){return mw}layout(){return r(this,void 0,void 0,function*(){const{center:t}=lt(this.options);this.resetLayoutState();const e=this.buildHierarchyTree();yield this.layoutHierarchy(e),this.convertToGlobalPositions(e,t),this.applyPositionsToModel(e)})}isCombo(t){return Boolean(t.isCombo)}resetLayoutState(){this.relativePositions.clear()}layoutHierarchy(t){return r(this,void 0,void 0,function*(){for(const e of t.children||[])this.isCombo(e)&&(yield this.layoutHierarchy(e));const e=t.children||[];if(0===e.length)return t.size=[0,0,0],void(t.parentId=t.id===yw?null:t.parentId);const n=this.getLayoutConfig(t),{type:o}=n,i=function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(r[n[o]]=t[n[o]])}return r}(n,["type"]),s=new(this.getLayoutClass(o))(i),a=this.createTemporaryGraphData(e);yield function(t,e,n={}){var o;return r(this,void 0,void 0,function*(){return gt(t)?(t.execute(e,n),t.stop(),t.tick(null!==(o=n.iterations)&&void 0!==o?o:300)):yield t.execute(e,n)})}(s,a,{});const u=s.model.nodes();this.recordRelativePositions(u,t);const{center:c,width:h,height:l}=this.calculateComboBounds(t);t.size=[h,l,0],(t.children||[]).forEach(t=>{const e=this.relativePositions.get(t.id);if(!e)return;const r=Object.assign(Object.assign({},e),{x:e.x-c[0],y:e.y-c[1]});this.relativePositions.set(t.id,r)})})}recordRelativePositions(t,e){const r=this.calculateComboCenter(t);t.forEach(t=>{this.relativePositions.set(t.id,{x:t.x-r[0],y:t.y-r[1],relativeTo:String(e.id)})})}buildHierarchyTree(){const t={id:yw,isCombo:!0,children:[],parentId:null},e=new Map;return e.set(yw,t),this.model.forEachNode(t=>{if(this.isCombo(t)){const r=Object.assign(Object.assign({},t),{children:[],parentId:this.getParentId(t)});e.set(String(t.id),r)}}),this.model.forEachNode(t=>{const r=e.get(this.getParentId(t));if(this.isCombo(t)){const n=e.get(String(t.id));r&&n&&(r.children.push(n),n.parentId=r.id)}else r&&r.children.push(Object.assign(Object.assign({},t),{children:[],parentId:this.getParentId(t)}))}),t}convertToGlobalPositions(t,e){var r,n;const o=t.id===yw?null:this.relativePositions.get(t.id),i=e[0]+(null!==(r=null==o?void 0:o.x)&&void 0!==r?r:0),s=e[1]+(null!==(n=null==o?void 0:o.y)&&void 0!==n?n:0);t.x=i,t.y=s,(t.children||[]).forEach(t=>{var e,r;const n=this.relativePositions.get(t.id);t.x=i+(null!==(e=null==n?void 0:n.x)&&void 0!==e?e:0),t.y=s+(null!==(r=null==n?void 0:n.y)&&void 0!==r?r:0),t.size=this.getNodeLikeSize(t,!1),this.isCombo(t)&&this.convertToGlobalPositions(t,[i,s])})}getLayoutConfig(t){const{layout:e}=this.options;if("function"==typeof e){const r=t.id===yw?null:t.id;return this.normalizeLayoutConfig(e(r))}return this.normalizeLayoutConfig(e)}normalizeLayoutConfig(t){const e=Object.assign(Object.assign({type:"concentric"},lt(this.options)),{nodeSize:t=>t.size,nodeSpacing:0});return t?"string"==typeof t?Object.assign(Object.assign({},e),{type:t}):Object.assign(Object.assign({},e),t):e}getLayoutClass(t){return vw[t]||vw.concentric}createTemporaryGraphData(t){const e=t.map(t=>Object.assign(Object.assign({},t),{size:this.getNodeLikeSize(t)})),r=new Set(t.map(t=>String(t.id))),n=[],o=t=>{let e=String(t);const n=new Set;for(;e&&!n.has(e);){if(r.has(e))return e;n.add(e);const t=this.model.node(e),o=null==t?void 0:t.parentId;e=null==o?null:String(o)}return null};return this.model.forEachEdge(t=>{const e=o(String(t.source)),r=o(String(t.target));e&&r&&e!==r&&n.push({source:e,target:r})}),{nodes:e,edges:n}}calculateComboCenter(t){if(0===t.length)return[0,0];const e=new Map;t.forEach(t=>{const r=this.getNodeLikeSize(t);e.set(t.id,r)});let r=1/0,n=1/0,o=-1/0,i=-1/0;return t.forEach(t=>{const[s=0,a=0]=e.get(t.id);r=Math.min(r,t.x-s/2),n=Math.min(n,t.y-a/2),o=Math.max(o,t.x+s/2),i=Math.max(i,t.y+a/2)}),Number.isFinite(r)&&Number.isFinite(n)?[(r+o)/2,(n+i)/2]:[0,0]}calculateComboBounds(t){const e=t.children||[];if(0===e.length)return{center:[0,0],width:0,height:0};let r=1/0,n=1/0,o=-1/0,i=-1/0;if(e.forEach(t=>{var e,s;const a=this.relativePositions.get(t.id),u=null!==(e=null==a?void 0:a.x)&&void 0!==e?e:0,c=null!==(s=null==a?void 0:a.y)&&void 0!==s?s:0,[h,l]=this.getNodeLikeSize(t);r=Math.min(r,u-h/2),n=Math.min(n,c-l/2),o=Math.max(o,u+h/2),i=Math.max(i,c+l/2)}),!Number.isFinite(r)||!Number.isFinite(n))return{center:[0,0],width:0,height:0};const s=pt(this.options.comboPadding,20)(t._original);return{center:[(r+o)/2,(n+i)/2],width:o-r+2*s,height:i-n+2*s}}getNodeLikeSize(t,e=!0){return this.isCombo(t)?this.getComboSize(t,e):this.getNodeSize(t,e)}getNodeSize(t,e=!0){const{nodeSize:r,nodeSpacing:n}=this.options;return ht(mt(r,e?n:0)(t._original))}getComboSize(t,e=!0){const r=pt(this.options.comboSpacing,0),n=e?r(t._original):0,[o,i]=t.size;return[o+n/2,i+n/2,0]}applyPositionsToModel(t){const e=t=>{const e=this.model.node(t.id);e&&(e.x=t.x,e.y=t.y,t.size&&(e.size=t.size))},r=t=>{t.id!==yw&&e(t),(t.children||[]).forEach(t=>{this.isCombo(t)?r(t):e(t)})};r(t)}},t.ConcentricLayout=vr,t.D3Force3DLayout=to,t.D3ForceLayout=fn,t.DagreLayout=vy,t.ForceAtlas2Layout=Cy,t.ForceLayout=ky,t.FruchtermanLayout=Py,t.GraphLib=b,t.GridLayout=Ty,t.MDSLayout=rw,t.RadialLayout=cw,t.RandomLayout=gw,t.RuntimeContext=_,t.Supervisor=W,t.applySingleNodeLayout=H,t.assignDefined=rt,t.floydWarshall=t=>{const e=t.length,r=Array.from({length:e},()=>new Array(e));for(let n=0;n<e;n++){const o=t[n],i=r[n];for(let t=0;t<e;t++)i[t]=n===t?0:o[t]>0?o[t]:1/0}for(let t=0;t<e;t++){const n=r[t];for(let o=0;o<e;o++){const i=r[o],s=i[t];if(s!==1/0)for(let t=0;t<e;t++){const e=n[t];if(e===1/0)continue;const r=s+e;r<i[t]&&(i[t]=r)}}}return r},t.getAdjList=X,t.getAdjMatrix=(t,e)=>{const r=t.nodeCount(),n=Array.from({length:r},()=>new Array(r)),o={};let i=0;return t.forEachNode(t=>{o[t.id]=i++}),t.forEachEdge(t=>{const r=o[t.source],i=o[t.target];void 0!==r&&void 0!==i&&(n[r][i]=1,e||(n[i][r]=1))}),n},t.getEuclideanDistance=(t,e)=>Math.sqrt((t.x-e.x)*(t.x-e.x)+(t.y-e.y)*(t.y-e.y)),t.getLayoutBBox=t=>{let e=1/0,r=1/0,n=-1/0,o=-1/0;return t.forEach(t=>{let i=t.data.size;Y(i)?1===i.length&&(i=[i[0],i[0]]):void 0===i||isNaN(i)?i=[30,30]:l(i)&&(i=[i,i]);const s=[i[0]/2,i[1]/2],a=t.data.x-s[0],u=t.data.x+s[0],c=t.data.y-s[1],h=t.data.y+s[1];e>a&&(e=a),r>c&&(r=c),n<u&&(n=u),o<h&&(o=h)}),{minX:e,minY:r,maxX:n,maxY:o}},t.getNestedValue=et,t.graphTreeDfs=J,t.initNodePosition=N,t.isArray=Y,t.isLayoutWithIterations=gt,t.johnson=K,t.mergeOptions=nt,t.normalizeViewport=lt,t.orderByDegree=it,t.orderById=st,t.orderBySorter=at,t.orderByTopology=ut,t.parsePoint=ct,t.parseSize=ht,t.registry=vw,t.scaleMatrix=Q,t.setNestedValue=function(t,e,r){!function(t,e,r){var n=t,o=h(e)?e.split("."):e;o.forEach(function(t,e){e<o.length-1?(s(n[t])||(n[t]=l(o[e+1])?[]:{}),n=n[t]):n[t]=r})}(t,String(e).split("."),r)},t.toPointObject=function(t){var e;return{x:t[0],y:t[1],z:null!==(e=t[2])&&void 0!==e?e:0}}});
|
|
7
|
+
//# sourceMappingURL=index.min.js.map
|