polly-graph 0.2.2 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/index.cjs +262 -198
  2. package/dist/index.js +262 -198
  3. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -437,14 +437,14 @@ var CanvasUtils = {
437
437
  /**
438
438
  * Safe image data extraction
439
439
  */
440
- getPixelData(ctx, x2, y2, pixelRatio = window.devicePixelRatio || 1) {
440
+ getPixelData(ctx, x3, y3, pixelRatio = window.devicePixelRatio || 1) {
441
441
  try {
442
- if (x2 <= 0 || y2 <= 0) {
442
+ if (x3 <= 0 || y3 <= 0) {
443
443
  return null;
444
444
  }
445
445
  const imageData = ctx.getImageData(
446
- x2 * pixelRatio,
447
- y2 * pixelRatio,
446
+ x3 * pixelRatio,
447
+ y3 * pixelRatio,
448
448
  1,
449
449
  1
450
450
  );
@@ -454,8 +454,8 @@ var CanvasUtils = {
454
454
  return null;
455
455
  }
456
456
  ErrorHandler.logError(error, {
457
- x: x2,
458
- y: y2,
457
+ x: x3,
458
+ y: y3,
459
459
  pixelRatio
460
460
  });
461
461
  return null;
@@ -1184,16 +1184,16 @@ var CanvasManager = class {
1184
1184
  };
1185
1185
 
1186
1186
  // node_modules/d3-force/src/center.js
1187
- function center_default(x2, y2) {
1187
+ function center_default(x3, y3) {
1188
1188
  var nodes, strength = 1;
1189
- if (x2 == null) x2 = 0;
1190
- if (y2 == null) y2 = 0;
1189
+ if (x3 == null) x3 = 0;
1190
+ if (y3 == null) y3 = 0;
1191
1191
  function force() {
1192
1192
  var i, n = nodes.length, node, sx = 0, sy = 0;
1193
1193
  for (i = 0; i < n; ++i) {
1194
1194
  node = nodes[i], sx += node.x, sy += node.y;
1195
1195
  }
1196
- for (sx = (sx / n - x2) * strength, sy = (sy / n - y2) * strength, i = 0; i < n; ++i) {
1196
+ for (sx = (sx / n - x3) * strength, sy = (sy / n - y3) * strength, i = 0; i < n; ++i) {
1197
1197
  node = nodes[i], node.x -= sx, node.y -= sy;
1198
1198
  }
1199
1199
  }
@@ -1201,10 +1201,10 @@ function center_default(x2, y2) {
1201
1201
  nodes = _;
1202
1202
  };
1203
1203
  force.x = function(_) {
1204
- return arguments.length ? (x2 = +_, force) : x2;
1204
+ return arguments.length ? (x3 = +_, force) : x3;
1205
1205
  };
1206
1206
  force.y = function(_) {
1207
- return arguments.length ? (y2 = +_, force) : y2;
1207
+ return arguments.length ? (y3 = +_, force) : y3;
1208
1208
  };
1209
1209
  force.strength = function(_) {
1210
1210
  return arguments.length ? (strength = +_, force) : strength;
@@ -1214,42 +1214,42 @@ function center_default(x2, y2) {
1214
1214
 
1215
1215
  // node_modules/d3-quadtree/src/add.js
1216
1216
  function add_default(d) {
1217
- const x2 = +this._x.call(null, d), y2 = +this._y.call(null, d);
1218
- return add(this.cover(x2, y2), x2, y2, d);
1217
+ const x3 = +this._x.call(null, d), y3 = +this._y.call(null, d);
1218
+ return add(this.cover(x3, y3), x3, y3, d);
1219
1219
  }
1220
- function add(tree, x2, y2, d) {
1221
- if (isNaN(x2) || isNaN(y2)) return tree;
1220
+ function add(tree, x3, y3, d) {
1221
+ if (isNaN(x3) || isNaN(y3)) return tree;
1222
1222
  var parent, node = tree._root, leaf = { data: d }, x0 = tree._x0, y0 = tree._y0, x1 = tree._x1, y1 = tree._y1, xm, ym, xp, yp, right, bottom, i, j;
1223
1223
  if (!node) return tree._root = leaf, tree;
1224
1224
  while (node.length) {
1225
- if (right = x2 >= (xm = (x0 + x1) / 2)) x0 = xm;
1225
+ if (right = x3 >= (xm = (x0 + x1) / 2)) x0 = xm;
1226
1226
  else x1 = xm;
1227
- if (bottom = y2 >= (ym = (y0 + y1) / 2)) y0 = ym;
1227
+ if (bottom = y3 >= (ym = (y0 + y1) / 2)) y0 = ym;
1228
1228
  else y1 = ym;
1229
1229
  if (parent = node, !(node = node[i = bottom << 1 | right])) return parent[i] = leaf, tree;
1230
1230
  }
1231
1231
  xp = +tree._x.call(null, node.data);
1232
1232
  yp = +tree._y.call(null, node.data);
1233
- if (x2 === xp && y2 === yp) return leaf.next = node, parent ? parent[i] = leaf : tree._root = leaf, tree;
1233
+ if (x3 === xp && y3 === yp) return leaf.next = node, parent ? parent[i] = leaf : tree._root = leaf, tree;
1234
1234
  do {
1235
1235
  parent = parent ? parent[i] = new Array(4) : tree._root = new Array(4);
1236
- if (right = x2 >= (xm = (x0 + x1) / 2)) x0 = xm;
1236
+ if (right = x3 >= (xm = (x0 + x1) / 2)) x0 = xm;
1237
1237
  else x1 = xm;
1238
- if (bottom = y2 >= (ym = (y0 + y1) / 2)) y0 = ym;
1238
+ if (bottom = y3 >= (ym = (y0 + y1) / 2)) y0 = ym;
1239
1239
  else y1 = ym;
1240
1240
  } while ((i = bottom << 1 | right) === (j = (yp >= ym) << 1 | xp >= xm));
1241
1241
  return parent[j] = node, parent[i] = leaf, tree;
1242
1242
  }
1243
1243
  function addAll(data) {
1244
- var d, i, n = data.length, x2, y2, xz = new Array(n), yz = new Array(n), x0 = Infinity, y0 = Infinity, x1 = -Infinity, y1 = -Infinity;
1244
+ var d, i, n = data.length, x3, y3, xz = new Array(n), yz = new Array(n), x0 = Infinity, y0 = Infinity, x1 = -Infinity, y1 = -Infinity;
1245
1245
  for (i = 0; i < n; ++i) {
1246
- if (isNaN(x2 = +this._x.call(null, d = data[i])) || isNaN(y2 = +this._y.call(null, d))) continue;
1247
- xz[i] = x2;
1248
- yz[i] = y2;
1249
- if (x2 < x0) x0 = x2;
1250
- if (x2 > x1) x1 = x2;
1251
- if (y2 < y0) y0 = y2;
1252
- if (y2 > y1) y1 = y2;
1246
+ if (isNaN(x3 = +this._x.call(null, d = data[i])) || isNaN(y3 = +this._y.call(null, d))) continue;
1247
+ xz[i] = x3;
1248
+ yz[i] = y3;
1249
+ if (x3 < x0) x0 = x3;
1250
+ if (x3 > x1) x1 = x3;
1251
+ if (y3 < y0) y0 = y3;
1252
+ if (y3 > y1) y1 = y3;
1253
1253
  }
1254
1254
  if (x0 > x1 || y0 > y1) return this;
1255
1255
  this.cover(x0, y0).cover(x1, y1);
@@ -1260,16 +1260,16 @@ function addAll(data) {
1260
1260
  }
1261
1261
 
1262
1262
  // node_modules/d3-quadtree/src/cover.js
1263
- function cover_default(x2, y2) {
1264
- if (isNaN(x2 = +x2) || isNaN(y2 = +y2)) return this;
1263
+ function cover_default(x3, y3) {
1264
+ if (isNaN(x3 = +x3) || isNaN(y3 = +y3)) return this;
1265
1265
  var x0 = this._x0, y0 = this._y0, x1 = this._x1, y1 = this._y1;
1266
1266
  if (isNaN(x0)) {
1267
- x1 = (x0 = Math.floor(x2)) + 1;
1268
- y1 = (y0 = Math.floor(y2)) + 1;
1267
+ x1 = (x0 = Math.floor(x3)) + 1;
1268
+ y1 = (y0 = Math.floor(y3)) + 1;
1269
1269
  } else {
1270
1270
  var z = x1 - x0 || 1, node = this._root, parent, i;
1271
- while (x0 > x2 || x2 >= x1 || y0 > y2 || y2 >= y1) {
1272
- i = (y2 < y0) << 1 | x2 < x0;
1271
+ while (x0 > x3 || x3 >= x1 || y0 > y3 || y3 >= y1) {
1272
+ i = (y3 < y0) << 1 | x3 < x0;
1273
1273
  parent = new Array(4), parent[i] = node, node = parent, z *= 2;
1274
1274
  switch (i) {
1275
1275
  case 0:
@@ -1321,17 +1321,17 @@ function quad_default(node, x0, y0, x1, y1) {
1321
1321
  }
1322
1322
 
1323
1323
  // node_modules/d3-quadtree/src/find.js
1324
- function find_default(x2, y2, radius) {
1325
- var data, x0 = this._x0, y0 = this._y0, x1, y1, x22, y22, x3 = this._x1, y3 = this._y1, quads = [], node = this._root, q, i;
1326
- if (node) quads.push(new quad_default(node, x0, y0, x3, y3));
1324
+ function find_default(x3, y3, radius) {
1325
+ var data, x0 = this._x0, y0 = this._y0, x1, y1, x22, y22, x32 = this._x1, y32 = this._y1, quads = [], node = this._root, q, i;
1326
+ if (node) quads.push(new quad_default(node, x0, y0, x32, y32));
1327
1327
  if (radius == null) radius = Infinity;
1328
1328
  else {
1329
- x0 = x2 - radius, y0 = y2 - radius;
1330
- x3 = x2 + radius, y3 = y2 + radius;
1329
+ x0 = x3 - radius, y0 = y3 - radius;
1330
+ x32 = x3 + radius, y32 = y3 + radius;
1331
1331
  radius *= radius;
1332
1332
  }
1333
1333
  while (q = quads.pop()) {
1334
- if (!(node = q.node) || (x1 = q.x0) > x3 || (y1 = q.y0) > y3 || (x22 = q.x1) < x0 || (y22 = q.y1) < y0) continue;
1334
+ if (!(node = q.node) || (x1 = q.x0) > x32 || (y1 = q.y0) > y32 || (x22 = q.x1) < x0 || (y22 = q.y1) < y0) continue;
1335
1335
  if (node.length) {
1336
1336
  var xm = (x1 + x22) / 2, ym = (y1 + y22) / 2;
1337
1337
  quads.push(
@@ -1340,17 +1340,17 @@ function find_default(x2, y2, radius) {
1340
1340
  new quad_default(node[1], xm, y1, x22, ym),
1341
1341
  new quad_default(node[0], x1, y1, xm, ym)
1342
1342
  );
1343
- if (i = (y2 >= ym) << 1 | x2 >= xm) {
1343
+ if (i = (y3 >= ym) << 1 | x3 >= xm) {
1344
1344
  q = quads[quads.length - 1];
1345
1345
  quads[quads.length - 1] = quads[quads.length - 1 - i];
1346
1346
  quads[quads.length - 1 - i] = q;
1347
1347
  }
1348
1348
  } else {
1349
- var dx = x2 - +this._x.call(null, node.data), dy = y2 - +this._y.call(null, node.data), d2 = dx * dx + dy * dy;
1349
+ var dx = x3 - +this._x.call(null, node.data), dy = y3 - +this._y.call(null, node.data), d2 = dx * dx + dy * dy;
1350
1350
  if (d2 < radius) {
1351
1351
  var d = Math.sqrt(radius = d2);
1352
- x0 = x2 - d, y0 = y2 - d;
1353
- x3 = x2 + d, y3 = y2 + d;
1352
+ x0 = x3 - d, y0 = y3 - d;
1353
+ x32 = x3 + d, y32 = y3 + d;
1354
1354
  data = node.data;
1355
1355
  }
1356
1356
  }
@@ -1360,13 +1360,13 @@ function find_default(x2, y2, radius) {
1360
1360
 
1361
1361
  // node_modules/d3-quadtree/src/remove.js
1362
1362
  function remove_default(d) {
1363
- if (isNaN(x2 = +this._x.call(null, d)) || isNaN(y2 = +this._y.call(null, d))) return this;
1364
- var parent, node = this._root, retainer, previous, next, x0 = this._x0, y0 = this._y0, x1 = this._x1, y1 = this._y1, x2, y2, xm, ym, right, bottom, i, j;
1363
+ if (isNaN(x3 = +this._x.call(null, d)) || isNaN(y3 = +this._y.call(null, d))) return this;
1364
+ var parent, node = this._root, retainer, previous, next, x0 = this._x0, y0 = this._y0, x1 = this._x1, y1 = this._y1, x3, y3, xm, ym, right, bottom, i, j;
1365
1365
  if (!node) return this;
1366
1366
  if (node.length) while (true) {
1367
- if (right = x2 >= (xm = (x0 + x1) / 2)) x0 = xm;
1367
+ if (right = x3 >= (xm = (x0 + x1) / 2)) x0 = xm;
1368
1368
  else x1 = xm;
1369
- if (bottom = y2 >= (ym = (y0 + y1) / 2)) y0 = ym;
1369
+ if (bottom = y3 >= (ym = (y0 + y1) / 2)) y0 = ym;
1370
1370
  else y1 = ym;
1371
1371
  if (!(parent = node, node = node[i = bottom << 1 | right])) return this;
1372
1372
  if (!node.length) break;
@@ -1458,13 +1458,13 @@ function y_default(_) {
1458
1458
  }
1459
1459
 
1460
1460
  // node_modules/d3-quadtree/src/quadtree.js
1461
- function quadtree(nodes, x2, y2) {
1462
- var tree = new Quadtree(x2 == null ? defaultX : x2, y2 == null ? defaultY : y2, NaN, NaN, NaN, NaN);
1461
+ function quadtree(nodes, x3, y3) {
1462
+ var tree = new Quadtree(x3 == null ? defaultX : x3, y3 == null ? defaultY : y3, NaN, NaN, NaN, NaN);
1463
1463
  return nodes == null ? tree : tree.addAll(nodes);
1464
1464
  }
1465
- function Quadtree(x2, y2, x0, y0, x1, y1) {
1466
- this._x = x2;
1467
- this._y = y2;
1465
+ function Quadtree(x3, y3, x0, y0, x1, y1) {
1466
+ this._x = x3;
1467
+ this._y = y3;
1468
1468
  this._x0 = x0;
1469
1469
  this._y0 = y0;
1470
1470
  this._x1 = x1;
@@ -1508,9 +1508,9 @@ treeProto.x = x_default;
1508
1508
  treeProto.y = y_default;
1509
1509
 
1510
1510
  // node_modules/d3-force/src/constant.js
1511
- function constant_default(x2) {
1511
+ function constant_default(x3) {
1512
1512
  return function() {
1513
- return x2;
1513
+ return x3;
1514
1514
  };
1515
1515
  }
1516
1516
 
@@ -1519,6 +1519,79 @@ function jiggle_default(random) {
1519
1519
  return (random() - 0.5) * 1e-6;
1520
1520
  }
1521
1521
 
1522
+ // node_modules/d3-force/src/collide.js
1523
+ function x(d) {
1524
+ return d.x + d.vx;
1525
+ }
1526
+ function y(d) {
1527
+ return d.y + d.vy;
1528
+ }
1529
+ function collide_default(radius) {
1530
+ var nodes, radii, random, strength = 1, iterations = 1;
1531
+ if (typeof radius !== "function") radius = constant_default(radius == null ? 1 : +radius);
1532
+ function force() {
1533
+ var i, n = nodes.length, tree, node, xi, yi, ri, ri2;
1534
+ for (var k = 0; k < iterations; ++k) {
1535
+ tree = quadtree(nodes, x, y).visitAfter(prepare);
1536
+ for (i = 0; i < n; ++i) {
1537
+ node = nodes[i];
1538
+ ri = radii[node.index], ri2 = ri * ri;
1539
+ xi = node.x + node.vx;
1540
+ yi = node.y + node.vy;
1541
+ tree.visit(apply);
1542
+ }
1543
+ }
1544
+ function apply(quad, x0, y0, x1, y1) {
1545
+ var data = quad.data, rj = quad.r, r = ri + rj;
1546
+ if (data) {
1547
+ if (data.index > node.index) {
1548
+ var x3 = xi - data.x - data.vx, y3 = yi - data.y - data.vy, l = x3 * x3 + y3 * y3;
1549
+ if (l < r * r) {
1550
+ if (x3 === 0) x3 = jiggle_default(random), l += x3 * x3;
1551
+ if (y3 === 0) y3 = jiggle_default(random), l += y3 * y3;
1552
+ l = (r - (l = Math.sqrt(l))) / l * strength;
1553
+ node.vx += (x3 *= l) * (r = (rj *= rj) / (ri2 + rj));
1554
+ node.vy += (y3 *= l) * r;
1555
+ data.vx -= x3 * (r = 1 - r);
1556
+ data.vy -= y3 * r;
1557
+ }
1558
+ }
1559
+ return;
1560
+ }
1561
+ return x0 > xi + r || x1 < xi - r || y0 > yi + r || y1 < yi - r;
1562
+ }
1563
+ }
1564
+ function prepare(quad) {
1565
+ if (quad.data) return quad.r = radii[quad.data.index];
1566
+ for (var i = quad.r = 0; i < 4; ++i) {
1567
+ if (quad[i] && quad[i].r > quad.r) {
1568
+ quad.r = quad[i].r;
1569
+ }
1570
+ }
1571
+ }
1572
+ function initialize() {
1573
+ if (!nodes) return;
1574
+ var i, n = nodes.length, node;
1575
+ radii = new Array(n);
1576
+ for (i = 0; i < n; ++i) node = nodes[i], radii[node.index] = +radius(node, i, nodes);
1577
+ }
1578
+ force.initialize = function(_nodes, _random) {
1579
+ nodes = _nodes;
1580
+ random = _random;
1581
+ initialize();
1582
+ };
1583
+ force.iterations = function(_) {
1584
+ return arguments.length ? (iterations = +_, force) : iterations;
1585
+ };
1586
+ force.strength = function(_) {
1587
+ return arguments.length ? (strength = +_, force) : strength;
1588
+ };
1589
+ force.radius = function(_) {
1590
+ return arguments.length ? (radius = typeof _ === "function" ? _ : constant_default(+_), initialize(), force) : radius;
1591
+ };
1592
+ return force;
1593
+ }
1594
+
1522
1595
  // node_modules/d3-force/src/link.js
1523
1596
  function index(d) {
1524
1597
  return d.index;
@@ -1536,17 +1609,17 @@ function link_default(links) {
1536
1609
  }
1537
1610
  function force(alpha) {
1538
1611
  for (var k = 0, n = links.length; k < iterations; ++k) {
1539
- for (var i = 0, link, source, target, x2, y2, l, b; i < n; ++i) {
1612
+ for (var i = 0, link, source, target, x3, y3, l, b; i < n; ++i) {
1540
1613
  link = links[i], source = link.source, target = link.target;
1541
- x2 = target.x + target.vx - source.x - source.vx || jiggle_default(random);
1542
- y2 = target.y + target.vy - source.y - source.vy || jiggle_default(random);
1543
- l = Math.sqrt(x2 * x2 + y2 * y2);
1614
+ x3 = target.x + target.vx - source.x - source.vx || jiggle_default(random);
1615
+ y3 = target.y + target.vy - source.y - source.vy || jiggle_default(random);
1616
+ l = Math.sqrt(x3 * x3 + y3 * y3);
1544
1617
  l = (l - distances[i]) / l * alpha * strengths[i];
1545
- x2 *= l, y2 *= l;
1546
- target.vx -= x2 * (b = bias[i]);
1547
- target.vy -= y2 * b;
1548
- source.vx += x2 * (b = 1 - b);
1549
- source.vy += y2 * b;
1618
+ x3 *= l, y3 *= l;
1619
+ target.vx -= x3 * (b = bias[i]);
1620
+ target.vy -= y3 * b;
1621
+ source.vx += x3 * (b = 1 - b);
1622
+ source.vy += y3 * b;
1550
1623
  }
1551
1624
  }
1552
1625
  }
@@ -1794,10 +1867,10 @@ function lcg_default() {
1794
1867
  }
1795
1868
 
1796
1869
  // node_modules/d3-force/src/simulation.js
1797
- function x(d) {
1870
+ function x2(d) {
1798
1871
  return d.x;
1799
1872
  }
1800
- function y(d) {
1873
+ function y2(d) {
1801
1874
  return d.y;
1802
1875
  }
1803
1876
  var initialRadius = 10;
@@ -1883,14 +1956,14 @@ function simulation_default(nodes) {
1883
1956
  force: function(name, _) {
1884
1957
  return arguments.length > 1 ? (_ == null ? forces.delete(name) : forces.set(name, initializeForce(_)), simulation) : forces.get(name);
1885
1958
  },
1886
- find: function(x2, y2, radius) {
1959
+ find: function(x3, y3, radius) {
1887
1960
  var i = 0, n = nodes.length, dx, dy, d2, node, closest;
1888
1961
  if (radius == null) radius = Infinity;
1889
1962
  else radius *= radius;
1890
1963
  for (i = 0; i < n; ++i) {
1891
1964
  node = nodes[i];
1892
- dx = x2 - node.x;
1893
- dy = y2 - node.y;
1965
+ dx = x3 - node.x;
1966
+ dy = y3 - node.y;
1894
1967
  d2 = dx * dx + dy * dy;
1895
1968
  if (d2 < radius) closest = node, radius = d2;
1896
1969
  }
@@ -1906,7 +1979,7 @@ function simulation_default(nodes) {
1906
1979
  function manyBody_default() {
1907
1980
  var nodes, node, random, alpha, strength = constant_default(-30), strengths, distanceMin2 = 1, distanceMax2 = Infinity, theta2 = 0.81;
1908
1981
  function force(_) {
1909
- var i, n = nodes.length, tree = quadtree(nodes, x, y).visitAfter(accumulate);
1982
+ var i, n = nodes.length, tree = quadtree(nodes, x2, y2).visitAfter(accumulate);
1910
1983
  for (alpha = _, i = 0; i < n; ++i) node = nodes[i], tree.visit(apply);
1911
1984
  }
1912
1985
  function initialize() {
@@ -1916,15 +1989,15 @@ function manyBody_default() {
1916
1989
  for (i = 0; i < n; ++i) node2 = nodes[i], strengths[node2.index] = +strength(node2, i, nodes);
1917
1990
  }
1918
1991
  function accumulate(quad) {
1919
- var strength2 = 0, q, c2, weight = 0, x2, y2, i;
1992
+ var strength2 = 0, q, c2, weight = 0, x3, y3, i;
1920
1993
  if (quad.length) {
1921
- for (x2 = y2 = i = 0; i < 4; ++i) {
1994
+ for (x3 = y3 = i = 0; i < 4; ++i) {
1922
1995
  if ((q = quad[i]) && (c2 = Math.abs(q.value))) {
1923
- strength2 += q.value, weight += c2, x2 += c2 * q.x, y2 += c2 * q.y;
1996
+ strength2 += q.value, weight += c2, x3 += c2 * q.x, y3 += c2 * q.y;
1924
1997
  }
1925
1998
  }
1926
- quad.x = x2 / weight;
1927
- quad.y = y2 / weight;
1999
+ quad.x = x3 / weight;
2000
+ quad.y = y3 / weight;
1928
2001
  } else {
1929
2002
  q = quad;
1930
2003
  q.x = q.data.x;
@@ -1935,29 +2008,29 @@ function manyBody_default() {
1935
2008
  }
1936
2009
  quad.value = strength2;
1937
2010
  }
1938
- function apply(quad, x1, _, x2) {
2011
+ function apply(quad, x1, _, x22) {
1939
2012
  if (!quad.value) return true;
1940
- var x3 = quad.x - node.x, y2 = quad.y - node.y, w = x2 - x1, l = x3 * x3 + y2 * y2;
2013
+ var x3 = quad.x - node.x, y3 = quad.y - node.y, w = x22 - x1, l = x3 * x3 + y3 * y3;
1941
2014
  if (w * w / theta2 < l) {
1942
2015
  if (l < distanceMax2) {
1943
2016
  if (x3 === 0) x3 = jiggle_default(random), l += x3 * x3;
1944
- if (y2 === 0) y2 = jiggle_default(random), l += y2 * y2;
2017
+ if (y3 === 0) y3 = jiggle_default(random), l += y3 * y3;
1945
2018
  if (l < distanceMin2) l = Math.sqrt(distanceMin2 * l);
1946
2019
  node.vx += x3 * quad.value * alpha / l;
1947
- node.vy += y2 * quad.value * alpha / l;
2020
+ node.vy += y3 * quad.value * alpha / l;
1948
2021
  }
1949
2022
  return true;
1950
2023
  } else if (quad.length || l >= distanceMax2) return;
1951
2024
  if (quad.data !== node || quad.next) {
1952
2025
  if (x3 === 0) x3 = jiggle_default(random), l += x3 * x3;
1953
- if (y2 === 0) y2 = jiggle_default(random), l += y2 * y2;
2026
+ if (y3 === 0) y3 = jiggle_default(random), l += y3 * y3;
1954
2027
  if (l < distanceMin2) l = Math.sqrt(distanceMin2 * l);
1955
2028
  }
1956
2029
  do
1957
2030
  if (quad.data !== node) {
1958
2031
  w = strengths[quad.data.index] * alpha / l;
1959
2032
  node.vx += x3 * w;
1960
- node.vy += y2 * w;
2033
+ node.vy += y3 * w;
1961
2034
  }
1962
2035
  while (quad = quad.next);
1963
2036
  }
@@ -2006,38 +2079,29 @@ var PhysicsManager = class {
2006
2079
  this.config = config;
2007
2080
  this.simulationStartTime = performance.now();
2008
2081
  const nodeCount = config.nodes.length;
2009
- const linkCount = config.links.length;
2010
2082
  const graphArea = config.width * config.height;
2011
- const baseChargeStrength = -600;
2012
2083
  const nodeDensity = nodeCount / (graphArea / 1e5);
2013
2084
  const densityFactor = Math.min(nodeDensity, 2);
2014
- const adaptiveChargeStrength = baseChargeStrength / (1 + densityFactor * 0.4);
2015
2085
  const baseVelocityDecay = 0.4;
2016
2086
  const adaptiveVelocityDecay = Math.min(baseVelocityDecay + densityFactor * 0.2, 0.8);
2017
2087
  const baseAlphaDecay = 0.02;
2018
2088
  const adaptiveAlphaDecay = Math.min(baseAlphaDecay + densityFactor * 0.01, 0.05);
2019
- console.log("\u{1F52C} Adaptive Physics:", {
2020
- nodeCount,
2021
- linkCount,
2022
- graphArea: Math.round(graphArea),
2023
- nodeDensity: nodeDensity.toFixed(3),
2024
- densityFactor: densityFactor.toFixed(2),
2025
- chargeStrength: adaptiveChargeStrength.toFixed(0),
2026
- velocityDecay: adaptiveVelocityDecay.toFixed(2),
2027
- alphaDecay: adaptiveAlphaDecay.toFixed(3),
2028
- maxDistance: Math.max(300, 600 - densityFactor * 100)
2029
- });
2030
2089
  this.simulation = simulation_default(config.nodes).force(
2031
2090
  "link",
2032
- link_default(config.links).id((d) => d.id).distance(100).strength(0.2)
2091
+ link_default(config.links).id((d) => d.id).distance(150).strength(0.4)
2033
2092
  // Much weaker link strength to allow repulsion to work
2034
2093
  ).force(
2035
2094
  "charge",
2036
- manyBody_default().strength(adaptiveChargeStrength).distanceMin(1).distanceMax(Math.max(300, 600 - densityFactor * 100))
2037
- // Reduce max distance for dense graphs
2095
+ manyBody_default().strength(-500)
2096
+ // Adaptive repulsion strength
2097
+ // .distanceMin(1) // Minimum distance for repulsion
2098
+ // .distanceMax(Math.max(300, 600 - densityFactor * 100)) // Reduce max distance for dense graphs
2099
+ ).force(
2100
+ "collision",
2101
+ collide_default().radius((node) => this.getNodeRadius(node) + 2).strength(1)
2038
2102
  ).force(
2039
2103
  "center",
2040
- center_default(0, 0).strength(0.1)
2104
+ center_default(0, 0).strength(0.5)
2041
2105
  // Center around origin like force-graph
2042
2106
  ).velocityDecay(adaptiveVelocityDecay).alphaDecay(adaptiveAlphaDecay).on("tick", config.onTick).on("end", () => this.handleSimulationEnd());
2043
2107
  if (config.cooldownTime) {
@@ -2164,12 +2228,12 @@ var PhysicsManager = class {
2164
2228
  * Update center force position for new canvas dimensions
2165
2229
  * Following force-graph pattern for container resizing
2166
2230
  */
2167
- updateCenterForce(x2, y2) {
2231
+ updateCenterForce(x3, y3) {
2168
2232
  if (!this.simulation) return;
2169
2233
  try {
2170
- this.simulation.force("center", center_default(x2, y2).strength(0.1));
2234
+ this.simulation.force("center", center_default(x3, y3).strength(0.1));
2171
2235
  } catch (error) {
2172
- ErrorHandler.logError(error, { x: x2, y: y2 });
2236
+ ErrorHandler.logError(error, { x: x3, y: y3 });
2173
2237
  }
2174
2238
  }
2175
2239
  /**
@@ -2386,8 +2450,8 @@ function select_default(select) {
2386
2450
  }
2387
2451
 
2388
2452
  // node_modules/d3-selection/src/array.js
2389
- function array(x2) {
2390
- return x2 == null ? [] : Array.isArray(x2) ? x2 : Array.from(x2);
2453
+ function array(x3) {
2454
+ return x3 == null ? [] : Array.isArray(x3) ? x3 : Array.from(x3);
2391
2455
  }
2392
2456
 
2393
2457
  // node_modules/d3-selection/src/selectorAll.js
@@ -2506,9 +2570,9 @@ EnterNode.prototype = {
2506
2570
  };
2507
2571
 
2508
2572
  // node_modules/d3-selection/src/constant.js
2509
- function constant_default2(x2) {
2573
+ function constant_default2(x3) {
2510
2574
  return function() {
2511
- return x2;
2575
+ return x3;
2512
2576
  };
2513
2577
  }
2514
2578
 
@@ -3181,7 +3245,7 @@ function yesdrag(view, noclick) {
3181
3245
  }
3182
3246
 
3183
3247
  // node_modules/d3-drag/src/constant.js
3184
- var constant_default3 = (x2) => () => x2;
3248
+ var constant_default3 = (x3) => () => x3;
3185
3249
 
3186
3250
  // node_modules/d3-drag/src/event.js
3187
3251
  function DragEvent(type, {
@@ -3190,8 +3254,8 @@ function DragEvent(type, {
3190
3254
  target,
3191
3255
  identifier,
3192
3256
  active,
3193
- x: x2,
3194
- y: y2,
3257
+ x: x3,
3258
+ y: y3,
3195
3259
  dx,
3196
3260
  dy,
3197
3261
  dispatch: dispatch2
@@ -3203,8 +3267,8 @@ function DragEvent(type, {
3203
3267
  target: { value: target, enumerable: true, configurable: true },
3204
3268
  identifier: { value: identifier, enumerable: true, configurable: true },
3205
3269
  active: { value: active, enumerable: true, configurable: true },
3206
- x: { value: x2, enumerable: true, configurable: true },
3207
- y: { value: y2, enumerable: true, configurable: true },
3270
+ x: { value: x3, enumerable: true, configurable: true },
3271
+ y: { value: y3, enumerable: true, configurable: true },
3208
3272
  dx: { value: dx, enumerable: true, configurable: true },
3209
3273
  dy: { value: dy, enumerable: true, configurable: true },
3210
3274
  _: { value: dispatch2 }
@@ -3731,7 +3795,7 @@ function basisClosed_default(values) {
3731
3795
  }
3732
3796
 
3733
3797
  // node_modules/d3-interpolate/src/constant.js
3734
- var constant_default4 = (x2) => () => x2;
3798
+ var constant_default4 = (x3) => () => x3;
3735
3799
 
3736
3800
  // node_modules/d3-interpolate/src/color.js
3737
3801
  function linear(a2, d) {
@@ -3739,14 +3803,14 @@ function linear(a2, d) {
3739
3803
  return a2 + t * d;
3740
3804
  };
3741
3805
  }
3742
- function exponential(a2, b, y2) {
3743
- return a2 = Math.pow(a2, y2), b = Math.pow(b, y2) - a2, y2 = 1 / y2, function(t) {
3744
- return Math.pow(a2 + t * b, y2);
3806
+ function exponential(a2, b, y3) {
3807
+ return a2 = Math.pow(a2, y3), b = Math.pow(b, y3) - a2, y3 = 1 / y3, function(t) {
3808
+ return Math.pow(a2 + t * b, y3);
3745
3809
  };
3746
3810
  }
3747
- function gamma(y2) {
3748
- return (y2 = +y2) === 1 ? nogamma : function(a2, b) {
3749
- return b - a2 ? exponential(a2, b, y2) : constant_default4(isNaN(a2) ? b : a2);
3811
+ function gamma(y3) {
3812
+ return (y3 = +y3) === 1 ? nogamma : function(a2, b) {
3813
+ return b - a2 ? exponential(a2, b, y3) : constant_default4(isNaN(a2) ? b : a2);
3750
3814
  };
3751
3815
  }
3752
3816
  function nogamma(a2, b) {
@@ -3755,8 +3819,8 @@ function nogamma(a2, b) {
3755
3819
  }
3756
3820
 
3757
3821
  // node_modules/d3-interpolate/src/rgb.js
3758
- var rgb_default = (function rgbGamma(y2) {
3759
- var color2 = gamma(y2);
3822
+ var rgb_default = (function rgbGamma(y3) {
3823
+ var color2 = gamma(y3);
3760
3824
  function rgb2(start2, end) {
3761
3825
  var r = color2((start2 = rgb(start2)).r, (end = rgb(end)).r), g = color2(start2.g, end.g), b = color2(start2.b, end.b), opacity = nogamma(start2.opacity, end.opacity);
3762
3826
  return function(t) {
@@ -3941,14 +4005,14 @@ var interpolateTransformSvg = interpolateTransform(parseSvg, ", ", ")", ")");
3941
4005
 
3942
4006
  // node_modules/d3-interpolate/src/zoom.js
3943
4007
  var epsilon2 = 1e-12;
3944
- function cosh(x2) {
3945
- return ((x2 = Math.exp(x2)) + 1 / x2) / 2;
4008
+ function cosh(x3) {
4009
+ return ((x3 = Math.exp(x3)) + 1 / x3) / 2;
3946
4010
  }
3947
- function sinh(x2) {
3948
- return ((x2 = Math.exp(x2)) - 1 / x2) / 2;
4011
+ function sinh(x3) {
4012
+ return ((x3 = Math.exp(x3)) - 1 / x3) / 2;
3949
4013
  }
3950
- function tanh(x2) {
3951
- return ((x2 = Math.exp(2 * x2)) - 1) / (x2 + 1);
4014
+ function tanh(x3) {
4015
+ return ((x3 = Math.exp(2 * x3)) - 1) / (x3 + 1);
3952
4016
  }
3953
4017
  var zoom_default = (function zoomRho(rho, rho2, rho4) {
3954
4018
  function zoom(p0, p1) {
@@ -4676,7 +4740,7 @@ selection_default.prototype.interrupt = interrupt_default2;
4676
4740
  selection_default.prototype.transition = transition_default2;
4677
4741
 
4678
4742
  // node_modules/d3-zoom/src/constant.js
4679
- var constant_default5 = (x2) => () => x2;
4743
+ var constant_default5 = (x3) => () => x3;
4680
4744
 
4681
4745
  // node_modules/d3-zoom/src/event.js
4682
4746
  function ZoomEvent(type, {
@@ -4695,42 +4759,42 @@ function ZoomEvent(type, {
4695
4759
  }
4696
4760
 
4697
4761
  // node_modules/d3-zoom/src/transform.js
4698
- function Transform(k, x2, y2) {
4762
+ function Transform(k, x3, y3) {
4699
4763
  this.k = k;
4700
- this.x = x2;
4701
- this.y = y2;
4764
+ this.x = x3;
4765
+ this.y = y3;
4702
4766
  }
4703
4767
  Transform.prototype = {
4704
4768
  constructor: Transform,
4705
4769
  scale: function(k) {
4706
4770
  return k === 1 ? this : new Transform(this.k * k, this.x, this.y);
4707
4771
  },
4708
- translate: function(x2, y2) {
4709
- return x2 === 0 & y2 === 0 ? this : new Transform(this.k, this.x + this.k * x2, this.y + this.k * y2);
4772
+ translate: function(x3, y3) {
4773
+ return x3 === 0 & y3 === 0 ? this : new Transform(this.k, this.x + this.k * x3, this.y + this.k * y3);
4710
4774
  },
4711
4775
  apply: function(point) {
4712
4776
  return [point[0] * this.k + this.x, point[1] * this.k + this.y];
4713
4777
  },
4714
- applyX: function(x2) {
4715
- return x2 * this.k + this.x;
4778
+ applyX: function(x3) {
4779
+ return x3 * this.k + this.x;
4716
4780
  },
4717
- applyY: function(y2) {
4718
- return y2 * this.k + this.y;
4781
+ applyY: function(y3) {
4782
+ return y3 * this.k + this.y;
4719
4783
  },
4720
4784
  invert: function(location) {
4721
4785
  return [(location[0] - this.x) / this.k, (location[1] - this.y) / this.k];
4722
4786
  },
4723
- invertX: function(x2) {
4724
- return (x2 - this.x) / this.k;
4787
+ invertX: function(x3) {
4788
+ return (x3 - this.x) / this.k;
4725
4789
  },
4726
- invertY: function(y2) {
4727
- return (y2 - this.y) / this.k;
4790
+ invertY: function(y3) {
4791
+ return (y3 - this.y) / this.k;
4728
4792
  },
4729
- rescaleX: function(x2) {
4730
- return x2.copy().domain(x2.range().map(this.invertX, this).map(x2.invert, x2));
4793
+ rescaleX: function(x3) {
4794
+ return x3.copy().domain(x3.range().map(this.invertX, this).map(x3.invert, x3));
4731
4795
  },
4732
- rescaleY: function(y2) {
4733
- return y2.copy().domain(y2.range().map(this.invertY, this).map(y2.invert, y2));
4796
+ rescaleY: function(y3) {
4797
+ return y3.copy().domain(y3.range().map(this.invertY, this).map(y3.invert, y3));
4734
4798
  },
4735
4799
  toString: function() {
4736
4800
  return "translate(" + this.x + "," + this.y + ") scale(" + this.k + ")";
@@ -4812,20 +4876,20 @@ function zoom_default2() {
4812
4876
  return constrain(translate(scale(t0, k1), p0, p1), e, translateExtent);
4813
4877
  }, p, event);
4814
4878
  };
4815
- zoom.translateBy = function(selection2, x2, y2, event) {
4879
+ zoom.translateBy = function(selection2, x3, y3, event) {
4816
4880
  zoom.transform(selection2, function() {
4817
4881
  return constrain(this.__zoom.translate(
4818
- typeof x2 === "function" ? x2.apply(this, arguments) : x2,
4819
- typeof y2 === "function" ? y2.apply(this, arguments) : y2
4882
+ typeof x3 === "function" ? x3.apply(this, arguments) : x3,
4883
+ typeof y3 === "function" ? y3.apply(this, arguments) : y3
4820
4884
  ), extent.apply(this, arguments), translateExtent);
4821
4885
  }, null, event);
4822
4886
  };
4823
- zoom.translateTo = function(selection2, x2, y2, p, event) {
4887
+ zoom.translateTo = function(selection2, x3, y3, p, event) {
4824
4888
  zoom.transform(selection2, function() {
4825
4889
  var e = extent.apply(this, arguments), t = this.__zoom, p0 = p == null ? centroid(e) : typeof p === "function" ? p.apply(this, arguments) : p;
4826
4890
  return constrain(identity2.translate(p0[0], p0[1]).scale(t.k).translate(
4827
- typeof x2 === "function" ? -x2.apply(this, arguments) : -x2,
4828
- typeof y2 === "function" ? -y2.apply(this, arguments) : -y2
4891
+ typeof x3 === "function" ? -x3.apply(this, arguments) : -x3,
4892
+ typeof y3 === "function" ? -y3.apply(this, arguments) : -y3
4829
4893
  ), e, translateExtent);
4830
4894
  }, p, event);
4831
4895
  };
@@ -4834,8 +4898,8 @@ function zoom_default2() {
4834
4898
  return k === transform2.k ? transform2 : new Transform(k, transform2.x, transform2.y);
4835
4899
  }
4836
4900
  function translate(transform2, p0, p1) {
4837
- var x2 = p0[0] - p1[0] * transform2.k, y2 = p0[1] - p1[1] * transform2.k;
4838
- return x2 === transform2.x && y2 === transform2.y ? transform2 : new Transform(transform2.k, x2, y2);
4901
+ var x3 = p0[0] - p1[0] * transform2.k, y3 = p0[1] - p1[1] * transform2.k;
4902
+ return x3 === transform2.x && y3 === transform2.y ? transform2 : new Transform(transform2.k, x3, y3);
4839
4903
  }
4840
4904
  function centroid(extent2) {
4841
4905
  return [(+extent2[0][0] + +extent2[1][0]) / 2, (+extent2[0][1] + +extent2[1][1]) / 2];
@@ -5869,9 +5933,9 @@ var SelectionManager = class {
5869
5933
  if (!this.canvasState) return;
5870
5934
  try {
5871
5935
  const rect = this.container.getBoundingClientRect();
5872
- const x2 = event.clientX - rect.left;
5873
- const y2 = event.clientY - rect.top;
5874
- const obj = this.getObjUnderPointer(x2, y2);
5936
+ const x3 = event.clientX - rect.left;
5937
+ const y3 = event.clientY - rect.top;
5938
+ const obj = this.getObjUnderPointer(x3, y3);
5875
5939
  if (obj) {
5876
5940
  if (obj.d.entityType === "Node") {
5877
5941
  this.selectNode(obj.d);
@@ -5891,19 +5955,19 @@ var SelectionManager = class {
5891
5955
  /**
5892
5956
  * Get object under pointer coordinates (using shadow canvas)
5893
5957
  */
5894
- getObjUnderPointer(x2, y2) {
5958
+ getObjUnderPointer(x3, y3) {
5895
5959
  if (!this.canvasState) return null;
5896
5960
  try {
5897
5961
  const { shadowCtx, colorTracker } = this.canvasState;
5898
5962
  const pxScale = window.devicePixelRatio;
5899
- const px = x2 > 0 && y2 > 0 ? shadowCtx.getImageData(x2 * pxScale, y2 * pxScale, 1, 1) : null;
5963
+ const px = x3 > 0 && y3 > 0 ? shadowCtx.getImageData(x3 * pxScale, y3 * pxScale, 1, 1) : null;
5900
5964
  if (px && px.data.length >= 3) {
5901
5965
  const rgb2 = [px.data[0] ?? 0, px.data[1] ?? 0, px.data[2] ?? 0];
5902
5966
  return colorTracker.lookup(rgb2);
5903
5967
  }
5904
5968
  return null;
5905
5969
  } catch (error) {
5906
- ErrorHandler.logError(error, { x: x2, y: y2 });
5970
+ ErrorHandler.logError(error, { x: x3, y: y3 });
5907
5971
  return null;
5908
5972
  }
5909
5973
  }
@@ -6121,8 +6185,8 @@ var NodesRenderer = class {
6121
6185
  static renderWithOptimizedStates(ctx, nodes, styleResolver, hoveredNodeId, selectedNodeId) {
6122
6186
  try {
6123
6187
  for (const node of nodes) {
6124
- const x2 = node.x;
6125
- const y2 = node.y;
6188
+ const x3 = node.x;
6189
+ const y3 = node.y;
6126
6190
  const isHovered = hoveredNodeId === node.id;
6127
6191
  const isSelected = selectedNodeId === node.id;
6128
6192
  const style = styleResolver.resolveNodeStyle({
@@ -6131,7 +6195,7 @@ var NodesRenderer = class {
6131
6195
  isSelected
6132
6196
  });
6133
6197
  ctx.beginPath();
6134
- ctx.arc(x2, y2, style.radius, 0, 2 * Math.PI);
6198
+ ctx.arc(x3, y3, style.radius, 0, 2 * Math.PI);
6135
6199
  ctx.fillStyle = style.fill;
6136
6200
  ctx.globalAlpha = style.opacity;
6137
6201
  ctx.fill();
@@ -6153,12 +6217,12 @@ var NodesRenderer = class {
6153
6217
  static render(ctx, nodes, nodeStyle, hoverNodeStyle, isNodeHovered) {
6154
6218
  try {
6155
6219
  for (const node of nodes) {
6156
- const x2 = node.x;
6157
- const y2 = node.y;
6220
+ const x3 = node.x;
6221
+ const y3 = node.y;
6158
6222
  const isHovered = isNodeHovered(node.id);
6159
6223
  const style = isHovered ? hoverNodeStyle : nodeStyle;
6160
6224
  ctx.beginPath();
6161
- ctx.arc(x2, y2, style.radius, 0, 2 * Math.PI);
6225
+ ctx.arc(x3, y3, style.radius, 0, 2 * Math.PI);
6162
6226
  ctx.fillStyle = style.fill;
6163
6227
  ctx.globalAlpha = style.opacity;
6164
6228
  ctx.fill();
@@ -6180,8 +6244,8 @@ var NodesRenderer = class {
6180
6244
  static renderWithStyleResolver(ctx, nodes, styleResolver, isNodeHovered, isNodeSelected, performanceMetrics) {
6181
6245
  try {
6182
6246
  for (const node of nodes) {
6183
- const x2 = node.x;
6184
- const y2 = node.y;
6247
+ const x3 = node.x;
6248
+ const y3 = node.y;
6185
6249
  const hoverStart = performance.now();
6186
6250
  const isHovered = isNodeHovered(node.id);
6187
6251
  const isSelected = isNodeSelected ? isNodeSelected(node.id) : false;
@@ -6199,7 +6263,7 @@ var NodesRenderer = class {
6199
6263
  }
6200
6264
  const canvasStart = performance.now();
6201
6265
  ctx.beginPath();
6202
- ctx.arc(x2, y2, style.radius, 0, 2 * Math.PI);
6266
+ ctx.arc(x3, y3, style.radius, 0, 2 * Math.PI);
6203
6267
  ctx.fillStyle = style.fill;
6204
6268
  ctx.globalAlpha = style.opacity;
6205
6269
  ctx.fill();
@@ -6225,14 +6289,14 @@ var NodesRenderer = class {
6225
6289
  try {
6226
6290
  for (const node of nodes) {
6227
6291
  if (!node.__indexColorRGB) continue;
6228
- const x2 = node.x;
6229
- const y2 = node.y;
6292
+ const x3 = node.x;
6293
+ const y3 = node.y;
6230
6294
  const [r, g, b] = node.__indexColorRGB;
6231
6295
  const rgbColor = `rgb(${r},${g},${b})`;
6232
6296
  const hitRadius = nodeRadius + 0.5 + 0.1;
6233
6297
  shadowCtx.fillStyle = rgbColor;
6234
6298
  shadowCtx.beginPath();
6235
- shadowCtx.arc(x2, y2, hitRadius, 0, 2 * Math.PI);
6299
+ shadowCtx.arc(x3, y3, hitRadius, 0, 2 * Math.PI);
6236
6300
  shadowCtx.fill();
6237
6301
  }
6238
6302
  } catch (error) {
@@ -6267,13 +6331,13 @@ var NodeLabelsRenderer = class {
6267
6331
  ctx.textBaseline = resolvedStyle.textBaseline;
6268
6332
  ctx.fillStyle = resolvedStyle.fillStyle;
6269
6333
  for (const node of nodes) {
6270
- const x2 = node.x;
6271
- const y2 = node.y;
6334
+ const x3 = node.x;
6335
+ const y3 = node.y;
6272
6336
  const fullLabel = node.label || node.id;
6273
6337
  const maxWidth = nodeRadius * 2 - 6;
6274
6338
  const truncatedLabel = this.truncateLabel(ctx, fullLabel, maxWidth);
6275
- const labelY = y2 + resolvedStyle.offsetY;
6276
- ctx.fillText(truncatedLabel, x2, labelY);
6339
+ const labelY = y3 + resolvedStyle.offsetY;
6340
+ ctx.fillText(truncatedLabel, x3, labelY);
6277
6341
  }
6278
6342
  } catch (error) {
6279
6343
  ErrorHandler.logError(error);
@@ -6456,15 +6520,15 @@ var LinkLabelsRenderer = class {
6456
6520
  /**
6457
6521
  * Render a single label at given coordinates
6458
6522
  */
6459
- static renderSingleLabel(ctx, text, x2, y2, style) {
6523
+ static renderSingleLabel(ctx, text, x3, y3, style) {
6460
6524
  ctx.font = style.font ?? "10px Arial";
6461
6525
  const metrics = ctx.measureText(text);
6462
6526
  const textWidth = metrics.width;
6463
6527
  const textHeight = (metrics.actualBoundingBoxAscent || 10) + (metrics.actualBoundingBoxDescent || 4);
6464
6528
  const rectWidth = textWidth + (style.paddingX ?? 8) * 2;
6465
6529
  const rectHeight = textHeight + (style.paddingY ?? 4) * 2;
6466
- const rectX = x2 - rectWidth / 2;
6467
- const rectY = y2 - rectHeight / 2;
6530
+ const rectX = x3 - rectWidth / 2;
6531
+ const rectY = y3 - rectHeight / 2;
6468
6532
  if (style.backgroundColor && style.backgroundColor !== "transparent") {
6469
6533
  ctx.fillStyle = style.backgroundColor;
6470
6534
  this.roundRect(ctx, rectX, rectY, rectWidth, rectHeight, style.borderRadius ?? 4);
@@ -6479,26 +6543,26 @@ var LinkLabelsRenderer = class {
6479
6543
  ctx.fillStyle = style.textColor ?? "#000000";
6480
6544
  ctx.textAlign = "center";
6481
6545
  ctx.textBaseline = "middle";
6482
- ctx.fillText(text, x2, y2);
6546
+ ctx.fillText(text, x3, y3);
6483
6547
  }
6484
6548
  /**
6485
6549
  * Helper to draw rounded rectangle
6486
6550
  */
6487
- static roundRect(ctx, x2, y2, width, height, radius) {
6551
+ static roundRect(ctx, x3, y3, width, height, radius) {
6488
6552
  if (radius === 0) {
6489
- ctx.rect(x2, y2, width, height);
6553
+ ctx.rect(x3, y3, width, height);
6490
6554
  return;
6491
6555
  }
6492
6556
  ctx.beginPath();
6493
- ctx.moveTo(x2 + radius, y2);
6494
- ctx.lineTo(x2 + width - radius, y2);
6495
- ctx.quadraticCurveTo(x2 + width, y2, x2 + width, y2 + radius);
6496
- ctx.lineTo(x2 + width, y2 + height - radius);
6497
- ctx.quadraticCurveTo(x2 + width, y2 + height, x2 + width - radius, y2 + height);
6498
- ctx.lineTo(x2 + radius, y2 + height);
6499
- ctx.quadraticCurveTo(x2, y2 + height, x2, y2 + height - radius);
6500
- ctx.lineTo(x2, y2 + radius);
6501
- ctx.quadraticCurveTo(x2, y2, x2 + radius, y2);
6557
+ ctx.moveTo(x3 + radius, y3);
6558
+ ctx.lineTo(x3 + width - radius, y3);
6559
+ ctx.quadraticCurveTo(x3 + width, y3, x3 + width, y3 + radius);
6560
+ ctx.lineTo(x3 + width, y3 + height - radius);
6561
+ ctx.quadraticCurveTo(x3 + width, y3 + height, x3 + width - radius, y3 + height);
6562
+ ctx.lineTo(x3 + radius, y3 + height);
6563
+ ctx.quadraticCurveTo(x3, y3 + height, x3, y3 + height - radius);
6564
+ ctx.lineTo(x3, y3 + radius);
6565
+ ctx.quadraticCurveTo(x3, y3, x3 + radius, y3);
6502
6566
  ctx.closePath();
6503
6567
  }
6504
6568
  /**
@@ -7139,13 +7203,13 @@ var Renderer = class {
7139
7203
  const arrowTipY = targetPoint.y + arrowLength * Math.sin(angle);
7140
7204
  const x1 = arrowTipX - arrowLength * Math.cos(angle - Math.PI / 6);
7141
7205
  const y1 = arrowTipY - arrowLength * Math.sin(angle - Math.PI / 6);
7142
- const x2 = arrowTipX - arrowLength * Math.cos(angle + Math.PI / 6);
7143
- const y2 = arrowTipY - arrowLength * Math.sin(angle + Math.PI / 6);
7206
+ const x22 = arrowTipX - arrowLength * Math.cos(angle + Math.PI / 6);
7207
+ const y22 = arrowTipY - arrowLength * Math.sin(angle + Math.PI / 6);
7144
7208
  ctx.fillStyle = arrowStyle.fill ?? "#000000";
7145
7209
  ctx.beginPath();
7146
7210
  ctx.moveTo(arrowTipX, arrowTipY);
7147
7211
  ctx.lineTo(x1, y1);
7148
- ctx.lineTo(x2, y2);
7212
+ ctx.lineTo(x22, y22);
7149
7213
  ctx.closePath();
7150
7214
  ctx.fill();
7151
7215
  } catch (error) {
@@ -8554,7 +8618,7 @@ var V2Graph = class {
8554
8618
  /**
8555
8619
  * Draw legend on export canvas
8556
8620
  */
8557
- drawLegendOnExportCanvas(ctx, legendElement, x2, y2) {
8621
+ drawLegendOnExportCanvas(ctx, legendElement, x3, y3) {
8558
8622
  const legendItems = legendElement.querySelectorAll(".pg-legend-item");
8559
8623
  const padding = 16;
8560
8624
  const itemHeight = 24;
@@ -8564,8 +8628,8 @@ var V2Graph = class {
8564
8628
  ctx.fillStyle = "#ffffff";
8565
8629
  ctx.strokeStyle = "#e2e8f0";
8566
8630
  ctx.lineWidth = 1;
8567
- ctx.fillRect(x2, y2, legendWidth, legendHeight);
8568
- ctx.strokeRect(x2, y2, legendWidth, legendHeight);
8631
+ ctx.fillRect(x3, y3, legendWidth, legendHeight);
8632
+ ctx.strokeRect(x3, y3, legendWidth, legendHeight);
8569
8633
  ctx.font = "12px Arial, sans-serif";
8570
8634
  ctx.textAlign = "left";
8571
8635
  ctx.textBaseline = "middle";
@@ -8573,8 +8637,8 @@ var V2Graph = class {
8573
8637
  const swatch = item.querySelector(".pg-legend-swatch");
8574
8638
  const label = item.querySelector(".pg-legend-label");
8575
8639
  if (swatch && label) {
8576
- const itemY = y2 + padding + index2 * (itemHeight + itemSpacing) + itemHeight / 2;
8577
- const swatchX = x2 + padding;
8640
+ const itemY = y3 + padding + index2 * (itemHeight + itemSpacing) + itemHeight / 2;
8641
+ const swatchX = x3 + padding;
8578
8642
  const textX = swatchX + 14 + 8;
8579
8643
  const swatchColor = swatch.style.backgroundColor || "#94a3b8";
8580
8644
  ctx.fillStyle = swatchColor;