@graphty/graphty-element 2.5.0 → 2.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/dist/ai.js +3 -3
  2. package/dist/catalog.js +6 -6
  3. package/dist/chunks/{AiManager-DNJCoeTO.js → AiManager-CrbvKdEK.js} +5 -5
  4. package/dist/chunks/{DataSource-xL3Yn0Pa.js → DataSource-qU-nLhXN.js} +3 -3
  5. package/dist/chunks/{GraphSession-PFm2tJ_j.js → GraphSession-DuAhRgCd.js} +863 -856
  6. package/dist/chunks/{GraphtyLogger-kbOx2zq3.js → GraphtyLogger-DOTwCiMR.js} +1 -1
  7. package/dist/chunks/{VoiceInputAdapter-CDNKQgUK.js → VoiceInputAdapter-D4NrRL_1.js} +1 -1
  8. package/dist/chunks/{XRPivotCameraController-JdlLBcD7.js → XRPivotCameraController-Uqa47vmo.js} +2 -2
  9. package/dist/chunks/{algorithms-B87OPYw4.js → algorithms-D-ab-Auu.js} +2 -2
  10. package/dist/chunks/{capability-check-B2oYf_30.js → capability-check-Vw3IcqiE.js} +1 -1
  11. package/dist/chunks/detect-B4Qrw976.js +88 -0
  12. package/dist/chunks/{format-detection-BG6CMwPO.js → format-detection-r2IfNFXO.js} +1 -1
  13. package/dist/chunks/{index-6GDfNfwJ.js → index-J9MgLio9.js} +104 -83
  14. package/dist/chunks/{optionsFromZod-DHLLiX_8.js → optionsFromZod-B9RncoTX.js} +183 -178
  15. package/dist/chunks/{paletteRegistry-jg9uS7wo.js → paletteRegistry-Kt-6CeoN.js} +19 -13
  16. package/dist/chunks/{pluginRegistry-MaTIDh6l.js → pluginRegistry-Bs8bEkz9.js} +3 -2
  17. package/dist/chunks/{registry-DQeq4B2K.js → registry-BdGvyZou.js} +1 -1
  18. package/dist/chunks/{scales-BXHmwPXC.js → scales-CJCRwi2J.js} +4 -4
  19. package/dist/custom-elements.json +1 -1
  20. package/dist/extend.js +7 -7
  21. package/dist/graphty-catalog.json +4 -3
  22. package/dist/graphty.bundle.js +15837 -15793
  23. package/dist/graphty.js +6 -6
  24. package/dist/index.d.ts +1 -1
  25. package/dist/logging.js +2 -2
  26. package/dist/session.js +5 -5
  27. package/dist/src/Graph.d.ts +3 -3
  28. package/dist/src/catalog/formats.d.ts +5 -1
  29. package/dist/src/catalog/types.d.ts +13 -2
  30. package/dist/src/errors/codes.d.ts +7 -0
  31. package/dist/src/events.d.ts +35 -2
  32. package/dist/src/managers/EventManager.d.ts +4 -0
  33. package/dist/src/managers/LayoutManager.d.ts +7 -0
  34. package/dist/src/session/results/types.d.ts +26 -0
  35. package/dist/src/session/styles/StylesApi.d.ts +6 -5
  36. package/dist/src/session/styles/explain.d.ts +3 -3
  37. package/dist/src/session/types.d.ts +12 -1
  38. package/dist/webgpu.js +2 -2
  39. package/package.json +6 -6
  40. package/dist/chunks/detect-tuYQLJbT.js +0 -88
@@ -1,4 +1,4 @@
1
- import { c as G, G as c } from "./pluginRegistry-MaTIDh6l.js";
1
+ import { c as G, G as c } from "./pluginRegistry-Bs8bEkz9.js";
2
2
  import { c as $ } from "./types-C_c53VgR.js";
