@graphty/graphty-element 2.2.3 → 2.2.5
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/dist/ai.js +3 -3
- package/dist/catalog.js +5 -5
- package/dist/chunks/{AiManager-DC3JWPeM.js → AiManager-Bd_r1Hei.js} +7 -2
- package/dist/chunks/{DataSource-DEg3igzS.js → DataSource-Dag8H5US.js} +3 -3
- package/dist/chunks/{GraphSession-DDrQWABb.js → GraphSession-mfo75G0q.js} +3308 -3284
- package/dist/chunks/{VoiceInputAdapter-BueUG885.js → VoiceInputAdapter-DszYl6Ha.js} +442 -424
- package/dist/chunks/{XRPivotCameraController-DENGN2uV.js → XRPivotCameraController-BdoMFcON.js} +1 -1
- package/dist/chunks/{capability-check-BC3Qn6fS.js → capability-check-CdoqmrF0.js} +1 -1
- package/dist/chunks/{detect-CqN0mC6u.js → detect-LAOOaxY_.js} +1 -1
- package/dist/chunks/{format-detection-C8vbCSlS.js → format-detection-a0bD5PIB.js} +1 -1
- package/dist/chunks/{index-COss7yTG.js → index-BY1gnMiZ.js} +1001 -848
- package/dist/chunks/{paletteRegistry-NrWOKT-A.js → paletteRegistry-YSpPryiT.js} +13 -13
- package/dist/chunks/{scales-DKsbJE2L.js → scales-DOpwlWuz.js} +3 -3
- package/dist/extend.js +3 -3
- package/dist/graphty-catalog.json +1 -1
- package/dist/graphty.bundle.js +23040 -22842
- package/dist/graphty.js +3 -3
- package/dist/session.js +37 -52
- package/dist/src/Graph.d.ts +3 -0
- package/dist/src/acceleration/AccelerationController.d.ts +11 -0
- package/dist/src/ai/input/VoiceInputAdapter.d.ts +18 -0
- package/dist/src/data/ingest.d.ts +13 -0
- package/dist/src/managers/DataManager.d.ts +51 -0
- package/dist/src/managers/RenderManager.d.ts +21 -0
- package/dist/src/managers/UpdateManager.d.ts +38 -23
- package/dist/src/session/limits.d.ts +24 -5
- package/package.json +5 -5
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
var
|
|
1
|
+
var Di = (l) => {
|
|
2
2
|
throw TypeError(l);
|
|
3
3
|
};
|
|
4
|
-
var
|
|
5
|
-
var g = (l, e, t) => (
|
|
6
|
-
import { LitElement as
|
|
4
|
+
var zt = (l, e, t) => e.has(l) || Di("Cannot " + t);
|
|
5
|
+
var g = (l, e, t) => (zt(l, e, "read from private field"), t ? t.call(l) : e.get(l)), T = (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) => (zt(l, e, "write to private field"), i ? i.call(l, t) : e.set(l, t), t), ne = (l, e, t) => (zt(l, e, "access private method"), t);
|
|
6
|
+
import { LitElement as Hs, css as Ws } from "lit";
|
|
7
7
|
import { property as D } from "lit/decorators.js";
|
|
8
|
-
import { l as q, _ as ie, V as
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
11
|
-
import { D as Z } from "./DataSource-
|
|
12
|
-
import { XMLParser as
|
|
13
|
-
import * as
|
|
8
|
+
import { l as q, _ as ie, V as js } from "./VoiceInputAdapter-DszYl6Ha.js";
|
|
9
|
+
import { l as qs, m as ps, G as Ks, D as _t, A as Zs, n as Xs, o as Li, p as Qs } from "./GraphSession-mfo75G0q.js";
|
|
10
|
+
import bt from "papaparse";
|
|
11
|
+
import { D as Z } from "./DataSource-Dag8H5US.js";
|
|
12
|
+
import { XMLParser as ms } from "fast-xml-parser";
|
|
13
|
+
import * as Js from "jmespath";
|
|
14
14
|
import gt from "jmespath";
|
|
15
15
|
import { z as E } from "zod/v4";
|
|
16
|
-
import { D as
|
|
17
|
-
import { a as V, W as
|
|
18
|
-
import { A as N, j as
|
|
16
|
+
import { D as Ys, N as er, h as tr, C as ir, i as sr, R as rr, j as ti, m as fs, n as ar, K as or, F as ys, A as nr, o as cr, q as hr, r as lr, M as dr, t as ur, u as gr, v as pr, w as mr, x as fr, y as yr, z as wr, E as vr, H as br, G as Sr, I as Er, J as Cr, O as Mr, Q as xr, T as Tr, V as Pr, W as Ar, X as Or, Y as Rr, Z as Ir, _ as Dr, $ as Lr, a0 as Fr, a1 as Nr, a2 as pe, a3 as kr, c as Fi, b as zr } from "./scales-DOpwlWuz.js";
|
|
17
|
+
import { a as V, W as _r, x as Br } from "./paletteRegistry-YSpPryiT.js";
|
|
18
|
+
import { A as N, j as ws, e as Ur, m as ii, o as Gr, k as $r, h as Vr, i as Hr } from "./Algorithm-RQ629NLb.js";
|
|
19
19
|
import "@babylonjs/core/Culling/ray";
|
|
20
20
|
import "@babylonjs/core/Animations/animatable";
|
|
21
|
-
import { Effect as
|
|
22
|
-
import { C as
|
|
23
|
-
import { b as
|
|
24
|
-
import { G as
|
|
25
|
-
import { u as
|
|
21
|
+
import { Effect as xe, Vector2 as Wr, Vector3 as v, Mesh as H, StandardMaterial as Ee, Color3 as F, MeshBuilder as J, VertexData as B, ShaderMaterial as xt, BoundingInfo as jr, Camera as pt, GreasedLineMeshColorMode as qr, RawTexture as Ni, Engine as Tt, DynamicTexture as vs, Texture as Kr, AbstractMesh as Zr, Ray as Xr, Quaternion as oe, Matrix as De, Viewport as Qr, HighlightLayer as Jr, InstancedMesh as bs, GlowLayer as Yr, MaterialPluginBase as ea, ShaderLanguage as St, ActionManager as ki, ExecuteCodeAction as ta, PointerEventTypes as Y, Color4 as Ce, Observable as Bt, KeyboardEventTypes as zi, TransformNode as bi, Axis as Ut, Space as Gt, UniversalCamera as ia, Scalar as sa, FreeCamera as ra, Logger as _i, WebGPUEngine as Bi, Scene as aa, HemisphericLight as oa, PerfCounter as se, SceneInstrumentation as na, EngineInstrumentation as ca, CreateScreenshotAsync as ha, DefaultRenderingPipeline as la, FxaaPostProcess as da, PhotoDome as ua, CubicEase as $t, EasingFunction as Vt, Animation as A } from "@babylonjs/core";
|
|
22
|
+
import { C as Si, j as Ei, t as Ss, b as Es } from "./cameras-ii4vngYY.js";
|
|
23
|
+
import { b as Cs, G as ge } from "./GraphtyLogger-5KEttFUo.js";
|
|
24
|
+
import { G as ae, i as si } from "./GraphtyError-BwcnblTH.js";
|
|
25
|
+
import { u as ga, b as Ui } from "./detect-LAOOaxY_.js";
|
|
26
26
|
import { z as I } from "zod";
|
|
27
27
|
import { INVALID_INDEX as K } from "@graphty/graph-format";
|
|
28
|
-
import { E as
|
|
29
|
-
import { CreateGreasedLine as
|
|
30
|
-
import { c as
|
|
31
|
-
import
|
|
32
|
-
import
|
|
33
|
-
import
|
|
28
|
+
import { E as Ms, a as xs, b as pa, d as ma, R as fa, e as ee, P as z, S as Re } from "./NodeStyle-DKj7HjMJ.js";
|
|
29
|
+
import { CreateGreasedLine as Gi } from "@babylonjs/core/Meshes/Builders/greasedLineBuilder";
|
|
30
|
+
import { c as ya, D as Ts, G as wa, b as va, a as ba } from "./GraphStyle-D0PXnZKu.js";
|
|
31
|
+
import Sa from "p-queue";
|
|
32
|
+
import Ea from "toposort";
|
|
33
|
+
import Te from "hammerjs";
|
|
34
34
|
import "@babylonjs/core/Meshes/instancedMesh";
|
|
35
|
-
import { Vector2 as
|
|
35
|
+
import { Vector2 as Ps } from "@babylonjs/core/Maths/math.vector";
|
|
36
36
|
import { Observable as W } from "@babylonjs/core/Misc/observable";
|
|
37
|
-
import { K as
|
|
37
|
+
import { K as Ca } from "./types-B7bX5c0K.js";
|
|
38
38
|
import "./sequential-Zym81qm7.js";
|
|
39
39
|
import "./common-DWNKjpH_.js";
|
|
40
|
-
const
|
|
40
|
+
const Ma = E.strictObject({
|
|
41
41
|
/*
|
|
42
42
|
* Whether dropping a dragged node fixes it where the reader put it.
|
|
43
43
|
*
|
|
@@ -53,7 +53,7 @@ const Sa = E.strictObject({
|
|
|
53
53
|
* on would have meant a session that froze one node per drag with no way out.
|
|
54
54
|
*/
|
|
55
55
|
pinOnDrag: E.boolean().default(!0)
|
|
56
|
-
}).prefault({}),
|
|
56
|
+
}).prefault({}), xa = E.strictObject({
|
|
57
57
|
/*
|
|
58
58
|
* Whether node labels that would be drawn on top of each other are thinned out.
|
|
59
59
|
*
|
|
@@ -64,7 +64,7 @@ const Sa = E.strictObject({
|
|
|
64
64
|
* the selection changes, and never on a frame where none of them did.
|
|
65
65
|
*/
|
|
66
66
|
declutter: E.boolean().default(!1)
|
|
67
|
-
}).prefault({}),
|
|
67
|
+
}).prefault({}), Ta = E.strictObject({
|
|
68
68
|
type: E.string().default("ngraph"),
|
|
69
69
|
preSteps: E.number().default(0),
|
|
70
70
|
stepMultiplier: E.number().default(1),
|
|
@@ -91,40 +91,40 @@ const Sa = E.strictObject({
|
|
|
91
91
|
* entry per batch. A CPU simulation ignores it: its step is synchronous.
|
|
92
92
|
*/
|
|
93
93
|
maxInFlight: E.number().int().min(1).max(4).default(2)
|
|
94
|
-
}),
|
|
94
|
+
}), As = E.strictObject({
|
|
95
95
|
// dimensions: z.int().min(2).max(3).default(3),
|
|
96
|
-
layout:
|
|
97
|
-
node:
|
|
98
|
-
labels:
|
|
96
|
+
layout: Ta.prefault({}),
|
|
97
|
+
node: Ma,
|
|
98
|
+
labels: xa,
|
|
99
99
|
fetchNodes: E.optional(E.instanceof(Function)),
|
|
100
100
|
fetchEdges: E.optional(E.instanceof(Function))
|
|
101
|
-
}),
|
|
101
|
+
}), Pa = E.looseObject({
|
|
102
102
|
selector: E.string(),
|
|
103
|
-
style:
|
|
104
|
-
}),
|
|
103
|
+
style: xs
|
|
104
|
+
}), Aa = E.looseObject({
|
|
105
105
|
selector: E.string(),
|
|
106
|
-
style:
|
|
107
|
-
}),
|
|
106
|
+
style: Ms
|
|
107
|
+
}), Oa = E.object({
|
|
108
108
|
name: E.string()
|
|
109
|
-
}).loose(),
|
|
110
|
-
node:
|
|
111
|
-
edge:
|
|
112
|
-
metadata:
|
|
113
|
-
}).partial(),
|
|
109
|
+
}).loose(), Ra = E.looseObject({
|
|
110
|
+
node: Pa,
|
|
111
|
+
edge: Aa,
|
|
112
|
+
metadata: Oa.optional()
|
|
113
|
+
}).partial(), Ia = E.strictObject({
|
|
114
114
|
templateName: E.string().optional(),
|
|
115
115
|
templateCreator: E.string().optional(),
|
|
116
116
|
templateCreationTimestamp: E.iso.datetime().optional(),
|
|
117
117
|
templateModificationTimestamp: E.iso.datetime().optional()
|
|
118
|
-
}),
|
|
118
|
+
}), Da = E.strictObject({
|
|
119
119
|
graphtyTemplate: E.literal(!0),
|
|
120
120
|
majorVersion: E.literal("1"),
|
|
121
|
-
metadata:
|
|
122
|
-
graph:
|
|
121
|
+
metadata: Ia.optional(),
|
|
122
|
+
graph: ya.prefault({}),
|
|
123
123
|
/** Accepted and ignored. See {@link StyleLayer}; style layers are `session.styles`. */
|
|
124
|
-
layers: E.array(
|
|
125
|
-
data:
|
|
126
|
-
behavior:
|
|
127
|
-
}),
|
|
124
|
+
layers: E.array(Ra).prefault([]),
|
|
125
|
+
data: qs.prefault({}),
|
|
126
|
+
behavior: As.prefault({})
|
|
127
|
+
}), La = E.discriminatedUnion("majorVersion", [Da]), Fa = {
|
|
128
128
|
enabled: !1,
|
|
129
129
|
ui: {
|
|
130
130
|
enabled: !0,
|
|
@@ -154,20 +154,20 @@ const Sa = E.strictObject({
|
|
|
154
154
|
enabled: !1,
|
|
155
155
|
easeTime: 200
|
|
156
156
|
}
|
|
157
|
-
},
|
|
157
|
+
}, Na = /* @__PURE__ */ new Set([
|
|
158
158
|
"snapshot-replaced",
|
|
159
159
|
"snapshot-dropped"
|
|
160
160
|
]);
|
|
161
|
-
function
|
|
162
|
-
return !
|
|
161
|
+
function ka(l) {
|
|
162
|
+
return !Na.has(l.type);
|
|
163
163
|
}
|
|
164
|
-
const
|
|
164
|
+
const za = {
|
|
165
165
|
"node-click": "graphty-node-click",
|
|
166
166
|
"node-hover": "graphty-node-hover",
|
|
167
167
|
"node-drag-start": "graphty-node-drag-start",
|
|
168
168
|
"node-drag-end": "graphty-node-drag-end"
|
|
169
169
|
};
|
|
170
|
-
function
|
|
170
|
+
function _a(l) {
|
|
171
171
|
switch (l.type) {
|
|
172
172
|
case "node-click":
|
|
173
173
|
return {
|
|
@@ -190,12 +190,12 @@ function Na(l) {
|
|
|
190
190
|
return null;
|
|
191
191
|
}
|
|
192
192
|
}
|
|
193
|
-
const
|
|
193
|
+
const Ba = [
|
|
194
194
|
["source", "target"],
|
|
195
195
|
["src", "dst"],
|
|
196
196
|
["from", "to"]
|
|
197
|
-
],
|
|
198
|
-
function
|
|
197
|
+
], $i = [",", " ", ";", "|"];
|
|
198
|
+
function Ht(l) {
|
|
199
199
|
const e = /* @__PURE__ */ new Map();
|
|
200
200
|
let t = !1;
|
|
201
201
|
for (const i of l)
|
|
@@ -205,13 +205,13 @@ function Ut(l) {
|
|
|
205
205
|
if (!t && (i === `
|
|
206
206
|
` || i === "\r"))
|
|
207
207
|
break;
|
|
208
|
-
!t &&
|
|
208
|
+
!t && $i.includes(i) && e.set(i, (e.get(i) ?? 0) + 1);
|
|
209
209
|
}
|
|
210
|
-
return
|
|
210
|
+
return $i.reduce(
|
|
211
211
|
(i, s) => (e.get(s) ?? 0) > (e.get(i) ?? 0) ? s : i
|
|
212
212
|
);
|
|
213
213
|
}
|
|
214
|
-
function
|
|
214
|
+
function Ua(l) {
|
|
215
215
|
if (l.some((t) => /:(ID|LABEL|TYPE|START_ID|END_ID)/.test(t)))
|
|
216
216
|
return {
|
|
217
217
|
variant: "neo4j",
|
|
@@ -242,7 +242,7 @@ function za(l) {
|
|
|
242
242
|
targetColumn: "target",
|
|
243
243
|
interactionColumn: "interaction"
|
|
244
244
|
};
|
|
245
|
-
const e =
|
|
245
|
+
const e = Ba.find(([t, i]) => l.includes(t) && l.includes(i));
|
|
246
246
|
return e ? {
|
|
247
247
|
variant: "edge-list",
|
|
248
248
|
hasHeaders: !0,
|
|
@@ -260,7 +260,7 @@ function za(l) {
|
|
|
260
260
|
delimiter: ","
|
|
261
261
|
};
|
|
262
262
|
}
|
|
263
|
-
function
|
|
263
|
+
function Vi(l, e) {
|
|
264
264
|
let t = 0, i = 0;
|
|
265
265
|
for (const s of l) {
|
|
266
266
|
const r = s[e];
|
|
@@ -271,10 +271,10 @@ function Ui(l, e) {
|
|
|
271
271
|
}
|
|
272
272
|
return t > 0 ? { directed: !0, statedBy: `${e}=Directed`, conflictingEdges: i } : i > 0 ? { directed: !1, statedBy: `${e}=Undirected`, conflictingEdges: 0 } : null;
|
|
273
273
|
}
|
|
274
|
-
function
|
|
274
|
+
function Wt(l, e, t) {
|
|
275
275
|
return !(e in l) && !(t in l);
|
|
276
276
|
}
|
|
277
|
-
const
|
|
277
|
+
const Mi = class Mi extends Z {
|
|
278
278
|
/**
|
|
279
279
|
* Creates a new CSVDataSource instance.
|
|
280
280
|
* @param config - Configuration options for CSV parsing and data loading
|
|
@@ -299,7 +299,7 @@ const Si = class Si extends Z {
|
|
|
299
299
|
yield* this.parsePairedFiles();
|
|
300
300
|
return;
|
|
301
301
|
}
|
|
302
|
-
const e = await this.getContent(), t = this.config.delimiter ??
|
|
302
|
+
const e = await this.getContent(), t = this.config.delimiter ?? Ht(e), s = bt.parse(e, {
|
|
303
303
|
header: !0,
|
|
304
304
|
preview: 1,
|
|
305
305
|
delimiter: t,
|
|
@@ -350,10 +350,10 @@ const Si = class Si extends Z {
|
|
|
350
350
|
};
|
|
351
351
|
} else
|
|
352
352
|
r = {
|
|
353
|
-
...
|
|
353
|
+
...Ua(s),
|
|
354
354
|
delimiter: t
|
|
355
355
|
};
|
|
356
|
-
const a = r.variant === "neo4j" ? !1 : r.hasHeaders, o =
|
|
356
|
+
const a = r.variant === "neo4j" ? !1 : r.hasHeaders, o = bt.parse(e, {
|
|
357
357
|
header: a,
|
|
358
358
|
delimiter: r.delimiter,
|
|
359
359
|
dynamicTyping: !0,
|
|
@@ -429,7 +429,7 @@ const Si = class Si extends Z {
|
|
|
429
429
|
for (let o = 0; o < e.length; o++)
|
|
430
430
|
try {
|
|
431
431
|
const n = e[o];
|
|
432
|
-
if (
|
|
432
|
+
if (Wt(n, s, r)) {
|
|
433
433
|
t.push(n);
|
|
434
434
|
continue;
|
|
435
435
|
}
|
|
@@ -504,12 +504,12 @@ const Si = class Si extends Z {
|
|
|
504
504
|
(t.length > 0 || i.length > 0) && (yield { nodes: t, edges: i });
|
|
505
505
|
}
|
|
506
506
|
*parseGephiFormat(e, t) {
|
|
507
|
-
const i = [], s = /* @__PURE__ */ new Set(), r = t.sourceColumn ?? "Source", a = t.targetColumn ?? "Target", o =
|
|
507
|
+
const i = [], s = /* @__PURE__ */ new Set(), r = t.sourceColumn ?? "Source", a = t.targetColumn ?? "Target", o = Vi(e, t.typeColumn ?? "Type");
|
|
508
508
|
o !== null && this.declareDirection(o.directed, o.statedBy, o.conflictingEdges);
|
|
509
509
|
for (let c = 0; c < e.length; c++)
|
|
510
510
|
try {
|
|
511
511
|
const h = e[c];
|
|
512
|
-
if (
|
|
512
|
+
if (Wt(h, r, a)) {
|
|
513
513
|
i.push(h);
|
|
514
514
|
continue;
|
|
515
515
|
}
|
|
@@ -533,7 +533,7 @@ const Si = class Si extends Z {
|
|
|
533
533
|
for (let n = 0; n < e.length; n++)
|
|
534
534
|
try {
|
|
535
535
|
const c = e[n];
|
|
536
|
-
if (
|
|
536
|
+
if (Wt(c, r, a)) {
|
|
537
537
|
i.push(c);
|
|
538
538
|
continue;
|
|
539
539
|
}
|
|
@@ -589,9 +589,9 @@ const Si = class Si extends Z {
|
|
|
589
589
|
);
|
|
590
590
|
const i = [];
|
|
591
591
|
if (this.config.nodeFile ?? this.config.nodeURL) {
|
|
592
|
-
const r = this.config.nodeFile ? await this.config.nodeFile.text() : await (await this.fetchWithRetry(this.config.nodeURL ?? "")).text(), a =
|
|
592
|
+
const r = this.config.nodeFile ? await this.config.nodeFile.text() : await (await this.fetchWithRetry(this.config.nodeURL ?? "")).text(), a = bt.parse(r, {
|
|
593
593
|
header: !0,
|
|
594
|
-
delimiter: this.config.delimiter ??
|
|
594
|
+
delimiter: this.config.delimiter ?? Ht(r),
|
|
595
595
|
dynamicTyping: !0,
|
|
596
596
|
skipEmptyLines: !0,
|
|
597
597
|
transformHeader: (o) => o.trim()
|
|
@@ -604,13 +604,13 @@ const Si = class Si extends Z {
|
|
|
604
604
|
}
|
|
605
605
|
const s = [];
|
|
606
606
|
if (this.config.edgeFile ?? this.config.edgeURL) {
|
|
607
|
-
const r = this.config.edgeFile ? await this.config.edgeFile.text() : await (await this.fetchWithRetry(this.config.edgeURL ?? "")).text(), o =
|
|
607
|
+
const r = this.config.edgeFile ? await this.config.edgeFile.text() : await (await this.fetchWithRetry(this.config.edgeURL ?? "")).text(), o = bt.parse(r, {
|
|
608
608
|
header: !0,
|
|
609
|
-
delimiter: this.config.delimiter ??
|
|
609
|
+
delimiter: this.config.delimiter ?? Ht(r),
|
|
610
610
|
dynamicTyping: !0,
|
|
611
611
|
skipEmptyLines: !0,
|
|
612
612
|
transformHeader: (c) => c.trim()
|
|
613
|
-
}).data, n =
|
|
613
|
+
}).data, n = Vi(o, "Type");
|
|
614
614
|
n !== null && this.declareDirection(n.directed, n.statedBy, n.conflictingEdges);
|
|
615
615
|
for (const c of o) {
|
|
616
616
|
const { source: h, src: d, Source: u, target: p, dst: m, Target: y, ...w } = c;
|
|
@@ -624,9 +624,9 @@ const Si = class Si extends Z {
|
|
|
624
624
|
yield* this.chunkData(i, s);
|
|
625
625
|
}
|
|
626
626
|
};
|
|
627
|
-
|
|
628
|
-
let
|
|
629
|
-
const
|
|
627
|
+
Mi.type = "csv";
|
|
628
|
+
let ri = Mi;
|
|
629
|
+
const xi = class xi extends Z {
|
|
630
630
|
/**
|
|
631
631
|
* Creates a new DOTDataSource instance.
|
|
632
632
|
* @param config - Configuration options for DOT parsing and data loading
|
|
@@ -973,9 +973,9 @@ const Ei = class Ei extends Z {
|
|
|
973
973
|
return e.startsWith('"') && e.endsWith('"') ? e.slice(1, -1) : /^-?\d+$/.test(e) ? parseInt(e, 10) : /^-?\d+\.\d+$/.test(e) ? parseFloat(e) : e;
|
|
974
974
|
}
|
|
975
975
|
};
|
|
976
|
-
|
|
977
|
-
let
|
|
978
|
-
function
|
|
976
|
+
xi.type = "dot";
|
|
977
|
+
let ai = xi;
|
|
978
|
+
function Hi(l) {
|
|
979
979
|
switch (l.trim().toLowerCase()) {
|
|
980
980
|
case "directed":
|
|
981
981
|
return !0;
|
|
@@ -986,7 +986,7 @@ function Gi(l) {
|
|
|
986
986
|
return null;
|
|
987
987
|
}
|
|
988
988
|
}
|
|
989
|
-
function
|
|
989
|
+
function Ga(l, e, t) {
|
|
990
990
|
return !l.written && e > 0 ? {
|
|
991
991
|
directed: !0,
|
|
992
992
|
statedBy: `type="directed" on ${e} edge(s), with no defaultedgetype on <graph>`,
|
|
@@ -997,7 +997,7 @@ function _a(l, e, t) {
|
|
|
997
997
|
conflicts: l.directed ? t : e
|
|
998
998
|
};
|
|
999
999
|
}
|
|
1000
|
-
const
|
|
1000
|
+
const Ti = class Ti extends Z {
|
|
1001
1001
|
/**
|
|
1002
1002
|
* Creates a new GEXFDataSource instance.
|
|
1003
1003
|
* @param config - Configuration options for GEXF parsing and data loading
|
|
@@ -1013,7 +1013,7 @@ const Ci = class Ci extends Z {
|
|
|
1013
1013
|
* @yields DataSourceChunk objects containing parsed nodes and edges
|
|
1014
1014
|
*/
|
|
1015
1015
|
async *sourceFetchData() {
|
|
1016
|
-
const e = await this.getContent(), t = new
|
|
1016
|
+
const e = await this.getContent(), t = new ms({
|
|
1017
1017
|
ignoreAttributes: !1,
|
|
1018
1018
|
attributeNamePrefix: "@_",
|
|
1019
1019
|
parseAttributeValue: !1,
|
|
@@ -1033,7 +1033,7 @@ const Ci = class Ci extends Z {
|
|
|
1033
1033
|
const { graph: r } = s;
|
|
1034
1034
|
if (!r)
|
|
1035
1035
|
throw new Error("Invalid GEXF: missing <graph> element");
|
|
1036
|
-
const a = this.parseAttributeDefinitions(r.attributes, "node"), o = this.parseAttributeDefinitions(r.attributes, "edge"), n = this.parseNodes(r.nodes?.node, a), c = this.readDefaultEdgeType(r), { edges: h, statedDirected: d, statedUndirected: u } = this.parseEdges(r.edges?.edge, o), p =
|
|
1036
|
+
const a = this.parseAttributeDefinitions(r.attributes, "node"), o = this.parseAttributeDefinitions(r.attributes, "edge"), n = this.parseNodes(r.nodes?.node, a), c = this.readDefaultEdgeType(r), { edges: h, statedDirected: d, statedUndirected: u } = this.parseEdges(r.edges?.edge, o), p = Ga(c, d, u);
|
|
1037
1037
|
this.declareDirection(p.directed, p.statedBy, p.conflicts), yield* this.chunkData(n, h);
|
|
1038
1038
|
}
|
|
1039
1039
|
/**
|
|
@@ -1062,7 +1062,7 @@ const Ci = class Ci extends Z {
|
|
|
1062
1062
|
readDefaultEdgeType(e) {
|
|
1063
1063
|
const t = e["@_defaultedgetype"];
|
|
1064
1064
|
if (typeof t == "string") {
|
|
1065
|
-
const i =
|
|
1065
|
+
const i = Hi(t);
|
|
1066
1066
|
return i !== null ? { directed: i, written: !0, statedBy: `defaultedgetype="${t}"` } : {
|
|
1067
1067
|
directed: !1,
|
|
1068
1068
|
written: !1,
|
|
@@ -1178,7 +1178,7 @@ const Ci = class Ci extends Z {
|
|
|
1178
1178
|
const d = { source: c, target: h };
|
|
1179
1179
|
if (n["@_id"] && (d.gexfId = n["@_id"]), n["@_label"] && (d.label = n["@_label"]), n["@_weight"] && (d.weight = parseFloat(n["@_weight"])), n["@_type"]) {
|
|
1180
1180
|
d.type = n["@_type"];
|
|
1181
|
-
const u =
|
|
1181
|
+
const u = Hi(n["@_type"]);
|
|
1182
1182
|
u === !0 ? r++ : u === !1 && a++;
|
|
1183
1183
|
}
|
|
1184
1184
|
if (n.attvalues?.attvalue) {
|
|
@@ -1213,9 +1213,9 @@ const Ci = class Ci extends Z {
|
|
|
1213
1213
|
}
|
|
1214
1214
|
}
|
|
1215
1215
|
};
|
|
1216
|
-
|
|
1217
|
-
let
|
|
1218
|
-
function
|
|
1216
|
+
Ti.type = "gexf";
|
|
1217
|
+
let oi = Ti;
|
|
1218
|
+
function $a(l) {
|
|
1219
1219
|
const e = l.directed;
|
|
1220
1220
|
if (typeof e == "number")
|
|
1221
1221
|
return { directed: e !== 0, statedBy: `directed ${String(e)}` };
|
|
@@ -1228,7 +1228,7 @@ function Ba(l) {
|
|
|
1228
1228
|
}
|
|
1229
1229
|
return { directed: !1, statedBy: "the GML default for an absent directed key (undirected)" };
|
|
1230
1230
|
}
|
|
1231
|
-
const
|
|
1231
|
+
const Pi = class Pi extends Z {
|
|
1232
1232
|
/**
|
|
1233
1233
|
* Creates a new GMLDataSource instance.
|
|
1234
1234
|
* @param config - Configuration options for GML parsing and data loading
|
|
@@ -1247,7 +1247,7 @@ const Mi = class Mi extends Z {
|
|
|
1247
1247
|
const e = await this.getContent(), t = this.parseGML(e);
|
|
1248
1248
|
if (!t)
|
|
1249
1249
|
return;
|
|
1250
|
-
const i = this.extractNodes(t), s = this.extractEdges(t), r =
|
|
1250
|
+
const i = this.extractNodes(t), s = this.extractEdges(t), r = $a(t);
|
|
1251
1251
|
this.declareDirection(r.directed, r.statedBy), yield* this.chunkData(i, s);
|
|
1252
1252
|
}
|
|
1253
1253
|
parseGML(e) {
|
|
@@ -1379,23 +1379,23 @@ const Mi = class Mi extends Z {
|
|
|
1379
1379
|
return t;
|
|
1380
1380
|
}
|
|
1381
1381
|
};
|
|
1382
|
-
|
|
1383
|
-
let
|
|
1384
|
-
function
|
|
1382
|
+
Pi.type = "gml";
|
|
1383
|
+
let ni = Pi;
|
|
1384
|
+
function Va(l) {
|
|
1385
1385
|
const e = l["@_edgedefault"];
|
|
1386
1386
|
if (typeof e != "string")
|
|
1387
1387
|
return null;
|
|
1388
1388
|
const t = e.trim().toLowerCase();
|
|
1389
1389
|
return t !== "directed" && t !== "undirected" ? null : { directed: t === "directed", statedBy: `edgedefault="${e}"` };
|
|
1390
1390
|
}
|
|
1391
|
-
function
|
|
1391
|
+
function Ha(l) {
|
|
1392
1392
|
const e = l["@_directed"];
|
|
1393
1393
|
if (typeof e != "string")
|
|
1394
1394
|
return null;
|
|
1395
1395
|
const t = e.trim().toLowerCase();
|
|
1396
1396
|
return t === "true" ? !0 : t === "false" ? !1 : null;
|
|
1397
1397
|
}
|
|
1398
|
-
const
|
|
1398
|
+
const Ai = class Ai extends Z {
|
|
1399
1399
|
/**
|
|
1400
1400
|
* Creates a new GraphMLDataSource instance.
|
|
1401
1401
|
* @param config - Configuration options for GraphML parsing and data loading
|
|
@@ -1411,7 +1411,7 @@ const xi = class xi extends Z {
|
|
|
1411
1411
|
* @yields DataSourceChunk objects containing parsed nodes and edges
|
|
1412
1412
|
*/
|
|
1413
1413
|
async *sourceFetchData() {
|
|
1414
|
-
const e = await this.getContent(), t = new
|
|
1414
|
+
const e = await this.getContent(), t = new ms({
|
|
1415
1415
|
ignoreAttributes: !1,
|
|
1416
1416
|
attributeNamePrefix: "@_",
|
|
1417
1417
|
parseAttributeValue: !1,
|
|
@@ -1430,7 +1430,7 @@ const xi = class xi extends Z {
|
|
|
1430
1430
|
const r = this.parseKeyDefinitions(s.key), { graph: a } = s;
|
|
1431
1431
|
if (!a)
|
|
1432
1432
|
return;
|
|
1433
|
-
const o = this.parseNodes(a.node, r), n =
|
|
1433
|
+
const o = this.parseNodes(a.node, r), n = Va(a), { edges: c, conflicts: h } = this.parseEdges(a.edge, r, n?.directed ?? null);
|
|
1434
1434
|
n !== null && this.declareDirection(n.directed, n.statedBy, h), yield* this.chunkData(o, c);
|
|
1435
1435
|
}
|
|
1436
1436
|
parseKeyDefinitions(e) {
|
|
@@ -1519,7 +1519,7 @@ const xi = class xi extends Z {
|
|
|
1519
1519
|
});
|
|
1520
1520
|
continue;
|
|
1521
1521
|
}
|
|
1522
|
-
const h = { source: n, target: c }, d =
|
|
1522
|
+
const h = { source: n, target: c }, d = Ha(o);
|
|
1523
1523
|
if (d !== null && (h.directed = d, i !== null && d !== i && a++), o.data) {
|
|
1524
1524
|
const u = Array.isArray(o.data) ? o.data : [o.data];
|
|
1525
1525
|
for (const p of u) {
|
|
@@ -1633,15 +1633,15 @@ const xi = class xi extends Z {
|
|
|
1633
1633
|
return t;
|
|
1634
1634
|
}
|
|
1635
1635
|
};
|
|
1636
|
-
|
|
1637
|
-
let
|
|
1638
|
-
const
|
|
1636
|
+
Ai.type = "graphml";
|
|
1637
|
+
let ci = Ai;
|
|
1638
|
+
const Wa = E.strictObject({
|
|
1639
1639
|
path: E.string().default("nodes"),
|
|
1640
1640
|
schema: E.custom().or(E.null()).default(null)
|
|
1641
|
-
}).prefault({}),
|
|
1641
|
+
}).prefault({}), ja = E.strictObject({
|
|
1642
1642
|
path: E.string().default("edges"),
|
|
1643
1643
|
schema: E.custom().or(E.null()).default(null)
|
|
1644
|
-
}).prefault({}),
|
|
1644
|
+
}).prefault({}), qa = E.object({
|
|
1645
1645
|
data: E.string().optional(),
|
|
1646
1646
|
file: E.instanceof(File).optional(),
|
|
1647
1647
|
url: E.string().optional(),
|
|
@@ -1650,22 +1650,22 @@ const $a = E.strictObject({
|
|
|
1650
1650
|
nodeIdPath: E.string().optional(),
|
|
1651
1651
|
edgeSrcIdPath: E.string().optional(),
|
|
1652
1652
|
edgeDstIdPath: E.string().optional(),
|
|
1653
|
-
node:
|
|
1654
|
-
edge:
|
|
1653
|
+
node: Wa,
|
|
1654
|
+
edge: ja
|
|
1655
1655
|
});
|
|
1656
|
-
function
|
|
1656
|
+
function Ka(l) {
|
|
1657
1657
|
if (l === null || typeof l != "object" || Array.isArray(l))
|
|
1658
1658
|
return null;
|
|
1659
1659
|
const e = l.directed;
|
|
1660
1660
|
return typeof e != "boolean" ? null : { directed: e, statedBy: `"directed": ${String(e)}` };
|
|
1661
1661
|
}
|
|
1662
|
-
const
|
|
1662
|
+
const Oi = class Oi extends Z {
|
|
1663
1663
|
/**
|
|
1664
1664
|
* Creates a new JsonDataSource instance.
|
|
1665
1665
|
* @param anyOpts - Configuration options for JSON parsing and data extraction
|
|
1666
1666
|
*/
|
|
1667
1667
|
constructor(e) {
|
|
1668
|
-
const t =
|
|
1668
|
+
const t = qa.parse(e);
|
|
1669
1669
|
super(t.errorLimit ?? 100, t.chunkSize ?? Z.DEFAULT_CHUNK_SIZE), this.opts = t, t.node.schema && (this.nodeSchema = t.node.schema), t.edge.schema && (this.edgeSchema = t.edge.schema);
|
|
1670
1670
|
}
|
|
1671
1671
|
getConfig() {
|
|
@@ -1701,7 +1701,7 @@ const Ti = class Ti extends Z {
|
|
|
1701
1701
|
yield* this.chunkData([], []);
|
|
1702
1702
|
return;
|
|
1703
1703
|
}
|
|
1704
|
-
const i =
|
|
1704
|
+
const i = Ka(e);
|
|
1705
1705
|
i !== null && this.declareDirection(i.directed, i.statedBy);
|
|
1706
1706
|
let s = [];
|
|
1707
1707
|
try {
|
|
@@ -1826,13 +1826,13 @@ const Ti = class Ti extends Z {
|
|
|
1826
1826
|
return !0;
|
|
1827
1827
|
}
|
|
1828
1828
|
};
|
|
1829
|
-
|
|
1830
|
-
let
|
|
1831
|
-
function
|
|
1829
|
+
Oi.type = "json";
|
|
1830
|
+
let hi = Oi;
|
|
1831
|
+
function Za(l, e) {
|
|
1832
1832
|
const t = l.filter((i) => i.directed).length;
|
|
1833
1833
|
return t > 0 ? { directed: !0, statedBy: "*Arcs", conflictingEdges: l.length - t } : l.length > 0 ? { directed: !1, statedBy: "*Edges", conflictingEdges: 0 } : e.arcs ? { directed: !0, statedBy: "*Arcs", conflictingEdges: 0 } : e.edges ? { directed: !1, statedBy: "*Edges", conflictingEdges: 0 } : null;
|
|
1834
1834
|
}
|
|
1835
|
-
const
|
|
1835
|
+
const Ri = class Ri extends Z {
|
|
1836
1836
|
/**
|
|
1837
1837
|
* Creates a new PajekDataSource instance.
|
|
1838
1838
|
* @param config - Configuration options for Pajek parsing and data loading
|
|
@@ -1848,7 +1848,7 @@ const Pi = class Pi extends Z {
|
|
|
1848
1848
|
* @yields DataSourceChunk objects containing parsed nodes and edges
|
|
1849
1849
|
*/
|
|
1850
1850
|
async *sourceFetchData() {
|
|
1851
|
-
const e = await this.getContent(), { vertices: t, edges: i, headers: s } = this.parsePajek(e), r = t.map((n) => this.vertexToNode(n)), a = i.map((n) => this.edgeToEdgeData(n)), o =
|
|
1851
|
+
const e = await this.getContent(), { vertices: t, edges: i, headers: s } = this.parsePajek(e), r = t.map((n) => this.vertexToNode(n)), a = i.map((n) => this.edgeToEdgeData(n)), o = Za(i, s);
|
|
1852
1852
|
o !== null && this.declareDirection(o.directed, o.statedBy, o.conflictingEdges), yield* this.chunkData(r, a);
|
|
1853
1853
|
}
|
|
1854
1854
|
parsePajek(e) {
|
|
@@ -1963,35 +1963,32 @@ const Pi = class Pi extends Z {
|
|
|
1963
1963
|
return e.weight !== void 0 && (t.weight = e.weight), t;
|
|
1964
1964
|
}
|
|
1965
1965
|
};
|
|
1966
|
-
|
|
1967
|
-
let
|
|
1968
|
-
Z.register(
|
|
1966
|
+
Ri.type = "pajek";
|
|
1967
|
+
let li = Ri;
|
|
1968
|
+
Z.register(hi);
|
|
1969
|
+
Z.register(ci);
|
|
1969
1970
|
Z.register(ri);
|
|
1970
|
-
Z.register(
|
|
1971
|
-
Z.register(si);
|
|
1972
|
-
Z.register(ii);
|
|
1973
|
-
Z.register(ti);
|
|
1971
|
+
Z.register(ni);
|
|
1974
1972
|
Z.register(oi);
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
V.register(Js);
|
|
1973
|
+
Z.register(ai);
|
|
1974
|
+
Z.register(li);
|
|
1978
1975
|
V.register(Ys);
|
|
1979
1976
|
V.register(er);
|
|
1980
1977
|
V.register(tr);
|
|
1981
|
-
V.register(Qt);
|
|
1982
|
-
V.register(ps);
|
|
1983
1978
|
V.register(ir);
|
|
1984
1979
|
V.register(sr);
|
|
1985
|
-
V.register(ms);
|
|
1986
1980
|
V.register(rr);
|
|
1981
|
+
V.register(ti);
|
|
1982
|
+
V.register(fs);
|
|
1987
1983
|
V.register(ar);
|
|
1988
1984
|
V.register(or);
|
|
1985
|
+
V.register(ys);
|
|
1989
1986
|
V.register(nr);
|
|
1990
1987
|
V.register(cr);
|
|
1991
1988
|
V.register(hr);
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1989
|
+
V.register(lr);
|
|
1990
|
+
V.register(dr);
|
|
1991
|
+
V.register(ur);
|
|
1995
1992
|
N.register(gr);
|
|
1996
1993
|
N.register(pr);
|
|
1997
1994
|
N.register(mr);
|
|
@@ -2012,8 +2009,11 @@ N.register(Or);
|
|
|
2012
2009
|
N.register(Rr);
|
|
2013
2010
|
N.register(Ir);
|
|
2014
2011
|
N.register(Dr);
|
|
2012
|
+
N.register(Lr);
|
|
2013
|
+
N.register(Fr);
|
|
2014
|
+
N.register(Nr);
|
|
2015
2015
|
const ce = 10;
|
|
2016
|
-
function
|
|
2016
|
+
function Xa() {
|
|
2017
2017
|
return Object.freeze({
|
|
2018
2018
|
min: { x: -ce, y: -ce, z: -ce },
|
|
2019
2019
|
max: { x: ce, y: ce, z: ce },
|
|
@@ -2023,12 +2023,12 @@ function qa() {
|
|
|
2023
2023
|
measured: 0
|
|
2024
2024
|
});
|
|
2025
2025
|
}
|
|
2026
|
-
function
|
|
2026
|
+
function Qa(l) {
|
|
2027
2027
|
let e = 1 / 0, t = 1 / 0, i = 1 / 0, s = -1 / 0, r = -1 / 0, a = -1 / 0, o = 0;
|
|
2028
2028
|
for (const c of l)
|
|
2029
2029
|
e = Math.min(e, c.x), t = Math.min(t, c.y), i = Math.min(i, c.z), s = Math.max(s, c.x), r = Math.max(r, c.y), a = Math.max(a, c.z), o++;
|
|
2030
2030
|
if (o === 0)
|
|
2031
|
-
return
|
|
2031
|
+
return Xa();
|
|
2032
2032
|
const n = { x: s - e, y: r - t, z: a - i };
|
|
2033
2033
|
return Object.freeze({
|
|
2034
2034
|
min: { x: e, y: t, z: i },
|
|
@@ -2039,29 +2039,29 @@ function Ka(l) {
|
|
|
2039
2039
|
measured: o
|
|
2040
2040
|
});
|
|
2041
2041
|
}
|
|
2042
|
-
const
|
|
2043
|
-
function
|
|
2042
|
+
const Ja = 0.8, Ya = 1.05, eo = 1.1, to = 0.65, jt = 0.577, Nt = 1.5, io = 0.615;
|
|
2043
|
+
function so(l) {
|
|
2044
2044
|
const { bounds: e } = l, { center: t } = e;
|
|
2045
2045
|
if (l.mode === "2d") {
|
|
2046
2046
|
const a = Math.max(e.size.x, e.size.y / l.aspect);
|
|
2047
2047
|
return {
|
|
2048
2048
|
type: "orthographic",
|
|
2049
|
-
zoom: l.viewport.width / (a *
|
|
2049
|
+
zoom: l.viewport.width / (a * Ya),
|
|
2050
2050
|
pan: { x: t.x, y: t.y }
|
|
2051
2051
|
};
|
|
2052
2052
|
}
|
|
2053
|
-
const i = l.fov ??
|
|
2053
|
+
const i = l.fov ?? Ja, r = e.maxDimension / Math.tan(i / 2) * eo * to;
|
|
2054
2054
|
return {
|
|
2055
2055
|
type: "arcRotate",
|
|
2056
2056
|
position: {
|
|
2057
|
-
x: t.x + r *
|
|
2058
|
-
y: t.y + r *
|
|
2059
|
-
z: t.z + r *
|
|
2057
|
+
x: t.x + r * jt,
|
|
2058
|
+
y: t.y + r * jt,
|
|
2059
|
+
z: t.z + r * jt
|
|
2060
2060
|
},
|
|
2061
2061
|
target: t
|
|
2062
2062
|
};
|
|
2063
2063
|
}
|
|
2064
|
-
function
|
|
2064
|
+
function ro(l) {
|
|
2065
2065
|
const { center: e } = l.bounds;
|
|
2066
2066
|
if (l.mode === "2d")
|
|
2067
2067
|
return {
|
|
@@ -2069,71 +2069,71 @@ function to(l) {
|
|
|
2069
2069
|
zoom: 1,
|
|
2070
2070
|
pan: { x: e.x, y: e.y }
|
|
2071
2071
|
};
|
|
2072
|
-
const t = l.bounds.maxDimension *
|
|
2072
|
+
const t = l.bounds.maxDimension * Nt;
|
|
2073
2073
|
return {
|
|
2074
2074
|
type: "arcRotate",
|
|
2075
2075
|
position: { x: e.x, y: e.y + t, z: e.z },
|
|
2076
2076
|
target: e
|
|
2077
2077
|
};
|
|
2078
2078
|
}
|
|
2079
|
-
function
|
|
2080
|
-
const { center: e } = l.bounds, t = l.bounds.maxDimension *
|
|
2079
|
+
function ao(l) {
|
|
2080
|
+
const { center: e } = l.bounds, t = l.bounds.maxDimension * Nt;
|
|
2081
2081
|
return {
|
|
2082
2082
|
type: "arcRotate",
|
|
2083
2083
|
position: { x: e.x + t, y: e.y, z: e.z },
|
|
2084
2084
|
target: e
|
|
2085
2085
|
};
|
|
2086
2086
|
}
|
|
2087
|
-
function
|
|
2088
|
-
const { center: e } = l.bounds, t = l.bounds.maxDimension *
|
|
2087
|
+
function oo(l) {
|
|
2088
|
+
const { center: e } = l.bounds, t = l.bounds.maxDimension * Nt;
|
|
2089
2089
|
return {
|
|
2090
2090
|
type: "arcRotate",
|
|
2091
2091
|
position: { x: e.x, y: e.y, z: e.z + t },
|
|
2092
2092
|
target: e
|
|
2093
2093
|
};
|
|
2094
2094
|
}
|
|
2095
|
-
function
|
|
2095
|
+
function no(l) {
|
|
2096
2096
|
return {
|
|
2097
2097
|
type: "arcRotate",
|
|
2098
2098
|
alpha: Math.PI / 4,
|
|
2099
|
-
beta:
|
|
2100
|
-
radius: l.bounds.maxDimension *
|
|
2099
|
+
beta: io,
|
|
2100
|
+
radius: l.bounds.maxDimension * Nt,
|
|
2101
2101
|
target: l.bounds.center
|
|
2102
2102
|
};
|
|
2103
2103
|
}
|
|
2104
|
-
const
|
|
2105
|
-
fitToGraph:
|
|
2106
|
-
topView:
|
|
2107
|
-
sideView:
|
|
2108
|
-
frontView:
|
|
2109
|
-
isometric:
|
|
2104
|
+
const Wi = Object.freeze({
|
|
2105
|
+
fitToGraph: so,
|
|
2106
|
+
topView: ro,
|
|
2107
|
+
sideView: ao,
|
|
2108
|
+
frontView: oo,
|
|
2109
|
+
isometric: no
|
|
2110
2110
|
});
|
|
2111
|
-
function
|
|
2112
|
-
return Object.hasOwn(
|
|
2111
|
+
function co(l) {
|
|
2112
|
+
return Object.hasOwn(Wi, l) ? Wi[l] : void 0;
|
|
2113
2113
|
}
|
|
2114
|
-
function
|
|
2114
|
+
function di() {
|
|
2115
2115
|
return [
|
|
2116
|
-
...
|
|
2117
|
-
...
|
|
2116
|
+
...Si.map((l) => l.id),
|
|
2117
|
+
...Ur().map((l) => l.id)
|
|
2118
2118
|
];
|
|
2119
2119
|
}
|
|
2120
|
-
function
|
|
2121
|
-
return
|
|
2120
|
+
function qt(l) {
|
|
2121
|
+
return Si.some((e) => e.id === l) || ws(l) !== void 0;
|
|
2122
2122
|
}
|
|
2123
|
-
function
|
|
2124
|
-
const e =
|
|
2123
|
+
function ho(l) {
|
|
2124
|
+
const e = co(l);
|
|
2125
2125
|
if (e !== void 0) {
|
|
2126
|
-
const i =
|
|
2126
|
+
const i = Si.find((s) => s.id === l);
|
|
2127
2127
|
return i === void 0 ? void 0 : { descriptor: i, compute: e };
|
|
2128
2128
|
}
|
|
2129
|
-
const t =
|
|
2129
|
+
const t = ws(l);
|
|
2130
2130
|
return t === void 0 ? void 0 : { descriptor: t.descriptor, compute: t.compute };
|
|
2131
2131
|
}
|
|
2132
|
-
function
|
|
2133
|
-
const t =
|
|
2132
|
+
function lo(l, e) {
|
|
2133
|
+
const t = ho(l);
|
|
2134
2134
|
if (t === void 0) {
|
|
2135
|
-
const o =
|
|
2136
|
-
throw new
|
|
2135
|
+
const o = di();
|
|
2136
|
+
throw new ae({
|
|
2137
2137
|
code: "E_UNKNOWN_CAMERA",
|
|
2138
2138
|
message: `no camera view is named "${l}". The views that can be named are: ${o.join(", ")}`,
|
|
2139
2139
|
source: "view",
|
|
@@ -2142,7 +2142,7 @@ function no(l, e) {
|
|
|
2142
2142
|
}
|
|
2143
2143
|
const { descriptor: i, compute: s } = t;
|
|
2144
2144
|
if (!i.modes.includes(e.mode))
|
|
2145
|
-
throw new
|
|
2145
|
+
throw new ae({
|
|
2146
2146
|
code: "E_UNSUPPORTED",
|
|
2147
2147
|
message: `the camera view "${l}" cannot be computed while the element is drawing in ${e.mode}: it declares ${i.modes.join(" and ")}`,
|
|
2148
2148
|
source: "view",
|
|
@@ -2153,7 +2153,7 @@ function no(l, e) {
|
|
|
2153
2153
|
modes: [...i.modes]
|
|
2154
2154
|
}
|
|
2155
2155
|
});
|
|
2156
|
-
const r =
|
|
2156
|
+
const r = Cs(i.options, e.options ?? {}, { kind: "camera", id: l }), a = {
|
|
2157
2157
|
bounds: e.bounds,
|
|
2158
2158
|
mode: e.mode,
|
|
2159
2159
|
aspect: e.aspect,
|
|
@@ -2164,7 +2164,7 @@ function no(l, e) {
|
|
|
2164
2164
|
};
|
|
2165
2165
|
return s(a);
|
|
2166
2166
|
}
|
|
2167
|
-
const
|
|
2167
|
+
const uo = I.object({
|
|
2168
2168
|
/**
|
|
2169
2169
|
* Enable/disable XR functionality globally
|
|
2170
2170
|
* @default true
|
|
@@ -2295,7 +2295,7 @@ const co = I.object({
|
|
|
2295
2295
|
*/
|
|
2296
2296
|
easeTime: I.number().positive().default(200)
|
|
2297
2297
|
}).default({})
|
|
2298
|
-
}).default({}),
|
|
2298
|
+
}).default({}), go = {
|
|
2299
2299
|
notification: {
|
|
2300
2300
|
backgroundColor: "rgba(255, 59, 48, 1)",
|
|
2301
2301
|
textColor: "white",
|
|
@@ -2412,7 +2412,7 @@ const co = I.object({
|
|
|
2412
2412
|
}, mt = {
|
|
2413
2413
|
getBadgeStyle(l) {
|
|
2414
2414
|
if (l)
|
|
2415
|
-
return
|
|
2415
|
+
return go[l];
|
|
2416
2416
|
},
|
|
2417
2417
|
applyBadgeBehaviors(l, e) {
|
|
2418
2418
|
const t = l._badgeType;
|
|
@@ -2438,7 +2438,7 @@ const co = I.object({
|
|
|
2438
2438
|
applyIconBehavior(l, e) {
|
|
2439
2439
|
e.icon && !e.text ? l.text = e.icon : e.icon && e.text && ((e.iconPosition ?? "left") === "left" ? l.text = `${e.icon} ${e.text}` : l.text = `${e.text} ${e.icon}`);
|
|
2440
2440
|
}
|
|
2441
|
-
},
|
|
2441
|
+
}, ui = "#FFFFFF", Os = xs.parse(pa), Rs = Ms.parse(ma), ji = Object.freeze([]);
|
|
2442
2442
|
function ke(l, e, t) {
|
|
2443
2443
|
const i = e.split(".");
|
|
2444
2444
|
let s = l;
|
|
@@ -2453,10 +2453,10 @@ function ke(l, e, t) {
|
|
|
2453
2453
|
}
|
|
2454
2454
|
s[i[i.length - 1]] = t;
|
|
2455
2455
|
}
|
|
2456
|
-
function
|
|
2456
|
+
function po(l) {
|
|
2457
2457
|
return l.split(".").slice(0, -1).join(".");
|
|
2458
2458
|
}
|
|
2459
|
-
const
|
|
2459
|
+
const mo = {
|
|
2460
2460
|
enabled: "enabled",
|
|
2461
2461
|
font: "font",
|
|
2462
2462
|
sizePx: "fontSize",
|
|
@@ -2501,47 +2501,47 @@ const uo = {
|
|
|
2501
2501
|
smartOverflow: "smartOverflow",
|
|
2502
2502
|
maxNumber: "maxNumber",
|
|
2503
2503
|
overflowSuffix: "overflowSuffix"
|
|
2504
|
-
},
|
|
2505
|
-
function
|
|
2504
|
+
}, fo = new Set(Object.keys(fa.shape));
|
|
2505
|
+
function yo(l) {
|
|
2506
2506
|
const e = mt.getBadgeStyle(l) ?? {}, t = {};
|
|
2507
2507
|
for (const [i, s] of Object.entries(e))
|
|
2508
|
-
|
|
2508
|
+
fo.has(i) && s !== void 0 && (t[i] = s);
|
|
2509
2509
|
return t;
|
|
2510
2510
|
}
|
|
2511
|
-
function
|
|
2512
|
-
const e = {}, t =
|
|
2511
|
+
function wo(l) {
|
|
2512
|
+
const e = {}, t = mo;
|
|
2513
2513
|
for (const [i, s] of Object.entries(l)) {
|
|
2514
2514
|
const r = t[i];
|
|
2515
2515
|
r !== void 0 && s !== void 0 && (e[r] = s);
|
|
2516
2516
|
}
|
|
2517
2517
|
if (l.weight !== void 0 && (e.fontWeight = String(l.weight)), l.outline !== void 0 && (e.textOutline = !0, e.textOutlineColor = l.outline), l.gradientColors !== void 0 && (e.backgroundGradientColors = [...l.gradientColors]), l.badge !== void 0)
|
|
2518
|
-
for (const [i, s] of Object.entries(
|
|
2518
|
+
for (const [i, s] of Object.entries(yo(l.badge)))
|
|
2519
2519
|
e[i] ??= s;
|
|
2520
2520
|
return e;
|
|
2521
2521
|
}
|
|
2522
|
-
function
|
|
2523
|
-
const i =
|
|
2522
|
+
function Is(l, e, t) {
|
|
2523
|
+
const i = Es[e];
|
|
2524
2524
|
if (!i.renderable)
|
|
2525
2525
|
return;
|
|
2526
2526
|
if (i.accepts === "labelStyle") {
|
|
2527
|
-
for (const [r, a] of Object.entries(
|
|
2527
|
+
for (const [r, a] of Object.entries(wo(t)))
|
|
2528
2528
|
ke(l, `${i.stylePath}.${r}`, a);
|
|
2529
2529
|
return;
|
|
2530
2530
|
}
|
|
2531
|
-
const s =
|
|
2532
|
-
ke(l, i.stylePath, s === null ? t : s.hex), i.accepts === "text" && ke(l, `${
|
|
2531
|
+
const s = Ei(t);
|
|
2532
|
+
ke(l, i.stylePath, s === null ? t : s.hex), i.accepts === "text" && ke(l, `${po(i.stylePath)}.enabled`, !0);
|
|
2533
2533
|
}
|
|
2534
|
-
function
|
|
2535
|
-
const e = (t) =>
|
|
2534
|
+
function Ds(l) {
|
|
2535
|
+
const e = (t) => Es[t]?.accepts === "labelStyle" ? 1 : 0;
|
|
2536
2536
|
return Object.entries(l).sort(([t], [i]) => e(t) - e(i));
|
|
2537
2537
|
}
|
|
2538
|
-
function
|
|
2538
|
+
function vo(l, e) {
|
|
2539
2539
|
const t = {};
|
|
2540
2540
|
let i = null, s;
|
|
2541
|
-
for (const [r, a] of
|
|
2541
|
+
for (const [r, a] of Ds(l)) {
|
|
2542
2542
|
const o = r;
|
|
2543
2543
|
if (o === "node.color") {
|
|
2544
|
-
const n =
|
|
2544
|
+
const n = Ei(a);
|
|
2545
2545
|
i = n === null ? null : { r: n.r, g: n.g, b: n.b, a: n.a };
|
|
2546
2546
|
continue;
|
|
2547
2547
|
}
|
|
@@ -2549,50 +2549,50 @@ function fo(l, e) {
|
|
|
2549
2549
|
s = typeof a == "number" ? a : void 0;
|
|
2550
2550
|
continue;
|
|
2551
2551
|
}
|
|
2552
|
-
|
|
2552
|
+
Is(t, o, a);
|
|
2553
2553
|
}
|
|
2554
2554
|
return ke(
|
|
2555
2555
|
t,
|
|
2556
2556
|
"texture.color",
|
|
2557
|
-
s === void 0 ?
|
|
2557
|
+
s === void 0 ? ui : { colorType: "solid", value: ui, opacity: s }
|
|
2558
2558
|
), {
|
|
2559
2559
|
meshKey: s === void 0 ? `s${String(e)}` : `s${String(e)}o${String(s)}`,
|
|
2560
|
-
style: q.defaultsDeep(t, q.cloneDeep(
|
|
2560
|
+
style: q.defaultsDeep(t, q.cloneDeep(Os)),
|
|
2561
2561
|
color: i
|
|
2562
2562
|
};
|
|
2563
2563
|
}
|
|
2564
|
-
function
|
|
2564
|
+
function bo(l, e) {
|
|
2565
2565
|
const t = {};
|
|
2566
|
-
for (const [a, o] of
|
|
2567
|
-
|
|
2568
|
-
const i =
|
|
2569
|
-
return { meshKey: `s${String(e)}|${i?.hex ?? ""}|${s === void 0 ? "" : String(s)}`, style:
|
|
2566
|
+
for (const [a, o] of Ds(l))
|
|
2567
|
+
Is(t, a, o);
|
|
2568
|
+
const i = Ei(l["edge.color"]), s = l["edge.opacity"];
|
|
2569
|
+
return { meshKey: `s${String(e)}|${i?.hex ?? ""}|${s === void 0 ? "" : String(s)}`, style: Ls(q.defaultsDeep(t, q.cloneDeep(Rs))) };
|
|
2570
2570
|
}
|
|
2571
|
-
const
|
|
2572
|
-
function
|
|
2573
|
-
for (const e of
|
|
2574
|
-
const t = q.get(l, e), i =
|
|
2571
|
+
const So = ["line.color", "arrowHead.color", "arrowTail.color"];
|
|
2572
|
+
function Ls(l) {
|
|
2573
|
+
for (const e of So) {
|
|
2574
|
+
const t = q.get(l, e), i = Ss(typeof t == "string" ? t : void 0);
|
|
2575
2575
|
i !== null && ke(l, e, i.hex);
|
|
2576
2576
|
}
|
|
2577
2577
|
return l;
|
|
2578
2578
|
}
|
|
2579
|
-
const
|
|
2580
|
-
let
|
|
2581
|
-
function
|
|
2582
|
-
if (
|
|
2583
|
-
const l = q.cloneDeep(
|
|
2584
|
-
ke(l, "texture.color",
|
|
2585
|
-
meshKey:
|
|
2579
|
+
const Fs = "graphty-bootstrap";
|
|
2580
|
+
let Kt = null, Zt = null;
|
|
2581
|
+
function Ns() {
|
|
2582
|
+
if (Kt === null) {
|
|
2583
|
+
const l = q.cloneDeep(Os), e = Ss(typeof l.texture?.color == "string" ? l.texture.color : void 0);
|
|
2584
|
+
ke(l, "texture.color", ui), Kt = {
|
|
2585
|
+
meshKey: Fs,
|
|
2586
2586
|
style: l,
|
|
2587
2587
|
color: e === null ? null : { r: e.r, g: e.g, b: e.b, a: e.a }
|
|
2588
2588
|
};
|
|
2589
2589
|
}
|
|
2590
|
-
return
|
|
2590
|
+
return Kt;
|
|
2591
2591
|
}
|
|
2592
|
-
function
|
|
2593
|
-
return
|
|
2592
|
+
function Pt() {
|
|
2593
|
+
return Zt === null && (Zt = { meshKey: Fs, style: Ls(q.cloneDeep(Rs)) }), Zt;
|
|
2594
2594
|
}
|
|
2595
|
-
class
|
|
2595
|
+
class Eo {
|
|
2596
2596
|
constructor() {
|
|
2597
2597
|
this.paint = null, this.pendingNodes = /* @__PURE__ */ new Set(), this.pendingEdges = /* @__PURE__ */ new Set(), this.stopListening = null;
|
|
2598
2598
|
}
|
|
@@ -2659,7 +2659,7 @@ class vo {
|
|
|
2659
2659
|
*/
|
|
2660
2660
|
takeNodes() {
|
|
2661
2661
|
if (this.pendingNodes.size === 0)
|
|
2662
|
-
return
|
|
2662
|
+
return ji;
|
|
2663
2663
|
const e = [...this.pendingNodes];
|
|
2664
2664
|
return this.pendingNodes.clear(), e;
|
|
2665
2665
|
}
|
|
@@ -2669,7 +2669,7 @@ class vo {
|
|
|
2669
2669
|
*/
|
|
2670
2670
|
takeEdges() {
|
|
2671
2671
|
if (this.pendingEdges.size === 0)
|
|
2672
|
-
return
|
|
2672
|
+
return ji;
|
|
2673
2673
|
const e = [...this.pendingEdges];
|
|
2674
2674
|
return this.pendingEdges.clear(), e;
|
|
2675
2675
|
}
|
|
@@ -2694,7 +2694,7 @@ class vo {
|
|
|
2694
2694
|
*/
|
|
2695
2695
|
nodePaint(e) {
|
|
2696
2696
|
const { paint: t } = this;
|
|
2697
|
-
return t === null || e < 0 ? null :
|
|
2697
|
+
return t === null || e < 0 ? null : vo(t.styleOf("node", e), t.meshKeyOf("node", e));
|
|
2698
2698
|
}
|
|
2699
2699
|
/**
|
|
2700
2700
|
* What one edge is painted.
|
|
@@ -2703,7 +2703,7 @@ class vo {
|
|
|
2703
2703
|
*/
|
|
2704
2704
|
edgePaint(e) {
|
|
2705
2705
|
const { paint: t } = this;
|
|
2706
|
-
return t === null || e < 0 ? null :
|
|
2706
|
+
return t === null || e < 0 ? null : bo(t.styleOf("edge", e), t.meshKeyOf("edge", e));
|
|
2707
2707
|
}
|
|
2708
2708
|
/**
|
|
2709
2709
|
* How many distinct source meshes one kind of element needs.
|
|
@@ -2724,7 +2724,7 @@ const dt = class dt {
|
|
|
2724
2724
|
static registerShaders() {
|
|
2725
2725
|
if (this.shadersRegistered)
|
|
2726
2726
|
return;
|
|
2727
|
-
const e = typeof window < "u" && window.BABYLON?.Effect.ShadersStore, t =
|
|
2727
|
+
const e = typeof window < "u" && window.BABYLON?.Effect.ShadersStore, t = xe.ShadersStore, i = `
|
|
2728
2728
|
precision highp float;
|
|
2729
2729
|
|
|
2730
2730
|
// Attributes
|
|
@@ -2891,7 +2891,7 @@ void main(void) {
|
|
|
2891
2891
|
this.registeredScene = e;
|
|
2892
2892
|
const t = e.getEngine();
|
|
2893
2893
|
e.onBeforeRenderObservable.add(() => {
|
|
2894
|
-
const i = t.getRenderWidth(), s = t.getRenderHeight(), r = new
|
|
2894
|
+
const i = t.getRenderWidth(), s = t.getRenderHeight(), r = new Wr(i, s);
|
|
2895
2895
|
for (const a of this.activeMaterials)
|
|
2896
2896
|
try {
|
|
2897
2897
|
a.setVector2("resolution", r);
|
|
@@ -2941,7 +2941,7 @@ void main(void) {
|
|
|
2941
2941
|
const s = this.calculateDotPositions(e.points, 0.1), r = new H("circular-dots", t);
|
|
2942
2942
|
if (s.length === 0)
|
|
2943
2943
|
return r;
|
|
2944
|
-
const a = new
|
|
2944
|
+
const a = new Ee("dotMaterial", t), o = F.FromHexString(e.color);
|
|
2945
2945
|
a.diffuseColor = o, a.emissiveColor = o, a.alpha = e.opacity ?? 1, a.backFaceCulling = !1;
|
|
2946
2946
|
for (const n of s) {
|
|
2947
2947
|
const c = J.CreateDisc(
|
|
@@ -3119,7 +3119,7 @@ void main(void) {
|
|
|
3119
3119
|
r.positions = i.positions, r.indices = i.indices, r.uvs = i.uvs, r.applyToMesh(s), s.setVerticesData("direction", i.directions, !1, 3), s.setVerticesData("side", i.sides, !1, 1), s.setVerticesData("distance", i.distances, !1, 1), s.setVerticesData("segmentStart", i.segmentStarts, !1, 3), s.setVerticesData("segmentEnd", i.segmentEnds, !1, 3);
|
|
3120
3120
|
const a = [];
|
|
3121
3121
|
e.enableInstancing && a.push("#define INSTANCES");
|
|
3122
|
-
const o = new
|
|
3122
|
+
const o = new xt(
|
|
3123
3123
|
"customLineMaterial",
|
|
3124
3124
|
t,
|
|
3125
3125
|
{
|
|
@@ -3185,7 +3185,7 @@ void main(void) {
|
|
|
3185
3185
|
this.registerShaders();
|
|
3186
3186
|
const s = new H("custom-line-geometry", i), r = new B();
|
|
3187
3187
|
r.positions = e.positions, r.indices = e.indices, r.uvs = e.uvs, r.applyToMesh(s), s.setVerticesData("direction", e.directions, !1, 3), s.setVerticesData("side", e.sides, !1, 1), s.setVerticesData("distance", e.distances, !1, 1), s.setVerticesData("segmentStart", e.segmentStarts, !1, 3), s.setVerticesData("segmentEnd", e.segmentEnds, !1, 3);
|
|
3188
|
-
const a = new
|
|
3188
|
+
const a = new xt(
|
|
3189
3189
|
"customLineMaterial",
|
|
3190
3190
|
i,
|
|
3191
3191
|
{
|
|
@@ -3212,8 +3212,8 @@ void main(void) {
|
|
|
3212
3212
|
}
|
|
3213
3213
|
};
|
|
3214
3214
|
dt.shadersRegistered = !1, dt.activeMaterials = /* @__PURE__ */ new Set(), dt.registeredScene = null;
|
|
3215
|
-
let
|
|
3216
|
-
class
|
|
3215
|
+
let At = dt;
|
|
3216
|
+
class gi {
|
|
3217
3217
|
/**
|
|
3218
3218
|
* Apply 2D material to a mesh
|
|
3219
3219
|
*
|
|
@@ -3225,7 +3225,7 @@ class hi {
|
|
|
3225
3225
|
* @param scene - Babylon.js scene
|
|
3226
3226
|
*/
|
|
3227
3227
|
static apply2DMaterial(e, t, i, s) {
|
|
3228
|
-
const r = new
|
|
3228
|
+
const r = new Ee(`material-2d-${e.name}`, s), a = F.FromHexString(t);
|
|
3229
3229
|
r.emissiveColor = a, r.alpha = i, r.disableLighting = !0, r.backFaceCulling = !1, e.material = r, e.rotation.x = Math.PI / 2, e.metadata = e.metadata ?? {}, e.metadata.is2D = !0;
|
|
3230
3230
|
}
|
|
3231
3231
|
/**
|
|
@@ -3282,7 +3282,7 @@ const Le = class Le {
|
|
|
3282
3282
|
* Register filled arrow shaders
|
|
3283
3283
|
*/
|
|
3284
3284
|
static registerShaders() {
|
|
3285
|
-
this.shadersRegistered || (
|
|
3285
|
+
this.shadersRegistered || (xe.ShadersStore.filledArrowVertexShader = `
|
|
3286
3286
|
precision highp float;
|
|
3287
3287
|
|
|
3288
3288
|
// Attributes
|
|
@@ -3324,7 +3324,7 @@ void main() {
|
|
|
3324
3324
|
// Transform to clip space
|
|
3325
3325
|
gl_Position = viewProjection * worldPos;
|
|
3326
3326
|
}
|
|
3327
|
-
`,
|
|
3327
|
+
`, xe.ShadersStore.filledArrowFragmentShader = `
|
|
3328
3328
|
precision highp float;
|
|
3329
3329
|
|
|
3330
3330
|
// Uniforms
|
|
@@ -3855,7 +3855,7 @@ void main() {
|
|
|
3855
3855
|
*/
|
|
3856
3856
|
static applyShader(e, t, i) {
|
|
3857
3857
|
this.registerShaders();
|
|
3858
|
-
const s = new
|
|
3858
|
+
const s = new xt(
|
|
3859
3859
|
"filledArrowMaterial",
|
|
3860
3860
|
i,
|
|
3861
3861
|
{
|
|
@@ -3931,7 +3931,7 @@ void main() {
|
|
|
3931
3931
|
e.alwaysSelectAsActiveMesh = !0;
|
|
3932
3932
|
return;
|
|
3933
3933
|
}
|
|
3934
|
-
e.alwaysSelectAsActiveMesh = !1, e.setBoundingInfo(new
|
|
3934
|
+
e.alwaysSelectAsActiveMesh = !1, e.setBoundingInfo(new jr(new v(-a, -a, -a), new v(a, a, a)));
|
|
3935
3935
|
}
|
|
3936
3936
|
/**
|
|
3937
3937
|
* Set the line direction for a filled arrow mesh
|
|
@@ -3957,7 +3957,7 @@ void main() {
|
|
|
3957
3957
|
*/
|
|
3958
3958
|
static create2DArrow(e, t, i, s, r, a) {
|
|
3959
3959
|
const o = this.getGeometryForType(e, a), n = new H(`arrow-2d-${e}`, a);
|
|
3960
|
-
return o.applyToMesh(n), n.scaling.setAll(t),
|
|
3960
|
+
return o.applyToMesh(n), n.scaling.setAll(t), gi.apply2DMaterial(n, s, r, a), n;
|
|
3961
3961
|
}
|
|
3962
3962
|
/**
|
|
3963
3963
|
* Get geometry for a specific arrow type
|
|
@@ -4018,19 +4018,19 @@ void main() {
|
|
|
4018
4018
|
};
|
|
4019
4019
|
Le.shadersRegistered = !1, Le.activeMaterials = /* @__PURE__ */ new Set(), Le.cameraCallbackRegistered = !1;
|
|
4020
4020
|
let _ = Le;
|
|
4021
|
-
function
|
|
4021
|
+
function Co(l) {
|
|
4022
4022
|
return l + l * 0.5;
|
|
4023
4023
|
}
|
|
4024
|
-
function
|
|
4024
|
+
function Mo(l, e, t) {
|
|
4025
4025
|
if (t !== void 0)
|
|
4026
4026
|
return Math.max(2, Math.floor(t));
|
|
4027
4027
|
const i = l - 2 * e;
|
|
4028
4028
|
if (i < 0)
|
|
4029
4029
|
return 2;
|
|
4030
|
-
const s =
|
|
4030
|
+
const s = Co(e), r = s - e, a = Math.floor((i - r) / s);
|
|
4031
4031
|
return 2 + Math.max(0, a);
|
|
4032
4032
|
}
|
|
4033
|
-
function
|
|
4033
|
+
function xo(l, e, t) {
|
|
4034
4034
|
const i = e / 2, s = i, r = l - i;
|
|
4035
4035
|
if (t <= 2)
|
|
4036
4036
|
return [s, r];
|
|
@@ -4040,7 +4040,7 @@ function Eo(l, e, t) {
|
|
|
4040
4040
|
u.push(p), p += e + d;
|
|
4041
4041
|
return u.push(r), u;
|
|
4042
4042
|
}
|
|
4043
|
-
const
|
|
4043
|
+
const ye = class ye {
|
|
4044
4044
|
/**
|
|
4045
4045
|
* Creates a new patterned line mesh
|
|
4046
4046
|
* @param pattern - The pattern type to render
|
|
@@ -4079,7 +4079,7 @@ const fe = class fe {
|
|
|
4079
4079
|
clipLastSegment(e) {
|
|
4080
4080
|
if (this.is2DMode)
|
|
4081
4081
|
return;
|
|
4082
|
-
const t = this.meshes.length - 1, i = this.meshes[t], s = t *
|
|
4082
|
+
const t = this.meshes.length - 1, i = this.meshes[t], s = t * ye.SEGMENT_LENGTH, r = Math.max(0, e - s), a = i.material;
|
|
4083
4083
|
r > 0.74 ? a.setFloat("clipEndX", -1) : a.setFloat("clipEndX", r), i.scaling.set(1, 1, 1);
|
|
4084
4084
|
}
|
|
4085
4085
|
/**
|
|
@@ -4109,7 +4109,7 @@ const fe = class fe {
|
|
|
4109
4109
|
*/
|
|
4110
4110
|
dispose() {
|
|
4111
4111
|
for (const e of this.meshes)
|
|
4112
|
-
|
|
4112
|
+
ye.disposePatternMesh(e);
|
|
4113
4113
|
this.meshes = [], this.isDisposed = !0;
|
|
4114
4114
|
}
|
|
4115
4115
|
/**
|
|
@@ -4124,7 +4124,7 @@ const fe = class fe {
|
|
|
4124
4124
|
*/
|
|
4125
4125
|
static disposePatternMesh(e) {
|
|
4126
4126
|
const { material: t } = e;
|
|
4127
|
-
t instanceof
|
|
4127
|
+
t instanceof xt && ft.releaseMaterial(t), e.dispose(!1, !0);
|
|
4128
4128
|
}
|
|
4129
4129
|
/**
|
|
4130
4130
|
* Create initial pattern meshes based on line length
|
|
@@ -4170,7 +4170,7 @@ const fe = class fe {
|
|
|
4170
4170
|
const r = s - i;
|
|
4171
4171
|
for (let a = 0; a < r; a++) {
|
|
4172
4172
|
const o = this.meshes.pop();
|
|
4173
|
-
o &&
|
|
4173
|
+
o && ye.disposePatternMesh(o);
|
|
4174
4174
|
}
|
|
4175
4175
|
}
|
|
4176
4176
|
}
|
|
@@ -4215,7 +4215,7 @@ const fe = class fe {
|
|
|
4215
4215
|
*/
|
|
4216
4216
|
calculateDiscretePositions(e, t) {
|
|
4217
4217
|
const i = t.subtract(e).normalize(), s = v.Distance(e, t), r = this.getRenderedMeshSize();
|
|
4218
|
-
return
|
|
4218
|
+
return xo(s, r, this.meshes.length).map((o) => e.add(i.scale(o)));
|
|
4219
4219
|
}
|
|
4220
4220
|
/**
|
|
4221
4221
|
* Calculate positions for connected patterns (sinewave, zigzag)
|
|
@@ -4231,7 +4231,7 @@ const fe = class fe {
|
|
|
4231
4231
|
calculateConnectedPositions(e, t, i) {
|
|
4232
4232
|
const s = t.subtract(e).normalize(), r = this.meshes.length, a = [];
|
|
4233
4233
|
for (let o = 0; o < r; o++) {
|
|
4234
|
-
const n = o *
|
|
4234
|
+
const n = o * ye.SEGMENT_LENGTH;
|
|
4235
4235
|
a.push(e.add(s.scale(n)));
|
|
4236
4236
|
}
|
|
4237
4237
|
return a;
|
|
@@ -4282,10 +4282,10 @@ const fe = class fe {
|
|
|
4282
4282
|
*/
|
|
4283
4283
|
calculateOptimalMeshCount(e, t) {
|
|
4284
4284
|
if (t.connected) {
|
|
4285
|
-
const i = Math.ceil(e /
|
|
4285
|
+
const i = Math.ceil(e / ye.SEGMENT_LENGTH);
|
|
4286
4286
|
return Math.max(1, i);
|
|
4287
4287
|
}
|
|
4288
|
-
return
|
|
4288
|
+
return Mo(e, this.getRenderedMeshSize(), this.patternCount);
|
|
4289
4289
|
}
|
|
4290
4290
|
/**
|
|
4291
4291
|
* Create a single pattern mesh
|
|
@@ -4314,8 +4314,8 @@ const fe = class fe {
|
|
|
4314
4314
|
return t.connected && !this.is2DMode && s.material.setFloat("clipEndX", -1), s;
|
|
4315
4315
|
}
|
|
4316
4316
|
};
|
|
4317
|
-
|
|
4318
|
-
let te =
|
|
4317
|
+
ye.SEGMENT_LENGTH = 0.75;
|
|
4318
|
+
let te = ye;
|
|
4319
4319
|
const he = {
|
|
4320
4320
|
dot: {
|
|
4321
4321
|
shapes: [{ type: "circle", size: 1 }],
|
|
@@ -4361,7 +4361,7 @@ const he = {
|
|
|
4361
4361
|
connected: !0
|
|
4362
4362
|
// Connected pattern - no gaps between segments
|
|
4363
4363
|
}
|
|
4364
|
-
},
|
|
4364
|
+
}, Lt = class Lt {
|
|
4365
4365
|
/**
|
|
4366
4366
|
* Unregister a pattern material so the per-frame camera-uniform walk stops visiting it.
|
|
4367
4367
|
*
|
|
@@ -4452,7 +4452,7 @@ const he = {
|
|
|
4452
4452
|
if (he[e].connected) {
|
|
4453
4453
|
const p = this.createConnectedSegmentGeometry(e, t, o), m = `pattern-${e}`, y = new H(m, r);
|
|
4454
4454
|
if (p.applyToMesh(y), n) {
|
|
4455
|
-
|
|
4455
|
+
gi.apply2DMaterial(y, i, s, r);
|
|
4456
4456
|
const w = y.getVerticesData("position"), S = y.getIndices();
|
|
4457
4457
|
if (w && S && !y.getVerticesData("normal")) {
|
|
4458
4458
|
const x = [];
|
|
@@ -4467,7 +4467,7 @@ const he = {
|
|
|
4467
4467
|
}
|
|
4468
4468
|
const h = a ? this.getGeometryForShapeType(a) : this.getGeometryForPattern(e), d = a ? `pattern-${e}-${a}` : `pattern-${e}`, u = new H(d, r);
|
|
4469
4469
|
if (h.applyToMesh(u), n) {
|
|
4470
|
-
|
|
4470
|
+
gi.apply2DMaterial(u, i, s, r);
|
|
4471
4471
|
const p = this.getGeometryDiameter(e, a), m = t / p;
|
|
4472
4472
|
u.scaling.set(m, m, m);
|
|
4473
4473
|
const y = u.getVerticesData("position"), w = u.getIndices();
|
|
@@ -4860,9 +4860,9 @@ const he = {
|
|
|
4860
4860
|
}));
|
|
4861
4861
|
}
|
|
4862
4862
|
};
|
|
4863
|
-
|
|
4864
|
-
let ft =
|
|
4865
|
-
class
|
|
4863
|
+
Lt.activeMaterials = /* @__PURE__ */ new Set(), Lt.cameraCallbackRegistered = !1;
|
|
4864
|
+
let ft = Lt;
|
|
4865
|
+
class ks {
|
|
4866
4866
|
/**
|
|
4867
4867
|
* Create a 2D line mesh
|
|
4868
4868
|
*
|
|
@@ -4879,7 +4879,7 @@ class Fs {
|
|
|
4879
4879
|
static create(e, t, i, s, r, a) {
|
|
4880
4880
|
const o = new H("line-2d", a), n = t.subtract(e), c = n.length();
|
|
4881
4881
|
this.createUnitRectangle(o);
|
|
4882
|
-
const h = new
|
|
4882
|
+
const h = new Ee(`line-2d-material-${Date.now()}`, a), d = F.FromHexString(s);
|
|
4883
4883
|
h.emissiveColor = d, h.alpha = r, h.disableLighting = !0, h.backFaceCulling = !1, o.material = h;
|
|
4884
4884
|
const u = e.add(t).scale(0.5);
|
|
4885
4885
|
o.position = u, o.scaling = new v(c, i, 1);
|
|
@@ -4939,7 +4939,7 @@ class Fs {
|
|
|
4939
4939
|
}
|
|
4940
4940
|
const Fe = class Fe {
|
|
4941
4941
|
static _registerShaders() {
|
|
4942
|
-
this.shadersRegistered || (
|
|
4942
|
+
this.shadersRegistered || (xe.ShadersStore.dotArrowScreenSpaceVertexShader = `
|
|
4943
4943
|
precision highp float;
|
|
4944
4944
|
|
|
4945
4945
|
attribute vec3 position;
|
|
@@ -4973,7 +4973,7 @@ void main() {
|
|
|
4973
4973
|
gl_Position = centerClip;
|
|
4974
4974
|
gl_Position.xy += offset;
|
|
4975
4975
|
}
|
|
4976
|
-
`,
|
|
4976
|
+
`, xe.ShadersStore.dotArrowScreenSpaceFragmentShader = `
|
|
4977
4977
|
precision highp float;
|
|
4978
4978
|
|
|
4979
4979
|
varying vec2 vUV;
|
|
@@ -4993,7 +4993,7 @@ void main() {
|
|
|
4993
4993
|
|
|
4994
4994
|
gl_FragColor = vec4(arrowColor, 1.0);
|
|
4995
4995
|
}
|
|
4996
|
-
`,
|
|
4996
|
+
`, xe.ShadersStore.veeArrowVertexShader = `
|
|
4997
4997
|
precision highp float;
|
|
4998
4998
|
|
|
4999
4999
|
attribute vec3 position;
|
|
@@ -5007,7 +5007,7 @@ void main() {
|
|
|
5007
5007
|
vUV = uv;
|
|
5008
5008
|
gl_Position = worldViewProjection * vec4(position, 1.0);
|
|
5009
5009
|
}
|
|
5010
|
-
`,
|
|
5010
|
+
`, xe.ShadersStore.veeArrowFragmentShader = `
|
|
5011
5011
|
precision highp float;
|
|
5012
5012
|
|
|
5013
5013
|
varying vec2 vUV;
|
|
@@ -5094,7 +5094,7 @@ void main() {
|
|
|
5094
5094
|
const h = this.createBezierLine(r, a), d = [];
|
|
5095
5095
|
for (let m = 0; m < h.length; m += 3)
|
|
5096
5096
|
d.push(new v(h[m], h[m + 1], h[m + 2]));
|
|
5097
|
-
const u = i.line, p =
|
|
5097
|
+
const u = i.line, p = At.create(
|
|
5098
5098
|
{
|
|
5099
5099
|
points: d,
|
|
5100
5100
|
width: t.width * 20,
|
|
@@ -5124,7 +5124,7 @@ void main() {
|
|
|
5124
5124
|
// undefined means follow the spacing rule
|
|
5125
5125
|
);
|
|
5126
5126
|
if (o === "solid" && this.is2DMode(s))
|
|
5127
|
-
return
|
|
5127
|
+
return ks.create(
|
|
5128
5128
|
new v(0, 0, -0.5),
|
|
5129
5129
|
// Placeholder start (Edge.update() will set real positions)
|
|
5130
5130
|
new v(0, 0, 0.5),
|
|
@@ -5218,7 +5218,7 @@ void main() {
|
|
|
5218
5218
|
segments: 16
|
|
5219
5219
|
},
|
|
5220
5220
|
a
|
|
5221
|
-
), u = new
|
|
5221
|
+
), u = new Ee("sphere-dot-material-3d", a);
|
|
5222
5222
|
return u.diffuseColor = F.FromHexString(s), u.emissiveColor = F.FromHexString(s), u.disableLighting = !0, d.material = u, d.visibility = r, d;
|
|
5223
5223
|
}
|
|
5224
5224
|
case "vee":
|
|
@@ -5261,7 +5261,7 @@ void main() {
|
|
|
5261
5261
|
const a = [
|
|
5262
5262
|
new v(this.UNIT_VECTOR_POINTS[0], this.UNIT_VECTOR_POINTS[1], this.UNIT_VECTOR_POINTS[2]),
|
|
5263
5263
|
new v(this.UNIT_VECTOR_POINTS[3], this.UNIT_VECTOR_POINTS[4], this.UNIT_VECTOR_POINTS[5])
|
|
5264
|
-
], o =
|
|
5264
|
+
], o = At.create(
|
|
5265
5265
|
{
|
|
5266
5266
|
points: a,
|
|
5267
5267
|
width: e.width * 20,
|
|
@@ -5275,7 +5275,7 @@ void main() {
|
|
|
5275
5275
|
);
|
|
5276
5276
|
return t.line?.opacity !== void 0 && (o.visibility = t.line.opacity), o;
|
|
5277
5277
|
}
|
|
5278
|
-
const r =
|
|
5278
|
+
const r = Gi(
|
|
5279
5279
|
"edge-plain",
|
|
5280
5280
|
{
|
|
5281
5281
|
points: this.UNIT_VECTOR_POINTS
|
|
@@ -5289,31 +5289,31 @@ void main() {
|
|
|
5289
5289
|
return t.line?.opacity !== void 0 && (r.visibility = t.line.opacity), r;
|
|
5290
5290
|
}
|
|
5291
5291
|
static createAnimatedLine(e, t, i) {
|
|
5292
|
-
const s = F.FromHexString(ee.MOVING_LINE_BASE_COLOR), r = F.FromHexString(e.color), a = this.createAnimatedTexture(s, r, i), o =
|
|
5292
|
+
const s = F.FromHexString(ee.MOVING_LINE_BASE_COLOR), r = F.FromHexString(e.color), a = this.createAnimatedTexture(s, r, i), o = Gi(
|
|
5293
5293
|
"edge-moving",
|
|
5294
5294
|
{
|
|
5295
5295
|
points: this.UNIT_VECTOR_POINTS
|
|
5296
5296
|
},
|
|
5297
5297
|
{
|
|
5298
5298
|
width: e.width,
|
|
5299
|
-
colorMode:
|
|
5299
|
+
colorMode: qr.COLOR_MODE_MULTIPLY
|
|
5300
5300
|
},
|
|
5301
5301
|
i
|
|
5302
5302
|
);
|
|
5303
5303
|
return this.applyAnimatedTexture(o, a, i, t.line?.animationSpeed), t.line?.opacity !== void 0 && (o.visibility = t.line.opacity), o;
|
|
5304
5304
|
}
|
|
5305
5305
|
static createAnimatedTexture(e, t, i) {
|
|
5306
|
-
const s = Math.floor(e.r * 255), r = Math.floor(e.g * 255), a = Math.floor(e.b * 255), o = Math.floor(t.r * 255), n = Math.floor(t.g * 255), c = Math.floor(t.b * 255), h = new Uint8Array([s, r, a, o, n, c]), d = new
|
|
5306
|
+
const s = Math.floor(e.r * 255), r = Math.floor(e.g * 255), a = Math.floor(e.b * 255), o = Math.floor(t.r * 255), n = Math.floor(t.g * 255), c = Math.floor(t.b * 255), h = new Uint8Array([s, r, a, o, n, c]), d = new Ni(
|
|
5307
5307
|
h,
|
|
5308
5308
|
h.length / 3,
|
|
5309
5309
|
1,
|
|
5310
|
-
|
|
5310
|
+
Tt.TEXTUREFORMAT_RGB,
|
|
5311
5311
|
i,
|
|
5312
5312
|
!1,
|
|
5313
5313
|
!0,
|
|
5314
|
-
|
|
5314
|
+
Tt.TEXTURE_NEAREST_NEAREST
|
|
5315
5315
|
);
|
|
5316
|
-
return d.wrapU =
|
|
5316
|
+
return d.wrapU = Ni.WRAP_ADDRESSMODE, d.name = "moving-texture", d;
|
|
5317
5317
|
}
|
|
5318
5318
|
static applyAnimatedTexture(e, t, i, s) {
|
|
5319
5319
|
const r = e.material;
|
|
@@ -5524,7 +5524,7 @@ void main() {
|
|
|
5524
5524
|
};
|
|
5525
5525
|
Fe.UNIT_VECTOR_POINTS = [0, 0, -0.5, 0, 0, 0.5], Fe.shadersRegistered = !1, Fe.USE_CUSTOM_RENDERER = !0;
|
|
5526
5526
|
let G = Fe;
|
|
5527
|
-
class
|
|
5527
|
+
class To {
|
|
5528
5528
|
/**
|
|
5529
5529
|
* Creates a speech bubble path with pointer in clockwise direction
|
|
5530
5530
|
* @param ctx - Canvas rendering context
|
|
@@ -5819,7 +5819,7 @@ class Co {
|
|
|
5819
5819
|
) : (e.lineTo(t + s + n, d), e.lineTo(t + s, Math.max(d - o / 2, i + a))), e.lineTo(t + s, i + a), e.quadraticCurveTo(t + s, i, t + s - a, i);
|
|
5820
5820
|
}
|
|
5821
5821
|
}
|
|
5822
|
-
class
|
|
5822
|
+
class Po {
|
|
5823
5823
|
/**
|
|
5824
5824
|
* Creates a new rich text animator
|
|
5825
5825
|
* @param scene - Babylon.js scene
|
|
@@ -5904,7 +5904,7 @@ class Mo {
|
|
|
5904
5904
|
this.sceneCallback && (this.scene.unregisterBeforeRender(this.sceneCallback), this.sceneCallback = null);
|
|
5905
5905
|
}
|
|
5906
5906
|
}
|
|
5907
|
-
class
|
|
5907
|
+
class Ao {
|
|
5908
5908
|
/**
|
|
5909
5909
|
* Creates a new rich text parser
|
|
5910
5910
|
* @param defaultStyle - Default text style to use as base
|
|
@@ -5995,7 +5995,7 @@ class xo {
|
|
|
5995
5995
|
return { maxWidth: s, totalHeight: r };
|
|
5996
5996
|
}
|
|
5997
5997
|
}
|
|
5998
|
-
class
|
|
5998
|
+
class Oo {
|
|
5999
5999
|
/**
|
|
6000
6000
|
* Creates a new rich text renderer
|
|
6001
6001
|
* @param options - Rendering configuration options
|
|
@@ -6062,7 +6062,7 @@ class To {
|
|
|
6062
6062
|
e.save(), e.strokeStyle = this.options.textOutlineColor, e.lineWidth = this.options.textOutlineWidth * 2, e.lineJoin = this.options.textOutlineJoin, e.miterLimit = 2, e.strokeText(t, i, s), e.restore();
|
|
6063
6063
|
}
|
|
6064
6064
|
}
|
|
6065
|
-
const
|
|
6065
|
+
const Ro = 1;
|
|
6066
6066
|
class ct {
|
|
6067
6067
|
/**
|
|
6068
6068
|
* Creates a new rich text label
|
|
@@ -6143,14 +6143,14 @@ class ct {
|
|
|
6143
6143
|
color: s.borderColor,
|
|
6144
6144
|
spacing: 0
|
|
6145
6145
|
}
|
|
6146
|
-
]), this.options = s, this.id = `richLabel_${Math.random().toString(36).substring(2, 11)}`, t.progress !== void 0 && (this._progressValue = Math.max(0, Math.min(1, t.progress))), this.parser = new
|
|
6146
|
+
]), this.options = s, this.id = `richLabel_${Math.random().toString(36).substring(2, 11)}`, t.progress !== void 0 && (this._progressValue = Math.max(0, Math.min(1, t.progress))), this.parser = new Ao({
|
|
6147
6147
|
font: this.options.font,
|
|
6148
6148
|
size: this.options.fontSize,
|
|
6149
6149
|
weight: this.options.fontWeight,
|
|
6150
6150
|
style: "normal",
|
|
6151
6151
|
color: this.options.textColor,
|
|
6152
6152
|
background: null
|
|
6153
|
-
}), this.renderer = new
|
|
6153
|
+
}), this.renderer = new Oo({
|
|
6154
6154
|
textAlignment: this.options.textAlign,
|
|
6155
6155
|
marginLeft: this.options.marginLeft,
|
|
6156
6156
|
marginRight: this.options.marginRight,
|
|
@@ -6167,7 +6167,7 @@ class ct {
|
|
|
6167
6167
|
textOutlineColor: this.options.textOutlineColor,
|
|
6168
6168
|
textOutlineWidth: this.options.textOutlineWidth,
|
|
6169
6169
|
textOutlineJoin: this.options.textOutlineJoin
|
|
6170
|
-
}), this.pointerRenderer = new
|
|
6170
|
+
}), this.pointerRenderer = new To(), this.options.animation !== "none" && (this.animator = new Po(this.scene, {
|
|
6171
6171
|
animation: this.options.animation,
|
|
6172
6172
|
animationSpeed: this.options.animationSpeed
|
|
6173
6173
|
})), this._create();
|
|
@@ -6250,7 +6250,7 @@ class ct {
|
|
|
6250
6250
|
`RichTextLabel: Texture size clamped to ${t}x${s} (max: 4096)`
|
|
6251
6251
|
);
|
|
6252
6252
|
}
|
|
6253
|
-
this.texture = new
|
|
6253
|
+
this.texture = new vs(
|
|
6254
6254
|
`richTextTexture_${this.id}`,
|
|
6255
6255
|
{
|
|
6256
6256
|
width: t,
|
|
@@ -6258,7 +6258,7 @@ class ct {
|
|
|
6258
6258
|
},
|
|
6259
6259
|
this.scene,
|
|
6260
6260
|
!0
|
|
6261
|
-
), this.texture.hasAlpha = !0, this.texture.updateSamplingMode(
|
|
6261
|
+
), this.texture.hasAlpha = !0, this.texture.updateSamplingMode(Kr.TRILINEAR_SAMPLINGMODE), this._drawContent();
|
|
6262
6262
|
}
|
|
6263
6263
|
_drawContent() {
|
|
6264
6264
|
if (!this.texture)
|
|
@@ -6445,7 +6445,7 @@ class ct {
|
|
|
6445
6445
|
e.beginPath(), e.moveTo(t + o, i), e.lineTo(t + s - o, i), e.quadraticCurveTo(t + s, i, t + s, i + o), e.lineTo(t + s, i + r - o), e.quadraticCurveTo(t + s, i + r, t + s - o, i + r), e.lineTo(t + o, i + r), e.quadraticCurveTo(t, i + r, t, i + r - o), e.lineTo(t, i + o), e.quadraticCurveTo(t, i, t + o, i), e.closePath();
|
|
6446
6446
|
}
|
|
6447
6447
|
_createMaterial() {
|
|
6448
|
-
this.material = new
|
|
6448
|
+
this.material = new Ee(`richTextMaterial_${this.id}`, this.scene), this.texture && (this.material.diffuseTexture = this.texture), this.material.specularColor = new F(0, 0, 0), this.options.animation !== "glow" ? this.material.emissiveColor = new F(1, 1, 1) : this.material.emissiveColor = new F(0.65, 0.65, 0.65), this.material.backFaceCulling = !1, this.material.useAlphaFromDiffuseTexture = !0, this.material.alphaMode = Tt.ALPHA_COMBINE;
|
|
6449
6449
|
}
|
|
6450
6450
|
_createMesh() {
|
|
6451
6451
|
const e = this.options.fontSize / 48, t = this.actualDimensions.width / this.actualDimensions.height, i = e, s = t * e;
|
|
@@ -6457,7 +6457,7 @@ class ct {
|
|
|
6457
6457
|
sideOrientation: H.DOUBLESIDE
|
|
6458
6458
|
},
|
|
6459
6459
|
this.scene
|
|
6460
|
-
), this.mesh.material = this.material, this.mesh.billboardMode = this.options.billboardMode, this.options.onTop === !0 && (this.mesh.renderingGroupId =
|
|
6460
|
+
), this.mesh.material = this.material, this.mesh.billboardMode = this.options.billboardMode, this.options.onTop === !0 && (this.mesh.renderingGroupId = Ro);
|
|
6461
6461
|
}
|
|
6462
6462
|
_attachToTarget() {
|
|
6463
6463
|
const e = this.options.attachTo, t = this.options.attachPosition, i = this.options.attachOffset;
|
|
@@ -6469,7 +6469,7 @@ class ct {
|
|
|
6469
6469
|
min: s.clone(),
|
|
6470
6470
|
max: s.clone()
|
|
6471
6471
|
};
|
|
6472
|
-
else if (e && "getBoundingInfo" in e && e instanceof
|
|
6472
|
+
else if (e && "getBoundingInfo" in e && e instanceof Zr) {
|
|
6473
6473
|
this.mesh.parent = e, s = v.Zero();
|
|
6474
6474
|
const h = e.getBoundingInfo();
|
|
6475
6475
|
r = {
|
|
@@ -6644,11 +6644,11 @@ class ct {
|
|
|
6644
6644
|
return this.id;
|
|
6645
6645
|
}
|
|
6646
6646
|
}
|
|
6647
|
-
const
|
|
6648
|
-
function
|
|
6647
|
+
const qi = "center", Ki = 0, Xt = "top", Qt = 0.3;
|
|
6648
|
+
function Zi(l, e) {
|
|
6649
6649
|
return e !== null && l?.enabled === !0 ? l : void 0;
|
|
6650
6650
|
}
|
|
6651
|
-
class
|
|
6651
|
+
class Ot {
|
|
6652
6652
|
/**
|
|
6653
6653
|
* Creates a new Edge instance connecting two nodes.
|
|
6654
6654
|
* @param graph - The parent graph or graph context
|
|
@@ -6665,7 +6665,7 @@ class Tt {
|
|
|
6665
6665
|
* @param opts - Optional configuration options
|
|
6666
6666
|
*/
|
|
6667
6667
|
constructor(e, t, i, s, r, a, o = {}) {
|
|
6668
|
-
this.index = K, this.arrowMesh = null, this.arrowTailMesh = null, this.sessionPaint = null, this.label = null, this.arrowHeadText = null, this.arrowTailText = null, this._arrowHeadTextOffset =
|
|
6668
|
+
this.index = K, this.arrowMesh = null, this.arrowTailMesh = null, this.sessionPaint = null, this.label = null, this.arrowHeadText = null, this.arrowTailText = null, this._arrowHeadTextOffset = Qt, this._arrowTailTextOffset = Qt, this._arrowHeadTextAttachPosition = Xt, this._arrowTailTextAttachPosition = Xt, this._labelOffset = Ki, this._labelAttachPosition = qi, this.drawnStyle = null, this._loggedLineDirection = !1, this._lastSrcPos = null, this._lastDstPos = null, this.disposed = !1, this.renderVisible = !0, this.selected = !1, this.parentGraph = e, this.srcId = t, this.dstId = i, this.id = ps(s), this.opts = o, this.data = a;
|
|
6669
6669
|
const n = this.context.getDataManager().nodeCache.get(t);
|
|
6670
6670
|
if (!n)
|
|
6671
6671
|
throw new Error(
|
|
@@ -6676,7 +6676,7 @@ class Tt {
|
|
|
6676
6676
|
throw new Error(
|
|
6677
6677
|
`Attempting to create edge '${t}->${i}', Node '${i}' hasn't been created yet.`
|
|
6678
6678
|
);
|
|
6679
|
-
this.srcNode = n, this.dstNode = c, this.ray = new
|
|
6679
|
+
this.srcNode = n, this.dstNode = c, this.ray = new Xr(this.srcNode.mesh.position, this.dstNode.mesh.position.subtract(this.srcNode.mesh.position)), this.meshKey = r.meshKey;
|
|
6680
6680
|
const { style: h } = r;
|
|
6681
6681
|
this.drawnStyle = h, this.arrowMesh = G.createArrowHead(
|
|
6682
6682
|
this.context.getMeshCache(),
|
|
@@ -6765,7 +6765,7 @@ class Tt {
|
|
|
6765
6765
|
* @returns The resolved style.
|
|
6766
6766
|
*/
|
|
6767
6767
|
get currentStyle() {
|
|
6768
|
-
return this.sessionPaint?.style ??
|
|
6768
|
+
return this.sessionPaint?.style ?? Pt().style;
|
|
6769
6769
|
}
|
|
6770
6770
|
/**
|
|
6771
6771
|
* Updates the edge's visual representation based on current node positions and style changes.
|
|
@@ -6836,7 +6836,7 @@ class Tt {
|
|
|
6836
6836
|
*/
|
|
6837
6837
|
currentPaint() {
|
|
6838
6838
|
const e = this.context.getStylePainter?.();
|
|
6839
|
-
return (e?.owns === !0 ? this.sessionPaint ?? e.edgePaint(this.index) : null) ??
|
|
6839
|
+
return (e?.owns === !0 ? this.sessionPaint ?? e.edgePaint(this.index) : null) ?? Pt();
|
|
6840
6840
|
}
|
|
6841
6841
|
/**
|
|
6842
6842
|
* Draw this edge as the session's style stack resolved it.
|
|
@@ -6938,7 +6938,7 @@ class Tt {
|
|
|
6938
6938
|
}
|
|
6939
6939
|
this.drawnLabelText = r, this.drawnLabelStyle = s === void 0 ? void 0 : ie.cloneDeep(s), i = !0;
|
|
6940
6940
|
}
|
|
6941
|
-
const a =
|
|
6941
|
+
const a = Zi(e.arrowHead?.text, this.arrowMesh);
|
|
6942
6942
|
if (t || !ie.isEqual(a, this.drawnArrowHeadText)) {
|
|
6943
6943
|
if (this.arrowHeadText?.dispose(), this.arrowHeadText = null, a !== void 0) {
|
|
6944
6944
|
const { label: n, offset: c, attachPosition: h } = this.createArrowText(a, "arrowHead");
|
|
@@ -6946,7 +6946,7 @@ class Tt {
|
|
|
6946
6946
|
}
|
|
6947
6947
|
this.drawnArrowHeadText = a === void 0 ? void 0 : ie.cloneDeep(a), i = !0;
|
|
6948
6948
|
}
|
|
6949
|
-
const o =
|
|
6949
|
+
const o = Zi(e.arrowTail?.text, this.arrowTailMesh);
|
|
6950
6950
|
if (t || !ie.isEqual(o, this.drawnArrowTailText)) {
|
|
6951
6951
|
if (this.arrowTailText?.dispose(), this.arrowTailText = null, o !== void 0) {
|
|
6952
6952
|
const { label: n, offset: c, attachPosition: h } = this.createArrowText(o, "arrowTail");
|
|
@@ -7085,7 +7085,7 @@ class Tt {
|
|
|
7085
7085
|
* @param dstPoint - The destination point position
|
|
7086
7086
|
*/
|
|
7087
7087
|
transformEdgeMesh(e, t) {
|
|
7088
|
-
this.mesh instanceof te ? this.mesh.update(e, t) : this.mesh.metadata?.is2DLine ?
|
|
7088
|
+
this.mesh instanceof te ? this.mesh.update(e, t) : this.mesh.metadata?.is2DLine ? ks.updatePositions(this.mesh, e, t) : this.mesh.metadata?.isBezierCurve || G.transformMesh(this.mesh, e, t);
|
|
7089
7089
|
}
|
|
7090
7090
|
/**
|
|
7091
7091
|
* Calculates and applies transformations for arrow head and tail meshes.
|
|
@@ -7108,15 +7108,15 @@ class Tt {
|
|
|
7108
7108
|
this.context.getStatsManager().endMeasurement("Edge.transformArrowCap.styleAndGeometry"), this.context.getStatsManager().startMeasurement("Edge.transformArrowCap.vectorMath");
|
|
7109
7109
|
const k = u.add(m.scale(C)), U = p.subtract(m.scale(x)), $ = y.arrowHead?.type, X = G.getArrowGeometry($ ?? "normal");
|
|
7110
7110
|
this.arrowMesh.metadata?.is2D && X.scaleFactor !== void 0 && (X.scaleFactor = 1), this.arrowMesh.setEnabled(!0);
|
|
7111
|
-
const
|
|
7111
|
+
const Me = G.calculateArrowPosition(
|
|
7112
7112
|
U,
|
|
7113
7113
|
m,
|
|
7114
7114
|
S,
|
|
7115
7115
|
X
|
|
7116
7116
|
), Oe = G.calculateLineEndpoint(U, m, S, X);
|
|
7117
|
-
if (this.context.getStatsManager().endMeasurement("Edge.transformArrowCap.vectorMath"), this.arrowMesh.position =
|
|
7118
|
-
const
|
|
7119
|
-
this.arrowMesh.rotation.z =
|
|
7117
|
+
if (this.context.getStatsManager().endMeasurement("Edge.transformArrowCap.vectorMath"), this.arrowMesh.position = Me, this.arrowMesh.metadata?.is2D) {
|
|
7118
|
+
const kt = Math.atan2(m.y, m.x);
|
|
7119
|
+
this.arrowMesh.rotation.z = kt;
|
|
7120
7120
|
} else if ($ && [
|
|
7121
7121
|
"normal",
|
|
7122
7122
|
"inverted",
|
|
@@ -7132,8 +7132,8 @@ class Tt {
|
|
|
7132
7132
|
].includes($))
|
|
7133
7133
|
_.setLineDirection(this.arrowMesh, m);
|
|
7134
7134
|
else if (X.needsRotation) {
|
|
7135
|
-
const
|
|
7136
|
-
this.arrowMesh.lookAt(
|
|
7135
|
+
const kt = Me.add(m);
|
|
7136
|
+
this.arrowMesh.lookAt(kt);
|
|
7137
7137
|
}
|
|
7138
7138
|
return {
|
|
7139
7139
|
srcPoint: k,
|
|
@@ -7145,7 +7145,7 @@ class Tt {
|
|
|
7145
7145
|
this.arrowMesh.metadata?.is2D && n.scaleFactor !== void 0 && (n.scaleFactor = 1);
|
|
7146
7146
|
const c = t.subtract(e).normalize(), h = G.calculateArrowPosition(t, c, o, n);
|
|
7147
7147
|
if (this.context.getStatsManager().endMeasurement("Edge.transformArrowCap.mainPath"), this.arrowMesh.position = h, this.arrowMesh.metadata?.is2D) {
|
|
7148
|
-
const u = Math.atan2(c.y, c.x), p =
|
|
7148
|
+
const u = Math.atan2(c.y, c.x), p = oe.RotationAxis(v.Right(), Math.PI / 2), m = oe.RotationAxis(v.Forward(), u);
|
|
7149
7149
|
this.arrowMesh.rotationQuaternion = m.multiply(p);
|
|
7150
7150
|
} else if (r && [
|
|
7151
7151
|
"normal",
|
|
@@ -7180,7 +7180,7 @@ class Tt {
|
|
|
7180
7180
|
S
|
|
7181
7181
|
), C = c.scale(-1);
|
|
7182
7182
|
if (this.arrowTailMesh.position = x, this.arrowTailMesh.metadata?.is2D) {
|
|
7183
|
-
const k = Math.atan2(C.y, C.x), U =
|
|
7183
|
+
const k = Math.atan2(C.y, C.x), U = oe.RotationAxis(v.Right(), Math.PI / 2), $ = oe.RotationAxis(v.Forward(), k);
|
|
7184
7184
|
this.arrowTailMesh.rotationQuaternion = $.multiply(U);
|
|
7185
7185
|
} else if ([
|
|
7186
7186
|
"normal",
|
|
@@ -7270,7 +7270,7 @@ class Tt {
|
|
|
7270
7270
|
};
|
|
7271
7271
|
}
|
|
7272
7272
|
createLabel(e) {
|
|
7273
|
-
const t = this.extractLabelText(e.label), i = this.placementOf(e.label,
|
|
7273
|
+
const t = this.extractLabelText(e.label), i = this.placementOf(e.label, qi, Ki), s = this.createLabelOptions(t, e.label, i);
|
|
7274
7274
|
return {
|
|
7275
7275
|
label: new ct(this.context.getScene(), s),
|
|
7276
7276
|
offset: i.attachOffset,
|
|
@@ -7295,7 +7295,7 @@ class Tt {
|
|
|
7295
7295
|
return String(e.text);
|
|
7296
7296
|
} else if (e.textPath && typeof e.textPath == "string")
|
|
7297
7297
|
try {
|
|
7298
|
-
const t =
|
|
7298
|
+
const t = Js.search(this.data, e.textPath);
|
|
7299
7299
|
if (t != null)
|
|
7300
7300
|
return String(t);
|
|
7301
7301
|
} catch {
|
|
@@ -7371,7 +7371,7 @@ class Tt {
|
|
|
7371
7371
|
* @returns The caption, and where to hang it from the cap.
|
|
7372
7372
|
*/
|
|
7373
7373
|
createArrowText(e, t) {
|
|
7374
|
-
const i = t === "arrowHead" ? "→" : "←", s = this.extractLabelText(e), r = s === "" ? i : s, a = this.placementOf(e,
|
|
7374
|
+
const i = t === "arrowHead" ? "→" : "←", s = this.extractLabelText(e), r = s === "" ? i : s, a = this.placementOf(e, Xt, Qt), o = this.createLabelOptions(r, e, a);
|
|
7375
7375
|
return {
|
|
7376
7376
|
label: new ct(this.context.getScene(), o),
|
|
7377
7377
|
offset: a.attachOffset,
|
|
@@ -7379,8 +7379,8 @@ class Tt {
|
|
|
7379
7379
|
};
|
|
7380
7380
|
}
|
|
7381
7381
|
}
|
|
7382
|
-
const
|
|
7383
|
-
class
|
|
7382
|
+
const Io = Object.freeze([]);
|
|
7383
|
+
class Do {
|
|
7384
7384
|
constructor() {
|
|
7385
7385
|
this.map = /* @__PURE__ */ new Map();
|
|
7386
7386
|
}
|
|
@@ -7416,7 +7416,7 @@ class Oo {
|
|
|
7416
7416
|
* @returns The edges, which is an empty array when there are none
|
|
7417
7417
|
*/
|
|
7418
7418
|
get(e, t) {
|
|
7419
|
-
return this.map.get(e)?.get(t) ??
|
|
7419
|
+
return this.map.get(e)?.get(t) ?? Io;
|
|
7420
7420
|
}
|
|
7421
7421
|
/**
|
|
7422
7422
|
* The first edge running from one node to another, for a caller whose question has one answer.
|
|
@@ -7462,17 +7462,17 @@ class Oo {
|
|
|
7462
7462
|
this.map.clear();
|
|
7463
7463
|
}
|
|
7464
7464
|
}
|
|
7465
|
-
const
|
|
7466
|
-
function
|
|
7465
|
+
const Lo = "graphty";
|
|
7466
|
+
function Fo(l, e) {
|
|
7467
7467
|
return Object.entries(l).every(([t, i]) => e[t] === i);
|
|
7468
7468
|
}
|
|
7469
|
-
function
|
|
7469
|
+
function No(l, e) {
|
|
7470
7470
|
const t = l.legacyKeys.find(
|
|
7471
|
-
(i) => i.params !== void 0 &&
|
|
7471
|
+
(i) => i.params !== void 0 && Fo(i.params, e)
|
|
7472
7472
|
);
|
|
7473
7473
|
return t !== void 0 ? t : l.legacyKeys.find((i) => i.params === void 0) ?? l.legacyKeys[0];
|
|
7474
7474
|
}
|
|
7475
|
-
class
|
|
7475
|
+
class ko {
|
|
7476
7476
|
/**
|
|
7477
7477
|
* Creates an instance of AlgorithmManager
|
|
7478
7478
|
* @param eventManager - Event manager for emitting algorithm events
|
|
@@ -7517,9 +7517,9 @@ class Lo {
|
|
|
7517
7517
|
* @throws A `GraphtyError` when nothing registers the key, or whatever the work threw.
|
|
7518
7518
|
*/
|
|
7519
7519
|
async execute(e, t) {
|
|
7520
|
-
const i = t === void 0 ?
|
|
7520
|
+
const i = t === void 0 ? ii(e.algorithm) : void 0, s = t ?? i?.descriptor;
|
|
7521
7521
|
if (s === void 0)
|
|
7522
|
-
throw new
|
|
7522
|
+
throw new ae({
|
|
7523
7523
|
code: "E_UNKNOWN_ALGORITHM",
|
|
7524
7524
|
message: `No algorithm is registered under "${e.algorithm}".`,
|
|
7525
7525
|
source: "run",
|
|
@@ -7528,14 +7528,14 @@ class Lo {
|
|
|
7528
7528
|
});
|
|
7529
7529
|
const r = t === void 0 && i !== void 0 ? { namespace: i.namespace, type: i.type, options: e.params } : this.targetFor(t, e.params), a = N.get(this.graph, r.namespace, r.type, r.options);
|
|
7530
7530
|
if (a === null)
|
|
7531
|
-
throw new
|
|
7531
|
+
throw new ae({
|
|
7532
7532
|
code: "E_UNKNOWN_ALGORITHM",
|
|
7533
7533
|
message: `The "${e.algorithm}" algorithm resolves to "${r.namespace}:${r.type}", which nothing registers.`,
|
|
7534
7534
|
source: "run",
|
|
7535
7535
|
target: { kind: "run", id: e.runId },
|
|
7536
7536
|
details: { algorithm: e.algorithm, registryKey: `${r.namespace}:${r.type}` }
|
|
7537
7537
|
});
|
|
7538
|
-
const o = await this.compute(a, e, s), { caveats: n } = o.summary(), c =
|
|
7538
|
+
const o = await this.compute(a, e, s), { caveats: n } = o.summary(), c = Gr(this.graph.getDataManager()), h = c === 0 ? n : {
|
|
7539
7539
|
...n,
|
|
7540
7540
|
notes: [
|
|
7541
7541
|
...n.notes,
|
|
@@ -7633,8 +7633,8 @@ class Lo {
|
|
|
7633
7633
|
* @returns The target.
|
|
7634
7634
|
*/
|
|
7635
7635
|
targetFor(e, t) {
|
|
7636
|
-
const i =
|
|
7637
|
-
return { namespace:
|
|
7636
|
+
const i = No(e, t);
|
|
7637
|
+
return { namespace: Lo, type: i.key, options: { ...i.params, ...t } };
|
|
7638
7638
|
}
|
|
7639
7639
|
/**
|
|
7640
7640
|
* Do the work.
|
|
@@ -7657,23 +7657,23 @@ class Lo {
|
|
|
7657
7657
|
report: (r) => {
|
|
7658
7658
|
t.report(r);
|
|
7659
7659
|
},
|
|
7660
|
-
yieldNow:
|
|
7660
|
+
yieldNow: zo
|
|
7661
7661
|
},
|
|
7662
7662
|
t.runId,
|
|
7663
7663
|
i.fields
|
|
7664
|
-
) ??
|
|
7664
|
+
) ?? _o(t, i);
|
|
7665
7665
|
}
|
|
7666
7666
|
}
|
|
7667
|
-
function
|
|
7667
|
+
function zo() {
|
|
7668
7668
|
return new Promise((l) => {
|
|
7669
7669
|
setTimeout(l, 0);
|
|
7670
7670
|
});
|
|
7671
7671
|
}
|
|
7672
|
-
function
|
|
7673
|
-
return
|
|
7672
|
+
function _o(l, e) {
|
|
7673
|
+
return _r({
|
|
7674
7674
|
runId: l.runId,
|
|
7675
7675
|
shape: e.shape,
|
|
7676
|
-
fields: e.fields.map((t) => ({ ...t, path:
|
|
7676
|
+
fields: e.fields.map((t) => ({ ...t, path: Br(l.runId, t.name) })),
|
|
7677
7677
|
measured: { nodes: 0, edges: 0 },
|
|
7678
7678
|
caveats: {
|
|
7679
7679
|
exact: !0,
|
|
@@ -7687,27 +7687,27 @@ function No(l, e) {
|
|
|
7687
7687
|
durationMs: 0
|
|
7688
7688
|
});
|
|
7689
7689
|
}
|
|
7690
|
-
const
|
|
7690
|
+
const Jt = Object.freeze([
|
|
7691
7691
|
{ source: "source", target: "target", resolvedFrom: "source/target" },
|
|
7692
7692
|
{ source: "src", target: "dst", resolvedFrom: "src/dst" },
|
|
7693
7693
|
{ source: "from", target: "to", resolvedFrom: "from/to" }
|
|
7694
|
-
]),
|
|
7695
|
-
function
|
|
7694
|
+
]), Bo = 50;
|
|
7695
|
+
function ue(l, e) {
|
|
7696
7696
|
try {
|
|
7697
7697
|
return gt.search(l, e);
|
|
7698
7698
|
} catch {
|
|
7699
7699
|
return null;
|
|
7700
7700
|
}
|
|
7701
7701
|
}
|
|
7702
|
-
function
|
|
7702
|
+
function Uo(l) {
|
|
7703
7703
|
const e = /* @__PURE__ */ new Set();
|
|
7704
7704
|
for (const t of l)
|
|
7705
7705
|
for (const i of Object.keys(t))
|
|
7706
|
-
if (e.add(i), e.size >=
|
|
7706
|
+
if (e.add(i), e.size >= Bo)
|
|
7707
7707
|
return [...e];
|
|
7708
7708
|
return [...e];
|
|
7709
7709
|
}
|
|
7710
|
-
function
|
|
7710
|
+
function zs(l, e) {
|
|
7711
7711
|
if (e.source !== null && e.target !== null)
|
|
7712
7712
|
return { source: e.source, target: e.target, resolvedFrom: "declared" };
|
|
7713
7713
|
if (e.source !== null || e.target !== null)
|
|
@@ -7717,25 +7717,25 @@ function Ns(l, e) {
|
|
|
7717
7717
|
resolvedFrom: "declared"
|
|
7718
7718
|
};
|
|
7719
7719
|
if (l.length === 0)
|
|
7720
|
-
return
|
|
7721
|
-
for (const i of
|
|
7720
|
+
return Jt[0];
|
|
7721
|
+
for (const i of Jt)
|
|
7722
7722
|
for (const s of l) {
|
|
7723
|
-
const r =
|
|
7723
|
+
const r = ue(s, i.source), a = ue(s, i.target);
|
|
7724
7724
|
if (r != null && a !== null && a !== void 0)
|
|
7725
7725
|
return i;
|
|
7726
7726
|
}
|
|
7727
|
-
const t =
|
|
7728
|
-
throw new
|
|
7727
|
+
const t = Uo(l);
|
|
7728
|
+
throw new ae({
|
|
7729
7729
|
code: "E_EDGE_ENDPOINTS_UNRESOLVED",
|
|
7730
7730
|
source: "data",
|
|
7731
7731
|
message: `No edge endpoint columns found. The element looked for source/target, src/dst and from/to, and these records carry ${t.length === 0 ? "no top-level keys at all" : t.join(", ")}. Name the columns with data.knownFields.edgeSrcIdPath and edgeDstIdPath.`,
|
|
7732
|
-
details: { columns: t, tried:
|
|
7732
|
+
details: { columns: t, tried: Jt.map((i) => i.resolvedFrom), records: l.length }
|
|
7733
7733
|
});
|
|
7734
7734
|
}
|
|
7735
|
-
function
|
|
7735
|
+
function yt(l) {
|
|
7736
7736
|
return typeof l == "string" || typeof l == "number" && Number.isFinite(l);
|
|
7737
7737
|
}
|
|
7738
|
-
function
|
|
7738
|
+
function Go(l) {
|
|
7739
7739
|
const { position: e } = l;
|
|
7740
7740
|
if (e === null || typeof e != "object")
|
|
7741
7741
|
return null;
|
|
@@ -7750,30 +7750,30 @@ function _o(l) {
|
|
|
7750
7750
|
}
|
|
7751
7751
|
return typeof t != "number" || typeof i != "number" || typeof s != "number" || !Number.isFinite(t) || !Number.isFinite(i) || !Number.isFinite(s) ? null : [t, i, s];
|
|
7752
7752
|
}
|
|
7753
|
-
function
|
|
7754
|
-
if (!
|
|
7753
|
+
function $o(l, e, t) {
|
|
7754
|
+
if (!yt(e))
|
|
7755
7755
|
return { index: K, merged: !1 };
|
|
7756
|
-
const i = l.builder.nodeCount, s = l.builder.addNode(e), r = l.builder.nodeCount === i, a =
|
|
7756
|
+
const i = l.builder.nodeCount, s = l.builder.addNode(e), r = l.builder.nodeCount === i, a = Go(t);
|
|
7757
7757
|
return a !== null && l.builder.setNodeValue(l.seedColumn, s, a), l.touch(), { index: s, merged: r };
|
|
7758
7758
|
}
|
|
7759
|
-
function
|
|
7759
|
+
function Vo(l, e) {
|
|
7760
7760
|
const t = e === null ? void 0 : l[e];
|
|
7761
7761
|
if (typeof t == "number" && Number.isFinite(t))
|
|
7762
7762
|
return { weight: t, source: "path" };
|
|
7763
7763
|
const i = l.value;
|
|
7764
7764
|
return typeof i == "number" && Number.isFinite(i) ? { weight: i, source: "legacy" } : { weight: 1, source: "default" };
|
|
7765
7765
|
}
|
|
7766
|
-
function
|
|
7767
|
-
if (!
|
|
7766
|
+
function Ho(l, e, t, i) {
|
|
7767
|
+
if (!yt(e) || !yt(t))
|
|
7768
7768
|
return { index: K, edgeId: K };
|
|
7769
7769
|
const s = l.builder.addEdge(e, t, i), r = l.nextEdgeId();
|
|
7770
7770
|
return l.builder.setEdgeValue(l.edgeIdColumn, s, r), l.touch(), { index: s, edgeId: r };
|
|
7771
7771
|
}
|
|
7772
|
-
function
|
|
7772
|
+
function Wo(l, e, t) {
|
|
7773
7773
|
const { builder: i } = l;
|
|
7774
7774
|
return i.directed === e ? (i.directedLocked || l.recordDirectionFromFile(t), "unchanged") : i.directedLocked ? "config-wins" : i.edgeCount > 0 ? "edges-present" : (i.setDirected(e), l.recordDirectionFromFile(t), l.touch(), "applied");
|
|
7775
7775
|
}
|
|
7776
|
-
function
|
|
7776
|
+
function Xi() {
|
|
7777
7777
|
return {
|
|
7778
7778
|
nodeRecords: 0,
|
|
7779
7779
|
edgeRecords: 0,
|
|
@@ -7786,7 +7786,7 @@ function qi() {
|
|
|
7786
7786
|
weightsAttribute: null
|
|
7787
7787
|
};
|
|
7788
7788
|
}
|
|
7789
|
-
function
|
|
7789
|
+
function Qi(l, e) {
|
|
7790
7790
|
return Object.freeze({
|
|
7791
7791
|
format: e.format,
|
|
7792
7792
|
endpoints: Object.freeze({ ...e.endpoints }),
|
|
@@ -7810,7 +7810,7 @@ function Ki(l, e) {
|
|
|
7810
7810
|
})
|
|
7811
7811
|
});
|
|
7812
7812
|
}
|
|
7813
|
-
class
|
|
7813
|
+
class jo {
|
|
7814
7814
|
constructor() {
|
|
7815
7815
|
this.meshCacheMap = /* @__PURE__ */ new Map(), this.hits = 0, this.misses = 0;
|
|
7816
7816
|
}
|
|
@@ -7846,10 +7846,10 @@ class Vo {
|
|
|
7846
7846
|
return this.meshCacheMap.size;
|
|
7847
7847
|
}
|
|
7848
7848
|
}
|
|
7849
|
-
const
|
|
7850
|
-
class
|
|
7849
|
+
const qo = new v(1, 0, 0), Ko = new v(0, 1, 0), Zo = 16;
|
|
7850
|
+
class Rt {
|
|
7851
7851
|
constructor(e, t) {
|
|
7852
|
-
this.scene = e, this.context = t, this.passes = 0, this.entries = /* @__PURE__ */ new Map(), this.order = [], this.grid = /* @__PURE__ */ new Map(), this.columns = 1, this.rows = 1, this.dirty = !0, this.wasOn = !1, this.camera = null, this.view = new Float64Array(16), this.projection = new Float64Array(16), this.width = -1, this.height = -1, this.edgeVersion = -1, this.degrees = /* @__PURE__ */ new Map(), this.transform = new De(), this.toPixels = new De(), this.worldToPixels = new De(), this.viewport = new
|
|
7852
|
+
this.scene = e, this.context = t, this.passes = 0, this.entries = /* @__PURE__ */ new Map(), this.order = [], this.grid = /* @__PURE__ */ new Map(), this.columns = 1, this.rows = 1, this.dirty = !0, this.wasOn = !1, this.camera = null, this.view = new Float64Array(16), this.projection = new Float64Array(16), this.width = -1, this.height = -1, this.edgeVersion = -1, this.degrees = /* @__PURE__ */ new Map(), this.transform = new De(), this.toPixels = new De(), this.worldToPixels = new De(), this.viewport = new Qr(0, 0, 0, 0), this.right = new v(), this.up = new v(), this.centre = new v(), this.corner = new v(), this.centreOnScreen = new v(), this.cornerOnScreen = new v(), this.observer = e.onBeforeRenderObservable.add(() => {
|
|
7853
7853
|
this.run();
|
|
7854
7854
|
}), e.onDisposeObservable.addOnce(() => {
|
|
7855
7855
|
this.dispose();
|
|
@@ -7863,7 +7863,7 @@ class Pt {
|
|
|
7863
7863
|
* @param node - The node drawing a label.
|
|
7864
7864
|
*/
|
|
7865
7865
|
static track(e, t, i) {
|
|
7866
|
-
e.metadata = e.metadata ?? {}, e.metadata.labelDeclutter instanceof
|
|
7866
|
+
e.metadata = e.metadata ?? {}, e.metadata.labelDeclutter instanceof Rt || (e.metadata.labelDeclutter = new Rt(e, t));
|
|
7867
7867
|
const s = e.metadata.labelDeclutter;
|
|
7868
7868
|
s.dirty = !0, s.entries.has(i) || s.entries.set(i, {
|
|
7869
7869
|
node: i,
|
|
@@ -7926,7 +7926,7 @@ class Pt {
|
|
|
7926
7926
|
this.toPixels
|
|
7927
7927
|
), this.transform.multiplyToRef(this.toPixels, this.worldToPixels);
|
|
7928
7928
|
const a = e.getViewMatrix().m;
|
|
7929
|
-
e.getDirectionToRef(
|
|
7929
|
+
e.getDirectionToRef(qo, this.right), e.getDirectionToRef(Ko, this.up), this.refreshDegrees();
|
|
7930
7930
|
const { order: o } = this;
|
|
7931
7931
|
o.length = 0;
|
|
7932
7932
|
let n = 0, c = 0;
|
|
@@ -7944,8 +7944,8 @@ class Pt {
|
|
|
7944
7944
|
}
|
|
7945
7945
|
if (o.length === 0)
|
|
7946
7946
|
return;
|
|
7947
|
-
o.sort(
|
|
7948
|
-
const h = Math.max(
|
|
7947
|
+
o.sort(Xo);
|
|
7948
|
+
const h = Math.max(Zo, Math.max(n, c) / o.length);
|
|
7949
7949
|
this.columns = Math.max(1, Math.ceil(i.width / h)), this.rows = Math.max(1, Math.ceil(i.height / h));
|
|
7950
7950
|
for (const d of this.grid.values())
|
|
7951
7951
|
d.length = 0;
|
|
@@ -7963,7 +7963,7 @@ class Pt {
|
|
|
7963
7963
|
if (this.dirty || e !== this.camera)
|
|
7964
7964
|
return !0;
|
|
7965
7965
|
const t = this.scene.getEngine();
|
|
7966
|
-
if (t.getRenderWidth() !== this.width || t.getRenderHeight() !== this.height || this.context.getDataManager().edgeVersion !== this.edgeVersion || !
|
|
7966
|
+
if (t.getRenderWidth() !== this.width || t.getRenderHeight() !== this.height || this.context.getDataManager().edgeVersion !== this.edgeVersion || !Ji(e.getViewMatrix(), this.view) || !Ji(e.getProjectionMatrix(), this.projection))
|
|
7967
7967
|
return !0;
|
|
7968
7968
|
for (const i of this.entries.values()) {
|
|
7969
7969
|
const s = i.node.label?.labelMesh ?? null;
|
|
@@ -7989,9 +7989,9 @@ class Pt {
|
|
|
7989
7989
|
this.camera = e, this.width = t.getRenderWidth(), this.height = t.getRenderHeight(), this.view.set(e.getViewMatrix().m), this.projection.set(e.getProjectionMatrix().m);
|
|
7990
7990
|
}
|
|
7991
7991
|
isClear(e, t) {
|
|
7992
|
-
const { x: i, y: s } = this.viewport, r =
|
|
7993
|
-
for (let o =
|
|
7994
|
-
for (let n =
|
|
7992
|
+
const { x: i, y: s } = this.viewport, r = me(e.right - i, t, this.columns), a = me(e.bottom - s, t, this.rows);
|
|
7993
|
+
for (let o = me(e.left - i, t, this.columns); o <= r; o++)
|
|
7994
|
+
for (let n = me(e.top - s, t, this.rows); n <= a; n++) {
|
|
7995
7995
|
const c = this.grid.get(o * this.rows + n);
|
|
7996
7996
|
if (c) {
|
|
7997
7997
|
for (const h of c)
|
|
@@ -8002,9 +8002,9 @@ class Pt {
|
|
|
8002
8002
|
return !0;
|
|
8003
8003
|
}
|
|
8004
8004
|
keep(e, t) {
|
|
8005
|
-
const { x: i, y: s } = this.viewport, r =
|
|
8006
|
-
for (let o =
|
|
8007
|
-
for (let n =
|
|
8005
|
+
const { x: i, y: s } = this.viewport, r = me(e.right - i, t, this.columns), a = me(e.bottom - s, t, this.rows);
|
|
8006
|
+
for (let o = me(e.left - i, t, this.columns); o <= r; o++)
|
|
8007
|
+
for (let n = me(e.top - s, t, this.rows); n <= a; n++) {
|
|
8008
8008
|
const c = o * this.rows + n;
|
|
8009
8009
|
let h = this.grid.get(c);
|
|
8010
8010
|
h || (h = [], this.grid.set(c, h)), h.push(e);
|
|
@@ -8029,20 +8029,20 @@ class Pt {
|
|
|
8029
8029
|
this.degrees = i, this.edgeVersion = t;
|
|
8030
8030
|
}
|
|
8031
8031
|
}
|
|
8032
|
-
function
|
|
8032
|
+
function Xo(l, e) {
|
|
8033
8033
|
return l.selected !== e.selected ? l.selected ? -1 : 1 : l.degree !== e.degree ? e.degree - l.degree : l.idKey === e.idKey ? 0 : l.idKey < e.idKey ? -1 : 1;
|
|
8034
8034
|
}
|
|
8035
|
-
function
|
|
8035
|
+
function me(l, e, t) {
|
|
8036
8036
|
return Math.min(t - 1, Math.max(0, Math.floor(l / e)));
|
|
8037
8037
|
}
|
|
8038
|
-
function
|
|
8038
|
+
function Ji(l, e) {
|
|
8039
8039
|
const { m: t } = l;
|
|
8040
8040
|
for (let i = 0; i < 16; i++)
|
|
8041
8041
|
if (t[i] !== e[i])
|
|
8042
8042
|
return !1;
|
|
8043
8043
|
return !0;
|
|
8044
8044
|
}
|
|
8045
|
-
const
|
|
8045
|
+
const Qo = "#FFFF00", Yi = "#FFFFFF", Ft = class Ft {
|
|
8046
8046
|
/**
|
|
8047
8047
|
* Check if an effect layer has been disposed.
|
|
8048
8048
|
* Neither HighlightLayer nor GlowLayer has an isDisposed property, so we check whether the
|
|
@@ -8072,7 +8072,7 @@ const Ko = "#FFFF00", Xi = "#FFFFFF", It = class It {
|
|
|
8072
8072
|
const t = e.metadata?.highlightLayer;
|
|
8073
8073
|
if (t && !this.isLayerDisposed(t, e))
|
|
8074
8074
|
return t;
|
|
8075
|
-
const i = new
|
|
8075
|
+
const i = new Jr(this.HIGHLIGHT_LAYER_NAME, e, {
|
|
8076
8076
|
isStroke: !0,
|
|
8077
8077
|
blurHorizontalSize: 0.5,
|
|
8078
8078
|
blurVerticalSize: 0.5
|
|
@@ -8102,7 +8102,7 @@ const Ko = "#FFFF00", Xi = "#FFFFFF", It = class It {
|
|
|
8102
8102
|
static applyOutlineEffect(e, t) {
|
|
8103
8103
|
const i = e.getScene(), s = this.resolveRenderedMesh(e);
|
|
8104
8104
|
if (t?.outline) {
|
|
8105
|
-
const a = this.extractColorValue(t.outline.color), o = F.FromHexString(a ??
|
|
8105
|
+
const a = this.extractColorValue(t.outline.color), o = F.FromHexString(a ?? Qo);
|
|
8106
8106
|
this.getOrCreateHighlightLayer(i).addMesh(s, o);
|
|
8107
8107
|
return;
|
|
8108
8108
|
}
|
|
@@ -8129,7 +8129,7 @@ const Ko = "#FFFF00", Xi = "#FFFFFF", It = class It {
|
|
|
8129
8129
|
* @returns The mesh Babylon renders for it: the instance's source, or the mesh itself
|
|
8130
8130
|
*/
|
|
8131
8131
|
static resolveRenderedMesh(e) {
|
|
8132
|
-
return e instanceof
|
|
8132
|
+
return e instanceof bs ? e.sourceMesh : e;
|
|
8133
8133
|
}
|
|
8134
8134
|
/**
|
|
8135
8135
|
* Get or create the GlowLayer for node glow effects.
|
|
@@ -8154,11 +8154,11 @@ const Ko = "#FFFF00", Xi = "#FFFFFF", It = class It {
|
|
|
8154
8154
|
const t = e.metadata?.glowLayer;
|
|
8155
8155
|
if (t && !this.isLayerDisposed(t, e))
|
|
8156
8156
|
return t;
|
|
8157
|
-
const i = new
|
|
8157
|
+
const i = new Yr(this.GLOW_LAYER_NAME, e, {
|
|
8158
8158
|
excludeByDefault: !0
|
|
8159
8159
|
}), s = /* @__PURE__ */ new Map();
|
|
8160
8160
|
i.customEmissiveColorSelector = (a, o, n, c) => {
|
|
8161
|
-
const h = s.get(a.uniqueId) ?? F.FromHexString(
|
|
8161
|
+
const h = s.get(a.uniqueId) ?? F.FromHexString(Yi);
|
|
8162
8162
|
c.set(h.r, h.g, h.b, 1);
|
|
8163
8163
|
}, e.metadata = e.metadata ?? {}, e.metadata.glowLayer = i, e.metadata.glowColors = s;
|
|
8164
8164
|
const r = e.onBeforeRenderObservable.add(() => {
|
|
@@ -8198,7 +8198,7 @@ const Ko = "#FFFF00", Xi = "#FFFFFF", It = class It {
|
|
|
8198
8198
|
const i = e.getScene(), s = this.resolveRenderedMesh(e);
|
|
8199
8199
|
if (t?.glow) {
|
|
8200
8200
|
const r = this.getOrCreateGlowLayer(i), a = this.extractColorValue(t.glow.color);
|
|
8201
|
-
i.metadata?.glowColors?.set(s.uniqueId, F.FromHexString(a ??
|
|
8201
|
+
i.metadata?.glowColors?.set(s.uniqueId, F.FromHexString(a ?? Yi)), this.glowStrengths(i).set(s, t.glow.strength ?? 1);
|
|
8202
8202
|
try {
|
|
8203
8203
|
r.addIncludedOnlyMesh(s);
|
|
8204
8204
|
} catch {
|
|
@@ -8306,9 +8306,9 @@ const Ko = "#FFFF00", Xi = "#FFFFFF", It = class It {
|
|
|
8306
8306
|
t && !this.isLayerDisposed(t, e) && t.dispose(), e.metadata && (e.metadata.glowLayer = void 0, e.metadata.glowColors = void 0, e.metadata.glowStrengths = void 0);
|
|
8307
8307
|
}
|
|
8308
8308
|
};
|
|
8309
|
-
|
|
8310
|
-
let ht =
|
|
8311
|
-
const
|
|
8309
|
+
Ft.HIGHLIGHT_LAYER_NAME = "graphty-selection-highlight", Ft.GLOW_LAYER_NAME = "graphty-node-glow";
|
|
8310
|
+
let ht = Ft;
|
|
8311
|
+
const pi = "GraphtyInstanceColorShading", Jo = 900, es = {
|
|
8312
8312
|
glsl: {
|
|
8313
8313
|
stock: String.raw`vec3\s+finalDiffuse\s*=\s*clamp\(\s*diffuseBase\s*\*\s*diffuseColor\s*\+\s*` + String.raw`emissiveColor\s*\+\s*vAmbientColor\s*,\s*0\.0\s*,\s*1\.0\s*\)\s*\*\s*baseColor\.rgb\s*;`,
|
|
8314
8314
|
shaded: "vec3 finalDiffuse=clamp((diffuseBase*diffuseColor+emissiveColor+vAmbientColor)*baseColor.rgb,0.0,1.0);"
|
|
@@ -8318,20 +8318,20 @@ const di = "GraphtyInstanceColorShading", Zo = 900, Qi = {
|
|
|
8318
8318
|
shaded: "var finalDiffuse: vec3f=clamp((diffuseBase*diffuseColor+emissiveColor+uniforms.vAmbientColor)*baseColor.rgb,vec3f(0.0),vec3f(1.0));"
|
|
8319
8319
|
}
|
|
8320
8320
|
};
|
|
8321
|
-
class
|
|
8321
|
+
class Yo extends ea {
|
|
8322
8322
|
/**
|
|
8323
8323
|
* Attaches the plugin to one material and switches it on.
|
|
8324
8324
|
* @param material - The material to shade.
|
|
8325
8325
|
*/
|
|
8326
8326
|
constructor(e) {
|
|
8327
|
-
super(e,
|
|
8327
|
+
super(e, pi, Jo, {}, !0, !0);
|
|
8328
8328
|
}
|
|
8329
8329
|
/**
|
|
8330
8330
|
* The name Babylon keys this plugin's shader define on.
|
|
8331
8331
|
* @returns The class name.
|
|
8332
8332
|
*/
|
|
8333
8333
|
getClassName() {
|
|
8334
|
-
return
|
|
8334
|
+
return pi;
|
|
8335
8335
|
}
|
|
8336
8336
|
/**
|
|
8337
8337
|
* Whether this plugin can be attached to a material written in the given shader language.
|
|
@@ -8344,7 +8344,7 @@ class Xo extends Qr {
|
|
|
8344
8344
|
* @returns Whether the rewrite below is written for it.
|
|
8345
8345
|
*/
|
|
8346
8346
|
isCompatible(e) {
|
|
8347
|
-
return e ===
|
|
8347
|
+
return e === St.GLSL || e === St.WGSL;
|
|
8348
8348
|
}
|
|
8349
8349
|
/**
|
|
8350
8350
|
* The shader edit: move the instance colour inside the clamp on the lit term.
|
|
@@ -8352,17 +8352,17 @@ class Xo extends Qr {
|
|
|
8352
8352
|
* @param shaderLanguage - The language it is building it in.
|
|
8353
8353
|
* @returns The replacement, keyed by the regular expression it replaces.
|
|
8354
8354
|
*/
|
|
8355
|
-
getCustomCode(e, t =
|
|
8355
|
+
getCustomCode(e, t = St.GLSL) {
|
|
8356
8356
|
if (e !== "fragment")
|
|
8357
8357
|
return null;
|
|
8358
|
-
const i = t ===
|
|
8358
|
+
const i = t === St.WGSL ? es.wgsl : es.glsl;
|
|
8359
8359
|
return { [`!${i.stock}`]: i.shaded };
|
|
8360
8360
|
}
|
|
8361
8361
|
}
|
|
8362
|
-
function
|
|
8363
|
-
l.pluginManager?.getPlugin(
|
|
8362
|
+
function en(l) {
|
|
8363
|
+
l.pluginManager?.getPlugin(pi) || new Yo(l);
|
|
8364
8364
|
}
|
|
8365
|
-
const
|
|
8365
|
+
const tn = 1e-3, sn = 128, rn = 32, ts = /* @__PURE__ */ new WeakMap(), b = class b {
|
|
8366
8366
|
/**
|
|
8367
8367
|
* Create a node mesh with caching
|
|
8368
8368
|
* @param cache - Mesh cache for reusing geometry
|
|
@@ -8391,7 +8391,7 @@ const Jo = 1e-3, Yo = 128, en = 32, Ji = /* @__PURE__ */ new WeakMap(), b = clas
|
|
|
8391
8391
|
const s = this.shapeCreators.get(t.shape.type);
|
|
8392
8392
|
if (!s)
|
|
8393
8393
|
throw new TypeError(`unknown shape: ${t.shape.type}`);
|
|
8394
|
-
const r = Math.max(t.shape.size ?? e.size,
|
|
8394
|
+
const r = Math.max(t.shape.size ?? e.size, tn);
|
|
8395
8395
|
return s(r, i);
|
|
8396
8396
|
}
|
|
8397
8397
|
/**
|
|
@@ -8432,14 +8432,14 @@ const Jo = 1e-3, Yo = 128, en = 32, Ji = /* @__PURE__ */ new WeakMap(), b = clas
|
|
|
8432
8432
|
* @returns The material to attach to the cached node mesh
|
|
8433
8433
|
*/
|
|
8434
8434
|
static createMaterial(e, t, i) {
|
|
8435
|
-
const s = new
|
|
8435
|
+
const s = new Ee("defaultMaterial", i), r = e.texture?.color;
|
|
8436
8436
|
let a = this.extractColor(r);
|
|
8437
8437
|
const o = a ? void 0 : this.extractGradient(r), n = o ? this.getGradientTexture(o, i) : void 0;
|
|
8438
8438
|
if (o && !n) {
|
|
8439
8439
|
const [c] = o.colors;
|
|
8440
8440
|
c && (a = F.FromHexString(c));
|
|
8441
8441
|
}
|
|
8442
|
-
return n ? (t && (s.disableLighting = !0, s.emissiveTexture = n), s.diffuseTexture = n) : a && (t ? (s.disableLighting = !0, s.emissiveColor = a) : (s.diffuseColor = a, s.emissiveColor = a.scale(0.2),
|
|
8442
|
+
return n ? (t && (s.disableLighting = !0, s.emissiveTexture = n), s.diffuseTexture = n) : a && (t ? (s.disableLighting = !0, s.emissiveColor = a) : (s.diffuseColor = a, s.emissiveColor = a.scale(0.2), en(s))), s.wireframe = e.effect?.wireframe ?? !1, s.freeze(), s;
|
|
8443
8443
|
}
|
|
8444
8444
|
static extractColor(e) {
|
|
8445
8445
|
if (typeof e == "string")
|
|
@@ -8518,12 +8518,12 @@ const Jo = 1e-3, Yo = 128, en = 32, Ji = /* @__PURE__ */ new WeakMap(), b = clas
|
|
|
8518
8518
|
if (!t || e.colors.length < 2)
|
|
8519
8519
|
return;
|
|
8520
8520
|
const i = `${e.radial ? "radial" : "linear"}|${e.direction}|${e.colors.join(",")}`;
|
|
8521
|
-
let s =
|
|
8522
|
-
s || (s = /* @__PURE__ */ new Map(),
|
|
8521
|
+
let s = ts.get(t);
|
|
8522
|
+
s || (s = /* @__PURE__ */ new Map(), ts.set(t, s));
|
|
8523
8523
|
const r = s.get(i);
|
|
8524
8524
|
if (r)
|
|
8525
8525
|
return r;
|
|
8526
|
-
if (s.size >=
|
|
8526
|
+
if (s.size >= rn)
|
|
8527
8527
|
return;
|
|
8528
8528
|
const a = this.createGradientTexture(e, t, i);
|
|
8529
8529
|
if (a)
|
|
@@ -8555,10 +8555,10 @@ const Jo = 1e-3, Yo = 128, en = 32, Ji = /* @__PURE__ */ new WeakMap(), b = clas
|
|
|
8555
8555
|
* @returns The painted texture, or undefined if no 2D canvas is available
|
|
8556
8556
|
*/
|
|
8557
8557
|
static createGradientTexture(e, t, i) {
|
|
8558
|
-
const s =
|
|
8558
|
+
const s = sn;
|
|
8559
8559
|
let r;
|
|
8560
8560
|
try {
|
|
8561
|
-
r = new
|
|
8561
|
+
r = new vs(`node-gradient-${i}`, { width: s, height: s }, t, !1);
|
|
8562
8562
|
const a = r.getContext(), o = e.radial ? a.createRadialGradient(s / 2, s / 2, 0, s / 2, s / 2, s / 2) : this.createLinearRamp(a, e.direction, s), { colors: n } = e;
|
|
8563
8563
|
for (let c = 0; c < n.length; c++)
|
|
8564
8564
|
o.addColorStop(c / (n.length - 1), n[c] ?? "transparent");
|
|
@@ -8754,9 +8754,9 @@ b.shapeCreators = /* @__PURE__ */ new Map(), b.registerShapeCreator("box", (e) =
|
|
|
8754
8754
|
"elongated_pentagonal_cupola",
|
|
8755
8755
|
(e, t) => b.createPolyhedron(z.ELONGATED_PENTAGONAL_CUPOLA, e, t)
|
|
8756
8756
|
);
|
|
8757
|
-
let
|
|
8758
|
-
const
|
|
8759
|
-
class
|
|
8757
|
+
let It = b;
|
|
8758
|
+
const an = 300, on = 5;
|
|
8759
|
+
class nn {
|
|
8760
8760
|
/**
|
|
8761
8761
|
* Creates a new drag handler for a node.
|
|
8762
8762
|
* @param node - The graph node to enable dragging on
|
|
@@ -8787,7 +8787,7 @@ class rn {
|
|
|
8787
8787
|
const i = this.getContext();
|
|
8788
8788
|
i.setRunning(!0);
|
|
8789
8789
|
const { layoutEngine: s } = i.getLayoutManager();
|
|
8790
|
-
s instanceof
|
|
8790
|
+
s instanceof pe && s.beginDrag(this.node);
|
|
8791
8791
|
const r = i.getEventManager?.();
|
|
8792
8792
|
if (r) {
|
|
8793
8793
|
const a = this.node.mesh.position;
|
|
@@ -8826,7 +8826,7 @@ class rn {
|
|
|
8826
8826
|
const e = this.getContext();
|
|
8827
8827
|
e.setRunning(!0);
|
|
8828
8828
|
const { layoutEngine: t } = e.getLayoutManager();
|
|
8829
|
-
t instanceof
|
|
8829
|
+
t instanceof pe && t.endDrag(this.node, this.node.pinOnDrag), this.node.pinOnDrag && this.node.pin();
|
|
8830
8830
|
const i = this.scene.metadata?.cameraManager;
|
|
8831
8831
|
i && i.temporarilyEnableInput();
|
|
8832
8832
|
const s = e.getEventManager?.();
|
|
@@ -8898,7 +8898,7 @@ class rn {
|
|
|
8898
8898
|
if (this.dragState.dragging) {
|
|
8899
8899
|
if (this.clickState && !this.clickState.hasMoved) {
|
|
8900
8900
|
const s = this.scene.pointerX - this.clickState.pointerDownPosition.x, r = this.scene.pointerY - this.clickState.pointerDownPosition.y;
|
|
8901
|
-
Math.sqrt(s * s + r * r) >
|
|
8901
|
+
Math.sqrt(s * s + r * r) > on && (this.clickState.hasMoved = !0);
|
|
8902
8902
|
}
|
|
8903
8903
|
const t = this.scene.createPickingRay(
|
|
8904
8904
|
this.scene.pointerX,
|
|
@@ -8943,7 +8943,7 @@ class rn {
|
|
|
8943
8943
|
* @returns True if the interaction qualifies as a click
|
|
8944
8944
|
*/
|
|
8945
8945
|
isClick() {
|
|
8946
|
-
return this.clickState ? Date.now() - this.clickState.pointerDownTime <
|
|
8946
|
+
return this.clickState ? Date.now() - this.clickState.pointerDownTime < an && !this.clickState.hasMoved : !1;
|
|
8947
8947
|
}
|
|
8948
8948
|
/**
|
|
8949
8949
|
* Handle a click on this node - select it and emit node-click event.
|
|
@@ -8988,7 +8988,7 @@ class rn {
|
|
|
8988
8988
|
this.pointerObserver && (this.scene.onPrePointerObservable.remove(this.pointerObserver), this.pointerObserver = null), this.hoverObserver && (this.scene.onPrePointerObservable.remove(this.hoverObserver), this.hoverObserver = null);
|
|
8989
8989
|
}
|
|
8990
8990
|
}
|
|
8991
|
-
class
|
|
8991
|
+
class is {
|
|
8992
8992
|
/**
|
|
8993
8993
|
* Add default interaction behaviors to a node
|
|
8994
8994
|
* @param node - The graph node to add behaviors to
|
|
@@ -8996,7 +8996,7 @@ class Yi {
|
|
|
8996
8996
|
*/
|
|
8997
8997
|
static addDefaultBehaviors(e, t = {}) {
|
|
8998
8998
|
e.mesh.isPickable = !0, e.pinOnDrag = t.pinOnDrag ?? !0;
|
|
8999
|
-
const i = new
|
|
8999
|
+
const i = new nn(e);
|
|
9000
9000
|
e.dragHandler = i, this.addClickBehavior(e);
|
|
9001
9001
|
}
|
|
9002
9002
|
/**
|
|
@@ -9013,12 +9013,12 @@ class Yi {
|
|
|
9013
9013
|
*/
|
|
9014
9014
|
static addClickBehavior(e) {
|
|
9015
9015
|
const t = this.getContext(e), i = t.getScene();
|
|
9016
|
-
e.mesh.actionManager = e.mesh.actionManager ?? new
|
|
9016
|
+
e.mesh.actionManager = e.mesh.actionManager ?? new ki(i);
|
|
9017
9017
|
const s = e.parentGraph;
|
|
9018
9018
|
e.mesh.actionManager.registerAction(
|
|
9019
|
-
new
|
|
9019
|
+
new ta(
|
|
9020
9020
|
{
|
|
9021
|
-
trigger:
|
|
9021
|
+
trigger: ki.OnDoublePickTrigger
|
|
9022
9022
|
// trigger: ActionManager.OnLongPressTrigger,
|
|
9023
9023
|
},
|
|
9024
9024
|
() => {
|
|
@@ -9026,9 +9026,9 @@ class Yi {
|
|
|
9026
9026
|
if (!r || !a)
|
|
9027
9027
|
return;
|
|
9028
9028
|
t.setRunning(!0);
|
|
9029
|
-
const o = a(e, s), n = Array.from(o), c =
|
|
9029
|
+
const o = a(e, s), n = Array.from(o), c = zs(n, { source: null, target: null }), h = /* @__PURE__ */ new Set();
|
|
9030
9030
|
n.forEach((p) => {
|
|
9031
|
-
h.add(
|
|
9031
|
+
h.add(ue(p, c.source)), h.add(ue(p, c.target));
|
|
9032
9032
|
}), h.delete(e.id);
|
|
9033
9033
|
const d = r(h, s), u = t.getDataManager();
|
|
9034
9034
|
u.addNodes([...d]), u.addEdges([...n], {
|
|
@@ -9049,8 +9049,8 @@ class Yi {
|
|
|
9049
9049
|
return "getStyles" in e.parentGraph, e.parentGraph;
|
|
9050
9050
|
}
|
|
9051
9051
|
}
|
|
9052
|
-
const
|
|
9053
|
-
class
|
|
9052
|
+
const ss = ge.getLogger(["graphty", "node"]), cn = "graphty-selection-halo", hn = "graphty-context-point", ln = "#8A8A8A", dn = 0.3, un = 0.18, rs = 0.2;
|
|
9053
|
+
class Dt {
|
|
9054
9054
|
/**
|
|
9055
9055
|
* Creates a new Node instance with mesh, label, and behaviors.
|
|
9056
9056
|
*
|
|
@@ -9067,7 +9067,7 @@ class Ot {
|
|
|
9067
9067
|
constructor(e, t, i, s, r = {}) {
|
|
9068
9068
|
this.index = K, this.drawnStyle = null, this.drawnColor = null, this.dragging = !1, this.renderState = "visible", this.selected = !1, this.sessionPaint = null, this.halo = null, this.contextPoint = null, this.disposed = !1, this.parentGraph = e, this.id = t, this.opts = r, this.data = s, this.meshKey = i.meshKey;
|
|
9069
9069
|
const a = i.style;
|
|
9070
|
-
this.drawnStyle = a, this.drawnColor = i.color, this.size = a.shape?.size ?? 0, this.shapeType = a.shape?.type, this.mesh =
|
|
9070
|
+
this.drawnStyle = a, this.drawnColor = i.color, this.size = a.shape?.size ?? 0, this.shapeType = a.shape?.type, this.mesh = It.create(
|
|
9071
9071
|
this.context.getMeshCache(),
|
|
9072
9072
|
{ styleId: i.meshKey, is2D: this.context.is2D(), size: this.size },
|
|
9073
9073
|
{ shape: a.shape, texture: a.texture, effect: a.effect },
|
|
@@ -9078,7 +9078,7 @@ class Ot {
|
|
|
9078
9078
|
graphNode: this,
|
|
9079
9079
|
styleId: i.meshKey,
|
|
9080
9080
|
nodeId: this.id
|
|
9081
|
-
}, this.syncLabel(a, !0), this.syncTooltip(a), this.applyInstancePaint(a, i.color),
|
|
9081
|
+
}, this.syncLabel(a, !0), this.syncTooltip(a), this.applyInstancePaint(a, i.color), is.addDefaultBehaviors(this, this.opts);
|
|
9082
9082
|
}
|
|
9083
9083
|
/**
|
|
9084
9084
|
* Helper to check if we're using GraphContext
|
|
@@ -9126,7 +9126,7 @@ class Ot {
|
|
|
9126
9126
|
*/
|
|
9127
9127
|
currentPaint() {
|
|
9128
9128
|
const e = this.context.getStylePainter?.();
|
|
9129
|
-
return (e?.owns === !0 ? this.sessionPaint ?? e.nodePaint(this.index) : null) ??
|
|
9129
|
+
return (e?.owns === !0 ? this.sessionPaint ?? e.nodePaint(this.index) : null) ?? Ns();
|
|
9130
9130
|
}
|
|
9131
9131
|
/**
|
|
9132
9132
|
* Draw this node as the session's style stack resolved it.
|
|
@@ -9151,10 +9151,10 @@ class Ot {
|
|
|
9151
9151
|
* @param color - The colour, or null when no layer painted one.
|
|
9152
9152
|
*/
|
|
9153
9153
|
applyInstanceColor(e) {
|
|
9154
|
-
if (e === null || !(this.mesh instanceof
|
|
9154
|
+
if (e === null || !(this.mesh instanceof bs))
|
|
9155
9155
|
return;
|
|
9156
9156
|
const t = this.mesh.sourceMesh;
|
|
9157
|
-
t.instancedBuffers?.color === void 0 && (t.material?.unfreeze(), t.registerInstancedBuffer("color", 4), t.instancedBuffers.color = new
|
|
9157
|
+
t.instancedBuffers?.color === void 0 && (t.material?.unfreeze(), t.registerInstancedBuffer("color", 4), t.instancedBuffers.color = new Ce(1, 1, 1, 1)), this.mesh.instancedBuffers.color = new Ce(e.r / 255, e.g / 255, e.b / 255, 1);
|
|
9158
9158
|
}
|
|
9159
9159
|
/**
|
|
9160
9160
|
* Apply everything about this node that lives on the drawn mesh rather than in its geometry.
|
|
@@ -9212,7 +9212,7 @@ class Ot {
|
|
|
9212
9212
|
for (const u of d.edges.values())
|
|
9213
9213
|
(u.srcNode === this || u.dstNode === this) && u.invalidatePositionCache();
|
|
9214
9214
|
}
|
|
9215
|
-
this.mesh =
|
|
9215
|
+
this.mesh = It.create(
|
|
9216
9216
|
this.context.getMeshCache(),
|
|
9217
9217
|
{ styleId: e, is2D: this.context.is2D(), size: this.size },
|
|
9218
9218
|
{ shape: t.shape, texture: t.texture, effect: t.effect },
|
|
@@ -9225,7 +9225,7 @@ class Ot {
|
|
|
9225
9225
|
nodeId: this.id
|
|
9226
9226
|
};
|
|
9227
9227
|
const h = this.context.getLayoutManager().layoutEngine?.getNodePosition(this);
|
|
9228
|
-
h && (this.mesh.position.x = h.x, this.mesh.position.y = h.y, this.mesh.position.z = h.z ?? 0), this.syncLabel(t, !0), this.syncTooltip(t), this.dragHandler && this.dragHandler.dispose(),
|
|
9228
|
+
h && (this.mesh.position.x = h.x, this.mesh.position.y = h.y, this.mesh.position.z = h.z ?? 0), this.syncLabel(t, !0), this.syncTooltip(t), this.dragHandler && this.dragHandler.dispose(), is.addDefaultBehaviors(this, this.opts), this.applyRenderState(), this.applyInstancePaint(t, i), this.context.getStatsManager().endMeasurement("Node.updateMesh");
|
|
9229
9229
|
}
|
|
9230
9230
|
/**
|
|
9231
9231
|
* Tears down every Babylon resource this node owns.
|
|
@@ -9335,7 +9335,7 @@ class Ot {
|
|
|
9335
9335
|
* @returns The configured colour, scale and opacity.
|
|
9336
9336
|
*/
|
|
9337
9337
|
selectionStyle() {
|
|
9338
|
-
return this.context.getStyles().config.graph.selection ??
|
|
9338
|
+
return this.context.getStyles().config.graph.selection ?? Ts;
|
|
9339
9339
|
}
|
|
9340
9340
|
/**
|
|
9341
9341
|
* Redraw this node's selection halo from the configuration as it now stands.
|
|
@@ -9358,8 +9358,8 @@ class Ot {
|
|
|
9358
9358
|
return;
|
|
9359
9359
|
}
|
|
9360
9360
|
const s = this.selectionStyle(), r = i && !i.isDisposed() ? i : this.createOverlay(e);
|
|
9361
|
-
e === "halo" ? (this.halo = r,
|
|
9362
|
-
const a = e === "halo" ? this.haloScale(s.scale) : Math.max(this.size,
|
|
9361
|
+
e === "halo" ? (this.halo = r, Dt.paintHalo(r, s)) : this.contextPoint = r;
|
|
9362
|
+
const a = e === "halo" ? this.haloScale(s.scale) : Math.max(this.size, rs) * dn;
|
|
9363
9363
|
r.scaling.setAll(a), r.position.copyFrom(this.mesh.position), r.setEnabled(!0);
|
|
9364
9364
|
}
|
|
9365
9365
|
/**
|
|
@@ -9381,7 +9381,7 @@ class Ot {
|
|
|
9381
9381
|
*/
|
|
9382
9382
|
haloScale(e) {
|
|
9383
9383
|
const t = this.mesh.isDisposed() ? null : this.mesh.getBoundingInfo().boundingBox, i = this.mesh.scaling, s = t === null ? 0 : Math.max(t.extendSize.x, t.extendSize.y, t.extendSize.z) * Math.max(Math.abs(i.x), Math.abs(i.y), Math.abs(i.z));
|
|
9384
|
-
return 2 * (s > 0 ? s : Math.max(this.size,
|
|
9384
|
+
return 2 * (s > 0 ? s : Math.max(this.size, rs) / 2) * e;
|
|
9385
9385
|
}
|
|
9386
9386
|
/**
|
|
9387
9387
|
* Build one overlay instance for this node.
|
|
@@ -9393,7 +9393,7 @@ class Ot {
|
|
|
9393
9393
|
* @returns The instance, parented and ready to be positioned.
|
|
9394
9394
|
*/
|
|
9395
9395
|
createOverlay(e) {
|
|
9396
|
-
const t = this.context.getScene(), i = this.selectionStyle(), s = e === "halo" ?
|
|
9396
|
+
const t = this.context.getScene(), i = this.selectionStyle(), s = e === "halo" ? cn : hn, r = e === "halo" ? i.color : ln, a = e === "halo" ? i.opacity : un, o = this.context.getMeshCache().get(s, () => Dt.createOverlaySource(s, r, a, t));
|
|
9397
9397
|
o.isPickable = !1;
|
|
9398
9398
|
const n = t.getTransformNodeByName("graph-root");
|
|
9399
9399
|
return n && (o.parent = n), o;
|
|
@@ -9405,7 +9405,7 @@ class Ot {
|
|
|
9405
9405
|
*/
|
|
9406
9406
|
static paintHalo(e, t) {
|
|
9407
9407
|
const { material: i } = e;
|
|
9408
|
-
i instanceof
|
|
9408
|
+
i instanceof Ee && (i.emissiveColor = F.FromHexString(t.color), i.alpha = t.opacity);
|
|
9409
9409
|
}
|
|
9410
9410
|
/**
|
|
9411
9411
|
* Build the one source mesh a kind of overlay is instanced from.
|
|
@@ -9416,7 +9416,7 @@ class Ot {
|
|
|
9416
9416
|
* @returns The source mesh, with a unit diameter so an instance scales to the node's size.
|
|
9417
9417
|
*/
|
|
9418
9418
|
static createOverlaySource(e, t, i, s) {
|
|
9419
|
-
const r = J.CreateSphere(e, { diameter: 1, segments: 8 }, s), a = new
|
|
9419
|
+
const r = J.CreateSphere(e, { diameter: 1, segments: 8 }, s), a = new Ee(`${e}-material`, s);
|
|
9420
9420
|
return a.disableLighting = !0, a.emissiveColor = F.FromHexString(t), a.diffuseColor = F.Black(), a.specularColor = F.Black(), a.alpha = i, a.backFaceCulling = !1, r.material = a, r;
|
|
9421
9421
|
}
|
|
9422
9422
|
/**
|
|
@@ -9447,7 +9447,7 @@ class Ot {
|
|
|
9447
9447
|
*/
|
|
9448
9448
|
pin() {
|
|
9449
9449
|
if (!this.positionsLane?.setPinned(this.index, !0)) {
|
|
9450
|
-
|
|
9450
|
+
ss.debug("A node with no row in the graph cannot be pinned", { nodeId: this.id });
|
|
9451
9451
|
return;
|
|
9452
9452
|
}
|
|
9453
9453
|
this.tellEngine("pin");
|
|
@@ -9478,7 +9478,7 @@ class Ot {
|
|
|
9478
9478
|
try {
|
|
9479
9479
|
t[e](this);
|
|
9480
9480
|
} catch (i) {
|
|
9481
|
-
|
|
9481
|
+
ss.debug("The layout engine did not accept the pin change", {
|
|
9482
9482
|
nodeId: this.id,
|
|
9483
9483
|
verb: e,
|
|
9484
9484
|
reason: i instanceof Error ? i.message : String(i)
|
|
@@ -9568,7 +9568,7 @@ class Ot {
|
|
|
9568
9568
|
}
|
|
9569
9569
|
createLabel(e) {
|
|
9570
9570
|
const t = this.extractLabelText(e.label), i = this.createLabelOptions(t, e.label), s = this.mesh.getScene();
|
|
9571
|
-
return
|
|
9571
|
+
return Rt.track(s, this.context, this), new ct(s, i);
|
|
9572
9572
|
}
|
|
9573
9573
|
extractLabelText(e) {
|
|
9574
9574
|
if (!e)
|
|
@@ -9683,11 +9683,11 @@ class Ot {
|
|
|
9683
9683
|
return this.positionsLane?.isPinned(this.index) ?? !1;
|
|
9684
9684
|
}
|
|
9685
9685
|
}
|
|
9686
|
-
const
|
|
9687
|
-
function
|
|
9686
|
+
const gn = /^-?\d+$/;
|
|
9687
|
+
function Et(l) {
|
|
9688
9688
|
return typeof l == "string" || typeof l == "number" && Number.isFinite(l);
|
|
9689
9689
|
}
|
|
9690
|
-
function
|
|
9690
|
+
function pn(l, e, t) {
|
|
9691
9691
|
switch (l) {
|
|
9692
9692
|
case "sum":
|
|
9693
9693
|
return e + t;
|
|
@@ -9699,14 +9699,14 @@ function dn(l, e, t) {
|
|
|
9699
9699
|
return t;
|
|
9700
9700
|
}
|
|
9701
9701
|
}
|
|
9702
|
-
class
|
|
9702
|
+
class mn {
|
|
9703
9703
|
/**
|
|
9704
9704
|
* Creates an instance of DataManager
|
|
9705
9705
|
* @param eventManager - Event manager for emitting data events
|
|
9706
9706
|
* @param styles - Styles instance for applying styles to data
|
|
9707
9707
|
*/
|
|
9708
9708
|
constructor(e, t) {
|
|
9709
|
-
this.eventManager = e, this.styles = t, this.nodes = /* @__PURE__ */ new Map(), this.edges = /* @__PURE__ */ new Map(), this.edgeVersion = 0, this.nodeCache = /* @__PURE__ */ new Map(), this.edgeCache = new
|
|
9709
|
+
this.eventManager = e, this.styles = t, this.nodes = /* @__PURE__ */ new Map(), this.edges = /* @__PURE__ */ new Map(), this.edgeVersion = 0, this.nodeCache = /* @__PURE__ */ new Map(), this.edgeCache = new Do(), this.edgesByIndex = [], this.logger = ge.getLogger(["graphty", "data"]), this.graphContext = null, this.shouldStartLayout = !1, this.shouldZoomToFit = !1, this.pendingEdges = [], this.pendingByPair = /* @__PURE__ */ new Map(), this.edgesByRecordId = /* @__PURE__ */ new Map(), this.importReport = null, this.loadEndpoints = null, this.loadTally = null, this.meshCache = new jo(), this.store = this.createStore();
|
|
9710
9710
|
}
|
|
9711
9711
|
/**
|
|
9712
9712
|
* The current graph snapshot, freezing first when records have arrived since the last one.
|
|
@@ -9780,7 +9780,7 @@ class un {
|
|
|
9780
9780
|
*/
|
|
9781
9781
|
createStore() {
|
|
9782
9782
|
const { data: e } = this.styles.config;
|
|
9783
|
-
return new
|
|
9783
|
+
return new Ks({
|
|
9784
9784
|
directed: e.directed,
|
|
9785
9785
|
positionScale: () => this.styles.config.data.knownFields.positionScale,
|
|
9786
9786
|
onNodeRemap: (t) => {
|
|
@@ -9958,19 +9958,20 @@ class un {
|
|
|
9958
9958
|
*/
|
|
9959
9959
|
addNodes(e, t) {
|
|
9960
9960
|
this.logger.debug("Adding nodes", { count: e.length }), this.loadTally !== null && (this.loadTally.nodeRecords += e.length);
|
|
9961
|
-
const i = t ?? this.styles.config.data.knownFields.nodeIdPath;
|
|
9962
|
-
|
|
9963
|
-
|
|
9964
|
-
|
|
9961
|
+
const i = t ?? this.styles.config.data.knownFields.nodeIdPath, s = e.map((a) => gt.search(a, i)), r = new Set(s.filter((a) => !this.nodeCache.get(a)));
|
|
9962
|
+
this.refuseAboveCeiling("nodes", this.nodes.size, r.size, _t.renderCeiling);
|
|
9963
|
+
for (const [a, o] of e.entries()) {
|
|
9964
|
+
const n = s[a];
|
|
9965
|
+
if (this.nodeCache.get(n))
|
|
9965
9966
|
continue;
|
|
9966
9967
|
if (!this.graphContext)
|
|
9967
9968
|
throw new Error("GraphContext not set. Call setGraphContext before adding nodes.");
|
|
9968
|
-
const
|
|
9969
|
+
const c = new Dt(this.graphContext, n, Ns(), o, {
|
|
9969
9970
|
pinOnDrag: this.graphContext.getConfig().pinOnDrag
|
|
9970
9971
|
});
|
|
9971
|
-
|
|
9972
|
-
nodeId:
|
|
9973
|
-
metadata:
|
|
9972
|
+
c.index = $o(this.store, n, o).index, this.nodeCache.set(n, c), this.nodes.set(n, c), this.layoutEngine && this.layoutEngine.addNode(c), this.eventManager.emitNodeEvent("node-add-before", {
|
|
9973
|
+
nodeId: n,
|
|
9974
|
+
metadata: o
|
|
9974
9975
|
});
|
|
9975
9976
|
}
|
|
9976
9977
|
e.length > 0 && (this.shouldStartLayout = !0, this.shouldZoomToFit = !0, this.processPendingEdges(), this.eventManager.emitDataAdded("nodes", e.length, !0, !0));
|
|
@@ -9995,12 +9996,12 @@ class un {
|
|
|
9995
9996
|
const h = {};
|
|
9996
9997
|
if (!this.graphContext)
|
|
9997
9998
|
throw new Error("GraphContext not set. Call setGraphContext before adding edges.");
|
|
9998
|
-
const d = new
|
|
9999
|
+
const d = new Ot(
|
|
9999
10000
|
this.graphContext,
|
|
10000
10001
|
s,
|
|
10001
10002
|
r,
|
|
10002
10003
|
o,
|
|
10003
|
-
|
|
10004
|
+
Pt(),
|
|
10004
10005
|
i,
|
|
10005
10006
|
h
|
|
10006
10007
|
);
|
|
@@ -10041,7 +10042,7 @@ class un {
|
|
|
10041
10042
|
*/
|
|
10042
10043
|
getNode(e) {
|
|
10043
10044
|
const t = this.nodes.get(e);
|
|
10044
|
-
return t !== void 0 ? t : typeof e == "string" ?
|
|
10045
|
+
return t !== void 0 ? t : typeof e == "string" ? gn.test(e) ? this.nodes.get(Number.parseInt(e, 10)) : void 0 : Number.isInteger(e) ? this.nodes.get(String(e)) : void 0;
|
|
10045
10046
|
}
|
|
10046
10047
|
/**
|
|
10047
10048
|
* Remove a node AND every edge attached to it.
|
|
@@ -10087,7 +10088,7 @@ class un {
|
|
|
10087
10088
|
const a = [];
|
|
10088
10089
|
for (const o of this.pendingEdges) {
|
|
10089
10090
|
if (i.has(o.edgeIndex)) {
|
|
10090
|
-
this.forgetPending(o), r.has(o.edgeIndex) || s.push(
|
|
10091
|
+
this.forgetPending(o), r.has(o.edgeIndex) || s.push(ps(o.edgeId));
|
|
10091
10092
|
continue;
|
|
10092
10093
|
}
|
|
10093
10094
|
a.push(o);
|
|
@@ -10138,21 +10139,27 @@ class un {
|
|
|
10138
10139
|
*/
|
|
10139
10140
|
addEdges(e, t) {
|
|
10140
10141
|
this.logger.debug("Adding edges", { count: e.length });
|
|
10141
|
-
const { knownFields: i } = this.styles.config.data, s = this.endpointsFor(e, t), r = t?.repeated ?? i.repeatedEdges, a = i.edgeIdPath, o = i.edgeWeightPath, n = this.loadTally ??
|
|
10142
|
+
const { knownFields: i } = this.styles.config.data, s = this.endpointsFor(e, t), r = t?.repeated ?? i.repeatedEdges, a = i.edgeIdPath, o = i.edgeWeightPath, n = this.loadTally ?? Xi();
|
|
10142
10143
|
let c = 0;
|
|
10144
|
+
this.refuseAboveCeiling(
|
|
10145
|
+
"edges",
|
|
10146
|
+
this.store.builder.edgeCount,
|
|
10147
|
+
this.edgesAdded(e, s, r, !1),
|
|
10148
|
+
_t.edgesDrawn
|
|
10149
|
+
);
|
|
10143
10150
|
for (const h of e) {
|
|
10144
10151
|
n.edgeRecords++;
|
|
10145
|
-
const d =
|
|
10152
|
+
const d = ue(h, s.source), u = ue(h, s.target), p = Vo(h, o);
|
|
10146
10153
|
p.source === "legacy" && c++, p.source !== "default" && (n.weightsResolvedFrom = p.source, n.weightsAttribute = p.source === "legacy" ? "value" : o);
|
|
10147
|
-
const m = a === null ? void 0 :
|
|
10154
|
+
const m = a === null ? void 0 : ue(h, a), y = this.knownEdgeFor(d, u, m);
|
|
10148
10155
|
if (y !== null && (n.repeatedSeen++, this.mergeRepeat(y, h, p.weight, r, d, u, n)))
|
|
10149
10156
|
continue;
|
|
10150
|
-
const { index: w, edgeId: S } =
|
|
10157
|
+
const { index: w, edgeId: S } = Ho(this.store, d, u, p.weight);
|
|
10151
10158
|
if (w === K) {
|
|
10152
10159
|
n.rejected++;
|
|
10153
10160
|
continue;
|
|
10154
10161
|
}
|
|
10155
|
-
|
|
10162
|
+
Et(m) && this.edgesByRecordId.set(m, w);
|
|
10156
10163
|
const x = this.nodeCache.get(d), C = this.nodeCache.get(u);
|
|
10157
10164
|
if (!x || !C) {
|
|
10158
10165
|
const $ = {
|
|
@@ -10168,12 +10175,12 @@ class un {
|
|
|
10168
10175
|
const k = {};
|
|
10169
10176
|
if (!this.graphContext)
|
|
10170
10177
|
throw new Error("GraphContext not set. Call setGraphContext before adding edges.");
|
|
10171
|
-
const U = new
|
|
10178
|
+
const U = new Ot(
|
|
10172
10179
|
this.graphContext,
|
|
10173
10180
|
d,
|
|
10174
10181
|
u,
|
|
10175
10182
|
S,
|
|
10176
|
-
|
|
10183
|
+
Pt(),
|
|
10177
10184
|
h,
|
|
10178
10185
|
k
|
|
10179
10186
|
);
|
|
@@ -10186,7 +10193,7 @@ class un {
|
|
|
10186
10193
|
c > 0 && this.logger.debug("edge weight read from the legacy 'value' key; set data.knownFields.edgeWeightPath", {
|
|
10187
10194
|
count: c,
|
|
10188
10195
|
edgeWeightPath: o
|
|
10189
|
-
}), this.loadTally === null && (this.importReport =
|
|
10196
|
+
}), this.loadTally === null && (this.importReport = Qi(n, {
|
|
10190
10197
|
format: "records",
|
|
10191
10198
|
endpoints: s,
|
|
10192
10199
|
policy: r,
|
|
@@ -10205,7 +10212,7 @@ class un {
|
|
|
10205
10212
|
return { source: t.source, target: t.target, resolvedFrom: "declared" };
|
|
10206
10213
|
if (this.loadEndpoints !== null)
|
|
10207
10214
|
return this.loadEndpoints;
|
|
10208
|
-
const { knownFields: i } = this.styles.config.data, s =
|
|
10215
|
+
const { knownFields: i } = this.styles.config.data, s = zs(e, {
|
|
10209
10216
|
source: t?.source ?? i.edgeSrcIdPath,
|
|
10210
10217
|
target: t?.target ?? i.edgeDstIdPath
|
|
10211
10218
|
});
|
|
@@ -10219,7 +10226,7 @@ class un {
|
|
|
10219
10226
|
* @returns the existing edge, or null
|
|
10220
10227
|
*/
|
|
10221
10228
|
knownEdgeFor(e, t, i) {
|
|
10222
|
-
if (
|
|
10229
|
+
if (Et(i)) {
|
|
10223
10230
|
const s = this.edgesByRecordId.get(i);
|
|
10224
10231
|
return s === void 0 ? null : this.existingAt(s);
|
|
10225
10232
|
}
|
|
@@ -10253,7 +10260,7 @@ class un {
|
|
|
10253
10260
|
if (s === "keep")
|
|
10254
10261
|
return o.repeatedKept++, !1;
|
|
10255
10262
|
if (s === "error")
|
|
10256
|
-
throw new
|
|
10263
|
+
throw new ae({
|
|
10257
10264
|
code: "E_DUPLICATE_EDGE",
|
|
10258
10265
|
source: "data",
|
|
10259
10266
|
message: `Two edges run from ${JSON.stringify(r)} to ${JSON.stringify(a)}, and data.knownFields.repeatedEdges is "error". Set it to "keep" to hold both, or to "first", "last", "sum", "min" or "max" to fold them into one.`,
|
|
@@ -10261,7 +10268,7 @@ class un {
|
|
|
10261
10268
|
});
|
|
10262
10269
|
if (s === "first")
|
|
10263
10270
|
return o.repeatedDropped++, !0;
|
|
10264
|
-
const n = this.store.builder.edgeWeight(e.edgeIndex), c =
|
|
10271
|
+
const n = this.store.builder.edgeWeight(e.edgeIndex), c = pn(s, n, i);
|
|
10265
10272
|
return this.store.builder.setEdgeWeight(e.edgeIndex, c), this.store.touch(), s === "last" && (e.edge ? e.edge.data = t : e.pending && (e.pending.record = t)), o.repeatedMerged++, !0;
|
|
10266
10273
|
}
|
|
10267
10274
|
/**
|
|
@@ -10284,6 +10291,66 @@ class un {
|
|
|
10284
10291
|
getEdgesBetween(e, t) {
|
|
10285
10292
|
return this.edgeCache.get(e, t);
|
|
10286
10293
|
}
|
|
10294
|
+
/**
|
|
10295
|
+
* Replace every built edge with a new set, or leave the graph exactly as it was.
|
|
10296
|
+
*
|
|
10297
|
+
* The ceiling is decided BEFORE anything is removed. Removing first and letting `addEdges`
|
|
10298
|
+
* refuse would leave a host that assigned too many edges with its old edges gone and none of
|
|
10299
|
+
* the new ones held, which is neither the graph it had nor the one it asked for. The new
|
|
10300
|
+
* batch is counted against an emptied graph, since the old edges are what it replaces; a
|
|
10301
|
+
* pending edge, whose endpoints have not arrived, survives the replace as it always has.
|
|
10302
|
+
* @param edges - the edges the graph should hold afterwards
|
|
10303
|
+
* @param options - the endpoint expressions and the repeat policy for this call
|
|
10304
|
+
* @throws A `GraphtyError` with `E_TOO_LARGE` when the new set is past the ceiling, and
|
|
10305
|
+
* whatever `addEdges` throws.
|
|
10306
|
+
*/
|
|
10307
|
+
setEdges(e, t) {
|
|
10308
|
+
const i = this.store.builder.edgeCount - this.edges.size, s = t?.repeated ?? this.styles.config.data.knownFields.repeatedEdges;
|
|
10309
|
+
this.refuseAboveCeiling(
|
|
10310
|
+
"edges",
|
|
10311
|
+
i,
|
|
10312
|
+
this.edgesAdded(e, this.endpointsFor(e, t), s, !0),
|
|
10313
|
+
_t.edgesDrawn
|
|
10314
|
+
);
|
|
10315
|
+
for (const r of [...this.edges.keys()])
|
|
10316
|
+
this.removeEdge(r);
|
|
10317
|
+
this.addEdges(e, t);
|
|
10318
|
+
}
|
|
10319
|
+
/**
|
|
10320
|
+
* How many edges a batch would add, by the same tests the ingest loop applies.
|
|
10321
|
+
*
|
|
10322
|
+
* A record whose endpoint ids graph-format will not store adds nothing (the loop rejects it).
|
|
10323
|
+
* Under the `keep` policy every other record is an edge. Under a folding policy a record that
|
|
10324
|
+
* repeats an edge the graph holds, or a record earlier in the same batch, folds into it and
|
|
10325
|
+
* adds nothing; a repeat is named the way `knownEdgeFor` names it, by record id when one is
|
|
10326
|
+
* configured and stored, else by the ordered endpoint pair.
|
|
10327
|
+
* @param edges - the batch
|
|
10328
|
+
* @param endpoints - the batch's endpoint expressions
|
|
10329
|
+
* @param policy - the repeat policy the batch is under
|
|
10330
|
+
* @param replacing - true when every held edge is about to be removed, so none of them can be
|
|
10331
|
+
* repeated
|
|
10332
|
+
* @returns the number of edges the batch would add
|
|
10333
|
+
*/
|
|
10334
|
+
edgesAdded(e, t, i, s) {
|
|
10335
|
+
const r = this.styles.config.data.knownFields.edgeIdPath, a = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Map();
|
|
10336
|
+
let n = 0;
|
|
10337
|
+
for (const c of e) {
|
|
10338
|
+
const h = ue(c, t.source), d = ue(c, t.target);
|
|
10339
|
+
if (!(!yt(h) || !yt(d))) {
|
|
10340
|
+
if (i !== "keep") {
|
|
10341
|
+
const u = r === null ? void 0 : ue(c, r);
|
|
10342
|
+
if (!s && this.knownEdgeFor(h, d, u) !== null)
|
|
10343
|
+
continue;
|
|
10344
|
+
const p = o.get(h) ?? /* @__PURE__ */ new Set();
|
|
10345
|
+
if (o.set(h, p), Et(u) ? a.has(u) : p.has(d))
|
|
10346
|
+
continue;
|
|
10347
|
+
Et(u) && a.add(u), p.add(d);
|
|
10348
|
+
}
|
|
10349
|
+
n++;
|
|
10350
|
+
}
|
|
10351
|
+
}
|
|
10352
|
+
return n;
|
|
10353
|
+
}
|
|
10287
10354
|
/**
|
|
10288
10355
|
* Removes an edge from the graph
|
|
10289
10356
|
* @param edgeId - Edge identifier to remove
|
|
@@ -10312,7 +10379,11 @@ class un {
|
|
|
10312
10379
|
applyDeclaredDirection(e, t) {
|
|
10313
10380
|
if (t === null)
|
|
10314
10381
|
return !1;
|
|
10315
|
-
const i =
|
|
10382
|
+
const i = Wo(
|
|
10383
|
+
this.store,
|
|
10384
|
+
t.directed,
|
|
10385
|
+
t.statedBy
|
|
10386
|
+
);
|
|
10316
10387
|
return i === "config-wins" ? this.logger.info("File declares a direction the configuration has already settled", {
|
|
10317
10388
|
type: e,
|
|
10318
10389
|
fileDeclares: t.directed,
|
|
@@ -10339,7 +10410,7 @@ class un {
|
|
|
10339
10410
|
this.logger.info("Loading data source", { type: e, options: t });
|
|
10340
10411
|
const i = Date.now();
|
|
10341
10412
|
let s = 0, r = 0, a = 0;
|
|
10342
|
-
const o =
|
|
10413
|
+
const o = Xi();
|
|
10343
10414
|
this.loadTally = o, this.loadEndpoints = null;
|
|
10344
10415
|
const n = t, c = {
|
|
10345
10416
|
...typeof n.edgeSource == "string" ? { source: n.edgeSource } : {},
|
|
@@ -10348,7 +10419,7 @@ class un {
|
|
|
10348
10419
|
try {
|
|
10349
10420
|
const h = Z.get(e, t);
|
|
10350
10421
|
if (!h)
|
|
10351
|
-
throw
|
|
10422
|
+
throw ga(e);
|
|
10352
10423
|
const d = t.size;
|
|
10353
10424
|
try {
|
|
10354
10425
|
let u = !1;
|
|
@@ -10417,12 +10488,12 @@ class un {
|
|
|
10417
10488
|
u instanceof Error ? u : new Error(String(u)),
|
|
10418
10489
|
"data-loading",
|
|
10419
10490
|
{ chunksLoaded: a, dataSourceType: e }
|
|
10420
|
-
)),
|
|
10491
|
+
)), si(u) ? u : new Error(
|
|
10421
10492
|
`Failed to load data from source '${e}' after ${a} chunks: ${u instanceof Error ? u.message : String(u)}`
|
|
10422
10493
|
);
|
|
10423
10494
|
}
|
|
10424
10495
|
} catch (h) {
|
|
10425
|
-
throw
|
|
10496
|
+
throw si(h) || h instanceof Error && h.message.includes("Failed to load data") ? h : new Error(
|
|
10426
10497
|
`Error initializing data source '${e}': ${h instanceof Error ? h.message : String(h)}`
|
|
10427
10498
|
);
|
|
10428
10499
|
} finally {
|
|
@@ -10442,7 +10513,7 @@ class un {
|
|
|
10442
10513
|
source: this.styles.config.data.knownFields.edgeSrcIdPath ?? "source",
|
|
10443
10514
|
target: this.styles.config.data.knownFields.edgeDstIdPath ?? "target",
|
|
10444
10515
|
resolvedFrom: "source/target"
|
|
10445
|
-
}, s =
|
|
10516
|
+
}, s = Qi(t, {
|
|
10446
10517
|
format: e,
|
|
10447
10518
|
endpoints: i,
|
|
10448
10519
|
policy: this.styles.config.data.knownFields.repeatedEdges,
|
|
@@ -10464,6 +10535,37 @@ class un {
|
|
|
10464
10535
|
heldCounts() {
|
|
10465
10536
|
return { nodes: this.store.builder.nodeCount, edges: this.store.builder.edgeCount };
|
|
10466
10537
|
}
|
|
10538
|
+
/**
|
|
10539
|
+
* Refuse to grow past what the renderer can draw, instead of freezing the tab.
|
|
10540
|
+
*
|
|
10541
|
+
* WHY A REFUSAL AND NOT A DEGRADED DRAW. The design says that above the render ceiling the
|
|
10542
|
+
* element draws a smaller render set, and above `edgesDrawn` it hides edges until the view
|
|
10543
|
+
* narrows. Neither exists yet. What exists is a renderer that, past these counts, exhausts
|
|
10544
|
+
* the renderer process and produces no further frame -- measured for issue #405 at 18,000
|
|
10545
|
+
* nodes / 180,000 edges on an RTX 4070 SUPER, where the renderer process reached 4.7 GB and
|
|
10546
|
+
* died while 17,000 / 170,000 loaded in 17 s. Until the degraded draw lands, the honest
|
|
10547
|
+
* behaviour at the ceiling is a coded error the consumer can show, so `DEFAULT_LIMITS` is
|
|
10548
|
+
* the number the element enforces rather than a number it merely publishes.
|
|
10549
|
+
*
|
|
10550
|
+
* `E_TOO_LARGE` is the code because the ceiling is a hard limit of this renderer, and the
|
|
10551
|
+
* caller's remedy is the one that code names: load a subset.
|
|
10552
|
+
* @param of - what is being counted
|
|
10553
|
+
* @param held - how many the graph holds already
|
|
10554
|
+
* @param adding - how many this call would add
|
|
10555
|
+
* @param limit - the most the renderer can draw
|
|
10556
|
+
* @throws A `GraphtyError` with `E_TOO_LARGE` when `held + adding` is past the limit
|
|
10557
|
+
*/
|
|
10558
|
+
refuseAboveCeiling(e, t, i, s) {
|
|
10559
|
+
if (t + i <= s)
|
|
10560
|
+
return;
|
|
10561
|
+
const { nodes: r, edges: a } = this.heldCounts();
|
|
10562
|
+
throw new ae({
|
|
10563
|
+
code: "E_TOO_LARGE",
|
|
10564
|
+
source: "data",
|
|
10565
|
+
message: `Loading ${i.toLocaleString("en-US")} more ${e} would take the graph to ${(t + i).toLocaleString("en-US")}, past the ${s.toLocaleString("en-US")} this renderer can draw. Load a subset of the graph.`,
|
|
10566
|
+
details: { limit: s, count: t + i, of: e, graph: { nodes: r, edges: a } }
|
|
10567
|
+
});
|
|
10568
|
+
}
|
|
10467
10569
|
// Utility methods
|
|
10468
10570
|
/**
|
|
10469
10571
|
* Clear all data
|
|
@@ -10491,9 +10593,9 @@ class un {
|
|
|
10491
10593
|
};
|
|
10492
10594
|
}
|
|
10493
10595
|
}
|
|
10494
|
-
class
|
|
10596
|
+
class fn {
|
|
10495
10597
|
constructor() {
|
|
10496
|
-
this.graphObservable = new
|
|
10598
|
+
this.graphObservable = new Bt(), this.nodeObservable = new Bt(), this.edgeObservable = new Bt(), this.observers = /* @__PURE__ */ new Map(), this.errorRetryCount = 3, this.errorRetryDelay = 1e3;
|
|
10497
10599
|
}
|
|
10498
10600
|
// Expose for testing and advanced usage
|
|
10499
10601
|
/**
|
|
@@ -10836,7 +10938,18 @@ class gn {
|
|
|
10836
10938
|
case "zoom-to-fit-complete":
|
|
10837
10939
|
case "graph-frame-stable":
|
|
10838
10940
|
case "elements-removed":
|
|
10839
|
-
case "selection-changed":
|
|
10941
|
+
case "selection-changed":
|
|
10942
|
+
case "ai-status-change":
|
|
10943
|
+
case "ai-command-start":
|
|
10944
|
+
case "ai-command-complete":
|
|
10945
|
+
case "ai-command-error":
|
|
10946
|
+
case "ai-command-cancelled":
|
|
10947
|
+
case "ai-stream-chunk":
|
|
10948
|
+
case "ai-stream-tool-call":
|
|
10949
|
+
case "ai-stream-tool-result":
|
|
10950
|
+
case "ai-voice-start":
|
|
10951
|
+
case "ai-voice-transcript":
|
|
10952
|
+
case "ai-voice-end": {
|
|
10840
10953
|
const s = this.graphObservable.add((r) => {
|
|
10841
10954
|
r.type === e && t(r);
|
|
10842
10955
|
});
|
|
@@ -10954,7 +11067,7 @@ class gn {
|
|
|
10954
11067
|
throw r ?? new Error("Operation failed with no recorded error");
|
|
10955
11068
|
}
|
|
10956
11069
|
}
|
|
10957
|
-
class
|
|
11070
|
+
class yn {
|
|
10958
11071
|
/**
|
|
10959
11072
|
* Creates an instance of DefaultGraphContext
|
|
10960
11073
|
* @param styles - Reads the element's configuration document. A function rather than the
|
|
@@ -11073,13 +11186,13 @@ class pn {
|
|
|
11073
11186
|
}
|
|
11074
11187
|
}
|
|
11075
11188
|
var ze = /* @__PURE__ */ ((l) => (l[l.Mouse = 0] = "Mouse", l[l.Touch = 1] = "Touch", l))(ze || {}), Ae = /* @__PURE__ */ ((l) => (l[l.Left = 0] = "Left", l[l.Middle = 1] = "Middle", l[l.Right = 2] = "Right", l))(Ae || {});
|
|
11076
|
-
class
|
|
11189
|
+
class Yt {
|
|
11077
11190
|
/**
|
|
11078
11191
|
* Creates a new BabylonInputSystem instance
|
|
11079
11192
|
* @param scene - The Babylon.js scene to attach to
|
|
11080
11193
|
*/
|
|
11081
11194
|
constructor(e) {
|
|
11082
|
-
this.onPointerMove = new W(), this.onPointerDown = new W(), this.onPointerUp = new W(), this.onWheel = new W(), this.onTouchStart = new W(), this.onTouchMove = new W(), this.onTouchEnd = new W(), this.onKeyDown = new W(), this.onKeyUp = new W(), this.element = null, this.pointerPosition = new
|
|
11195
|
+
this.onPointerMove = new W(), this.onPointerDown = new W(), this.onPointerUp = new W(), this.onWheel = new W(), this.onTouchStart = new W(), this.onTouchMove = new W(), this.onTouchEnd = new W(), this.onKeyDown = new W(), this.onKeyUp = new W(), this.element = null, this.pointerPosition = new Ps(0, 0), this.pointerStates = /* @__PURE__ */ new Map(), this.activeTouches = /* @__PURE__ */ new Map(), this.handleTouchStart = (t) => {
|
|
11083
11196
|
const i = this.extractTouches(t.touches);
|
|
11084
11197
|
i.forEach((s) => this.activeTouches.set(s.id, s)), this.onTouchStart.notifyObservers(i);
|
|
11085
11198
|
}, this.handleTouchMove = (t) => {
|
|
@@ -11117,10 +11230,10 @@ class Zt {
|
|
|
11117
11230
|
}), this.scene.onKeyboardObservable.add((e) => {
|
|
11118
11231
|
const t = this.convertKeyboardInfo(e);
|
|
11119
11232
|
switch (e.type) {
|
|
11120
|
-
case
|
|
11233
|
+
case zi.KEYDOWN:
|
|
11121
11234
|
this.onKeyDown.notifyObservers(t);
|
|
11122
11235
|
break;
|
|
11123
|
-
case
|
|
11236
|
+
case zi.KEYUP:
|
|
11124
11237
|
this.onKeyUp.notifyObservers(t);
|
|
11125
11238
|
break;
|
|
11126
11239
|
}
|
|
@@ -11209,9 +11322,9 @@ class Zt {
|
|
|
11209
11322
|
this.detach(), this.onPointerMove.clear(), this.onPointerDown.clear(), this.onPointerUp.clear(), this.onWheel.clear(), this.onTouchStart.clear(), this.onTouchMove.clear(), this.onTouchEnd.clear(), this.onKeyDown.clear(), this.onKeyUp.clear();
|
|
11210
11323
|
}
|
|
11211
11324
|
}
|
|
11212
|
-
class
|
|
11325
|
+
class Ct {
|
|
11213
11326
|
constructor() {
|
|
11214
|
-
this.onPointerMove = new W(), this.onPointerDown = new W(), this.onPointerUp = new W(), this.onWheel = new W(), this.onTouchStart = new W(), this.onTouchMove = new W(), this.onTouchEnd = new W(), this.onKeyDown = new W(), this.onKeyUp = new W(), this.pointerPosition = new
|
|
11327
|
+
this.onPointerMove = new W(), this.onPointerDown = new W(), this.onPointerUp = new W(), this.onWheel = new W(), this.onTouchStart = new W(), this.onTouchMove = new W(), this.onTouchEnd = new W(), this.onKeyDown = new W(), this.onKeyUp = new W(), this.pointerPosition = new Ps(0, 0), this.pointerStates = /* @__PURE__ */ new Map(), this.activeTouches = /* @__PURE__ */ new Map(), this.activeKeys = /* @__PURE__ */ new Set(), this._nextPointerId = 1, this.attached = !1;
|
|
11215
11328
|
}
|
|
11216
11329
|
// Device simulation
|
|
11217
11330
|
/**
|
|
@@ -11463,14 +11576,14 @@ class St {
|
|
|
11463
11576
|
this.pointerPosition.set(0, 0), this.pointerStates.clear(), this.activeTouches.clear(), this.activeKeys.clear();
|
|
11464
11577
|
}
|
|
11465
11578
|
}
|
|
11466
|
-
class
|
|
11579
|
+
class wn {
|
|
11467
11580
|
/**
|
|
11468
11581
|
* Creates an instance of InputManager
|
|
11469
11582
|
* @param context - Manager context providing access to scene, canvas, and event manager
|
|
11470
11583
|
* @param config - Input manager configuration options
|
|
11471
11584
|
*/
|
|
11472
11585
|
constructor(e, t = {}) {
|
|
11473
|
-
this.context = e, this.config = t, this.enabled = !0, this.recordedEvents = [], this.playbackIndex = 0, this.playbackStartTime = 0, this.inputSystem = this.config.useMockInput ? new
|
|
11586
|
+
this.context = e, this.config = t, this.enabled = !0, this.recordedEvents = [], this.playbackIndex = 0, this.playbackStartTime = 0, this.inputSystem = this.config.useMockInput ? new Ct() : new Yt(this.context.scene), this.onPointerMove = this.inputSystem.onPointerMove, this.onPointerDown = this.inputSystem.onPointerDown, this.onPointerUp = this.inputSystem.onPointerUp, this.onWheel = this.inputSystem.onWheel, this.onTouchStart = this.inputSystem.onTouchStart, this.onTouchMove = this.inputSystem.onTouchMove, this.onTouchEnd = this.inputSystem.onTouchEnd, this.onKeyDown = this.inputSystem.onKeyDown, this.onKeyUp = this.inputSystem.onKeyUp;
|
|
11474
11587
|
}
|
|
11475
11588
|
/**
|
|
11476
11589
|
* Initializes the input manager and sets up event bridges
|
|
@@ -11497,7 +11610,7 @@ class mn {
|
|
|
11497
11610
|
* @param enabled - Whether input should be enabled
|
|
11498
11611
|
*/
|
|
11499
11612
|
setEnabled(e) {
|
|
11500
|
-
this.enabled = e, !e && this.inputSystem instanceof
|
|
11613
|
+
this.enabled = e, !e && this.inputSystem instanceof Yt ? this.inputSystem.detach() : e && this.inputSystem instanceof Yt && this.inputSystem.attach(this.context.canvas), this.context.eventManager.emitGraphEvent("input-enabled-changed", { enabled: e });
|
|
11501
11614
|
}
|
|
11502
11615
|
/**
|
|
11503
11616
|
* Get the current pointer position
|
|
@@ -11527,7 +11640,7 @@ class mn {
|
|
|
11527
11640
|
* @throws Error if not using mock input
|
|
11528
11641
|
*/
|
|
11529
11642
|
getMockInputSystem() {
|
|
11530
|
-
if (!(this.inputSystem instanceof
|
|
11643
|
+
if (!(this.inputSystem instanceof Ct))
|
|
11531
11644
|
throw new Error("Not using mock input system");
|
|
11532
11645
|
return this.inputSystem;
|
|
11533
11646
|
}
|
|
@@ -11554,7 +11667,7 @@ class mn {
|
|
|
11554
11667
|
startPlayback(e) {
|
|
11555
11668
|
if (e && (this.recordedEvents = e), this.recordedEvents.length === 0)
|
|
11556
11669
|
throw new Error("No events to playback");
|
|
11557
|
-
return this.inputSystem instanceof
|
|
11670
|
+
return this.inputSystem instanceof Ct || (this.inputSystem.dispose(), this.inputSystem = new Ct(), this.inputSystem.attach(this.context.canvas), this.setupEventBridges()), this.playbackIndex = 0, this.playbackStartTime = Date.now(), this.runPlayback();
|
|
11558
11671
|
}
|
|
11559
11672
|
/**
|
|
11560
11673
|
* Set up bridges between input system and event manager
|
|
@@ -11695,13 +11808,13 @@ class mn {
|
|
|
11695
11808
|
}));
|
|
11696
11809
|
}
|
|
11697
11810
|
}
|
|
11698
|
-
const
|
|
11699
|
-
forceatlas2:
|
|
11700
|
-
fruchtermanReingold:
|
|
11701
|
-
spring:
|
|
11702
|
-
"spring-electrical":
|
|
11703
|
-
},
|
|
11704
|
-
function
|
|
11811
|
+
const vn = 256, bn = {
|
|
11812
|
+
forceatlas2: ys.zodOptionsSchema,
|
|
11813
|
+
fruchtermanReingold: ti.zodOptionsSchema,
|
|
11814
|
+
spring: ti.zodOptionsSchema,
|
|
11815
|
+
"spring-electrical": fs.zodOptionsSchema
|
|
11816
|
+
}, Sn = 100;
|
|
11817
|
+
function En(l, e) {
|
|
11705
11818
|
const t = { dim: e.dim, seed: e.seed };
|
|
11706
11819
|
switch (l) {
|
|
11707
11820
|
case "forceatlas2":
|
|
@@ -11744,14 +11857,14 @@ function vn(l, e) {
|
|
|
11744
11857
|
}
|
|
11745
11858
|
}
|
|
11746
11859
|
}
|
|
11747
|
-
function
|
|
11748
|
-
return (l.scalingFactor ??
|
|
11860
|
+
function Cn(l) {
|
|
11861
|
+
return (l.scalingFactor ?? Sn) * (l.scale ?? 1);
|
|
11749
11862
|
}
|
|
11750
|
-
function
|
|
11751
|
-
const i =
|
|
11863
|
+
function Mn(l, e, t) {
|
|
11864
|
+
const i = kr(bn[l]).parse(e), s = typeof e.iterationsPerStep == "number" ? e.iterationsPerStep : void 0, r = typeof e.maxInFlight == "number" ? e.maxInFlight : void 0;
|
|
11752
11865
|
return {
|
|
11753
|
-
model:
|
|
11754
|
-
scalingFactor:
|
|
11866
|
+
model: En(l, i),
|
|
11867
|
+
scalingFactor: Cn(i),
|
|
11755
11868
|
iterationsPerStep: s ?? t.iterationsPerStep ?? null,
|
|
11756
11869
|
maxInFlight: r ?? t.maxInFlight,
|
|
11757
11870
|
settleThreshold: typeof e.settleThreshold == "number" ? e.settleThreshold : void 0,
|
|
@@ -11759,18 +11872,18 @@ function Sn(l, e, t) {
|
|
|
11759
11872
|
stepMultiplier: t.stepMultiplier
|
|
11760
11873
|
};
|
|
11761
11874
|
}
|
|
11762
|
-
function
|
|
11763
|
-
return e === void 0 ? { ...t } :
|
|
11875
|
+
function xn(l, e, t) {
|
|
11876
|
+
return e === void 0 ? { ...t } : Cs(e.options, t, { kind: "layout", id: l });
|
|
11764
11877
|
}
|
|
11765
|
-
function
|
|
11766
|
-
return new
|
|
11878
|
+
function as(l) {
|
|
11879
|
+
return new ae({
|
|
11767
11880
|
code: "E_UNKNOWN_LAYOUT",
|
|
11768
11881
|
message: `no layout named "${l}" is registered`,
|
|
11769
11882
|
source: "layout",
|
|
11770
11883
|
details: { layout: l, available: V.getRegisteredTypes() }
|
|
11771
11884
|
});
|
|
11772
11885
|
}
|
|
11773
|
-
class
|
|
11886
|
+
class Tn {
|
|
11774
11887
|
/**
|
|
11775
11888
|
* Creates an instance of LayoutManager
|
|
11776
11889
|
* @param eventManager - Event manager for emitting layout events
|
|
@@ -11778,7 +11891,7 @@ class Cn {
|
|
|
11778
11891
|
* @param styles - Styles instance for layout configuration
|
|
11779
11892
|
*/
|
|
11780
11893
|
constructor(e, t, i) {
|
|
11781
|
-
this.eventManager = e, this.dataManager = t, this.styles = i, this._running = !1, this.preStepsOwed = !1, this.logger =
|
|
11894
|
+
this.eventManager = e, this.dataManager = t, this.styles = i, this._running = !1, this.preStepsOwed = !1, this.logger = ge.getLogger(["graphty", "layout"]), this.graphContext = null, this.acceleration = null, this.unsubscribeAcceleration = null, this.unsubscribeSnapshot = null;
|
|
11782
11895
|
const s = this.eventManager.onGraphEvent.add((r) => {
|
|
11783
11896
|
r.type === "snapshot-replaced" && this.onSnapshotReplaced(r);
|
|
11784
11897
|
});
|
|
@@ -11805,7 +11918,7 @@ class Cn {
|
|
|
11805
11918
|
*/
|
|
11806
11919
|
set running(e) {
|
|
11807
11920
|
const t = e && !this._running;
|
|
11808
|
-
this._running = e, t && this.layoutEngine instanceof
|
|
11921
|
+
this._running = e, t && this.layoutEngine instanceof pe && this.layoutEngine.isSettled && this.layoutEngine.reheat();
|
|
11809
11922
|
}
|
|
11810
11923
|
/**
|
|
11811
11924
|
* Set the GraphContext for error reporting
|
|
@@ -11831,7 +11944,7 @@ class Cn {
|
|
|
11831
11944
|
*/
|
|
11832
11945
|
onAccelerationChange() {
|
|
11833
11946
|
const e = this.acceleration, t = this.layoutEngine;
|
|
11834
|
-
if (!(e === null || !(t instanceof
|
|
11947
|
+
if (!(e === null || !(t instanceof pe) || !t.builtWithChanged(e.accelerator)))
|
|
11835
11948
|
try {
|
|
11836
11949
|
t.replaceSimulation(), this.running = !0;
|
|
11837
11950
|
} catch (i) {
|
|
@@ -11844,7 +11957,7 @@ class Cn {
|
|
|
11844
11957
|
*/
|
|
11845
11958
|
onSnapshotReplaced(e) {
|
|
11846
11959
|
const t = this.layoutEngine;
|
|
11847
|
-
if (t instanceof
|
|
11960
|
+
if (t instanceof pe)
|
|
11848
11961
|
try {
|
|
11849
11962
|
t.reload(e.next, this.dataManager.positions.view(e.next.nodeCount)), this.running = !0;
|
|
11850
11963
|
} catch (i) {
|
|
@@ -11856,7 +11969,7 @@ class Cn {
|
|
|
11856
11969
|
* @param error - Whatever was thrown.
|
|
11857
11970
|
*/
|
|
11858
11971
|
reportSimulationFailure(e) {
|
|
11859
|
-
const t =
|
|
11972
|
+
const t = ae.wrap(e, { code: "E_INTERNAL", source: "layout" });
|
|
11860
11973
|
this.logger.error("The running layout could not be rebuilt", t, {
|
|
11861
11974
|
layoutType: this.layoutType
|
|
11862
11975
|
}), this.eventManager.emitGraphError(this.graphContext, t, "layout", { layoutType: this.layoutType });
|
|
@@ -11891,8 +12004,8 @@ class Cn {
|
|
|
11891
12004
|
this.logger.info("Setting layout", { type: e, options: t });
|
|
11892
12005
|
const i = V.getClass(e);
|
|
11893
12006
|
if (!i)
|
|
11894
|
-
throw
|
|
11895
|
-
const s =
|
|
12007
|
+
throw as(e);
|
|
12008
|
+
const s = xn(e, i.descriptor, t), r = { ...s }, o = this.styles.config.graph.viewMode === "2d" || this.styles.config.graph.twoD ? 2 : 3, n = V.getOptionsForDimensionByType(e, o);
|
|
11896
12009
|
if (n)
|
|
11897
12010
|
for (const [m, y] of Object.entries(n))
|
|
11898
12011
|
m in r || (r[m] = y);
|
|
@@ -11903,7 +12016,7 @@ class Cn {
|
|
|
11903
12016
|
h = V.get(e, r);
|
|
11904
12017
|
else {
|
|
11905
12018
|
if (this.acceleration === null)
|
|
11906
|
-
throw new
|
|
12019
|
+
throw new ae({
|
|
11907
12020
|
code: "E_INTERNAL",
|
|
11908
12021
|
message: `the layout "${e}" runs on the graph's acceleration controller, and this layout manager has no graph context to read one from`,
|
|
11909
12022
|
source: "layout",
|
|
@@ -11913,7 +12026,7 @@ class Cn {
|
|
|
11913
12026
|
const m = {
|
|
11914
12027
|
type: c,
|
|
11915
12028
|
layoutType: e,
|
|
11916
|
-
options:
|
|
12029
|
+
options: Mn(
|
|
11917
12030
|
c,
|
|
11918
12031
|
r,
|
|
11919
12032
|
this.styles.config.behavior.layout
|
|
@@ -11924,13 +12037,13 @@ class Cn {
|
|
|
11924
12037
|
},
|
|
11925
12038
|
dataManager: this.dataManager
|
|
11926
12039
|
};
|
|
11927
|
-
h = new
|
|
12040
|
+
h = new pe(m);
|
|
11928
12041
|
}
|
|
11929
12042
|
} catch (m) {
|
|
11930
12043
|
throw this.reportLayoutFailure(e, m, "built");
|
|
11931
12044
|
}
|
|
11932
12045
|
if (!h)
|
|
11933
|
-
throw
|
|
12046
|
+
throw as(e);
|
|
11934
12047
|
const d = this.layoutEngine, u = this.currentLayoutOptions, p = this.engineDimension;
|
|
11935
12048
|
this.currentLayoutOptions = s;
|
|
11936
12049
|
try {
|
|
@@ -11990,7 +12103,7 @@ class Cn {
|
|
|
11990
12103
|
*/
|
|
11991
12104
|
reportLayoutFailure(e, t, i) {
|
|
11992
12105
|
const s = t instanceof Error ? t : new Error(String(t));
|
|
11993
|
-
return this.logger.error(`Layout could not be ${i}`, s, { layoutType: e }), this.graphContext && this.eventManager.emitGraphError(this.graphContext, s, "layout", { layoutType: e, phase: i }),
|
|
12106
|
+
return this.logger.error(`Layout could not be ${i}`, s, { layoutType: e }), this.graphContext && this.eventManager.emitGraphError(this.graphContext, s, "layout", { layoutType: e, phase: i }), si(s) ? s : new ae({
|
|
11994
12107
|
code: "E_INTERNAL",
|
|
11995
12108
|
message: `the layout "${e}" could not be ${i}: ${s.message}`,
|
|
11996
12109
|
source: "layout",
|
|
@@ -12030,9 +12143,9 @@ class Cn {
|
|
|
12030
12143
|
*/
|
|
12031
12144
|
async spendPreSteps(e) {
|
|
12032
12145
|
const { preSteps: t } = this.styles.config.behavior.layout;
|
|
12033
|
-
if (this.preStepsOwed = !1, e instanceof
|
|
12146
|
+
if (this.preStepsOwed = !1, e instanceof pe)
|
|
12034
12147
|
for (let i = t; i > 0 && !e.isSettled; ) {
|
|
12035
|
-
const s = Math.min(i,
|
|
12148
|
+
const s = Math.min(i, vn);
|
|
12036
12149
|
await e.stepAsync(s), i -= s;
|
|
12037
12150
|
}
|
|
12038
12151
|
else
|
|
@@ -12193,7 +12306,7 @@ class Cn {
|
|
|
12193
12306
|
* @returns A promise that resolves once the newcomers have been placed.
|
|
12194
12307
|
*/
|
|
12195
12308
|
updatePositions(e) {
|
|
12196
|
-
return !this.layoutEngine || e.length === 0 ? Promise.resolve() : (this.running = !0, this.layoutEngine instanceof
|
|
12309
|
+
return !this.layoutEngine || e.length === 0 ? Promise.resolve() : (this.running = !0, this.layoutEngine instanceof pe ? (this.dataManager.getSnapshot(), this.eventManager.emitGraphEvent("layout-updated", {
|
|
12197
12310
|
nodeCount: e.length,
|
|
12198
12311
|
type: "incremental"
|
|
12199
12312
|
}), Promise.resolve()) : (this.layoutEngine.updatePositions(e), this.layoutEngine.publishPositions(), this.eventManager.emitGraphEvent("layout-updated", {
|
|
@@ -12202,10 +12315,10 @@ class Cn {
|
|
|
12202
12315
|
}), Promise.resolve()));
|
|
12203
12316
|
}
|
|
12204
12317
|
}
|
|
12205
|
-
function
|
|
12318
|
+
function Pn(l) {
|
|
12206
12319
|
return "startRenderLoop" in l;
|
|
12207
12320
|
}
|
|
12208
|
-
class
|
|
12321
|
+
class An {
|
|
12209
12322
|
/**
|
|
12210
12323
|
* Creates a new lifecycle manager for coordinating manager initialization and disposal
|
|
12211
12324
|
* @param managers - Map of manager names to manager instances
|
|
@@ -12213,7 +12326,7 @@ class xn {
|
|
|
12213
12326
|
* @param initOrder - Array of manager names defining initialization order
|
|
12214
12327
|
*/
|
|
12215
12328
|
constructor(e, t, i) {
|
|
12216
|
-
this.managers = e, this.eventManager = t, this.initOrder = i, this.initialized = !1, this.initializing = !1, this.logger =
|
|
12329
|
+
this.managers = e, this.eventManager = t, this.initOrder = i, this.initialized = !1, this.initializing = !1, this.logger = ge.getLogger(["graphty", "lifecycle"]);
|
|
12217
12330
|
}
|
|
12218
12331
|
/**
|
|
12219
12332
|
* Initialize all managers in the specified order
|
|
@@ -12277,7 +12390,7 @@ class xn {
|
|
|
12277
12390
|
throw new Error("Cannot start graph before initialization");
|
|
12278
12391
|
try {
|
|
12279
12392
|
const t = this.managers.get("render");
|
|
12280
|
-
t &&
|
|
12393
|
+
t && Pn(t) && t.startRenderLoop(e), this.eventManager.emitGraphEvent("graph-started", {
|
|
12281
12394
|
timestamp: Date.now()
|
|
12282
12395
|
});
|
|
12283
12396
|
} catch (t) {
|
|
@@ -12371,7 +12484,7 @@ class xn {
|
|
|
12371
12484
|
return this.managers.get(e);
|
|
12372
12485
|
}
|
|
12373
12486
|
}
|
|
12374
|
-
const
|
|
12487
|
+
const On = {
|
|
12375
12488
|
// Data operations obsolete dependent calculations.
|
|
12376
12489
|
//
|
|
12377
12490
|
// WHAT `algorithm-run` MEANS HERE, because the rule below is only correct for one reading of
|
|
@@ -12446,7 +12559,7 @@ const Tn = {
|
|
|
12446
12559
|
respectProgress: !1
|
|
12447
12560
|
// The latest view the consumer asked for is the one to draw
|
|
12448
12561
|
}
|
|
12449
|
-
},
|
|
12562
|
+
}, Rn = 90, In = 1e3, Dn = 10, Ne = class Ne {
|
|
12450
12563
|
/**
|
|
12451
12564
|
* Creates a new operation queue manager
|
|
12452
12565
|
* @param eventManager - Event manager for emitting operation events
|
|
@@ -12457,13 +12570,13 @@ const Tn = {
|
|
|
12457
12570
|
* @param options.interval - Time interval in milliseconds
|
|
12458
12571
|
*/
|
|
12459
12572
|
constructor(e, t = {}) {
|
|
12460
|
-
this.eventManager = e, this.pendingOperations = /* @__PURE__ */ new Map(), this.operationCounter = 0, this.batchingEnabled = !0, this.currentBatch = /* @__PURE__ */ new Set(), this.logger =
|
|
12573
|
+
this.eventManager = e, this.pendingOperations = /* @__PURE__ */ new Map(), this.operationCounter = 0, this.batchingEnabled = !0, this.currentBatch = /* @__PURE__ */ new Set(), this.logger = ge.getLogger(["graphty", "operation"]), this.operationProgress = /* @__PURE__ */ new Map(), this.activeControllers = /* @__PURE__ */ new Map(), this.runningOperations = /* @__PURE__ */ new Map(), this.queuedOperations = /* @__PURE__ */ new Map(), this.completedCategories = /* @__PURE__ */ new Set(), this.batchMode = !1, this.batchOperations = /* @__PURE__ */ new Set(), this.batchPromises = /* @__PURE__ */ new Map(), this.triggers = /* @__PURE__ */ new Map();
|
|
12461
12574
|
const i = {
|
|
12462
12575
|
concurrency: t.concurrency ?? 1,
|
|
12463
12576
|
// Sequential by default
|
|
12464
12577
|
autoStart: t.autoStart ?? !0
|
|
12465
12578
|
};
|
|
12466
|
-
t.intervalCap !== void 0 && (i.intervalCap = t.intervalCap), t.interval !== void 0 && (i.interval = t.interval), this.queue = new
|
|
12579
|
+
t.intervalCap !== void 0 && (i.intervalCap = t.intervalCap), t.interval !== void 0 && (i.interval = t.interval), this.queue = new Sa(i), this.queue.on("active", () => {
|
|
12467
12580
|
this.eventManager.emitGraphEvent("operation-queue-active", {
|
|
12468
12581
|
size: this.queue.size,
|
|
12469
12582
|
pending: this.queue.pending
|
|
@@ -12530,7 +12643,7 @@ const Tn = {
|
|
|
12530
12643
|
* @param newOperation - The new operation to check for obsolescence rules
|
|
12531
12644
|
*/
|
|
12532
12645
|
applyObsolescenceRules(e) {
|
|
12533
|
-
const { metadata: t } = e, i =
|
|
12646
|
+
const { metadata: t } = e, i = On[e.category];
|
|
12534
12647
|
if (!t?.obsoletes && !t?.shouldObsolete && !t?.respectProgress && !t?.skipRunning && !i?.obsoletes)
|
|
12535
12648
|
return;
|
|
12536
12649
|
const s = t?.obsoletes ?? [], r = i?.obsoletes ?? [], a = [.../* @__PURE__ */ new Set([...s, ...r])], o = t?.shouldObsolete, n = t?.skipRunning ?? i?.skipRunning ?? !1, c = t?.respectProgress ?? i?.respectProgress ?? !0, h = [
|
|
@@ -12549,7 +12662,7 @@ const Tn = {
|
|
|
12549
12662
|
})), u) {
|
|
12550
12663
|
if (c && this.runningOperations.has(d.id)) {
|
|
12551
12664
|
const m = this.operationProgress.get(d.id);
|
|
12552
|
-
if (m && m.percent >=
|
|
12665
|
+
if (m && m.percent >= Rn)
|
|
12553
12666
|
continue;
|
|
12554
12667
|
}
|
|
12555
12668
|
const p = this.activeControllers.get(d.id);
|
|
@@ -12591,7 +12704,7 @@ const Tn = {
|
|
|
12591
12704
|
} finally {
|
|
12592
12705
|
setTimeout(() => {
|
|
12593
12706
|
this.operationProgress.delete(s.id), this.activeControllers.delete(s.id);
|
|
12594
|
-
},
|
|
12707
|
+
}, In);
|
|
12595
12708
|
}
|
|
12596
12709
|
},
|
|
12597
12710
|
{
|
|
@@ -12630,7 +12743,7 @@ const Tn = {
|
|
|
12630
12743
|
});
|
|
12631
12744
|
let r;
|
|
12632
12745
|
try {
|
|
12633
|
-
r =
|
|
12746
|
+
r = Ea.array(i, s);
|
|
12634
12747
|
} catch (o) {
|
|
12635
12748
|
this.eventManager.emitGraphError(
|
|
12636
12749
|
null,
|
|
@@ -12894,7 +13007,7 @@ const Tn = {
|
|
|
12894
13007
|
*/
|
|
12895
13008
|
async _waitForOperation(e) {
|
|
12896
13009
|
for (; this.pendingOperations.has(e) || this.queuedOperations.has(e) || this.runningOperations.has(e); )
|
|
12897
|
-
await new Promise((t) => setTimeout(t,
|
|
13010
|
+
await new Promise((t) => setTimeout(t, Dn));
|
|
12898
13011
|
}
|
|
12899
13012
|
/**
|
|
12900
13013
|
* Get the AbortController for a specific operation
|
|
@@ -13061,8 +13174,8 @@ Ne.CATEGORY_DEPENDENCIES = [
|
|
|
13061
13174
|
"data-update": ["layout-update"],
|
|
13062
13175
|
"algorithm-run": ["style-apply"]
|
|
13063
13176
|
};
|
|
13064
|
-
let
|
|
13065
|
-
class
|
|
13177
|
+
let mi = Ne;
|
|
13178
|
+
class Ln {
|
|
13066
13179
|
/**
|
|
13067
13180
|
* Creates a new CameraManager instance.
|
|
13068
13181
|
* @param scene - The Babylon.js scene to manage cameras for
|
|
@@ -13141,14 +13254,14 @@ class Rn {
|
|
|
13141
13254
|
this.activeInputHandler?.disable(), this.activeCameraController?.camera.detachControl(), this.activeCameraController = null, this.activeInputHandler = null, this.controllers.clear(), this.inputs.clear();
|
|
13142
13255
|
}
|
|
13143
13256
|
}
|
|
13144
|
-
const Ie =
|
|
13145
|
-
class
|
|
13257
|
+
const Ie = ge.getLogger(["graphty", "camera", "pivot"]);
|
|
13258
|
+
class Fn {
|
|
13146
13259
|
/**
|
|
13147
13260
|
* Creates a new PivotController instance.
|
|
13148
13261
|
* @param scene - The Babylon.js scene to create the pivot in
|
|
13149
13262
|
*/
|
|
13150
13263
|
constructor(e) {
|
|
13151
|
-
this.accumulatedYaw = 0, this.accumulatedPitch = 0, this.frameCount = 0, this.pivot = new
|
|
13264
|
+
this.accumulatedYaw = 0, this.accumulatedPitch = 0, this.frameCount = 0, this.pivot = new bi("xrPivot", e), this.pivot.position = v.Zero(), this.pivot.rotationQuaternion = oe.Identity(), Ie.debug("Created pivot node");
|
|
13152
13265
|
}
|
|
13153
13266
|
/**
|
|
13154
13267
|
* Rotate the pivot by yaw (Y-axis) and pitch (X-axis) deltas.
|
|
@@ -13159,7 +13272,7 @@ class In {
|
|
|
13159
13272
|
rotate(e, t) {
|
|
13160
13273
|
this.frameCount++;
|
|
13161
13274
|
const i = Math.abs(e) > 1e-4, s = Math.abs(t) > 1e-4;
|
|
13162
|
-
!i && !s || (this.accumulatedYaw += e, this.accumulatedPitch += t, i && this.pivot.rotate(
|
|
13275
|
+
!i && !s || (this.accumulatedYaw += e, this.accumulatedPitch += t, i && this.pivot.rotate(Ut.Y, e, Gt.LOCAL), s && this.pivot.rotate(Ut.X, t, Gt.LOCAL), this.frameCount % 30 === 0 && Ie.trace("Rotate", {
|
|
13163
13276
|
yawDelta: e * 180 / Math.PI,
|
|
13164
13277
|
pitchDelta: t * 180 / Math.PI,
|
|
13165
13278
|
accYaw: this.accumulatedYaw * 180 / Math.PI,
|
|
@@ -13175,7 +13288,7 @@ class In {
|
|
|
13175
13288
|
rotateAroundAxis(e, t) {
|
|
13176
13289
|
if (Math.abs(t) < 1e-4 || e.length() < 1e-4)
|
|
13177
13290
|
return;
|
|
13178
|
-
const i = e.normalize(), s = this.pivot.rotationQuaternion ??
|
|
13291
|
+
const i = e.normalize(), s = this.pivot.rotationQuaternion ?? oe.Identity(), r = oe.RotationAxis(i, t);
|
|
13179
13292
|
this.pivot.rotationQuaternion = r.multiply(s), this.frameCount % 30 === 0 && Ie.trace("RotateAroundAxis", {
|
|
13180
13293
|
axis: { x: i.x, y: i.y, z: i.z },
|
|
13181
13294
|
angle: t * 180 / Math.PI
|
|
@@ -13186,7 +13299,7 @@ class In {
|
|
|
13186
13299
|
* @param delta - The rotation angle in radians
|
|
13187
13300
|
*/
|
|
13188
13301
|
spin(e) {
|
|
13189
|
-
Math.abs(e) > 1e-4 && this.pivot.rotate(
|
|
13302
|
+
Math.abs(e) > 1e-4 && this.pivot.rotate(Ut.Z, e, Gt.LOCAL);
|
|
13190
13303
|
}
|
|
13191
13304
|
/**
|
|
13192
13305
|
* Zoom by scaling the pivot uniformly.
|
|
@@ -13234,11 +13347,11 @@ class In {
|
|
|
13234
13347
|
* - Unit scale
|
|
13235
13348
|
*/
|
|
13236
13349
|
reset() {
|
|
13237
|
-
this.pivot.position = v.Zero(), this.pivot.rotationQuaternion =
|
|
13350
|
+
this.pivot.position = v.Zero(), this.pivot.rotationQuaternion = oe.Identity(), this.pivot.scaling.setAll(1), this.accumulatedYaw = 0, this.accumulatedPitch = 0, Ie.debug("Reset to initial state");
|
|
13238
13351
|
}
|
|
13239
13352
|
}
|
|
13240
|
-
const
|
|
13241
|
-
class
|
|
13353
|
+
const Nn = 1e4;
|
|
13354
|
+
class kn {
|
|
13242
13355
|
/** Half the diagonal of the last bounding box fitted by zoomToBoundingBox. */
|
|
13243
13356
|
#e = 0;
|
|
13244
13357
|
/**
|
|
@@ -13256,7 +13369,7 @@ class Ln {
|
|
|
13256
13369
|
* @param config - Configuration options for the orbit camera
|
|
13257
13370
|
*/
|
|
13258
13371
|
constructor(e, t, i) {
|
|
13259
|
-
this.config = i, this.scene = t, this.scene.clearColor = new
|
|
13372
|
+
this.config = i, this.scene = t, this.scene.clearColor = new Ce(0, 0, 0, 1), this.pivotController = new Fn(t), this.cameraDistance = 10, this.camera = new ia("camera", new v(0, 0, -this.cameraDistance), this.scene), this.camera.inputs.clear(), this.scene.activeCamera = this.camera, this.camera.attachControl(e, !0), this.updateCameraPosition();
|
|
13260
13373
|
}
|
|
13261
13374
|
/**
|
|
13262
13375
|
* Rotate the scene by dx (yaw) and dy (pitch) amounts.
|
|
@@ -13283,14 +13396,14 @@ class Ln {
|
|
|
13283
13396
|
*/
|
|
13284
13397
|
zoom(e) {
|
|
13285
13398
|
const t = Math.max(this.config.maxZoomDistance, this.cameraDistance + this.#e * 2);
|
|
13286
|
-
this.cameraDistance =
|
|
13399
|
+
this.cameraDistance = sa.Clamp(this.cameraDistance + e, this.config.minZoomDistance, t);
|
|
13287
13400
|
}
|
|
13288
13401
|
/**
|
|
13289
13402
|
* Update camera position relative to the pivot.
|
|
13290
13403
|
* Parents camera to pivot and positions at negative Z distance.
|
|
13291
13404
|
*/
|
|
13292
13405
|
updateCameraPosition() {
|
|
13293
|
-
this.camera.parent = this.pivot, this.camera.position.set(0, 0, -this.cameraDistance), this.camera.rotation.set(0, 0, 0), this.camera.maxZ = Math.max(
|
|
13406
|
+
this.camera.parent = this.pivot, this.camera.position.set(0, 0, -this.cameraDistance), this.camera.rotation.set(0, 0, 0), this.camera.maxZ = Math.max(Nn, this.cameraDistance + this.#e * 2);
|
|
13294
13407
|
}
|
|
13295
13408
|
/**
|
|
13296
13409
|
* Zoom the camera to fit a bounding box in view.
|
|
@@ -13311,14 +13424,14 @@ class Ln {
|
|
|
13311
13424
|
for (const x of [-1, 1])
|
|
13312
13425
|
for (const C of [-1, 1])
|
|
13313
13426
|
for (const k of [-1, 1]) {
|
|
13314
|
-
const U = x * u, $ = C * p, X = k * m,
|
|
13315
|
-
y = Math.max(y,
|
|
13427
|
+
const U = x * u, $ = C * p, X = k * m, Me = X + Math.abs(U) / Math.tan(d), Oe = X + Math.abs($) / Math.tan(h);
|
|
13428
|
+
y = Math.max(y, Me, Oe);
|
|
13316
13429
|
}
|
|
13317
13430
|
const S = y * (1 + 5 / 100);
|
|
13318
13431
|
this.cameraDistance = Math.max(S, this.config.minZoomDistance), this.updateCameraPosition();
|
|
13319
13432
|
}
|
|
13320
13433
|
}
|
|
13321
|
-
class
|
|
13434
|
+
class zn {
|
|
13322
13435
|
/**
|
|
13323
13436
|
* Creates a new OrbitInputController instance.
|
|
13324
13437
|
* @param canvas - The HTML canvas element to attach input listeners to
|
|
@@ -13341,7 +13454,7 @@ class Fn {
|
|
|
13341
13454
|
}, this.canvas = e, this.controller = t, this.config = t.config, this.canvas.setAttribute("tabindex", "0"), this.attachMouseTouch();
|
|
13342
13455
|
}
|
|
13343
13456
|
attachMouseTouch() {
|
|
13344
|
-
this.hammer = new
|
|
13457
|
+
this.hammer = new Te.Manager(this.canvas), this.hammer.add(new Te.Pinch()), this.hammer.add(new Te.Rotate());
|
|
13345
13458
|
let e = 0, t = 1;
|
|
13346
13459
|
this.hammer.on("pinchstart rotatestart", (i) => {
|
|
13347
13460
|
this.isMultiTouch = !0, e = i.rotation || 0, t = i.scale || 1;
|
|
@@ -13379,7 +13492,7 @@ class Fn {
|
|
|
13379
13492
|
e.arrowleft && (this.rotationVelocityY += this.config.keyboardRotationSpeed), e.arrowright && (this.rotationVelocityY -= this.config.keyboardRotationSpeed), e.arrowup && (this.rotationVelocityX += this.config.keyboardRotationSpeed), e.arrowdown && (this.rotationVelocityX -= this.config.keyboardRotationSpeed), e.w && t.zoom(-this.config.keyboardZoomSpeed), e.s && t.zoom(this.config.keyboardZoomSpeed), e.a && t.spin(this.config.keyboardYawSpeed), e.d && t.spin(-this.config.keyboardYawSpeed), Math.abs(this.rotationVelocityX) > 1e-5 && (t.rotate(0, -this.rotationVelocityX / this.config.trackballRotationSpeed), this.rotationVelocityX *= this.config.inertiaDamping), Math.abs(this.rotationVelocityY) > 1e-5 && (t.rotate(-this.rotationVelocityY / this.config.trackballRotationSpeed, 0), this.rotationVelocityY *= this.config.inertiaDamping), t.updateCameraPosition();
|
|
13380
13493
|
}
|
|
13381
13494
|
}
|
|
13382
|
-
class
|
|
13495
|
+
class _n {
|
|
13383
13496
|
/**
|
|
13384
13497
|
* Creates a new TwoDCameraController instance.
|
|
13385
13498
|
* @param scene - The Babylon.js scene
|
|
@@ -13388,7 +13501,7 @@ class Nn {
|
|
|
13388
13501
|
* @param config - Configuration options for 2D camera controls
|
|
13389
13502
|
*/
|
|
13390
13503
|
constructor(e, t, i, s) {
|
|
13391
|
-
this.scene = e, this.engine = t, this.canvas = i, this.config = s, this.velocity = { x: 0, y: 0, zoom: 0, rotate: 0 }, this.camera = new
|
|
13504
|
+
this.scene = e, this.engine = t, this.canvas = i, this.config = s, this.velocity = { x: 0, y: 0, zoom: 0, rotate: 0 }, this.camera = new ra("orthoCamera", new v(0, 0, -10), e), this.camera.mode = pt.ORTHOGRAPHIC_CAMERA, this.camera.inertia = 0, this.camera.inputs.clear(), this.parent = new bi("parent", e), this.updateOrtho(s.initialOrthoSize), this.camera.setTarget(v.Zero());
|
|
13392
13505
|
}
|
|
13393
13506
|
/**
|
|
13394
13507
|
* Updates the orthographic camera bounds based on size.
|
|
@@ -13462,7 +13575,7 @@ class Nn {
|
|
|
13462
13575
|
this.camera.position.z = e.z - Math.max(10, h), this.camera.maxZ = Math.max(1e4, h + Math.abs(this.camera.position.z) * 2), this.updateOrtho(c * 1.1);
|
|
13463
13576
|
}
|
|
13464
13577
|
}
|
|
13465
|
-
class
|
|
13578
|
+
class Bn {
|
|
13466
13579
|
/**
|
|
13467
13580
|
* Creates a new InputController instance.
|
|
13468
13581
|
* @param cam - The 2D camera controller to manipulate
|
|
@@ -13505,8 +13618,8 @@ class kn {
|
|
|
13505
13618
|
}, Y.POINTERWHEEL);
|
|
13506
13619
|
}
|
|
13507
13620
|
setupTouch() {
|
|
13508
|
-
this.hammer = new
|
|
13509
|
-
const e = new
|
|
13621
|
+
this.hammer = new Te.Manager(this.canvas);
|
|
13622
|
+
const e = new Te.Pan({ threshold: 0, pointers: 0 }), t = new Te.Pinch(), i = new Te.Rotate();
|
|
13510
13623
|
this.hammer.add([e, t, i]), this.hammer.get("pinch").recognizeWith(this.hammer.get("rotate")), this.hammer.get("pan").requireFailure(this.hammer.get("pinch")), this.hammer.on("panstart pinchstart rotatestart", (s) => {
|
|
13511
13624
|
this.gestureSession = {
|
|
13512
13625
|
panX: s.center.x,
|
|
@@ -13568,8 +13681,8 @@ class kn {
|
|
|
13568
13681
|
this.applyKeyboardInertia(), this.cam.applyInertia();
|
|
13569
13682
|
}
|
|
13570
13683
|
}
|
|
13571
|
-
const
|
|
13572
|
-
class
|
|
13684
|
+
const Un = "graph-root";
|
|
13685
|
+
class Gn {
|
|
13573
13686
|
/**
|
|
13574
13687
|
* Creates a new render manager for Babylon.js scene and rendering
|
|
13575
13688
|
* @param canvas - HTML canvas element for rendering
|
|
@@ -13577,25 +13690,25 @@ class _n {
|
|
|
13577
13690
|
* @param config - Optional render configuration
|
|
13578
13691
|
*/
|
|
13579
13692
|
constructor(e, t, i = {}) {
|
|
13580
|
-
this.canvas = e, this.eventManager = t, this.config = i, this.renderLoopActive = !1, this.focusOnPointer = (a) => {
|
|
13693
|
+
this.canvas = e, this.eventManager = t, this.config = i, this.renderLoopActive = !1, this.frameHolds = 0, this.focusOnPointer = (a) => {
|
|
13581
13694
|
a.preventDefault(), this.canvas.focus({ preventScroll: !0 });
|
|
13582
|
-
},
|
|
13695
|
+
}, _i.LogLevels = _i.ErrorLogLevel, this.config.useWebGPU ? this.engine = new Bi(this.canvas) : this.engine = new Tt(this.canvas, !0, {
|
|
13583
13696
|
preserveDrawingBuffer: !0
|
|
13584
13697
|
// Required for screenshots
|
|
13585
|
-
}), this.scene = new
|
|
13698
|
+
}), this.scene = new aa(this.engine), this.scene.preventDefaultOnPointerDown = !1, this.scene.preventDefaultOnPointerUp = !1, this.canvas.addEventListener("pointerdown", this.focusOnPointer), this.canvas.addEventListener("pointerup", this.focusOnPointer), this.graphRoot = new bi(Un, this.scene), this.graphRoot.position = v.Zero(), this.graphRoot.rotationQuaternion = oe.Identity(), this.resizeHandler = () => {
|
|
13586
13699
|
this.engine.resize();
|
|
13587
|
-
}, this.camera = new
|
|
13588
|
-
const s = new
|
|
13700
|
+
}, this.camera = new Ln(this.scene), this.scene.metadata = this.scene.metadata ?? {}, this.scene.metadata.cameraManager = this.camera, this.setupCameras();
|
|
13701
|
+
const s = new oa("light", new v(1, 1, 0), this.scene);
|
|
13589
13702
|
s.groundColor = new F(0.35, 0.35, 0.35);
|
|
13590
13703
|
const r = this.config.backgroundColor ?? "#F5F5F5";
|
|
13591
|
-
this.scene.clearColor =
|
|
13704
|
+
this.scene.clearColor = Ce.FromHexString(r);
|
|
13592
13705
|
}
|
|
13593
13706
|
/**
|
|
13594
13707
|
* Initialize the render manager and Babylon.js engine
|
|
13595
13708
|
*/
|
|
13596
13709
|
async init() {
|
|
13597
13710
|
try {
|
|
13598
|
-
this.engine instanceof
|
|
13711
|
+
this.engine instanceof Bi && await this.engine.initAsync(), await this.scene.whenReadyAsync(), window.addEventListener("resize", this.resizeHandler), this.eventManager.emitGraphEvent("render-initialized", {
|
|
13599
13712
|
engine: this.engine,
|
|
13600
13713
|
scene: this.scene
|
|
13601
13714
|
});
|
|
@@ -13616,15 +13729,16 @@ class _n {
|
|
|
13616
13729
|
*/
|
|
13617
13730
|
startRenderLoop(e) {
|
|
13618
13731
|
this.renderLoopActive || (this.updateCallback = e, this.renderLoopActive = !0, this.engine.runRenderLoop(() => {
|
|
13619
|
-
|
|
13620
|
-
|
|
13621
|
-
|
|
13622
|
-
|
|
13623
|
-
|
|
13624
|
-
|
|
13625
|
-
|
|
13626
|
-
|
|
13627
|
-
|
|
13732
|
+
if (!(this.frameHolds > 0))
|
|
13733
|
+
try {
|
|
13734
|
+
this.updateCallback && this.updateCallback(), this.scene.render();
|
|
13735
|
+
} catch (t) {
|
|
13736
|
+
const i = t instanceof Error ? t : new Error(String(t));
|
|
13737
|
+
this.eventManager.emitGraphError(null, i, "other", {
|
|
13738
|
+
component: "RenderManager",
|
|
13739
|
+
phase: "render-loop"
|
|
13740
|
+
}), console.error("Error in render loop:", t);
|
|
13741
|
+
}
|
|
13628
13742
|
}));
|
|
13629
13743
|
}
|
|
13630
13744
|
/**
|
|
@@ -13633,13 +13747,38 @@ class _n {
|
|
|
13633
13747
|
stopRenderLoop() {
|
|
13634
13748
|
this.renderLoopActive && (this.renderLoopActive = !1, this.engine.stopRenderLoop(), this.updateCallback = void 0);
|
|
13635
13749
|
}
|
|
13750
|
+
/**
|
|
13751
|
+
* Keeps the render loop from drawing until the returned function is called.
|
|
13752
|
+
*
|
|
13753
|
+
* A FRAME IS WHAT A GPU READBACK WAITS BEHIND. Drawing a scene of thousands of meshes keeps
|
|
13754
|
+
* the main thread for tens to hundreds of milliseconds, and a promise the GPU resolves --
|
|
13755
|
+
* the mapped buffer at the end of a traversal, the frontier count between its levels -- is
|
|
13756
|
+
* delivered as a task, which cannot run until the frame that was drawing has finished. A
|
|
13757
|
+
* breadth-first search that costs 7 ms on the device came back after 225 ms through the
|
|
13758
|
+
* element at 1,000 nodes and after 8.6 s at 10,000, two frames per readback (issue #390).
|
|
13759
|
+
* Measured apart, the CPU update of a frame is 2.5 ms and is not what the readback waits on;
|
|
13760
|
+
* the draw is 48 ms at 1,000 nodes and is.
|
|
13761
|
+
*
|
|
13762
|
+
* So a call-shaped accelerated run holds the frames for as long as it is on the device, and
|
|
13763
|
+
* the picture stands still for those milliseconds instead of the run stretching to seconds.
|
|
13764
|
+
* Holds nest: the frames resume when the last holder releases, and releasing twice is a
|
|
13765
|
+
* no-op, so a `finally` cannot over-release.
|
|
13766
|
+
* @returns Releases this hold.
|
|
13767
|
+
*/
|
|
13768
|
+
holdFrames() {
|
|
13769
|
+
this.frameHolds++;
|
|
13770
|
+
let e = !1;
|
|
13771
|
+
return () => {
|
|
13772
|
+
e || (e = !0, this.frameHolds--);
|
|
13773
|
+
};
|
|
13774
|
+
}
|
|
13636
13775
|
/**
|
|
13637
13776
|
* Update the background color
|
|
13638
13777
|
* @param color - Hex color string (e.g., "#FFFFFF")
|
|
13639
13778
|
*/
|
|
13640
13779
|
setBackgroundColor(e) {
|
|
13641
13780
|
try {
|
|
13642
|
-
this.scene.clearColor =
|
|
13781
|
+
this.scene.clearColor = Ce.FromHexString(e);
|
|
13643
13782
|
} catch (t) {
|
|
13644
13783
|
const i = t instanceof Error ? t : new Error(String(t));
|
|
13645
13784
|
this.eventManager.emitGraphError(null, i, "other", {
|
|
@@ -13663,7 +13802,7 @@ class _n {
|
|
|
13663
13802
|
* Setup camera configurations
|
|
13664
13803
|
*/
|
|
13665
13804
|
setupCameras() {
|
|
13666
|
-
const e = new
|
|
13805
|
+
const e = new kn(this.canvas, this.scene, {
|
|
13667
13806
|
trackballRotationSpeed: 5e-3,
|
|
13668
13807
|
keyboardRotationSpeed: 0.03,
|
|
13669
13808
|
keyboardZoomSpeed: 0.2,
|
|
@@ -13674,9 +13813,9 @@ class _n {
|
|
|
13674
13813
|
maxZoomDistance: 2e3,
|
|
13675
13814
|
// The zoom-out ceiling for a small graph; a fit of a larger one raises it
|
|
13676
13815
|
inertiaDamping: 0.9
|
|
13677
|
-
}), t = new
|
|
13816
|
+
}), t = new zn(this.canvas, e);
|
|
13678
13817
|
this.camera.registerCamera("orbit", e, t);
|
|
13679
|
-
const i = new
|
|
13818
|
+
const i = new _n(this.scene, this.engine, this.canvas, {
|
|
13680
13819
|
panAcceleration: 0.02,
|
|
13681
13820
|
panDamping: 0.85,
|
|
13682
13821
|
zoomFactorPerFrame: 0.02,
|
|
@@ -13695,7 +13834,7 @@ class _n {
|
|
|
13695
13834
|
initialOrthoSize: 5,
|
|
13696
13835
|
rotationEnabled: !0,
|
|
13697
13836
|
inertiaEnabled: !0
|
|
13698
|
-
}), s = new
|
|
13837
|
+
}), s = new Bn(i, this.canvas, {
|
|
13699
13838
|
panAcceleration: 0.02,
|
|
13700
13839
|
panDamping: 0.85,
|
|
13701
13840
|
zoomFactorPerFrame: 0.02,
|
|
@@ -13718,7 +13857,7 @@ class _n {
|
|
|
13718
13857
|
this.camera.registerCamera("2d", i, s), this.camera.activateCamera("orbit");
|
|
13719
13858
|
}
|
|
13720
13859
|
}
|
|
13721
|
-
class
|
|
13860
|
+
class $n {
|
|
13722
13861
|
/**
|
|
13723
13862
|
* Creates a new selection manager
|
|
13724
13863
|
* @param eventManager - Event manager for emitting selection events
|
|
@@ -13858,7 +13997,7 @@ class Bn {
|
|
|
13858
13997
|
this.selection?.applyNow({ nodes: e.map((s) => s.id) }, "replace", t);
|
|
13859
13998
|
}
|
|
13860
13999
|
}
|
|
13861
|
-
const
|
|
14000
|
+
const os = ge.getLogger(["graphty", "stats"]), ut = class ut {
|
|
13862
14001
|
/**
|
|
13863
14002
|
* Creates a new stats manager for performance tracking
|
|
13864
14003
|
* @param eventManager - Event manager for emitting stats events
|
|
@@ -13886,7 +14025,7 @@ const rs = ue.getLogger(["graphty", "stats"]), ut = class ut {
|
|
|
13886
14025
|
* @param engine - The Babylon.js engine (Engine or WebGPUEngine)
|
|
13887
14026
|
*/
|
|
13888
14027
|
initializeBabylonInstrumentation(e, t) {
|
|
13889
|
-
this.sceneInstrumentation = new
|
|
14028
|
+
this.sceneInstrumentation = new na(e), this.sceneInstrumentation.captureFrameTime = !0, this.sceneInstrumentation.captureRenderTime = !0, this.sceneInstrumentation.captureInterFrameTime = !0, this.sceneInstrumentation.captureCameraRenderTime = !0, this.sceneInstrumentation.captureActiveMeshesEvaluationTime = !0, this.sceneInstrumentation.captureRenderTargetsRenderTime = !0, this.babylonInstrumentation = new ca(t), this.babylonInstrumentation.captureGPUFrameTime = !0, this.babylonInstrumentation.captureShaderCompilationTime = !0;
|
|
13890
14029
|
}
|
|
13891
14030
|
/**
|
|
13892
14031
|
* Inject mocked instrumentation for testing
|
|
@@ -14016,7 +14155,7 @@ ${r}
|
|
|
14016
14155
|
try {
|
|
14017
14156
|
this.longTaskObserver = new PerformanceObserver((e) => {
|
|
14018
14157
|
for (const t of e.getEntries())
|
|
14019
|
-
|
|
14158
|
+
os.warn("Long task detected (>50ms blocking)", {
|
|
14020
14159
|
duration: t.duration,
|
|
14021
14160
|
startTime: t.startTime
|
|
14022
14161
|
});
|
|
@@ -14060,7 +14199,7 @@ ${r}
|
|
|
14060
14199
|
*/
|
|
14061
14200
|
reportHighBlockingFrame(e) {
|
|
14062
14201
|
const t = [...e.operations].sort((i, s) => s.duration - i.duration).slice(0, 5);
|
|
14063
|
-
|
|
14202
|
+
os.warn("High blocking frame detected", {
|
|
14064
14203
|
frameNumber: e.frameNumber,
|
|
14065
14204
|
totalFrameTime: e.interFrameTime,
|
|
14066
14205
|
cpuTime: e.totalCpuTime,
|
|
@@ -14466,9 +14605,40 @@ ${r}
|
|
|
14466
14605
|
}
|
|
14467
14606
|
};
|
|
14468
14607
|
ut.RING_BUFFER_SIZE = 1e3;
|
|
14469
|
-
let
|
|
14470
|
-
|
|
14471
|
-
|
|
14608
|
+
let fi = ut;
|
|
14609
|
+
function _s(l) {
|
|
14610
|
+
let e, t;
|
|
14611
|
+
for (const i of l) {
|
|
14612
|
+
if (i.getRenderState() !== "visible")
|
|
14613
|
+
continue;
|
|
14614
|
+
i.mesh.computeWorldMatrix(!0);
|
|
14615
|
+
const s = i.mesh.getAbsolutePosition(), r = i.size / 2;
|
|
14616
|
+
e ??= s.clone().setAll(1 / 0), t ??= s.clone().setAll(-1 / 0);
|
|
14617
|
+
for (const a of ["x", "y", "z"])
|
|
14618
|
+
e[a] = Math.min(e[a], s[a] - r), t[a] = Math.max(t[a], s[a] + r);
|
|
14619
|
+
}
|
|
14620
|
+
return e && t ? { min: e, max: t } : void 0;
|
|
14621
|
+
}
|
|
14622
|
+
function Mt(l, e) {
|
|
14623
|
+
if (!e)
|
|
14624
|
+
return;
|
|
14625
|
+
e.computeWorldMatrix(!0);
|
|
14626
|
+
const { minimumWorld: t, maximumWorld: i } = e.getBoundingInfo().boundingBox;
|
|
14627
|
+
for (const s of ["x", "y", "z"])
|
|
14628
|
+
l.min[s] = Math.min(l.min[s], t[s]), l.max[s] = Math.max(l.max[s], i[s]);
|
|
14629
|
+
}
|
|
14630
|
+
function Vn(l, e) {
|
|
14631
|
+
const t = _s(l);
|
|
14632
|
+
if (t) {
|
|
14633
|
+
for (const i of l)
|
|
14634
|
+
i.getRenderState() === "visible" && Mt(t, i.label?.labelMesh);
|
|
14635
|
+
for (const i of e)
|
|
14636
|
+
i.isRenderVisible() && (Mt(t, i.label?.labelMesh), Mt(t, i.arrowHeadText?.labelMesh), Mt(t, i.arrowTailText?.labelMesh));
|
|
14637
|
+
return t;
|
|
14638
|
+
}
|
|
14639
|
+
}
|
|
14640
|
+
const re = -1, Hn = Object.freeze({});
|
|
14641
|
+
class Ci {
|
|
14472
14642
|
/**
|
|
14473
14643
|
* Creates a new update manager
|
|
14474
14644
|
* @param eventManager - Event manager for emitting update events
|
|
@@ -14549,7 +14719,7 @@ class bi {
|
|
|
14549
14719
|
* not moved, so the cost lands only while records are actually arriving.
|
|
14550
14720
|
*/
|
|
14551
14721
|
syncViewMasks() {
|
|
14552
|
-
const e = this.viewMasks ??
|
|
14722
|
+
const e = this.viewMasks ?? Hn, t = e.selection?.nodes() ?? null, i = e.selection?.edges() ?? null, s = e.visibility?.nodes() ?? null, r = e.visibility?.edges() ?? null, a = e.showContext?.() ?? !1, o = t?.version ?? re, n = i?.version ?? re, c = s?.version ?? re, h = r?.version ?? re, d = !this.appliedAnything || o !== this.appliedNodeSelection || c !== this.appliedNodeVisibility || a !== this.appliedShowContext, u = !this.appliedAnything || n !== this.appliedEdgeSelection || h !== this.appliedEdgeVisibility;
|
|
14553
14723
|
if (!(!d && !u)) {
|
|
14554
14724
|
if (d) {
|
|
14555
14725
|
const p = a ? "context" : "hidden";
|
|
@@ -14729,7 +14899,7 @@ class bi {
|
|
|
14729
14899
|
if (!i.isReady(!0, s))
|
|
14730
14900
|
return !1;
|
|
14731
14901
|
for (const r of t)
|
|
14732
|
-
if (r.hasMesh(i) && !
|
|
14902
|
+
if (r.hasMesh(i) && !Ci.layerIsReadyFor(r, i, s))
|
|
14733
14903
|
return !1;
|
|
14734
14904
|
}
|
|
14735
14905
|
}
|
|
@@ -14778,15 +14948,12 @@ class bi {
|
|
|
14778
14948
|
*/
|
|
14779
14949
|
runUpdatePass() {
|
|
14780
14950
|
if (this.frameCount++, this.syncViewMasks(), this.syncStyles(), this.camera.update(), !this.layoutManager.running) {
|
|
14781
|
-
|
|
14782
|
-
const { boundingBoxMin: s, boundingBoxMax: r } = this.updateNodes(!0);
|
|
14783
|
-
this.updateEdges(s, r), this.applyZoomToFit(s, r), this.updateStatistics();
|
|
14784
|
-
}
|
|
14951
|
+
this.updateEdges(), this.willZoomToFit() && (this.updateNodes(), this.updateEdges(), this.applyZoomToFit(this.measure()), this.updateStatistics());
|
|
14785
14952
|
return;
|
|
14786
14953
|
}
|
|
14787
14954
|
this.updateLayout();
|
|
14788
|
-
const e = this.willZoomToFit()
|
|
14789
|
-
this.
|
|
14955
|
+
const e = this.willZoomToFit();
|
|
14956
|
+
this.updateNodes(), this.updateEdges(), e && this.applyZoomToFit(this.measure()), this.updateStatistics();
|
|
14790
14957
|
}
|
|
14791
14958
|
/**
|
|
14792
14959
|
* Update the layout engine
|
|
@@ -14804,7 +14971,7 @@ class bi {
|
|
|
14804
14971
|
updateLayout() {
|
|
14805
14972
|
this.statsManager.step(), this.statsManager.graphStep.beginMonitoring();
|
|
14806
14973
|
const { stepMultiplier: e, minDelta: t } = this.graphContext.getStyles().config.behavior.layout, i = t > 0 ? this.enginePositions() : null;
|
|
14807
|
-
if (this.layoutManager.layoutEngine instanceof
|
|
14974
|
+
if (this.layoutManager.layoutEngine instanceof pe)
|
|
14808
14975
|
this.layoutManager.stepBatch(), this.layoutStepCount++;
|
|
14809
14976
|
else
|
|
14810
14977
|
for (let s = 0; s < e; s++)
|
|
@@ -14846,55 +15013,29 @@ class bi {
|
|
|
14846
15013
|
return i;
|
|
14847
15014
|
}
|
|
14848
15015
|
/**
|
|
14849
|
-
* Update all nodes
|
|
14850
|
-
* @param measure - Whether this frame's bounding box will be used. False skips the
|
|
14851
|
-
* measurement entirely, which is most frames.
|
|
14852
|
-
* @returns Object containing minimum and maximum bounding box vectors
|
|
15016
|
+
* Update all nodes.
|
|
14853
15017
|
*/
|
|
14854
|
-
updateNodes(
|
|
14855
|
-
let t, i;
|
|
15018
|
+
updateNodes() {
|
|
14856
15019
|
this.statsManager.nodeUpdate.beginMonitoring();
|
|
14857
|
-
for (const
|
|
14858
|
-
|
|
14859
|
-
|
|
14860
|
-
s.mesh.computeWorldMatrix(!0);
|
|
14861
|
-
const r = s.mesh.getAbsolutePosition(), a = s.size;
|
|
14862
|
-
(!t || !i) && (t = r.clone(), i = r.clone()), this.updateBoundingBoxAxis(r, t, i, a, "x"), this.updateBoundingBoxAxis(r, t, i, a, "y"), this.updateBoundingBoxAxis(r, t, i, a, "z"), s.label?.labelMesh && this.expandBoundingBoxForLabel(s.label.labelMesh, t, i);
|
|
14863
|
-
}
|
|
14864
|
-
return this.statsManager.nodeUpdate.endMonitoring(), { boundingBoxMin: t, boundingBoxMax: i };
|
|
14865
|
-
}
|
|
14866
|
-
/**
|
|
14867
|
-
* Update bounding box for a single axis
|
|
14868
|
-
* @param pos - Position vector
|
|
14869
|
-
* @param min - Minimum bounds vector
|
|
14870
|
-
* @param max - Maximum bounds vector
|
|
14871
|
-
* @param size - Node size
|
|
14872
|
-
* @param axis - Axis to update (x, y, or z)
|
|
14873
|
-
*/
|
|
14874
|
-
updateBoundingBoxAxis(e, t, i, s, r) {
|
|
14875
|
-
const a = e[r], o = s / 2;
|
|
14876
|
-
t[r] = Math.min(t[r], a - o), i[r] = Math.max(i[r], a + o);
|
|
15020
|
+
for (const e of this.layoutManager.nodes)
|
|
15021
|
+
e.update();
|
|
15022
|
+
this.statsManager.nodeUpdate.endMonitoring();
|
|
14877
15023
|
}
|
|
14878
15024
|
/**
|
|
14879
|
-
*
|
|
14880
|
-
*
|
|
14881
|
-
* @
|
|
14882
|
-
* @param max - Maximum bounds vector
|
|
15025
|
+
* Measure the graph the camera is about to be framed on. Taken AFTER the nodes and edges have
|
|
15026
|
+
* updated, so the labels are where this frame's positions put them.
|
|
15027
|
+
* @returns The box, or undefined when nothing is visible.
|
|
14883
15028
|
*/
|
|
14884
|
-
|
|
14885
|
-
|
|
14886
|
-
const s = e.getBoundingInfo(), r = s.boundingBox.minimumWorld, a = s.boundingBox.maximumWorld;
|
|
14887
|
-
t.x = Math.min(t.x, r.x), t.y = Math.min(t.y, r.y), t.z = Math.min(t.z, r.z), i.x = Math.max(i.x, a.x), i.y = Math.max(i.y, a.y), i.z = Math.max(i.z, a.z);
|
|
15029
|
+
measure() {
|
|
15030
|
+
return Vn(this.layoutManager.nodes, this.layoutManager.edges);
|
|
14888
15031
|
}
|
|
14889
15032
|
/**
|
|
14890
|
-
* Update all edges
|
|
14891
|
-
* @param boundingBoxMin - Minimum bounds (optional)
|
|
14892
|
-
* @param boundingBoxMax - Maximum bounds (optional)
|
|
15033
|
+
* Update all edges.
|
|
14893
15034
|
*/
|
|
14894
|
-
updateEdges(
|
|
14895
|
-
this.statsManager.edgeUpdate.beginMonitoring(),
|
|
14896
|
-
for (const
|
|
14897
|
-
|
|
15035
|
+
updateEdges() {
|
|
15036
|
+
this.statsManager.edgeUpdate.beginMonitoring(), Ot.updateRays(this.graphContext);
|
|
15037
|
+
for (const e of this.layoutManager.edges)
|
|
15038
|
+
e.update();
|
|
14898
15039
|
this.statsManager.edgeUpdate.endMonitoring();
|
|
14899
15040
|
}
|
|
14900
15041
|
/**
|
|
@@ -14915,22 +15056,23 @@ class bi {
|
|
|
14915
15056
|
}
|
|
14916
15057
|
/**
|
|
14917
15058
|
* Frame the camera on a box {@link UpdateManager.willZoomToFit} has already approved.
|
|
14918
|
-
* @param
|
|
14919
|
-
* @param boundingBoxMax - Maximum bounds (optional)
|
|
15059
|
+
* @param box - The box to frame, or undefined when there is nothing to frame.
|
|
14920
15060
|
*/
|
|
14921
|
-
applyZoomToFit(e
|
|
14922
|
-
if (!e
|
|
15061
|
+
applyZoomToFit(e) {
|
|
15062
|
+
if (!e) {
|
|
14923
15063
|
this.framingHasNothingToFrame = !0;
|
|
14924
15064
|
return;
|
|
14925
15065
|
}
|
|
14926
|
-
const
|
|
14927
|
-
|
|
15066
|
+
const t = this.layoutManager.layoutEngine?.isSettled ?? !1;
|
|
15067
|
+
this.wasSettled = t;
|
|
15068
|
+
const { min: i, max: s } = e;
|
|
15069
|
+
if (s.subtract(i).length() <= this.config.minBoundingBoxSize) {
|
|
14928
15070
|
this.framingHasNothingToFrame = !0;
|
|
14929
15071
|
return;
|
|
14930
15072
|
}
|
|
14931
|
-
this.camera.zoomToBoundingBox(
|
|
14932
|
-
boundingBoxMin:
|
|
14933
|
-
boundingBoxMax:
|
|
15073
|
+
this.camera.zoomToBoundingBox(i, s), this.hasZoomedToFit = !0, this.forceZoomToFit = !1, this.framingHasNothingToFrame = !1, this.lastZoomStep = this.layoutStepCount, t && (this.needsZoomToFit = !1), this.eventManager.emitGraphEvent("zoom-to-fit-complete", {
|
|
15074
|
+
boundingBoxMin: i,
|
|
15075
|
+
boundingBoxMax: s
|
|
14934
15076
|
});
|
|
14935
15077
|
}
|
|
14936
15078
|
/**
|
|
@@ -14968,7 +15110,7 @@ class O extends Error {
|
|
|
14968
15110
|
super(e), this.code = t, this.details = i, this.name = "ScreenshotError", Object.setPrototypeOf(this, O.prototype);
|
|
14969
15111
|
}
|
|
14970
15112
|
}
|
|
14971
|
-
async function
|
|
15113
|
+
async function Wn(l) {
|
|
14972
15114
|
if (!window.isSecureContext)
|
|
14973
15115
|
return {
|
|
14974
15116
|
status: "not-secure-context",
|
|
@@ -15030,7 +15172,7 @@ async function Gn(l) {
|
|
|
15030
15172
|
};
|
|
15031
15173
|
}
|
|
15032
15174
|
}
|
|
15033
|
-
const
|
|
15175
|
+
const ei = {
|
|
15034
15176
|
/**
|
|
15035
15177
|
* Maximum time to wait for layout to settle before screenshot capture (ms).
|
|
15036
15178
|
* If the layout doesn't settle within this time, a timeout error is thrown.
|
|
@@ -15045,7 +15187,7 @@ const Xt = {
|
|
|
15045
15187
|
* Default PNG quality (always maximum for lossless format).
|
|
15046
15188
|
*/
|
|
15047
15189
|
DEFAULT_PNG_QUALITY: 1
|
|
15048
|
-
},
|
|
15190
|
+
}, ns = {
|
|
15049
15191
|
/**
|
|
15050
15192
|
* Default frames per second for video capture.
|
|
15051
15193
|
*/
|
|
@@ -15055,14 +15197,14 @@ const Xt = {
|
|
|
15055
15197
|
* How often to report progress during video capture.
|
|
15056
15198
|
*/
|
|
15057
15199
|
PROGRESS_INTERVAL_MS: 100
|
|
15058
|
-
},
|
|
15200
|
+
}, fe = {
|
|
15059
15201
|
MAX_DIMENSION: 16384,
|
|
15060
15202
|
MAX_PIXELS: 33177600,
|
|
15061
15203
|
// 8K
|
|
15062
15204
|
WARN_PIXELS: 8294400
|
|
15063
15205
|
// 4K
|
|
15064
15206
|
};
|
|
15065
|
-
function
|
|
15207
|
+
function jn(l, e) {
|
|
15066
15208
|
const t = l.width, i = l.height, s = t / i;
|
|
15067
15209
|
if (e.width !== void 0 || e.height !== void 0) {
|
|
15068
15210
|
let n, c;
|
|
@@ -15093,45 +15235,45 @@ function $n(l, e) {
|
|
|
15093
15235
|
}
|
|
15094
15236
|
);
|
|
15095
15237
|
}
|
|
15096
|
-
return
|
|
15238
|
+
return cs(n, c), { width: n, height: c };
|
|
15097
15239
|
}
|
|
15098
15240
|
const r = e.multiplier ?? 1, a = Math.floor(t * r), o = Math.floor(i * r);
|
|
15099
|
-
return
|
|
15241
|
+
return cs(a, o), { width: a, height: o };
|
|
15100
15242
|
}
|
|
15101
|
-
function
|
|
15243
|
+
function cs(l, e) {
|
|
15102
15244
|
if (l <= 0 || e <= 0 || !Number.isFinite(l) || !Number.isFinite(e))
|
|
15103
15245
|
throw new O(
|
|
15104
15246
|
`Invalid dimensions: ${l}x${e}. Dimensions must be positive finite numbers.`,
|
|
15105
15247
|
R.INVALID_DIMENSIONS,
|
|
15106
15248
|
{ width: l, height: e }
|
|
15107
15249
|
);
|
|
15108
|
-
if (l >
|
|
15250
|
+
if (l > fe.MAX_DIMENSION || e > fe.MAX_DIMENSION)
|
|
15109
15251
|
throw new O(
|
|
15110
|
-
`Dimension ${l}x${e} exceeds browser limit of ${
|
|
15252
|
+
`Dimension ${l}x${e} exceeds browser limit of ${fe.MAX_DIMENSION}px.`,
|
|
15111
15253
|
R.DIMENSION_TOO_LARGE,
|
|
15112
15254
|
{
|
|
15113
15255
|
width: l,
|
|
15114
15256
|
height: e,
|
|
15115
|
-
maxDimension:
|
|
15257
|
+
maxDimension: fe.MAX_DIMENSION
|
|
15116
15258
|
}
|
|
15117
15259
|
);
|
|
15118
15260
|
const t = l * e;
|
|
15119
|
-
if (t >
|
|
15261
|
+
if (t > fe.MAX_PIXELS)
|
|
15120
15262
|
throw new O(
|
|
15121
|
-
`Total pixels too large: ${l}x${e} = ${t} pixels. Maximum is ${
|
|
15263
|
+
`Total pixels too large: ${l}x${e} = ${t} pixels. Maximum is ${fe.MAX_PIXELS} pixels.`,
|
|
15122
15264
|
R.RESOLUTION_TOO_HIGH,
|
|
15123
15265
|
{
|
|
15124
15266
|
width: l,
|
|
15125
15267
|
height: e,
|
|
15126
15268
|
totalPixels: t,
|
|
15127
|
-
maxPixels:
|
|
15269
|
+
maxPixels: fe.MAX_PIXELS
|
|
15128
15270
|
}
|
|
15129
15271
|
);
|
|
15130
|
-
t >
|
|
15272
|
+
t > fe.WARN_PIXELS && console.warn(
|
|
15131
15273
|
`Large screenshot ${l}x${e} (${(t / 1e6).toFixed(1)}MP) may fail on devices with limited memory`
|
|
15132
15274
|
);
|
|
15133
15275
|
}
|
|
15134
|
-
const
|
|
15276
|
+
const qn = {
|
|
15135
15277
|
print: {
|
|
15136
15278
|
format: "png",
|
|
15137
15279
|
multiplier: 4,
|
|
@@ -15156,8 +15298,8 @@ const Vn = {
|
|
|
15156
15298
|
destination: { download: !0 }
|
|
15157
15299
|
}
|
|
15158
15300
|
};
|
|
15159
|
-
function
|
|
15160
|
-
const t =
|
|
15301
|
+
function Kn(l, e) {
|
|
15302
|
+
const t = qn[l];
|
|
15161
15303
|
if (!t)
|
|
15162
15304
|
throw new O(`Unknown screenshot preset: ${l}`, R.PRESET_NOT_FOUND);
|
|
15163
15305
|
return {
|
|
@@ -15170,19 +15312,19 @@ function Hn(l, e) {
|
|
|
15170
15312
|
} : void 0
|
|
15171
15313
|
};
|
|
15172
15314
|
}
|
|
15173
|
-
function
|
|
15315
|
+
function Zn(l, e) {
|
|
15174
15316
|
const t = {
|
|
15175
15317
|
clearColor: l.clearColor.clone(),
|
|
15176
15318
|
skyboxEnabled: e?.isEnabled() ?? !1,
|
|
15177
15319
|
environmentTexture: l.environmentTexture,
|
|
15178
15320
|
imageProcessingEnabled: l.imageProcessingConfiguration.isEnabled
|
|
15179
15321
|
};
|
|
15180
|
-
return l.clearColor = new
|
|
15322
|
+
return l.clearColor = new Ce(0, 0, 0, 0), e && e.setEnabled(!1), l.environmentTexture = null, l.imageProcessingConfiguration.vignetteEnabled = !1, t;
|
|
15181
15323
|
}
|
|
15182
|
-
function
|
|
15324
|
+
function Xn(l, e, t) {
|
|
15183
15325
|
l.clearColor = t.clearColor, e && e.setEnabled(t.skyboxEnabled), l.environmentTexture = t.environmentTexture, l.imageProcessingConfiguration.isEnabled = t.imageProcessingEnabled;
|
|
15184
15326
|
}
|
|
15185
|
-
class
|
|
15327
|
+
class Qn {
|
|
15186
15328
|
/**
|
|
15187
15329
|
* Creates a new ScreenshotCapture instance
|
|
15188
15330
|
* @param engine - The Babylon.js rendering engine
|
|
@@ -15259,8 +15401,8 @@ class qn {
|
|
|
15259
15401
|
}
|
|
15260
15402
|
try {
|
|
15261
15403
|
let o = e;
|
|
15262
|
-
e.preset && (o =
|
|
15263
|
-
const n =
|
|
15404
|
+
e.preset && (o = Kn(e.preset, e));
|
|
15405
|
+
const n = jn(this.canvas, o), c = o.format ?? "png", h = o.quality ?? (c === "jpeg" ? ei.DEFAULT_JPEG_QUALITY : ei.DEFAULT_PNG_QUALITY);
|
|
15264
15406
|
if (o.transparentBackground && c !== "png" && c !== "webp")
|
|
15265
15407
|
throw new O(
|
|
15266
15408
|
"Transparent background requires PNG or WebP format",
|
|
@@ -15269,7 +15411,7 @@ class qn {
|
|
|
15269
15411
|
let d;
|
|
15270
15412
|
if (o.transparentBackground) {
|
|
15271
15413
|
const m = this.findSkyboxMesh();
|
|
15272
|
-
d =
|
|
15414
|
+
d = Zn(this.scene, m);
|
|
15273
15415
|
}
|
|
15274
15416
|
let u = null, p;
|
|
15275
15417
|
if (o.enhanceQuality) {
|
|
@@ -15290,7 +15432,7 @@ class qn {
|
|
|
15290
15432
|
n.height
|
|
15291
15433
|
);
|
|
15292
15434
|
let k;
|
|
15293
|
-
m.clipboard && (k =
|
|
15435
|
+
m.clipboard && (k = Wn(C));
|
|
15294
15436
|
const U = await C;
|
|
15295
15437
|
let $ = !1;
|
|
15296
15438
|
if (m.download)
|
|
@@ -15303,8 +15445,8 @@ class qn {
|
|
|
15303
15445
|
const Oe = await k;
|
|
15304
15446
|
y = Oe.status, w = Oe.error;
|
|
15305
15447
|
}
|
|
15306
|
-
const X = Date.now() - t,
|
|
15307
|
-
return o.enhanceQuality && this.graph.eventManager.emitGraphEvent("screenshot-ready", { enhancementTime:
|
|
15448
|
+
const X = Date.now() - t, Me = p ? Date.now() - p : void 0;
|
|
15449
|
+
return o.enhanceQuality && this.graph.eventManager.emitGraphEvent("screenshot-ready", { enhancementTime: Me }), {
|
|
15308
15450
|
blob: U,
|
|
15309
15451
|
downloaded: $,
|
|
15310
15452
|
clipboardStatus: y,
|
|
@@ -15315,13 +15457,13 @@ class qn {
|
|
|
15315
15457
|
format: c,
|
|
15316
15458
|
byteSize: U.size,
|
|
15317
15459
|
captureTime: X,
|
|
15318
|
-
enhancementTime:
|
|
15460
|
+
enhancementTime: Me
|
|
15319
15461
|
}
|
|
15320
15462
|
};
|
|
15321
15463
|
} finally {
|
|
15322
15464
|
if (d) {
|
|
15323
15465
|
const m = this.findSkyboxMesh();
|
|
15324
|
-
|
|
15466
|
+
Xn(this.scene, m, d);
|
|
15325
15467
|
}
|
|
15326
15468
|
u && this.disableQualityEnhancement(u);
|
|
15327
15469
|
}
|
|
@@ -15360,7 +15502,7 @@ class qn {
|
|
|
15360
15502
|
R.LAYOUT_SETTLE_TIMEOUT
|
|
15361
15503
|
)
|
|
15362
15504
|
));
|
|
15363
|
-
},
|
|
15505
|
+
}, ei.LAYOUT_SETTLE_TIMEOUT_MS), n = () => {
|
|
15364
15506
|
!s && e.isSettled && (s = !0, a(), t());
|
|
15365
15507
|
};
|
|
15366
15508
|
r = this.graph.eventManager.addListener("graph-settled", n), !s && e.isSettled && (s = !0, a(), t());
|
|
@@ -15396,7 +15538,7 @@ class qn {
|
|
|
15396
15538
|
let n;
|
|
15397
15539
|
if (e === "png" ? n = "image/png" : e === "jpeg" ? n = "image/jpeg" : n = "image/webp", !this.scene.activeCamera)
|
|
15398
15540
|
throw new O("No active camera in scene", R.SCREENSHOT_CAPTURE_FAILED);
|
|
15399
|
-
const c = await
|
|
15541
|
+
const c = await ha(this.engine, this.scene.activeCamera, {
|
|
15400
15542
|
width: i,
|
|
15401
15543
|
height: s,
|
|
15402
15544
|
precision: t
|
|
@@ -15542,7 +15684,7 @@ class qn {
|
|
|
15542
15684
|
supersampledHeight: t.height * s
|
|
15543
15685
|
};
|
|
15544
15686
|
if (r > 1) {
|
|
15545
|
-
const n = new
|
|
15687
|
+
const n = new la(
|
|
15546
15688
|
"screenshotPipeline",
|
|
15547
15689
|
!1,
|
|
15548
15690
|
// hdr - not needed for screenshots
|
|
@@ -15551,7 +15693,7 @@ class qn {
|
|
|
15551
15693
|
);
|
|
15552
15694
|
n.samples = r, n.fxaaEnabled = a, o.pipeline = n;
|
|
15553
15695
|
} else if (a) {
|
|
15554
|
-
const n = new
|
|
15696
|
+
const n = new da("screenshotFxaa", 1, i);
|
|
15555
15697
|
o.fxaaPostProcess = n;
|
|
15556
15698
|
}
|
|
15557
15699
|
return o;
|
|
@@ -15587,7 +15729,7 @@ class lt {
|
|
|
15587
15729
|
* @returns New Styles instance
|
|
15588
15730
|
*/
|
|
15589
15731
|
static fromObject(e) {
|
|
15590
|
-
return new lt(
|
|
15732
|
+
return new lt(La.parse(e));
|
|
15591
15733
|
}
|
|
15592
15734
|
/**
|
|
15593
15735
|
* Fetches and creates a Styles instance from a URL.
|
|
@@ -15612,7 +15754,7 @@ class lt {
|
|
|
15612
15754
|
});
|
|
15613
15755
|
}
|
|
15614
15756
|
}
|
|
15615
|
-
class
|
|
15757
|
+
class Jn {
|
|
15616
15758
|
/**
|
|
15617
15759
|
* Creates a new XRUIManager instance and initializes UI buttons
|
|
15618
15760
|
* @param container - The HTML element to contain the XR UI
|
|
@@ -15734,8 +15876,8 @@ class Kn {
|
|
|
15734
15876
|
this.unavailableTimeout && (clearTimeout(this.unavailableTimeout), this.unavailableTimeout = null), this.overlay && (this.overlay.remove(), this.overlay = null), this.styleElement && (this.styleElement.remove(), this.styleElement = null), this.onEnterXR = null;
|
|
15735
15877
|
}
|
|
15736
15878
|
}
|
|
15737
|
-
const Q =
|
|
15738
|
-
class
|
|
15879
|
+
const Q = ge.getLogger(["graphty", "xr", "session"]);
|
|
15880
|
+
class Yn {
|
|
15739
15881
|
/**
|
|
15740
15882
|
* Creates a new XRSessionManager instance
|
|
15741
15883
|
* @param scene - The Babylon.js scene for XR rendering
|
|
@@ -15903,19 +16045,19 @@ class Zn {
|
|
|
15903
16045
|
this.xrHelper && (this.xrHelper.dispose(), this.xrHelper = null), this.activeMode = null;
|
|
15904
16046
|
}
|
|
15905
16047
|
}
|
|
15906
|
-
const
|
|
15907
|
-
function
|
|
16048
|
+
const hs = ge.getLogger(["graphty", "graph"]), ls = "#F5F5F5", ec = 3e4, ds = "graphty";
|
|
16049
|
+
function tc(l, e) {
|
|
15908
16050
|
const t = l.edgesByIndex[e]?.data;
|
|
15909
16051
|
if (t === void 0)
|
|
15910
16052
|
return;
|
|
15911
16053
|
const i = l.lastImport?.endpoints;
|
|
15912
16054
|
if (i === void 0)
|
|
15913
16055
|
return t;
|
|
15914
|
-
const s = new Set([i.source, i.target].filter((r) =>
|
|
16056
|
+
const s = new Set([i.source, i.target].filter((r) => ic.test(r)));
|
|
15915
16057
|
return s.size === 0 ? t : Object.fromEntries(Object.entries(t).filter(([r]) => !s.has(r)));
|
|
15916
16058
|
}
|
|
15917
|
-
const
|
|
15918
|
-
class
|
|
16059
|
+
const ic = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
16060
|
+
class us {
|
|
15919
16061
|
/**
|
|
15920
16062
|
* Creates a new Graph instance and initializes the rendering engine and managers.
|
|
15921
16063
|
* @param element - DOM element or element ID to attach the graph canvas to
|
|
@@ -15924,11 +16066,11 @@ class ls {
|
|
|
15924
16066
|
constructor(e, t = !1) {
|
|
15925
16067
|
if (this.initialCameraStateCaptured = !1, this.userCameraPresets = /* @__PURE__ */ new Map(), this.xrHelper = null, this.needRays = !0, this.initialized = !1, this.runAlgorithmsOnLoad = !1, this.wasSettled = !1, this.resizeHandler = () => {
|
|
15926
16068
|
this.engine.resize();
|
|
15927
|
-
}, this.#e = null, this.xrSessionManager = null, this.xrUIManager = null, this.activeCapture = null, this.savedZPositions = /* @__PURE__ */ new Map(), this.aiManager = null, this.voiceAdapter = null, this.eventManager = new
|
|
16069
|
+
}, this.#e = null, this.xrSessionManager = null, this.xrUIManager = null, this.activeCapture = null, this.savedZPositions = /* @__PURE__ */ new Map(), this.aiManager = null, this.voiceAdapter = null, this.eventManager = new fn(), this.operationQueue = new mi(this.eventManager, {
|
|
15928
16070
|
concurrency: 1,
|
|
15929
16071
|
// Sequential execution
|
|
15930
16072
|
autoStart: !0
|
|
15931
|
-
}), this.styles = lt.default(), this.stylePainter = new
|
|
16073
|
+
}), this.styles = lt.default(), this.stylePainter = new Eo(), typeof e == "string") {
|
|
15932
16074
|
const o = document.getElementById(e);
|
|
15933
16075
|
if (!o)
|
|
15934
16076
|
throw new Error(`getElementById() could not find element '${e}'`);
|
|
@@ -15939,10 +16081,13 @@ class ls {
|
|
|
15939
16081
|
throw new TypeError(
|
|
15940
16082
|
"Graph constructor requires 'element' argument that is either a string specifying the ID of the HTML element or an Element"
|
|
15941
16083
|
);
|
|
15942
|
-
this.element.innerHTML = "", this.canvas = document.createElement("canvas"), this.canvas.setAttribute("id", `graphty-canvas-${Date.now()}`), this.canvas.setAttribute("touch-action", "none"), this.canvas.setAttribute("autofocus", "true"), this.canvas.setAttribute("tabindex", "0"), this.canvas.style.width = "100%", this.canvas.style.height = "100%", this.canvas.style.touchAction = "none", this.element.appendChild(this.canvas), this.renderManager = new
|
|
15943
|
-
policy:
|
|
15944
|
-
minNodes:
|
|
15945
|
-
|
|
16084
|
+
this.element.innerHTML = "", this.canvas = document.createElement("canvas"), this.canvas.setAttribute("id", `graphty-canvas-${Date.now()}`), this.canvas.setAttribute("touch-action", "none"), this.canvas.setAttribute("autofocus", "true"), this.canvas.setAttribute("tabindex", "0"), this.canvas.style.width = "100%", this.canvas.style.height = "100%", this.canvas.style.touchAction = "none", this.element.appendChild(this.canvas), this.renderManager = new Gn(this.canvas, this.eventManager), this.engine = this.renderManager.engine, this.scene = this.renderManager.scene, this.camera = this.renderManager.camera, this.statsManager = new fi(this.eventManager), this.statsManager.initializeBabylonInstrumentation(this.scene, this.engine), this.dataManager = new mn(this.eventManager, this.styles), this.acceleration = new Zs({
|
|
16085
|
+
policy: Vr,
|
|
16086
|
+
minNodes: $r,
|
|
16087
|
+
// No frame is drawn while a call-shaped run is on the device: a draw of this scene
|
|
16088
|
+
// is what the run's readback would otherwise wait behind (issue #390).
|
|
16089
|
+
whileRunning: () => this.renderManager.holdFrames()
|
|
16090
|
+
}), this.session = Xs({
|
|
15946
16091
|
acceleration: this.acceleration,
|
|
15947
16092
|
store: this.dataManager,
|
|
15948
16093
|
records: {
|
|
@@ -15952,7 +16097,7 @@ class ls {
|
|
|
15952
16097
|
// and that is its contract for anyone reaching through `element.graph`. Without
|
|
15953
16098
|
// this a record pushed in spelled `src`/`dst` would show up in the data table as a
|
|
15954
16099
|
// `src` column beside the canonical `source` one, saying the same thing twice.
|
|
15955
|
-
edgeAttributes: (o) =>
|
|
16100
|
+
edgeAttributes: (o) => tc(this.dataManager, o)
|
|
15956
16101
|
},
|
|
15957
16102
|
// Read, not captured: the configuration document is written in place by the
|
|
15958
16103
|
// element's own property setters, so a captured copy would be the one that was in
|
|
@@ -15965,7 +16110,7 @@ class ls {
|
|
|
15965
16110
|
// Late-bound on purpose: the algorithm manager is built after the session, and an
|
|
15966
16111
|
// algorithm needs this Graph to read the data manager through. The session only
|
|
15967
16112
|
// ever calls this once a run reaches the front of the queue.
|
|
15968
|
-
execute: (o) => this.algorithmManager.execute(o,
|
|
16113
|
+
execute: (o) => this.algorithmManager.execute(o, zr(o.algorithm))
|
|
15969
16114
|
}
|
|
15970
16115
|
}), this.stylePainter.bind(this.session.paint), this.session.on("style:changed", (o) => {
|
|
15971
16116
|
this.eventManager.emitGraphEvent("style-changed", {
|
|
@@ -15974,7 +16119,7 @@ class ls {
|
|
|
15974
16119
|
painted: o.painted,
|
|
15975
16120
|
unresolvedPaths: [...o.unresolvedPaths]
|
|
15976
16121
|
});
|
|
15977
|
-
}), this.layoutManager = new
|
|
16122
|
+
}), this.layoutManager = new Tn(this.eventManager, this.dataManager, this.styles), this.eventManager.onGraphEvent.add((o) => {
|
|
15978
16123
|
if (o.type === "snapshot-replaced") {
|
|
15979
16124
|
this.#e = o.next, this.releaseSnapshot(o.previous);
|
|
15980
16125
|
return;
|
|
@@ -15986,6 +16131,12 @@ class ls {
|
|
|
15986
16131
|
await this.repaintFromSession();
|
|
15987
16132
|
},
|
|
15988
16133
|
description: "Repaint from the session style stack after data add"
|
|
16134
|
+
})), this.operationQueue.registerTrigger("data-remove", () => ({
|
|
16135
|
+
category: "style-apply",
|
|
16136
|
+
execute: async () => {
|
|
16137
|
+
await this.repaintFromSession();
|
|
16138
|
+
},
|
|
16139
|
+
description: "Repaint from the session style stack after data remove"
|
|
15989
16140
|
})), this.session.on("run:changed", (o) => {
|
|
15990
16141
|
o.phase === "end" && this.repaintFromSession().catch((n) => {
|
|
15991
16142
|
this.eventManager.emitGraphError(
|
|
@@ -16002,7 +16153,7 @@ class ls {
|
|
|
16002
16153
|
o.length > 0 && this.layoutManager.layoutEngine && await this.layoutManager.updatePositions(o);
|
|
16003
16154
|
},
|
|
16004
16155
|
description: "Update layout positions after data add"
|
|
16005
|
-
})), this.updateManager = new
|
|
16156
|
+
})), this.updateManager = new Ci(
|
|
16006
16157
|
this.eventManager,
|
|
16007
16158
|
this.statsManager,
|
|
16008
16159
|
this.layoutManager,
|
|
@@ -16014,7 +16165,7 @@ class ls {
|
|
|
16014
16165
|
layoutStepMultiplier: this.styles.config.behavior.layout.stepMultiplier,
|
|
16015
16166
|
autoZoomToFit: !0
|
|
16016
16167
|
}
|
|
16017
|
-
), this.algorithmManager = new
|
|
16168
|
+
), this.algorithmManager = new ko(this.eventManager, this), this.selectionManager = new $n(this.eventManager), this.selectionManager.setDataManager(this.dataManager), this.selectionManager.bindSelection(this.session.selection);
|
|
16018
16169
|
const i = {
|
|
16019
16170
|
selection: {
|
|
16020
16171
|
edges: () => this.session.selection.edgeMembers(),
|
|
@@ -16031,7 +16182,7 @@ class ls {
|
|
|
16031
16182
|
pointerLockEnabled: !1,
|
|
16032
16183
|
recordInput: !1
|
|
16033
16184
|
};
|
|
16034
|
-
this.inputManager = new
|
|
16185
|
+
this.inputManager = new wn(
|
|
16035
16186
|
{
|
|
16036
16187
|
scene: this.scene,
|
|
16037
16188
|
engine: this.engine,
|
|
@@ -16043,9 +16194,9 @@ class ls {
|
|
|
16043
16194
|
const r = {
|
|
16044
16195
|
pinOnDrag: this.pinOnDrag,
|
|
16045
16196
|
enableDetailedProfiling: this.enableDetailedProfiling,
|
|
16046
|
-
xr:
|
|
16197
|
+
xr: Fa
|
|
16047
16198
|
};
|
|
16048
|
-
this.graphContext = new
|
|
16199
|
+
this.graphContext = new yn(
|
|
16049
16200
|
() => this.styles,
|
|
16050
16201
|
this.dataManager,
|
|
16051
16202
|
this.layoutManager,
|
|
@@ -16067,7 +16218,7 @@ class ls {
|
|
|
16067
16218
|
["input", this.inputManager],
|
|
16068
16219
|
["selection", this.selectionManager]
|
|
16069
16220
|
]);
|
|
16070
|
-
this.lifecycleManager = new
|
|
16221
|
+
this.lifecycleManager = new An(a, this.eventManager, [
|
|
16071
16222
|
"event",
|
|
16072
16223
|
"queue",
|
|
16073
16224
|
"stats",
|
|
@@ -16207,8 +16358,8 @@ class ls {
|
|
|
16207
16358
|
if (!this.initialized)
|
|
16208
16359
|
try {
|
|
16209
16360
|
if (this.enableDetailedProfiling && (this.statsManager.enableProfiling(), this.statsManager.resetMeasurements()), this.applyOpeningViewMode(), await this.layoutManager.updateLayoutDimension(this.styles.config.graph.twoD), this.operationQueue.markCategoryCompleted("style-init"), await this.lifecycleManager.init(), this.styles.config.graph.background.backgroundType === "color") {
|
|
16210
|
-
const e = this.styles.config.graph.background.color ??
|
|
16211
|
-
this.scene.clearColor =
|
|
16361
|
+
const e = this.styles.config.graph.background.color ?? ls;
|
|
16362
|
+
this.scene.clearColor = Ce.FromHexString(e);
|
|
16212
16363
|
}
|
|
16213
16364
|
this.lifecycleManager.startGraph(() => {
|
|
16214
16365
|
this.update();
|
|
@@ -16244,10 +16395,10 @@ class ls {
|
|
|
16244
16395
|
if (this.layoutManager.isSettled && !this.wasSettled) {
|
|
16245
16396
|
this.wasSettled = !0, this.statsManager.endLayoutSession();
|
|
16246
16397
|
const e = this.statsManager.getSnapshot();
|
|
16247
|
-
|
|
16398
|
+
hs.debug("Layout settled", {
|
|
16248
16399
|
updateCalls: e.cpu.find((t) => t.label === "Graph.update")?.count ?? 0
|
|
16249
16400
|
}), this.statsManager.reportDetailed(), this.statsManager.resetMeasurements();
|
|
16250
|
-
} else !this.layoutManager.isSettled && this.wasSettled && (this.wasSettled = !1, this.statsManager.startLayoutSession(),
|
|
16401
|
+
} else !this.layoutManager.isSettled && this.wasSettled && (this.wasSettled = !1, this.statsManager.startLayoutSession(), hs.debug("Layout became unsettled, will report on next settlement"));
|
|
16251
16402
|
}
|
|
16252
16403
|
});
|
|
16253
16404
|
}), this.statsManager.endFrameProfiling();
|
|
@@ -16263,10 +16414,10 @@ class ls {
|
|
|
16263
16414
|
* (`{backgroundType: "skybox", data}`), where `data` is an image URL or a base64 PNG.
|
|
16264
16415
|
*/
|
|
16265
16416
|
setBackground(e) {
|
|
16266
|
-
const t =
|
|
16417
|
+
const t = wa.parse(e);
|
|
16267
16418
|
if (this.styles.config.graph.background = t, t.backgroundType === "skybox") {
|
|
16268
16419
|
const i = t.data;
|
|
16269
|
-
new
|
|
16420
|
+
new ua("testdome", i, { resolution: 32, size: 500 }, this.scene).texture.onLoadObservable.addOnce(() => {
|
|
16270
16421
|
this.eventManager.emitGraphEvent("skybox-loaded", {
|
|
16271
16422
|
graph: this,
|
|
16272
16423
|
url: i
|
|
@@ -16274,7 +16425,7 @@ class ls {
|
|
|
16274
16425
|
});
|
|
16275
16426
|
return;
|
|
16276
16427
|
}
|
|
16277
|
-
this.scene.clearColor =
|
|
16428
|
+
this.scene.clearColor = Ce.FromHexString(t.color ?? ls);
|
|
16278
16429
|
}
|
|
16279
16430
|
/**
|
|
16280
16431
|
* Set what a selected node looks like: its halo's colour, how far it stands out past the
|
|
@@ -16293,8 +16444,8 @@ class ls {
|
|
|
16293
16444
|
* positive, an opacity outside `[0, 1]`, a colour the element cannot read.
|
|
16294
16445
|
*/
|
|
16295
16446
|
setSelectionStyle(e) {
|
|
16296
|
-
const t = this.styles.config.graph.selection ??
|
|
16297
|
-
this.styles.config.graph.selection =
|
|
16447
|
+
const t = this.styles.config.graph.selection ?? Ts;
|
|
16448
|
+
this.styles.config.graph.selection = va.parse({ ...t, ...e });
|
|
16298
16449
|
for (const i of this.dataManager.nodes.values())
|
|
16299
16450
|
i.refreshSelectionOverlay();
|
|
16300
16451
|
}
|
|
@@ -16311,7 +16462,7 @@ class ls {
|
|
|
16311
16462
|
* @param behavior - The fields to change. Anything omitted keeps its current value.
|
|
16312
16463
|
*/
|
|
16313
16464
|
setLayoutBehavior(e) {
|
|
16314
|
-
const t = this.styles.config.behavior, i =
|
|
16465
|
+
const t = this.styles.config.behavior, i = As.parse({
|
|
16315
16466
|
...t,
|
|
16316
16467
|
...e,
|
|
16317
16468
|
layout: { ...t.layout, ...e.layout ?? {} },
|
|
@@ -16369,12 +16520,12 @@ class ls {
|
|
|
16369
16520
|
* @param options.edgeTarget - Where the node an edge ends at is named in the record
|
|
16370
16521
|
*/
|
|
16371
16522
|
async loadFromFile(e, t) {
|
|
16372
|
-
const { detectFormat: i } = await import("./format-detection-
|
|
16523
|
+
const { detectFormat: i } = await import("./format-detection-a0bD5PIB.js");
|
|
16373
16524
|
let s = t?.format;
|
|
16374
16525
|
if (!s) {
|
|
16375
16526
|
const a = await e.slice(0, 2048).text(), o = i(e.name, a);
|
|
16376
16527
|
if (!o)
|
|
16377
|
-
throw
|
|
16528
|
+
throw Ui(e.name, 'loadFromFile(file, { format: "graphml" })');
|
|
16378
16529
|
s = o;
|
|
16379
16530
|
}
|
|
16380
16531
|
const r = await e.text();
|
|
@@ -16412,7 +16563,7 @@ class ls {
|
|
|
16412
16563
|
* ```
|
|
16413
16564
|
*/
|
|
16414
16565
|
async loadFromUrl(e, t) {
|
|
16415
|
-
const { detectFormat: i } = await import("./format-detection-
|
|
16566
|
+
const { detectFormat: i } = await import("./format-detection-a0bD5PIB.js");
|
|
16416
16567
|
let s = t?.format, r;
|
|
16417
16568
|
if (!s) {
|
|
16418
16569
|
const h = i(e, "");
|
|
@@ -16425,7 +16576,7 @@ class ls {
|
|
|
16425
16576
|
r = await d.text();
|
|
16426
16577
|
const u = r.slice(0, 2048), p = i(e, u);
|
|
16427
16578
|
if (!p)
|
|
16428
|
-
throw
|
|
16579
|
+
throw Ui(e, 'loadFromUrl(url, { format: "graphml" })');
|
|
16429
16580
|
s = p;
|
|
16430
16581
|
}
|
|
16431
16582
|
}
|
|
@@ -16575,15 +16726,16 @@ class ls {
|
|
|
16575
16726
|
* present each time a host re-assigned the property -- and a host that re-renders on state
|
|
16576
16727
|
* change re-assigns it constantly. The old drop guard was silently doing this job; deleting the
|
|
16577
16728
|
* guard without this would have turned "assign the same edges twice" into "hold them twice".
|
|
16729
|
+
*
|
|
16730
|
+
* A set past the render ceiling is refused with `E_TOO_LARGE` before an edge is removed, so
|
|
16731
|
+
* the graph keeps the edges it had.
|
|
16578
16732
|
* @param edges - the edges the graph should hold afterwards
|
|
16579
16733
|
* @param options - The endpoint expressions, the repeat policy, and queue ordering
|
|
16580
16734
|
* @returns Promise that resolves once the graph holds exactly these edges
|
|
16581
16735
|
*/
|
|
16582
16736
|
async setEdges(e, t) {
|
|
16583
16737
|
const i = () => {
|
|
16584
|
-
|
|
16585
|
-
this.dataManager.removeEdge(s);
|
|
16586
|
-
this.dataManager.addEdges(e, t);
|
|
16738
|
+
this.dataManager.setEdges(e, t);
|
|
16587
16739
|
};
|
|
16588
16740
|
if (t?.skipQueue) {
|
|
16589
16741
|
i();
|
|
@@ -16723,12 +16875,12 @@ class ls {
|
|
|
16723
16875
|
* descriptor has no run to give them to.
|
|
16724
16876
|
*/
|
|
16725
16877
|
async runLegacyAddress(e, t, i, s) {
|
|
16726
|
-
const r = e ===
|
|
16878
|
+
const r = e === ds ? Fi(t) : void 0;
|
|
16727
16879
|
if (r !== void 0) {
|
|
16728
16880
|
await this.runLegacyAsRun(r, e, t, i, s);
|
|
16729
16881
|
return;
|
|
16730
16882
|
}
|
|
16731
|
-
const a =
|
|
16883
|
+
const a = ii(`${e}:${t}`) ?? ii(t);
|
|
16732
16884
|
if (a !== void 0) {
|
|
16733
16885
|
await this.runLegacyAsRun(
|
|
16734
16886
|
{ descriptor: a.descriptor, params: {} },
|
|
@@ -16912,7 +17064,7 @@ class ls {
|
|
|
16912
17064
|
* @returns The runs of that algorithm that succeeded, oldest first.
|
|
16913
17065
|
*/
|
|
16914
17066
|
#i(e) {
|
|
16915
|
-
const [t, i] = e.includes(":") ? e.split(":") : ["", e], r = (t ===
|
|
17067
|
+
const [t, i] = e.includes(":") ? e.split(":") : ["", e], r = (t === ds ? Fi(i) : void 0)?.descriptor.key ?? (t === "" ? e : i);
|
|
16916
17068
|
return this.session.runs.list().filter((a) => a.algorithm === r && a.status === "succeeded");
|
|
16917
17069
|
}
|
|
16918
17070
|
/**
|
|
@@ -16941,7 +17093,7 @@ class ls {
|
|
|
16941
17093
|
(a.length > 0 || o.length > 0) && this.eventManager.emitElementsRemoved(a, o);
|
|
16942
17094
|
};
|
|
16943
17095
|
if (t?.skipQueue) {
|
|
16944
|
-
i();
|
|
17096
|
+
i(), await this.repaintFromSession();
|
|
16945
17097
|
return;
|
|
16946
17098
|
}
|
|
16947
17099
|
await this.operationQueue.queueOperationAsync(
|
|
@@ -17452,7 +17604,7 @@ class ls {
|
|
|
17452
17604
|
* the session begins when a consumer calls `setViewMode` from a click.
|
|
17453
17605
|
*/
|
|
17454
17606
|
applyOpeningViewMode() {
|
|
17455
|
-
const e = this.styles.config.graph, i = e.viewMode ===
|
|
17607
|
+
const e = this.styles.config.graph, i = e.viewMode === ba && e.twoD ? "2d" : e.viewMode, s = i === "2d";
|
|
17456
17608
|
e.viewMode = i, e.twoD = s, this.scene.metadata = this.scene.metadata ?? {}, this.scene.metadata.twoD = s, this.scene.metadata.viewMode = i, this.camera.activateCamera(s ? "2d" : "orbit");
|
|
17457
17609
|
}
|
|
17458
17610
|
/**
|
|
@@ -17554,18 +17706,11 @@ class ls {
|
|
|
17554
17706
|
}
|
|
17555
17707
|
this.savedZPositions.clear();
|
|
17556
17708
|
}
|
|
17557
|
-
|
|
17709
|
+
Ot.updateRays(this);
|
|
17558
17710
|
for (const o of this.dataManager.edges.values())
|
|
17559
17711
|
o.update();
|
|
17560
|
-
const a = this.getNodes();
|
|
17561
|
-
|
|
17562
|
-
let o = 1 / 0, n = 1 / 0, c = 1 / 0, h = -1 / 0, d = -1 / 0, u = -1 / 0;
|
|
17563
|
-
for (const p of a) {
|
|
17564
|
-
const m = p.mesh.position, y = p.size / 2;
|
|
17565
|
-
o = Math.min(o, m.x - y), n = Math.min(n, m.y - y), c = Math.min(c, m.z - y), h = Math.max(h, m.x + y), d = Math.max(d, m.y + y), u = Math.max(u, m.z + y);
|
|
17566
|
-
}
|
|
17567
|
-
this.camera.zoomToBoundingBox(new v(o, n, c), new v(h, d, u));
|
|
17568
|
-
}
|
|
17712
|
+
const a = _s(this.getNodes());
|
|
17713
|
+
a && this.camera.zoomToBoundingBox(a.min, a.max);
|
|
17569
17714
|
}
|
|
17570
17715
|
}
|
|
17571
17716
|
/**
|
|
@@ -17616,7 +17761,7 @@ class ls {
|
|
|
17616
17761
|
* @param config - Partial XR configuration to apply
|
|
17617
17762
|
*/
|
|
17618
17763
|
setXRConfig(e) {
|
|
17619
|
-
const t =
|
|
17764
|
+
const t = uo.parse(e);
|
|
17620
17765
|
this.graphContext.updateConfig({ xr: t });
|
|
17621
17766
|
}
|
|
17622
17767
|
/**
|
|
@@ -17818,7 +17963,7 @@ class ls {
|
|
|
17818
17963
|
* ```
|
|
17819
17964
|
*/
|
|
17820
17965
|
async waitForStableFrame(e = {}) {
|
|
17821
|
-
const t = e.timeoutMs ??
|
|
17966
|
+
const t = e.timeoutMs ?? ec;
|
|
17822
17967
|
let i, s;
|
|
17823
17968
|
try {
|
|
17824
17969
|
await Promise.race([
|
|
@@ -17883,7 +18028,7 @@ class ls {
|
|
|
17883
18028
|
* ```
|
|
17884
18029
|
*/
|
|
17885
18030
|
async captureScreenshot(e) {
|
|
17886
|
-
return new
|
|
18031
|
+
return new Qn(this.engine, this.scene, this.canvas, this).captureScreenshot(e);
|
|
17887
18032
|
}
|
|
17888
18033
|
/**
|
|
17889
18034
|
* Check if screenshot can be captured with given options.
|
|
@@ -17908,7 +18053,7 @@ class ls {
|
|
|
17908
18053
|
* ```
|
|
17909
18054
|
*/
|
|
17910
18055
|
async canCaptureScreenshot(e) {
|
|
17911
|
-
const { canCaptureScreenshot: t } = await import("./capability-check-
|
|
18056
|
+
const { canCaptureScreenshot: t } = await import("./capability-check-CdoqmrF0.js");
|
|
17912
18057
|
return t(this.canvas, e ?? {});
|
|
17913
18058
|
}
|
|
17914
18059
|
/**
|
|
@@ -17949,7 +18094,7 @@ class ls {
|
|
|
17949
18094
|
* ```
|
|
17950
18095
|
*/
|
|
17951
18096
|
async captureAnimation(e) {
|
|
17952
|
-
const { MediaRecorderCapture: t } = await Promise.resolve().then(() =>
|
|
18097
|
+
const { MediaRecorderCapture: t } = await Promise.resolve().then(() => hc), i = new t();
|
|
17953
18098
|
this.activeCapture = i;
|
|
17954
18099
|
const s = (r) => {
|
|
17955
18100
|
this.eventManager.emitGraphEvent("animation-progress", { progress: r });
|
|
@@ -18161,7 +18306,7 @@ class ls {
|
|
|
18161
18306
|
if (i && "pivot" in i && "cameraDistance" in i) {
|
|
18162
18307
|
const s = i;
|
|
18163
18308
|
if (e.target && s.pivot.position.set(e.target.x, e.target.y, e.target.z), e.pivotRotation) {
|
|
18164
|
-
const r =
|
|
18309
|
+
const r = oe.RotationYawPitchRoll(
|
|
18165
18310
|
e.pivotRotation.y,
|
|
18166
18311
|
// yaw
|
|
18167
18312
|
e.pivotRotation.x,
|
|
@@ -18175,7 +18320,7 @@ class ls {
|
|
|
18175
18320
|
e.position.x - e.target.x,
|
|
18176
18321
|
e.position.y - e.target.y,
|
|
18177
18322
|
e.position.z - e.target.z
|
|
18178
|
-
), a = r.length(), o = Math.atan2(r.x, r.z) + Math.PI, n = Math.asin(r.y / a), c =
|
|
18323
|
+
), a = r.length(), o = Math.atan2(r.x, r.z) + Math.PI, n = Math.asin(r.y / a), c = oe.RotationYawPitchRoll(o, n, 0);
|
|
18179
18324
|
s.pivot.rotationQuaternion = c;
|
|
18180
18325
|
}
|
|
18181
18326
|
if (e.cameraDistance !== void 0)
|
|
@@ -18209,13 +18354,13 @@ class ls {
|
|
|
18209
18354
|
let i;
|
|
18210
18355
|
switch (t) {
|
|
18211
18356
|
case "easeInOut":
|
|
18212
|
-
i = new
|
|
18357
|
+
i = new $t(), i.setEasingMode(Vt.EASINGMODE_EASEINOUT);
|
|
18213
18358
|
break;
|
|
18214
18359
|
case "easeIn":
|
|
18215
|
-
i = new
|
|
18360
|
+
i = new $t(), i.setEasingMode(Vt.EASINGMODE_EASEIN);
|
|
18216
18361
|
break;
|
|
18217
18362
|
case "easeOut":
|
|
18218
|
-
i = new
|
|
18363
|
+
i = new $t(), i.setEasingMode(Vt.EASINGMODE_EASEOUT);
|
|
18219
18364
|
break;
|
|
18220
18365
|
default:
|
|
18221
18366
|
return;
|
|
@@ -18577,7 +18722,7 @@ class ls {
|
|
|
18577
18722
|
*/
|
|
18578
18723
|
boundsToFrame(e) {
|
|
18579
18724
|
const t = e === void 0 ? this.getNodes() : [...e].map((i) => this.getNode(i)).filter((i) => i !== void 0);
|
|
18580
|
-
return
|
|
18725
|
+
return Qa(t.map((i) => i.getPosition()));
|
|
18581
18726
|
}
|
|
18582
18727
|
/**
|
|
18583
18728
|
* Everything a camera view is told: the box, the drawing mode, the viewport and where the
|
|
@@ -18618,13 +18763,13 @@ class ls {
|
|
|
18618
18763
|
* `E_UNKNOWN_OPTION` / `E_OPTION_RANGE` when `params` is not what the view declared.
|
|
18619
18764
|
*/
|
|
18620
18765
|
resolveCameraPreset(e, t) {
|
|
18621
|
-
if (!
|
|
18766
|
+
if (!qt(e)) {
|
|
18622
18767
|
const s = this.userCameraPresets.get(e);
|
|
18623
18768
|
if (s)
|
|
18624
18769
|
return s;
|
|
18625
18770
|
}
|
|
18626
18771
|
const i = this.cameraViewContext(this.boundsToFrame(t?.nodes), t?.params);
|
|
18627
|
-
return
|
|
18772
|
+
return lo(e, i);
|
|
18628
18773
|
}
|
|
18629
18774
|
/**
|
|
18630
18775
|
* Put the viewer where a named camera view says they should stand.
|
|
@@ -18658,12 +18803,12 @@ class ls {
|
|
|
18658
18803
|
* @throws A `GraphtyError` with `E_PROTECTED` when a camera view already answers to the name.
|
|
18659
18804
|
*/
|
|
18660
18805
|
saveCameraPreset(e) {
|
|
18661
|
-
if (
|
|
18662
|
-
throw new
|
|
18806
|
+
if (qt(e))
|
|
18807
|
+
throw new ae({
|
|
18663
18808
|
code: "E_PROTECTED",
|
|
18664
18809
|
message: `"${e}" is a camera view, and a view recomputes itself for whatever is on screen. Saving a fixed position under the same name would silently replace a rule with a snapshot.`,
|
|
18665
18810
|
source: "view",
|
|
18666
|
-
details: { name: e, available:
|
|
18811
|
+
details: { name: e, available: di() }
|
|
18667
18812
|
});
|
|
18668
18813
|
const t = this.getCameraState();
|
|
18669
18814
|
this.userCameraPresets.set(e, t);
|
|
@@ -18690,7 +18835,7 @@ class ls {
|
|
|
18690
18835
|
*/
|
|
18691
18836
|
getCameraPresets() {
|
|
18692
18837
|
const e = {};
|
|
18693
|
-
for (const t of
|
|
18838
|
+
for (const t of di())
|
|
18694
18839
|
e[t] = { builtin: !0 };
|
|
18695
18840
|
for (const [t, i] of this.userCameraPresets.entries())
|
|
18696
18841
|
e[t] = i;
|
|
@@ -18712,7 +18857,7 @@ class ls {
|
|
|
18712
18857
|
*/
|
|
18713
18858
|
importCameraPresets(e) {
|
|
18714
18859
|
for (const [t, i] of Object.entries(e)) {
|
|
18715
|
-
if (
|
|
18860
|
+
if (qt(t)) {
|
|
18716
18861
|
console.warn(`Skipping import of camera preset "${t}": a camera view already answers to that name`);
|
|
18717
18862
|
continue;
|
|
18718
18863
|
}
|
|
@@ -18776,7 +18921,7 @@ class ls {
|
|
|
18776
18921
|
* ```
|
|
18777
18922
|
*/
|
|
18778
18923
|
async enableAiControl(e) {
|
|
18779
|
-
const { AiManager: t } = await import("./AiManager-
|
|
18924
|
+
const { AiManager: t } = await import("./AiManager-Bd_r1Hei.js").then((i) => i.t);
|
|
18780
18925
|
this.aiManager = new t(), this.aiManager.init(this, e);
|
|
18781
18926
|
}
|
|
18782
18927
|
/**
|
|
@@ -18964,7 +19109,15 @@ class ls {
|
|
|
18964
19109
|
* ```
|
|
18965
19110
|
*/
|
|
18966
19111
|
getVoiceAdapter() {
|
|
18967
|
-
|
|
19112
|
+
if (!this.voiceAdapter) {
|
|
19113
|
+
const e = new js();
|
|
19114
|
+
e.onActiveChange((t, i) => {
|
|
19115
|
+
t ? this.eventManager.emitGraphEvent("ai-voice-start", {}) : this.eventManager.emitGraphEvent("ai-voice-end", { reason: i });
|
|
19116
|
+
}), e.onInput((t, i) => {
|
|
19117
|
+
this.eventManager.emitGraphEvent("ai-voice-transcript", { transcript: t, isFinal: i });
|
|
19118
|
+
}), this.voiceAdapter = e;
|
|
19119
|
+
}
|
|
19120
|
+
return this.voiceAdapter;
|
|
18968
19121
|
}
|
|
18969
19122
|
/**
|
|
18970
19123
|
* Start voice input and execute commands.
|
|
@@ -19025,13 +19178,13 @@ class ls {
|
|
|
19025
19178
|
const e = this.graphContext.getConfig().xr;
|
|
19026
19179
|
if (!e?.enabled)
|
|
19027
19180
|
return;
|
|
19028
|
-
this.xrSessionManager = new
|
|
19181
|
+
this.xrSessionManager = new Yn(this.scene, {
|
|
19029
19182
|
vr: e.vr,
|
|
19030
19183
|
ar: e.ar,
|
|
19031
19184
|
handTracking: e.input.handTracking
|
|
19032
19185
|
});
|
|
19033
19186
|
const t = e.vr.enabled && await this.xrSessionManager.isVRSupported(), i = e.ar.enabled && await this.xrSessionManager.isARSupported();
|
|
19034
|
-
this.xrUIManager = new
|
|
19187
|
+
this.xrUIManager = new Jn(this.element, t, i, e.ui), this.xrUIManager.onEnterXR = (s) => {
|
|
19035
19188
|
(async () => {
|
|
19036
19189
|
try {
|
|
19037
19190
|
await this.enterXR(s);
|
|
@@ -19064,7 +19217,7 @@ Check console for details.`), this.eventManager.emitGraphError(
|
|
|
19064
19217
|
if (!i)
|
|
19065
19218
|
throw new Error("XR helper not available after session creation");
|
|
19066
19219
|
this.scene.metadata = this.scene.metadata ?? {}, this.scene.metadata.xrHelper = i;
|
|
19067
|
-
const { XRPivotCameraController: s } = await import("./XRPivotCameraController-
|
|
19220
|
+
const { XRPivotCameraController: s } = await import("./XRPivotCameraController-BdoMFcON.js"), r = new s(this.scene, i), a = this.scene.onBeforeRenderObservable.add(() => {
|
|
19068
19221
|
r.update();
|
|
19069
19222
|
});
|
|
19070
19223
|
this.scene.metadata.xrCameraController = r, this.scene.metadata.xrUpdateObserver = a;
|
|
@@ -19082,12 +19235,12 @@ Check console for details.`), this.eventManager.emitGraphError(
|
|
|
19082
19235
|
this.voiceAdapter?.dispose(), this.voiceAdapter = null, this.disableAiControl(), this.xrUIManager?.dispose(), this.xrSessionManager?.dispose(), this.shutdown();
|
|
19083
19236
|
}
|
|
19084
19237
|
}
|
|
19085
|
-
var
|
|
19086
|
-
for (var s =
|
|
19238
|
+
var sc = Object.defineProperty, rc = Object.getOwnPropertyDescriptor, L = (l, e, t, i) => {
|
|
19239
|
+
for (var s = rc(e, t), r = l.length - 1, a; r >= 0; r--)
|
|
19087
19240
|
(a = l[r]) && (s = a(e, t, s) || s);
|
|
19088
|
-
return s &&
|
|
19241
|
+
return s && sc(e, t, s), s;
|
|
19089
19242
|
};
|
|
19090
|
-
const
|
|
19243
|
+
const ac = 100, oc = [
|
|
19091
19244
|
"nodeData",
|
|
19092
19245
|
"edgeData",
|
|
19093
19246
|
"dataSourceConfig",
|
|
@@ -19098,8 +19251,8 @@ const tc = 100, ic = [
|
|
|
19098
19251
|
"background",
|
|
19099
19252
|
"xr"
|
|
19100
19253
|
];
|
|
19101
|
-
var f,
|
|
19102
|
-
const
|
|
19254
|
+
var f, we, ve, wt, _e, Be, Ue, Ge, vt, j, Bs, Us, Gs, $s, $e, Ve, le, de, He, We, je, qe, Ke, Ze, Xe, Qe, Je, be, Pe, Se, Ye, et, tt, it, st, rt, at, yi, ot, wi, nt, Vs;
|
|
19255
|
+
const Ii = class Ii extends Hs {
|
|
19103
19256
|
/**
|
|
19104
19257
|
* Creates a new Graphty element instance.
|
|
19105
19258
|
*/
|
|
@@ -19107,14 +19260,14 @@ const Ai = class Ai extends Gs {
|
|
|
19107
19260
|
super();
|
|
19108
19261
|
T(this, j);
|
|
19109
19262
|
T(this, f);
|
|
19110
|
-
T(this,
|
|
19111
|
-
T(this,
|
|
19112
|
-
T(this,
|
|
19263
|
+
T(this, we);
|
|
19264
|
+
T(this, ve, null);
|
|
19265
|
+
T(this, wt, !1);
|
|
19113
19266
|
T(this, _e, null);
|
|
19114
19267
|
T(this, Be, null);
|
|
19115
19268
|
T(this, Ue, null);
|
|
19116
19269
|
T(this, Ge, /* @__PURE__ */ new Map());
|
|
19117
|
-
T(this,
|
|
19270
|
+
T(this, vt, !1);
|
|
19118
19271
|
// Private backing fields for reactive properties
|
|
19119
19272
|
T(this, $e);
|
|
19120
19273
|
T(this, Ve);
|
|
@@ -19129,9 +19282,9 @@ const Ai = class Ai extends Gs {
|
|
|
19129
19282
|
T(this, Xe);
|
|
19130
19283
|
T(this, Qe);
|
|
19131
19284
|
T(this, Je);
|
|
19132
|
-
T(this, ve);
|
|
19133
|
-
T(this, Te);
|
|
19134
19285
|
T(this, be);
|
|
19286
|
+
T(this, Pe);
|
|
19287
|
+
T(this, Se);
|
|
19135
19288
|
T(this, Ye);
|
|
19136
19289
|
T(this, et);
|
|
19137
19290
|
T(this, tt);
|
|
@@ -19144,7 +19297,7 @@ const Ai = class Ai extends Gs {
|
|
|
19144
19297
|
*/
|
|
19145
19298
|
T(this, ot, !1);
|
|
19146
19299
|
T(this, nt);
|
|
19147
|
-
M(this,
|
|
19300
|
+
M(this, we, document.createElement("div")), g(this, we).setAttribute("style", "position: absolute; inset: 0; display: block;"), M(this, f, new us(g(this, we)));
|
|
19148
19301
|
}
|
|
19149
19302
|
/**
|
|
19150
19303
|
* The headless model this element draws.
|
|
@@ -19227,18 +19380,18 @@ const Ai = class Ai extends Gs {
|
|
|
19227
19380
|
* Called when the element is added to the DOM. Sets up the graph container and resize observer.
|
|
19228
19381
|
*/
|
|
19229
19382
|
connectedCallback() {
|
|
19230
|
-
super.connectedCallback(), this.renderRoot.appendChild(g(this,
|
|
19383
|
+
super.connectedCallback(), this.renderRoot.appendChild(g(this, we)), ne(this, j, $s).call(this), M(this, ve, new ResizeObserver(() => {
|
|
19231
19384
|
g(this, f).engine.resize(), g(this, f).camera.onResize();
|
|
19232
|
-
})), g(this,
|
|
19233
|
-
const t = ne(this, j,
|
|
19385
|
+
})), g(this, ve).observe(this);
|
|
19386
|
+
const t = ne(this, j, Vs).call(this);
|
|
19234
19387
|
t.disposed || t.start();
|
|
19235
19388
|
const i = g(this, f).getSession();
|
|
19236
19389
|
g(this, _e) ?? M(this, _e, i.on("run:changed", (s) => {
|
|
19237
|
-
ne(this, j,
|
|
19390
|
+
ne(this, j, Bs).call(this, s);
|
|
19238
19391
|
})), g(this, Be) ?? M(this, Be, i.on("selection:changed", (s) => {
|
|
19239
|
-
ne(this, j,
|
|
19392
|
+
ne(this, j, Us).call(this, s);
|
|
19240
19393
|
})), g(this, Ue) ?? M(this, Ue, i.on("visibility:changed", (s) => {
|
|
19241
|
-
ne(this, j,
|
|
19394
|
+
ne(this, j, Gs).call(this, s);
|
|
19242
19395
|
}));
|
|
19243
19396
|
}
|
|
19244
19397
|
/**
|
|
@@ -19255,7 +19408,7 @@ const Ai = class Ai extends Gs {
|
|
|
19255
19408
|
*/
|
|
19256
19409
|
async asyncFirstUpdated() {
|
|
19257
19410
|
g(this, f).eventManager.onGraphEvent.add((t) => {
|
|
19258
|
-
|
|
19411
|
+
ka(t) && this.dispatchEvent(
|
|
19259
19412
|
new CustomEvent(t.type, {
|
|
19260
19413
|
detail: t,
|
|
19261
19414
|
bubbles: !0,
|
|
@@ -19263,7 +19416,7 @@ const Ai = class Ai extends Gs {
|
|
|
19263
19416
|
})
|
|
19264
19417
|
);
|
|
19265
19418
|
}), g(this, f).eventManager.onNodeEvent.add((t) => {
|
|
19266
|
-
const i =
|
|
19419
|
+
const i = za[t.type], s = _a(t);
|
|
19267
19420
|
i === void 0 || s === null || this.dispatchEvent(
|
|
19268
19421
|
new CustomEvent(i, {
|
|
19269
19422
|
detail: s,
|
|
@@ -19282,14 +19435,14 @@ const Ai = class Ai extends Gs {
|
|
|
19282
19435
|
* @returns The graph container element
|
|
19283
19436
|
*/
|
|
19284
19437
|
render() {
|
|
19285
|
-
return g(this,
|
|
19438
|
+
return g(this, we);
|
|
19286
19439
|
}
|
|
19287
19440
|
/**
|
|
19288
19441
|
* Called when the element is removed from the DOM. Cleans up resources and shuts down the graph.
|
|
19289
19442
|
*/
|
|
19290
19443
|
disconnectedCallback() {
|
|
19291
19444
|
var t, i, s;
|
|
19292
|
-
g(this,
|
|
19445
|
+
g(this, ve) && (g(this, ve).disconnect(), M(this, ve, null)), (t = g(this, _e)) == null || t.call(this), M(this, _e, null), (i = g(this, Be)) == null || i.call(this), M(this, Be, null), (s = g(this, Ue)) == null || s.call(this), M(this, Ue, null), g(this, f).shutdown(), super.disconnectedCallback();
|
|
19293
19446
|
}
|
|
19294
19447
|
get nodeData() {
|
|
19295
19448
|
return g(this, $e);
|
|
@@ -19300,7 +19453,7 @@ const Ai = class Ai extends Gs {
|
|
|
19300
19453
|
set nodeData(t) {
|
|
19301
19454
|
const i = g(this, $e);
|
|
19302
19455
|
M(this, $e, t), t && Array.isArray(t) && g(this, f).addNodes(t).catch((s) => {
|
|
19303
|
-
ne(this, j,
|
|
19456
|
+
ne(this, j, yi).call(this, s);
|
|
19304
19457
|
}), this.requestUpdate("nodeData", i);
|
|
19305
19458
|
}
|
|
19306
19459
|
get edgeData() {
|
|
@@ -19312,7 +19465,7 @@ const Ai = class Ai extends Gs {
|
|
|
19312
19465
|
set edgeData(t) {
|
|
19313
19466
|
const i = g(this, Ve);
|
|
19314
19467
|
M(this, Ve, t), t && Array.isArray(t) && g(this, f).setEdges(t).catch((s) => {
|
|
19315
|
-
ne(this, j,
|
|
19468
|
+
ne(this, j, yi).call(this, s);
|
|
19316
19469
|
}), this.requestUpdate("edgeData", i);
|
|
19317
19470
|
}
|
|
19318
19471
|
get dataSource() {
|
|
@@ -19323,7 +19476,7 @@ const Ai = class Ai extends Gs {
|
|
|
19323
19476
|
*/
|
|
19324
19477
|
set dataSource(t) {
|
|
19325
19478
|
const i = g(this, le);
|
|
19326
|
-
M(this, le, t), ne(this, j,
|
|
19479
|
+
M(this, le, t), ne(this, j, wi).call(this), this.requestUpdate("dataSource", i);
|
|
19327
19480
|
}
|
|
19328
19481
|
get dataSourceConfig() {
|
|
19329
19482
|
return g(this, de);
|
|
@@ -19333,7 +19486,7 @@ const Ai = class Ai extends Gs {
|
|
|
19333
19486
|
*/
|
|
19334
19487
|
set dataSourceConfig(t) {
|
|
19335
19488
|
const i = g(this, de);
|
|
19336
|
-
M(this, de, t), ne(this, j,
|
|
19489
|
+
M(this, de, t), ne(this, j, wi).call(this), this.requestUpdate("dataSourceConfig", i);
|
|
19337
19490
|
}
|
|
19338
19491
|
/**
|
|
19339
19492
|
* Removes every node and edge, and lets a later data source load.
|
|
@@ -19402,9 +19555,9 @@ const Ai = class Ai extends Gs {
|
|
|
19402
19555
|
*/
|
|
19403
19556
|
set repeatedEdges(t) {
|
|
19404
19557
|
const i = g(this, Ke);
|
|
19405
|
-
if (t !== void 0 && !
|
|
19558
|
+
if (t !== void 0 && !Li.includes(t)) {
|
|
19406
19559
|
console.error(
|
|
19407
|
-
`<graphty-element>: repeated-edges must be one of ${
|
|
19560
|
+
`<graphty-element>: repeated-edges must be one of ${Li.join(", ")}, not "${t}". Keeping "${i ?? "keep"}". See https://graphty.app/docs/graphty-element/attributes#repeated-edges`
|
|
19408
19561
|
);
|
|
19409
19562
|
return;
|
|
19410
19563
|
}
|
|
@@ -19463,30 +19616,30 @@ const Ai = class Ai extends Gs {
|
|
|
19463
19616
|
M(this, Je, t), t !== void 0 && q.set(g(this, f).styles.config, "data.directed", t), this.requestUpdate("directed", i);
|
|
19464
19617
|
}
|
|
19465
19618
|
get layout() {
|
|
19466
|
-
return g(this,
|
|
19619
|
+
return g(this, be);
|
|
19467
19620
|
}
|
|
19468
19621
|
/**
|
|
19469
19622
|
* Sets the layout algorithm. Triggers layout recalculation with merged config.
|
|
19470
19623
|
*/
|
|
19471
19624
|
set layout(t) {
|
|
19472
|
-
const i = g(this,
|
|
19473
|
-
if (M(this,
|
|
19474
|
-
const r = { ...g(this, f).styles.config.graph.layoutOptions ?? {}, ...g(this,
|
|
19625
|
+
const i = g(this, be);
|
|
19626
|
+
if (M(this, be, t), t) {
|
|
19627
|
+
const r = { ...g(this, f).styles.config.graph.layoutOptions ?? {}, ...g(this, Pe) ?? {} };
|
|
19475
19628
|
g(this, f).setLayout(t, r);
|
|
19476
19629
|
}
|
|
19477
19630
|
this.requestUpdate("layout", i);
|
|
19478
19631
|
}
|
|
19479
19632
|
get layoutConfig() {
|
|
19480
|
-
return g(this,
|
|
19633
|
+
return g(this, Pe);
|
|
19481
19634
|
}
|
|
19482
19635
|
/**
|
|
19483
19636
|
* Sets layout-specific configuration. Updates active layout if one is set.
|
|
19484
19637
|
*/
|
|
19485
19638
|
set layoutConfig(t) {
|
|
19486
|
-
const i = g(this,
|
|
19487
|
-
if (M(this,
|
|
19639
|
+
const i = g(this, Pe);
|
|
19640
|
+
if (M(this, Pe, t), g(this, be)) {
|
|
19488
19641
|
const r = { ...g(this, f).styles.config.graph.layoutOptions ?? {}, ...t ?? {} };
|
|
19489
|
-
g(this, f).setLayout(g(this,
|
|
19642
|
+
g(this, f).setLayout(g(this, be), r);
|
|
19490
19643
|
}
|
|
19491
19644
|
this.requestUpdate("layoutConfig", i);
|
|
19492
19645
|
}
|
|
@@ -19541,23 +19694,23 @@ const Ai = class Ai extends Gs {
|
|
|
19541
19694
|
* @throws A `GraphtyError` coded `E_BAD_COMMAND` naming the first malformed entry.
|
|
19542
19695
|
*/
|
|
19543
19696
|
set algorithmsOnLoad(t) {
|
|
19544
|
-
const i = t === void 0 ? void 0 :
|
|
19697
|
+
const i = t === void 0 ? void 0 : Qs(t), s = g(this, st);
|
|
19545
19698
|
M(this, st, t), g(this, f).styles.config.data.algorithms = i, this.requestUpdate("algorithmsOnLoad", s);
|
|
19546
19699
|
}
|
|
19547
19700
|
get viewMode() {
|
|
19548
|
-
return g(this,
|
|
19701
|
+
return g(this, Se);
|
|
19549
19702
|
}
|
|
19550
19703
|
/**
|
|
19551
19704
|
* Sets the view mode. Switches camera and rendering mode accordingly.
|
|
19552
19705
|
*/
|
|
19553
19706
|
set viewMode(t) {
|
|
19554
|
-
const i = g(this,
|
|
19555
|
-
M(this,
|
|
19707
|
+
const i = g(this, Se);
|
|
19708
|
+
M(this, Se, t), t !== void 0 && g(this, f).setViewMode(t), this.requestUpdate("viewMode", i);
|
|
19556
19709
|
}
|
|
19557
19710
|
get layout2d() {
|
|
19558
|
-
if (g(this,
|
|
19711
|
+
if (g(this, Se) === "2d")
|
|
19559
19712
|
return !0;
|
|
19560
|
-
if (g(this,
|
|
19713
|
+
if (g(this, Se) === "3d")
|
|
19561
19714
|
return !1;
|
|
19562
19715
|
}
|
|
19563
19716
|
/**
|
|
@@ -20998,7 +21151,7 @@ const Ai = class Ai extends Gs {
|
|
|
20998
21151
|
* ```
|
|
20999
21152
|
*/
|
|
21000
21153
|
static createApiKeyManager() {
|
|
21001
|
-
return
|
|
21154
|
+
return us.createApiKeyManager();
|
|
21002
21155
|
}
|
|
21003
21156
|
/**
|
|
21004
21157
|
* Get the voice input adapter.
|
|
@@ -21064,7 +21217,7 @@ const Ai = class Ai extends Gs {
|
|
|
21064
21217
|
*/
|
|
21065
21218
|
set acceleration(t) {
|
|
21066
21219
|
const i = g(this, f).acceleration.policy;
|
|
21067
|
-
if (!
|
|
21220
|
+
if (!Hr(t)) {
|
|
21068
21221
|
console.error(
|
|
21069
21222
|
`<graphty-element>: acceleration must be "auto", "off" or "required", not "${String(t)}". Keeping "${i}". See https://graphty.app/docs/graphty-element/guide/acceleration`
|
|
21070
21223
|
);
|
|
@@ -21098,7 +21251,7 @@ const Ai = class Ai extends Gs {
|
|
|
21098
21251
|
this.requestUpdate("accelerationMinNodes", i);
|
|
21099
21252
|
}
|
|
21100
21253
|
};
|
|
21101
|
-
f = new WeakMap(),
|
|
21254
|
+
f = new WeakMap(), we = new WeakMap(), ve = new WeakMap(), wt = new WeakMap(), _e = new WeakMap(), Be = new WeakMap(), Ue = new WeakMap(), Ge = new WeakMap(), vt = new WeakMap(), j = new WeakSet(), /**
|
|
21102
21255
|
* Mirror one run notification onto the DOM, so a consumer holding only the tag can follow it.
|
|
21103
21256
|
*
|
|
21104
21257
|
* The detail carries the run's RECORD rather than the run: a `CustomEvent` detail crosses to
|
|
@@ -21106,10 +21259,10 @@ f = new WeakMap(), ye = new WeakMap(), we = new WeakMap(), yt = new WeakMap(), _
|
|
|
21106
21259
|
* there. A consumer that wants to cancel looks the run up by `detail.run.id`.
|
|
21107
21260
|
* @param change - The run's record, and which moment it reached.
|
|
21108
21261
|
*/
|
|
21109
|
-
|
|
21262
|
+
Bs = function(t) {
|
|
21110
21263
|
if (t.phase === "progress") {
|
|
21111
21264
|
const i = Date.now(), s = g(this, Ge).get(t.run.id) ?? 0;
|
|
21112
|
-
if (i - s <
|
|
21265
|
+
if (i - s < ac)
|
|
21113
21266
|
return;
|
|
21114
21267
|
g(this, Ge).set(t.run.id, i);
|
|
21115
21268
|
}
|
|
@@ -21130,7 +21283,7 @@ ks = function(t) {
|
|
|
21130
21283
|
* that wants the record looks the id up.
|
|
21131
21284
|
* @param delta - What joined, what left, and what the selection holds now.
|
|
21132
21285
|
*/
|
|
21133
|
-
|
|
21286
|
+
Us = function(t) {
|
|
21134
21287
|
this.dispatchEvent(
|
|
21135
21288
|
new CustomEvent("graphty-selection-change", {
|
|
21136
21289
|
detail: t,
|
|
@@ -21147,7 +21300,7 @@ zs = function(t) {
|
|
|
21147
21300
|
* all three and must not learn about them in three different ways.
|
|
21148
21301
|
* @param change - The counts, the unresolved paths and what produced them.
|
|
21149
21302
|
*/
|
|
21150
|
-
|
|
21303
|
+
Gs = function(t) {
|
|
21151
21304
|
this.dispatchEvent(
|
|
21152
21305
|
new CustomEvent("graphty-visibility-change", {
|
|
21153
21306
|
detail: t,
|
|
@@ -21163,15 +21316,15 @@ _s = function(t) {
|
|
|
21163
21316
|
* loaded lazily, `nodeData={[...]}` arrives as `nodedata="[object Object]"` and the graph comes
|
|
21164
21317
|
* up empty. The value is gone, so the element cannot recover it, but it can say why.
|
|
21165
21318
|
*/
|
|
21166
|
-
|
|
21167
|
-
if (!g(this,
|
|
21168
|
-
M(this,
|
|
21169
|
-
for (const t of
|
|
21319
|
+
$s = function() {
|
|
21320
|
+
if (!g(this, vt)) {
|
|
21321
|
+
M(this, vt, !0);
|
|
21322
|
+
for (const t of oc)
|
|
21170
21323
|
this.getAttribute(t) === "[object Object]" && console.error(
|
|
21171
21324
|
`<graphty-element> received ${t} as the attribute ${t.toLowerCase()}="[object Object]", so the value was lost. This happens when a framework renders the tag before @graphty/graphty-element is loaded. Import the element before rendering, or await customElements.whenDefined("graphty-element"). See https://graphty.app/docs/graphty-element/guide/installation#loading-the-element-lazily`
|
|
21172
21325
|
);
|
|
21173
21326
|
}
|
|
21174
|
-
}, $e = new WeakMap(), Ve = new WeakMap(), le = new WeakMap(), de = new WeakMap(), He = new WeakMap(), We = new WeakMap(), je = new WeakMap(), qe = new WeakMap(), Ke = new WeakMap(), Ze = new WeakMap(), Xe = new WeakMap(), Qe = new WeakMap(), Je = new WeakMap(),
|
|
21327
|
+
}, $e = new WeakMap(), Ve = new WeakMap(), le = new WeakMap(), de = new WeakMap(), He = new WeakMap(), We = new WeakMap(), je = new WeakMap(), qe = new WeakMap(), Ke = new WeakMap(), Ze = new WeakMap(), Xe = new WeakMap(), Qe = new WeakMap(), Je = new WeakMap(), be = new WeakMap(), Pe = new WeakMap(), Se = new WeakMap(), Ye = new WeakMap(), et = new WeakMap(), tt = new WeakMap(), it = new WeakMap(), st = new WeakMap(), rt = new WeakMap(), at = new WeakMap(), /**
|
|
21175
21328
|
* Publish a failure from work that a property or an attribute assignment started.
|
|
21176
21329
|
*
|
|
21177
21330
|
* Assigning `node-data`, `edge-data` or the data-source pair hands the caller no promise, so a
|
|
@@ -21186,14 +21339,14 @@ Bs = function() {
|
|
|
21186
21339
|
* throw calls the method -- `addNodes`, `setEdges`, `addDataFromSource` -- and awaits it.
|
|
21187
21340
|
* @param error - whatever the load rejected with
|
|
21188
21341
|
*/
|
|
21189
|
-
|
|
21342
|
+
yi = function(t) {
|
|
21190
21343
|
g(this, f).eventManager.emitDataLoadingError(
|
|
21191
21344
|
t instanceof Error ? t : new Error(String(t)),
|
|
21192
21345
|
"validation",
|
|
21193
21346
|
"records",
|
|
21194
21347
|
{ canContinue: !1 }
|
|
21195
21348
|
);
|
|
21196
|
-
}, ot = new WeakMap(),
|
|
21349
|
+
}, ot = new WeakMap(), wi = function() {
|
|
21197
21350
|
!g(this, ot) && g(this, le) && g(this, de) && (M(this, ot, !0), g(this, f).addDataFromSource(g(this, le), g(this, de)).catch(() => {
|
|
21198
21351
|
}));
|
|
21199
21352
|
}, nt = new WeakMap(), /**
|
|
@@ -21206,9 +21359,9 @@ pi = function(t) {
|
|
|
21206
21359
|
* same object `element.session.capabilities` returns, so the two channels cannot disagree.
|
|
21207
21360
|
* @returns The controller.
|
|
21208
21361
|
*/
|
|
21209
|
-
|
|
21362
|
+
Vs = function() {
|
|
21210
21363
|
const t = g(this, f).acceleration;
|
|
21211
|
-
return g(this,
|
|
21364
|
+
return g(this, wt) || (t.onChange(() => {
|
|
21212
21365
|
this.dispatchEvent(
|
|
21213
21366
|
new CustomEvent("graphty-capabilities-change", {
|
|
21214
21367
|
detail: { capabilities: t.capabilities },
|
|
@@ -21216,8 +21369,8 @@ Us = function() {
|
|
|
21216
21369
|
composed: !0
|
|
21217
21370
|
})
|
|
21218
21371
|
);
|
|
21219
|
-
}), M(this,
|
|
21220
|
-
},
|
|
21372
|
+
}), M(this, wt, !0)), t;
|
|
21373
|
+
}, Ii.styles = Ws`
|
|
21221
21374
|
:host {
|
|
21222
21375
|
display: block;
|
|
21223
21376
|
position: relative;
|
|
@@ -21226,7 +21379,7 @@ Us = function() {
|
|
|
21226
21379
|
aspect-ratio: 2 / 1;
|
|
21227
21380
|
}
|
|
21228
21381
|
`;
|
|
21229
|
-
let P =
|
|
21382
|
+
let P = Ii;
|
|
21230
21383
|
L([
|
|
21231
21384
|
D({
|
|
21232
21385
|
/*
|
|
@@ -21417,12 +21570,12 @@ L([
|
|
|
21417
21570
|
L([
|
|
21418
21571
|
D({ attribute: "acceleration-min-nodes", type: Number, reflect: !0 })
|
|
21419
21572
|
], P.prototype, "accelerationMinNodes");
|
|
21420
|
-
const
|
|
21421
|
-
|
|
21573
|
+
const gs = customElements.get("graphty-element");
|
|
21574
|
+
gs === void 0 ? customElements.define("graphty-element", P) : gs !== P && console.warn(
|
|
21422
21575
|
"<graphty-element> is already defined by another class, so this copy of @graphty/graphty-element was not registered. Two copies of the package are loaded; make every import resolve to one."
|
|
21423
21576
|
);
|
|
21424
|
-
const
|
|
21425
|
-
class
|
|
21577
|
+
const nc = ge.getLogger(["graphty", "video", "recorder"]);
|
|
21578
|
+
class vi extends Error {
|
|
21426
21579
|
/**
|
|
21427
21580
|
* Creates a new AnimationCancelledError
|
|
21428
21581
|
*/
|
|
@@ -21430,7 +21583,7 @@ class fi extends Error {
|
|
|
21430
21583
|
super("Animation capture cancelled"), this.name = "AnimationCancelledError";
|
|
21431
21584
|
}
|
|
21432
21585
|
}
|
|
21433
|
-
class
|
|
21586
|
+
class cc {
|
|
21434
21587
|
/**
|
|
21435
21588
|
* Creates a new MediaRecorderCapture instance
|
|
21436
21589
|
* @param config - Configuration options for the recorder
|
|
@@ -21443,7 +21596,7 @@ class rc {
|
|
|
21443
21596
|
* @param message - The message to log
|
|
21444
21597
|
*/
|
|
21445
21598
|
log(e) {
|
|
21446
|
-
this.debug &&
|
|
21599
|
+
this.debug && nc.debug(e);
|
|
21447
21600
|
}
|
|
21448
21601
|
/**
|
|
21449
21602
|
* Detects browser and returns best supported codec
|
|
@@ -21495,7 +21648,7 @@ class rc {
|
|
|
21495
21648
|
*/
|
|
21496
21649
|
async captureRealtime(e, t, i) {
|
|
21497
21650
|
this.isCancelled = !1, this.cancelReject = null;
|
|
21498
|
-
const s = this.getSupportedCodec(t.format), r = t.fps ??
|
|
21651
|
+
const s = this.getSupportedCodec(t.format), r = t.fps ?? ns.DEFAULT_FPS, a = t.width ?? e.width, o = t.height ?? e.height, n = e.captureStream(r), c = {
|
|
21499
21652
|
mimeType: s
|
|
21500
21653
|
};
|
|
21501
21654
|
t.videoBitrate && (c.videoBitsPerSecond = t.videoBitrate);
|
|
@@ -21504,7 +21657,7 @@ class rc {
|
|
|
21504
21657
|
const d = [];
|
|
21505
21658
|
return new Promise((u, p) => {
|
|
21506
21659
|
if (this.cancelReject = p, this.isCancelled) {
|
|
21507
|
-
this.activeRecorder = null, this.cancelReject = null, p(new
|
|
21660
|
+
this.activeRecorder = null, this.cancelReject = null, p(new vi());
|
|
21508
21661
|
return;
|
|
21509
21662
|
}
|
|
21510
21663
|
h.ondataavailable = (w) => {
|
|
@@ -21544,7 +21697,7 @@ class rc {
|
|
|
21544
21697
|
}
|
|
21545
21698
|
const w = Date.now() - m, S = Math.min(100, w / t.duration * 100);
|
|
21546
21699
|
i?.(S), w >= t.duration && clearInterval(y);
|
|
21547
|
-
},
|
|
21700
|
+
}, ns.PROGRESS_INTERVAL_MS);
|
|
21548
21701
|
setTimeout(() => {
|
|
21549
21702
|
clearInterval(y), !this.isCancelled && h.state !== "inactive" && (h.stop(), i?.(100));
|
|
21550
21703
|
}, t.duration);
|
|
@@ -21561,7 +21714,7 @@ class rc {
|
|
|
21561
21714
|
* @returns true if a capture was cancelled, false if no capture was in progress
|
|
21562
21715
|
*/
|
|
21563
21716
|
cancel() {
|
|
21564
|
-
return this.activeRecorder ? (this.isCancelled = !0, this.activeRecorder.state !== "inactive" && this.activeRecorder.stop(), this.cancelReject && (this.cancelReject(new
|
|
21717
|
+
return this.activeRecorder ? (this.isCancelled = !0, this.activeRecorder.state !== "inactive" && this.activeRecorder.stop(), this.cancelReject && (this.cancelReject(new vi()), this.cancelReject = null), this.activeRecorder = null, !0) : !1;
|
|
21565
21718
|
}
|
|
21566
21719
|
/**
|
|
21567
21720
|
* Check if a capture is currently in progress
|
|
@@ -21579,32 +21732,32 @@ class rc {
|
|
|
21579
21732
|
return this.getSupportedCodec(e);
|
|
21580
21733
|
}
|
|
21581
21734
|
}
|
|
21582
|
-
const
|
|
21735
|
+
const hc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
21583
21736
|
__proto__: null,
|
|
21584
|
-
AnimationCancelledError:
|
|
21585
|
-
MediaRecorderCapture:
|
|
21586
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
21737
|
+
AnimationCancelledError: vi,
|
|
21738
|
+
MediaRecorderCapture: cc
|
|
21739
|
+
}, Symbol.toStringTag, { value: "Module" })), Hc = Ca;
|
|
21587
21740
|
export {
|
|
21588
|
-
|
|
21589
|
-
|
|
21590
|
-
|
|
21591
|
-
|
|
21592
|
-
|
|
21593
|
-
|
|
21594
|
-
|
|
21595
|
-
|
|
21596
|
-
|
|
21597
|
-
|
|
21598
|
-
|
|
21741
|
+
ko as A,
|
|
21742
|
+
fe as B,
|
|
21743
|
+
mn as D,
|
|
21744
|
+
Ot as E,
|
|
21745
|
+
us as G,
|
|
21746
|
+
wn as I,
|
|
21747
|
+
Tn as L,
|
|
21748
|
+
Dt as N,
|
|
21749
|
+
mi as O,
|
|
21750
|
+
Fn as P,
|
|
21751
|
+
Gn as R,
|
|
21599
21752
|
O as S,
|
|
21600
|
-
|
|
21601
|
-
|
|
21602
|
-
|
|
21603
|
-
|
|
21604
|
-
|
|
21753
|
+
Ci as U,
|
|
21754
|
+
vi as a,
|
|
21755
|
+
Hc as b,
|
|
21756
|
+
jn as c,
|
|
21757
|
+
fn as d,
|
|
21605
21758
|
P as e,
|
|
21606
21759
|
R as f,
|
|
21607
|
-
|
|
21608
|
-
|
|
21609
|
-
|
|
21760
|
+
$n as g,
|
|
21761
|
+
fi as h,
|
|
21762
|
+
Fa as i
|
|
21610
21763
|
};
|