@qe-libs/qeviz 0.5.6 → 0.6.0

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/qeviz.es.js CHANGED
@@ -1,90 +1,90 @@
1
- var ri = Object.defineProperty;
2
- var Fs = (d) => {
3
- throw TypeError(d);
1
+ var pi = Object.defineProperty;
2
+ var Ks = (g) => {
3
+ throw TypeError(g);
4
4
  };
5
- var u = (d, t) => ri(d, "name", { value: t, configurable: !0 });
6
- var js = (d, t, e) => t.has(d) || Fs("Cannot " + e);
7
- var k = (d, t, e) => (js(d, t, "read from private field"), e ? e.call(d) : t.get(d)), et = (d, t, e) => t.has(d) ? Fs("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(d) : t.set(d, e), B = (d, t, e, s) => (js(d, t, "write to private field"), s ? s.call(d, e) : t.set(d, e), e);
8
- var ae, he, le, bt, ce;
9
- const es = class es extends Array {
5
+ var c = (g, t) => pi(g, "name", { value: t, configurable: !0 });
6
+ var Js = (g, t, e) => t.has(g) || Ks("Cannot " + e);
7
+ var L = (g, t, e) => (Js(g, t, "read from private field"), e ? e.call(g) : t.get(g)), tt = (g, t, e) => t.has(g) ? Ks("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(g) : t.set(g, e), G = (g, t, e, s) => (Js(g, t, "write to private field"), s ? s.call(g, e) : t.set(g, e), e);
8
+ var de, ge, me, yt, fe;
9
+ const ls = class ls extends Array {
10
10
  constructor(e, s, i, n, r) {
11
11
  super(...s);
12
- et(this, ae);
13
- et(this, he);
14
- et(this, le);
15
- et(this, bt);
16
- et(this, ce);
17
- B(this, le, e), B(this, he, i), B(this, bt, n), B(this, ce, n == null ? void 0 : n.classes), B(this, ae, r);
12
+ tt(this, de);
13
+ tt(this, ge);
14
+ tt(this, me);
15
+ tt(this, yt);
16
+ tt(this, fe);
17
+ G(this, me, e), G(this, ge, i), G(this, yt, n), G(this, fe, n == null ? void 0 : n.classes), G(this, de, r);
18
18
  }
19
19
  get parent() {
20
- return k(this, bt);
20
+ return L(this, yt);
21
21
  }
22
22
  get names() {
23
- return k(this, le);
23
+ return L(this, me);
24
24
  }
25
25
  get rowName() {
26
- return k(this, he);
26
+ return L(this, ge);
27
27
  }
28
28
  get types() {
29
- if (!k(this, bt)) throw new Error("No parent DataFrame attached to this row.");
30
- return k(this, bt).types;
29
+ if (!L(this, yt)) throw new Error("No parent DataFrame attached to this row.");
30
+ return L(this, yt).types;
31
31
  }
32
32
  get classes() {
33
- return k(this, ce);
33
+ return L(this, fe);
34
34
  }
35
35
  get rowNumber() {
36
- return k(this, ae);
36
+ return L(this, de);
37
37
  }
38
38
  col(e) {
39
- if (!k(this, bt)) throw new Error("No parent DataFrame attached to this row.");
40
- return k(this, bt).col(e);
39
+ if (!L(this, yt)) throw new Error("No parent DataFrame attached to this row.");
40
+ return L(this, yt).col(e);
41
41
  }
42
42
  cols(...e) {
43
- if (!k(this, bt)) throw new Error("No parent DataFrame attached to this row.");
44
- return k(this, bt).cols(...e);
43
+ if (!L(this, yt)) throw new Error("No parent DataFrame attached to this row.");
44
+ return L(this, yt).cols(...e);
45
45
  }
46
46
  filter(e) {
47
47
  console.error("DataFrameRow does not currently support filtering.");
48
48
  }
49
49
  };
50
- ae = new WeakMap(), he = new WeakMap(), le = new WeakMap(), bt = new WeakMap(), ce = new WeakMap(), u(es, "DataFrameRow");
51
- let Ht = es;
52
- var oi = /* @__PURE__ */ ((d) => (d.Character = "character", d.Double = "double", d.Logical = "logical", d.Integer = "integer", d))(oi || {}), _e, yt, Ut, Nt;
53
- const ss = class ss extends Array {
50
+ de = new WeakMap(), ge = new WeakMap(), me = new WeakMap(), yt = new WeakMap(), fe = new WeakMap(), c(ls, "DataFrameRow");
51
+ let Jt = ls;
52
+ var bi = /* @__PURE__ */ ((g) => (g.Character = "character", g.Double = "double", g.Logical = "logical", g.Integer = "integer", g))(bi || {}), pe, xt, Vt, zt;
53
+ const cs = class cs extends Array {
54
54
  constructor(e, s, i, n) {
55
55
  super(s.length);
56
- et(this, _e);
57
- et(this, yt);
58
- et(this, Ut);
59
- et(this, Nt);
56
+ tt(this, pe);
57
+ tt(this, xt);
58
+ tt(this, Vt);
59
+ tt(this, zt);
60
60
  for (let r = 0; r < s.length; r++)
61
61
  this[r] = s[r];
62
- if (B(this, _e, e), s.type !== void 0 ? B(this, yt, s.type) : s.every((r) => typeof r == "string" || r === null || r === void 0) ? B(this, yt, "character") : s.every((r) => Number.isInteger(r) || r === null || r === void 0) ? s.every((r) => r === 0 || r === 1 || r === null || r === void 0) ? B(this, yt, "logical") : B(this, yt, "integer") : s.every((r) => typeof r == "number" || r === null || r === void 0) ? B(this, yt, "double") : s.every((r) => typeof r == "boolean" || r === null || r === void 0) ? B(this, yt, "logical") : B(this, yt, "character"), B(this, Nt, n), i && i.length !== this.length)
62
+ if (G(this, pe, e), s.type !== void 0 ? G(this, xt, s.type) : s.every((r) => typeof r == "string" || r === null || r === void 0) ? G(this, xt, "character") : s.every((r) => Number.isInteger(r) || r === null || r === void 0) ? s.every((r) => r === 0 || r === 1 || r === null || r === void 0) ? G(this, xt, "logical") : G(this, xt, "integer") : s.every((r) => typeof r == "number" || r === null || r === void 0) ? G(this, xt, "double") : s.every((r) => typeof r == "boolean" || r === null || r === void 0) ? G(this, xt, "logical") : G(this, xt, "character"), G(this, zt, n), i && i.length !== this.length)
63
63
  throw new Error("Row names length must match the number of rows in the DataFrameColumn.");
64
- i && i.length > 0 ? B(this, Ut, i) : B(this, Ut, void 0);
64
+ i && i.length > 0 ? G(this, Vt, i) : G(this, Vt, void 0);
65
65
  }
66
66
  get name() {
67
- return k(this, _e);
67
+ return L(this, pe);
68
68
  }
69
69
  get type() {
70
- return k(this, yt);
70
+ return L(this, xt);
71
71
  }
72
72
  get rowNames() {
73
- return k(this, Ut);
73
+ return L(this, Vt);
74
74
  }
75
75
  row(e) {
76
- if (!k(this, Nt)) throw new Error("No parent DataFrame attached to this column.");
77
- return k(this, Nt).row(e);
76
+ if (!L(this, zt)) throw new Error("No parent DataFrame attached to this column.");
77
+ return L(this, zt).row(e);
78
78
  }
79
79
  rows(...e) {
80
- if (!k(this, Nt)) throw new Error("No parent DataFrame attached to this column.");
81
- return k(this, Nt).rows(...e);
80
+ if (!L(this, zt)) throw new Error("No parent DataFrame attached to this column.");
81
+ return L(this, zt).rows(...e);
82
82
  }
83
83
  };
84
- _e = new WeakMap(), yt = new WeakMap(), Ut = new WeakMap(), Nt = new WeakMap(), u(ss, "DataFrameColumn");
85
- let ye = ss;
86
- var Et, ct, ue;
87
- const Zt = class Zt extends Array {
84
+ pe = new WeakMap(), xt = new WeakMap(), Vt = new WeakMap(), zt = new WeakMap(), c(cs, "DataFrameColumn");
85
+ let Me = cs;
86
+ var It, ht, be;
87
+ const re = class re extends Array {
88
88
  constructor(e, s, i, n) {
89
89
  if ((!e || !s) && (s = [], e = []), s.map((r) => r.length).every((r) => r === e.length)) {
90
90
  const r = [];
@@ -97,37 +97,37 @@ const Zt = class Zt extends Array {
97
97
  s = r;
98
98
  }
99
99
  super(s.length);
100
- et(this, Et);
101
- et(this, ct);
102
- et(this, ue);
100
+ tt(this, It);
101
+ tt(this, ht);
102
+ tt(this, be);
103
103
  if (s.forEach((r, a) => {
104
- r instanceof ye ? this[a] = r : this[a] = new ye(e[a], r, i, this);
105
- }), B(this, Et, e), i && this[0] && i.length !== this[0].length)
104
+ r instanceof Me ? this[a] = r : this[a] = new Me(e[a], r, i, this);
105
+ }), G(this, It, e), i && this[0] && i.length !== this[0].length)
106
106
  throw new Error("Row names length must match the number of rows in the DataFrame.");
107
- if (i && i.length > 0 && B(this, ct, i), n && n.length !== this.length)
107
+ if (i && i.length > 0 && G(this, ht, i), n && n.length !== this.length)
108
108
  throw new Error("Classes length must match the number of columns in the DataFrame.");
109
- n && n.length > 0 && B(this, ue, n);
109
+ n && n.length > 0 && G(this, be, n);
110
110
  }
111
111
  get classes() {
112
- return k(this, ue);
112
+ return L(this, be);
113
113
  }
114
114
  getColumnByName(e) {
115
- const s = k(this, Et).indexOf(e);
115
+ const s = L(this, It).indexOf(e);
116
116
  return s >= 0 ? this[s] : void 0;
117
117
  }
118
118
  getRowByIndex(e) {
119
119
  if (this && this.length === 0)
120
- return console.warn("DataFrame is empty, cannot get row by index", e), new Ht(k(this, Et), [], void 0, this, e);
120
+ return console.warn("DataFrame is empty, cannot get row by index", e), new Jt(L(this, It), [], void 0, this, e);
121
121
  const s = [];
122
122
  for (let i of this) {
123
123
  let n = i[e];
124
124
  s.push(n);
125
125
  }
126
- return new Ht(k(this, Et), s, k(this, ct) ? k(this, ct)[e] : void 0, this, e);
126
+ return new Jt(L(this, It), s, L(this, ht) ? L(this, ht)[e] : void 0, this, e);
127
127
  }
128
128
  getRowByName(e) {
129
- if (!k(this, ct)) return;
130
- const s = k(this, ct).indexOf(e);
129
+ if (!L(this, ht)) return;
130
+ const s = L(this, ht).indexOf(e);
131
131
  if (s !== -1)
132
132
  return this.getRowByIndex(s);
133
133
  }
@@ -157,11 +157,11 @@ const Zt = class Zt extends Array {
157
157
  if (!this[0] || this.length === 0)
158
158
  return [];
159
159
  const r = this[0].length;
160
- i = Array.from({ length: r }, (a, h) => this.getRowByIndex(h)), n = k(this, ct);
160
+ i = Array.from({ length: r }, (a, h) => this.getRowByIndex(h)), n = L(this, ht);
161
161
  } else
162
162
  e.length === 1 && Array.isArray(e[0]) ? s = e[0] : s = e, i = s.map((r, a) => {
163
163
  let h = this.row(r);
164
- return k(this, ct) && h && (n == null || n.push(k(this, ct)[a])), h;
164
+ return L(this, ht) && h && (n == null || n.push(L(this, ht)[a])), h;
165
165
  }).filter((r) => r !== void 0);
166
166
  return i;
167
167
  }
@@ -173,21 +173,21 @@ const Zt = class Zt extends Array {
173
173
  }
174
174
  cols(...e) {
175
175
  let s, i, n = [];
176
- return e.length === 0 ? (i = this.slice(), n = k(this, Et)) : (e.length === 1 && Array.isArray(e[0]) ? s = e[0] : s = e, i = s.map((r) => this.col(r)).filter((r) => r !== void 0), n = i.map((r) => r.name)), new Zt(n, i, k(this, ct));
176
+ return e.length === 0 ? (i = this.slice(), n = L(this, It)) : (e.length === 1 && Array.isArray(e[0]) ? s = e[0] : s = e, i = s.map((r) => this.col(r)).filter((r) => r !== void 0), n = i.map((r) => r.name)), new re(n, i, L(this, ht));
177
177
  }
178
178
  subset(e, s) {
179
179
  const i = s && s.length > 0 ? this.cols(...s) : this.slice();
180
- return new Zt(
180
+ return new re(
181
181
  i.map((n) => n.name),
182
182
  i.map((n) => n.values),
183
- k(this, ct)
183
+ L(this, ht)
184
184
  );
185
185
  }
186
186
  get names() {
187
- return k(this, Et);
187
+ return L(this, It);
188
188
  }
189
189
  get rowNames() {
190
- return k(this, ct);
190
+ return L(this, ht);
191
191
  }
192
192
  get nrow() {
193
193
  return this[0] ? this[0].length : 0;
@@ -196,11 +196,11 @@ const Zt = class Zt extends Array {
196
196
  return this.length;
197
197
  }
198
198
  };
199
- Et = new WeakMap(), ct = new WeakMap(), ue = new WeakMap(), u(Zt, "DataFrame");
200
- let Yt = Zt;
201
- const is = class is {
199
+ It = new WeakMap(), ht = new WeakMap(), be = new WeakMap(), c(re, "DataFrame");
200
+ let Xt = re;
201
+ const _s = class _s {
202
202
  constructor(t = {}) {
203
- this.unit_id_col = "id", this.node_id_col = "id", this.group_col = null, this.directed = !1, this.palette = [], this._points = t.points ?? new Yt(), this._nodes = t.nodes ?? new Yt(), this._edges = t.edges ?? new Yt(), this._dimensions = t.dimensions ?? [], this._confidence = void 0, this._outlier = void 0, this._groups = void 0;
203
+ this.unit_id_col = "id", this.node_id_col = "id", this.group_col = null, this.directed = !1, this.palette = [], this._points = t.points ?? new Xt(), this._nodes = t.nodes ?? new Xt(), this._edges = t.edges ?? new Xt(), this._dimensions = t.dimensions ?? [], this._confidence = void 0, this._outlier = void 0, this._groups = void 0;
204
204
  }
205
205
  get updated() {
206
206
  return this._updated;
@@ -285,23 +285,23 @@ const is = class is {
285
285
  this[t] = e;
286
286
  }
287
287
  };
288
- u(is, "Model");
289
- let Xe = is;
290
- const ai = globalThis.__QEVIZ_DEBUG__ === !0;
291
- function Ys(...d) {
292
- ai && console.log(...d);
288
+ c(_s, "Model");
289
+ let ts = _s;
290
+ const yi = globalThis.__QEVIZ_DEBUG__ === !0;
291
+ function Qt(...g) {
292
+ yi && console.log(...g);
293
293
  }
294
- u(Ys, "dbg");
295
- const Pi = {
296
- get: /* @__PURE__ */ u((d) => {
294
+ c(Qt, "dbg");
295
+ const Wi = {
296
+ get: /* @__PURE__ */ c((g) => {
297
297
  const t = [...document.querySelectorAll("qe-graph")];
298
- return typeof d == "number" && d >= 0 ? t[d] : t;
298
+ return typeof g == "number" && g >= 0 ? t[g] : t;
299
299
  }, "get")
300
- }, zt = class zt extends HTMLElement {
300
+ }, Bt = class Bt extends HTMLElement {
301
301
  constructor() {
302
- super(), this._isVisible = !0, this.output = "", this._updated = "", this._active_points = [], this._points = /* @__PURE__ */ new Map(), this._edges = /* @__PURE__ */ new Map(), this._labels = /* @__PURE__ */ new Map(), this._model = new Xe();
302
+ super(), this._isVisible = !0, this.output = "", this._updated = "", this._active_points = [], this._points = /* @__PURE__ */ new Map(), this._edges = /* @__PURE__ */ new Map(), this._labels = /* @__PURE__ */ new Map(), this._model = new ts();
303
303
  const t = this.attachShadow({ mode: "open" }), e = document.createElement("style");
304
- e.textContent = zt.styles, t.appendChild(e), this._outputElement = document.createElement("div"), t.appendChild(this._outputElement);
304
+ e.textContent = Bt.styles, t.appendChild(e), this._outputElement = document.createElement("div"), t.appendChild(this._outputElement);
305
305
  }
306
306
  static get observedAttributes() {
307
307
  return ["updated"];
@@ -339,7 +339,7 @@ const Pi = {
339
339
  return this._labels;
340
340
  }
341
341
  connectedCallback() {
342
- Ys("QEVisualElement connected"), this.render();
342
+ Qt("QEVisualElement connected"), this.render();
343
343
  }
344
344
  /**
345
345
  * Accept pre-fetched ENA model data and update the visualization.
@@ -348,44 +348,44 @@ const Pi = {
348
348
  */
349
349
  setModelData(t) {
350
350
  var r, a, h, o;
351
- ["nodes", "edges", "points", "groups", "confidence", "outlier", "trajectories", "networks", "pointsets"].forEach((l) => {
352
- var v;
353
- const _ = t[l];
354
- if (!((v = _ == null ? void 0 : _.data) != null && v.length)) return;
355
- const g = _.data, c = _.types || {}, E = Object.keys(g[0]), m = g.map((F) => Object.values(F)), S = E.map((F) => c[F] ?? "character");
356
- let R;
357
- l === "networks" ? R = "name" : l === "pointsets" ? R = "id" : l === "nodes" ? R = t.node_id_col ?? E.find((F) => (c[F] ?? "character") === "character") : l === "edges" || l === "points" || l === "trajectories" ? R = t.id_col ?? E.find((F) => (c[F] ?? "character") === "character") : R = t.group_col ?? E.find((F) => (c[F] ?? "character") === "character");
358
- const j = R ? E.indexOf(R) : 0, Y = m.map((F) => String(F[j]));
359
- this._model.setByKey(l, new Yt(E, m, Y, S));
351
+ ["nodes", "edges", "points", "groups", "confidence", "outlier", "trajectories", "networks", "pointsets"].forEach((_) => {
352
+ var z;
353
+ const m = t[_];
354
+ if (!((z = m == null ? void 0 : m.data) != null && z.length)) return;
355
+ const p = m.data, u = m.types || {}, d = Object.keys(p[0]), l = p.map((D) => Object.values(D)), b = d.map((D) => u[D] ?? "character");
356
+ let f;
357
+ _ === "networks" ? f = "name" : _ === "pointsets" ? f = "id" : _ === "nodes" ? f = t.node_id_col ?? d.find((D) => (u[D] ?? "character") === "character") : _ === "edges" || _ === "points" || _ === "trajectories" ? f = t.id_col ?? d.find((D) => (u[D] ?? "character") === "character") : f = t.group_col ?? d.find((D) => (u[D] ?? "character") === "character");
358
+ const w = f ? d.indexOf(f) : 0, $ = l.map((D) => String(D[w]));
359
+ this._model.setByKey(_, new Xt(d, l, $, b));
360
360
  }), t.updated !== void 0 && this._model.setByKey("updated", t.updated), t.directed !== void 0 && (this._model.directed = t.directed), Array.isArray(t.palette) && (this._model.palette = t.palette.map(String));
361
361
  const s = this._model.nodes;
362
- this._model.node_id_col = t.node_id_col ?? ((r = s == null ? void 0 : s.names) == null ? void 0 : r.find((l) => {
363
- var _;
364
- return ((_ = s.col(l)) == null ? void 0 : _.type) === "character";
362
+ this._model.node_id_col = t.node_id_col ?? ((r = s == null ? void 0 : s.names) == null ? void 0 : r.find((_) => {
363
+ var m;
364
+ return ((m = s.col(_)) == null ? void 0 : m.type) === "character";
365
365
  })) ?? "id";
366
366
  const i = this._model.points;
367
- this._model.unit_id_col = t.id_col ?? ((a = i == null ? void 0 : i.names) == null ? void 0 : a.find((l) => {
368
- var _;
369
- return ((_ = i.col(l)) == null ? void 0 : _.type) === "character";
367
+ this._model.unit_id_col = t.id_col ?? ((a = i == null ? void 0 : i.names) == null ? void 0 : a.find((_) => {
368
+ var m;
369
+ return ((m = i.col(_)) == null ? void 0 : m.type) === "character";
370
370
  })) ?? "id";
371
371
  const n = this._model.unit_id_col;
372
- if (this._model.group_col = t.group_col ?? ((h = i == null ? void 0 : i.names) == null ? void 0 : h.find((l) => {
373
- var _;
374
- return l !== n && ((_ = i.col(l)) == null ? void 0 : _.type) === "character";
372
+ if (this._model.group_col = t.group_col ?? ((h = i == null ? void 0 : i.names) == null ? void 0 : h.find((_) => {
373
+ var m;
374
+ return _ !== n && ((m = i.col(_)) == null ? void 0 : m.type) === "character";
375
375
  })) ?? null, (o = s == null ? void 0 : s.names) != null && o.length) {
376
- const l = this._model.node_id_col, _ = t.x_col, g = t.y_col;
377
- if (_ && g)
378
- this._model.dimensions = [_, g];
376
+ const _ = this._model.node_id_col, m = t.x_col, p = t.y_col;
377
+ if (m && p)
378
+ this._model.dimensions = [m, p];
379
379
  else {
380
- const c = s.names.filter((E) => {
381
- if (E === l) return !1;
382
- const m = s.col(E);
383
- return m && m.type !== "character" && m.type !== "logical";
380
+ const u = s.names.filter((d) => {
381
+ if (d === _) return !1;
382
+ const l = s.col(d);
383
+ return l && l.type !== "character" && l.type !== "logical";
384
384
  });
385
- c.length >= 2 && (this._model.dimensions = [_ ?? c[0], g ?? c[1]]);
385
+ u.length >= 2 && (this._model.dimensions = [m ?? u[0], p ?? u[1]]);
386
386
  }
387
387
  }
388
- this.updated = this._model.updated !== void 0 ? String(this._model.updated) : String(Date.now()), Ys("Model updated via setModelData:", this.updated), this.render();
388
+ this.updated = this._model.updated !== void 0 ? String(this._model.updated) : String(Date.now()), Qt("Model updated via setModelData:", this.updated), this.render();
389
389
  }
390
390
  /**
391
391
  * Base implementation is a no-op. Subclasses (e.g. RQEVisualElement) override
@@ -398,7 +398,7 @@ const Pi = {
398
398
  this._isVisible ? this.classList.remove("hidden") : this.classList.add("hidden"), ((t = this._model) == null ? void 0 : t.updated) !== void 0 && this._model.updated !== null ? this._outputElement.innerHTML = `${this.output}<slot></slot>` : this._outputElement.innerHTML = "Define the model on the left.";
399
399
  }
400
400
  };
401
- u(zt, "QEVisualElement"), zt.tagName = "qe-visual", zt.styles = `
401
+ c(Bt, "QEVisualElement"), Bt.tagName = "qe-visual", Bt.styles = `
402
402
  :host { display: block; width: 100%; }
403
403
  :host(.hidden) { display: none !important; }
404
404
  /* The output wrapper and the slotted graph fill the host so the plot
@@ -406,8 +406,8 @@ u(zt, "QEVisualElement"), zt.tagName = "qe-visual", zt.styles = `
406
406
  div { display: block; width: 100%; height: 100%; }
407
407
  ::slotted(qe-graph) { display: block; width: 100%; height: 100%; }
408
408
  `;
409
- let xe = zt;
410
- customElements.define(xe.tagName, xe);
409
+ let Ie = Bt;
410
+ customElements.define(Ie.tagName, Ie);
411
411
  const dt = class dt {
412
412
  constructor(t) {
413
413
  return this.base = typeof t == "string" ? t : t.base, new Proxy(this, {
@@ -461,34 +461,34 @@ const dt = class dt {
461
461
  return `rgb(${t}, ${e}, ${s})`;
462
462
  }
463
463
  };
464
- u(dt, "Color"), dt._cssCache = /* @__PURE__ */ new Map();
464
+ c(dt, "Color"), dt._cssCache = /* @__PURE__ */ new Map();
465
465
  let st = dt;
466
- const Qt = class Qt extends st {
466
+ const oe = class oe extends st {
467
467
  constructor(t, e, s) {
468
468
  super(t), this.weight = e, this.alpha = s;
469
469
  }
470
470
  // Parse hex → HSV (h in [0, 360), s/v in [0, 1]).
471
471
  static toHSV(t) {
472
- const { r: e, g: s, b: i } = st.parseColor(t), n = e / 255, r = s / 255, a = i / 255, h = Math.max(n, r, a), o = Math.min(n, r, a), l = h - o, _ = h, g = h === 0 ? 0 : l / h;
473
- let c = 0;
474
- if (l > 0)
472
+ const { r: e, g: s, b: i } = st.parseColor(t), n = e / 255, r = s / 255, a = i / 255, h = Math.max(n, r, a), o = Math.min(n, r, a), _ = h - o, m = h, p = h === 0 ? 0 : _ / h;
473
+ let u = 0;
474
+ if (_ > 0)
475
475
  switch (h) {
476
476
  case n:
477
- c = ((r - a) / l + (r < a ? 6 : 0)) / 6;
477
+ u = ((r - a) / _ + (r < a ? 6 : 0)) / 6;
478
478
  break;
479
479
  case r:
480
- c = ((a - n) / l + 2) / 6;
480
+ u = ((a - n) / _ + 2) / 6;
481
481
  break;
482
482
  default:
483
- c = ((n - r) / l + 4) / 6;
483
+ u = ((n - r) / _ + 4) / 6;
484
484
  }
485
- return { h: c * 360, s: g, v: _ };
485
+ return { h: u * 360, s: p, v: m };
486
486
  }
487
487
  // Convert HSV + alpha → rgba() CSS string.
488
488
  static hsvToRgba(t, e, s, i) {
489
489
  const n = s * e, r = n * (1 - Math.abs(t / 60 % 2 - 1)), a = s - n;
490
- let h = 0, o = 0, l = 0;
491
- return t < 60 ? (h = n, o = r, l = 0) : t < 120 ? (h = r, o = n, l = 0) : t < 180 ? (h = 0, o = n, l = r) : t < 240 ? (h = 0, o = r, l = n) : t < 300 ? (h = r, o = 0, l = n) : (h = n, o = 0, l = r), `rgba(${Math.round((h + a) * 255)},${Math.round((o + a) * 255)},${Math.round((l + a) * 255)},${i.toFixed(4)})`;
490
+ let h = 0, o = 0, _ = 0;
491
+ return t < 60 ? (h = n, o = r, _ = 0) : t < 120 ? (h = r, o = n, _ = 0) : t < 180 ? (h = 0, o = n, _ = r) : t < 240 ? (h = 0, o = r, _ = n) : t < 300 ? (h = r, o = 0, _ = n) : (h = n, o = 0, _ = r), `rgba(${Math.round((h + a) * 255)},${Math.round((o + a) * 255)},${Math.round((_ + a) * 255)},${i.toFixed(4)})`;
492
492
  }
493
493
  // Returns rgba(...) matching rENA's edge-color convention (ena.plot.network):
494
494
  // • hue and value (brightness) are preserved from the base color
@@ -501,13 +501,13 @@ const Qt = class Qt extends st {
501
501
  // #EE6677 have HSL lightness ≈ 67%, so 100% HSL saturation still looks
502
502
  // washed-out, whereas HSV value ≈ 0.93 gives the expected vivid output.
503
503
  toString() {
504
- const { h: t, v: e } = Qt.toHSV(this.base), s = Math.min(1, Math.abs(this.weight)), i = this.alpha === void 0 ? s : Math.min(1, Math.max(0, this.alpha));
505
- return Qt.hsvToRgba(t, s, e, i);
504
+ const { h: t, v: e } = oe.toHSV(this.base), s = Math.min(1, Math.abs(this.weight)), i = this.alpha === void 0 ? s : Math.min(1, Math.max(0, this.alpha));
505
+ return oe.hsvToRgba(t, s, e, i);
506
506
  }
507
507
  };
508
- u(Qt, "WeightedColor");
509
- let we = Qt;
510
- const ns = class ns {
508
+ c(oe, "WeightedColor");
509
+ let Ne = oe;
510
+ const us = class us {
511
511
  constructor(t = null) {
512
512
  this._values = [1, 0, 0, 1, 0, 0], this._keys = ["a", "b", "c", "d", "e", "f"], t && (this.values = t);
513
513
  }
@@ -532,8 +532,11 @@ const ns = class ns {
532
532
  toArray() {
533
533
  return this._values;
534
534
  }
535
+ /** Set one matrix entry. Any finite number is accepted (0 resets a pan);
536
+ * NaN / ±Infinity are ignored so a bad input can't blank the plot. */
535
537
  set(t, e) {
536
- e !== 75e-4 && e !== 0 && (this._values[this._keys.findIndex((s) => s === t)] = e);
538
+ const s = this._keys.indexOf(t);
539
+ s >= 0 && Number.isFinite(e) && (this._values[s] = e);
537
540
  }
538
541
  get(t) {
539
542
  return this._values[this._keys.findIndex((e) => e === t)];
@@ -584,148 +587,148 @@ const ns = class ns {
584
587
  return this.get("f");
585
588
  }
586
589
  };
587
- u(ns, "Transform");
588
- let se = ns;
589
- var ie;
590
- ((d) => {
590
+ c(us, "Transform");
591
+ let le = us;
592
+ var ce;
593
+ ((g) => {
591
594
  ((t) => {
592
595
  function e(s) {
593
596
  return `matrix(${["a", "b", "c", "d", "e", "f"].map((n) => s[n]).join(" ")})`;
594
597
  }
595
- u(e, "matrixString"), t.matrixString = e;
596
- })(d.Matrix || (d.Matrix = {})), ((t) => {
598
+ c(e, "matrixString"), t.matrixString = e;
599
+ })(g.Matrix || (g.Matrix = {})), ((t) => {
597
600
  ((s) => {
598
601
  function i(r, a, h) {
599
602
  const o = e.toRad(a);
600
603
  return [r[0] + h * Math.cos(o), r[1] + h * Math.sin(o)];
601
604
  }
602
- u(i, "translate"), s.translate = i;
605
+ c(i, "translate"), s.translate = i;
603
606
  function n(r, a, h) {
604
607
  const o = e.toRad(a);
605
- function l(_, g) {
608
+ function _(m, p) {
606
609
  return [
607
- _[0] * Math.cos(g) - _[1] * Math.sin(g),
608
- _[0] * Math.sin(g) + _[1] * Math.cos(g)
610
+ m[0] * Math.cos(p) - m[1] * Math.sin(p),
611
+ m[0] * Math.sin(p) + m[1] * Math.cos(p)
609
612
  ];
610
613
  }
611
- if (u(l, "rotatePoint"), !h || h[0] === 0 && h[1] === 0)
612
- return l(r, o);
614
+ if (c(_, "rotatePoint"), !h || h[0] === 0 && h[1] === 0)
615
+ return _(r, o);
613
616
  {
614
- const _ = r.map((c, E) => c - h[E]);
615
- return l(_, o).map((c, E) => c + h[E]);
617
+ const m = r.map((u, d) => u - h[d]);
618
+ return _(m, o).map((u, d) => u + h[d]);
616
619
  }
617
620
  }
618
- u(n, "rotate"), s.rotate = n;
621
+ c(n, "rotate"), s.rotate = n;
619
622
  })(t.Point || (t.Point = {})), ((s) => {
620
- function i(m, S) {
621
- return (S[1] - m[1]) / (S[0] - m[0]);
623
+ function i(l, b) {
624
+ return (b[1] - l[1]) / (b[0] - l[0]);
622
625
  }
623
- u(i, "slope"), s.slope = i;
624
- function n(m, S) {
625
- const R = i(m, S);
626
- return m[1] - R * m[0];
626
+ c(i, "slope"), s.slope = i;
627
+ function n(l, b) {
628
+ const f = i(l, b);
629
+ return l[1] - f * l[0];
627
630
  }
628
- u(n, "intercept"), s.intercept = n;
629
- function r(m, S) {
631
+ c(n, "intercept"), s.intercept = n;
632
+ function r(l, b) {
630
633
  return {
631
- slope: i(m, S),
632
- intercept: n(m, S)
634
+ slope: i(l, b),
635
+ intercept: n(l, b)
633
636
  };
634
637
  }
635
- u(r, "slopeIntercept"), s.slopeIntercept = r;
636
- function a(m, S = 0) {
637
- const R = S, j = (1 - R) * m[0][0] + R * m[1][0], Y = (1 - R) * m[0][1] + R * m[1][1];
638
- return [j, Y];
638
+ c(r, "slopeIntercept"), s.slopeIntercept = r;
639
+ function a(l, b = 0) {
640
+ const f = b, w = (1 - f) * l[0][0] + f * l[1][0], $ = (1 - f) * l[0][1] + f * l[1][1];
641
+ return [w, $];
639
642
  }
640
- u(a, "point_along"), s.point_along = a;
641
- function h(m, S, R = 0.5) {
642
- return Array.isArray(m[0]) && (S = m[1], m = m[0]), [0, 1].map((j) => (parseFloat(m[j]) + parseFloat(S[j])) * R);
643
+ c(a, "point_along"), s.point_along = a;
644
+ function h(l, b, f = 0.5) {
645
+ return Array.isArray(l[0]) && (b = l[1], l = l[0]), [0, 1].map((w) => (parseFloat(l[w]) + parseFloat(b[w])) * f);
643
646
  }
644
- u(h, "midpoint"), s.midpoint = h;
645
- function o(m, S) {
646
- return Array.isArray(m[0]) && (S = m[1], m = m[0]), Math.sqrt(
647
- [0, 1].map((R) => Math.pow(S[R] - m[R], 2)).reduce((R, j) => R + j, 0)
647
+ c(h, "midpoint"), s.midpoint = h;
648
+ function o(l, b) {
649
+ return Array.isArray(l[0]) && (b = l[1], l = l[0]), Math.sqrt(
650
+ [0, 1].map((f) => Math.pow(b[f] - l[f], 2)).reduce((f, w) => f + w, 0)
648
651
  );
649
652
  }
650
- u(o, "length"), s.length = o;
651
- function l(m, S = [0, 0]) {
652
- const R = [
653
- m[1][0] - S[0],
654
- m[1][1] - S[1]
655
- ], j = [
656
- -R[1],
657
- R[0]
658
- ], Y = [
659
- -j[0],
660
- -j[1]
661
- ], v = [
662
- j[0] + S[0],
663
- j[1] + S[1]
664
- ], F = [
665
- Y[0] + S[0],
666
- Y[1] + S[1]
653
+ c(o, "length"), s.length = o;
654
+ function _(l, b = [0, 0]) {
655
+ const f = [
656
+ l[1][0] - b[0],
657
+ l[1][1] - b[1]
658
+ ], w = [
659
+ -f[1],
660
+ f[0]
661
+ ], $ = [
662
+ -w[0],
663
+ -w[1]
664
+ ], z = [
665
+ w[0] + b[0],
666
+ w[1] + b[1]
667
+ ], D = [
668
+ $[0] + b[0],
669
+ $[1] + b[1]
667
670
  ];
668
- return [v, F];
671
+ return [z, D];
669
672
  }
670
- u(l, "rotate"), s.rotate = l;
671
- function _(m, S, R = 90) {
672
- const j = d.Geometry.Line.slope(m[0], m[1]), Y = d.Geometry.Line.intercept(m[0], m[1]), v = [0, Y], F = [1, j + Y];
673
- m = [v, F];
674
- const nt = [m[0][0], m[1][0]], ot = [m[0][1], m[1][1]], it = S[0], _t = S[1], K = -2 * Math.PI * R / 360, It = nt.map(
675
- (ge, ut) => (ge - it) * Math.cos(K) - (ot[ut] - _t) * Math.sin(K) + it
676
- ), Ot = ot.map(
677
- (ge, ut) => (nt[ut] - it) * Math.sin(K) - (ge - _t) * Math.cos(K) + _t
673
+ c(_, "rotate"), s.rotate = _;
674
+ function m(l, b, f = 90) {
675
+ const w = g.Geometry.Line.slope(l[0], l[1]), $ = g.Geometry.Line.intercept(l[0], l[1]), z = [0, $], D = [1, w + $];
676
+ l = [z, D];
677
+ const lt = [l[0][0], l[1][0]], ct = [l[0][1], l[1][1]], J = b[0], _t = b[1], Z = -2 * Math.PI * f / 360, kt = lt.map(
678
+ (Lt, vt) => (Lt - J) * Math.cos(Z) - (ct[vt] - _t) * Math.sin(Z) + J
679
+ ), Qe = ct.map(
680
+ (Lt, vt) => (lt[vt] - J) * Math.sin(Z) - (Lt - _t) * Math.cos(Z) + _t
678
681
  );
679
682
  return [
680
- [It[0], Ot[0]],
681
- [It[1], Ot[1]]
683
+ [kt[0], Qe[0]],
684
+ [kt[1], Qe[1]]
682
685
  ];
683
686
  }
684
- u(_, "rotate2"), s.rotate2 = _;
685
- function g(m, S) {
686
- const [[R, j], [Y, v]] = m, [[F, nt], [ot, it]] = S, _t = (R - Y) * (nt - it) - (j - v) * (F - ot), K = (R * v - j * Y) * (F - ot) - (R - Y) * (F * it - nt * ot), It = (R * v - j * Y) * (nt - it) - (j - v) * (F * it - nt * ot);
687
- return [K / _t, It / _t];
687
+ c(m, "rotate2"), s.rotate2 = m;
688
+ function p(l, b) {
689
+ const [[f, w], [$, z]] = l, [[D, lt], [ct, J]] = b, _t = (f - $) * (lt - J) - (w - z) * (D - ct), Z = (f * z - w * $) * (D - ct) - (f - $) * (D * J - lt * ct), kt = (f * z - w * $) * (lt - J) - (w - z) * (D * J - lt * ct);
690
+ return [Z / _t, kt / _t];
688
691
  }
689
- u(g, "intersection"), s.intersection = g;
690
- function c(m, S, R) {
691
- let { slope: j, intercept: Y } = d.Geometry.Line.slopeIntercept(m[0], m[1]), v = 1 + Math.pow(j, 2), F = 2 * j * Y - 2 * S[1] * j - 2 * S[0], nt = Math.pow(S[0], 2) + Math.pow(Y, 2) + Math.pow(S[1], 2) - 2 * S[1] * Y - Math.pow(R, 2), ot = [[1 / 0, 1 / 0], [1 / 0, 1 / 0]];
692
- if (Math.sqrt(Math.pow(F, 2) - 4 * v * nt) >= 0) {
693
- let it = (-F + Math.sqrt(Math.pow(F, 2) - 4 * v * nt)) / (2 * v), _t = (-F - Math.sqrt(Math.pow(F, 2) - 4 * v * nt)) / (2 * v), K = j * it + Y, It = j * _t + Y;
694
- ot = [[it, K], [_t, It]];
692
+ c(p, "intersection"), s.intersection = p;
693
+ function u(l, b, f) {
694
+ let { slope: w, intercept: $ } = g.Geometry.Line.slopeIntercept(l[0], l[1]), z = 1 + Math.pow(w, 2), D = 2 * w * $ - 2 * b[1] * w - 2 * b[0], lt = Math.pow(b[0], 2) + Math.pow($, 2) + Math.pow(b[1], 2) - 2 * b[1] * $ - Math.pow(f, 2), ct = [[1 / 0, 1 / 0], [1 / 0, 1 / 0]];
695
+ if (Math.sqrt(Math.pow(D, 2) - 4 * z * lt) >= 0) {
696
+ let J = (-D + Math.sqrt(Math.pow(D, 2) - 4 * z * lt)) / (2 * z), _t = (-D - Math.sqrt(Math.pow(D, 2) - 4 * z * lt)) / (2 * z), Z = w * J + $, kt = w * _t + $;
697
+ ct = [[J, Z], [_t, kt]];
695
698
  } else
696
699
  console.error("The line and the circumference do not intersect");
697
- return ot;
700
+ return ct;
698
701
  }
699
- u(c, "intersect_circle"), s.intersect_circle = c;
700
- function E(m) {
701
- return (S) => S === 0 ? m[0] : S === 1 ? m[1] : d.Geometry.Point.translate(m[0], d.Geometry.Angle.line(m), d.Geometry.Line.length(m) * S);
702
+ c(u, "intersect_circle"), s.intersect_circle = u;
703
+ function d(l) {
704
+ return (b) => b === 0 ? l[0] : b === 1 ? l[1] : g.Geometry.Point.translate(l[0], g.Geometry.Angle.line(l), g.Geometry.Line.length(l) * b);
702
705
  }
703
- u(E, "interpolate"), s.interpolate = E;
706
+ c(d, "interpolate"), s.interpolate = d;
704
707
  })(t.Line || (t.Line = {}));
705
708
  let e;
706
709
  ((s) => {
707
710
  function i(a) {
708
711
  return a / 180 * Math.PI;
709
712
  }
710
- u(i, "toRad"), s.toRad = i;
713
+ c(i, "toRad"), s.toRad = i;
711
714
  function n(a) {
712
715
  return a * 180 / Math.PI;
713
716
  }
714
- u(n, "toDeg"), s.toDeg = n;
717
+ c(n, "toDeg"), s.toDeg = n;
715
718
  function r(a) {
716
719
  if (a.length !== 2 || !Array.isArray(a[0]) || !Array.isArray(a[1]) || a[0].length !== 2 || a[1].length !== 2)
717
720
  throw new Error("Invalid line format. Expected [[x1, y1], [x2, y2]].");
718
- return d.Geometry.Angle.toDeg(
721
+ return g.Geometry.Angle.toDeg(
719
722
  Math.atan2(a[1][1] - a[0][1], a[1][0] - a[0][0])
720
723
  );
721
724
  }
722
- u(r, "line"), s.line = r;
725
+ c(r, "line"), s.line = r;
723
726
  })(e = t.Angle || (t.Angle = {}));
724
- })(d.Geometry || (d.Geometry = {})), ((t) => {
727
+ })(g.Geometry || (g.Geometry = {})), ((t) => {
725
728
  function e(n) {
726
729
  return [...new Set(n)];
727
730
  }
728
- u(e, "unique"), t.unique = e;
731
+ c(e, "unique"), t.unique = e;
729
732
  function s(n, r) {
730
733
  if (Array.isArray(n)) {
731
734
  if (Array.isArray(r)) {
@@ -736,26 +739,26 @@ var ie;
736
739
  }
737
740
  return n / r;
738
741
  }
739
- u(s, "divide"), t.divide = s;
742
+ c(s, "divide"), t.divide = s;
740
743
  function i(n) {
741
744
  return typeof Array.isArray == "function" ? Array.isArray(n) : n && typeof n == "object" && n.constructor.name === "Array";
742
745
  }
743
- u(i, "isArray"), t.isArray = i;
744
- })(d.ArrayTools || (d.ArrayTools = {})), ((t) => {
746
+ c(i, "isArray"), t.isArray = i;
747
+ })(g.ArrayTools || (g.ArrayTools = {})), ((t) => {
745
748
  function e(n) {
746
749
  return n.reduce((r, a) => r + a, 0);
747
750
  }
748
- u(e, "sum"), t.sum = e;
751
+ c(e, "sum"), t.sum = e;
749
752
  function s(n) {
750
753
  return e(n) / n.length;
751
754
  }
752
- u(s, "mean"), t.mean = s;
755
+ c(s, "mean"), t.mean = s;
753
756
  function i(n, r) {
754
757
  const a = Math.pow(10, r);
755
758
  return Math.round(n * a) / a;
756
759
  }
757
- u(i, "round"), t.round = i;
758
- })(d.Mathematics || (d.Mathematics = {})), ((t) => {
760
+ c(i, "round"), t.round = i;
761
+ })(g.Mathematics || (g.Mathematics = {})), ((t) => {
759
762
  function e(s, i, n) {
760
763
  return new CustomEvent(s, {
761
764
  bubbles: !0,
@@ -766,17 +769,17 @@ var ie;
766
769
  }
767
770
  });
768
771
  }
769
- u(e, "createEvent"), t.createEvent = e;
770
- })(d.Events || (d.Events = {})), ((t) => {
772
+ c(e, "createEvent"), t.createEvent = e;
773
+ })(g.Events || (g.Events = {})), ((t) => {
771
774
  function e() {
772
775
  return location.hash.replace(/#/, "").split(/\//).filter((i) => i).map((i) => i.split(/:/));
773
776
  }
774
- u(e, "parts"), t.parts = e;
777
+ c(e, "parts"), t.parts = e;
775
778
  function s(i) {
776
779
  return e().flat().findIndex((n) => n === i) >= 0;
777
780
  }
778
- u(s, "exists"), t.exists = s;
779
- })(d.Hash || (d.Hash = {})), ((t) => {
781
+ c(s, "exists"), t.exists = s;
782
+ })(g.Hash || (g.Hash = {})), ((t) => {
780
783
  function e(n, r, a = !1) {
781
784
  if (a) {
782
785
  if (typeof n != "object" || n === null)
@@ -787,10 +790,10 @@ var ie;
787
790
  } else
788
791
  return new Proxy(n, r);
789
792
  }
790
- u(e, "proxy"), t.proxy = e, t.handler = {
793
+ c(e, "proxy"), t.proxy = e, t.handler = {
791
794
  set(n, r, a) {
792
795
  return n[r] = a, window.dispatchEvent(
793
- d.Events.createEvent("settingUpdate", window, { target: n, property: r, value: a })
796
+ g.Events.createEvent("settingUpdate", window, { target: n, property: r, value: a })
794
797
  ), !0;
795
798
  },
796
799
  get(n, r) {
@@ -807,43 +810,43 @@ var ie;
807
810
  return;
808
811
  return h;
809
812
  }
810
- u(s, "get"), t.get = s;
813
+ c(s, "get"), t.get = s;
811
814
  function i(n, r, a) {
812
815
  const h = r.split(".");
813
- let o = n, l;
814
- for (l = 0; l < h.length - 1; l++) {
815
- const _ = h[l];
816
+ let o = n, _;
817
+ for (_ = 0; _ < h.length - 1; _++) {
818
+ const m = h[_];
816
819
  if (o && typeof o == "object")
817
- Object.prototype.hasOwnProperty.call(o, _) || (o[_] = {}), o = o[_];
820
+ Object.prototype.hasOwnProperty.call(o, m) || (o[m] = {}), o = o[m];
818
821
  else
819
822
  return !1;
820
823
  }
821
- return o && typeof o == "object" ? (o[h[l]] = a, !0) : !1;
824
+ return o && typeof o == "object" ? (o[h[_]] = a, !0) : !1;
822
825
  }
823
- u(i, "set"), t.set = i;
824
- })(d.Objects || (d.Objects = {})), ((t) => {
826
+ c(i, "set"), t.set = i;
827
+ })(g.Objects || (g.Objects = {})), ((t) => {
825
828
  function e(s = window.location) {
826
829
  return Object.fromEntries(new URLSearchParams(s.search));
827
830
  }
828
- u(e, "parse"), t.parse = e, ((s) => {
831
+ c(e, "parse"), t.parse = e, ((s) => {
829
832
  function i(a = window.location.search) {
830
833
  return Object.fromEntries(
831
834
  a.replace(/^\?/, "").split(/&/).map((h) => h.split(/=/))
832
835
  );
833
836
  }
834
- u(i, "parse2"), s.parse = i;
837
+ c(i, "parse2"), s.parse = i;
835
838
  function n(a = window.location.search) {
836
839
  return a.replace(/^\?/, "").split(/&/).map((h) => h.split(/=/)[0]);
837
840
  }
838
- u(n, "keys"), s.keys = n;
841
+ c(n, "keys"), s.keys = n;
839
842
  function r(a, h = window.location.search) {
840
843
  return n(h).findIndex((o) => o === a) >= 0;
841
844
  }
842
- u(r, "has"), s.has = r;
845
+ c(r, "has"), s.has = r;
843
846
  })(t.Query || (t.Query = {}));
844
- })(d.URL || (d.URL = {}));
845
- })(ie || (ie = {}));
846
- const rs = class rs {
847
+ })(g.URL || (g.URL = {}));
848
+ })(ce || (ce = {}));
849
+ const ds = class ds {
847
850
  constructor() {
848
851
  this._state = /* @__PURE__ */ new Map(), this.listeners = /* @__PURE__ */ new Map();
849
852
  }
@@ -882,9 +885,9 @@ const rs = class rs {
882
885
  });
883
886
  }
884
887
  };
885
- u(rs, "EventBus");
886
- let Ae = rs;
887
- const { ArrayTools: qs } = ie, te = class te extends Array {
888
+ c(ds, "EventBus");
889
+ let ke = ds;
890
+ const { ArrayTools: Qs } = ce, ae = class ae extends Array {
888
891
  constructor(...t) {
889
892
  super(...t);
890
893
  }
@@ -893,46 +896,46 @@ const { ArrayTools: qs } = ie, te = class te extends Array {
893
896
  function i(r) {
894
897
  return r.name === e ? r : void 0;
895
898
  }
896
- u(i, "fn");
899
+ c(i, "fn");
897
900
  function n(r, a, h = null) {
898
- if (qs.isArray(r)) {
899
- for (const [o, l] of r.entries())
900
- if (s = n(l, o, h), s)
901
+ if (Qs.isArray(r)) {
902
+ for (const [o, _] of r.entries())
903
+ if (s = n(_, o, h), s)
901
904
  return s;
902
905
  } else {
903
906
  if (s = i(r), s)
904
907
  return s;
905
- if (r && qs.isArray(r[t])) {
906
- for (const [o, l] of r[t].entries())
907
- if (s = n(l, o, r), s)
908
+ if (r && Qs.isArray(r[t])) {
909
+ for (const [o, _] of r[t].entries())
910
+ if (s = n(_, o, r), s)
908
911
  return s;
909
912
  }
910
913
  }
911
914
  return s;
912
915
  }
913
- return u(n, "recurse"), n(this);
916
+ return c(n, "recurse"), n(this);
914
917
  }
915
918
  flatten() {
916
919
  return this.reduce((t, e) => (t.push(e), e.layers && Array.isArray(e.layers) && t.push(...e.layers), t), []);
917
920
  }
918
921
  recurse(t, e, s = null, i = 0) {
919
- let n = new te();
922
+ let n = new ae();
920
923
  for (const r of this) {
921
924
  let a = e(r, s, i);
922
925
  if (r[t] && Array.isArray(r[t])) {
923
- let h = new te(...r[t]).recurse(t, e, r, i + 1);
926
+ let h = new ae(...r[t]).recurse(t, e, r, i + 1);
924
927
  h !== void 0 && n.push(...h);
925
928
  }
926
929
  n.push(a);
927
930
  }
928
- return console.log("Recurse results: ", n), n;
931
+ return Qt("Recurse results: ", n), n;
929
932
  }
930
933
  };
931
- u(te, "LayerArray");
932
- let qt = te;
933
- const os = class os {
934
+ c(ae, "LayerArray");
935
+ let Wt = ae;
936
+ const gs = class gs {
934
937
  constructor(t, e, s) {
935
- this.__state__ = new Ae(), this.scale_x = 1, this.scale_y = 1, this.scale_objects = !0, this.layers = new qt(), this.objects = /* @__PURE__ */ new Map(), this.visible = !0, this.ID = t, this.name = e.name || `layer-${t}`, this.tabindex = e.tabindex, this.parent = s, this._transform = new se(), s == null || s.__state__.addListener("graph_updated", "live", ({ key: i, newValue: n, oldValue: r }) => {
938
+ this.__state__ = new ke(), this.scale_x = 1, this.scale_y = 1, this.scale_objects = !0, this.layers = new Wt(), this.objects = /* @__PURE__ */ new Map(), this.visible = !0, this.ID = t, this.name = e.name || `layer-${t}`, this.tabindex = e.tabindex, this.parent = s, this._transform = new le(), s == null || s.__state__.addListener("graph_updated", "live", ({ key: i, newValue: n, oldValue: r }) => {
936
939
  }), s == null || s.__state__.addListener(`graph_updated_${this.name}`, "live", ({ key: i, newValue: n, oldValue: r }) => {
937
940
  this.objects = n, this.__state__.setVariable("layer_updated", this);
938
941
  });
@@ -944,45 +947,45 @@ const os = class os {
944
947
  this._transform = t;
945
948
  }
946
949
  };
947
- u(os, "Layer");
948
- let We = os;
949
- var Lt, Mt;
950
- const Le = class Le extends Array {
950
+ c(gs, "Layer");
951
+ let es = gs;
952
+ var Ft, Nt;
953
+ const qe = class qe extends Array {
951
954
  constructor(...e) {
952
955
  super(arguments.length);
953
- et(this, Lt, !1);
954
- et(this, Mt);
956
+ tt(this, Ft, !1);
957
+ tt(this, Nt);
955
958
  for (let s = 0; s < e.length; s++)
956
959
  this[s] = e[s];
957
- B(this, Lt, !1);
960
+ G(this, Ft, !1);
958
961
  }
959
962
  static fromArray(e) {
960
- const s = new Le();
963
+ const s = new qe();
961
964
  return e.forEach((i, n) => {
962
965
  s.push(i);
963
- }), B(s, Mt, e.names), s;
966
+ }), G(s, Nt, e.names), s;
964
967
  }
965
968
  flip() {
966
- B(this, Lt, !k(this, Lt));
969
+ G(this, Ft, !L(this, Ft));
967
970
  for (let e = 0; e < this.length; e++)
968
971
  this[e] = -this[e];
969
972
  return this;
970
973
  }
971
974
  get(e) {
972
- return typeof e == "number" ? this[e] : k(this, Mt) && k(this, Mt).includes(e) ? this[k(this, Mt).indexOf(e)] : void 0;
975
+ return typeof e == "number" ? this[e] : L(this, Nt) && L(this, Nt).includes(e) ? this[L(this, Nt).indexOf(e)] : void 0;
973
976
  }
974
977
  get flipped() {
975
- return k(this, Lt);
978
+ return L(this, Ft);
976
979
  }
977
980
  get names() {
978
- return k(this, Mt) ? k(this, Mt) : this.map((e, s) => `V${s + 1}`);
981
+ return L(this, Nt) ? L(this, Nt) : this.map((e, s) => `V${s + 1}`);
979
982
  }
980
983
  };
981
- Lt = new WeakMap(), Mt = new WeakMap(), u(Le, "DimensionVector");
982
- let Pt = Le;
983
- const as = class as {
984
+ Ft = new WeakMap(), Nt = new WeakMap(), c(qe, "DimensionVector");
985
+ let Tt = qe;
986
+ const ms = class ms {
984
987
  constructor(t, e) {
985
- this.scale_x = 1, this.scale_y = 1, this.scale_size = 0.05, this.active = !1, this.visible = !1, this.highlighting = !1, this.meta = {}, this._x = 0, this._y = 0, this._highlight_default = new st("#000000"), this._size = 0, this.ID = e.ID, this._transform = new se(), t instanceof Pt ? this._dimensions = t : t instanceof Ht ? this._dimensions = Pt.fromArray(t) : Array.isArray(t) ? this._dimensions = new Pt(...t) : (console.warn("Invalid dimensions provided, using default DimensionVector(0, 0)"), this._dimensions = new Pt(0, 0));
988
+ this.scale_x = 1, this.scale_y = 1, this.scale_size = 0.05, this.active = !1, this.visible = !1, this.highlighting = !1, this.meta = {}, this._x = 0, this._y = 0, this._highlight_default = new st("#000000"), this._size = 0, this.ID = e.ID, this._transform = new le(), t instanceof Tt ? this._dimensions = t : t instanceof Jt ? this._dimensions = Tt.fromArray(t) : Array.isArray(t) ? this._dimensions = new Tt(...t) : (console.warn("Invalid dimensions provided, using default DimensionVector(0, 0)"), this._dimensions = new Tt(0, 0));
986
989
  let s = { ...e };
987
990
  this._original = { ...s }, this.ID = s.ID, this.x = s.x || this._dimensions[0], this.y = s.y || this._dimensions[1], this._size = s.size || 1, this._color = s.color || new st("#000000"), this.active = s.active || !1, this.shape = s.shape || null, this.meta = s.meta || {}, this._highlight = this._highlight_default, s.highlight && (this._highlight = s.highlight);
988
991
  }
@@ -1036,9 +1039,9 @@ const as = class as {
1036
1039
  this._transform = t;
1037
1040
  }
1038
1041
  };
1039
- u(as, "PlottedObject");
1040
- let kt = as;
1041
- const hs = class hs extends kt {
1042
+ c(ms, "PlottedObject");
1043
+ let Ot = ms;
1044
+ const fs = class fs extends Ot {
1042
1045
  // constructor(x: LineOptions) {
1043
1046
  // super([], x);
1044
1047
  // // const data = Object.assign({}, x);
@@ -1080,9 +1083,9 @@ const hs = class hs extends kt {
1080
1083
  this._color = t;
1081
1084
  }
1082
1085
  };
1083
- u(hs, "Line");
1084
- let Xt = hs;
1085
- const ee = class ee extends kt {
1086
+ c(fs, "Line");
1087
+ let te = fs;
1088
+ const he = class he extends Ot {
1086
1089
  // constructor(dimensions: DimensionType, o: PointOptions) { //, graph?: any) {
1087
1090
  // super(dimensions, o);
1088
1091
  // this.active = o.active || false;
@@ -1098,7 +1101,7 @@ const ee = class ee extends kt {
1098
1101
  constructor(t) {
1099
1102
  var n, r;
1100
1103
  let e, s, i;
1101
- t ? t instanceof Ht ? (e = (n = t.classes) == null ? void 0 : n.map((a, h) => a === "ena.co.occurrence" || a === "ena.dimension" ? t[h] : -1).filter((a) => a !== -1), s = (r = t.classes) == null ? void 0 : r.map((a, h) => a === "ena.metadata" ? [t.names[h], t[h]] : null).filter((a) => a !== null).reduce((a, h) => (a[h[0]] = h[1], a), {}), i = t.rowName || `point-${Math.random().toString(36).substring(2, 9)}`) : typeof t == "object" ? (e = t.dimensions || [], s = t.meta || {}, i = t.ID || `point-${Math.random().toString(36).substring(2, 9)}`) : (console.warn("Invalid data provided for Point, using default values"), e = [], s = {}, i = `point-${Math.random().toString(36).substring(2, 9)}`) : (e = [], s = {}, i = `point-${Math.random().toString(36).substring(2, 9)}`), super(e ?? [], { meta: s, ID: i }), this.edges = /* @__PURE__ */ new Map(), this.shape = ee.SHAPES.CIRCLE;
1104
+ t ? t instanceof Jt ? (e = (n = t.classes) == null ? void 0 : n.map((a, h) => a === "ena.co.occurrence" || a === "ena.dimension" ? t[h] : -1).filter((a) => a !== -1), s = (r = t.classes) == null ? void 0 : r.map((a, h) => a === "ena.metadata" ? [t.names[h], t[h]] : null).filter((a) => a !== null).reduce((a, h) => (a[h[0]] = h[1], a), {}), i = t.rowName || `point-${Math.random().toString(36).substring(2, 9)}`) : typeof t == "object" ? (e = t.dimensions || [], s = t.meta || {}, i = t.ID || `point-${Math.random().toString(36).substring(2, 9)}`) : (console.warn("Invalid data provided for Point, using default values"), e = [], s = {}, i = `point-${Math.random().toString(36).substring(2, 9)}`) : (e = [], s = {}, i = `point-${Math.random().toString(36).substring(2, 9)}`), super(e ?? [], { meta: s, ID: i }), this.edges = /* @__PURE__ */ new Map(), this.shape = he.SHAPES.CIRCLE;
1102
1105
  }
1103
1106
  set label(t) {
1104
1107
  this._label = t;
@@ -1119,9 +1122,9 @@ const ee = class ee extends kt {
1119
1122
  this._y = parseFloat(t);
1120
1123
  }
1121
1124
  };
1122
- u(ee, "Point"), ee.SHAPES = { CIRCLE: "circle", SQUARE: "rect" };
1123
- let J = ee;
1124
- const Ft = class Ft extends kt {
1125
+ c(he, "Point"), he.SHAPES = { CIRCLE: "circle", SQUARE: "rect" };
1126
+ let K = he;
1127
+ const Gt = class Gt extends Ot {
1125
1128
  constructor(t, e) {
1126
1129
  super(e.dimensions, e), this._visible = !1, this.offset = 0, this.text = t, this.ID = e.ID, this.object = e, this.x = this.dimensions[0], this.y = this.dimensions[1], this.offset = e.size || 0, this.size = this.offset / 4, this.visible = !1, this._transform.set("e", 1), this._transform.set("f", 1);
1127
1130
  }
@@ -1144,9 +1147,9 @@ const Ft = class Ft extends kt {
1144
1147
  this._transform = t;
1145
1148
  }
1146
1149
  };
1147
- u(Ft, "Label"), Ft.DISPLAY_TYPES = { OFF: 0, AUTO: 1, CLICK: 2, ON: 3 }, Ft.HIGHLIGHT = { OFF: 0, ON: 2 }, Ft.POSITION = { OBJECT: 1, STATIC: 2, CONTAINER: 3, CUSTOM: 4 };
1148
- let H = Ft;
1149
- const ls = class ls {
1150
+ c(Gt, "Label"), Gt.DISPLAY_TYPES = { OFF: 0, AUTO: 1, CLICK: 2, ON: 3 }, Gt.HIGHLIGHT = { OFF: 0, ON: 2 }, Gt.POSITION = { OBJECT: 1, STATIC: 2, CONTAINER: 3, CUSTOM: 4 };
1151
+ let q = Gt;
1152
+ const ps = class ps {
1150
1153
  constructor(t, e, s = 0, i = 0) {
1151
1154
  this.x_max = t, this.y_max = e, this.cx = s, this.cy = i;
1152
1155
  }
@@ -1179,9 +1182,9 @@ const ls = class ls {
1179
1182
  return this.x_max;
1180
1183
  }
1181
1184
  };
1182
- u(ls, "Extremes");
1183
- let Rt = ls;
1184
- const cs = class cs extends kt {
1185
+ c(ps, "Extremes");
1186
+ let Ct = ps;
1187
+ const bs = class bs extends Ot {
1185
1188
  constructor(t, e) {
1186
1189
  super(t, e), this.visible = !0, this.size = e.size;
1187
1190
  }
@@ -1207,8 +1210,8 @@ const cs = class cs extends kt {
1207
1210
  return this._transform;
1208
1211
  }
1209
1212
  };
1210
- u(cs, "AxisPoint");
1211
- let Ve = cs, Ks = {
1213
+ c(bs, "AxisPoint");
1214
+ let ss = bs, ai = {
1212
1215
  GRAPH: {
1213
1216
  ratio: 1,
1214
1217
  x_max: 1,
@@ -1224,25 +1227,25 @@ let Ve = cs, Ks = {
1224
1227
  size: 1,
1225
1228
  highlight: {
1226
1229
  color: "yellow",
1227
- labels: H.DISPLAY_TYPES.ON
1230
+ labels: q.DISPLAY_TYPES.ON
1228
1231
  },
1229
- labels: H.DISPLAY_TYPES.ON,
1230
- labelposition: H.POSITION.OBJECT
1232
+ labels: q.DISPLAY_TYPES.ON,
1233
+ labelposition: q.POSITION.OBJECT
1231
1234
  },
1232
1235
  POINT: {
1233
1236
  active: 2,
1234
1237
  size: 0.05,
1235
1238
  color: "#000",
1236
- shape: J.SHAPES.CIRCLE,
1237
- labels: H.DISPLAY_TYPES.AUTO,
1238
- labelposition: H.POSITION.OBJECT
1239
+ shape: K.SHAPES.CIRCLE,
1240
+ labels: q.DISPLAY_TYPES.AUTO,
1241
+ labelposition: q.POSITION.OBJECT
1239
1242
  },
1240
1243
  MEAN: {
1241
- shape: J.SHAPES.SQUARE,
1242
- labels: H.DISPLAY_TYPES.AUTO
1244
+ shape: K.SHAPES.SQUARE,
1245
+ labels: q.DISPLAY_TYPES.AUTO
1243
1246
  },
1244
1247
  LABEL: {
1245
- highlight: H.HIGHLIGHT.OFF,
1248
+ highlight: q.HIGHLIGHT.OFF,
1246
1249
  position: ["top", "left"],
1247
1250
  container: "#label-container"
1248
1251
  },
@@ -1250,9 +1253,9 @@ let Ve = cs, Ks = {
1250
1253
  multiplier: 1
1251
1254
  }
1252
1255
  };
1253
- const _s = class _s {
1254
- constructor(t = { ...Ks }) {
1255
- this.__state__ = new Ae(), this.name = "unnamed-graph", this.origin = void 0, this.points = /* @__PURE__ */ new Map(), this.nodes = /* @__PURE__ */ new Map(), this.edges = /* @__PURE__ */ new Map(), this.trajectories = /* @__PURE__ */ new Map(), this.labels = /* @__PURE__ */ new Map(), this.transform = new se(), this.scale_x = 1, this.scale_y = 1, this.SIZE_EFFECT = 1, this._mirror_y = !0, this._mirror_x = !1, this._layers = new qt(
1256
+ const ys = class ys {
1257
+ constructor(t = { ...ai }) {
1258
+ this.__state__ = new ke(), this.name = "unnamed-graph", this.origin = void 0, this.points = /* @__PURE__ */ new Map(), this.nodes = /* @__PURE__ */ new Map(), this.edges = /* @__PURE__ */ new Map(), this.trajectories = /* @__PURE__ */ new Map(), this.labels = /* @__PURE__ */ new Map(), this.transform = new le(), this.scale_x = 1, this.scale_y = 1, this.SIZE_EFFECT = 1, this._mirror_y = !0, this._mirror_x = !1, this._layers = new Wt(
1256
1259
  { name: "graph", tabindex: 0, layers: [
1257
1260
  {
1258
1261
  name: "axes",
@@ -1291,8 +1294,8 @@ const _s = class _s {
1291
1294
  { name: "points", layers: [], tabindex: 0 },
1292
1295
  { name: "labels", layers: [], tabindex: 0 }
1293
1296
  ] }
1294
- ), this.options = t, this.origin = new Ve(
1295
- new Pt(0, 0),
1297
+ ), this.options = t, this.origin = new ss(
1298
+ new Tt(0, 0),
1296
1299
  {
1297
1300
  ID: "origin",
1298
1301
  x: 0,
@@ -1307,28 +1310,28 @@ const _s = class _s {
1307
1310
  );
1308
1311
  let e = 1;
1309
1312
  function s(r, a, h) {
1310
- const o = new We(`${e}`, r, h);
1311
- return e += 1, o.parent = a || void 0, r.layers && Array.isArray(r.layers) && (o.layers = new qt(...r.layers.map((l) => s(l, o, h)))), o;
1313
+ const o = new es(`${e}`, r, h);
1314
+ return e += 1, o.parent = a || void 0, r.layers && Array.isArray(r.layers) && (o.layers = new Wt(...r.layers.map((_) => s(_, o, h)))), o;
1312
1315
  }
1313
- u(s, "buildLayerTree"), this.layers = new qt(...this._layers.map((r) => s(r, null, this)));
1316
+ c(s, "buildLayerTree"), this.layers = new Wt(...this._layers.map((r) => s(r, null, this)));
1314
1317
  let i = this.layers.search("layers", "axis_points");
1315
1318
  i && i.objects.set(this.origin.ID, this.origin);
1316
1319
  let n = this.layers.search("layers", "axis_lines");
1317
1320
  if (n) {
1318
- let r = this.extremes || new Rt(1, 1), a = new Xt(
1321
+ let r = this.extremes || new Ct(1, 1), a = new te(
1319
1322
  {},
1320
- new J({ ID: "axis-x-start", dimensions: [-r.x_max, 0], classes: ["ena.dimension", "ena.dimension"] }),
1321
- new J({ ID: "axis-x-end", dimensions: [r.x_max, 0], classes: ["ena.dimension", "ena.dimension"] })
1323
+ new K({ ID: "axis-x-start", dimensions: [-r.x_max, 0], classes: ["ena.dimension", "ena.dimension"] }),
1324
+ new K({ ID: "axis-x-end", dimensions: [r.x_max, 0], classes: ["ena.dimension", "ena.dimension"] })
1322
1325
  );
1323
1326
  a.ID = "axis-x", n.objects.set(a.ID, a);
1324
- let h = new Xt(
1327
+ let h = new te(
1325
1328
  {},
1326
- new J({ ID: "axis-y-start", dimensions: [0, -r.y_max], classes: ["ena.dimension", "ena.dimension"] }),
1327
- new J({ ID: "axis-y-end", dimensions: [0, r.y_max], classes: ["ena.dimension", "ena.dimension"] })
1329
+ new K({ ID: "axis-y-start", dimensions: [0, -r.y_max], classes: ["ena.dimension", "ena.dimension"] }),
1330
+ new K({ ID: "axis-y-end", dimensions: [0, r.y_max], classes: ["ena.dimension", "ena.dimension"] })
1328
1331
  );
1329
- h.ID = "axis-y", n.objects.set(h.ID, h), console.log("Added axis lines to layer: ", n);
1332
+ h.ID = "axis-y", n.objects.set(h.ID, h), Qt("Added axis lines to layer: ", n);
1330
1333
  }
1331
- this.extremes = new Rt(t.GRAPH.x_max, t.GRAPH.y_max);
1334
+ this.extremes = new Ct(t.GRAPH.x_max, t.GRAPH.y_max);
1332
1335
  }
1333
1336
  set extremes(t) {
1334
1337
  this._extremes = t;
@@ -1355,7 +1358,7 @@ const _s = class _s {
1355
1358
  return this.mirror_y ? -1 : 1;
1356
1359
  }
1357
1360
  add_point(t) {
1358
- const e = new J(t);
1361
+ const e = new K(t);
1359
1362
  this.points.set(e.ID, e);
1360
1363
  }
1361
1364
  add_points(t) {
@@ -1367,7 +1370,7 @@ const _s = class _s {
1367
1370
  add_nodes(t) {
1368
1371
  let e = this;
1369
1372
  t.forEach((s) => {
1370
- s.label = new H(s.ID, s), e.labels.set(s.label.ID, s.label), e.nodes.set(s.ID, s);
1373
+ s.label = new q(s.ID, s), e.labels.set(s.label.ID, s.label), e.nodes.set(s.ID, s);
1371
1374
  const i = e.layers.search("layers", "nodes");
1372
1375
  i && i.objects.push(s);
1373
1376
  }), e.update_extremes();
@@ -1392,14 +1395,14 @@ const _s = class _s {
1392
1395
  this.layers.search("layers", "nodes")
1393
1396
  ].filter((s) => s !== void 0);
1394
1397
  if (e.length === 0)
1395
- this.extremes = new Rt(1, 1);
1398
+ this.extremes = new Ct(1, 1);
1396
1399
  else {
1397
1400
  let s = 1 / 0, i = -1 / 0, n = 1 / 0, r = -1 / 0;
1398
- e.forEach((g) => g.objects.forEach((c) => {
1399
- Number.isFinite(c.x) && (s = Math.min(s, c.x), i = Math.max(i, c.x)), Number.isFinite(c.y) && (n = Math.min(n, c.y), r = Math.max(r, c.y));
1401
+ e.forEach((p) => p.objects.forEach((u) => {
1402
+ Number.isFinite(u.x) && (s = Math.min(s, u.x), i = Math.max(i, u.x)), Number.isFinite(u.y) && (n = Math.min(n, u.y), r = Math.max(r, u.y));
1400
1403
  }));
1401
- const a = Number.isFinite(s) && Number.isFinite(n), h = t && a ? (s + i) / 2 : 0, o = t && a ? (n + r) / 2 : 0, l = a ? Math.max(Math.abs(s - h), Math.abs(i - h), Math.abs(n - o), Math.abs(r - o)) : 0, _ = (l > 0 ? l : 1) * 1.3;
1402
- this.extremes = new Rt(_, _, h, o);
1404
+ const a = Number.isFinite(s) && Number.isFinite(n), h = t && a ? (s + i) / 2 : 0, o = t && a ? (n + r) / 2 : 0, _ = a ? Math.max(Math.abs(s - h), Math.abs(i - h), Math.abs(n - o), Math.abs(r - o)) : 0, m = (_ > 0 ? _ : 1) * 1.3;
1405
+ this.extremes = new Ct(m, m, h, o);
1403
1406
  }
1404
1407
  }
1405
1408
  /** Farthest node from (cx, cy), on either axis */
@@ -1415,9 +1418,9 @@ const _s = class _s {
1415
1418
  return Math.min(1, e / (Math.sqrt(s) * t));
1416
1419
  }
1417
1420
  };
1418
- u(_s, "Graph");
1419
- let Ke = _s;
1420
- const De = class De extends HTMLElement {
1421
+ c(ys, "Graph");
1422
+ let is = ys;
1423
+ const Be = class Be extends HTMLElement {
1421
1424
  constructor() {
1422
1425
  super(), this.element = null, this.object = null;
1423
1426
  const t = this, e = t.attachShadow({ mode: "open" }), s = document.createElement("style"), i = document.createElement("div");
@@ -1428,7 +1431,7 @@ const De = class De extends HTMLElement {
1428
1431
  return e == null ? void 0 : e.querySelector(".wrapper");
1429
1432
  }
1430
1433
  };
1431
- u(De, "DrawableElement"), De.style = `
1434
+ c(Be, "DrawableElement"), Be.style = `
1432
1435
  :host {
1433
1436
  max-width: 100%;
1434
1437
  display: block;
@@ -1439,22 +1442,22 @@ u(De, "DrawableElement"), De.style = `
1439
1442
  justify-content: center;
1440
1443
  }
1441
1444
  `;
1442
- let ve = De;
1443
- const hi = 1e-8;
1444
- function Us(d, t = hi) {
1445
- return d.filter((e) => Math.abs(e.x) > t || Math.abs(e.y) > t);
1445
+ let ze = Be;
1446
+ const xi = 1e-8;
1447
+ function ti(g, t = xi) {
1448
+ return g.filter((e) => Math.abs(e.x) > t || Math.abs(e.y) > t);
1446
1449
  }
1447
- u(Us, "nearOriginFilter");
1448
- function Js(d) {
1449
- if (d <= 0) return [];
1450
- if (d === 1) return [0];
1451
- const t = new Array(d);
1452
- for (let e = 0; e < d; e++) t[e] = e / (d - 1);
1450
+ c(ti, "nearOriginFilter");
1451
+ function hi(g) {
1452
+ if (g <= 0) return [];
1453
+ if (g === 1) return [0];
1454
+ const t = new Array(g);
1455
+ for (let e = 0; e < g; e++) t[e] = e / (g - 1);
1453
1456
  return t;
1454
1457
  }
1455
- u(Js, "normalizedT");
1456
- function Zs(d, t) {
1457
- return d.map((e) => {
1458
+ c(hi, "normalizedT");
1459
+ function li(g, t) {
1460
+ return g.map((e) => {
1458
1461
  const s = new Array(t + 1);
1459
1462
  let i = 1;
1460
1463
  for (let n = 0; n <= t; n++)
@@ -1462,9 +1465,9 @@ function Zs(d, t) {
1462
1465
  return s;
1463
1466
  });
1464
1467
  }
1465
- u(Zs, "design");
1466
- function Qs(d) {
1467
- const t = d.length, e = d[0].length, s = d.map((n) => n.slice()), i = Array.from({ length: e }, () => new Array(e).fill(0));
1468
+ c(li, "design");
1469
+ function ci(g) {
1470
+ const t = g.length, e = g[0].length, s = g.map((n) => n.slice()), i = Array.from({ length: e }, () => new Array(e).fill(0));
1468
1471
  for (let n = 0; n < e; n++) {
1469
1472
  let r = 0;
1470
1473
  for (let a = 0; a < t; a++) r += s[a][n] * s[a][n];
@@ -1479,91 +1482,91 @@ function Qs(d) {
1479
1482
  }
1480
1483
  return { Q: s, R: i };
1481
1484
  }
1482
- u(Qs, "qr");
1483
- function Je(d, t) {
1484
- const e = d.length, s = d[0].length, i = new Array(s).fill(0);
1485
+ c(ci, "qr");
1486
+ function ns(g, t) {
1487
+ const e = g.length, s = g[0].length, i = new Array(s).fill(0);
1485
1488
  for (let n = 0; n < s; n++) {
1486
1489
  let r = 0;
1487
- for (let a = 0; a < e; a++) r += d[a][n] * t[a];
1490
+ for (let a = 0; a < e; a++) r += g[a][n] * t[a];
1488
1491
  i[n] = r;
1489
1492
  }
1490
1493
  return i;
1491
1494
  }
1492
- u(Je, "qtY");
1493
- function Ze(d, t) {
1495
+ c(ns, "qtY");
1496
+ function rs(g, t) {
1494
1497
  const e = t.length, s = new Array(e).fill(0);
1495
1498
  for (let i = e - 1; i >= 0; i--) {
1496
1499
  let n = t[i];
1497
- for (let r = i + 1; r < e; r++) n -= d[i][r] * s[r];
1498
- s[i] = Math.abs(d[i][i]) > 1e-12 ? n / d[i][i] : 0;
1500
+ for (let r = i + 1; r < e; r++) n -= g[i][r] * s[r];
1501
+ s[i] = Math.abs(g[i][i]) > 1e-12 ? n / g[i][i] : 0;
1499
1502
  }
1500
1503
  return s;
1501
1504
  }
1502
- u(Ze, "backSolve");
1503
- function li(d) {
1504
- return d.map((t) => {
1505
+ c(rs, "backSolve");
1506
+ function wi(g) {
1507
+ return g.map((t) => {
1505
1508
  let e = 0;
1506
1509
  for (let s = 0; s < t.length; s++) e += t[s] * t[s];
1507
1510
  return e;
1508
1511
  });
1509
1512
  }
1510
- u(li, "leverages");
1511
- function Gs(d, t, e) {
1512
- const s = Zs(d, e), { Q: i, R: n } = Qs(s);
1513
- return Ze(n, Je(i, t));
1513
+ c(wi, "leverages");
1514
+ function ei(g, t, e) {
1515
+ const s = li(g, e), { Q: i, R: n } = ci(s);
1516
+ return rs(n, ns(i, t));
1514
1517
  }
1515
- u(Gs, "fitCoeffs");
1516
- function Se(d, t) {
1518
+ c(ei, "fitCoeffs");
1519
+ function Ce(g, t) {
1517
1520
  let e = 0, s = 1;
1518
- for (let i = 0; i < d.length; i++)
1519
- e += d[i] * s, s *= t;
1521
+ for (let i = 0; i < g.length; i++)
1522
+ e += g[i] * s, s *= t;
1520
1523
  return e;
1521
1524
  }
1522
- u(Se, "evalPoly");
1523
- function ci(d, t, e, s) {
1524
- const i = Zs(d, s), { Q: n, R: r } = Qs(i), a = li(n), h = Ze(r, Je(n, t)), o = Ze(r, Je(n, e));
1525
- let l = 0;
1526
- for (let _ = 0; _ < d.length; _++) {
1527
- const g = 1 - a[_];
1528
- if (g <= 0) return 1 / 0;
1529
- const c = t[_] - Se(h, d[_]), E = e[_] - Se(o, d[_]);
1530
- l += (c / g) ** 2 + (E / g) ** 2;
1531
- }
1532
- return l;
1525
+ c(Ce, "evalPoly");
1526
+ function vi(g, t, e, s) {
1527
+ const i = li(g, s), { Q: n, R: r } = ci(i), a = wi(n), h = rs(r, ns(n, t)), o = rs(r, ns(n, e));
1528
+ let _ = 0;
1529
+ for (let m = 0; m < g.length; m++) {
1530
+ const p = 1 - a[m];
1531
+ if (p <= 0) return 1 / 0;
1532
+ const u = t[m] - Ce(h, g[m]), d = e[m] - Ce(o, g[m]);
1533
+ _ += (u / p) ** 2 + (d / p) ** 2;
1534
+ }
1535
+ return _;
1533
1536
  }
1534
- u(ci, "loocv2d");
1535
- function _i(d, t, e) {
1536
- const s = d.length, i = Math.min(Math.max(1, Math.floor(t)), Math.max(1, s - 1));
1537
+ c(vi, "loocv2d");
1538
+ function Ai(g, t, e) {
1539
+ const s = g.length, i = Math.min(Math.max(1, Math.floor(t)), Math.max(1, s - 1));
1537
1540
  if (e === "fixed" || s < 3) return i;
1538
- const n = Js(s), r = d.map((l) => l.x), a = d.map((l) => l.y);
1541
+ const n = hi(s), r = g.map((_) => _.x), a = g.map((_) => _.y);
1539
1542
  let h = 1, o = 1 / 0;
1540
- for (let l = 1; l <= i; l++) {
1541
- const _ = ci(n, r, a, l);
1542
- _ < o && (o = _, h = l);
1543
+ for (let _ = 1; _ <= i; _++) {
1544
+ const m = vi(n, r, a, _);
1545
+ m < o && (o = m, h = _);
1543
1546
  }
1544
1547
  return h;
1545
1548
  }
1546
- u(_i, "selectDegree");
1547
- function ui(d, t) {
1548
- const e = Us(d);
1549
+ c(Ai, "selectDegree");
1550
+ function Si(g, t) {
1551
+ const e = ti(g);
1549
1552
  if (e.length < 3) return null;
1550
- const s = t.selectionSet ? Us(t.selectionSet) : e, i = s.length >= 3 ? s : e;
1551
- let n = _i(i, t.maxDegree, t.degreeSelection);
1553
+ const s = t.selectionSet ? ti(t.selectionSet) : e, i = s.length >= 3 ? s : e;
1554
+ let n = Ai(i, t.maxDegree, t.degreeSelection);
1552
1555
  n = Math.min(n, Math.max(1, e.length - 1));
1553
- const r = Js(e.length), a = Gs(r, e.map((o) => o.x), n), h = Gs(r, e.map((o) => o.y), n);
1556
+ const r = hi(e.length), a = ei(r, e.map((o) => o.x), n), h = ei(r, e.map((o) => o.y), n);
1554
1557
  return { degree: n, coeffsX: a, coeffsY: h };
1555
1558
  }
1556
- u(ui, "fitTrajectory");
1557
- function Bs(d, t = 100) {
1559
+ c(Si, "fitTrajectory");
1560
+ function si(g, t = 100) {
1558
1561
  const e = [];
1559
1562
  for (let s = 0; s <= t; s++) {
1560
1563
  const i = s / t;
1561
- e.push({ x: Se(d.coeffsX, i), y: Se(d.coeffsY, i) });
1564
+ e.push({ x: Ce(g.coeffsX, i), y: Ce(g.coeffsY, i) });
1562
1565
  }
1563
1566
  return e;
1564
1567
  }
1565
- u(Bs, "sampleCurve");
1566
- const Hs = 100, us = class us extends kt {
1568
+ c(si, "sampleCurve");
1569
+ const ii = 100, xs = class xs extends Ot {
1567
1570
  constructor(t = {}) {
1568
1571
  const e = t.color instanceof st ? t.color : new st(typeof t.color == "string" ? t.color : "#000000");
1569
1572
  super([], {
@@ -1575,8 +1578,8 @@ const Hs = 100, us = class us extends kt {
1575
1578
  meta: t.meta || {},
1576
1579
  ...t
1577
1580
  }), this._typeName = "Trajectory", this.trajPoints = [], this.smooth = "none", this.maxDegree = 3, this.degreeSelection = "loocv_2d", this.selectedDegree = -1, this.polyCoeffsX = [], this.polyCoeffsY = [], this.currentTime = 1 / 0, this.showPoints = !0, this.showTips = !0, this.lineStyle = "uniform", this.strokeWidth = 2, this.strokeWidthRange = [1, 6], this.opacityRange = [0.3, 1], this.smooth = t.smooth || "none", this.maxDegree = t.maxDegree !== void 0 ? t.maxDegree : 3, this.degreeSelection = t.degreeSelection || "loocv_2d", this.polyCoeffsX = t.polyCoeffsX || [], this.polyCoeffsY = t.polyCoeffsY || [], this.currentTime = t.currentTime !== void 0 ? t.currentTime : 1 / 0, this.showPoints = t.showPoints !== void 0 ? t.showPoints : !0, this.showTips = t.showTips !== void 0 ? t.showTips : !0, this.lineStyle = t.lineStyle || "uniform", this.strokeWidth = t.strokeWidth || 2, this.strokeWidthRange = t.strokeWidthRange || [1, 6], this.opacityRange = t.opacityRange || [0.3, 1], t.points && Array.isArray(t.points) && (this.trajPoints = t.points.map((s) => {
1578
- if (s instanceof J) return s;
1579
- const i = new J({ dimensions: [s.x, s.y], meta: { time: s.time, label: s.label } });
1581
+ if (s instanceof K) return s;
1582
+ const i = new K({ dimensions: [s.x, s.y], meta: { time: s.time, label: s.label } });
1580
1583
  return i.x = s.x, i.y = s.y, i;
1581
1584
  }));
1582
1585
  }
@@ -1591,11 +1594,11 @@ const Hs = 100, us = class us extends kt {
1591
1594
  if (t.length < 2) return [];
1592
1595
  if (this.smooth === "poly") {
1593
1596
  if (this.polyCoeffsX.length > 0 && this.polyCoeffsY.length > 0)
1594
- return Bs(
1597
+ return si(
1595
1598
  { degree: this.polyCoeffsX.length - 1, coeffsX: this.polyCoeffsX, coeffsY: this.polyCoeffsY },
1596
- Hs
1599
+ ii
1597
1600
  );
1598
- const e = ui(
1601
+ const e = Si(
1599
1602
  t.map((s) => ({ x: s.x, y: s.y })),
1600
1603
  {
1601
1604
  maxDegree: this.maxDegree,
@@ -1604,14 +1607,14 @@ const Hs = 100, us = class us extends kt {
1604
1607
  }
1605
1608
  );
1606
1609
  if (e)
1607
- return this.selectedDegree = e.degree, Bs(e, Hs);
1610
+ return this.selectedDegree = e.degree, si(e, ii);
1608
1611
  }
1609
1612
  return t.map((e) => ({ x: e.x, y: e.y }));
1610
1613
  }
1611
1614
  };
1612
- u(us, "Trajectory");
1613
- let Ee = us;
1614
- const ti = 1, ds = class ds extends Xt {
1615
+ c(xs, "Trajectory");
1616
+ let Oe = xs;
1617
+ const _i = 1, ws = class ws extends te {
1615
1618
  constructor(t, e, s, i = 0) {
1616
1619
  super(t, e, s), this._totalweight = 0, this._weight = i;
1617
1620
  }
@@ -1620,7 +1623,7 @@ const ti = 1, ds = class ds extends Xt {
1620
1623
  }
1621
1624
  get color() {
1622
1625
  const t = this._color || new st("#000000");
1623
- return new we(t, Math.abs(this.weight));
1626
+ return new Ne(t, Math.abs(this.weight));
1624
1627
  }
1625
1628
  set color(t) {
1626
1629
  this._color = t;
@@ -1641,90 +1644,90 @@ const ti = 1, ds = class ds extends Xt {
1641
1644
  this._totalweight = t;
1642
1645
  }
1643
1646
  };
1644
- u(ds, "Edge");
1645
- let Me = ds;
1646
- var Gt;
1647
- const gs = class gs extends kt {
1647
+ c(ws, "Edge");
1648
+ let Pe = ws;
1649
+ var Zt;
1650
+ const vs = class vs extends Ot {
1648
1651
  constructor(e) {
1649
1652
  super(e.dimensions || [], e);
1650
- et(this, Gt);
1651
- B(this, Gt, e);
1653
+ tt(this, Zt);
1654
+ G(this, Zt, e);
1652
1655
  }
1653
1656
  get edge() {
1654
- return k(this, Gt);
1657
+ return L(this, Zt);
1655
1658
  }
1656
1659
  get path() {
1657
- const e = k(this, Gt), s = [e.to.x, e.to.y], i = e.from_point, [n, r] = e.base_pts, a = Math.hypot(i[0] - s[0], i[1] - s[1]), h = Math.hypot(n[0] - r[0], n[1] - r[1]);
1660
+ const e = L(this, Zt), s = [e.to.x, e.to.y], i = e.from_point, [n, r] = e.base_pts, a = Math.hypot(i[0] - s[0], i[1] - s[1]), h = Math.hypot(n[0] - r[0], n[1] - r[1]);
1658
1661
  if (!(a > 0) || !(h > 0)) return "";
1659
- const o = [(i[0] - s[0]) / a, (i[1] - s[1]) / a], l = Math.hypot(n[0] - s[0], n[1] - s[1]), _ = [(n[0] - s[0]) / l, (n[1] - s[1]) / l], g = /* @__PURE__ */ u((Y) => h / 2 * Math.max(0, 1 - Y / a), "halfW"), c = /* @__PURE__ */ u((Y, v) => `${s[0] + o[0] * Y + _[0] * v} ${s[1] + o[1] * Y + _[1] * v}`, "at"), E = 0.2 * a, m = Math.min(0.15 * a, 0.8 * 2 * g(E)), S = E + m / 2, R = E + m;
1660
- return `M${c(E, 0)} L${c(S, g(S))} L${c(R, g(R))} L${c(S, 0)} L${c(R, -g(R))} L${c(S, -g(S))}z`;
1662
+ const o = [(i[0] - s[0]) / a, (i[1] - s[1]) / a], _ = Math.hypot(n[0] - s[0], n[1] - s[1]), m = [(n[0] - s[0]) / _, (n[1] - s[1]) / _], p = /* @__PURE__ */ c(($) => h / 2 * Math.max(0, 1 - $ / a), "halfW"), u = /* @__PURE__ */ c(($, z) => `${s[0] + o[0] * $ + m[0] * z} ${s[1] + o[1] * $ + m[1] * z}`, "at"), d = 0.2 * a, l = Math.min(0.15 * a, 0.8 * 2 * p(d)), b = d + l / 2, f = d + l;
1663
+ return `M${u(d, 0)} L${u(b, p(b))} L${u(f, p(f))} L${u(b, 0)} L${u(f, -p(f))} L${u(b, -p(b))}z`;
1661
1664
  }
1662
1665
  };
1663
- Gt = new WeakMap(), u(gs, "EdgeArrow");
1664
- let Ie = gs;
1665
- var Bt, de;
1666
- const Te = class Te extends Me {
1666
+ Zt = new WeakMap(), c(vs, "EdgeArrow");
1667
+ let Le = vs;
1668
+ var Kt, ye;
1669
+ const Ge = class Ge extends Pe {
1667
1670
  constructor(e, s, i) {
1668
1671
  super(e, s, i);
1669
- et(this, Bt);
1670
- et(this, de);
1671
- this._path = "", B(this, Bt, !1), this._directions = [
1672
+ tt(this, Kt);
1673
+ tt(this, ye);
1674
+ this._path = "", G(this, Kt, !1), this._directions = [
1672
1675
  "from",
1673
1676
  "to"
1674
1677
  /* TO */
1675
- ], this.towards = "to", k(this, Bt) === !0 && B(this, de, new Ie(this));
1678
+ ], this.towards = "to", L(this, Kt) === !0 && G(this, ye, new Le(this));
1676
1679
  }
1677
1680
  get path() {
1678
1681
  return `M${this.from.x} ${this.from.y} L${this.base_pts[0].join(" ")} L${this.base_pts[1].join(" ")}z`;
1679
1682
  }
1680
1683
  static calculate_base_points(e) {
1681
- const s = e.towards, i = e._directions.find((S) => S !== e.towards), n = e[i].x, r = e[i].y, a = e[s].x, h = e[s].y, o = a - n, l = h - r, _ = Math.hypot(o, l), g = (e.weight ?? 0) * ti;
1682
- if (_ === 0 || !isFinite(g) || g === 0)
1684
+ const s = e.towards, i = e._directions.find((b) => b !== e.towards), n = e[i].x, r = e[i].y, a = e[s].x, h = e[s].y, o = a - n, _ = h - r, m = Math.hypot(o, _), p = (e.weight ?? 0) * _i;
1685
+ if (m === 0 || !isFinite(p) || p === 0)
1683
1686
  return [[a, h], [a, h]];
1684
- const c = -l / _, E = o / _, m = g / 2;
1687
+ const u = -_ / m, d = o / m, l = p / 2;
1685
1688
  return [
1686
- [a + c * m, h + E * m],
1687
- [a - c * m, h - E * m]
1689
+ [a + u * l, h + d * l],
1690
+ [a - u * l, h - d * l]
1688
1691
  ];
1689
1692
  }
1690
1693
  get base_pts() {
1691
- return Te.calculate_base_points(this);
1694
+ return Ge.calculate_base_points(this);
1692
1695
  }
1693
1696
  get arrow() {
1694
- return k(this, de);
1697
+ return L(this, ye);
1695
1698
  }
1696
1699
  get with_arrow() {
1697
- return k(this, Bt);
1700
+ return L(this, Kt);
1698
1701
  }
1699
1702
  get from_point() {
1700
1703
  return [this.from.x, this.from.y];
1701
1704
  }
1702
1705
  };
1703
- Bt = new WeakMap(), de = new WeakMap(), u(Te, "TaperedEdge");
1704
- let Wt = Te;
1705
- const ze = class ze extends Wt {
1706
+ Kt = new WeakMap(), ye = new WeakMap(), c(Ge, "TaperedEdge");
1707
+ let Dt = Ge;
1708
+ const Ue = class Ue extends Dt {
1706
1709
  constructor(t, e, s) {
1707
1710
  super(t, e, s), this._dataWeight = 0, this._totalweight = t.totalweight ?? 0, this._dataWeight = t.weight ?? this._weight;
1708
1711
  }
1709
1712
  get weighted_midpoint() {
1710
- return ie.Geometry.Line.interpolate(this.line)(1 - this._dataWeight / this._totalweight);
1713
+ return ce.Geometry.Line.interpolate(this.line)(1 - this._dataWeight / this._totalweight);
1711
1714
  }
1712
1715
  get base_pts() {
1713
- return Wt.calculate_base_points(this);
1716
+ return Dt.calculate_base_points(this);
1714
1717
  }
1715
1718
  static build_path(t) {
1716
1719
  return t._totalweight > 0 ? `M${t.weighted_midpoint[0]} ${t.weighted_midpoint[1]} L${t.base_pts[0].join(" ")} L${t.base_pts[1].join(" ")}z` : (console.error("TaperedWeightedMidpointEdge: No totalweight, returning empty path"), "");
1717
1720
  }
1718
1721
  get path() {
1719
- return ze.build_path(this);
1722
+ return Ue.build_path(this);
1720
1723
  }
1721
1724
  get from_point() {
1722
1725
  return this.weighted_midpoint;
1723
1726
  }
1724
1727
  };
1725
- u(ze, "TaperedWeightedMidpointEdge");
1726
- let Qe = ze;
1727
- const Fe = class Fe extends Me {
1728
+ c(Ue, "TaperedWeightedMidpointEdge");
1729
+ let os = Ue;
1730
+ const Xe = class Xe extends Pe {
1728
1731
  constructor(t, e, s) {
1729
1732
  super(t, e, s);
1730
1733
  }
@@ -1733,14 +1736,14 @@ const Fe = class Fe extends Me {
1733
1736
  return `M ${i}, ${e.y} a ${s},${s} 0 1,0 ${n},0 a ${s},${s} 0 1,0 -${n},0`;
1734
1737
  }
1735
1738
  get path() {
1736
- let t = this.weight * ti;
1737
- return Fe.build_path(t, this.to);
1739
+ let t = this.weight * _i;
1740
+ return Xe.build_path(t, this.to);
1738
1741
  }
1739
1742
  };
1740
- u(Fe, "NodeEdge");
1741
- let ne = Fe;
1742
- const fs = class fs {
1743
- constructor(t, e, s, i = new Ct()) {
1743
+ c(Xe, "NodeEdge");
1744
+ let Ht = Xe;
1745
+ const As = class As {
1746
+ constructor(t, e, s, i = new Pt()) {
1744
1747
  this.__data__ = t, this.parent = e, this.graph = s, this.__children__ = i, this.svg_element = this.create();
1745
1748
  }
1746
1749
  get_size() {
@@ -1757,103 +1760,122 @@ const fs = class fs {
1757
1760
  if (i === s) return;
1758
1761
  const n = 5e3, r = performance.now();
1759
1762
  function a(h) {
1760
- const o = Math.min(1, (h - r) / n), l = i + (s - i) * o;
1761
- t.setAttribute(e, l.toString()), o < 1 ? requestAnimationFrame(a) : t.setAttribute(e, s.toString());
1763
+ const o = Math.min(1, (h - r) / n), _ = i + (s - i) * o;
1764
+ t.setAttribute(e, _.toString()), o < 1 ? requestAnimationFrame(a) : t.setAttribute(e, s.toString());
1762
1765
  }
1763
- u(a, "animate"), requestAnimationFrame(a);
1766
+ c(a, "animate"), requestAnimationFrame(a);
1764
1767
  }
1765
1768
  };
1766
- u(fs, "Drawable");
1767
- let re = fs;
1768
- const di = 0.04, gi = [0.25, 1], fi = [0.3, 1];
1769
- function Xs(d, t, e, s) {
1770
- const i = Math.abs(d);
1769
+ c(As, "Drawable");
1770
+ let _e = As;
1771
+ const Ei = 0.04, Mi = [0.25, 1], Ii = [0.3, 1];
1772
+ function ni(g, t, e, s) {
1773
+ const i = Math.abs(g);
1771
1774
  if (!(i > 0)) return 0;
1772
1775
  if (!(e > t)) return s[1];
1773
1776
  const n = Math.min(1, Math.max(0, (i - t) / (e - t)));
1774
1777
  return s[0] + n * (s[1] - s[0]);
1775
1778
  }
1776
- u(Xs, "rampFor");
1777
- const mi = 0.011, pi = 0.75, bi = 0.8, yi = 0.75, ei = 6e-3, xi = 0.6;
1778
- function wi(d) {
1779
- return 2 * d;
1779
+ c(ni, "rampFor");
1780
+ const Ni = 0.011, ki = 0.75, zi = 0.8, Ci = 0.75, ui = 6e-3, Oi = 0.6;
1781
+ function Pi(g) {
1782
+ return 2 * g;
1780
1783
  }
1781
- u(wi, "widthPerWeight");
1782
- function Ai(d, t) {
1783
- return d * t / (2 * ei);
1784
+ c(Pi, "widthPerWeight");
1785
+ function Li(g, t) {
1786
+ return g * t / (2 * ui);
1784
1787
  }
1785
- u(Ai, "nodeSizeForEdges");
1786
- function vi(d) {
1787
- const t = /rgba?\(([^)]+)\)/.exec(d);
1788
- if (!t) return d;
1789
- const [e, s, i, n = 1] = t[1].split(",").map(Number), r = /* @__PURE__ */ u((a) => Math.round(255 + (a - 255) * n), "f");
1788
+ c(Li, "nodeSizeForEdges");
1789
+ function Ri(g) {
1790
+ const t = /rgba?\(([^)]+)\)/.exec(g);
1791
+ if (!t) return g;
1792
+ const [e, s, i, n = 1] = t[1].split(",").map(Number), r = /* @__PURE__ */ c((a) => Math.round(255 + (a - 255) * n), "f");
1790
1793
  return `rgb(${r(e)},${r(s)},${r(i)})`;
1791
1794
  }
1792
- u(vi, "flattenOnWhite");
1793
- function Si(d, t) {
1794
- const e = /rgba?\(([^)]+)\)/.exec(d);
1795
- if (!e) return d;
1795
+ c(Ri, "flattenOnWhite");
1796
+ function $i(g, t) {
1797
+ const e = /rgba?\(([^)]+)\)/.exec(g);
1798
+ if (!e) return g;
1796
1799
  const [s, i, n, r = 1] = e[1].split(",").map(Number);
1797
1800
  return `rgba(${Math.round(s * t)},${Math.round(i * t)},${Math.round(n * t)},${r})`;
1798
1801
  }
1799
- u(Si, "darkenRgba");
1800
- const ms = class ms extends re {
1801
- constructor(t, e, s, i = new Ct()) {
1802
+ c($i, "darkenRgba");
1803
+ const Ss = class Ss extends _e {
1804
+ constructor(t, e, s, i = new Pt()) {
1802
1805
  super(t, e, s, i), this.__data__ = t, this.parent = e, this.graph = s, this.__children__ = i, this.__name__ = "unnamed-line", this._arrow_el = null, this._hit_el = null, this.svg_element = this.create();
1803
1806
  }
1804
1807
  /** Stamp edge identity onto an element so <qe-graph> delegation can resolve
1805
1808
  * qe-edge-* events. No-op for non-edges (e.g. axis lines). */
1806
1809
  _stampEdge(t) {
1807
1810
  const e = this.__data__.meta ?? {};
1808
- e.isMeanEdge && (t.setAttribute("data-edge-source", String(e.source ?? "")), t.setAttribute("data-edge-target", String(e.target ?? "")), t.setAttribute("data-edge-weight", String(e.weight ?? 0)), t.setAttribute("data-edge-directed", e.isDirected ? "true" : "false"), e.isSelf && t.setAttribute("data-edge-self", "true"), e.group != null && t.setAttribute("data-edge-group", String(e.group)), e.unit != null && t.setAttribute("data-edge-unit", String(e.unit)));
1811
+ if (!e.isMeanEdge) return;
1812
+ t.setAttribute("data-edge-source", String(e.source ?? "")), t.setAttribute("data-edge-target", String(e.target ?? "")), t.setAttribute("data-edge-weight", String(e.weight ?? 0)), t.setAttribute("data-edge-directed", e.isDirected ? "true" : "false");
1813
+ const s = /* @__PURE__ */ c((i, n) => n != null && n !== !1 ? t.setAttribute(i, n === !0 ? "true" : String(n)) : t.removeAttribute(i), "opt");
1814
+ s("data-edge-self", !!e.isSelf), s("data-edge-group", e.group), s("data-edge-unit", e.unit);
1809
1815
  }
1810
1816
  create() {
1811
- if (this.__data__ instanceof ne) {
1817
+ if (this.__data__ instanceof Ht) {
1812
1818
  const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
1813
1819
  return e.setAttribute("fill", this.__data__.color.toString()), e.setAttribute("stroke", "none"), this.svg_element = e, e;
1814
1820
  }
1815
- if (this.__data__ instanceof Wt) {
1821
+ if (this.__data__ instanceof Dt) {
1816
1822
  const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
1817
1823
  return e.setAttribute("fill", this.__data__.color.toString()), e.setAttribute("stroke", "none"), this.svg_element = e, e;
1818
1824
  }
1819
1825
  const t = document.createElementNS("http://www.w3.org/2000/svg", "line");
1820
1826
  return t.setAttribute("x1", this.__data__.from.x.toString()), t.setAttribute("y1", this.__data__.from.y.toString()), t.setAttribute("x2", this.__data__.to.x.toString()), t.setAttribute("y2", this.__data__.to.y.toString()), t.setAttribute("stroke-width", this.get_size().toString()), t.setAttribute("stroke", this.__data__.color.toString()), this.svg_element = t, t;
1821
1827
  }
1828
+ /** Self and directed edges draw as a <path>, everything else as a <line>. */
1829
+ get drawsPath() {
1830
+ return this.__data__ instanceof Ht || this.__data__ instanceof Dt;
1831
+ }
1822
1832
  update() {
1823
- var s;
1824
- this.svg_element || this.create(), this.svg_element.parentElement || this.parent.appendChild(this.svg_element);
1825
- const t = ((s = this.graph.__data__.extremes) == null ? void 0 : s.x_max) ?? 1, e = this.__data__.meta ?? {};
1833
+ var i, n, r, a;
1834
+ if (this.svg_element || this.create(), this.svg_element.tagName.toLowerCase() === "path" !== this.drawsPath) {
1835
+ const h = this.svg_element;
1836
+ this.create(), h.parentElement && h.replaceWith(this.svg_element);
1837
+ }
1838
+ this.drawsPath && ((i = this._hit_el) == null || i.remove(), this._hit_el = null), this.svg_element.parentElement || this.parent.appendChild(this.svg_element);
1839
+ const t = ((n = this.graph.__data__.extremes) == null ? void 0 : n.x_max) ?? 1, e = this.__data__.meta ?? {};
1840
+ let s = !1;
1826
1841
  if (e.isMeanEdge) {
1827
1842
  this._stampEdge(this.svg_element);
1828
- const i = typeof e.weight == "number" ? e.weight : 0, n = typeof e.maxWeight == "number" ? e.maxWeight : 1, r = typeof e.opacity == "number" ? e.opacity : Math.min(1, i / (n || 1)), a = t > 0 ? t : 1, h = typeof e.widthFrac == "number" ? a * e.widthFrac * i : a * mi * (i / (n || 1)), o = this.__data__._color || new st("#000000"), l = typeof e.saturation == "number" ? e.saturation : r, _ = new we(o, l, r).toString();
1829
- if (this.__data__ instanceof ne)
1830
- this.__data__.weight = h, this.svg_element.setAttribute("d", this.__data__.path), this.svg_element.setAttribute("fill", _), this.svg_element.setAttribute("stroke", "none");
1831
- else if (this.__data__ instanceof Wt) {
1832
- if (this.__data__.weight = h, this.svg_element.setAttribute("d", this.__data__.path), this.svg_element.setAttribute("fill", _), this.svg_element.setAttribute("stroke", _), this.svg_element.setAttribute("stroke-width", String(pi)), this.svg_element.setAttribute("vector-effect", "non-scaling-stroke"), this.svg_element.setAttribute("stroke-linejoin", "round"), e.isDirected)
1843
+ const h = typeof e.weight == "number" ? e.weight : 0, o = typeof e.maxWeight == "number" ? e.maxWeight : 1, _ = typeof e.opacity == "number" ? e.opacity : Math.min(1, h / (o || 1)), m = t > 0 ? t : 1, p = e.fixedSize && this.graph.zoom_level || 1, u = (typeof e.widthFrac == "number" ? m * e.widthFrac * h : m * Ni * (h / (o || 1))) / p, d = this.__data__._color || new st("#000000"), l = typeof e.saturation == "number" ? e.saturation : _, b = new Ne(d, l, _).toString();
1844
+ if (this.__data__ instanceof Ht) {
1845
+ const f = typeof e.selfSize == "number" && e.selfSize > 0 ? e.selfSize : null, w = f != null ? (a = (r = this.graph)._nodeRadius) == null ? void 0 : a.call(r, String(e.source)) : null;
1846
+ this.__data__.weight = typeof w == "number" ? 2 * f * w : u, this.svg_element.setAttribute("d", this.__data__.path), this.svg_element.setAttribute("fill", b), this.svg_element.setAttribute("stroke", "none");
1847
+ } else if (this.__data__ instanceof Dt) {
1848
+ if (this.__data__.weight = u, this.svg_element.setAttribute("d", this.__data__.path), this.svg_element.setAttribute("fill", b), this.svg_element.setAttribute("stroke", b), this.svg_element.setAttribute("stroke-width", String(ki)), this.svg_element.setAttribute("vector-effect", "non-scaling-stroke"), this.svg_element.setAttribute("stroke-linejoin", "round"), e.isDirected)
1833
1849
  try {
1834
- const c = new Ie(this.__data__).path;
1835
- c && !c.includes("NaN") && !c.includes("Infinity") && (this._arrow_el || (this._arrow_el = document.createElementNS("http://www.w3.org/2000/svg", "path"), this._arrow_el.setAttribute("stroke", "none")), this._arrow_el.parentElement || this.parent.appendChild(this._arrow_el), this._arrow_el.setAttribute("d", c), this._arrow_el.setAttribute("fill", Si(vi(_), bi)), this._arrow_el.setAttribute("stroke", "#ffffff"), this._arrow_el.setAttribute("stroke-width", String(yi)), this._arrow_el.setAttribute("vector-effect", "non-scaling-stroke"), this._arrow_el.setAttribute("stroke-linejoin", "round"));
1850
+ const w = new Le(this.__data__).path;
1851
+ w && !w.includes("NaN") && !w.includes("Infinity") && (this._arrow_el || (this._arrow_el = document.createElementNS("http://www.w3.org/2000/svg", "path"), this._arrow_el.setAttribute("stroke", "none")), this._arrow_el.parentElement || this.parent.appendChild(this._arrow_el), this._arrow_el.setAttribute("d", w), this._arrow_el.setAttribute("fill", $i(Ri(b), zi)), this._arrow_el.setAttribute("stroke", "#ffffff"), this._arrow_el.setAttribute("stroke-width", String(Ci)), this._arrow_el.setAttribute("vector-effect", "non-scaling-stroke"), this._arrow_el.setAttribute("stroke-linejoin", "round"), s = !0);
1836
1852
  } catch {
1837
1853
  }
1838
1854
  } else {
1839
- const g = this.__data__.from.x, c = this.__data__.from.y, E = this.__data__.to.x, m = this.__data__.to.y;
1840
- this.svg_element.setAttribute("x1", g.toString()), this.svg_element.setAttribute("y1", c.toString()), this.svg_element.setAttribute("x2", E.toString()), this.svg_element.setAttribute("y2", m.toString()), this.svg_element.setAttribute("stroke-width", h.toString()), this.svg_element.setAttribute("stroke", _), this.svg_element.setAttribute("pointer-events", "stroke"), this.svg_element.removeAttribute("marker-end"), this._hit_el || (this._hit_el = document.createElementNS("http://www.w3.org/2000/svg", "line"), this._hit_el.setAttribute("stroke", "transparent"), this._hit_el.setAttribute("stroke-linecap", "round"), this._hit_el.setAttribute("pointer-events", "stroke")), this._hit_el.parentElement || this.parent.appendChild(this._hit_el), this._hit_el.setAttribute("x1", g.toString()), this._hit_el.setAttribute("y1", c.toString()), this._hit_el.setAttribute("x2", E.toString()), this._hit_el.setAttribute("y2", m.toString()), this._hit_el.setAttribute("stroke-width", Math.max(h, t * 0.03).toString()), this._stampEdge(this._hit_el);
1855
+ const f = this.__data__.from.x, w = this.__data__.from.y, $ = this.__data__.to.x, z = this.__data__.to.y;
1856
+ this.svg_element.setAttribute("x1", f.toString()), this.svg_element.setAttribute("y1", w.toString()), this.svg_element.setAttribute("x2", $.toString()), this.svg_element.setAttribute("y2", z.toString()), this.svg_element.setAttribute("stroke-width", u.toString()), this.svg_element.setAttribute("stroke", b), this.svg_element.setAttribute("pointer-events", "stroke"), this.svg_element.removeAttribute("marker-end"), this._hit_el || (this._hit_el = document.createElementNS("http://www.w3.org/2000/svg", "line"), this._hit_el.setAttribute("stroke", "transparent"), this._hit_el.setAttribute("stroke-linecap", "round"), this._hit_el.setAttribute("pointer-events", "stroke")), this._hit_el.parentElement || this.parent.appendChild(this._hit_el), this._hit_el.setAttribute("x1", f.toString()), this._hit_el.setAttribute("y1", w.toString()), this._hit_el.setAttribute("x2", $.toString()), this._hit_el.setAttribute("y2", z.toString()), this._hit_el.setAttribute("stroke-width", Math.max(u, t * 0.03 / p).toString()), this._stampEdge(this._hit_el);
1841
1857
  }
1842
1858
  } else {
1843
1859
  this.svg_element.setAttribute("x1", this.__data__.from.x.toString()), this.svg_element.setAttribute("y1", this.__data__.from.y.toString()), this.svg_element.setAttribute("x2", this.__data__.to.x.toString()), this.svg_element.setAttribute("y2", this.__data__.to.y.toString());
1844
- const i = (t > 0 ? t : 1) * 4e-3 * this.get_size();
1845
- this.svg_element.setAttribute("stroke-width", i.toString()), this.svg_element.setAttribute("stroke-opacity", "1"), this.svg_element.setAttribute("stroke", this.__data__.color.toString());
1860
+ const h = this.graph._axesFixedSize && String(this.__data__.ID).startsWith("axis-") && this.graph.zoom_level || 1, o = (t > 0 ? t : 1) * 4e-3 * this.get_size() / h;
1861
+ this.svg_element.setAttribute("stroke-width", o.toString()), this.svg_element.setAttribute("stroke-opacity", "1"), this.svg_element.setAttribute("stroke", this.__data__.color.toString());
1846
1862
  }
1863
+ !s && this._arrow_el && (this._arrow_el.remove(), this._arrow_el = null);
1864
+ }
1865
+ /** Take the edge off the plot, with its hit target and chevron. */
1866
+ remove() {
1867
+ var t, e, s;
1868
+ (t = this.svg_element) == null || t.remove(), (e = this._hit_el) == null || e.remove(), (s = this._arrow_el) == null || s.remove();
1847
1869
  }
1848
1870
  draw() {
1849
1871
  var t, e, s;
1850
1872
  this._hit_el && ((t = this.parent) == null || t.appendChild(this._hit_el)), (e = this.parent) == null || e.appendChild(this.svg_element), this._arrow_el && ((s = this.parent) == null || s.appendChild(this._arrow_el));
1851
1873
  }
1852
1874
  };
1853
- u(ms, "QELine");
1854
- let St = ms;
1855
- const ps = class ps extends re {
1856
- constructor(t, e, s, i = new Ct()) {
1875
+ c(Ss, "QELine");
1876
+ let Mt = Ss;
1877
+ const Es = class Es extends _e {
1878
+ constructor(t, e, s, i = new Pt()) {
1857
1879
  super(t, e, s, i), this.__data__ = t, this.parent = e, this.graph = s, this.__children__ = i, this.__name__ = "unnamed-point", this.svg_element = this.create();
1858
1880
  }
1859
1881
  get x() {
@@ -1904,13 +1926,22 @@ const ps = class ps extends re {
1904
1926
  return typeof e == "number" && e > 0 ? Math.min(t, e) : t;
1905
1927
  }
1906
1928
  baseRadius() {
1907
- var s, i, n, r;
1908
- const t = this.graph.__data__.extremes.x_max || 1, e = ((s = this.__data__.meta) == null ? void 0 : s.sizeScale) ?? 1;
1909
- if ((i = this.__data__.meta) != null && i.fixedSize) {
1910
- const a = (r = (n = this.graph.svg_element) == null ? void 0 : n.getBoundingClientRect) == null ? void 0 : r.call(n), h = this.graph.zoom_level || 1, o = a && a.width > 0 ? a.width / (2 * t) : 1;
1911
- return this.__data__.size * 2 * e / o / h;
1929
+ var e;
1930
+ const t = this.dataRadius();
1931
+ return (e = this.__data__.meta) != null && e.zoomFixed ? t / (this.graph.zoom_level || 1) : t;
1932
+ }
1933
+ dataRadius() {
1934
+ var i, n, r, a, h, o, _;
1935
+ const t = this.graph.__data__.extremes.x_max || 1, e = ((i = this.__data__.meta) == null ? void 0 : i.sizeScale) ?? 1, s = (n = this.__data__.meta) == null ? void 0 : n.sizePx;
1936
+ if (typeof s == "number" && s > 0) {
1937
+ const m = (a = (r = this.graph.svg_element) == null ? void 0 : r.getBoundingClientRect) == null ? void 0 : a.call(r), p = m && m.width > 0 ? 2 * t / m.width : t * 4e-3;
1938
+ return s / 2 * p;
1939
+ }
1940
+ if ((h = this.__data__.meta) != null && h.fixedSize) {
1941
+ const m = (_ = (o = this.graph.svg_element) == null ? void 0 : o.getBoundingClientRect) == null ? void 0 : _.call(o), p = this.graph.zoom_level || 1, u = m && m.width > 0 ? m.width / (2 * t) : 1;
1942
+ return this.__data__.size * 2 * e / u / p;
1912
1943
  }
1913
- return t * ei * this.__data__.size * e;
1944
+ return t * ui * this.__data__.size * e;
1914
1945
  }
1915
1946
  /** Optional halo stroke (e.g. white outline on unit points to separate
1916
1947
  * overlapping dots in dense clusters). Width scales with the dot so it holds
@@ -1920,33 +1951,42 @@ const ps = class ps extends re {
1920
1951
  const e = (s = this.__data__.meta) == null ? void 0 : s.stroke;
1921
1952
  e && (t.setAttribute("stroke", e), t.setAttribute("stroke-width", (this.computeRadius() * 0.22).toString()));
1922
1953
  }
1954
+ /** Identity for <qe-graph> delegation → qe-node-* interaction events.
1955
+ * Re-applied on update(), since the element outlives renders. */
1956
+ stampIdentity(t) {
1957
+ t.setAttribute("data-point-id", this.__data__.ID);
1958
+ const e = this.__data__.meta ?? {}, s = /* @__PURE__ */ c((i, n) => n != null && n !== "" ? t.setAttribute(i, String(n)) : t.removeAttribute(i), "opt");
1959
+ s("data-kind", e.kind), s("data-name", e.name), s("data-group", e.group), s("data-unit", e.unit);
1960
+ }
1923
1961
  create() {
1924
1962
  const t = document.createElementNS("http://www.w3.org/2000/svg", this.tag);
1925
- t.setAttribute("data-point-id", this.__data__.ID);
1926
- const e = this.__data__.meta ?? {};
1927
- return e.kind && t.setAttribute("data-kind", e.kind), e.name != null && t.setAttribute("data-name", String(e.name)), e.group != null && t.setAttribute("data-group", String(e.group)), e.unit != null && t.setAttribute("data-unit", String(e.unit)), t.setAttribute("fill", this.__data__.color.toString()), this.applyStroke(t), this.setGeometry(t, this.computeRadius()), this.svg_element = t, t.addEventListener("click", () => {
1963
+ return this.stampIdentity(t), t.setAttribute("fill", this.__data__.color.toString()), this.applyStroke(t), this.setGeometry(t, this.computeRadius()), this.svg_element = t, t.addEventListener("click", () => {
1928
1964
  this.__data__.active = !this.__data__.active, this.update();
1929
- const s = new CustomEvent("point-clicked", {
1965
+ const e = new CustomEvent("point-clicked", {
1930
1966
  detail: { pointData: this.__data__ },
1931
1967
  bubbles: !0,
1932
1968
  composed: !0
1933
1969
  });
1934
- this.svg_element.dispatchEvent(s);
1970
+ this.svg_element.dispatchEvent(e);
1935
1971
  }), t.addEventListener("mouseover", () => {
1936
1972
  }), t;
1937
1973
  }
1938
1974
  update() {
1939
- this.svg_element || this.parent.__data__.__children__.push(this.create()), this.svg_element.parentElement || this.parent.appendChild(this.svg_element), this.svg_element.setAttribute("fill", this.__data__.color.toString()), this.applyStroke(this.svg_element), this.setGeometry(this.svg_element, this.computeRadius());
1975
+ if (this.svg_element || this.parent.__data__.__children__.push(this.create()), this.svg_element.tagName.toLowerCase() !== this.tag) {
1976
+ const t = this.svg_element;
1977
+ this.create(), t.parentElement && t.replaceWith(this.svg_element);
1978
+ }
1979
+ this.svg_element.parentElement || this.parent.appendChild(this.svg_element), this.stampIdentity(this.svg_element), this.svg_element.setAttribute("fill", this.__data__.color.toString()), this.applyStroke(this.svg_element), this.setGeometry(this.svg_element, this.computeRadius());
1940
1980
  }
1941
1981
  draw() {
1942
1982
  var t;
1943
1983
  (t = this.parent) == null || t.appendChild(this.svg_element);
1944
1984
  }
1945
1985
  };
1946
- u(ps, "QEPoint");
1947
- let oe = ps;
1948
- const bs = class bs extends re {
1949
- constructor(t, e, s, i = new Ct()) {
1986
+ c(Es, "QEPoint");
1987
+ let ue = Es;
1988
+ const Ms = class Ms extends _e {
1989
+ constructor(t, e, s, i = new Pt()) {
1950
1990
  super(t, e, s, i), this.__data__ = t, this.parent = e, this.graph = s, this.__children__ = i, this.__name__ = "trajectory", this._path_el = null, this._segments_group = null, this._tip_el = null, this._points_group = null, this.svg_element = this.create();
1951
1991
  }
1952
1992
  // Trajectory styling is specified in display pixels, while SVG paths use
@@ -1977,8 +2017,8 @@ const bs = class bs extends re {
1977
2017
  if (this._segments_group.innerHTML = "", this.__data__.lineStyle === "tapered") {
1978
2018
  const s = this.__data__.pathPoints, i = s.length - 1, [n, r] = this.__data__.strokeWidthRange, [a, h] = this.__data__.opacityRange;
1979
2019
  for (let o = 0; o < i; o++) {
1980
- const l = s[o], _ = s[o + 1], g = i <= 1 ? 1 : o / (i - 1), c = n + (r - n) * g, E = a + (h - a) * g, m = document.createElementNS("http://www.w3.org/2000/svg", "path");
1981
- m.setAttribute("d", `M${l.x},${l.y} L${_.x},${_.y}`), m.setAttribute("fill", "none"), m.setAttribute("stroke", this.__data__.color.toString()), m.setAttribute("stroke-linecap", "round"), m.setAttribute("stroke-linejoin", "round"), m.setAttribute("stroke-width", this.graphUnitsForPixels(c).toString()), m.setAttribute("opacity", E.toString()), this._segments_group.appendChild(m);
2020
+ const _ = s[o], m = s[o + 1], p = i <= 1 ? 1 : o / (i - 1), u = n + (r - n) * p, d = a + (h - a) * p, l = document.createElementNS("http://www.w3.org/2000/svg", "path");
2021
+ l.setAttribute("d", `M${_.x},${_.y} L${m.x},${m.y}`), l.setAttribute("fill", "none"), l.setAttribute("stroke", this.__data__.color.toString()), l.setAttribute("stroke-linecap", "round"), l.setAttribute("stroke-linejoin", "round"), l.setAttribute("stroke-width", this.graphUnitsForPixels(u).toString()), l.setAttribute("opacity", d.toString()), this._segments_group.appendChild(l);
1982
2022
  }
1983
2023
  this._segments_group.style.display = "block";
1984
2024
  } else
@@ -1999,9 +2039,9 @@ const bs = class bs extends re {
1999
2039
  this.svg_element && !this.svg_element.parentElement && this.parent.appendChild(this.svg_element), this.update();
2000
2040
  }
2001
2041
  };
2002
- u(bs, "QETrajectory");
2003
- let Ne = bs;
2004
- const { ArrayTools: Ws } = ie, ys = class ys extends Array {
2042
+ c(Ms, "QETrajectory");
2043
+ let Re = Ms;
2044
+ const { ArrayTools: ri } = ce, Is = class Is extends Array {
2005
2045
  constructor(...t) {
2006
2046
  super(...t);
2007
2047
  }
@@ -2010,67 +2050,68 @@ const { ArrayTools: Ws } = ie, ys = class ys extends Array {
2010
2050
  function i(r) {
2011
2051
  return r.name === e ? r : void 0;
2012
2052
  }
2013
- u(i, "fn");
2053
+ c(i, "fn");
2014
2054
  function n(r, a, h = null) {
2015
- if (Ws.isArray(r)) {
2016
- for (const [o, l] of r.entries())
2017
- if (s = n(l, o, h), s)
2055
+ if (ri.isArray(r)) {
2056
+ for (const [o, _] of r.entries())
2057
+ if (s = n(_, o, h), s)
2018
2058
  return s;
2019
2059
  } else {
2020
2060
  if (s = i(r), s)
2021
2061
  return s;
2022
- if (r && Ws.isArray(r[t])) {
2023
- for (const [o, l] of r[t].entries())
2024
- if (s = n(l, o, r), s)
2062
+ if (r && ri.isArray(r[t])) {
2063
+ for (const [o, _] of r[t].entries())
2064
+ if (s = n(_, o, r), s)
2025
2065
  return s;
2026
2066
  }
2027
2067
  }
2028
2068
  return s;
2029
2069
  }
2030
- return u(n, "recurse"), n(this);
2070
+ return c(n, "recurse"), n(this);
2031
2071
  }
2032
2072
  flatten() {
2033
2073
  return this.reduce((t, e) => (t.push(e), e.layers && Array.isArray(e.layers) && t.push(...e.layers), t), []);
2034
2074
  }
2035
2075
  };
2036
- u(ys, "QEArray");
2037
- let Ct = ys;
2038
- const Ei = {
2039
- AxisPoint: oe,
2040
- AxisLine: St,
2041
- Point: oe,
2042
- Line: St,
2043
- Edge: St,
2044
- TaperedEdge: St,
2045
- TaperedWeightedMidpointEdge: St,
2046
- NodeEdge: St,
2047
- Trajectory: Ne
2048
- }, jt = class jt {
2049
- constructor(t, e, s, i = new Ct()) {
2076
+ c(Is, "QEArray");
2077
+ let Pt = Is;
2078
+ const Ti = {
2079
+ AxisPoint: ue,
2080
+ AxisLine: Mt,
2081
+ Point: ue,
2082
+ Line: Mt,
2083
+ Edge: Mt,
2084
+ TaperedEdge: Mt,
2085
+ TaperedWeightedMidpointEdge: Mt,
2086
+ NodeEdge: Mt,
2087
+ Trajectory: Re
2088
+ }, Ut = class Ut {
2089
+ constructor(t, e, s, i = new Pt()) {
2050
2090
  this.__data__ = t, this.parent = e, this.graph = s, this.__children__ = i, this.__name__ = t.name || "unnamed-layer", t.__state__.addListener("layer_updated", "live", ({ key: n, newValue: r, oldValue: a }) => {
2051
- const h = /* @__PURE__ */ u((g) => {
2052
- var c;
2053
- return (c = g.__data__) == null ? void 0 : c.ID;
2091
+ const h = /* @__PURE__ */ c((p) => {
2092
+ var u;
2093
+ return (u = p.__data__) == null ? void 0 : u.ID;
2054
2094
  }, "childId"), o = this.__children__.filter(
2055
- (g) => !r.objects.has(h(g))
2056
- ), l = this.__children__.filter(
2057
- (g) => r.objects.has(h(g))
2095
+ (p) => !r.objects.has(h(p))
2096
+ ), _ = this.__children__.filter(
2097
+ (p) => r.objects.has(h(p))
2058
2098
  );
2059
2099
  [...r.objects.values()].filter(
2060
- (g) => !this.__children__.some((c) => h(c) === g.ID)
2061
- ).forEach((g) => {
2062
- const c = g._typeName || g.constructor.name;
2063
- let E = Ei[c];
2064
- E || (g instanceof Ee ? E = Ne : g instanceof J ? E = oe : E = St);
2065
- const m = new E(g, this.svg_element, this.graph);
2066
- this.__children__.push(m);
2067
- }), l.forEach((g) => {
2068
- const c = r.objects.get(h(g));
2069
- c && (g.__data__ = c), g.update();
2070
- }), o.forEach((g) => {
2071
- g.svg_element.parentElement && g.svg_element.parentElement.removeChild(g.svg_element);
2072
- const c = this.__children__.indexOf(g);
2073
- c >= 0 && this.__children__.splice(c, 1);
2100
+ (p) => !this.__children__.some((u) => h(u) === p.ID)
2101
+ ).forEach((p) => {
2102
+ const u = p._typeName || p.constructor.name;
2103
+ let d = Ti[u];
2104
+ d || (p instanceof Oe ? d = Re : p instanceof K ? d = ue : d = Mt);
2105
+ const l = new d(p, this.svg_element, this.graph);
2106
+ this.__children__.push(l);
2107
+ }), _.forEach((p) => {
2108
+ const u = r.objects.get(h(p));
2109
+ u && (p.__data__ = u), p.update();
2110
+ }), o.forEach((p) => {
2111
+ var d;
2112
+ typeof p.remove == "function" ? p.remove() : (d = p.svg_element.parentElement) == null || d.removeChild(p.svg_element);
2113
+ const u = this.__children__.indexOf(p);
2114
+ u >= 0 && this.__children__.splice(u, 1);
2074
2115
  }), this.update();
2075
2116
  }), this.svg_element = this.create();
2076
2117
  }
@@ -2081,8 +2122,8 @@ const Ei = {
2081
2122
  if (!this.__data__)
2082
2123
  throw new Error("Layer is null");
2083
2124
  let t = this.__data__;
2084
- return this.svg_element = document.createElementNS("http://www.w3.org/2000/svg", jt.tagName), this.svg_element.setAttribute("data-layer-name", t.name), this.svg_element.setAttribute("data-layer-id", t.ID), this.svg_element.__data__ = t, this.svg_element.classList.add("ena-layer"), this.__data__.layers && this.__data__.layers.length > 0 && this.__data__.layers.forEach((e) => {
2085
- const s = new jt(e, this.svg_element, this.graph);
2125
+ return this.svg_element = document.createElementNS("http://www.w3.org/2000/svg", Ut.tagName), this.svg_element.setAttribute("data-layer-name", t.name), this.svg_element.setAttribute("data-layer-id", t.ID), this.svg_element.__data__ = t, this.svg_element.classList.add("ena-layer"), this.__data__.layers && this.__data__.layers.length > 0 && this.__data__.layers.forEach((e) => {
2126
+ const s = new Ut(e, this.svg_element, this.graph);
2086
2127
  this.__children__.push(s);
2087
2128
  }), this.svg_element;
2088
2129
  }
@@ -2103,42 +2144,79 @@ const Ei = {
2103
2144
  this.__children__.push(t);
2104
2145
  }
2105
2146
  };
2106
- u(jt, "QELayer"), jt.tagName = "g";
2107
- let ts = jt;
2108
- const xs = class xs {
2109
- constructor(t, e, s, i, n = H.DISPLAY_TYPES.ON, r = H.POSITION.OBJECT, a, h) {
2110
- this.text = t, this.point = e, this.parent = s, this.graph = i, this.displayMode = n, this.position = r, this.customX = a, this.customY = h, this._visible = !1, this._offsetX = 0, this._offsetY = 0, this.pinned = !1, this.svg_element = this._create(), n === H.DISPLAY_TYPES.ON ? (this._visible = !0, this.svg_element.setAttribute("display", "block")) : (this._visible = !1, this.svg_element.setAttribute("display", "none"));
2147
+ c(Ut, "QELayer"), Ut.tagName = "g";
2148
+ let as = Ut;
2149
+ const Ns = class Ns {
2150
+ constructor(t, e, s, i, n = q.DISPLAY_TYPES.ON, r = q.POSITION.OBJECT, a, h) {
2151
+ this.text = t, this.parent = s, this.graph = i, this.displayMode = n, this.position = r, this.customX = a, this.customY = h, this._visible = !1, this._offsetX = 0, this._offsetY = 0, this.pinned = !1, this._hostPinned = !1, this.fontWeight = null, this._point = e, this.svg_element = this._create(), n === q.DISPLAY_TYPES.ON ? (this._visible = !0, this.svg_element.setAttribute("display", "block")) : (this._visible = !1, this.svg_element.setAttribute("display", "none"));
2152
+ }
2153
+ /** The mark this label follows. Rebound by setPoint() on every render. */
2154
+ get point() {
2155
+ return this._point;
2111
2156
  }
2112
2157
  _create() {
2113
2158
  const t = document.createElementNS("http://www.w3.org/2000/svg", "text");
2114
2159
  return t.textContent = this.text, t.setAttribute("data-label-for", this.point.ID), t.setAttribute("pointer-events", "auto"), t.style.cursor = "grab", this._attachDrag(t), this.parent.appendChild(t), t;
2115
2160
  }
2116
- /** Drag to reposition; pins the label open and emits qe-label-move on drop. */
2161
+ /**
2162
+ * Follow a new Point for the same mark. Each render builds fresh Point
2163
+ * objects, so a label reused across renders must be rebound or it keeps the
2164
+ * old coordinates. A dragged label keeps its offset from the mark.
2165
+ */
2166
+ setPoint(t) {
2167
+ this._point = t, this.svg_element.setAttribute("data-label-for", t.ID);
2168
+ }
2169
+ /** Host-set offset (graph units, y down), as qe-label-move reports it. */
2170
+ setOffset(t, e) {
2171
+ this._offsetX = Number.isFinite(t) ? t : 0, this._offsetY = Number.isFinite(e) ? e : 0;
2172
+ }
2173
+ /** Keep the label shown whatever its display mode (or stop doing so). */
2174
+ setHostPinned(t) {
2175
+ t !== this._hostPinned && (this._hostPinned = t, t ? this.show() : this.displayMode !== q.DISPLAY_TYPES.ON && this.hide());
2176
+ }
2177
+ /** Drag to reposition (mouse, or a finger); pins the label open and
2178
+ * emits qe-label-move on drop. */
2117
2179
  _attachDrag(t) {
2118
2180
  t.addEventListener("mousedown", (e) => {
2119
- e.preventDefault(), e.stopPropagation();
2120
- const s = t.ownerSVGElement;
2121
- if (!s) return;
2122
- const i = /* @__PURE__ */ u((l, _) => {
2123
- const g = s.createSVGPoint();
2124
- g.x = l, g.y = _;
2125
- const c = s.getScreenCTM();
2126
- return c ? g.matrixTransform(c.inverse()) : { x: 0, y: 0 };
2127
- }, "toUser"), n = i(e.clientX, e.clientY), r = this._offsetX, a = this._offsetY;
2128
- t.style.cursor = "grabbing";
2129
- const h = /* @__PURE__ */ u((l) => {
2130
- const _ = i(l.clientX, l.clientY);
2131
- this._offsetX = r + (_.x - n.x), this._offsetY = a + (_.y - n.y), this.pinned = !0, this._visible = !0, this.svg_element.setAttribute("display", "block"), this.update();
2132
- }, "onMove"), o = /* @__PURE__ */ u(() => {
2133
- document.removeEventListener("mousemove", h), document.removeEventListener("mouseup", o), t.style.cursor = "grab", this.graph.dispatchEvent(new CustomEvent("qe-label-move", {
2134
- detail: { id: this.point.ID, transform: { x: this._offsetX, y: this._offsetY } },
2135
- bubbles: !0,
2136
- composed: !0
2137
- }));
2138
- }, "onUp");
2139
- document.addEventListener("mousemove", h), document.addEventListener("mouseup", o);
2181
+ e.preventDefault(), e.stopPropagation(), this._drag(t, e.clientX, e.clientY, "mouse");
2182
+ }), t.addEventListener("pointerdown", (e) => {
2183
+ e.pointerType === "touch" && (e.preventDefault(), e.stopPropagation(), this._drag(t, e.clientX, e.clientY, e.pointerId));
2140
2184
  });
2141
2185
  }
2186
+ _drag(t, e, s, i) {
2187
+ const n = t.parentNode ?? t.ownerSVGElement, r = t.ownerSVGElement;
2188
+ if (!r || !n) return;
2189
+ const a = /* @__PURE__ */ c((u, d) => {
2190
+ const l = r.createSVGPoint();
2191
+ l.x = u, l.y = d;
2192
+ const b = n.getScreenCTM();
2193
+ return b ? l.matrixTransform(b.inverse()) : { x: 0, y: 0 };
2194
+ }, "toUser"), h = a(e, s), o = this._offsetX, _ = this._offsetY;
2195
+ t.style.cursor = "grabbing";
2196
+ const m = /* @__PURE__ */ c((u, d) => {
2197
+ const l = a(u, d);
2198
+ this._offsetX = o + (l.x - h.x), this._offsetY = _ + (l.y - h.y), this.pinned = !0, this._visible = !0, this.svg_element.setAttribute("display", "block"), this.update();
2199
+ }, "move"), p = /* @__PURE__ */ c(() => {
2200
+ t.style.cursor = "grab", this.graph.dispatchEvent(new CustomEvent("qe-label-move", {
2201
+ detail: { id: this.point.ID, transform: { x: this._offsetX, y: this._offsetY } },
2202
+ bubbles: !0,
2203
+ composed: !0
2204
+ }));
2205
+ }, "done");
2206
+ if (i === "mouse") {
2207
+ const u = /* @__PURE__ */ c((l) => m(l.clientX, l.clientY), "onMove"), d = /* @__PURE__ */ c(() => {
2208
+ document.removeEventListener("mousemove", u), document.removeEventListener("mouseup", d), p();
2209
+ }, "onUp");
2210
+ document.addEventListener("mousemove", u), document.addEventListener("mouseup", d);
2211
+ } else {
2212
+ const u = /* @__PURE__ */ c((l) => {
2213
+ l.pointerId === i && m(l.clientX, l.clientY);
2214
+ }, "onMove"), d = /* @__PURE__ */ c((l) => {
2215
+ l.pointerId === i && (document.removeEventListener("pointermove", u), document.removeEventListener("pointerup", d), document.removeEventListener("pointercancel", d), p());
2216
+ }, "onUp");
2217
+ document.addEventListener("pointermove", u), document.addEventListener("pointerup", d), document.addEventListener("pointercancel", d);
2218
+ }
2219
+ }
2142
2220
  /**
2143
2221
  * Recompute position and font-size from current graph extents.
2144
2222
  * No-ops when the label is hidden (AUTO/CLICK modes while not hovered/clicked).
@@ -2151,35 +2229,75 @@ const xs = class xs {
2151
2229
  const e = this.graph._labelFont ?? {}, s = e.size ? e.size * this.graph.unitsPerPixel() : t * 0.06, i = s * 1.2;
2152
2230
  let n, r, a;
2153
2231
  switch (this.position) {
2154
- case H.POSITION.STATIC: {
2232
+ case q.POSITION.STATIC: {
2155
2233
  n = this.point.x, r = this.point.y - i * 0.3, a = "middle";
2156
2234
  break;
2157
2235
  }
2158
- case H.POSITION.CONTAINER: {
2159
- const { cx: o, cy: l } = this.graph.__data__.extremes, _ = this.point.x - o, g = this.point.y - l, c = Math.sqrt(_ * _ + g * g) || 1, E = t * 0.93 / c;
2160
- n = o + _ * E, r = l + g * E - i * 0.3, a = _ >= 0 ? "start" : "end";
2236
+ case q.POSITION.CONTAINER: {
2237
+ const { cx: o, cy: _ } = this.graph.__data__.extremes, m = this.point.x - o, p = this.point.y - _, u = Math.sqrt(m * m + p * p) || 1, d = t * 0.93 / u;
2238
+ n = o + m * d, r = _ + p * d - i * 0.3, a = m >= 0 ? "start" : "end";
2161
2239
  break;
2162
2240
  }
2163
- case H.POSITION.CUSTOM:
2241
+ case q.POSITION.CUSTOM:
2164
2242
  if (this.customX != null && this.customY != null) {
2165
2243
  n = this.customX, r = this.customY, a = "start";
2166
2244
  break;
2167
2245
  }
2168
2246
  default:
2169
- case H.POSITION.OBJECT: {
2247
+ case q.POSITION.OBJECT: {
2170
2248
  const o = this.point.x >= 0 ? i : -i;
2171
2249
  a = this.point.x >= 0 ? "start" : "end", n = this.point.x + o, r = this.point.y - i * 0.4;
2172
2250
  break;
2173
2251
  }
2174
2252
  }
2175
- this.svg_element.setAttribute("x", n.toString()), this.svg_element.setAttribute("y", r.toString()), (this._offsetX || this._offsetY) && this.svg_element.setAttribute("transform", `translate(${this._offsetX}, ${this._offsetY})`), this.svg_element.setAttribute("font-size", s.toString()), this.svg_element.setAttribute("font-family", e.family ?? "system-ui, sans-serif"), this.svg_element.setAttribute("font-weight", "500"), this.svg_element.setAttribute("text-anchor", a), this.svg_element.setAttribute("fill", e.color ?? ((h = this.point.color) == null ? void 0 : h.toString()) ?? "#333333");
2253
+ this.svg_element.setAttribute("x", n.toString()), this.svg_element.setAttribute("y", r.toString()), this._offsetX || this._offsetY ? this.svg_element.setAttribute("transform", `translate(${this._offsetX}, ${this._offsetY})`) : this.svg_element.removeAttribute("transform"), this.svg_element.setAttribute("font-size", s.toString()), this.svg_element.setAttribute("font-family", e.family ?? "system-ui, sans-serif"), this.svg_element.setAttribute("font-weight", this.fontWeight ?? "500"), this.svg_element.setAttribute("text-anchor", a), this.svg_element.setAttribute("fill", e.color ?? ((h = this.point.color) == null ? void 0 : h.toString()) ?? "#333333"), !this._offsetX && !this._offsetY && this.position !== q.POSITION.CUSTOM && this.fitInside(n, r, a, i, s * 0.3);
2254
+ }
2255
+ /** The visible plot area in this label's coordinates (so zoom, pan and the
2256
+ * viewBox's letterboxing are accounted for), or null if not laid out. */
2257
+ visibleBounds() {
2258
+ var h;
2259
+ const t = this.svg_element, e = t.ownerSVGElement, s = (h = t.getScreenCTM) == null ? void 0 : h.call(t);
2260
+ if (!e || !s) return null;
2261
+ const i = e.getBoundingClientRect();
2262
+ if (!(i.width > 0 && i.height > 0)) return null;
2263
+ const n = s.inverse(), r = new DOMPoint(i.left, i.top).matrixTransform(n), a = new DOMPoint(i.right, i.bottom).matrixTransform(n);
2264
+ return {
2265
+ left: Math.min(r.x, a.x),
2266
+ right: Math.max(r.x, a.x),
2267
+ top: Math.min(r.y, a.y),
2268
+ bottom: Math.max(r.y, a.y)
2269
+ };
2270
+ }
2271
+ bbox() {
2272
+ try {
2273
+ const t = this.svg_element.getBBox();
2274
+ return t.width > 0 ? t : null;
2275
+ } catch {
2276
+ return null;
2277
+ }
2278
+ }
2279
+ /** If the label runs past an edge: put an outward label on the other side
2280
+ * of its point, and if it still doesn't fit, slide it back inside. */
2281
+ fitInside(t, e, s, i, n) {
2282
+ const r = this.visibleBounds();
2283
+ let a = this.bbox();
2284
+ if (!r || !a) return;
2285
+ const h = r.left + n, o = r.right - n, _ = r.top + n, m = r.bottom - n, p = /* @__PURE__ */ c((b) => Math.max(0, h - b.x) + Math.max(0, b.x + b.width - o), "over"), u = this.svg_element;
2286
+ if (p(a) > 0 && this.position === q.POSITION.OBJECT && s !== "middle") {
2287
+ const b = s === "end" ? "start" : "end", f = s === "end" ? this.point.x + i : this.point.x - i;
2288
+ u.setAttribute("text-anchor", b), u.setAttribute("x", f.toString());
2289
+ const w = this.bbox();
2290
+ w && p(w) < p(a) ? (a = w, t = f) : (u.setAttribute("text-anchor", s), u.setAttribute("x", t.toString()));
2291
+ }
2292
+ let d = 0, l = 0;
2293
+ a.x < h ? d = h - a.x : a.x + a.width > o && (d = Math.max(o - (a.x + a.width), h - a.x)), a.y < _ ? l = _ - a.y : a.y + a.height > m && (l = Math.max(m - (a.y + a.height), _ - a.y)), d && u.setAttribute("x", (t + d).toString()), l && u.setAttribute("y", (e + l).toString());
2176
2294
  }
2177
2295
  /** Make the label visible and position it immediately. */
2178
2296
  show() {
2179
2297
  this._visible = !0, this.svg_element.setAttribute("display", "block"), this.update();
2180
2298
  }
2181
2299
  hide() {
2182
- this.pinned || (this._visible = !1, this.svg_element.setAttribute("display", "none"));
2300
+ this.pinned || this._hostPinned || (this._visible = !1, this.svg_element.setAttribute("display", "none"));
2183
2301
  }
2184
2302
  toggle() {
2185
2303
  this._visible ? this.hide() : this.show();
@@ -2191,39 +2309,39 @@ const xs = class xs {
2191
2309
  this.svg_element.remove();
2192
2310
  }
2193
2311
  };
2194
- u(xs, "QELabel");
2195
- let Jt = xs;
2196
- const je = class je extends HTMLElement {
2312
+ c(Ns, "QELabel");
2313
+ let hs = Ns;
2314
+ const We = class We extends HTMLElement {
2197
2315
  };
2198
- u(je, "QENodesElement"), je.tagName = "qe-nodes";
2199
- let ke = je;
2200
- const Ye = class Ye extends HTMLElement {
2316
+ c(We, "QENodesElement"), We.tagName = "qe-nodes";
2317
+ let $e = We;
2318
+ const He = class He extends HTMLElement {
2201
2319
  };
2202
- u(Ye, "QEMeansElement"), Ye.tagName = "qe-means";
2203
- let Ce = Ye;
2204
- const qe = class qe extends HTMLElement {
2320
+ c(He, "QEMeansElement"), He.tagName = "qe-means";
2321
+ let Te = He;
2322
+ const Ve = class Ve extends HTMLElement {
2205
2323
  };
2206
- u(qe, "QEPointsElement"), qe.tagName = "qe-points";
2207
- let Oe = qe;
2208
- const Ue = class Ue extends HTMLElement {
2324
+ c(Ve, "QEPointsElement"), Ve.tagName = "qe-points";
2325
+ let Fe = Ve;
2326
+ const Ze = class Ze extends HTMLElement {
2209
2327
  };
2210
- u(Ue, "QEEdgesElement"), Ue.tagName = "qe-edges";
2211
- let $e = Ue;
2212
- const Ge = class Ge extends HTMLElement {
2328
+ c(Ze, "QEEdgesElement"), Ze.tagName = "qe-edges";
2329
+ let De = Ze;
2330
+ const Ke = class Ke extends HTMLElement {
2213
2331
  };
2214
- u(Ge, "QETrajectoriesElement"), Ge.tagName = "qe-trajectories";
2215
- let Pe = Ge;
2216
- const Be = class Be extends HTMLElement {
2332
+ c(Ke, "QETrajectoriesElement"), Ke.tagName = "qe-trajectories";
2333
+ let je = Ke;
2334
+ const Je = class Je extends HTMLElement {
2217
2335
  };
2218
- u(Be, "QEAxesElement"), Be.tagName = "qe-axes";
2219
- let Re = Be;
2220
- customElements.define(ke.tagName, ke);
2221
- customElements.define(Ce.tagName, Ce);
2222
- customElements.define(Oe.tagName, Oe);
2336
+ c(Je, "QEAxesElement"), Je.tagName = "qe-axes";
2337
+ let Ye = Je;
2223
2338
  customElements.define($e.tagName, $e);
2224
- customElements.define(Pe.tagName, Pe);
2225
- customElements.define(Re.tagName, Re);
2226
- const Vs = [
2339
+ customElements.define(Te.tagName, Te);
2340
+ customElements.define(Fe.tagName, Fe);
2341
+ customElements.define(De.tagName, De);
2342
+ customElements.define(je.tagName, je);
2343
+ customElements.define(Ye.tagName, Ye);
2344
+ const oi = [
2227
2345
  "#4477AA",
2228
2346
  "#EE6677",
2229
2347
  "#228833",
@@ -2233,42 +2351,66 @@ const Vs = [
2233
2351
  "#BBBBBB",
2234
2352
  "#000000"
2235
2353
  ];
2236
- function Mi(d, t) {
2354
+ function Fi(g, t) {
2237
2355
  for (const e of t)
2238
- if (d === `${e}.${e}`) return [e, e];
2356
+ if (g === `${e}.${e}`) return [e, e];
2239
2357
  for (const e of t)
2240
- if (d.startsWith(e + ".")) {
2241
- const s = d.slice(e.length + 1);
2358
+ if (g.startsWith(e + ".")) {
2359
+ const s = g.slice(e.length + 1);
2242
2360
  if (t.includes(s)) return [e, s];
2243
2361
  }
2244
2362
  return null;
2245
2363
  }
2246
- u(Mi, "parseEdgePair");
2247
- function Ii(d, t, e, s) {
2248
- const i = Math.max(1, e - 1), n = i >= 120 ? 1.96 : i >= 60 ? 2 : i >= 30 ? 2.042 : i >= 20 ? 2.086 : i >= 10 ? 2.228 : i >= 5 ? 2.571 : 4.303, r = Math.sqrt(Math.max(0, d) / e) * s, a = Math.sqrt(Math.max(0, t) / e) * s;
2364
+ c(Fi, "parseEdgePair");
2365
+ function Di(g, t, e, s) {
2366
+ const i = Math.max(1, e - 1), n = i >= 120 ? 1.96 : i >= 60 ? 2 : i >= 30 ? 2.042 : i >= 20 ? 2.086 : i >= 10 ? 2.228 : i >= 5 ? 2.571 : 4.303, r = Math.sqrt(Math.max(0, g) / e) * s, a = Math.sqrt(Math.max(0, t) / e) * s;
2249
2367
  return { halfW: n * r, halfH: n * a };
2250
2368
  }
2251
- u(Ii, "computeCIRect");
2252
- const Ni = 0.5;
2253
- function pe(d, t, e) {
2254
- if (!d) return;
2369
+ c(Di, "computeCIRect");
2370
+ const ji = 0.5;
2371
+ function ve(g, t, e) {
2372
+ if (!g) return;
2255
2373
  const s = Math.min(Math.abs(t), Math.abs(e));
2256
- s > 0 && (d.meta = { ...d.meta ?? {}, maxRadius: s * Ni });
2374
+ s > 0 && (g.meta = { ...g.meta ?? {}, maxRadius: s * ji });
2257
2375
  }
2258
- u(pe, "capMeanToInterval");
2259
- function be(d, t, e, s = "") {
2260
- const i = /* @__PURE__ */ u((o) => {
2261
- const l = d.names.indexOf(o), _ = l >= 0 ? d[l] : null;
2262
- if (_ == null || _ === "") return;
2263
- const g = Number(_);
2264
- return Number.isFinite(g) ? g : void 0;
2376
+ c(ve, "capMeanToInterval");
2377
+ function Ae(g, t, e, s = "") {
2378
+ const i = /* @__PURE__ */ c((o) => {
2379
+ const _ = g.names.indexOf(o), m = _ >= 0 ? g[_] : null;
2380
+ if (m == null || m === "") return;
2381
+ const p = Number(m);
2382
+ return Number.isFinite(p) ? p : void 0;
2265
2383
  }, "get"), n = i(`${t}.${s}low`) ?? i(`${t}_${s}low`), r = i(`${t}.${s}high`) ?? i(`${t}_${s}high`), a = i(`${e}.${s}low`) ?? i(`${e}_${s}low`), h = i(`${e}.${s}high`) ?? i(`${e}_${s}high`);
2266
2384
  return n == null || r == null || a == null || h == null ? null : { x_low: n, x_high: r, y_low: a, y_high: h };
2267
2385
  }
2268
- u(be, "readIntervalBounds");
2269
- function ki(d) {
2386
+ c(Ae, "readIntervalBounds");
2387
+ function Se(g, t) {
2388
+ const e = /* @__PURE__ */ c((o) => {
2389
+ if (!g) return;
2390
+ const _ = g.names.indexOf(o);
2391
+ return _ >= 0 ? g[_] : void 0;
2392
+ }, "raw"), s = /* @__PURE__ */ c((o) => o == null || o === "NA" || typeof o == "number" && Number.isNaN(o), "isNA"), i = e("label"), n = s(i) ? t : String(i) === "" ? null : String(i), r = /* @__PURE__ */ c((o) => {
2393
+ const _ = e(o), m = s(_) || _ === "" ? 0 : Number(_);
2394
+ return Number.isFinite(m) ? m : 0;
2395
+ }, "num"), a = !!g && (g.names.includes("label.dx") || g.names.includes("label.dy")), h = e("label.pinned");
2396
+ return {
2397
+ text: n,
2398
+ offset: a ? { x: r("label.dx"), y: r("label.dy") } : null,
2399
+ pinned: h === !0 || h === 1 || String(h).toLowerCase() === "true"
2400
+ };
2401
+ }
2402
+ c(Se, "readLabelSpec");
2403
+ function Yi(g) {
2404
+ const t = g == null ? void 0 : g.trim().toLowerCase();
2405
+ if (!t) return null;
2406
+ if (t === "node") return 0.5;
2407
+ const e = Number(t);
2408
+ return Number.isFinite(e) && e > 0 ? e : null;
2409
+ }
2410
+ c(Yi, "parseSelfSize");
2411
+ function qi(g) {
2270
2412
  var i, n;
2271
- const t = /* @__PURE__ */ u((r) => d.getAttribute(r), "a"), e = ((i = t("colors")) == null ? void 0 : i.split(",").map((r) => r.trim()).filter(Boolean)) ?? [], s = ((n = t("threshold")) == null ? void 0 : n.split(",").map(Number).filter(Number.isFinite)) ?? [];
2413
+ const t = /* @__PURE__ */ c((r) => g.getAttribute(r), "a"), e = ((i = t("colors")) == null ? void 0 : i.split(",").map((r) => r.trim()).filter(Boolean)) ?? [], s = ((n = t("threshold")) == null ? void 0 : n.split(",").map(Number).filter(Number.isFinite)) ?? [];
2272
2414
  return {
2273
2415
  group: t("group"),
2274
2416
  unit: t("unit"),
@@ -2277,22 +2419,24 @@ function ki(d) {
2277
2419
  network: t("network"),
2278
2420
  colors: e.length ? [e[0], e[1] ?? null] : null,
2279
2421
  threshold: s.length ? [s[0], s.length > 1 ? s[1] : 1 / 0] : null,
2280
- name: t("name")
2422
+ name: t("name"),
2423
+ selfSize: Yi(t("self-size")),
2424
+ fixedSize: g.hasAttribute("fixed-size")
2281
2425
  };
2282
2426
  }
2283
- u(ki, "parseEdgeLayer");
2284
- function Ci(d) {
2285
- const { r: t, g: e, b: s } = st.parseColor(d), i = Math.max(t, e, s), n = Math.min(t, e, s), r = /* @__PURE__ */ u((a) => (i + n - a).toString(16).padStart(2, "0"), "f");
2427
+ c(qi, "parseEdgeLayer");
2428
+ function Bi(g) {
2429
+ const { r: t, g: e, b: s } = st.parseColor(g), i = Math.max(t, e, s), n = Math.min(t, e, s), r = /* @__PURE__ */ c((a) => (i + n - a).toString(16).padStart(2, "0"), "f");
2286
2430
  return `#${r(t)}${r(e)}${r(s)}`;
2287
2431
  }
2288
- u(Ci, "complementColor");
2289
- function Oi(d) {
2290
- const t = d == null ? void 0 : d.trim().toLowerCase();
2432
+ c(Bi, "complementColor");
2433
+ function Gi(g) {
2434
+ const t = g == null ? void 0 : g.trim().toLowerCase();
2291
2435
  return t === "plot" || t === "absolute" ? t : "model";
2292
2436
  }
2293
- u(Oi, "parseColorScale");
2294
- function He(d, t) {
2295
- switch (d == null ? void 0 : d.toLowerCase()) {
2437
+ c(Gi, "parseColorScale");
2438
+ function Ee(g, t) {
2439
+ switch (g == null ? void 0 : g.toLowerCase()) {
2296
2440
  case "on":
2297
2441
  return 3;
2298
2442
  case "off":
@@ -2305,241 +2449,271 @@ function He(d, t) {
2305
2449
  return t;
2306
2450
  }
2307
2451
  }
2308
- u(He, "parseLabelMode");
2309
- const gt = class gt extends ve {
2452
+ c(Ee, "parseLabelMode");
2453
+ const et = class et extends ze {
2310
2454
  constructor() {
2311
- super(), this.zoom_level = 1, this.__children__ = new Ct(), this._hasModel = !1, this._renderPending = !1, this._childObserver = null, this._ciRects = /* @__PURE__ */ new Map(), this._outlierRects = /* @__PURE__ */ new Map(), this._ciCross = /* @__PURE__ */ new Map(), this._labelsGroup = null, this._nodeLabels = /* @__PURE__ */ new Map(), this._meanLabels = /* @__PURE__ */ new Map(), this._pointLabels = /* @__PURE__ */ new Map(), this._showAxes = !1, this._axisXText = null, this._axisYText = null, this._axisLabelEls = /* @__PURE__ */ new Map(), this._magnifyText = null, this._magnifyEl = null, this._rangeExtent = null, this._rangeMode = null, this._centerContent = !1, this._plotTitle = null, this._titleEl = null, this._resizeObs = null, this._labelFont = { size: null, family: null, color: null }, this._animateMs = 0, this._tweenRaf = null, this._highlight = { edges: /* @__PURE__ */ new Set(), nodes: /* @__PURE__ */ new Set() }, this._highlightGroup = null, this._tooltipEl = null, this.graph = this, this.parent = null, this.__data__ = new Ke(Ks), this.__name__ = this.__data__.name || "unnamed-graph", this.svg_element = this.create(), console.log("Created ena-graph svg element: ", this.svg_element), document.addEventListener("model-updated", (t) => {
2312
- var vs, Ss, Es, Ms, Is, Ns, ks, Cs, Os, $s, Ps, Rs, Ls, Ds, Ts;
2313
- const e = ((vs = t.composedPath) == null ? void 0 : vs.call(t)[0]) ?? t.target;
2455
+ super(), this.zoom_level = 1, this.__children__ = new Pt(), this._hasModel = !1, this._renderPending = !1, this._childObserver = null, this._ciRects = /* @__PURE__ */ new Map(), this._outlierRects = /* @__PURE__ */ new Map(), this._ciCross = /* @__PURE__ */ new Map(), this._labelsGroup = null, this._nodeLabels = /* @__PURE__ */ new Map(), this._meanLabels = /* @__PURE__ */ new Map(), this._pointLabels = /* @__PURE__ */ new Map(), this._setLabels = /* @__PURE__ */ new Map(), this._showAxes = !1, this._axisXText = null, this._axisYText = null, this._axisLabelEls = /* @__PURE__ */ new Map(), this._magnifyText = null, this._magnifyEl = null, this._rangeExtent = null, this._rangeMode = null, this._centerContent = !1, this._edgesFixedSize = !1, this._meansFixedSize = !1, this._intervalBase = /* @__PURE__ */ new WeakMap(), this._axesFixedSize = !1, this._plotTitle = null, this._titleEl = null, this._resizeObs = null, this._labelFont = { size: null, family: null, color: null }, this._zoomAnim = null, this._animateMs = 0, this._tweenRaf = null, this._tween = null, this._tweenView = null, this._highlight = { edges: /* @__PURE__ */ new Set(), nodes: /* @__PURE__ */ new Set() }, this._highlightGroup = null, this._tooltipEl = null, this.graph = this, this.parent = null, this.__data__ = new is(ai), this.__name__ = this.__data__.name || "unnamed-graph", this.svg_element = this.create(), Qt("Created qe-graph svg element: ", this.svg_element), document.addEventListener("model-updated", (t) => {
2456
+ var Os, Ps, Ls, Rs, $s, Ts, Fs, Ds, js, Ys, qs, Bs, Gs, Us, Xs, Ws, Hs;
2457
+ const e = ((Os = t.composedPath) == null ? void 0 : Os.call(t)[0]) ?? t.target;
2314
2458
  if (this._vizena && e !== this._vizena) return;
2315
2459
  const s = t.detail;
2316
2460
  if (!s) return;
2317
- this._animateMs = this.hasAttribute("animate") ? parseInt(this.getAttribute("animate") || "", 10) || 300 : 0;
2318
- const i = this._animateMs > 0 && this._hasModel ? this._captureTween() : null;
2319
- this._hasModel = !0;
2461
+ this._renderPending = !1, (Ps = this._childObserver) == null || Ps.takeRecords(), this._animateMs = this.hasAttribute("animate") ? parseInt(this.getAttribute("animate") || "", 10) || 300 : 0;
2462
+ const i = this._animateMs > 0 && this._hasModel ? this._captureTweenState() : null;
2463
+ this._stopTween(), this._hasModel = !0;
2320
2464
  const n = s.dimensions, r = s.unit_id_col, a = s.node_id_col, h = s.group_col, o = this._readLayerConfig();
2321
2465
  this._showAxes = o.showAxes, this._axisXText = o.axisXLabel === null ? null : o.axisXLabel || String((n == null ? void 0 : n[0]) ?? "x"), this._magnifyText = o.edgeMagnify == null ? null : `(scaled ${o.edgeMagnify.toFixed(1)}x)`, this._axisYText = o.axisYLabel === null ? null : o.axisYLabel || String((n == null ? void 0 : n[1]) ?? "y");
2322
- const l = {}, _ = (Ss = s.palette) != null && Ss.length ? s.palette : Vs;
2323
- if (h && ((Es = s.points) != null && Es.names)) {
2324
- const C = s.points.col(h);
2325
- C && [...new Set([...C].map(String))].forEach(($, y) => {
2326
- l[$] = _[y % _.length];
2466
+ const _ = {}, m = (Ls = s.palette) != null && Ls.length ? s.palette : oi;
2467
+ if (h && ((Rs = s.points) != null && Rs.names)) {
2468
+ const I = s.points.col(h);
2469
+ I && [...new Set([...I].map(String))].forEach((P, N) => {
2470
+ _[P] = m[N % m.length];
2327
2471
  });
2328
2472
  }
2329
- (Ms = s.groups) != null && Ms.rows && s.groups.rows().length > 0 && s.groups.rows().forEach((C) => {
2330
- const I = C.rowName ?? String(C[0]), $ = C.names.indexOf("color"), y = $ >= 0 ? C[$] : null;
2331
- y && String(y) !== "NA" ? l[I] = String(y) : l[I] || (l[I] = _[Object.keys(l).length % _.length]);
2473
+ ($s = s.groups) != null && $s.rows && s.groups.rows().length > 0 && s.groups.rows().forEach((I) => {
2474
+ const k = I.rowName ?? String(I[0]), P = I.names.indexOf("color"), N = P >= 0 ? I[P] : null;
2475
+ N && String(N) !== "NA" ? _[k] = String(N) : _[k] || (_[k] = m[Object.keys(_).length % m.length]);
2332
2476
  });
2333
- const g = Object.keys(l), c = o.activeMeanGroups && o.activeMeanGroups.trim() ? new Set(
2334
- o.activeMeanGroups.split(",").map((C) => C.trim()).filter((C) => l[C])
2477
+ const p = Object.keys(_), u = o.activeMeanGroups && o.activeMeanGroups.trim() ? new Set(
2478
+ o.activeMeanGroups.split(",").map((I) => I.trim()).filter((I) => _[I])
2335
2479
  // silently drop names not in model
2336
- ) : new Set(g), E = o.scalePoints, m = /* @__PURE__ */ u((C) => {
2337
- let I = 0;
2338
- return C.forEach(($) => {
2339
- const y = $.names.indexOf(n[0]), b = n.length > 1 ? $.names.indexOf(n[1]) : -1;
2340
- y >= 0 && (I = Math.max(I, Math.abs(Number($[y])))), b >= 0 && (I = Math.max(I, Math.abs(Number($[b]))));
2341
- }), I;
2342
- }, "getExtent"), S = (Is = s.nodes) != null && Is.rows ? m(s.nodes.rows()) : 0, R = (Ns = s.points) != null && Ns.rows ? m(s.points.rows()) : 0, j = (ks = s.trajectories) != null && ks.rows ? m(s.trajectories.rows()) : 0, Y = R > 0 ? R : j, v = o.pointScale !== null ? o.pointScale : E && Y > 0 && S > 0 ? S / Y : 1;
2343
- this._rangeExtent = o.range === "network" ? S * 1.2 : o.range === "points" ? Y * v * 1.2 : typeof o.range == "number" ? o.range : null, this._rangeMode = o.range === "network" || o.range === "points" ? o.range : typeof o.range == "number" ? "number" : null, this._centerContent = o.centerContent, this._plotTitle = o.plotTitle, this._labelFont = o.labelFont;
2344
- const F = o.labelNodes, nt = o.labelMeans, ot = o.labelPoints, it = this._labelsGroup, _t = /* @__PURE__ */ u((C, I, $, y = 1) => {
2345
- const b = C.names.indexOf(I), A = C.names.indexOf(n[0]), O = n.length > 1 ? C.names.indexOf(n[1]) : -1, p = new J({
2346
- ID: b >= 0 ? String(C[b]) : C.rowName || `pt-${Math.random().toString(36).slice(2)}`,
2480
+ ) : new Set(p), d = o.scalePoints, l = /* @__PURE__ */ c((I) => {
2481
+ let k = 0;
2482
+ return I.forEach((P) => {
2483
+ const N = P.names.indexOf(n[0]), S = n.length > 1 ? P.names.indexOf(n[1]) : -1;
2484
+ N >= 0 && (k = Math.max(k, Math.abs(Number(P[N])))), S >= 0 && (k = Math.max(k, Math.abs(Number(P[S]))));
2485
+ }), k;
2486
+ }, "getExtent"), b = (Ts = s.nodes) != null && Ts.rows ? l(s.nodes.rows()) : 0, f = (Fs = s.points) != null && Fs.rows ? l(s.points.rows()) : 0, w = (Ds = s.trajectories) != null && Ds.rows ? l(s.trajectories.rows()) : 0, $ = f > 0 ? f : w, z = o.pointScale !== null ? o.pointScale : d && $ > 0 && b > 0 ? b / $ : 1;
2487
+ this._rangeExtent = o.range === "network" ? b * 1.2 : o.range === "points" ? $ * z * 1.2 : typeof o.range == "number" ? o.range : null, this._rangeMode = o.range === "network" || o.range === "points" ? o.range : typeof o.range == "number" ? "number" : null, this._centerContent = o.centerContent, this._edgesFixedSize = o.edgeLayers.some((I) => I.fixedSize), this._meansFixedSize = o.meanFixedSize, this._axesFixedSize = o.axesFixedSize, this._plotTitle = o.plotTitle, this._labelFont = o.labelFont;
2488
+ const D = o.labelNodes, lt = o.labelMeans, ct = o.labelPoints, J = this._labelsGroup, _t = /* @__PURE__ */ c((I, k, P, N = 1) => {
2489
+ const S = I.names.indexOf(k), y = I.names.indexOf(n[0]), O = n.length > 1 ? I.names.indexOf(n[1]) : -1, v = new K({
2490
+ ID: S >= 0 ? String(I[S]) : I.rowName || `pt-${Math.random().toString(36).slice(2)}`,
2347
2491
  dimensions: [
2348
- A >= 0 ? Number(C[A]) * y : 0,
2349
- O >= 0 ? -Number(C[O]) * y : 0
2492
+ y >= 0 ? Number(I[y]) * N : 0,
2493
+ O >= 0 ? -Number(I[O]) * N : 0
2350
2494
  // negate Y: SVG y-down vs ENA y-up
2351
2495
  ],
2352
2496
  meta: {}
2353
2497
  });
2354
- return $ && (p.color = new st($)), p;
2355
- }, "rowToPoint"), K = {}, It = o.showPoints, Ot = s.pointsets;
2356
- if (o.pointSets.length && (Ot != null && Ot.rows)) {
2357
- const C = this.__children__.search("__children__", "points"), I = /* @__PURE__ */ u(($, y) => {
2358
- const b = $.names.indexOf(y);
2359
- return b >= 0 ? $[b] : null;
2498
+ return P && (v.color = new st(P)), v;
2499
+ }, "rowToPoint"), Z = {}, kt = o.showPoints;
2500
+ ["points", "nodes", "edges", "edgenodes"].map((I) => this.__children__.search("__children__", I)).filter((I) => !!I).forEach((I) => I.__data__.objects.clear()), this.__data__.points.clear();
2501
+ const se = s.pointsets, Lt = [];
2502
+ if (o.pointSets.length && (se != null && se.rows)) {
2503
+ const I = this.__children__.search("__children__", "points"), k = /* @__PURE__ */ c((P, N) => {
2504
+ const S = P.names.indexOf(N);
2505
+ return S >= 0 ? P[S] : null;
2360
2506
  }, "col");
2361
- o.pointSets.forEach(($, y) => {
2362
- Ot.rows().forEach((b) => {
2363
- if (String(I(b, "set")) !== $.set) return;
2364
- const A = String(I(b, "id")), O = I(b, "group") != null && String(I(b, "group")) !== "NA" ? String(I(b, "group")) : null, p = I(b, "color") && String(I(b, "color")) !== "NA" ? String(I(b, "color")) : O && l[O] ? l[O] : _[y % _.length], w = _t(b, "id", p, v);
2365
- w.ID = `${$.set}::${A}`, w.size = $.size ?? o.pointSize ?? 2.5;
2366
- const P = I(b, "shape");
2367
- P && String(P) !== "NA" && (w.shape = String(P));
2368
- const q = I(b, "label");
2369
- w.meta = {
2507
+ o.pointSets.forEach((P, N) => {
2508
+ se.rows().forEach((S) => {
2509
+ if (String(k(S, "set")) !== P.set) return;
2510
+ const y = String(k(S, "id")), O = k(S, "group") != null && String(k(S, "group")) !== "NA" ? String(k(S, "group")) : null, v = k(S, "color") && String(k(S, "color")) !== "NA" ? String(k(S, "color")) : O && _[O] ? _[O] : m[N % m.length], E = _t(S, "id", v, z);
2511
+ E.ID = `${P.set}::${y}`, E.size = P.size ?? o.pointSize ?? 2.5;
2512
+ const F = k(S, "shape");
2513
+ F && String(F) !== "NA" && (E.shape = String(F));
2514
+ const U = k(S, "label");
2515
+ E.meta = {
2370
2516
  stroke: "#ffffff",
2371
2517
  kind: "point",
2372
- name: q != null && String(q) !== "NA" ? String(q) : A,
2518
+ name: U != null && String(U) !== "NA" ? String(U) : y,
2373
2519
  group: O ?? void 0,
2374
- unit: A,
2375
- set: $.set,
2376
- fixedSize: $.fixedSize
2377
- }, this.__data__.points.set(w.ID, w), C == null || C.__data__.objects.set(w.ID, w);
2520
+ unit: y,
2521
+ set: P.set,
2522
+ fixedSize: P.fixedSize
2523
+ }, this.__data__.points.set(E.ID, E), I == null || I.__data__.objects.set(E.ID, E), Lt.push({ pt: E, spec: Se(S, y), mode: P.labelMode, weight: P.labelWeight });
2378
2524
  });
2379
2525
  });
2380
2526
  }
2381
- if ((Cs = s.points) != null && Cs.rows) {
2382
- const C = this.__children__.search("__children__", "points");
2383
- if (C) {
2384
- s.points.rows().forEach((y) => {
2385
- const b = h ? y.names.indexOf(h) : -1, A = b >= 0 ? String(y[b]) : null, O = A ? l[A] ?? "#888888" : "#888888";
2386
- if (It) {
2387
- const p = _t(y, r, O, v);
2388
- p.size = o.pointSize ?? 2.5, p.meta = {
2389
- ...p.meta ?? {},
2527
+ if (J) {
2528
+ const I = new Set(Lt.map((k) => k.pt.ID));
2529
+ this._setLabels.forEach((k, P) => {
2530
+ I.has(P) || (k.remove(), this._setLabels.delete(P));
2531
+ }), Lt.forEach((k) => this._syncLabel(this._setLabels, k.pt.ID, k.spec, k.pt, J, k.mode, k.weight));
2532
+ }
2533
+ if ((js = s.points) != null && js.rows) {
2534
+ const I = this.__children__.search("__children__", "points");
2535
+ if (I) {
2536
+ s.points.rows().forEach((N) => {
2537
+ const S = h ? N.names.indexOf(h) : -1, y = S >= 0 ? String(N[S]) : null, O = y ? _[y] ?? "#888888" : "#888888";
2538
+ if (kt) {
2539
+ const v = _t(N, r, O, z);
2540
+ v.size = o.pointSize ?? 2.5, v.meta = {
2541
+ ...v.meta ?? {},
2390
2542
  stroke: "#ffffff",
2391
2543
  kind: "point",
2392
- name: p.ID,
2393
- group: A ?? void 0,
2394
- unit: p.ID,
2544
+ name: v.ID,
2545
+ group: y ?? void 0,
2546
+ unit: v.ID,
2395
2547
  fixedSize: o.pointFixedSize
2396
- }, this.__data__.points.set(p.ID, p), C.__data__.objects.set(p.ID, p);
2548
+ }, this.__data__.points.set(v.ID, v), I.__data__.objects.set(v.ID, v);
2397
2549
  }
2398
- if (A) {
2399
- const p = y.names.indexOf(n[0]), w = n.length > 1 ? y.names.indexOf(n[1]) : -1;
2400
- K[A] || (K[A] = { x: 0, y: 0, x2: 0, y2: 0, xy: 0, n: 0, color: O });
2401
- const P = p >= 0 ? Number(y[p]) : 0, q = w >= 0 ? Number(y[w]) : 0;
2402
- K[A].x += P, K[A].y += q, K[A].x2 += P * P, K[A].y2 += q * q, K[A].xy += P * q, K[A].n += 1;
2550
+ if (y) {
2551
+ const v = N.names.indexOf(n[0]), E = n.length > 1 ? N.names.indexOf(n[1]) : -1;
2552
+ Z[y] || (Z[y] = { x: 0, y: 0, x2: 0, y2: 0, xy: 0, n: 0, color: O });
2553
+ const F = v >= 0 ? Number(N[v]) : 0, U = E >= 0 ? Number(N[E]) : 0;
2554
+ Z[y].x += F, Z[y].y += U, Z[y].x2 += F * F, Z[y].y2 += U * U, Z[y].xy += F * U, Z[y].n += 1;
2403
2555
  }
2404
2556
  });
2405
- const I = !!((Os = s.groups) != null && Os.rows && s.groups.rows().length > 0), $ = o.showMeans && I ? s.groups.rows().filter((y) => {
2406
- const b = y.rowName ?? String(y[0]);
2407
- return c.size === 0 || c.has(b);
2557
+ const k = !!((Ys = s.groups) != null && Ys.rows && s.groups.rows().length > 0), P = o.showMeans && k ? s.groups.rows().filter((N) => {
2558
+ const S = N.rowName ?? String(N[0]);
2559
+ return u.size === 0 || u.has(S);
2408
2560
  }) : [];
2409
2561
  if (o.showMeans) {
2410
- const y = C.svg_element, b = this._rangeExtent ? this._rangeExtent / 1.2 : S, A = (b > 0 ? b : 1) * 8e-3;
2411
- if (I) {
2412
- const O = new Set($.map((p) => p.rowName ?? String(p[0])));
2413
- this._ciRects.forEach((p, w) => {
2414
- O.has(w) || (p.remove(), this._ciRects.delete(w));
2415
- }), this._outlierRects.forEach((p, w) => {
2416
- O.has(w) || (p.remove(), this._outlierRects.delete(w));
2417
- }), this._ciCross.forEach((p, w) => {
2418
- O.has(w.slice(2)) || (p.remove(), this._ciCross.delete(w));
2419
- }), $.forEach((p) => {
2420
- var N, z, D;
2421
- const w = p.rowName ?? String(p[0]), P = l[w] ?? "#888888", q = p.names.indexOf(n[0]), X = n.length > 1 ? p.names.indexOf(n[1]) : -1, W = q >= 0 ? Number(p[q]) * v : 0, mt = X >= 0 ? -Number(p[X]) * v : 0, Z = new J({
2422
- ID: `mean-${w}`,
2423
- dimensions: [W, mt],
2424
- meta: { kind: "mean", name: w, group: w, fixedSize: o.meanFixedSize }
2562
+ const N = I.svg_element, S = this._rangeExtent ? this._rangeExtent / 1.2 : b, y = (S > 0 ? S : 1) * 8e-3;
2563
+ if (k) {
2564
+ const O = new Set(P.map((v) => v.rowName ?? String(v[0])));
2565
+ this._ciRects.forEach((v, E) => {
2566
+ O.has(E) || (v.remove(), this._ciRects.delete(E));
2567
+ }), this._outlierRects.forEach((v, E) => {
2568
+ O.has(E) || (v.remove(), this._outlierRects.delete(E));
2569
+ }), this._ciCross.forEach((v, E) => {
2570
+ O.has(E.slice(2)) || (v.remove(), this._ciCross.delete(E));
2571
+ }), P.forEach((v) => {
2572
+ var we, qt, $t;
2573
+ const E = v.rowName ?? String(v[0]), F = _[E] ?? "#888888", U = v.names.indexOf(n[0]), Y = n.length > 1 ? v.names.indexOf(n[1]) : -1, W = U >= 0 ? Number(v[U]) * z : 0, pt = Y >= 0 ? -Number(v[Y]) * z : 0, X = new K({
2574
+ ID: `mean-${E}`,
2575
+ dimensions: [W, pt],
2576
+ meta: { kind: "mean", name: E, group: E, fixedSize: o.meanFixedSize }
2425
2577
  });
2426
- Z.color = new st(P), Z.size = 4;
2427
- const at = p.names.indexOf("shape"), L = at >= 0 ? p[at] : null;
2428
- Z.shape = L && String(L) !== "NA" ? String(L) : "rect", this.__data__.points.set(Z.ID, Z), C.__data__.objects.set(Z.ID, Z);
2429
- const Tt = /* @__PURE__ */ u((M) => {
2430
- const tt = p.names.indexOf(M), G = tt >= 0 ? p[tt] : null;
2431
- return G == null || String(G) === "NA" || String(G) === "" ? null : G;
2432
- }, "cell"), xt = Tt("intervals"), At = xt === "box" || xt === "crosshairs" || xt === "none" ? xt : o.intervals, vt = Tt("outlier"), U = (vt == null ? o.showOutlier : vt === !0 || String(vt) === "true") ? be(p, n[0], n[1], "o") : null;
2433
- if (!U)
2434
- (N = this._outlierRects.get(w)) == null || N.remove(), this._outlierRects.delete(w);
2578
+ X.color = new st(F), X.size = 4;
2579
+ const rt = v.names.indexOf("shape"), R = rt >= 0 ? v[rt] : null;
2580
+ X.shape = R && String(R) !== "NA" ? String(R) : "rect", this.__data__.points.set(X.ID, X), I.__data__.objects.set(X.ID, X);
2581
+ const jt = /* @__PURE__ */ c((j) => {
2582
+ const x = v.names.indexOf(j), A = x >= 0 ? v[x] : null;
2583
+ return A == null || String(A) === "NA" || String(A) === "" ? null : A;
2584
+ }, "cell"), gt = jt("intervals"), St = gt === "box" || gt === "crosshairs" || gt === "none" ? gt : o.intervals, Rt = jt("outlier"), B = (Rt == null ? o.showOutlier : Rt === !0 || String(Rt) === "true") ? Ae(v, n[0], n[1], "o") : null;
2585
+ if (!B)
2586
+ (we = this._outlierRects.get(E)) == null || we.remove(), this._outlierRects.delete(E);
2435
2587
  else {
2436
- let M = this._outlierRects.get(w);
2437
- M || (M = document.createElementNS("http://www.w3.org/2000/svg", "rect"), M.setAttribute("data-outlier-group", w), this._outlierRects.set(w, M)), M.setAttribute("x", (U.x_low * v).toString()), M.setAttribute("y", (-U.y_high * v).toString()), M.setAttribute("width", ((U.x_high - U.x_low) * v).toString()), M.setAttribute("height", ((U.y_high - U.y_low) * v).toString()), M.setAttribute("fill", "none"), M.setAttribute("stroke", P), M.setAttribute("stroke-width", A.toString()), M.setAttribute("stroke-opacity", "0.5"), M.setAttribute("stroke-dasharray", `${A * 2} ${A * 2}`), y && !M.parentElement && y.insertBefore(M, y.firstChild);
2588
+ let j = this._outlierRects.get(E);
2589
+ j || (j = document.createElementNS("http://www.w3.org/2000/svg", "rect"), j.setAttribute("data-outlier-group", E), this._outlierRects.set(E, j)), j.setAttribute("x", (B.x_low * z).toString()), j.setAttribute("y", (-B.y_high * z).toString()), j.setAttribute("width", ((B.x_high - B.x_low) * z).toString()), j.setAttribute("height", ((B.y_high - B.y_low) * z).toString()), j.setAttribute("fill", "none"), j.setAttribute("stroke", F), j.setAttribute("stroke-width", y.toString()), j.setAttribute("stroke-opacity", "0.5"), j.setAttribute("stroke-dasharray", `${y * 2} ${y * 2}`), this._intervalStroke(j, y, [y * 2, y * 2]), N && !j.parentElement && N.insertBefore(j, N.firstChild);
2438
2590
  }
2439
- const f = At !== "none" ? be(p, n[0], n[1]) : null, x = `x:${w}`;
2440
- if ((!f || At !== "crosshairs") && ((z = this._ciCross.get(x)) == null || z.remove(), this._ciCross.delete(x)), f && At === "crosshairs") {
2441
- (D = this._ciRects.get(w)) == null || D.remove(), this._ciRects.delete(w);
2442
- const M = f.x_low * v, tt = f.x_high * v, G = -f.y_high * v, rt = -f.y_low * v;
2443
- pe(Z, (tt - M) / 2, (rt - G) / 2);
2444
- let T = this._ciCross.get(x);
2445
- T || (T = document.createElementNS("http://www.w3.org/2000/svg", "path"), T.setAttribute("data-ci-group", w), T.setAttribute("data-ci-kind", "crosshairs"), this._ciCross.set(x, T)), T.setAttribute("d", `M${M} ${mt} L${tt} ${mt} M${W} ${G} L${W} ${rt}`), T.setAttribute("fill", "none"), T.setAttribute("stroke", P), T.setAttribute("stroke-width", (A * 1.25).toString()), T.setAttribute("stroke-opacity", "0.8"), y && !T.parentElement && y.insertBefore(T, y.firstChild);
2446
- } else if (f) {
2447
- const M = f.x_low * v, tt = -f.y_high * v, G = (f.x_high - f.x_low) * v, rt = (f.y_high - f.y_low) * v;
2448
- pe(Z, G / 2, rt / 2);
2449
- let T = this._ciRects.get(w);
2450
- T || (T = document.createElementNS("http://www.w3.org/2000/svg", "rect"), T.setAttribute("data-ci-group", w), this._ciRects.set(w, T)), T.setAttribute("x", M.toString()), T.setAttribute("y", tt.toString()), T.setAttribute("width", G.toString()), T.setAttribute("height", rt.toString()), T.setAttribute("fill", "none"), T.setAttribute("stroke", P), T.setAttribute("stroke-width", A.toString()), T.setAttribute("stroke-opacity", "0.8"), T.setAttribute("stroke-dasharray", `${A * 4} ${A * 3}`), y && !T.parentElement && y.insertBefore(T, y.firstChild);
2591
+ const nt = St !== "none" ? Ae(v, n[0], n[1]) : null, Yt = `x:${E}`;
2592
+ if ((!nt || St !== "crosshairs") && ((qt = this._ciCross.get(Yt)) == null || qt.remove(), this._ciCross.delete(Yt)), nt && St === "crosshairs") {
2593
+ ($t = this._ciRects.get(E)) == null || $t.remove(), this._ciRects.delete(E);
2594
+ const j = nt.x_low * z, x = nt.x_high * z, A = -nt.y_high * z, C = -nt.y_low * z;
2595
+ ve(X, (x - j) / 2, (C - A) / 2);
2596
+ let M = this._ciCross.get(Yt);
2597
+ M || (M = document.createElementNS("http://www.w3.org/2000/svg", "path"), M.setAttribute("data-ci-group", E), M.setAttribute("data-ci-kind", "crosshairs"), this._ciCross.set(Yt, M)), M.setAttribute("d", `M${j} ${pt} L${x} ${pt} M${W} ${A} L${W} ${C}`), M.setAttribute("fill", "none"), M.setAttribute("stroke", F), M.setAttribute("stroke-width", (y * 1.25).toString()), this._intervalStroke(M, y * 1.25, null), M.setAttribute("stroke-opacity", "0.8"), N && !M.parentElement && N.insertBefore(M, N.firstChild);
2598
+ } else if (nt) {
2599
+ const j = nt.x_low * z, x = -nt.y_high * z, A = (nt.x_high - nt.x_low) * z, C = (nt.y_high - nt.y_low) * z;
2600
+ ve(X, A / 2, C / 2);
2601
+ let M = this._ciRects.get(E);
2602
+ M || (M = document.createElementNS("http://www.w3.org/2000/svg", "rect"), M.setAttribute("data-ci-group", E), this._ciRects.set(E, M)), M.setAttribute("x", j.toString()), M.setAttribute("y", x.toString()), M.setAttribute("width", A.toString()), M.setAttribute("height", C.toString()), M.setAttribute("fill", "none"), M.setAttribute("stroke", F), M.setAttribute("stroke-width", y.toString()), M.setAttribute("stroke-opacity", "0.8"), M.setAttribute("stroke-dasharray", `${y * 4} ${y * 3}`), this._intervalStroke(M, y, [y * 4, y * 3]), N && !M.parentElement && N.insertBefore(M, N.firstChild);
2451
2603
  } else {
2452
- const M = this._ciRects.get(w);
2453
- M && (M.remove(), this._ciRects.delete(w));
2604
+ const j = this._ciRects.get(E);
2605
+ j && (j.remove(), this._ciRects.delete(E));
2454
2606
  }
2455
2607
  });
2456
2608
  } else
2457
- Object.entries(K).forEach(([p, { x: w, y: P, n: q, color: X }]) => {
2458
- const W = new J({
2459
- ID: `mean-${p}`,
2460
- dimensions: [w / q * v, -(P / q) * v],
2461
- meta: { kind: "mean", name: p, group: p, fixedSize: o.meanFixedSize }
2609
+ this._removeIntervals(this._ciCross), Object.entries(Z).forEach(([v, { x: E, y: F, n: U, color: Y }]) => {
2610
+ const W = new K({
2611
+ ID: `mean-${v}`,
2612
+ dimensions: [E / U * z, -(F / U) * z],
2613
+ meta: { kind: "mean", name: v, group: v, fixedSize: o.meanFixedSize }
2462
2614
  });
2463
- W.color = new st(X), W.size = 4, W.shape = "rect", this.__data__.points.set(W.ID, W), C.__data__.objects.set(W.ID, W);
2464
- }), o.showCI && (this._ciRects.forEach((p, w) => {
2465
- K[w] || (p.remove(), this._ciRects.delete(w));
2466
- }), ($s = s.confidence) != null && $s.rows ? s.confidence.rows().forEach((p) => {
2467
- const w = p.names.indexOf(h ?? "group"), P = w >= 0 ? String(p[w]) : p.rowName ?? null;
2468
- if (!P) return;
2469
- const q = l[P] ?? "#888888", X = be(p, n[0], n[1]);
2470
- if (!X) return;
2471
- const W = X.x_low * v, mt = -X.y_high * v, Z = (X.x_high - X.x_low) * v, at = (X.y_high - X.y_low) * v;
2472
- pe(
2473
- this.__data__.points.get(`mean-${P}`),
2474
- Z / 2,
2475
- at / 2
2615
+ W.color = new st(Y), W.size = 4, W.shape = "rect", this.__data__.points.set(W.ID, W), I.__data__.objects.set(W.ID, W);
2616
+ }), o.showCI ? (this._ciRects.forEach((v, E) => {
2617
+ Z[E] || (v.remove(), this._ciRects.delete(E));
2618
+ }), (qs = s.confidence) != null && qs.rows ? s.confidence.rows().forEach((v) => {
2619
+ const E = v.names.indexOf(h ?? "group"), F = E >= 0 ? String(v[E]) : v.rowName ?? null;
2620
+ if (!F) return;
2621
+ const U = _[F] ?? "#888888", Y = Ae(v, n[0], n[1]);
2622
+ if (!Y) return;
2623
+ const W = Y.x_low * z, pt = -Y.y_high * z, X = (Y.x_high - Y.x_low) * z, rt = (Y.y_high - Y.y_low) * z;
2624
+ ve(
2625
+ this.__data__.points.get(`mean-${F}`),
2626
+ X / 2,
2627
+ rt / 2
2476
2628
  );
2477
- let L = this._ciRects.get(P);
2478
- L || (L = document.createElementNS("http://www.w3.org/2000/svg", "rect"), L.setAttribute("data-ci-group", P), this._ciRects.set(P, L)), L.setAttribute("x", W.toString()), L.setAttribute("y", mt.toString()), L.setAttribute("width", Z.toString()), L.setAttribute("height", at.toString()), L.setAttribute("fill", "none"), L.setAttribute("stroke", q), L.setAttribute("stroke-width", A.toString()), L.setAttribute("stroke-opacity", "0.8"), L.setAttribute("stroke-dasharray", `${A * 4} ${A * 3}`), y && !L.parentElement && y.insertBefore(L, y.firstChild);
2479
- }) : Object.entries(K).forEach(([p, { x: w, y: P, x2: q, y2: X, n: W, color: mt }]) => {
2629
+ let R = this._ciRects.get(F);
2630
+ R || (R = document.createElementNS("http://www.w3.org/2000/svg", "rect"), R.setAttribute("data-ci-group", F), this._ciRects.set(F, R)), R.setAttribute("x", W.toString()), R.setAttribute("y", pt.toString()), R.setAttribute("width", X.toString()), R.setAttribute("height", rt.toString()), R.setAttribute("fill", "none"), R.setAttribute("stroke", U), R.setAttribute("stroke-width", y.toString()), R.setAttribute("stroke-opacity", "0.8"), R.setAttribute("stroke-dasharray", `${y * 4} ${y * 3}`), this._intervalStroke(R, y, [y * 4, y * 3]), N && !R.parentElement && N.insertBefore(R, N.firstChild);
2631
+ }) : Object.entries(Z).forEach(([v, { x: E, y: F, x2: U, y2: Y, n: W, color: pt }]) => {
2480
2632
  if (W < 2) return;
2481
- const Z = w / W, at = P / W, L = q / W - Z * Z, Tt = X / W - at * at, { halfW: xt, halfH: At } = Ii(L, Tt, W, v), vt = Z * v, $t = -at * v;
2482
- pe(
2483
- this.__data__.points.get(`mean-${p}`),
2484
- xt,
2485
- At
2633
+ const X = E / W, rt = F / W, R = U / W - X * X, jt = Y / W - rt * rt, { halfW: gt, halfH: St } = Di(R, jt, W, z), Rt = X * z, ie = -rt * z;
2634
+ ve(
2635
+ this.__data__.points.get(`mean-${v}`),
2636
+ gt,
2637
+ St
2486
2638
  );
2487
- let U = this._ciRects.get(p);
2488
- U || (U = document.createElementNS("http://www.w3.org/2000/svg", "rect"), U.setAttribute("data-ci-group", p), this._ciRects.set(p, U)), U.setAttribute("x", (vt - xt).toString()), U.setAttribute("y", ($t - At).toString()), U.setAttribute("width", (xt * 2).toString()), U.setAttribute("height", (At * 2).toString()), U.setAttribute("fill", "none"), U.setAttribute("stroke", mt), U.setAttribute("stroke-width", A.toString()), U.setAttribute("stroke-opacity", "0.8"), U.setAttribute("stroke-dasharray", `${A * 4} ${A * 3}`), y && !U.parentElement && y.insertBefore(U, y.firstChild);
2489
- })), (Ps = s.outlier) != null && Ps.rows && (this._outlierRects.forEach((p, w) => {
2490
- l[w] || (p.remove(), this._outlierRects.delete(w));
2491
- }), s.outlier.rows().forEach((p) => {
2492
- const w = p.names.indexOf(h ?? "group"), P = w >= 0 ? String(p[w]) : p.rowName ?? null;
2493
- if (!P) return;
2494
- const q = l[P] ?? "#888888", X = be(p, n[0], n[1]);
2495
- if (!X) return;
2496
- const W = X.x_low * v, mt = -X.y_high * v, Z = (X.x_high - X.x_low) * v, at = (X.y_high - X.y_low) * v;
2497
- let L = this._outlierRects.get(P);
2498
- L || (L = document.createElementNS("http://www.w3.org/2000/svg", "rect"), L.setAttribute("data-outlier-group", P), this._outlierRects.set(P, L)), L.setAttribute("x", W.toString()), L.setAttribute("y", mt.toString()), L.setAttribute("width", Z.toString()), L.setAttribute("height", at.toString()), L.setAttribute("fill", "none"), L.setAttribute("stroke", q), L.setAttribute("stroke-width", A.toString()), L.setAttribute("stroke-opacity", "0.5"), L.setAttribute("stroke-dasharray", `${A * 2} ${A * 2}`), y && !L.parentElement && y.insertBefore(L, y.firstChild);
2499
- }));
2639
+ let B = this._ciRects.get(v);
2640
+ B || (B = document.createElementNS("http://www.w3.org/2000/svg", "rect"), B.setAttribute("data-ci-group", v), this._ciRects.set(v, B)), B.setAttribute("x", (Rt - gt).toString()), B.setAttribute("y", (ie - St).toString()), B.setAttribute("width", (gt * 2).toString()), B.setAttribute("height", (St * 2).toString()), B.setAttribute("fill", "none"), B.setAttribute("stroke", pt), B.setAttribute("stroke-width", y.toString()), B.setAttribute("stroke-opacity", "0.8"), B.setAttribute("stroke-dasharray", `${y * 4} ${y * 3}`), this._intervalStroke(B, y, [y * 4, y * 3]), N && !B.parentElement && N.insertBefore(B, N.firstChild);
2641
+ })) : this._removeIntervals(this._ciRects), (Bs = s.outlier) != null && Bs.rows ? (this._outlierRects.forEach((v, E) => {
2642
+ _[E] || (v.remove(), this._outlierRects.delete(E));
2643
+ }), s.outlier.rows().forEach((v) => {
2644
+ const E = v.names.indexOf(h ?? "group"), F = E >= 0 ? String(v[E]) : v.rowName ?? null;
2645
+ if (!F) return;
2646
+ const U = _[F] ?? "#888888", Y = Ae(v, n[0], n[1]);
2647
+ if (!Y) return;
2648
+ const W = Y.x_low * z, pt = -Y.y_high * z, X = (Y.x_high - Y.x_low) * z, rt = (Y.y_high - Y.y_low) * z;
2649
+ let R = this._outlierRects.get(F);
2650
+ R || (R = document.createElementNS("http://www.w3.org/2000/svg", "rect"), R.setAttribute("data-outlier-group", F), this._outlierRects.set(F, R)), R.setAttribute("x", W.toString()), R.setAttribute("y", pt.toString()), R.setAttribute("width", X.toString()), R.setAttribute("height", rt.toString()), R.setAttribute("fill", "none"), R.setAttribute("stroke", U), R.setAttribute("stroke-width", y.toString()), R.setAttribute("stroke-opacity", "0.5"), R.setAttribute("stroke-dasharray", `${y * 2} ${y * 2}`), this._intervalStroke(R, y, [y * 2, y * 2]), N && !R.parentElement && N.insertBefore(R, N.firstChild);
2651
+ })) : this._removeIntervals(this._outlierRects);
2652
+ } else
2653
+ [this._ciRects, this._outlierRects, this._ciCross].forEach((N) => this._removeIntervals(N));
2654
+ if (J) {
2655
+ this._pointLabels.forEach((y, O) => {
2656
+ I.__data__.objects.get(O) || (y.remove(), this._pointLabels.delete(O));
2657
+ }), this._meanLabels.forEach((y, O) => {
2658
+ I.__data__.objects.get(`mean-${O}`) || (y.remove(), this._meanLabels.delete(O));
2659
+ }), ct !== 0 ? s.points.rows().forEach((y) => {
2660
+ const O = y.names.indexOf(r), v = O >= 0 ? String(y[O]) : null;
2661
+ if (!v) return;
2662
+ const E = I.__data__.objects.get(v);
2663
+ E && this._syncLabel(
2664
+ this._pointLabels,
2665
+ v,
2666
+ Se(null, v),
2667
+ E,
2668
+ J,
2669
+ ct,
2670
+ o.labelWeightPoints
2671
+ );
2672
+ }) : this._clearLabels(this._pointLabels);
2673
+ const N = new Map(
2674
+ P.map((y) => [y.rowName ?? String(y[0]), y])
2675
+ );
2676
+ (k ? [...N.keys()] : Object.keys(Z)).forEach((y) => {
2677
+ const O = `mean-${y}`, v = I.__data__.objects.get(O);
2678
+ v && this._syncLabel(
2679
+ this._meanLabels,
2680
+ y,
2681
+ Se(N.get(y), y),
2682
+ v,
2683
+ J,
2684
+ lt,
2685
+ o.labelWeightMeans
2686
+ );
2687
+ });
2500
2688
  }
2501
- it && (this._pointLabels.forEach((y, b) => {
2502
- C.__data__.objects.get(b) || (y.remove(), this._pointLabels.delete(b));
2503
- }), this._meanLabels.forEach((y, b) => {
2504
- C.__data__.objects.get(`mean-${b}`) || (y.remove(), this._meanLabels.delete(b));
2505
- }), ot !== 0 && s.points.rows().forEach((y) => {
2506
- const b = y.names.indexOf(r), A = b >= 0 ? String(y[b]) : null;
2507
- if (!A) return;
2508
- const O = C.__data__.objects.get(A);
2509
- if (!O) return;
2510
- const p = A;
2511
- let w = this._pointLabels.get(A);
2512
- w ? ot === H.DISPLAY_TYPES.ON ? w.show() : w.hide() : (w = new Jt(p, O, it, this, ot), this._pointLabels.set(A, w));
2513
- }), nt !== 0 && (I ? $.map((b) => b.rowName ?? String(b[0])) : Object.keys(K)).forEach((b) => {
2514
- const A = `mean-${b}`, O = C.__data__.objects.get(A);
2515
- if (!O) return;
2516
- let p = this._meanLabels.get(b);
2517
- p ? nt === H.DISPLAY_TYPES.ON ? p.show() : p.hide() : (p = new Jt(b, O, it, this, nt), this._meanLabels.set(b, p));
2518
- })), C.__data__.__state__.setVariable("layer_updated", C.__data__);
2689
+ I.__data__.__state__.setVariable("layer_updated", I.__data__);
2519
2690
  }
2691
+ } else {
2692
+ const I = this.__children__.search("__children__", "points");
2693
+ I == null || I.__data__.__state__.setVariable("layer_updated", I.__data__);
2520
2694
  }
2521
- const Dt = this.__children__.search("__children__", "trajectories");
2522
- if (o.showTrajectories && Dt) {
2523
- Dt.__data__.objects.clear(), this.__data__.trajectories.clear();
2524
- const C = (Rs = s.trajectories) != null && Rs.rows ? s.trajectories : s.points;
2525
- if (C != null && C.rows) {
2526
- const I = {}, $ = o.trajectoryUnits ? o.trajectoryUnits.split(",").map((b) => b.trim()) : null;
2527
- C.rows().forEach((b) => {
2528
- const A = b.names.indexOf(r) >= 0 ? b.names.indexOf(r) : b.names.indexOf("unit") >= 0 ? b.names.indexOf("unit") : b.names.indexOf("ENA_UNIT") >= 0 ? b.names.indexOf("ENA_UNIT") : -1, O = A >= 0 ? String(b[A]) : b.rowName || "unit-1";
2529
- if ($ && !$.includes(O)) return;
2530
- const p = b.names.indexOf(n[0]), w = n.length > 1 ? b.names.indexOf(n[1]) : -1, P = b.names.indexOf("time") >= 0 ? b.names.indexOf("time") : b.names.indexOf("ActivityNumber") >= 0 ? b.names.indexOf("ActivityNumber") : b.names.indexOf("RowID") >= 0 ? b.names.indexOf("RowID") : -1, q = P >= 0 ? Number(b[P]) : I[O] ? I[O].length + 1 : 1;
2531
- p >= 0 && w >= 0 && (I[O] || (I[O] = []), I[O].push({
2532
- x: Number(b[p]) * v,
2533
- y: -Number(b[w]) * v,
2534
- time: q
2695
+ const vt = this.__children__.search("__children__", "trajectories");
2696
+ if (o.showTrajectories && vt) {
2697
+ vt.__data__.objects.clear(), this.__data__.trajectories.clear();
2698
+ const I = (Gs = s.trajectories) != null && Gs.rows ? s.trajectories : s.points;
2699
+ if (I != null && I.rows) {
2700
+ const k = {}, P = o.trajectoryUnits ? o.trajectoryUnits.split(",").map((S) => S.trim()) : null;
2701
+ I.rows().forEach((S) => {
2702
+ const y = S.names.indexOf(r) >= 0 ? S.names.indexOf(r) : S.names.indexOf("unit") >= 0 ? S.names.indexOf("unit") : S.names.indexOf("ENA_UNIT") >= 0 ? S.names.indexOf("ENA_UNIT") : -1, O = y >= 0 ? String(S[y]) : S.rowName || "unit-1";
2703
+ if (P && !P.includes(O)) return;
2704
+ const v = S.names.indexOf(n[0]), E = n.length > 1 ? S.names.indexOf(n[1]) : -1, F = S.names.indexOf("time") >= 0 ? S.names.indexOf("time") : S.names.indexOf("ActivityNumber") >= 0 ? S.names.indexOf("ActivityNumber") : S.names.indexOf("RowID") >= 0 ? S.names.indexOf("RowID") : -1, U = F >= 0 ? Number(S[F]) : k[O] ? k[O].length + 1 : 1;
2705
+ v >= 0 && E >= 0 && (k[O] || (k[O] = []), k[O].push({
2706
+ x: Number(S[v]) * z,
2707
+ y: -Number(S[E]) * z,
2708
+ time: U
2535
2709
  }));
2536
- }), Object.keys(I).forEach((b, A) => {
2537
- const O = I[b];
2710
+ }), Object.keys(k).forEach((S, y) => {
2711
+ const O = k[S];
2538
2712
  if (O.length === 0) return;
2539
- const p = _[A % _.length], w = new Ee({
2540
- ID: `traj-${b}`,
2541
- unitId: b,
2542
- color: new st(p),
2713
+ const v = m[y % m.length], E = new Oe({
2714
+ ID: `traj-${S}`,
2715
+ unitId: S,
2716
+ color: new st(v),
2543
2717
  lineStyle: o.trajectoryLineStyle,
2544
2718
  strokeWidth: o.trajectoryStrokeWidth,
2545
2719
  strokeWidthRange: o.trajectoryStrokeWidthRange,
@@ -2550,213 +2724,233 @@ const gt = class gt extends ve {
2550
2724
  currentTime: o.trajectoryPlayhead ?? 1 / 0,
2551
2725
  showPoints: o.trajectoryShowPoints,
2552
2726
  showTips: o.trajectoryShowTips,
2553
- points: O.map((P) => ({ x: P.x, y: P.y, time: P.time }))
2727
+ points: O.map((F) => ({ x: F.x, y: F.y, time: F.time }))
2554
2728
  });
2555
- this.__data__.trajectories.set(b, w), Dt.__data__.objects.set(w.ID, w);
2729
+ this.__data__.trajectories.set(S, E), vt.__data__.objects.set(E.ID, E);
2556
2730
  });
2557
2731
  }
2558
- Dt.__data__.__state__.setVariable("layer_updated", Dt.__data__);
2732
+ vt.__data__.__state__.setVariable("layer_updated", vt.__data__);
2559
2733
  }
2560
- const ut = this.__children__.search("__children__", "network"), Kt = ut == null ? void 0 : ut.__children__.search("__children__", "edges"), ft = ut == null ? void 0 : ut.__children__.search("__children__", "nodes"), fe = ut == null ? void 0 : ut.__children__.search("__children__", "edgenodes"), si = o.showEdges;
2561
- if ((Ls = s.nodes) != null && Ls.rows && ft) {
2562
- if (s.nodes.rows().forEach((I) => {
2563
- const $ = _t(I, a, "#444444");
2564
- $.size = 2;
2565
- const y = I.names.indexOf("label"), b = y >= 0 ? I[y] : null;
2566
- $.meta = {
2567
- ...$.meta ?? {},
2734
+ const At = this.__children__.search("__children__", "network"), xe = At == null ? void 0 : At.__children__.search("__children__", "edges"), it = At == null ? void 0 : At.__children__.search("__children__", "nodes"), ks = At == null ? void 0 : At.__children__.search("__children__", "edgenodes"), di = o.showEdges;
2735
+ if ((Us = s.nodes) != null && Us.rows && it) {
2736
+ if (s.nodes.rows().forEach((k) => {
2737
+ const P = _t(k, a, "#444444");
2738
+ P.size = 2;
2739
+ const N = k.names.indexOf("label"), S = N >= 0 ? k[N] : null, y = k.names.indexOf("size"), O = y >= 0 && k[y] != null && k[y] !== "" ? Number(k[y]) : NaN;
2740
+ P.meta = {
2741
+ ...P.meta ?? {},
2568
2742
  kind: "node",
2569
- name: b != null && String(b) !== "NA" && String(b) !== "" ? String(b) : $.ID
2570
- }, ft.__data__.objects.set($.ID, $);
2571
- }), si && Kt && ((Ds = s.edges) != null && Ds.rows)) {
2572
- const I = {};
2573
- h && ((Ts = s.points) != null && Ts.rows) && s.points.rows().forEach((f) => {
2574
- const x = f.names.indexOf(r), N = f.names.indexOf(h);
2575
- x >= 0 && N >= 0 && (I[String(f[x])] = String(f[N]));
2743
+ name: S != null && String(S) !== "NA" && String(S) !== "" ? String(S) : P.ID,
2744
+ sizePx: Number.isFinite(O) && O > 0 ? O : void 0,
2745
+ // <qe-nodes fixed-size>: constant on-screen size at any zoom.
2746
+ zoomFixed: o.nodeFixedSize || void 0
2747
+ }, it.__data__.objects.set(P.ID, P);
2748
+ }), di && xe) {
2749
+ const k = {};
2750
+ h && ((Xs = s.points) != null && Xs.rows) && s.points.rows().forEach((x) => {
2751
+ const A = x.names.indexOf(r), C = x.names.indexOf(h);
2752
+ A >= 0 && C >= 0 && (k[String(x[A])] = String(x[C]));
2576
2753
  });
2577
- const $ = s.nodes.rows().map((f) => {
2578
- const x = f.names.indexOf(a);
2579
- return x >= 0 ? String(f[x]) : "";
2580
- }).filter(Boolean), y = [];
2581
- (s.edges.names ?? []).forEach((f) => {
2582
- const x = Mi(f, $);
2583
- x && y.push({ col: f, pair: x });
2584
- });
2585
- const b = /* @__PURE__ */ u((f) => {
2586
- const x = {};
2587
- return s.edges.rows().forEach((N) => {
2588
- const z = N.names.indexOf(r);
2589
- z < 0 || String(N[z]) !== f || y.forEach(({ col: D }) => {
2590
- const M = N.names.indexOf(D);
2591
- M >= 0 && (x[D] = Number(N[M]) || 0);
2754
+ const P = s.nodes.rows().map((x) => {
2755
+ const A = x.names.indexOf(a);
2756
+ return A >= 0 ? String(x[A]) : "";
2757
+ }).filter(Boolean), N = /* @__PURE__ */ c((x) => {
2758
+ const A = [];
2759
+ return x.forEach((C) => {
2760
+ const M = Fi(C, P);
2761
+ M && A.push({ col: C, pair: M });
2762
+ }), A;
2763
+ }, "parsePairs"), S = (Ws = s.edges) != null && Ws.rows ? s.edges.rows() : [], y = s.networks, O = N(((Hs = s.edges) == null ? void 0 : Hs.names) ?? []), v = N((y == null ? void 0 : y.names) ?? []), E = /* @__PURE__ */ c((x) => {
2764
+ const A = {};
2765
+ return S.forEach((C) => {
2766
+ const M = C.names.indexOf(r);
2767
+ M < 0 || String(C[M]) !== x || O.forEach(({ col: T }) => {
2768
+ const H = C.names.indexOf(T);
2769
+ H >= 0 && (A[T] = Number(C[H]) || 0);
2592
2770
  });
2593
- }), x;
2594
- }, "getUnitEdges"), A = /* @__PURE__ */ u((f) => {
2595
- const x = {};
2596
- let N = 0;
2597
- if (s.edges.rows().forEach((D) => {
2598
- const M = D.names.indexOf(r), tt = M >= 0 ? String(D[M]) : null, G = h ? D.names.indexOf(h) : -1;
2599
- (G >= 0 ? String(D[G]) : tt ? I[tt] : null) === f && (N++, y.forEach(({ col: T }) => {
2600
- const pt = D.names.indexOf(T);
2601
- if (pt >= 0) {
2602
- const V = Number(D[pt]);
2603
- isNaN(V) || (x[T] = (x[T] ?? 0) + V);
2771
+ }), A;
2772
+ }, "getUnitEdges"), F = /* @__PURE__ */ c((x) => {
2773
+ const A = {};
2774
+ let C = 0;
2775
+ if (S.forEach((T) => {
2776
+ const H = T.names.indexOf(r), ut = H >= 0 ? String(T[H]) : null, mt = h ? T.names.indexOf(h) : -1;
2777
+ (mt >= 0 ? String(T[mt]) : ut ? k[ut] : null) === x && (C++, O.forEach(({ col: bt }) => {
2778
+ const ft = T.names.indexOf(bt);
2779
+ if (ft >= 0) {
2780
+ const V = Number(T[ft]);
2781
+ isNaN(V) || (A[bt] = (A[bt] ?? 0) + V);
2604
2782
  }
2605
2783
  }));
2606
- }), N === 0) return {};
2607
- const z = {};
2608
- return y.forEach(({ col: D }) => {
2609
- z[D] = (x[D] ?? 0) / N;
2610
- }), z;
2611
- }, "getGroupEdges"), O = /* @__PURE__ */ u((f) => {
2612
- if (l[f])
2613
- return { weights: A(f), color: l[f], label: f };
2614
- const x = I[f] ?? null, N = x ? l[x] ?? "#888888" : "#888888";
2615
- return { weights: b(f), color: N, label: f };
2616
- }, "resolve"), p = [], w = /* @__PURE__ */ u((f) => {
2617
- var D;
2618
- const x = s.networks, N = (D = x == null ? void 0 : x.rows) == null ? void 0 : D.call(x).find((M) => M.rowName === f);
2619
- if (!N) return null;
2620
- const z = {};
2621
- return y.forEach(({ col: M }) => {
2622
- const tt = N.names.indexOf(M);
2623
- if (tt >= 0) {
2624
- const G = Number(N[tt]);
2625
- Number.isFinite(G) && (z[M] = G);
2784
+ }), C === 0) return {};
2785
+ const M = {};
2786
+ return O.forEach(({ col: T }) => {
2787
+ M[T] = (A[T] ?? 0) / C;
2788
+ }), M;
2789
+ }, "getGroupEdges"), U = /* @__PURE__ */ c((x) => {
2790
+ if (_[x])
2791
+ return { weights: F(x), color: _[x], label: x };
2792
+ const A = k[x] ?? null, C = A ? _[A] ?? "#888888" : "#888888";
2793
+ return { weights: E(x), color: C, label: x };
2794
+ }, "resolve"), Y = [], W = /* @__PURE__ */ c((x) => {
2795
+ var M;
2796
+ const A = (M = y == null ? void 0 : y.rows) == null ? void 0 : M.call(y).find((T) => T.rowName === x);
2797
+ if (!A) return null;
2798
+ const C = {};
2799
+ return v.forEach(({ col: T }) => {
2800
+ const H = A.names.indexOf(T);
2801
+ if (H >= 0) {
2802
+ const ut = Number(A[H]);
2803
+ Number.isFinite(ut) && (C[T] = ut);
2626
2804
  }
2627
- }), z;
2628
- }, "networkRow"), P = /* @__PURE__ */ u((f, x) => {
2629
- if (!x) return f;
2630
- const N = Math.abs(f);
2631
- return N < x[0] ? 0 : N > x[1] ? Math.sign(f) * x[1] : f;
2805
+ }), C;
2806
+ }, "networkRow"), pt = /* @__PURE__ */ c((x, A) => {
2807
+ if (!A) return x;
2808
+ const C = Math.abs(x);
2809
+ return C < A[0] ? 0 : C > A[1] ? Math.sign(x) * A[1] : x;
2632
2810
  }, "thresholded");
2633
- o.edgeLayers.forEach((f, x) => {
2634
- const N = /* @__PURE__ */ u((V, ht, Q, wt, lt) => {
2635
- Q = P(Q, f.threshold), !(Math.abs(Q) < 1e-6) && p.push({ col: `${x}:${V}`, pair: ht, weight: Math.abs(Q), color: wt, layer: x, ...lt });
2636
- }, "push"), z = /* @__PURE__ */ u((V, ht) => f.colors ? [f.colors[0], f.colors[1] ?? Ci(f.colors[0])] : [V, ht], "signColors");
2637
- if (f.network) {
2638
- const V = w(f.network);
2811
+ o.edgeLayers.forEach((x, A) => {
2812
+ const C = /* @__PURE__ */ c((V, ot, Q, wt, at) => {
2813
+ Q = pt(Q, x.threshold), !(Math.abs(Q) < 1e-6) && Y.push({ col: `${A}:${V}`, pair: ot, weight: Math.abs(Q), color: wt, layer: A, ...at });
2814
+ }, "push"), M = /* @__PURE__ */ c((V, ot) => x.colors ? [x.colors[0], x.colors[1] ?? Bi(x.colors[0])] : [V, ot], "signColors");
2815
+ if (x.network) {
2816
+ const V = W(x.network);
2639
2817
  if (!V) return;
2640
- const [ht, Q] = z(_[0], _[1]), wt = { name: f.name ?? f.network };
2641
- y.forEach(({ col: lt, pair: zs }) => {
2642
- const me = V[lt] ?? 0;
2643
- N(lt, zs, me, me >= 0 ? ht : Q, wt);
2818
+ const [ot, Q] = M(m[0], m[1]), wt = { name: x.name ?? x.network };
2819
+ v.forEach(({ col: at, pair: Vs }) => {
2820
+ const ne = V[at] ?? 0;
2821
+ C(at, Vs, ne, ne >= 0 ? ot : Q, wt);
2644
2822
  });
2645
2823
  return;
2646
2824
  }
2647
- const D = f.unit ?? f.group ?? null;
2648
- if (!D) return;
2649
- const M = O(D), tt = f.compare ?? f.also ?? null, G = tt ? O(tt) : null, rt = { name: f.name ?? D, group: f.group ?? void 0, unit: f.unit ?? void 0 }, [T, pt] = z(M.color, (G == null ? void 0 : G.color) ?? M.color);
2650
- G && f.compare ? y.forEach(({ col: V, pair: ht }) => {
2651
- const Q = (M.weights[V] ?? 0) - (G.weights[V] ?? 0);
2652
- N(V, ht, Q, Q > 0 ? T : pt, rt);
2653
- }) : G && f.also ? y.forEach(({ col: V, pair: ht }) => {
2654
- const Q = M.weights[V] ?? 0, wt = G.weights[V] ?? 0;
2655
- Q > 0 && N(V + "-a", ht, Q, T, rt), wt > 0 && N(V + "-b", ht, wt, pt, { ...rt, name: f.also ?? void 0, group: f.also ?? void 0 });
2656
- }) : y.forEach(({ col: V, pair: ht }) => {
2657
- const Q = M.weights[V] ?? 0;
2658
- Q > 0 && N(V, ht, Q, T, rt);
2825
+ const T = x.unit ?? x.group ?? null;
2826
+ if (!T) return;
2827
+ const H = U(T), ut = x.compare ?? x.also ?? null, mt = ut ? U(ut) : null, Et = { name: x.name ?? T, group: x.group ?? void 0, unit: x.unit ?? void 0 }, [bt, ft] = M(H.color, (mt == null ? void 0 : mt.color) ?? H.color);
2828
+ mt && x.compare ? O.forEach(({ col: V, pair: ot }) => {
2829
+ const Q = (H.weights[V] ?? 0) - (mt.weights[V] ?? 0);
2830
+ C(V, ot, Q, Q > 0 ? bt : ft, Et);
2831
+ }) : mt && x.also ? O.forEach(({ col: V, pair: ot }) => {
2832
+ const Q = H.weights[V] ?? 0, wt = mt.weights[V] ?? 0;
2833
+ Q > 0 && C(V + "-a", ot, Q, bt, Et), wt > 0 && C(V + "-b", ot, wt, ft, { ...Et, name: x.also ?? void 0, group: x.also ?? void 0 });
2834
+ }) : O.forEach(({ col: V, pair: ot }) => {
2835
+ const Q = H.weights[V] ?? 0;
2836
+ Q > 0 && C(V, ot, Q, bt, Et);
2659
2837
  });
2660
- }), p.sort((f, x) => x.weight - f.weight);
2661
- const q = !!s.directed, X = wi(o.edgeWidth) * (o.edgeMagnify ?? 1), W = /* @__PURE__ */ u((f) => {
2662
- const x = f.map(Math.abs).filter((N) => N > 0);
2663
- return x.length ? [Math.min(...x), Math.max(...x)] : [0, 0];
2664
- }, "rangeOf"), mt = /* @__PURE__ */ u((f) => {
2665
- const x = [];
2666
- return y.forEach(({ col: N, pair: z }) => {
2667
- if (z[0] === z[1] !== f) return;
2668
- const D = s.edges.col(N);
2669
- if (D) for (const M of D) x.push(Number(M));
2670
- }), W(x);
2671
- }, "modelRange"), Z = /* @__PURE__ */ u((f) => W(p.filter((x) => x.pair[0] === x.pair[1] === f).map((x) => x.weight)), "plotRange"), at = o.edgeColorScale, L = /* @__PURE__ */ u((f) => at === "plot" ? Z(f) : mt(f), "colourRange"), Tt = L(!1), xt = L(!0), At = /* @__PURE__ */ u((f, x) => {
2672
- if (at === "absolute") {
2673
- const D = Math.min(1, Math.abs(f));
2674
- return { saturation: D, opacity: D };
2838
+ }), Y.sort((x, A) => A.weight - x.weight);
2839
+ const X = !!s.directed, rt = Pi(o.edgeWidth) * (o.edgeMagnify ?? 1), R = /* @__PURE__ */ c((x) => {
2840
+ const A = x.map(Math.abs).filter((C) => C > 0);
2841
+ return A.length ? [Math.min(...A), Math.max(...A)] : [0, 0];
2842
+ }, "rangeOf"), [jt, gt] = S.length ? [O, s.edges] : [v, y], St = /* @__PURE__ */ c((x) => {
2843
+ const A = [];
2844
+ return jt.forEach(({ col: C, pair: M }) => {
2845
+ if (M[0] === M[1] !== x) return;
2846
+ const T = gt == null ? void 0 : gt.col(C);
2847
+ if (T) for (const H of T) A.push(Number(H));
2848
+ }), R(A);
2849
+ }, "modelRange"), Rt = /* @__PURE__ */ c((x) => R(Y.filter((A) => A.pair[0] === A.pair[1] === x).map((A) => A.weight)), "plotRange"), ie = o.edgeColorScale, B = /* @__PURE__ */ c((x) => ie === "plot" ? Rt(x) : St(x), "colourRange"), nt = B(!1), Yt = B(!0), we = /* @__PURE__ */ c((x, A) => {
2850
+ if (ie === "absolute") {
2851
+ const T = Math.min(1, Math.abs(x));
2852
+ return { saturation: T, opacity: T };
2675
2853
  }
2676
- const [N, z] = x ? xt : Tt;
2677
- return { saturation: Xs(f, N, z, gi), opacity: Xs(f, N, z, fi) };
2678
- }, "colourOf"), vt = {};
2679
- p.forEach(({ pair: f, weight: x }) => {
2680
- if (f[0] === f[1] && !q) return;
2681
- const z = /* @__PURE__ */ u((D) => {
2682
- vt[D] = (vt[D] ?? 0) + Math.abs(x);
2854
+ const [C, M] = A ? Yt : nt;
2855
+ return { saturation: ni(x, C, M, Mi), opacity: ni(x, C, M, Ii) };
2856
+ }, "colourOf"), qt = {};
2857
+ Y.forEach(({ pair: x, weight: A }) => {
2858
+ if (x[0] === x[1] && !X) return;
2859
+ const M = /* @__PURE__ */ c((T) => {
2860
+ qt[T] = (qt[T] ?? 0) + Math.abs(A);
2683
2861
  }, "add");
2684
- if (q) {
2685
- z(f[1]);
2862
+ if (X) {
2863
+ M(x[1]);
2686
2864
  return;
2687
2865
  }
2688
- z(f[0]), z(f[1]);
2689
- }), s.nodes.rows().forEach((f) => {
2690
- const x = f.names.indexOf(a), N = x >= 0 ? String(f[x]) : "";
2691
- if (!N) return;
2692
- const z = ft.__data__.objects.get(N);
2693
- if (!z) return;
2694
- const D = vt[N] ?? 0, M = !(D > 0);
2695
- z.size = M ? o.hideUnconnectedNodes ? 0 : xi : Ai(D, X), z.meta = {
2696
- ...z.meta ?? {},
2697
- hidden: M && o.hideUnconnectedNodes
2866
+ M(x[0]), M(x[1]);
2867
+ }), s.nodes.rows().forEach((x) => {
2868
+ var ut;
2869
+ const A = x.names.indexOf(a), C = A >= 0 ? String(x[A]) : "";
2870
+ if (!C) return;
2871
+ const M = it.__data__.objects.get(C);
2872
+ if (!M) return;
2873
+ const T = qt[C] ?? 0, H = !(T > 0);
2874
+ M.size = H ? o.hideUnconnectedNodes ? 0 : Oi : Li(T, rt), M.meta = {
2875
+ ...M.meta ?? {},
2876
+ hidden: H && o.hideUnconnectedNodes,
2877
+ sizePx: H || (ut = M.meta) == null ? void 0 : ut.sizePx
2698
2878
  };
2699
2879
  });
2700
- const $t = {}, U = /* @__PURE__ */ u((f, x, N, z) => `${f}:${x ?? ""}:${N}.${z}`, "pairKey");
2701
- q && p.forEach(({ pair: f, weight: x, layer: N, name: z }) => {
2702
- const D = U(N, z, f[0], f[1]);
2703
- $t[D] = ($t[D] ?? 0) + x;
2704
- }), p.forEach(({ col: f, pair: x, weight: N, color: z, layer: D, name: M, group: tt, unit: G }) => {
2705
- const rt = ft.__data__.objects.get(x[0]), T = ft.__data__.objects.get(x[1]);
2706
- if (!rt || !T) return;
2707
- const pt = x[0] === x[1];
2708
- if (pt && !q) return;
2709
- const { saturation: V, opacity: ht } = At(N, pt), Q = new J({ ID: `${x[0]}-src`, dimensions: [rt.x, rt.y], meta: {} }), wt = new J({ ID: `${x[1]}-dst`, dimensions: [T.x, T.y], meta: {} });
2710
- let lt;
2711
- if (pt)
2712
- lt = new ne({}, Q, wt), lt.weight = 0;
2713
- else if (q) {
2714
- const me = $t[U(D, M, x[0], x[1])] ?? N, ii = $t[U(D, M, x[1], x[0])] ?? 0, ni = me + ii;
2715
- lt = new Qe(
2716
- { weight: N, totalweight: ni },
2880
+ const $t = {}, j = /* @__PURE__ */ c((x, A, C, M) => `${x}:${A ?? ""}:${C}.${M}`, "pairKey");
2881
+ X && Y.forEach(({ pair: x, weight: A, layer: C, name: M }) => {
2882
+ const T = j(C, M, x[0], x[1]);
2883
+ $t[T] = ($t[T] ?? 0) + A;
2884
+ }), Y.forEach(({ col: x, pair: A, weight: C, color: M, layer: T, name: H, group: ut, unit: mt }) => {
2885
+ var ne, Zs;
2886
+ const Et = it.__data__.objects.get(A[0]), bt = it.__data__.objects.get(A[1]);
2887
+ if (!Et || !bt) return;
2888
+ const ft = A[0] === A[1];
2889
+ if (ft && !X) return;
2890
+ const { saturation: V, opacity: ot } = we(C, ft), Q = new K({ ID: `${A[0]}-src`, dimensions: [Et.x, Et.y], meta: {} }), wt = new K({ ID: `${A[1]}-dst`, dimensions: [bt.x, bt.y], meta: {} });
2891
+ let at;
2892
+ if (ft)
2893
+ at = new Ht({}, Q, wt), at.weight = 0;
2894
+ else if (X) {
2895
+ const gi = $t[j(T, H, A[0], A[1])] ?? C, mi = $t[j(T, H, A[1], A[0])] ?? 0, fi = gi + mi;
2896
+ at = new os(
2897
+ { weight: C, totalweight: fi },
2717
2898
  Q,
2718
2899
  wt
2719
2900
  );
2720
2901
  } else
2721
- lt = new Xt({}, Q, wt);
2722
- lt.ID = `edge-${f}`, lt.color = new st(z), lt.meta = {
2902
+ at = new te({}, Q, wt);
2903
+ at.ID = `edge-${x}`, at.color = new st(M), at.meta = {
2723
2904
  isMeanEdge: !0,
2724
- weight: N,
2905
+ weight: C,
2725
2906
  // Width per unit weight (extent units), shared by all marks.
2726
- widthFrac: X,
2907
+ widthFrac: rt,
2727
2908
  saturation: V,
2728
- opacity: ht,
2729
- isDirected: q,
2730
- isSelf: pt,
2909
+ opacity: ot,
2910
+ isDirected: X,
2911
+ isSelf: ft,
2731
2912
  // Identity for the qe-edge-* interaction events.
2732
- source: x[0],
2733
- target: x[1],
2734
- group: tt,
2735
- unit: G,
2736
- layer: M
2737
- }, (pt ? fe ?? Kt : Kt).__data__.objects.set(lt.ID, lt);
2738
- }), Kt.__data__.__state__.setVariable("layer_updated", Kt.__data__), fe && fe.__data__.__state__.setVariable("layer_updated", fe.__data__);
2913
+ source: A[0],
2914
+ target: A[1],
2915
+ group: ut,
2916
+ unit: mt,
2917
+ layer: H,
2918
+ // <qe-edges self-size>: self dot radius as a fraction of its node's.
2919
+ selfSize: ft ? ((ne = o.edgeLayers[T]) == null ? void 0 : ne.selfSize) ?? void 0 : void 0,
2920
+ // <qe-edges fixed-size>: thickness keeps its zoom-1 on-screen size.
2921
+ fixedSize: ((Zs = o.edgeLayers[T]) == null ? void 0 : Zs.fixedSize) || void 0
2922
+ }, (ft ? ks ?? xe : xe).__data__.objects.set(at.ID, at);
2923
+ });
2739
2924
  }
2740
- const C = o.showNodes;
2741
- ft.svg_element && (ft.svg_element.style.display = C ? "" : "none"), C || (this._nodeLabels.forEach((I) => I.remove()), this._nodeLabels.clear()), it && F !== 0 && C && (this._nodeLabels.forEach((I, $) => {
2742
- ft.__data__.objects.get($) || (I.remove(), this._nodeLabels.delete($));
2743
- }), s.nodes.rows().forEach((I) => {
2744
- var p, w, P;
2745
- const $ = I.names.indexOf(a), y = $ >= 0 ? String(I[$]) : "";
2746
- if (!y) return;
2747
- const b = ft.__data__.objects.get(y);
2748
- if (!b) return;
2749
- if ((p = b.meta) != null && p.hidden) {
2750
- (w = this._nodeLabels.get(y)) == null || w.remove(), this._nodeLabels.delete(y);
2751
- return;
2925
+ const I = o.showNodes;
2926
+ it.svg_element && (it.svg_element.style.display = I ? "" : "none"), I || this._clearLabels(this._nodeLabels), J && I && (this._nodeLabels.forEach((k, P) => {
2927
+ it.__data__.objects.get(P) || (k.remove(), this._nodeLabels.delete(P));
2928
+ }), s.nodes.rows().forEach((k) => {
2929
+ var y, O, v;
2930
+ const P = k.names.indexOf(a), N = P >= 0 ? String(k[P]) : "";
2931
+ if (!N) return;
2932
+ const S = it.__data__.objects.get(N);
2933
+ if (S) {
2934
+ if ((y = S.meta) != null && y.hidden) {
2935
+ (O = this._nodeLabels.get(N)) == null || O.remove(), this._nodeLabels.delete(N);
2936
+ return;
2937
+ }
2938
+ this._syncLabel(
2939
+ this._nodeLabels,
2940
+ N,
2941
+ Se(k, String(((v = S.meta) == null ? void 0 : v.name) ?? N)),
2942
+ S,
2943
+ J,
2944
+ D,
2945
+ o.labelWeightNodes
2946
+ );
2752
2947
  }
2753
- const A = String(((P = b.meta) == null ? void 0 : P.name) ?? y);
2754
- let O = this._nodeLabels.get(y);
2755
- O && O.text !== A && (O.remove(), this._nodeLabels.delete(y), O = void 0), O ? F === H.DISPLAY_TYPES.ON ? O.show() : O.hide() : (O = new Jt(A, b, it, this, F), this._nodeLabels.set(y, O));
2756
- })), ft.__data__.__state__.setVariable("layer_updated", ft.__data__);
2757
- }
2758
- const ws = this.__children__.search("__children__", "axis_points"), As = this.__children__.search("__children__", "axis_lines");
2759
- ws && this.__data__.__state__.setVariable("graph_updated_axis_points", ws.__data__.objects), As && this.__data__.__state__.setVariable("graph_updated_axis_lines", As.__data__.objects), this.update(), i && this._runTween(i);
2948
+ })), it.__data__.__state__.setVariable("layer_updated", it.__data__);
2949
+ } else
2950
+ it == null || it.__data__.__state__.setVariable("layer_updated", it.__data__);
2951
+ [xe, ks].forEach((I) => I == null ? void 0 : I.__data__.__state__.setVariable("layer_updated", I.__data__));
2952
+ const zs = this.__children__.search("__children__", "axis_points"), Cs = this.__children__.search("__children__", "axis_lines");
2953
+ zs && this.__data__.__state__.setVariable("graph_updated_axis_points", zs.__data__.objects), Cs && this.__data__.__state__.setVariable("graph_updated_axis_lines", Cs.__data__.objects), this.update(), i && this._startTween(i);
2760
2954
  });
2761
2955
  }
2762
2956
  static get observedAttributes() {
@@ -2767,6 +2961,7 @@ const gt = class gt extends ve {
2767
2961
  "scale-points",
2768
2962
  "point-scale",
2769
2963
  "center",
2964
+ "view-padding",
2770
2965
  "labels",
2771
2966
  "label-nodes",
2772
2967
  "label-means",
@@ -2776,12 +2971,60 @@ const gt = class gt extends ve {
2776
2971
  get vizena() {
2777
2972
  return this._vizena;
2778
2973
  }
2974
+ /** <qe-graph view-padding>: the view spans ±range × this (default 1.2). */
2975
+ _viewPadding() {
2976
+ const t = Number(this.getAttribute("view-padding"));
2977
+ return this.hasAttribute("view-padding") && Number.isFinite(t) && t > 0 ? t : 1.2;
2978
+ }
2779
2979
  /** SVG user units per CSS pixel at the current size / zoom. */
2780
2980
  unitsPerPixel() {
2781
2981
  var i, n;
2782
2982
  const t = this.__data__.extremes.x_max || 1, e = (n = (i = this.svg_element) == null ? void 0 : i.getBoundingClientRect) == null ? void 0 : n.call(i), s = this.zoom_level || 1;
2783
2983
  return e && e.width > 0 ? 2 * t / e.width / s : t * 4e-3;
2784
2984
  }
2985
+ /**
2986
+ * Keep one mark's label in step with this render. A reused label is rebound
2987
+ * to the render's Point (each render builds new ones, so a label left on the
2988
+ * old Point stays at the old coordinates); one whose text or display mode
2989
+ * changed is rebuilt. A row with no text (label "") has no label, and with
2990
+ * mode "off" only a pinned row does. "auto" / "click" labels keep the state
2991
+ * hover or a click left them in, so a host that re-renders on hover doesn't
2992
+ * undo it. The row's offset, pin and the layer's font weight are applied
2993
+ * every render.
2994
+ */
2995
+ _syncLabel(t, e, s, i, n, r, a) {
2996
+ let h = t.get(e);
2997
+ const o = s.text != null && (r !== q.DISPLAY_TYPES.OFF || s.pinned);
2998
+ h && (!o || h.text !== s.text || h.displayMode !== r) && (h.remove(), t.delete(e), h = void 0), o && (h ? (h.setPoint(i), r === q.DISPLAY_TYPES.ON && h.show()) : (h = new hs(s.text, i, n, this, r), t.set(e, h)), s.offset && h.setOffset(s.offset.x, s.offset.y), h.fontWeight = a, h.setHostPinned(s.pinned));
2999
+ }
3000
+ /** Rendered radius of a code node in graph units (for self-size), or null. */
3001
+ _nodeRadius(t) {
3002
+ const e = this.__children__.search("__children__", "nodes"), s = e == null ? void 0 : e.__children__.find((i) => {
3003
+ var n;
3004
+ return ((n = i.__data__) == null ? void 0 : n.ID) === t;
3005
+ });
3006
+ return s ? s.computeRadius() : null;
3007
+ }
3008
+ /** Remember an interval mark's zoom-1 stroke width and dashes, and apply
3009
+ * them for the current zoom (see _applyIntervalStroke). */
3010
+ _intervalStroke(t, e, s) {
3011
+ this._intervalBase.set(t, { w: e, dash: s }), this._applyIntervalStroke(t);
3012
+ }
3013
+ /** With <qe-means fixed-size>, divide by the zoom level (the zoom group
3014
+ * scales strokes and dashes by it); otherwise the zoom-1 values. Interval
3015
+ * marks are built once per render, so update() re-applies this on zoom. */
3016
+ _applyIntervalStroke(t) {
3017
+ const e = this._intervalBase.get(t);
3018
+ if (!e) return;
3019
+ const s = this._meansFixedSize && this.zoom_level || 1;
3020
+ t.setAttribute("stroke-width", String(e.w / s)), e.dash && t.setAttribute("stroke-dasharray", e.dash.map((i) => i / s).join(" "));
3021
+ }
3022
+ _removeIntervals(t) {
3023
+ t.forEach((e) => e.remove()), t.clear();
3024
+ }
3025
+ _clearLabels(t) {
3026
+ t.forEach((e) => e.remove()), t.clear();
3027
+ }
2785
3028
  // ── Shared re-render scheduler ───────────────────────────────────────────────
2786
3029
  // Batches synchronous attribute / child-list changes into a single microtask
2787
3030
  // so that e.g. adding <qe-edges> and setting its attributes in the same tick
@@ -2789,11 +3032,11 @@ const gt = class gt extends ve {
2789
3032
  _scheduleRerender() {
2790
3033
  !this._vizena || !this._hasModel || this._renderPending || (this._renderPending = !0, queueMicrotask(() => {
2791
3034
  var t;
2792
- this._renderPending = !1, (t = this._vizena) == null || t.dispatchEvent(new CustomEvent("model-updated", {
3035
+ this._renderPending && (this._renderPending = !1, (t = this._vizena) == null || t.dispatchEvent(new CustomEvent("model-updated", {
2793
3036
  detail: this._vizena.model,
2794
3037
  bubbles: !0,
2795
3038
  composed: !0
2796
- }));
3039
+ })));
2797
3040
  }));
2798
3041
  }
2799
3042
  // ── Layer configuration reader ────────────────────────────────────────────────
@@ -2801,43 +3044,46 @@ const gt = class gt extends ve {
2801
3044
  // should render. Called once at the top of every model-updated handler so
2802
3045
  // all rendering decisions are derived from a single snapshot.
2803
3046
  _readLayerConfig() {
2804
- var g;
2805
- const t = this.querySelector("qe-nodes"), e = this.querySelector("qe-means"), s = [...this.querySelectorAll("qe-points")], i = s.find((c) => !c.hasAttribute("set")) ?? null, n = s.filter((c) => c.hasAttribute("set")), r = [...this.querySelectorAll("qe-edges")], a = /* @__PURE__ */ u((c) => {
2806
- var E;
2807
- return ((E = r.find((m) => m.hasAttribute(c))) == null ? void 0 : E.getAttribute(c)) ?? null;
2808
- }, "firstAttr"), h = r.find((c) => c.hasAttribute("magnify")), o = this.querySelector("qe-trajectories"), l = this.querySelector("qe-axes"), _ = this.getAttribute("labels");
3047
+ var p;
3048
+ const t = this.querySelector("qe-nodes"), e = this.querySelector("qe-means"), s = [...this.querySelectorAll("qe-points")], i = s.find((u) => !u.hasAttribute("set")) ?? null, n = s.filter((u) => u.hasAttribute("set")), r = [...this.querySelectorAll("qe-edges")], a = /* @__PURE__ */ c((u) => {
3049
+ var d;
3050
+ return ((d = r.find((l) => l.hasAttribute(u))) == null ? void 0 : d.getAttribute(u)) ?? null;
3051
+ }, "firstAttr"), h = r.find((u) => u.hasAttribute("magnify")), o = this.querySelector("qe-trajectories"), _ = this.querySelector("qe-axes"), m = this.getAttribute("labels");
2809
3052
  return {
2810
3053
  // Nodes — always placed from the model (they anchor the coordinate
2811
3054
  // space); <qe-nodes> presence draws them, like every other layer.
2812
- labelNodes: He(
2813
- (t == null ? void 0 : t.getAttribute("label")) ?? this.getAttribute("label-nodes") ?? _,
2814
- H.DISPLAY_TYPES.ON
3055
+ labelNodes: Ee(
3056
+ (t == null ? void 0 : t.getAttribute("label")) ?? this.getAttribute("label-nodes") ?? m,
3057
+ q.DISPLAY_TYPES.ON
2815
3058
  ),
3059
+ // label-font-weight on a layer element (e.g. "bold"); null = 500.
3060
+ labelWeightNodes: (t == null ? void 0 : t.getAttribute("label-font-weight")) || null,
3061
+ nodeFixedSize: !!t && t.hasAttribute("fixed-size"),
2816
3062
  showNodes: !!t,
2817
3063
  range: (() => {
2818
- const c = this.getAttribute("range");
2819
- if (c === "network" || c === "points") return c;
2820
- const E = Number(c);
2821
- return c != null && Number.isFinite(E) && E > 0 ? E : null;
3064
+ const u = this.getAttribute("range");
3065
+ if (u === "network" || u === "points") return u;
3066
+ const d = Number(u);
3067
+ return u != null && Number.isFinite(d) && d > 0 ? d : null;
2822
3068
  })(),
2823
3069
  plotTitle: this.getAttribute("plot-title") || null,
2824
3070
  labelFont: {
2825
3071
  size: (() => {
2826
- const c = Number(this.getAttribute("label-font-size"));
2827
- return Number.isFinite(c) && c > 0 ? c : null;
3072
+ const u = Number(this.getAttribute("label-font-size"));
3073
+ return Number.isFinite(u) && u > 0 ? u : null;
2828
3074
  })(),
2829
3075
  family: this.getAttribute("label-font-family") || null,
2830
3076
  color: this.getAttribute("label-font-color") || null
2831
3077
  },
2832
3078
  edgeWidth: (() => {
2833
- const c = Number(this.getAttribute("edge-width"));
2834
- return Number.isFinite(c) && c > 0 && c <= 1 ? c : di;
3079
+ const u = Number(this.getAttribute("edge-width"));
3080
+ return Number.isFinite(u) && u > 0 && u <= 1 ? u : Ei;
2835
3081
  })(),
2836
- hideUnconnectedNodes: ((g = t == null ? void 0 : t.getAttribute("unconnected")) == null ? void 0 : g.toLowerCase()) === "hide",
3082
+ hideUnconnectedNodes: ((p = t == null ? void 0 : t.getAttribute("unconnected")) == null ? void 0 : p.toLowerCase()) === "hide",
2837
3083
  scalePoints: this.getAttribute("scale-points") !== "false",
2838
3084
  pointScale: (() => {
2839
- const c = Number(this.getAttribute("point-scale"));
2840
- return this.hasAttribute("point-scale") && Number.isFinite(c) && c > 0 ? c : null;
3085
+ const u = Number(this.getAttribute("point-scale"));
3086
+ return this.hasAttribute("point-scale") && Number.isFinite(u) && u > 0 ? u : null;
2841
3087
  })(),
2842
3088
  centerContent: this.getAttribute("center") === "content",
2843
3089
  // Means — presence of <qe-means> = show; absence = hide.
@@ -2846,38 +3092,46 @@ const gt = class gt extends ve {
2846
3092
  showCI: !!e && e.hasAttribute("confidence"),
2847
3093
  // intervals="box|crosshairs|none"; absent → the legacy `confidence` flag.
2848
3094
  intervals: (() => {
2849
- const c = e == null ? void 0 : e.getAttribute("intervals");
2850
- return c === "box" || c === "crosshairs" || c === "none" ? c : e != null && e.hasAttribute("confidence") ? "box" : "none";
3095
+ const u = e == null ? void 0 : e.getAttribute("intervals");
3096
+ return u === "box" || u === "crosshairs" || u === "none" ? u : e != null && e.hasAttribute("confidence") ? "box" : "none";
2851
3097
  })(),
2852
3098
  showOutlier: !!e && e.hasAttribute("outlier"),
2853
- labelMeans: He(
2854
- (e == null ? void 0 : e.getAttribute("label")) ?? this.getAttribute("label-means") ?? _,
2855
- H.DISPLAY_TYPES.ON
3099
+ labelMeans: Ee(
3100
+ (e == null ? void 0 : e.getAttribute("label")) ?? this.getAttribute("label-means") ?? m,
3101
+ q.DISPLAY_TYPES.ON
2856
3102
  ),
3103
+ labelWeightMeans: (e == null ? void 0 : e.getAttribute("label-font-weight")) || null,
2857
3104
  // fixed-size keeps mean markers a constant on-screen px size (webENA parity).
2858
3105
  meanFixedSize: !!e && e.hasAttribute("fixed-size"),
2859
3106
  // Points — presence of <qe-points> = show unit dots.
2860
3107
  showPoints: !!i,
2861
- pointSets: n.map((c) => ({
2862
- set: c.getAttribute("set"),
2863
- size: c.getAttribute("size") ? parseFloat(c.getAttribute("size")) : null,
2864
- fixedSize: c.hasAttribute("fixed-size")
3108
+ pointSets: n.map((u) => ({
3109
+ set: u.getAttribute("set"),
3110
+ size: u.getAttribute("size") ? parseFloat(u.getAttribute("size")) : null,
3111
+ fixedSize: u.hasAttribute("fixed-size"),
3112
+ // Label mode: this set's `label`, else <qe-graph label-points>.
3113
+ labelMode: Ee(
3114
+ u.getAttribute("label") ?? this.getAttribute("label-points") ?? m,
3115
+ q.DISPLAY_TYPES.OFF
3116
+ ),
3117
+ labelWeight: u.getAttribute("label-font-weight") || null
2865
3118
  })),
2866
- labelPoints: He(
2867
- (i == null ? void 0 : i.getAttribute("label")) ?? this.getAttribute("label-points") ?? _,
2868
- H.DISPLAY_TYPES.OFF
3119
+ labelPoints: Ee(
3120
+ (i == null ? void 0 : i.getAttribute("label")) ?? this.getAttribute("label-points") ?? m,
3121
+ q.DISPLAY_TYPES.OFF
2869
3122
  ),
3123
+ labelWeightPoints: (i == null ? void 0 : i.getAttribute("label-font-weight")) || null,
2870
3124
  pointSize: i != null && i.getAttribute("size") ? parseFloat(i.getAttribute("size")) : null,
2871
3125
  // fixed-size keeps unit dots a constant on-screen px size (webENA parity).
2872
3126
  pointFixedSize: !!i && i.hasAttribute("fixed-size"),
2873
3127
  // Edges — presence of <qe-edges> = draw a network.
2874
3128
  showEdges: r.length > 0,
2875
- edgeLayers: r.map(ki),
3129
+ edgeLayers: r.map(qi),
2876
3130
  // Plot-wide edge settings: the first <qe-edges> that sets them.
2877
- edgeColorScale: Oi(a("color-scale")),
3131
+ edgeColorScale: Gi(a("color-scale")),
2878
3132
  edgeMagnify: h ? (() => {
2879
- const c = Number(h.getAttribute("magnify"));
2880
- return Number.isFinite(c) && c > 0 ? c : 1;
3133
+ const u = Number(h.getAttribute("magnify"));
3134
+ return Number.isFinite(u) && u > 0 ? u : 1;
2881
3135
  })() : null,
2882
3136
  // Trajectories — presence of <qe-trajectories> = draw cognitive trajectories
2883
3137
  showTrajectories: !!o,
@@ -2896,9 +3150,10 @@ const gt = class gt extends ve {
2896
3150
  // a per-axis label: a value is used verbatim, an empty attribute falls back
2897
3151
  // to the dimension name (resolved later, where dims are known). null = no
2898
3152
  // label for that axis.
2899
- showAxes: !!l,
2900
- axisXLabel: l != null && l.hasAttribute("x") ? l.getAttribute("x") ?? "" : null,
2901
- axisYLabel: l != null && l.hasAttribute("y") ? l.getAttribute("y") ?? "" : null
3153
+ showAxes: !!_,
3154
+ axesFixedSize: !!_ && _.hasAttribute("fixed-size"),
3155
+ axisXLabel: _ != null && _.hasAttribute("x") ? _.getAttribute("x") ?? "" : null,
3156
+ axisYLabel: _ != null && _.hasAttribute("y") ? _.getAttribute("y") ?? "" : null
2902
3157
  };
2903
3158
  }
2904
3159
  _parseNumberPair(t, e) {
@@ -2912,7 +3167,7 @@ const gt = class gt extends ve {
2912
3167
  connectedCallback() {
2913
3168
  var n;
2914
3169
  const t = this.getAttribute("width"), e = this.getAttribute("height");
2915
- this.style.display = "block", t && (this.style.width = isNaN(Number(t)) ? t : `${t}px`), e && (this.style.height = isNaN(Number(e)) ? e : `${e}px`), this.appendChild(this.svg_element), gt._instances.add(this), this._childObserver = new MutationObserver(() => this._scheduleRerender()), this._childObserver.observe(this, {
3170
+ this.style.display = "block", t && (this.style.width = isNaN(Number(t)) ? t : `${t}px`), e && (this.style.height = isNaN(Number(e)) ? e : `${e}px`), this.appendChild(this.svg_element), et._instances.add(this), this._childObserver = new MutationObserver(() => this._scheduleRerender()), this._childObserver.observe(this, {
2916
3171
  childList: !0,
2917
3172
  attributes: !0,
2918
3173
  subtree: !0,
@@ -2940,13 +3195,16 @@ const gt = class gt extends ve {
2940
3195
  "labels",
2941
3196
  "range",
2942
3197
  "center",
3198
+ "view-padding",
2943
3199
  "plot-title",
2944
3200
  "label-font-size",
2945
3201
  "label-font-family",
2946
3202
  "label-font-color",
3203
+ "label-font-weight",
2947
3204
  "label-nodes",
2948
3205
  "label-means",
2949
3206
  "label-points",
3207
+ "self-size",
2950
3208
  "units",
2951
3209
  "smooth",
2952
3210
  "degree",
@@ -2976,15 +3234,15 @@ const gt = class gt extends ve {
2976
3234
  }
2977
3235
  disconnectedCallback() {
2978
3236
  var t, e, s;
2979
- (t = this._childObserver) == null || t.disconnect(), this._childObserver = null, (e = this._resizeObs) == null || e.disconnect(), this._resizeObs = null, gt._instances.delete(this), (s = this._tooltipEl) == null || s.remove(), this._tooltipEl = null;
3237
+ this._stopTween(), (t = this._childObserver) == null || t.disconnect(), this._childObserver = null, (e = this._resizeObs) == null || e.disconnect(), this._resizeObs = null, et._instances.delete(this), (s = this._tooltipEl) == null || s.remove(), this._tooltipEl = null;
2980
3238
  }
2981
3239
  /** All connected <qe-graph> instances (newest membership order). */
2982
3240
  static instances() {
2983
- return [...gt._instances];
3241
+ return [...et._instances];
2984
3242
  }
2985
3243
  /** Look up a graph by its `id` or `plot-group` attribute. */
2986
3244
  static getGraph(t) {
2987
- for (const e of gt._instances)
3245
+ for (const e of et._instances)
2988
3246
  if (e.id === t || e.getAttribute("plot-group") === t) return e;
2989
3247
  return null;
2990
3248
  }
@@ -3003,7 +3261,7 @@ const gt = class gt extends ve {
3003
3261
  }
3004
3262
  /** Resolved edges of the current network with weights and direction. */
3005
3263
  getEdges() {
3006
- const t = /* @__PURE__ */ u((e) => {
3264
+ const t = /* @__PURE__ */ c((e) => {
3007
3265
  const s = this.__children__.search("__children__", e);
3008
3266
  return s ? [...s.__data__.objects.values()] : [];
3009
3267
  }, "collect");
@@ -3018,65 +3276,193 @@ const gt = class gt extends ve {
3018
3276
  };
3019
3277
  }).filter((e) => e.source != null && e.target != null);
3020
3278
  }
3021
- /** Marks (circles/rects), undirected edge lines, and directed / self-edge
3022
- * triangle paths all participate in tweening. */
3023
- _tweenTargets() {
3024
- return [...this.svg_element.querySelectorAll(
3025
- "circle[data-point-id], rect[data-point-id], line[data-edge-source], path[data-edge-source]"
3026
- )];
3027
- }
3028
- _readCoords(t) {
3029
- const e = t.tagName.toLowerCase(), s = /* @__PURE__ */ u((i) => parseFloat(t.getAttribute(i) || "0"), "n");
3030
- if (e === "circle") return { t: "c", cx: s("cx"), cy: s("cy") };
3031
- if (e === "rect") return { t: "r", x: s("x"), y: s("y") };
3032
- if (e === "line") return { t: "l", x1: s("x1"), y1: s("y1"), x2: s("x2"), y2: s("y2") };
3033
- if (e === "path") {
3034
- const i = t.getAttribute("d") || "";
3035
- return { t: "p", d: i, nums: (i.match(gt._PATH_NUM_RE) || []).map(Number) };
3036
- }
3037
- return null;
3279
+ // ── View: zoom / pan ─────────────────────────────────────────────────────────
3280
+ /** <qe-graph zoom-min / zoom-max>: the zoom levels every zoom stays within
3281
+ * (1 = the fitted view); unbounded when absent. */
3282
+ _zoomLimits() {
3283
+ const t = /* @__PURE__ */ c((e) => {
3284
+ const s = Number(this.getAttribute(e));
3285
+ return this.hasAttribute(e) && Number.isFinite(s) && s > 0 ? s : null;
3286
+ }, "num");
3287
+ return [t("zoom-min") ?? 0, t("zoom-max") ?? 1 / 0];
3288
+ }
3289
+ _clampZoom(t) {
3290
+ const [e, s] = this._zoomLimits();
3291
+ return Math.min(s, Math.max(e, t));
3292
+ }
3293
+ /** <qe-graph zoom-step>: the wheel's zoom factor per 100 px of scroll. */
3294
+ _zoomStep() {
3295
+ const t = Number(this.getAttribute("zoom-step"));
3296
+ return this.hasAttribute("zoom-step") && Number.isFinite(t) && t > 0 ? t : 1.1;
3297
+ }
3298
+ /** Client (CSS px) → root-svg user coordinates, the space the zoom / pan
3299
+ * transform maps into; null before layout. */
3300
+ _clientToRoot(t, e) {
3301
+ var n, r;
3302
+ const s = (r = (n = this.svg_element).getScreenCTM) == null ? void 0 : r.call(n);
3303
+ if (!s) return null;
3304
+ const i = new DOMPoint(t, e).matrixTransform(s.inverse());
3305
+ return [i.x, i.y];
3306
+ }
3307
+ /** Zoom to `level` (within the limits), keeping the root-svg point
3308
+ * (ux, uy) where it is on screen. Every zoom goes through here. */
3309
+ _zoomAbout(t, e, s) {
3310
+ if (!(Number.isFinite(t) && t > 0)) return;
3311
+ t = this._clampZoom(t);
3312
+ const i = this.__data__.transform, n = t / (this.zoom_level || 1);
3313
+ i.e = e - n * (e - i.e), i.f = s - n * (s - i.f), i.zoom(t), this.zoom_level = t, this.update();
3314
+ }
3315
+ _stopZoomAnim() {
3316
+ this._zoomAnim !== null && cancelAnimationFrame(this._zoomAnim), this._zoomAnim = null;
3317
+ }
3318
+ /** Ease the zoom to `level` about (ux, uy) over `ms` (double-click). */
3319
+ _animateZoomAbout(t, e, s, i) {
3320
+ this._stopZoomAnim();
3321
+ const n = this.zoom_level || 1, r = this._clampZoom(t);
3322
+ if (r === n) return;
3323
+ const a = performance.now(), h = /* @__PURE__ */ c((o) => {
3324
+ const _ = Math.min(1, Math.max(0, (o - a) / i));
3325
+ this._zoomAbout(_ >= 1 ? r : n * Math.pow(r / n, 1 - Math.pow(1 - _, 3)), e, s), this._zoomAnim = _ < 1 ? requestAnimationFrame(h) : null;
3326
+ }, "step");
3327
+ this._zoomAnim = requestAnimationFrame(h);
3038
3328
  }
3039
- /** Snapshot current tween-target positions keyed by element. */
3040
- _captureTween() {
3329
+ /**
3330
+ * Zoom to an absolute level (1 = the fitted view, 2 = twice as close),
3331
+ * about the centre of the view: whatever is under the centre stays there,
3332
+ * pan included. Ignores levels that are not finite and > 0; clamped to
3333
+ * zoom-min / zoom-max. Works with view-locked set.
3334
+ */
3335
+ zoomTo(t) {
3336
+ this._stopZoomAnim();
3337
+ const { cx: e, cy: s } = this.__data__.extremes;
3338
+ this._zoomAbout(t, e, s);
3339
+ }
3340
+ /** Zoom by a factor relative to the current level (> 1 in, < 1 out). */
3341
+ zoomBy(t) {
3342
+ Number.isFinite(t) && t > 0 && this.zoomTo((this.zoom_level || 1) * t);
3343
+ }
3344
+ /** Back to the fitted view: zoom 1 (or the nearest limit), no pan. */
3345
+ resetView() {
3346
+ this._stopZoomAnim();
3347
+ const t = this._clampZoom(1), { cx: e, cy: s } = this.__data__.extremes;
3348
+ this.zoom_level = t, this.__data__.transform.values = t === 1 ? [1, 0, 0, 1, 0, 0] : [t, 0, 0, t, e * (1 - t), s * (1 - t)], this.update();
3349
+ }
3350
+ static _ease(t) {
3351
+ return t < 0.5 ? 2 * t * t : 1 - Math.pow(-2 * t + 2, 2) / 2;
3352
+ }
3353
+ /** Move a Point (or an edge end): QEPoint reads `dimensions`, others `x` / `y`. */
3354
+ static _setXY(t, e, s) {
3355
+ t.x = e, t.y = s, t.dimensions && (t.dimensions[0] = e, t.dimensions[1] = s);
3356
+ }
3357
+ _layerObjects(t) {
3358
+ var e;
3359
+ return (e = this.__children__.search("__children__", t)) == null ? void 0 : e.__data__.objects;
3360
+ }
3361
+ _intervalMarks() {
3362
+ return [...this._ciRects.values(), ...this._outlierRects.values(), ...this._ciCross.values()];
3363
+ }
3364
+ /** A box's x, y, width, height, or a crosshair path's numbers. */
3365
+ _boxGeom(t) {
3366
+ return t.tagName.toLowerCase() === "rect" ? ["x", "y", "width", "height"].map((e) => parseFloat(t.getAttribute(e) || "0")) : ((t.getAttribute("d") || "").match(et._PATH_NUM_RE) || []).map(Number);
3367
+ }
3368
+ /** The plot as drawn now — mid-tween, the in-between state — with the
3369
+ * running tween's clock and targets, so a new render can continue it. */
3370
+ _captureTweenState() {
3371
+ var n;
3041
3372
  const t = /* @__PURE__ */ new Map();
3042
- return this._tweenTargets().forEach((e) => {
3043
- const s = this._readCoords(e);
3044
- s && t.set(e, s);
3045
- }), t;
3046
- }
3047
- /** Animate each still-present element from its snapshot to its new position. */
3048
- _runTween(t) {
3049
- this._tweenRaf !== null && (cancelAnimationFrame(this._tweenRaf), this._tweenRaf = null);
3373
+ for (const r of ["points", "nodes"])
3374
+ (n = this._layerObjects(r)) == null || n.forEach((a, h) => t.set(`${r}:${h}`, [a.x, a.y]));
3050
3375
  const e = /* @__PURE__ */ new Map();
3051
- if (this._tweenTargets().forEach((h) => {
3052
- if (t.has(h)) {
3053
- const o = this._readCoords(h);
3054
- o && e.set(h, o);
3376
+ this._intervalMarks().forEach((r) => e.set(r, this._boxGeom(r)));
3377
+ const s = this.__data__.extremes, i = this._tween;
3378
+ return {
3379
+ marks: t,
3380
+ boxes: e,
3381
+ view: [s.x_max, s.y_max, s.cx, s.cy],
3382
+ running: i ? {
3383
+ t0: i.t0,
3384
+ k: i.k,
3385
+ marks: new Map(i.marks.map((r) => [r.key, [r.tx, r.ty]])),
3386
+ boxes: new Map(i.boxes.map((r) => [r.el, r.to])),
3387
+ view: i.view.to
3388
+ } : null
3389
+ };
3390
+ }
3391
+ _stopTween() {
3392
+ this._tweenRaf !== null && cancelAnimationFrame(this._tweenRaf), this._tweenRaf = null, this._tween = null, this._tweenView = null;
3393
+ }
3394
+ /**
3395
+ * Tween from `prev` (what was on screen) to the plot just rendered. A render
3396
+ * that lands mid-tween with the same targets (the same model again, an
3397
+ * attribute that moves nothing) continues on the running clock; one with
3398
+ * new targets starts a fresh tween from the current, in-between positions.
3399
+ */
3400
+ _startTween(t) {
3401
+ var b;
3402
+ const e = performance.now(), s = /* @__PURE__ */ c((f, w) => !!w && f.length === w.length && f.every(($, z) => $ === w[z]), "same"), i = [];
3403
+ for (const f of ["points", "nodes"])
3404
+ (b = this._layerObjects(f)) == null || b.forEach((w, $) => {
3405
+ const z = `${f}:${$}`, D = t.marks.get(z);
3406
+ D && i.push({ key: z, o: w, tx: w.x, ty: w.y, cx: D[0], cy: D[1] });
3407
+ });
3408
+ const n = this._intervalMarks().map((f) => ({ el: f, to: this._boxGeom(f), cur: t.boxes.get(f) })).filter((f) => f.cur && f.cur.length === f.to.length), r = this.__data__.extremes, a = [r.x_max, r.y_max, r.cx, r.cy], h = t.running, o = !!h && h.k < 0.95 && s(a, h.view) && i.every((f) => s([f.tx, f.ty], h.marks.get(f.key) ?? [f.cx, f.cy])) && n.every((f) => s(f.to, h.boxes.get(f.el) ?? f.cur)), _ = o ? h.k : 0, m = /* @__PURE__ */ c((f, w) => _ > 0 ? (f - _ * w) / (1 - _) : f, "from"), p = i.map((f) => ({ key: f.key, o: f.o, tx: f.tx, ty: f.ty, fx: m(f.cx, f.tx), fy: m(f.cy, f.ty) })).filter((f) => f.fx !== f.tx || f.fy !== f.ty), u = n.map((f) => ({
3409
+ el: f.el,
3410
+ to: f.to,
3411
+ from: f.cur.map((w, $) => m(w, f.to[$])),
3412
+ attrs: Object.fromEntries(["x", "y", "width", "height", "d"].filter((w) => f.el.hasAttribute(w)).map((w) => [w, f.el.getAttribute(w)]))
3413
+ })).filter((f) => !s(f.from, f.to)), d = t.view.map((f, w) => m(f, a[w]));
3414
+ if (!p.length && !u.length && s(d, a)) return;
3415
+ this._tween = {
3416
+ t0: o ? h.t0 : e,
3417
+ dur: this._animateMs,
3418
+ k: _,
3419
+ marks: p,
3420
+ boxes: u,
3421
+ view: { from: d, to: a }
3422
+ }, this._tweenFrame(_);
3423
+ const l = /* @__PURE__ */ c((f) => {
3424
+ const w = this._tween;
3425
+ if (!w) return;
3426
+ const $ = (f - w.t0) / w.dur;
3427
+ if ($ >= 1) {
3428
+ this._endTween();
3429
+ return;
3055
3430
  }
3056
- }), !e.size) return;
3057
- const s = this._animateMs, i = performance.now(), n = /* @__PURE__ */ u((h) => h < 0.5 ? 2 * h * h : 1 - Math.pow(-2 * h + 2, 2) / 2, "ease"), r = /* @__PURE__ */ u((h, o, l) => h + (o - h) * l, "lerp"), a = /* @__PURE__ */ u((h) => {
3058
- const o = Math.min(1, (h - i) / s), l = n(o);
3059
- e.forEach((_, g) => {
3060
- const c = t.get(g);
3061
- if (!(!c || c.t !== _.t))
3062
- if (_.t === "c")
3063
- g.setAttribute("cx", String(r(c.cx, _.cx, l))), g.setAttribute("cy", String(r(c.cy, _.cy, l)));
3064
- else if (_.t === "r")
3065
- g.setAttribute("x", String(r(c.x, _.x, l))), g.setAttribute("y", String(r(c.y, _.y, l)));
3066
- else if (_.t === "l")
3067
- g.setAttribute("x1", String(r(c.x1, _.x1, l))), g.setAttribute("y1", String(r(c.y1, _.y1, l))), g.setAttribute("x2", String(r(c.x2, _.x2, l))), g.setAttribute("y2", String(r(c.y2, _.y2, l)));
3068
- else {
3069
- if (!c.nums || c.nums.length !== _.nums.length) return;
3070
- let E = 0;
3071
- const m = _.d.replace(
3072
- gt._PATH_NUM_RE,
3073
- () => String(r(c.nums[E], _.nums[E++], l))
3074
- );
3075
- g.setAttribute("d", m);
3076
- }
3077
- }), this._tweenRaf = o < 1 ? requestAnimationFrame(a) : null;
3431
+ this._tweenFrame(Math.max(w.k, et._ease(Math.max(0, $)))), this._tweenRaf = requestAnimationFrame(l);
3078
3432
  }, "step");
3079
- this._tweenRaf = requestAnimationFrame(a);
3433
+ this._tweenRaf = requestAnimationFrame(l);
3434
+ }
3435
+ /** Draw the tween at eased progress k (0 = start, 1 = end). */
3436
+ _tweenFrame(t) {
3437
+ const e = this._tween;
3438
+ if (!e) return;
3439
+ e.k = t;
3440
+ const s = /* @__PURE__ */ c((i, n) => i + (n - i) * t, "lerp");
3441
+ e.marks.forEach((i) => et._setXY(i.o, s(i.fx, i.tx), s(i.fy, i.ty))), this._attachEdges(), e.boxes.forEach((i) => {
3442
+ const n = i.from.map((r, a) => s(r, i.to[a]));
3443
+ if ("d" in i.attrs) {
3444
+ let r = 0;
3445
+ i.el.setAttribute("d", i.attrs.d.replace(et._PATH_NUM_RE, () => String(n[r++])));
3446
+ } else
3447
+ ["x", "y", "width", "height"].forEach((r, a) => i.el.setAttribute(r, String(n[a])));
3448
+ }), this._tweenView = e.view.from.map((i, n) => s(i, e.view.to[n])), this.update();
3449
+ }
3450
+ /** Land exactly on the rendered plot and stop. */
3451
+ _endTween() {
3452
+ const t = this._tween;
3453
+ t && (t.marks.forEach((e) => et._setXY(e.o, e.tx, e.ty)), this._attachEdges(), t.boxes.forEach((e) => Object.entries(e.attrs).forEach(([s, i]) => e.el.setAttribute(s, i))), this._stopTween(), this.update());
3454
+ }
3455
+ /** Put each edge's ends on its nodes' current positions. */
3456
+ _attachEdges() {
3457
+ var e;
3458
+ const t = this._layerObjects("nodes");
3459
+ if (t)
3460
+ for (const s of ["edges", "edgenodes"])
3461
+ (e = this._layerObjects(s)) == null || e.forEach((i) => {
3462
+ var a, h;
3463
+ const n = t.get((a = i.meta) == null ? void 0 : a.source), r = t.get((h = i.meta) == null ? void 0 : h.target);
3464
+ n && i.from && et._setXY(i.from, n.x, n.y), r && i.to && et._setXY(i.to, r.x, r.y);
3465
+ });
3080
3466
  }
3081
3467
  /** Serialize the current plot as a standalone SVG string (webENA P2.3). */
3082
3468
  toSVG() {
@@ -3090,23 +3476,23 @@ const gt = class gt extends ve {
3090
3476
  toPNG(t = 2) {
3091
3477
  const e = this.toSVG(), s = this.svg_element.getBoundingClientRect(), i = Math.max(1, Math.round(s.width)), n = Math.max(1, Math.round(s.height));
3092
3478
  return new Promise((r, a) => {
3093
- const h = new Blob([e], { type: "image/svg+xml;charset=utf-8" }), o = URL.createObjectURL(h), l = new Image();
3094
- l.onload = () => {
3479
+ const h = new Blob([e], { type: "image/svg+xml;charset=utf-8" }), o = URL.createObjectURL(h), _ = new Image();
3480
+ _.onload = () => {
3095
3481
  try {
3096
- const _ = document.createElement("canvas");
3097
- _.width = i * t, _.height = n * t;
3098
- const g = _.getContext("2d");
3099
- if (!g) {
3482
+ const m = document.createElement("canvas");
3483
+ m.width = i * t, m.height = n * t;
3484
+ const p = m.getContext("2d");
3485
+ if (!p) {
3100
3486
  URL.revokeObjectURL(o), a(new Error("no 2d context"));
3101
3487
  return;
3102
3488
  }
3103
- g.scale(t, t), g.drawImage(l, 0, 0, i, n), URL.revokeObjectURL(o), r(_.toDataURL("image/png"));
3104
- } catch (_) {
3105
- URL.revokeObjectURL(o), a(_);
3489
+ p.scale(t, t), p.drawImage(_, 0, 0, i, n), URL.revokeObjectURL(o), r(m.toDataURL("image/png"));
3490
+ } catch (m) {
3491
+ URL.revokeObjectURL(o), a(m);
3106
3492
  }
3107
- }, l.onerror = (_) => {
3108
- URL.revokeObjectURL(o), a(_);
3109
- }, l.src = o;
3493
+ }, _.onerror = (m) => {
3494
+ URL.revokeObjectURL(o), a(m);
3495
+ }, _.src = o;
3110
3496
  });
3111
3497
  }
3112
3498
  /** Unit points with their current graph-space coordinates. */
@@ -3143,114 +3529,169 @@ const gt = class gt extends ve {
3143
3529
  this._highlight.edges.clear(), this._highlight.nodes.clear(), this._applyHighlights();
3144
3530
  }
3145
3531
  _applyHighlights() {
3532
+ var _;
3146
3533
  if (!this.svg_element) return;
3147
- this._highlightGroup || (this._highlightGroup = document.createElementNS("http://www.w3.org/2000/svg", "g"), this._highlightGroup.setAttribute("data-layer-name", "highlight"), this._highlightGroup.setAttribute("pointer-events", "none")), this.svg_element.appendChild(this._highlightGroup);
3148
- const t = this._highlightGroup;
3149
- t.textContent = "";
3150
- const e = this.__data__.extremes.x_max || 1, s = "#f5a623", i = /* @__PURE__ */ u((n, r) => {
3151
- const a = document.createElementNS("http://www.w3.org/2000/svg", n);
3152
- for (const h in r) a.setAttribute(h, String(r[h]));
3153
- return a;
3534
+ this._highlightGroup || (this._highlightGroup = document.createElementNS("http://www.w3.org/2000/svg", "g"), this._highlightGroup.setAttribute("data-layer-name", "highlight"), this._highlightGroup.setAttribute("pointer-events", "none"));
3535
+ const t = this._highlight.edges.size > 0 || this._highlight.nodes.size > 0, e = (_ = this.__children__[0]) == null ? void 0 : _.svg_element;
3536
+ (t && e ? e : this.svg_element).appendChild(this._highlightGroup);
3537
+ const s = this._highlightGroup;
3538
+ s.textContent = "";
3539
+ const i = this.__data__.extremes.x_max || 1, n = "#f5a623", r = this.zoom_level || 1, a = this._edgesFixedSize ? r : 1, h = /* @__PURE__ */ c((m) => {
3540
+ var d;
3541
+ const p = /* @__PURE__ */ c((l) => {
3542
+ var b;
3543
+ return (b = this.__children__.search("__children__", l)) == null ? void 0 : b.__data__.objects.get(m);
3544
+ }, "find"), u = (d = p("nodes") ?? p("points")) == null ? void 0 : d.meta;
3545
+ return u != null && u.zoomFixed || u != null && u.fixedSize ? r : 1;
3546
+ }, "markK"), o = /* @__PURE__ */ c((m, p) => {
3547
+ const u = document.createElementNS("http://www.w3.org/2000/svg", m);
3548
+ for (const d in p) u.setAttribute(d, String(p[d]));
3549
+ return u;
3154
3550
  }, "mk");
3155
3551
  if (this._highlight.edges.size) {
3156
- const n = {};
3157
- this.getNodes().forEach((r) => {
3158
- n[r.id] = { x: r.x, y: r.y };
3159
- }), this._highlight.edges.forEach((r) => {
3160
- const [a, h] = r.split("\0"), o = n[a], l = n[h];
3161
- !o || !l || t.appendChild(i("line", {
3162
- x1: o.x,
3163
- y1: o.y,
3164
- x2: l.x,
3165
- y2: l.y,
3166
- stroke: s,
3167
- "stroke-width": e * 0.02,
3552
+ const m = {};
3553
+ this.getNodes().forEach((p) => {
3554
+ m[p.id] = { x: p.x, y: p.y };
3555
+ }), this._highlight.edges.forEach((p) => {
3556
+ const [u, d] = p.split("\0"), l = m[u], b = m[d];
3557
+ !l || !b || s.appendChild(o("line", {
3558
+ x1: l.x,
3559
+ y1: l.y,
3560
+ x2: b.x,
3561
+ y2: b.y,
3562
+ stroke: n,
3563
+ "stroke-width": i * 0.02 / a,
3168
3564
  "stroke-opacity": 0.6,
3169
3565
  "stroke-linecap": "round"
3170
3566
  }));
3171
3567
  });
3172
3568
  }
3173
- this._highlight.nodes.forEach((n) => {
3174
- var _;
3175
- const r = this.svg_element.querySelector(`[data-point-id="${(_ = window.CSS) != null && _.escape ? CSS.escape(n) : n}"]`);
3176
- if (!r) return;
3177
- const a = r.tagName.toLowerCase();
3178
- let h, o, l;
3179
- if (a === "rect") {
3180
- const g = parseFloat(r.getAttribute("width") || "0");
3181
- h = parseFloat(r.getAttribute("x") || "0") + g / 2, o = parseFloat(r.getAttribute("y") || "0") + parseFloat(r.getAttribute("height") || "0") / 2, l = g / 2;
3569
+ this._highlight.nodes.forEach((m) => {
3570
+ var f;
3571
+ const p = this.svg_element.querySelector(`[data-point-id="${(f = window.CSS) != null && f.escape ? CSS.escape(m) : m}"]`);
3572
+ if (!p) return;
3573
+ const u = p.tagName.toLowerCase();
3574
+ let d, l, b;
3575
+ if (u === "rect") {
3576
+ const w = parseFloat(p.getAttribute("width") || "0");
3577
+ d = parseFloat(p.getAttribute("x") || "0") + w / 2, l = parseFloat(p.getAttribute("y") || "0") + parseFloat(p.getAttribute("height") || "0") / 2, b = w / 2;
3182
3578
  } else
3183
- h = parseFloat(r.getAttribute("cx") || "0"), o = parseFloat(r.getAttribute("cy") || "0"), l = parseFloat(r.getAttribute("r") || "0");
3184
- t.appendChild(i("circle", {
3185
- cx: h,
3186
- cy: o,
3187
- r: l * 1.7 + e * 4e-3,
3579
+ d = parseFloat(p.getAttribute("cx") || "0"), l = parseFloat(p.getAttribute("cy") || "0"), b = parseFloat(p.getAttribute("r") || "0");
3580
+ s.appendChild(o("circle", {
3581
+ cx: d,
3582
+ cy: l,
3583
+ r: b * 1.7 + i * 4e-3 / h(m),
3188
3584
  fill: "none",
3189
- stroke: s,
3190
- "stroke-width": e * 6e-3
3585
+ stroke: n,
3586
+ "stroke-width": i * 6e-3 / h(m)
3191
3587
  }));
3192
3588
  });
3193
3589
  }
3194
3590
  create() {
3195
3591
  const t = document.createElementNS("http://www.w3.org/2000/svg", "svg");
3196
3592
  t.classList.add("graph"), t.style.display = "block", t.style.width = "100%", t.style.height = "100%", t.setAttribute("preserveAspectRatio", "xMidYMid meet"), t.setAttribute("viewBox", this.__data__.extremes.as_viewBox()), t.setAttribute("transform", this.__data__.transform.toString()), t.setAttribute("role", "figure"), t.setAttribute("data-graph-size", `${Math.min(this.__data__.extremes.width, this.__data__.extremes.height)}`), this.svg_element = t;
3197
- const e = document.createElementNS("http://www.w3.org/2000/svg", "defs"), s = 0.22, i = 0.15, n = /* @__PURE__ */ u((r, a) => {
3593
+ const e = document.createElementNS("http://www.w3.org/2000/svg", "defs"), s = 0.22, i = 0.15, n = /* @__PURE__ */ c((r, a) => {
3198
3594
  const h = document.createElementNS("http://www.w3.org/2000/svg", "marker");
3199
3595
  h.setAttribute("id", r), h.setAttribute("markerWidth", String(s)), h.setAttribute("markerHeight", String(i)), h.setAttribute("refX", String(s)), h.setAttribute("refY", String(i / 2)), h.setAttribute("orient", "auto"), h.setAttribute("markerUnits", "userSpaceOnUse");
3200
3596
  const o = document.createElementNS("http://www.w3.org/2000/svg", "path");
3201
3597
  o.setAttribute("d", `M0,0 L0,${i} L${s},${i / 2} z`), o.setAttribute("fill", a), h.appendChild(o), e.appendChild(h);
3202
3598
  }, "makeArrow");
3203
- return Vs.forEach((r) => n(`qe-arrow-${r.slice(1)}`, r)), t.appendChild(e), this.__data__.layers.forEach((r) => {
3204
- const a = new ts(r, this.svg_element, this);
3599
+ return oi.forEach((r) => n(`qe-arrow-${r.slice(1)}`, r)), t.appendChild(e), this.__data__.layers.forEach((r) => {
3600
+ const a = new as(r, this.svg_element, this);
3205
3601
  this.__children__.push(a);
3206
3602
  }), this.__data__.__state__.setVariable("graph_updated", this.__data__), this.attach_events(), t;
3207
3603
  }
3208
3604
  attach_events() {
3209
- this.svg_element.addEventListener("wheel", (o) => {
3210
- console.log("Wheel event: ", o), o.preventDefault(), Math.sign(o.deltaY) < 0 ? this.zoom_level *= 1.1 : this.zoom_level /= 1.1, this.__data__.transform.zoom(this.zoom_level), this.update();
3605
+ const t = /* @__PURE__ */ c(() => this.hasAttribute("view-locked"), "locked");
3606
+ this.svg_element.addEventListener("wheel", (d) => {
3607
+ if (t()) return;
3608
+ d.preventDefault();
3609
+ const l = d.deltaMode === 1 ? 33 : d.deltaMode === 2 ? this.svg_element.clientHeight || 800 : 1, b = d.deltaY * l, f = d.ctrlKey ? Math.exp(-b / 100) : Math.pow(this._zoomStep(), -b / 100);
3610
+ this._stopZoomAnim();
3611
+ const w = this._clientToRoot(d.clientX, d.clientY);
3612
+ w ? this._zoomAbout((this.zoom_level || 1) * f, w[0], w[1]) : this.zoomBy(f);
3613
+ }, { passive: !1 }), this.svg_element.addEventListener("dblclick", (d) => {
3614
+ var b, f;
3615
+ if (t() || (f = (b = d.target) == null ? void 0 : b.closest) != null && f.call(b, "text[data-label-for]")) return;
3616
+ d.preventDefault();
3617
+ const l = this._clientToRoot(d.clientX, d.clientY);
3618
+ l && this._animateZoomAbout((this.zoom_level || 1) * 2.2, l[0], l[1], 200);
3211
3619
  });
3212
- let t = !1, e, s;
3213
- this.svg_element.addEventListener("mousedown", (o) => {
3214
- t = !0, e = o.clientX, s = o.clientY;
3620
+ const e = /* @__PURE__ */ new Map();
3621
+ let s = null;
3622
+ const i = /* @__PURE__ */ c(() => {
3623
+ const [d, l] = [...e.values()];
3624
+ return d ? l ? { mid: [(d[0] + l[0]) / 2, (d[1] + l[1]) / 2], dist: Math.hypot(d[0] - l[0], d[1] - l[1]), n: 2 } : { mid: d, dist: 0, n: 1 } : null;
3625
+ }, "measure");
3626
+ this.svg_element.addEventListener("pointerdown", (d) => {
3627
+ d.pointerType !== "touch" || t() || (e.set(d.pointerId, [d.clientX, d.clientY]), s = i(), this._stopZoomAnim());
3628
+ }), this.svg_element.addEventListener("pointermove", (d) => {
3629
+ if (!e.has(d.pointerId)) return;
3630
+ if (t()) {
3631
+ e.clear(), s = null;
3632
+ return;
3633
+ }
3634
+ e.set(d.pointerId, [d.clientX, d.clientY]);
3635
+ const l = i();
3636
+ if (l && s && l.n === s.n) {
3637
+ const b = this._clientToRoot(...s.mid), f = this._clientToRoot(...l.mid);
3638
+ if (b && f) {
3639
+ const w = this.__data__.transform;
3640
+ w.pan(f[0] - b[0], f[1] - b[1]), l.n === 2 && s.dist > 0 && l.dist > 0 ? this._zoomAbout((this.zoom_level || 1) * l.dist / s.dist, f[0], f[1]) : this.__children__[0].svg_element.setAttribute("transform", w.toString());
3641
+ }
3642
+ }
3643
+ s = l;
3644
+ });
3645
+ const n = /* @__PURE__ */ c((d) => {
3646
+ e.delete(d.pointerId) && (s = i());
3647
+ }, "touchEnd");
3648
+ this.svg_element.addEventListener("pointerup", n), this.svg_element.addEventListener("pointercancel", n);
3649
+ let r = !1, a = 0, h = 0;
3650
+ this.svg_element.addEventListener("mousedown", (d) => {
3651
+ t() || (r = !0, a = d.clientX, h = d.clientY);
3215
3652
  });
3216
- let i = null, n = null;
3217
- const r = /* @__PURE__ */ u(() => {
3218
- n && (this.__data__.transform.pan(n.dx, n.dy), this.__children__[0].svg_element.setAttribute("transform", this.__data__.transform.toString()), n = null), i = null;
3653
+ let o = null, _ = null;
3654
+ const m = /* @__PURE__ */ c(() => {
3655
+ _ && (this.__data__.transform.pan(_.dx, _.dy), this.__children__[0].svg_element.setAttribute("transform", this.__data__.transform.toString()), _ = null), o = null;
3219
3656
  }, "panUpdate");
3220
- this.svg_element.addEventListener("mousemove", (o) => {
3221
- if (!t) return;
3222
- const l = o.clientX - e, _ = o.clientY - s;
3223
- n = { dx: l / 100, dy: _ / 100 }, e = o.clientX, s = o.clientY, i === null && (i = requestAnimationFrame(r));
3224
- }), this.svg_element.addEventListener("mouseup", (o) => {
3225
- t = !1;
3226
- }), this.svg_element.addEventListener("point-clicked", ((o) => {
3227
- var g, c;
3228
- const l = (c = (g = o.detail) == null ? void 0 : g.pointData) == null ? void 0 : c.ID;
3657
+ this.svg_element.addEventListener("mousemove", (d) => {
3658
+ if (!r) return;
3659
+ if (d.buttons === 0) {
3660
+ r = !1;
3661
+ return;
3662
+ }
3663
+ const l = this._clientToRoot(a, h), b = this._clientToRoot(d.clientX, d.clientY);
3664
+ a = d.clientX, h = d.clientY, !(!l || !b) && (_ = { dx: ((_ == null ? void 0 : _.dx) ?? 0) + b[0] - l[0], dy: ((_ == null ? void 0 : _.dy) ?? 0) + b[1] - l[1] }, o === null && (o = requestAnimationFrame(m)));
3665
+ }), this.svg_element.addEventListener("mouseup", (d) => {
3666
+ r = !1;
3667
+ }), this.svg_element.addEventListener("point-clicked", ((d) => {
3668
+ var f, w;
3669
+ const l = (w = (f = d.detail) == null ? void 0 : f.pointData) == null ? void 0 : w.ID;
3229
3670
  if (!l) return;
3230
- const _ = this._pointLabels.get(l) ?? this._meanLabels.get(l.replace("mean-", "")) ?? this._nodeLabels.get(l);
3231
- _ && _.displayMode === H.DISPLAY_TYPES.CLICK && _.toggle();
3671
+ const b = this._pointLabels.get(l) ?? this._setLabels.get(l) ?? this._meanLabels.get(l.replace("mean-", "")) ?? this._nodeLabels.get(l);
3672
+ b && b.displayMode === q.DISPLAY_TYPES.CLICK && b.toggle();
3232
3673
  }));
3233
- const a = /* @__PURE__ */ u((o) => {
3674
+ const p = /* @__PURE__ */ c((d) => {
3234
3675
  var l;
3235
- for (; o && o !== this.svg_element; ) {
3236
- const _ = (l = o.getAttribute) == null ? void 0 : l.call(o, "data-point-id");
3237
- if (_) return _;
3238
- o = o.parentElement;
3676
+ for (; d && d !== this.svg_element; ) {
3677
+ const b = (l = d.getAttribute) == null ? void 0 : l.call(d, "data-point-id");
3678
+ if (b) return b;
3679
+ d = d.parentElement;
3239
3680
  }
3240
3681
  return null;
3241
- }, "findPointId"), h = /* @__PURE__ */ u((o) => this._pointLabels.get(o) ?? this._meanLabels.get(o.replace(/^mean-/, "")) ?? this._nodeLabels.get(o), "getAutoLabel");
3242
- this.svg_element.addEventListener("mouseover", (o) => {
3243
- const l = a(o.target);
3682
+ }, "findPointId"), u = /* @__PURE__ */ c((d) => this._pointLabels.get(d) ?? this._setLabels.get(d) ?? this._meanLabels.get(d.replace(/^mean-/, "")) ?? this._nodeLabels.get(d), "getAutoLabel");
3683
+ this.svg_element.addEventListener("mouseover", (d) => {
3684
+ const l = p(d.target);
3244
3685
  if (!l) return;
3245
- const _ = h(l);
3246
- (_ == null ? void 0 : _.displayMode) === H.DISPLAY_TYPES.AUTO && _.show();
3247
- }), this.svg_element.addEventListener("mouseout", (o) => {
3248
- const l = a(o.target);
3686
+ const b = u(l);
3687
+ (b == null ? void 0 : b.displayMode) === q.DISPLAY_TYPES.AUTO && b.show();
3688
+ }), this.svg_element.addEventListener("mouseout", (d) => {
3689
+ const l = p(d.target);
3249
3690
  if (!l) return;
3250
- const _ = o.relatedTarget;
3251
- if (a(_) === l) return;
3252
- const c = h(l);
3253
- (c == null ? void 0 : c.displayMode) === H.DISPLAY_TYPES.AUTO && c.hide();
3691
+ const b = d.relatedTarget;
3692
+ if (p(b) === l) return;
3693
+ const w = u(l);
3694
+ (w == null ? void 0 : w.displayMode) === q.DISPLAY_TYPES.AUTO && w.hide();
3254
3695
  }), this._attachInteractionEvents();
3255
3696
  }
3256
3697
  /** Emit a namespaced CustomEvent on the public element (bubbles + composed). */
@@ -3307,7 +3748,7 @@ const gt = class gt extends ve {
3307
3748
  a && this._emit("qe-node-click", { ...a, originalEvent: i });
3308
3749
  });
3309
3750
  let e = null;
3310
- const s = /* @__PURE__ */ u((i, n) => i === "edge" ? `${n.source}\0${n.target}` : String(n.id), "keyOf");
3751
+ const s = /* @__PURE__ */ c((i, n) => i === "edge" ? `${n.source}\0${n.target}` : String(n.id), "keyOf");
3311
3752
  t.addEventListener("mousemove", (i) => {
3312
3753
  const n = i.target, r = this._edgeDetail(n), a = r ? null : this._nodeDetail(n), h = r ? { type: "edge", detail: r } : a ? { type: "node", detail: a } : null, o = h ? s(h.type, h.detail) : null;
3313
3754
  e && (!h || e.key !== o) && (this._emit(e.type === "edge" ? "qe-edge-unhover" : "qe-node-unhover", { key: e.key }), e = null), h && (!e || e.key !== o) && (this._emit(h.type === "edge" ? "qe-edge-hover" : "qe-node-hover", { ...h.detail, originalEvent: i }), e = { type: h.type, key: o }), this.hasAttribute("tooltip") && h ? this._showTooltip(this._tooltipText(h.type, h.detail), i.clientX, i.clientY) : this._hideTooltip();
@@ -3362,7 +3803,7 @@ const gt = class gt extends ve {
3362
3803
  }
3363
3804
  }
3364
3805
  update() {
3365
- this.update_extremes(), this.update_layers(), this.update_labels(), this.update_extremes(), this.update_axes(), this._applyHighlights();
3806
+ this.update_extremes(), this.update_layers(), [this._ciRects, this._outlierRects, this._ciCross].forEach((t) => t.forEach((e) => this._applyIntervalStroke(e))), this.update_labels(), this.update_extremes(), this.update_axes(), this._applyHighlights();
3366
3807
  }
3367
3808
  /**
3368
3809
  * Axes (<qe-axes>): toggle the axis-line cross by presence, and draw/position
@@ -3370,55 +3811,58 @@ const gt = class gt extends ve {
3370
3811
  * cached SVG <text> nodes in the labels group; null text removes them.
3371
3812
  */
3372
3813
  update_axes() {
3373
- var o, l;
3814
+ var m, p;
3374
3815
  const t = this.__children__.search("__children__", "axes");
3375
3816
  t != null && t.svg_element && (t.svg_element.style.display = this._showAxes ? "" : "none");
3376
3817
  const e = this._labelsGroup, s = this.__data__.extremes.x_max, { cx: i, cy: n } = this.__data__.extremes;
3377
3818
  if (!e || s <= 0) return;
3378
- const r = s * 0.06, a = r * 0.6, h = /* @__PURE__ */ u((_, g) => {
3379
- let c = this._axisLabelEls.get(_);
3380
- if (!this._showAxes || g == null) {
3381
- c && (c.remove(), this._axisLabelEls.delete(_));
3819
+ const r = s * 0.06, a = r * 0.6, h = r / (this._axesFixedSize && this.zoom_level || 1), o = h * 0.6, _ = /* @__PURE__ */ c((u, d) => {
3820
+ let l = this._axisLabelEls.get(u);
3821
+ if (!this._showAxes || d == null) {
3822
+ l && (l.remove(), this._axisLabelEls.delete(u));
3382
3823
  return;
3383
3824
  }
3384
- c || (c = document.createElementNS("http://www.w3.org/2000/svg", "text"), c.setAttribute("data-axis-label", _), c.setAttribute("pointer-events", "none"), e.appendChild(c), this._axisLabelEls.set(_, c)), c.textContent = g, c.setAttribute("font-size", r.toString()), c.setAttribute("font-family", "system-ui, sans-serif"), c.setAttribute("font-weight", "600"), c.setAttribute("fill", "#556"), _ === "x" ? (c.setAttribute("x", (i + s - a).toString()), c.setAttribute("y", (-a).toString()), c.setAttribute("text-anchor", "end")) : (c.setAttribute("x", a.toString()), c.setAttribute("y", (n - s + r + a).toString()), c.setAttribute("text-anchor", "start"));
3825
+ l || (l = document.createElementNS("http://www.w3.org/2000/svg", "text"), l.setAttribute("data-axis-label", u), l.setAttribute("pointer-events", "none"), e.appendChild(l), this._axisLabelEls.set(u, l)), l.textContent = d, l.setAttribute("font-size", h.toString()), l.setAttribute("font-family", "system-ui, sans-serif"), l.setAttribute("font-weight", "600"), l.setAttribute("fill", "#556"), u === "x" ? (l.setAttribute("x", (i + s - o).toString()), l.setAttribute("y", (-o).toString()), l.setAttribute("text-anchor", "end")) : (l.setAttribute("x", o.toString()), l.setAttribute("y", (n - s + h + o).toString()), l.setAttribute("text-anchor", "start"));
3385
3826
  }, "place");
3386
- if (h("x", this._axisXText), h("y", this._axisYText), this._magnifyText == null)
3387
- (o = this._magnifyEl) == null || o.remove(), this._magnifyEl = null;
3827
+ if (_("x", this._axisXText), _("y", this._axisYText), this._magnifyText == null)
3828
+ (m = this._magnifyEl) == null || m.remove(), this._magnifyEl = null;
3388
3829
  else {
3389
3830
  this._magnifyEl || (this._magnifyEl = document.createElementNS("http://www.w3.org/2000/svg", "text"), this._magnifyEl.setAttribute("data-magnify-label", ""), this._magnifyEl.setAttribute("pointer-events", "none")), this._magnifyEl.parentElement || e.appendChild(this._magnifyEl);
3390
- const _ = this._magnifyEl;
3391
- _.textContent = this._magnifyText, _.setAttribute("font-size", (r * 0.85).toString()), _.setAttribute("font-family", "system-ui, sans-serif"), _.setAttribute("font-style", "italic"), _.setAttribute("fill", "#556"), _.setAttribute("x", (i - s + a).toString()), _.setAttribute("y", (n - s + r + a).toString()), _.setAttribute("text-anchor", "start");
3831
+ const u = this._magnifyEl;
3832
+ u.textContent = this._magnifyText, u.setAttribute("font-size", (r * 0.85).toString()), u.setAttribute("font-family", "system-ui, sans-serif"), u.setAttribute("font-style", "italic"), u.setAttribute("fill", "#556"), u.setAttribute("x", (i - s + a).toString()), u.setAttribute("y", (n - s + r + a).toString()), u.setAttribute("text-anchor", "start");
3392
3833
  }
3393
3834
  if (!this._plotTitle)
3394
- (l = this._titleEl) == null || l.remove(), this._titleEl = null;
3835
+ (p = this._titleEl) == null || p.remove(), this._titleEl = null;
3395
3836
  else {
3396
3837
  this._titleEl || (this._titleEl = document.createElementNS("http://www.w3.org/2000/svg", "text"), this._titleEl.setAttribute("data-plot-title", ""), this._titleEl.setAttribute("pointer-events", "none")), this._titleEl.parentElement || e.appendChild(this._titleEl);
3397
- const g = (this._labelFont.size ?? 12) * 1.35 * this.unitsPerPixel(), c = this._titleEl;
3398
- c.textContent = this._plotTitle, c.setAttribute("font-size", g.toString()), c.setAttribute("font-family", this._labelFont.family ?? "system-ui, sans-serif"), c.setAttribute("font-weight", "600"), c.setAttribute("fill", this._labelFont.color ?? "#223"), c.setAttribute("x", i.toString()), c.setAttribute("y", (n - s + g * 1.1).toString()), c.setAttribute("text-anchor", "middle");
3838
+ const d = (this._labelFont.size ?? 12) * 1.35 * this.unitsPerPixel(), l = this._titleEl;
3839
+ l.textContent = this._plotTitle, l.setAttribute("font-size", d.toString()), l.setAttribute("font-family", this._labelFont.family ?? "system-ui, sans-serif"), l.setAttribute("font-weight", "600"), l.setAttribute("fill", this._labelFont.color ?? "#223"), l.setAttribute("x", i.toString()), l.setAttribute("y", (n - s + d * 1.1).toString()), l.setAttribute("text-anchor", "middle");
3399
3840
  }
3400
3841
  }
3401
3842
  update_labels() {
3402
- this._nodeLabels.forEach((t) => t.update()), this._meanLabels.forEach((t) => t.update()), this._pointLabels.forEach((t) => t.update());
3843
+ this._nodeLabels.forEach((t) => t.update()), this._meanLabels.forEach((t) => t.update()), this._pointLabels.forEach((t) => t.update()), this._setLabels.forEach((t) => t.update());
3403
3844
  }
3404
3845
  update_extremes() {
3405
3846
  var s;
3406
3847
  const t = this.__data__;
3407
- if (t.update_extremes(this._centerContent), this._rangeExtent && this._rangeExtent > 0) {
3848
+ if (this._tweenView) {
3849
+ const [i, n, r, a] = this._tweenView;
3850
+ t.extremes = new Ct(i, n, r, a);
3851
+ } else if (t.update_extremes(this._centerContent), this._rangeExtent && this._rangeExtent > 0) {
3408
3852
  const { cx: i, cy: n } = t.extremes, r = this._centerContent && this._rangeMode === "network" ? t.nodeExtentFrom(i, n) * 1.2 : this._rangeExtent;
3409
- t.extremes = new Rt(r, r, i, n);
3853
+ t.extremes = new Ct(r, r, i, n);
3410
3854
  }
3411
3855
  const e = (s = this.svg_element) == null ? void 0 : s.getBoundingClientRect();
3412
3856
  if (this.svg_element && e) {
3413
- console.log("SVG rect: ", e);
3857
+ Qt("SVG rect: ", e);
3414
3858
  let i, n;
3415
- e.width === 0 || e.height === 0 ? (i = 1, n = 1) : (i = e.width, n = e.height), this.__data__.scale_x = 1 / (i / (4 * this.__data__.extremes.x_max)), this.__data__.scale_y = 1 / (n / (4 * this.__data__.extremes.y_max)), this.__children__[0].svg_element.setAttribute("transform", this.__data__.transform.toString()), this.svg_element.setAttribute("viewBox", this.__data__.extremes.as_viewBox());
3859
+ e.width === 0 || e.height === 0 ? (i = 1, n = 1) : (i = e.width, n = e.height), this.__data__.scale_x = 1 / (i / (4 * this.__data__.extremes.x_max)), this.__data__.scale_y = 1 / (n / (4 * this.__data__.extremes.y_max)), this.__children__[0].svg_element.setAttribute("transform", this.__data__.transform.toString()), this.svg_element.setAttribute("viewBox", this.__data__.extremes.as_viewBox(this._viewPadding()));
3416
3860
  let r = this.__data__.layers.search("layers", "axis_lines");
3417
3861
  if (r) {
3418
3862
  let a = r.objects.get("axis-x"), h = r.objects.get("axis-y");
3419
3863
  if (a && h) {
3420
3864
  const o = this.__data__.extremes;
3421
- a.from = new J({ ID: "axis-x-start", dimensions: [o.cx - o.x_max, 0], classes: ["ena.dimension", "ena.dimension"] }), a.to = new J({ ID: "axis-x-end", dimensions: [o.cx + o.x_max, 0], classes: ["ena.dimension", "ena.dimension"] }), h.from = new J({ ID: "axis-y-start", dimensions: [0, o.cy - o.y_max], classes: ["ena.dimension", "ena.dimension"] }), h.to = new J({ ID: "axis-y-end", dimensions: [0, o.cy + o.y_max], classes: ["ena.dimension", "ena.dimension"] });
3865
+ a.from = new K({ ID: "axis-x-start", dimensions: [o.cx - o.x_max, 0], classes: ["ena.dimension", "ena.dimension"] }), a.to = new K({ ID: "axis-x-end", dimensions: [o.cx + o.x_max, 0], classes: ["ena.dimension", "ena.dimension"] }), h.from = new K({ ID: "axis-y-start", dimensions: [0, o.cy - o.y_max], classes: ["ena.dimension", "ena.dimension"] }), h.to = new K({ ID: "axis-y-end", dimensions: [0, o.cy + o.y_max], classes: ["ena.dimension", "ena.dimension"] });
3422
3866
  }
3423
3867
  }
3424
3868
  }
@@ -3429,8 +3873,8 @@ const gt = class gt extends ve {
3429
3873
  });
3430
3874
  }
3431
3875
  };
3432
- u(gt, "QEGraphElement"), gt.tagName = "qe-graph", gt.style = `
3433
- ${ve.style}
3876
+ c(et, "QEGraphElement"), et.tagName = "qe-graph", et.style = `
3877
+ ${ze.style}
3434
3878
 
3435
3879
  :host {
3436
3880
  display: block;
@@ -3446,40 +3890,60 @@ u(gt, "QEGraphElement"), gt.tagName = "qe-graph", gt.style = `
3446
3890
  height: 100%;
3447
3891
  aspect-ratio: 1 / 1;
3448
3892
  background-color: #FFF;
3893
+ /* Touch pans and pinch-zooms the plot, not the page; a double-click
3894
+ zooms instead of selecting label text. */
3895
+ touch-action: none;
3896
+ -webkit-user-select: none;
3897
+ user-select: none;
3898
+ }
3899
+
3900
+ /* Marks that emit qe-node-click / qe-edge-click: nodes, means, points,
3901
+ edges, their hover lines and self-connection dots. Custom properties
3902
+ cross the shadow boundary, so a host can set --qe-mark-cursor on
3903
+ <qe-graph>. Labels keep their own grab / grabbing cursor. */
3904
+ svg [data-point-id],
3905
+ svg [data-edge-source] {
3906
+ cursor: var(--qe-mark-cursor, pointer);
3907
+ }
3908
+
3909
+ /* A directed edge's chevron sits on top of its triangle without the
3910
+ edge's identity; let clicks and the cursor reach the triangle. */
3911
+ svg [data-layer-name="edges"] path:not([data-edge-source]) {
3912
+ pointer-events: none;
3449
3913
  }
3450
- `, gt._instances = /* @__PURE__ */ new Set(), gt._PATH_NUM_RE = /-?\d*\.?\d+(?:e[-+]?\d+)?/gi;
3451
- let Vt = gt;
3452
- customElements.define(Vt.tagName, Vt);
3453
- const Ri = /* @__PURE__ */ u((d) => Vt.getGraph(d), "getGraph"), Li = /* @__PURE__ */ u(() => Vt.instances(), "getGraphs");
3914
+ `, et._instances = /* @__PURE__ */ new Set(), et._PATH_NUM_RE = /-?\d*\.?\d+(?:e[-+]?\d+)?/gi;
3915
+ let ee = et;
3916
+ customElements.define(ee.tagName, ee);
3917
+ const Hi = /* @__PURE__ */ c((g) => ee.getGraph(g), "getGraph"), Vi = /* @__PURE__ */ c(() => ee.instances(), "getGraphs");
3454
3918
  export {
3455
3919
  st as Color,
3456
- Yt as DataFrame,
3457
- ye as DataFrameColumn,
3458
- oi as DataFrameColumnType,
3459
- Ht as DataFrameRow,
3460
- Me as Edge,
3461
- Ke as Graph,
3462
- Re as QEAxesElement,
3463
- $e as QEEdgesElement,
3464
- Vt as QEGraphElement,
3465
- ts as QELayer,
3466
- St as QELine,
3467
- Ce as QEMeansElement,
3468
- ke as QENodesElement,
3469
- oe as QEPoint,
3470
- Oe as QEPointsElement,
3471
- Pe as QETrajectoriesElement,
3472
- Ne as QETrajectory,
3473
- xe as QEVisualElement,
3474
- hi as TRAJECTORY_ZERO_EPS,
3475
- Ee as Trajectory,
3476
- we as WeightedColor,
3477
- ui as fitTrajectory,
3478
- Ri as getGraph,
3479
- Li as getGraphs,
3480
- Us as nearOriginFilter,
3481
- Bs as sampleCurve,
3482
- _i as selectDegree,
3483
- Pi as vizENA
3920
+ Xt as DataFrame,
3921
+ Me as DataFrameColumn,
3922
+ bi as DataFrameColumnType,
3923
+ Jt as DataFrameRow,
3924
+ Pe as Edge,
3925
+ is as Graph,
3926
+ Ye as QEAxesElement,
3927
+ De as QEEdgesElement,
3928
+ ee as QEGraphElement,
3929
+ as as QELayer,
3930
+ Mt as QELine,
3931
+ Te as QEMeansElement,
3932
+ $e as QENodesElement,
3933
+ ue as QEPoint,
3934
+ Fe as QEPointsElement,
3935
+ je as QETrajectoriesElement,
3936
+ Re as QETrajectory,
3937
+ Ie as QEVisualElement,
3938
+ xi as TRAJECTORY_ZERO_EPS,
3939
+ Oe as Trajectory,
3940
+ Ne as WeightedColor,
3941
+ Si as fitTrajectory,
3942
+ Hi as getGraph,
3943
+ Vi as getGraphs,
3944
+ ti as nearOriginFilter,
3945
+ si as sampleCurve,
3946
+ Ai as selectDegree,
3947
+ Wi as vizENA
3484
3948
  };
3485
3949
  //# sourceMappingURL=qeviz.es.js.map