3
3
  const E = G({
4
4
  kind: "sink",
@@ -1,4 +1,4 @@
1
- import { i as ke, j as up } from "./algorithms-B87OPYw4.js";
1
+ import { i as ke, j as up } from "./algorithms-D-ab-Auu.js";
2
2
  var ee = { exports: {} };
3
3
  var fp = ee.exports, oo;
4
4
  function op() {
@@ -1,7 +1,7 @@
1
1
  import { Vector3 as f, Quaternion as E, Ray as N, WebXRState as D } from "@babylonjs/core";
2
- import { P as I } from "./index-6GDfNfwJ.js";
2
+ import { P as I } from "./index-J9MgLio9.js";
3
3
  import "@babylonjs/core/Culling/ray";
4
- import { G as y } from "./GraphtyLogger-kbOx2zq3.js";
4
+ import { G as y } from "./GraphtyLogger-DOTwCiMR.js";
5
5
  function x(c, t = 0.15) {
6
6
  if (Math.abs(c) < t)
7
7
  return 0;
@@ -1,9 +1,9 @@
1
1
  import { c as rt } from "./common-DWNKjpH_.js";
2
2
  import { E as ct, a as lt, N as dt } from "./NodeStyle-CtmA7dXi.js";
3
- import { F as ht, k as ut, a as z, h as S, P as tt, f as M, A as v, Y as pt, G as mt, H as gt, n as $, L as Ze, s as je, e as ee, m as re, i as Be, o as Ae } from "./optionsFromZod-DHLLiX_8.js";
3
+ import { F as ht, k as ut, a as z, h as S, P as tt, f as M, A as v, Y as pt, G as mt, H as gt, n as $, L as Ze, s as je, e as ee, m as re, i as Be, o as Ae } from "./optionsFromZod-B9RncoTX.js";
4
4
  import { z as c } from "zod/v4";
5
5
  import { bellmanFord as ft, betweennessCentrality as yt, breadthFirstSearch as bt, bipartitePartition as wt, maximumBipartiteMatching as vt, closenessCentrality as Nt, depthFirstSearch as kt, eigenvectorCentrality as St, ConvergenceError as Ot, floydWarshall as xt, girvanNewman as It, hits as Mt, katzCentrality as Ct, kCoreDecomposition as zt, labelPropagation as Tt, leiden as Et, commonNeighborsPrediction as Dt, adamicAdarPrediction as Pt, louvain as Rt, Graph as at, fordFulkerson as Ft, kargerMinCut as $t, stoerWagner as Gt, minSTCut as Ht, pageRank as Wt, primMST as Kt, stronglyConnectedComponents as Lt } from "@graphty/algorithms";
6
- import { G as nt } from "./pluginRegistry-MaTIDh6l.js";
6
+ import { G as nt } from "./pluginRegistry-Bs8bEkz9.js";
7
7
  import { INVALID_INDEX as F } from "@graphty/graph-format";
8
8
  var Fa = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
9
9
  function $a(o) {
@@ -1,4 +1,4 @@
1
- import { c as i, B as m } from "./index-6GDfNfwJ.js";
1
+ import { c as i, B as m } from "./index-J9MgLio9.js";
2
2
  async function p(n, e) {
3
3
  let s;
4
4
  try {
@@ -0,0 +1,88 @@
1
+ import { U as O, F as m, h } from "./paletteRegistry-Kt-6CeoN.js";
2
+ import { G as p } from "./pluginRegistry-Bs8bEkz9.js";
3
+ function l(e) {
4
+ return e.startsWith("<");
5
+ }
6
+ const u = [
7
+ { id: "graphml", detect: (e) => e.includes('xmlns="http://graphml.graphdrawing.org') },
8
+ { id: "gexf", detect: (e) => e.includes('xmlns="http://gexf.net') },
9
+ { id: "json", detect: (e) => e.startsWith("{") || e.startsWith("[") },
10
+ { id: "gml", detect: (e) => !l(e) && /graph\s*\[/i.test(e) },
11
+ { id: "pajek", detect: (e) => /^\*vertices/i.test(e) },
12
+ { id: "dot", detect: (e) => /^\s*(strict\s+)?(di)?graph\s+/i.test(e) },
13
+ { id: "csv", detect: (e) => !l(e) && /^[\w-]+[ \t]*[,\t;|][ \t]*[\w-]+/m.test(e) }
14
+ ];
15
+ function d(e, r) {
16
+ try {
17
+ return e(r);
18
+ } catch {
19
+ return !1;
20
+ }
21
+ }
22
+ function v(e) {
23
+ return /\.[^.]+$/.exec(e.toLowerCase())?.[0] ?? null;
24
+ }
25
+ function w(e) {
26
+ const r = e.sample?.trim() ?? "", s = h(), o = e.filename === void 0 ? null : v(e.filename);
27
+ if (o !== null) {
28
+ const t = [
29
+ ...m.filter((n) => n.extensions.includes(o)).map(
30
+ (n) => n.id
31
+ ),
32
+ ...s.filter((n) => n.descriptor.extensions.includes(o)).map((n) => n.descriptor.id)
33
+ ];
34
+ if (t.length > 1 && r !== "") {
35
+ const n = new Map([
36
+ ...u.map((i) => [i.id, i.detect]),
37
+ ...s.filter((i) => i.detect !== void 0).map((i) => [i.descriptor.id, i.detect])
38
+ ]), c = t.filter((i) => {
39
+ const f = n.get(i);
40
+ return f !== void 0 && d(f, r);
41
+ });
42
+ if (c.length > 0)
43
+ return Object.freeze([...c, ...t.filter((i) => !c.includes(i))]);
44
+ }
45
+ if (t.length > 0)
46
+ return Object.freeze(t);
47
+ }
48
+ if (r === "")
49
+ return Object.freeze([]);
50
+ const a = u.filter((t) => d(t.detect, r)).map(
51
+ (t) => t.id
52
+ );
53
+ for (const t of s) {
54
+ const { detect: n } = t;
55
+ n !== void 0 && d(n, r) && !a.includes(t.descriptor.id) && a.push(t.descriptor.id);
56
+ }
57
+ return Object.freeze(a);
58
+ }
59
+ function b(e) {
60
+ return w(e)[0] ?? null;
61
+ }
62
+ function g() {
63
+ return [...m.map((e) => e.id), ...h().map((e) => e.descriptor.id)];
64
+ }
65
+ function T(e) {
66
+ const r = g(), s = O.find((a) => a.id === e), o = s === void 0 ? `no format is named "${e}".` : `the format "${e}" cannot be read: ${s.reason}`;
67
+ return new p({
68
+ code: "E_UNKNOWN_FORMAT",
69
+ message: `${o} The formats this element can read are: ${r.join(", ")}. A format of your own is registered with \`DataSource.register\`.`,
70
+ source: "data",
71
+ details: { format: e, available: [...r] }
72
+ });
73
+ }
74
+ function N(e, r) {
75
+ const s = g();
76
+ return new p({
77
+ code: "E_UNKNOWN_FORMAT",
78
+ message: `nothing recognised the format of "${e}". The formats this element can read are: ${s.join(", ")}. Name one explicitly: ${r}`,
79
+ source: "data",
80
+ details: { source: e, available: [...s] }
81
+ });
82
+ }
83
+ export {
84
+ w as a,
85
+ N as b,
86
+ b as d,
87
+ T as u
88
+ };
@@ -1,4 +1,4 @@
1
- import { d as r } from "./detect-tuYQLJbT.js";
1
+ import { d as r } from "./detect-B4Qrw976.js";
2
2
  function m(t, e) {
3
3
  return r({ filename: t, sample: e });
4
4
  }
@@ -2,27 +2,27 @@ var Di = (l) => {
2
2
  throw TypeError(l);
3
3
  };
4
4
  var Wt = (l, e, t) => e.has(l) || Di("Cannot " + t);
5
- var g = (l, e, t) => (Wt(l, e, "read from private field"), t ? t.call(l) : e.get(l)), E = (l, e, t) => e.has(l) ? Di("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(l) : e.set(l, t), M = (l, e, t, i) => (Wt(l, e, "write to private field"), i ? i.call(l, t) : e.set(l, t), t), le = (l, e, t) => (Wt(l, e, "access private method"), t);
5
+ var g = (l, e, t) => (Wt(l, e, "read from private field"), t ? t.call(l) : e.get(l)), x = (l, e, t) => e.has(l) ? Di("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(l) : e.set(l, t), M = (l, e, t, i) => (Wt(l, e, "write to private field"), i ? i.call(l, t) : e.set(l, t), t), le = (l, e, t) => (Wt(l, e, "access private method"), t);
6
6
  import { LitElement as Ks, css as er } from "lit";
7
7
  import { property as k } from "lit/decorators.js";
8
- import { l as Q, _ as re, V as tr } from "./VoiceInputAdapter-CDNKQgUK.js";
9
- import { l as ir, m as vs, G as sr, D as Le, A as rr, n as ar, o as zi, p as nr } from "./GraphSession-PFm2tJ_j.js";
8
+ import { l as Q, _ as re, V as tr } from "./VoiceInputAdapter-D4NrRL_1.js";
9
+ import { l as ir, m as vs, G as sr, D as Le, A as rr, n as ar, o as zi, p as nr } from "./GraphSession-DuAhRgCd.js";
10
10
  import Ct from "papaparse";
11
- import { D as q } from "./DataSource-xL3Yn0Pa.js";
11
+ import { D as q } from "./DataSource-qU-nLhXN.js";
12
12
  import { XMLParser as Ss } from "fast-xml-parser";
13
13
  import * as or from "jmespath";
14
14
  import mt from "jmespath";
15
15
  import { z as C } from "zod/v4";
16
- import { D as cr, N as lr, f as hr, C as dr, g as ur, R as gr, h as ii, i as Cs, j as pr, K as mr, F as Is, A as fr, m as yr, B as br, n as wr, M as vr, o as Sr, G as Cr, q as Ir, r as de, l as Mr, L as Er } from "./scales-BXHmwPXC.js";
17
- import { L as V } from "./paletteRegistry-jg9uS7wo.js";
18
- import { A as F, F as Ms, k as xr, B as si, a0 as Tr, H as Or, z as Rr, q as Ar, x as Pr } from "./optionsFromZod-DHLLiX_8.js";
19
- import { D as Lr, n as Nr, P as Fr, L as Dr, o as zr, p as kr, E as Wr, H as Gr, K as Ur, G as Zr, q as Vr, r as _r, s as Br, F as jr, u as Jr, v as Hr, w as Xr, S as $r, x as Yr, y as Qr, z as qr, M as Kr, A as ea, I as ta, J as ia, C as Ci, m as Ii, t as Es, b as xs, O as sa, d as ki, c as ra } from "./algorithms-B87OPYw4.js";
16
+ import { D as cr, N as lr, f as hr, C as dr, g as ur, R as gr, h as ii, i as Cs, j as pr, K as mr, F as Is, A as fr, m as yr, B as br, n as wr, M as vr, o as Sr, G as Cr, q as Ir, r as de, l as Mr, L as Er } from "./scales-CJCRwi2J.js";
17
+ import { L as V } from "./paletteRegistry-Kt-6CeoN.js";
18
+ import { A as F, F as Ms, k as xr, B as si, a2 as Tr, H as Or, z as Rr, q as Ar, x as Pr } from "./optionsFromZod-B9RncoTX.js";
19
+ import { D as Lr, n as Nr, P as Fr, L as Dr, o as zr, p as kr, E as Wr, H as Gr, K as Ur, G as Zr, q as Vr, r as _r, s as Br, F as jr, u as Jr, v as Hr, w as Xr, S as $r, x as Yr, y as Qr, z as qr, M as Kr, A as ea, I as ta, J as ia, C as Ci, m as Ii, t as Es, b as xs, O as sa, d as ki, c as ra } from "./algorithms-D-ab-Auu.js";
20
20
  import "@babylonjs/core/Culling/ray";
21
21
  import "@babylonjs/core/Animations/animatable";
22
22
  import { TransformNode as Mi, Vector3 as w, Quaternion as oe, Axis as Gt, Space as Ut, Color4 as xe, UniversalCamera as aa, Scalar as na, Camera as ft, FreeCamera as oa, Vector2 as ca, Effect as Oe, Mesh as j, StandardMaterial as Te, Color3 as N, MeshBuilder as K, VertexData as Z, ShaderMaterial as yt, BoundingInfo as la, InstancedMesh as Ei, GreasedLineMeshColorMode as ha, RawTexture as Wi, Engine as Tt, DynamicTexture as Ts, Texture as da, AbstractMesh as ua, Ray as ga, Matrix as De, Viewport as pa, HighlightLayer as ma, GlowLayer as fa, MaterialPluginBase as ya, ShaderLanguage as It, ActionManager as Gi, ExecuteCodeAction as ba, PointerEventTypes as ee, Observable as Zt, KeyboardEventTypes as Ui, Logger as Zi, WebGPUEngine as Vi, Scene as wa, HemisphericLight as va, PerfCounter as ae, SceneInstrumentation as Sa, EngineInstrumentation as Ca, CreateScreenshotAsync as Ia, DefaultRenderingPipeline as Ma, FxaaPostProcess as Ea, PhotoDome as xa, CubicEase as Vt, EasingFunction as _t, Animation as A } from "@babylonjs/core";
23
- import { b as Os, G as fe } from "./GraphtyLogger-kbOx2zq3.js";
24
- import { G as Y, S as Ta, i as ri } from "./pluginRegistry-MaTIDh6l.js";
25
- import { u as Oa, b as _i } from "./detect-tuYQLJbT.js";
23
+ import { b as Os, G as fe } from "./GraphtyLogger-DOTwCiMR.js";
24
+ import { G as Y, S as Ta, i as ri } from "./pluginRegistry-Bs8bEkz9.js";
25
+ import { u as Oa, b as _i } from "./detect-B4Qrw976.js";
26
26
  import { z as D } from "zod";
27
27
  import { INVALID_INDEX as $ } from "@graphty/graph-format";
28
28
  import { b as Rs, c as As, e as Ra, d as Aa, R as Pa, g as te, P as U, S as Ne } from "./NodeStyle-CtmA7dXi.js";
@@ -2480,10 +2480,10 @@ class Fs {
2480
2480
  this.camera.fovMode === ft.FOVMODE_VERTICAL_FIXED ? c = this.camera.fov : this.camera.fovMode === ft.FOVMODE_HORIZONTAL_FIXED && this.camera.fov && (c = 2 * Math.atan(Math.tan(this.camera.fov / 2) / o));
2481
2481
  const h = c / 2, d = Math.atan(Math.tan(h) * o), u = s.x / 2, p = s.y / 2, m = s.z / 2;
2482
2482
  let y = 0;
2483
- for (const x of [-1, 1])
2483
+ for (const E of [-1, 1])
2484
2484
  for (const I of [-1, 1])
2485
2485
  for (const O of [-1, 1]) {
2486
- const T = x * u, G = I * p, B = O * m, ce = B + Math.abs(T) / Math.tan(d), ye = B + Math.abs(G) / Math.tan(h);
2486
+ const T = E * u, G = I * p, B = O * m, ce = B + Math.abs(T) / Math.tan(d), ye = B + Math.abs(G) / Math.tan(h);
2487
2487
  y = Math.max(y, ce, ye);
2488
2488
  }
2489
2489
  const v = y * (1 + 5 / 100);
@@ -3377,9 +3377,9 @@ void main(void) {
3377
3377
  for (let h = 0; h < c; h++) {
3378
3378
  const d = h * r + t;
3379
3379
  let u = 0;
3380
- for (let x = 1; x < a.length; x++)
3381
- if (d <= a[x]) {
3382
- u = x - 1;
3380
+ for (let E = 1; E < a.length; E++)
3381
+ if (d <= a[E]) {
3382
+ u = E - 1;
3383
3383
  break;
3384
3384
  }
3385
3385
  const p = a[u], y = a[u + 1] - p, b = (d - p) / y, v = w.Lerp(e[u], e[u + 1], b);
@@ -3508,7 +3508,7 @@ void main(void) {
3508
3508
  u = m.normalize();
3509
3509
  const y = Math.max(10, Math.ceil(h * 10));
3510
3510
  for (let b = 0; b <= y; b++) {
3511
- const v = b / y, x = n.add(c.scale(v)), I = (a + v) / r, O = Math.sin(I * i * Math.PI * 2) * t, T = x.add(u.scale(O));
3511
+ const v = b / y, E = n.add(c.scale(v)), I = (a + v) / r, O = Math.sin(I * i * Math.PI * 2) * t, T = E.add(u.scale(O));
3512
3512
  s.push(T);
3513
3513
  }
3514
3514
  }
@@ -3538,7 +3538,7 @@ void main(void) {
3538
3538
  d = p.normalize();
3539
3539
  const m = Math.max(4, Math.ceil(i * 2));
3540
3540
  for (let y = 0; y <= m; y++) {
3541
- const b = y / m, v = n.add(c.scale(b)), x = y % 2 === 0 ? t : -t, I = v.add(d.scale(x));
3541
+ const b = y / m, v = n.add(c.scale(b)), E = y % 2 === 0 ? t : -t, I = v.add(d.scale(E));
3542
3542
  s.push(I);
3543
3543
  }
3544
3544
  }
@@ -4977,8 +4977,8 @@ class mi {
4977
4977
  pi.apply2DMaterial(y, i, s, r);
4978
4978
  const b = y.getVerticesData("position"), v = y.getIndices();
4979
4979
  if (b && v && !y.getVerticesData("normal")) {
4980
- const x = [];
4981
- Z.ComputeNormals(b, v, x), y.setVerticesData("normal", x);
4980
+ const E = [];
4981
+ Z.ComputeNormals(b, v, E), y.setVerticesData("normal", E);
4982
4982
  }
4983
4983
  } else
4984
4984
  z.applyShader(y, { size: 1, color: i, opacity: s }, r);
@@ -5232,11 +5232,11 @@ class mi {
5232
5232
  for (let u = 0; u <= h; u++) {
5233
5233
  const p = u * 0.31875;
5234
5234
  if (p > e) {
5235
- const b = (u - 1) * 0.31875, v = (u - 1) % 4, x = u % 4;
5235
+ const b = (u - 1) * 0.31875, v = (u - 1) % 4, E = u % 4;
5236
5236
  let I = 0;
5237
5237
  v === 1 ? I = 0.31875 : v === 3 && (I = -0.31875);
5238
5238
  let O = 0;
5239
- x === 1 ? O = 0.31875 : x === 3 && (O = -0.31875);
5239
+ E === 1 ? O = 0.31875 : E === 3 && (O = -0.31875);
5240
5240
  const T = (e - b) / (p - b), G = I + T * (O - I);
5241
5241
  c.push([e, 0, G]);
5242
5242
  break;
@@ -7588,9 +7588,9 @@ class At {
7588
7588
  };
7589
7589
  const m = p.subtract(u).normalize();
7590
7590
  this.context.getStatsManager().startMeasurement("Edge.transformArrowCap.styleAndGeometry");
7591
- const y = this.currentStyle, b = y.arrowHead?.size ?? 1, v = _.calculateArrowLength() * b, x = this.dstNode.mesh.getBoundingInfo().boundingSphere.radiusWorld, I = this.srcNode.mesh.getBoundingInfo().boundingSphere.radiusWorld;
7591
+ const y = this.currentStyle, b = y.arrowHead?.size ?? 1, v = _.calculateArrowLength() * b, E = this.dstNode.mesh.getBoundingInfo().boundingSphere.radiusWorld, I = this.srcNode.mesh.getBoundingInfo().boundingSphere.radiusWorld;
7592
7592
  this.context.getStatsManager().endMeasurement("Edge.transformArrowCap.styleAndGeometry"), this.context.getStatsManager().startMeasurement("Edge.transformArrowCap.vectorMath");
7593
- const O = u.add(m.scale(I)), T = p.subtract(m.scale(x)), G = y.arrowHead?.type, B = _.getArrowGeometry(G ?? "normal");
7593
+ const O = u.add(m.scale(I)), T = p.subtract(m.scale(E)), G = y.arrowHead?.type, B = _.getArrowGeometry(G ?? "normal");
7594
7594
  this.arrowMesh.metadata?.is2D && B.scaleFactor !== void 0 && (B.scaleFactor = 1), this.arrowMesh.setEnabled(!0);
7595
7595
  const ce = _.calculateArrowPosition(
7596
7596
  T,
@@ -7656,14 +7656,14 @@ class At {
7656
7656
  this.arrowTailMesh.setEnabled(!0);
7657
7657
  const m = t.subtract(e).normalize(), y = u.arrowTail?.size ?? 1, b = _.calculateArrowLength() * y, v = _.getArrowGeometry(p);
7658
7658
  this.arrowTailMesh.metadata?.is2D && v.scaleFactor !== void 0 && (v.scaleFactor = 1);
7659
- const x = _.calculateArrowPosition(
7659
+ const E = _.calculateArrowPosition(
7660
7660
  e,
7661
7661
  m.scale(-1),
7662
7662
  // Reverse direction for tail
7663
7663
  b,
7664
7664
  v
7665
7665
  ), I = c.scale(-1);
7666
- if (this.arrowTailMesh.position = x, this.arrowTailMesh.metadata?.is2D) {
7666
+ if (this.arrowTailMesh.position = E, this.arrowTailMesh.metadata?.is2D) {
7667
7667
  const O = Math.atan2(I.y, I.x), T = oe.RotationAxis(w.Right(), Math.PI / 2), G = oe.RotationAxis(w.Forward(), O);
7668
7668
  this.arrowTailMesh.rotationQuaternion = G.multiply(T);
7669
7669
  } else if ([
@@ -8445,9 +8445,9 @@ class Lt {
8445
8445
  const p = d.node.mesh, m = w.TransformCoordinatesToRef(u.position, p.computeWorldMatrix(), this.centre), y = m.x * a[2] + m.y * a[6] + m.z * a[10] + a[14];
8446
8446
  if (y < e.minZ || e.maxZ > 0 && y > e.maxZ)
8447
8447
  continue;
8448
- const b = u.getBoundingInfo().boundingBox.extendSize, v = p.absoluteScaling, x = this.corner.copyFrom(m);
8449
- this.right.scaleAndAddToRef(b.x * Math.abs(v.x * u.scaling.x), x), this.up.scaleAndAddToRef(b.y * Math.abs(v.y * u.scaling.y), x);
8450
- const I = w.TransformCoordinatesToRef(m, this.worldToPixels, this.centreOnScreen), O = w.TransformCoordinatesToRef(x, this.worldToPixels, this.cornerOnScreen), T = Math.abs(O.x - I.x), G = Math.abs(O.y - I.y), { text: B } = d;
8448
+ const b = u.getBoundingInfo().boundingBox.extendSize, v = p.absoluteScaling, E = this.corner.copyFrom(m);
8449
+ this.right.scaleAndAddToRef(b.x * Math.abs(v.x * u.scaling.x), E), this.up.scaleAndAddToRef(b.y * Math.abs(v.y * u.scaling.y), E);
8450
+ const I = w.TransformCoordinatesToRef(m, this.worldToPixels, this.centreOnScreen), O = w.TransformCoordinatesToRef(E, this.worldToPixels, this.cornerOnScreen), T = Math.abs(O.x - I.x), G = Math.abs(O.y - I.y), { text: B } = d;
8451
8451
  d.left = I.x + (2 * B.left - 1) * T, d.right = I.x + (2 * B.right - 1) * T, d.top = I.y + (2 * B.top - 1) * G, d.bottom = I.y + (2 * B.bottom - 1) * G, !(d.right < i.x || d.left > i.x + i.width || d.bottom < i.y || d.top > i.y + i.height) && (o += d.right - d.left, c += d.bottom - d.top, n.push(d));
8452
8452
  }
8453
8453
  if (n.length === 0)
@@ -10697,8 +10697,8 @@ class No {
10697
10697
  continue;
10698
10698
  }
10699
10699
  Mt(m) && this.edgesByRecordId.set(m, b);
10700
- const x = this.nodeCache.get(d), I = this.nodeCache.get(u);
10701
- if (!x || !I) {
10700
+ const E = this.nodeCache.get(d), I = this.nodeCache.get(u);
10701
+ if (!E || !I) {
10702
10702
  const G = {
10703
10703
  record: h,
10704
10704
  sourceId: d,
@@ -11017,9 +11017,9 @@ class No {
11017
11017
  const b = t.size;
11018
11018
  try {
11019
11019
  let v = !1;
11020
- const x = [], I = [];
11020
+ const E = [], I = [];
11021
11021
  for await (const X of y.getData())
11022
- r ? (x.push(...X.nodes), I.push(...X.edges)) : (n(), v || (v = this.applyDeclaredDirection(e, y.declaredDirection)), this.addNodes(X.nodes), this.addEdges(X.edges, m)), c += X.nodes.length, h += X.edges.length, d++, this.graphContext && this.eventManager.emitDataLoadingProgress(
11022
+ r ? (E.push(...X.nodes), I.push(...X.edges)) : (n(), v || (v = this.applyDeclaredDirection(e, y.declaredDirection)), this.addNodes(X.nodes), this.addEdges(X.edges, m)), c += X.nodes.length, h += X.edges.length, d++, this.graphContext && this.eventManager.emitDataLoadingProgress(
11023
11023
  e,
11024
11024
  d * 64 * 1024,
11025
11025
  // Approximate bytes (chunk size)
@@ -11060,7 +11060,7 @@ class No {
11060
11060
  r && (this.loadTally = u, this.loadEndpoints = null, this.refuseAboveCeiling(
11061
11061
  "nodes",
11062
11062
  0,
11063
- new Set(x.map((X) => this.nodeIdOf(X))).size,
11063
+ new Set(E.map((X) => this.nodeIdOf(X))).size,
11064
11064
  Le.renderCeiling
11065
11065
  ), I.length > 0 && this.refuseAboveCeiling(
11066
11066
  "edges",
@@ -11072,7 +11072,7 @@ class No {
11072
11072
  !0
11073
11073
  ),
11074
11074
  Le.edgesDrawn
11075
- ), this.clear(), this.applyDeclaredDirection(e, y.declaredDirection), this.addNodes(x), this.addEdges(I, m));
11075
+ ), this.clear(), this.applyDeclaredDirection(e, y.declaredDirection), this.addNodes(E), this.addEdges(I, m));
11076
11076
  const G = Date.now() - o, B = this.sealLoad(e, u), ce = B.counts.edges, ye = B.counts.nodes;
11077
11077
  this.logger.info("Data source loading complete", {
11078
11078
  nodeRecords: c,
@@ -11198,7 +11198,7 @@ class No {
11198
11198
  * Clear all data
11199
11199
  */
11200
11200
  clear() {
11201
- this.disposeNodesAndEdges(), this.nodes.clear(), this.edges.clear(), this.edgeVersion++, this.nodeCache.clear(), this.edgeCache.clear(), this.eventManager.emitSnapshotDropped(), this.resetStore(), this.importReport = null, this.graphResults = void 0, this.meshCache.clear();
11201
+ this.disposeNodesAndEdges(), this.nodes.clear(), this.edges.clear(), this.edgeVersion++, this.nodeCache.clear(), this.edgeCache.clear(), this.eventManager.emitSnapshotDropped(), this.resetStore(), this.importReport = null, this.graphResults = void 0, this.meshCache.clear(), this.eventManager.emitDataCleared();
11202
11202
  }
11203
11203
  /**
11204
11204
  * Start label animations for all nodes
@@ -11380,6 +11380,13 @@ class Fo {
11380
11380
  const e = { type: "snapshot-dropped" };
11381
11381
  this.graphObservable.notifyObservers(e);
11382
11382
  }
11383
+ /**
11384
+ * Emits the public announcement that the graph's data was cleared.
11385
+ */
11386
+ emitDataCleared() {
11387
+ const e = { type: "data-cleared" };
11388
+ this.graphObservable.notifyObservers(e);
11389
+ }
11383
11390
  /**
11384
11391
  * Emits a layout initialized event when a layout is ready
11385
11392
  * @param layoutType - Type of layout that was initialized
@@ -11551,6 +11558,7 @@ class Fo {
11551
11558
  case "error":
11552
11559
  case "data-loaded":
11553
11560
  case "data-added":
11561
+ case "data-cleared":
11554
11562
  case "snapshot-replaced":
11555
11563
  case "layout-initialized":
11556
11564
  case "skybox-loaded":
@@ -12537,7 +12545,7 @@ class Bo {
12537
12545
  constructor(e, t, i) {
12538
12546
  this.eventManager = e, this.dataManager = t, this.styles = i, this._running = !1, this._paused = !1, this.preStepsOwed = !1, this.logger = fe.getLogger(["graphty", "layout"]), this.graphContext = null, this.acceleration = null, this.unsubscribeAcceleration = null, this.unsubscribeSnapshot = null;
12539
12547
  const s = this.eventManager.onGraphEvent.add((r) => {
12540
- r.type === "snapshot-replaced" && this.onSnapshotReplaced(r);
12548
+ r.type === "snapshot-replaced" ? this.onSnapshotReplaced(r) : r.type === "data-cleared" && this.reset();
12541
12549
  });
12542
12550
  this.unsubscribeSnapshot = () => {
12543
12551
  this.eventManager.onGraphEvent.remove(s);
@@ -12621,6 +12629,17 @@ class Bo {
12621
12629
  this.running = !1, this.reportSimulationFailure(i);
12622
12630
  }
12623
12631
  }
12632
+ /**
12633
+ * Forget the cleared graph: stop the engine and build a fresh one of the same type with the
12634
+ * consumer's own options, so the next load lays out from scratch instead of inheriting the old
12635
+ * engine's bodies and its settled state. A failure is already reported on the error channel
12636
+ * by `_setLayoutInternal`, which also leaves the old engine in place.
12637
+ */
12638
+ reset() {
12639
+ const e = this.layoutEngine;
12640
+ e && (this.running = !1, this._setLayoutInternal(e.type, this.currentLayoutOptions ?? {}).catch(() => {
12641
+ }));
12642
+ }
12624
12643
  /**
12625
12644
  * Report a failure that happened to a layout already running, on the element's error channel.
12626
12645
  * @param error - Whatever was thrown.
@@ -12705,7 +12724,9 @@ class Bo {
12705
12724
  this.currentLayoutOptions = r;
12706
12725
  try {
12707
12726
  const y = [...this.dataManager.nodes.values()], b = [...this.dataManager.edges.values()];
12708
- d.addNodes(y), d.addEdges(b), this.layoutEngine = d, this.engineDimension = o, await d.init(), this.replayPins(d, y), this.dataManager.setLayoutEngine(d), y.length === 0 ? this.preStepsOwed = !0 : await this.spendPreSteps(d), d.publishPositions(), this.running = !0, this.logger.debug("Layout initialized", {
12727
+ d.addNodes(y), d.addEdges(b), this.layoutEngine = d, this.engineDimension = o, await d.init();
12728
+ const v = new Set(y), E = new Set(b);
12729
+ d.addNodes([...this.dataManager.nodes.values()].filter((I) => !v.has(I))), d.addEdges([...this.dataManager.edges.values()].filter((I) => !E.has(I))), this.replayPins(d, y), this.dataManager.setLayoutEngine(d), y.length === 0 ? this.preStepsOwed = !0 : await this.spendPreSteps(d), d.publishPositions(), this.running = !0, this.logger.debug("Layout initialized", {
12709
12730
  type: i,
12710
12731
  nodeCount: y.length,
12711
12732
  edgeCount: b.length
@@ -15765,11 +15786,11 @@ class hc {
15765
15786
  try {
15766
15787
  const m = n.destination ?? { blob: !0 };
15767
15788
  let y = "success", b;
15768
- const v = u?.supersampledWidth ?? o.width, x = u?.supersampledHeight ?? o.height, I = this.captureBlob(
15789
+ const v = u?.supersampledWidth ?? o.width, E = u?.supersampledHeight ?? o.height, I = this.captureBlob(
15769
15790
  c,
15770
15791
  h,
15771
15792
  v,
15772
- x,
15793
+ E,
15773
15794
  u?.supersampleFactor,
15774
15795
  o.width,
15775
15796
  o.height
@@ -16905,7 +16926,7 @@ class bs {
16905
16926
  * @returns Promise that resolves to the load's id when data is loaded
16906
16927
  */
16907
16928
  async loadFromFile(e, t) {
16908
- const i = this.reserveLoad(t?.replace), { detectFormat: s } = await import("./format-detection-BG6CMwPO.js");
16929
+ const i = this.reserveLoad(t?.replace), { detectFormat: s } = await import("./format-detection-r2IfNFXO.js");
16909
16930
  let r = t?.format;
16910
16931
  if (!r) {
16911
16932
  const c = await e.slice(0, 2048).text();
@@ -16956,7 +16977,7 @@ class bs {
16956
16977
  * ```
16957
16978
  */
16958
16979
  async loadFromUrl(e, t) {
16959
- const i = this.reserveLoad(t?.replace), { detectFormat: s } = await import("./format-detection-BG6CMwPO.js");
16980
+ const i = this.reserveLoad(t?.replace), { detectFormat: s } = await import("./format-detection-r2IfNFXO.js");
16960
16981
  let r = t?.format, a;
16961
16982
  if (!r) {
16962
16983
  const d = s(e, "");
@@ -18576,7 +18597,7 @@ class bs {
18576
18597
  * ```
18577
18598
  */
18578
18599
  async canCaptureScreenshot(e) {
18579
- const { canCaptureScreenshot: t } = await import("./capability-check-B2oYf_30.js");
18600
+ const { canCaptureScreenshot: t } = await import("./capability-check-Vw3IcqiE.js");
18580
18601
  return t(this.canvas, e ?? {});
18581
18602
  }
18582
18603
  /**
@@ -19041,8 +19062,8 @@ class bs {
19041
19062
  e.position.x - e.target.x,
19042
19063
  e.position.y - e.target.y,
19043
19064
  e.position.z - e.target.z
19044
- ), b = y.length(), v = Math.atan2(y.x, y.z) + Math.PI, x = Math.asin(y.y / b);
19045
- r.pivot.rotation.set(x, v, 0);
19065
+ ), b = y.length(), v = Math.atan2(y.x, y.z) + Math.PI, E = Math.asin(y.y / b);
19066
+ r.pivot.rotation.set(E, v, 0);
19046
19067
  }
19047
19068
  r.pivot.computeWorldMatrix(!0), r.updateCameraPosition(), this.eventManager.emitGraphEvent("camera-state-changed", {
19048
19069
  state: e
@@ -19443,7 +19464,7 @@ class bs {
19443
19464
  * ```
19444
19465
  */
19445
19466
  async enableAiControl(e) {
19446
- const { AiManager: t } = await import("./AiManager-DNJCoeTO.js").then((i) => i.v);
19467
+ const { AiManager: t } = await import("./AiManager-CrbvKdEK.js").then((i) => i.v);
19447
19468
  this.aiManager = new t(), this.aiManager.init(this, e);
19448
19469
  }
19449
19470
  /**
@@ -19739,7 +19760,7 @@ Check console for details.`), this.eventManager.emitGraphError(
19739
19760
  if (!i)
19740
19761
  throw new Error("XR helper not available after session creation");
19741
19762
  this.scene.metadata = this.scene.metadata ?? {}, this.scene.metadata.xrHelper = i;
19742
- const { XRPivotCameraController: s } = await import("./XRPivotCameraController-JdlLBcD7.js"), r = new s(this.scene, i), a = this.scene.onBeforeRenderObservable.add(() => {
19763
+ const { XRPivotCameraController: s } = await import("./XRPivotCameraController-Uqa47vmo.js"), r = new s(this.scene, i), a = this.scene.onBeforeRenderObservable.add(() => {
19743
19764
  r.update();
19744
19765
  });
19745
19766
  this.scene.metadata.xrCameraController = r, this.scene.metadata.xrUpdateObserver = a;
@@ -19780,48 +19801,48 @@ const Fi = class Fi extends Ks {
19780
19801
  */
19781
19802
  constructor() {
19782
19803
  super();
19783
- E(this, H);
19784
- E(this, f);
19785
- E(this, Se);
19786
- E(this, Ce, null);
19787
- E(this, vt, !1);
19788
- E(this, Ue, null);
19789
- E(this, Ze, null);
19790
- E(this, Ve, null);
19791
- E(this, _e, /* @__PURE__ */ new Map());
19792
- E(this, St, !1);
19804
+ x(this, H);
19805
+ x(this, f);
19806
+ x(this, Se);
19807
+ x(this, Ce, null);
19808
+ x(this, vt, !1);
19809
+ x(this, Ue, null);
19810
+ x(this, Ze, null);
19811
+ x(this, Ve, null);
19812
+ x(this, _e, /* @__PURE__ */ new Map());
19813
+ x(this, St, !1);
19793
19814
  // Private backing fields for reactive properties
19794
- E(this, Be);
19795
- E(this, je);
19796
- E(this, ge);
19797
- E(this, pe);
19798
- E(this, Je);
19799
- E(this, He);
19800
- E(this, Xe);
19801
- E(this, $e);
19802
- E(this, Ye);
19803
- E(this, Qe);
19804
- E(this, qe);
19805
- E(this, Ke);
19806
- E(this, et);
19807
- E(this, Ie);
19808
- E(this, Ae);
19809
- E(this, Me);
19810
- E(this, tt);
19811
- E(this, it);
19812
- E(this, st);
19813
- E(this, rt);
19814
- E(this, at);
19815
- E(this, nt);
19816
- E(this, ot);
19815
+ x(this, Be);
19816
+ x(this, je);
19817
+ x(this, ge);
19818
+ x(this, pe);
19819
+ x(this, Je);
19820
+ x(this, He);
19821
+ x(this, Xe);
19822
+ x(this, $e);
19823
+ x(this, Ye);
19824
+ x(this, Qe);
19825
+ x(this, qe);
19826
+ x(this, Ke);
19827
+ x(this, et);
19828
+ x(this, Ie);
19829
+ x(this, Ae);
19830
+ x(this, Me);
19831
+ x(this, tt);
19832
+ x(this, it);
19833
+ x(this, st);
19834
+ x(this, rt);
19835
+ x(this, at);
19836
+ x(this, nt);
19837
+ x(this, ot);
19817
19838
  /**
19818
19839
  * The pair the last pair load started with, since the last `clearData`. Set means the next
19819
19840
  * load replaces; the same type and the same config object (`===`) again start no load.
19820
19841
  */
19821
- E(this, Ee);
19842
+ x(this, Ee);
19822
19843
  /** Whether a pair load is already scheduled for the end of this task. */
19823
- E(this, ct, !1);
19824
- E(this, lt);
19844
+ x(this, ct, !1);
19845
+ x(this, lt);
19825
19846
  M(this, Se, document.createElement("div")), g(this, Se).setAttribute("style", "position: absolute; inset: 0; display: block;"), M(this, f, new bs(g(this, Se)));
19826
19847
  }
19827
19848
  /**