@qe-libs/qeviz 0.5.5 → 0.5.6

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
@@ -4,87 +4,87 @@ var Fs = (d) => {
4
4
  };
5
5
  var u = (d, t) => ri(d, "name", { value: t, configurable: !0 });
6
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)), tt = (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), G = (d, t, e, s) => (js(d, t, "write to private field"), s ? s.call(d, e) : t.set(d, e), e);
8
- var oe, ae, he, pt, le;
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
9
  const es = class es extends Array {
10
10
  constructor(e, s, i, n, r) {
11
11
  super(...s);
12
- tt(this, oe);
13
- tt(this, ae);
14
- tt(this, he);
15
- tt(this, pt);
16
- tt(this, le);
17
- G(this, he, e), G(this, ae, i), G(this, pt, n), G(this, le, n == null ? void 0 : n.classes), G(this, oe, r);
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);
18
18
  }
19
19
  get parent() {
20
- return k(this, pt);
20
+ return k(this, bt);
21
21
  }
22
22
  get names() {
23
- return k(this, he);
23
+ return k(this, le);
24
24
  }
25
25
  get rowName() {
26
- return k(this, ae);
26
+ return k(this, he);
27
27
  }
28
28
  get types() {
29
- if (!k(this, pt)) throw new Error("No parent DataFrame attached to this row.");
30
- return k(this, pt).types;
29
+ if (!k(this, bt)) throw new Error("No parent DataFrame attached to this row.");
30
+ return k(this, bt).types;
31
31
  }
32
32
  get classes() {
33
- return k(this, le);
33
+ return k(this, ce);
34
34
  }
35
35
  get rowNumber() {
36
- return k(this, oe);
36
+ return k(this, ae);
37
37
  }
38
38
  col(e) {
39
- if (!k(this, pt)) throw new Error("No parent DataFrame attached to this row.");
40
- return k(this, pt).col(e);
39
+ if (!k(this, bt)) throw new Error("No parent DataFrame attached to this row.");
40
+ return k(this, bt).col(e);
41
41
  }
42
42
  cols(...e) {
43
- if (!k(this, pt)) throw new Error("No parent DataFrame attached to this row.");
44
- return k(this, pt).cols(...e);
43
+ if (!k(this, bt)) throw new Error("No parent DataFrame attached to this row.");
44
+ return k(this, bt).cols(...e);
45
45
  }
46
46
  filter(e) {
47
47
  console.error("DataFrameRow does not currently support filtering.");
48
48
  }
49
49
  };
50
- oe = new WeakMap(), ae = new WeakMap(), he = new WeakMap(), pt = new WeakMap(), le = new WeakMap(), u(es, "DataFrameRow");
51
- let Bt = es;
52
- var oi = /* @__PURE__ */ ((d) => (d.Character = "character", d.Double = "double", d.Logical = "logical", d.Integer = "integer", d))(oi || {}), ce, bt, qt, Mt;
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
53
  const ss = class ss extends Array {
54
54
  constructor(e, s, i, n) {
55
55
  super(s.length);
56
- tt(this, ce);
57
- tt(this, bt);
58
- tt(this, qt);
59
- tt(this, Mt);
56
+ et(this, _e);
57
+ et(this, yt);
58
+ et(this, Ut);
59
+ et(this, Nt);
60
60
  for (let r = 0; r < s.length; r++)
61
61
  this[r] = s[r];
62
- if (G(this, ce, e), s.type !== void 0 ? G(this, bt, s.type) : s.every((r) => typeof r == "string" || r === null || r === void 0) ? G(this, bt, "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, bt, "logical") : G(this, bt, "integer") : s.every((r) => typeof r == "number" || r === null || r === void 0) ? G(this, bt, "double") : s.every((r) => typeof r == "boolean" || r === null || r === void 0) ? G(this, bt, "logical") : G(this, bt, "character"), G(this, Mt, n), i && i.length !== this.length)
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)
63
63
  throw new Error("Row names length must match the number of rows in the DataFrameColumn.");
64
- i && i.length > 0 ? G(this, qt, i) : G(this, qt, void 0);
64
+ i && i.length > 0 ? B(this, Ut, i) : B(this, Ut, void 0);
65
65
  }
66
66
  get name() {
67
- return k(this, ce);
67
+ return k(this, _e);
68
68
  }
69
69
  get type() {
70
- return k(this, bt);
70
+ return k(this, yt);
71
71
  }
72
72
  get rowNames() {
73
- return k(this, qt);
73
+ return k(this, Ut);
74
74
  }
75
75
  row(e) {
76
- if (!k(this, Mt)) throw new Error("No parent DataFrame attached to this column.");
77
- return k(this, Mt).row(e);
76
+ if (!k(this, Nt)) throw new Error("No parent DataFrame attached to this column.");
77
+ return k(this, Nt).row(e);
78
78
  }
79
79
  rows(...e) {
80
- if (!k(this, Mt)) throw new Error("No parent DataFrame attached to this column.");
81
- return k(this, Mt).rows(...e);
80
+ if (!k(this, Nt)) throw new Error("No parent DataFrame attached to this column.");
81
+ return k(this, Nt).rows(...e);
82
82
  }
83
83
  };
84
- ce = new WeakMap(), bt = new WeakMap(), qt = new WeakMap(), Mt = new WeakMap(), u(ss, "DataFrameColumn");
85
- let be = ss;
86
- var vt, ht, _e;
87
- const Jt = class Jt extends Array {
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 {
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 Jt = class Jt extends Array {
97
97
  s = r;
98
98
  }
99
99
  super(s.length);
100
- tt(this, vt);
101
- tt(this, ht);
102
- tt(this, _e);
100
+ et(this, Et);
101
+ et(this, ct);
102
+ et(this, ue);
103
103
  if (s.forEach((r, a) => {
104
- r instanceof be ? this[a] = r : this[a] = new be(e[a], r, i, this);
105
- }), G(this, vt, e), i && this[0] && i.length !== this[0].length)
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)
106
106
  throw new Error("Row names length must match the number of rows in the DataFrame.");
107
- if (i && i.length > 0 && G(this, ht, i), n && n.length !== this.length)
107
+ if (i && i.length > 0 && B(this, ct, 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 && G(this, _e, n);
109
+ n && n.length > 0 && B(this, ue, n);
110
110
  }
111
111
  get classes() {
112
- return k(this, _e);
112
+ return k(this, ue);
113
113
  }
114
114
  getColumnByName(e) {
115
- const s = k(this, vt).indexOf(e);
115
+ const s = k(this, Et).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 Bt(k(this, vt), [], void 0, this, e);
120
+ return console.warn("DataFrame is empty, cannot get row by index", e), new Ht(k(this, Et), [], 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 Bt(k(this, vt), s, k(this, ht) ? k(this, ht)[e] : void 0, this, e);
126
+ return new Ht(k(this, Et), s, k(this, ct) ? k(this, ct)[e] : void 0, this, e);
127
127
  }
128
128
  getRowByName(e) {
129
- if (!k(this, ht)) return;
130
- const s = k(this, ht).indexOf(e);
129
+ if (!k(this, ct)) return;
130
+ const s = k(this, ct).indexOf(e);
131
131
  if (s !== -1)
132
132
  return this.getRowByIndex(s);
133
133
  }
@@ -157,11 +157,11 @@ const Jt = class Jt 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, ht);
160
+ i = Array.from({ length: r }, (a, h) => this.getRowByIndex(h)), n = k(this, ct);
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, ht) && h && (n == null || n.push(k(this, ht)[a])), h;
164
+ return k(this, ct) && h && (n == null || n.push(k(this, ct)[a])), h;
165
165
  }).filter((r) => r !== void 0);
166
166
  return i;
167
167
  }
@@ -173,21 +173,21 @@ const Jt = class Jt 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, vt)) : (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 Jt(n, i, k(this, ht));
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));
177
177
  }
178
178
  subset(e, s) {
179
179
  const i = s && s.length > 0 ? this.cols(...s) : this.slice();
180
- return new Jt(
180
+ return new Zt(
181
181
  i.map((n) => n.name),
182
182
  i.map((n) => n.values),
183
- k(this, ht)
183
+ k(this, ct)
184
184
  );
185
185
  }
186
186
  get names() {
187
- return k(this, vt);
187
+ return k(this, Et);
188
188
  }
189
189
  get rowNames() {
190
- return k(this, ht);
190
+ return k(this, ct);
191
191
  }
192
192
  get nrow() {
193
193
  return this[0] ? this[0].length : 0;
@@ -196,11 +196,11 @@ const Jt = class Jt extends Array {
196
196
  return this.length;
197
197
  }
198
198
  };
199
- vt = new WeakMap(), ht = new WeakMap(), _e = new WeakMap(), u(Jt, "DataFrame");
200
- let jt = Jt;
199
+ Et = new WeakMap(), ct = new WeakMap(), ue = new WeakMap(), u(Zt, "DataFrame");
200
+ let Yt = Zt;
201
201
  const is = class is {
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 jt(), this._nodes = t.nodes ?? new jt(), this._edges = t.edges ?? new jt(), 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 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;
204
204
  }
205
205
  get updated() {
206
206
  return this._updated;
@@ -297,11 +297,11 @@ const Pi = {
297
297
  const t = [...document.querySelectorAll("qe-graph")];
298
298
  return typeof d == "number" && d >= 0 ? t[d] : t;
299
299
  }, "get")
300
- }, Tt = class Tt extends HTMLElement {
300
+ }, zt = class zt extends HTMLElement {
301
301
  constructor() {
302
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();
303
303
  const t = this.attachShadow({ mode: "open" }), e = document.createElement("style");
304
- e.textContent = Tt.styles, t.appendChild(e), this._outputElement = document.createElement("div"), t.appendChild(this._outputElement);
304
+ e.textContent = zt.styles, t.appendChild(e), this._outputElement = document.createElement("div"), t.appendChild(this._outputElement);
305
305
  }
306
306
  static get observedAttributes() {
307
307
  return ["updated"];
@@ -349,14 +349,14 @@ const Pi = {
349
349
  setModelData(t) {
350
350
  var r, a, h, o;
351
351
  ["nodes", "edges", "points", "groups", "confidence", "outlier", "trajectories", "networks", "pointsets"].forEach((l) => {
352
- var S;
352
+ var v;
353
353
  const _ = t[l];
354
- if (!((S = _ == null ? void 0 : _.data) != null && S.length)) return;
355
- const g = _.data, c = _.types || {}, E = Object.keys(g[0]), f = g.map((j) => Object.values(j)), v = E.map((j) => c[j] ?? "character");
356
- let P;
357
- l === "networks" ? P = "name" : l === "pointsets" ? P = "id" : l === "nodes" ? P = t.node_id_col ?? E.find((j) => (c[j] ?? "character") === "character") : l === "edges" || l === "points" || l === "trajectories" ? P = t.id_col ?? E.find((j) => (c[j] ?? "character") === "character") : P = t.group_col ?? E.find((j) => (c[j] ?? "character") === "character");
358
- const Y = P ? E.indexOf(P) : 0, q = f.map((j) => String(j[Y]));
359
- this._model.setByKey(l, new jt(E, f, q, v));
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));
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
362
  this._model.node_id_col = t.node_id_col ?? ((r = s == null ? void 0 : s.names) == null ? void 0 : r.find((l) => {
@@ -379,8 +379,8 @@ const Pi = {
379
379
  else {
380
380
  const c = s.names.filter((E) => {
381
381
  if (E === l) return !1;
382
- const f = s.col(E);
383
- return f && f.type !== "character" && f.type !== "logical";
382
+ const m = s.col(E);
383
+ return m && m.type !== "character" && m.type !== "logical";
384
384
  });
385
385
  c.length >= 2 && (this._model.dimensions = [_ ?? c[0], g ?? c[1]]);
386
386
  }
@@ -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(Tt, "QEVisualElement"), Tt.tagName = "qe-visual", Tt.styles = `
401
+ u(zt, "QEVisualElement"), zt.tagName = "qe-visual", zt.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,14 +406,14 @@ u(Tt, "QEVisualElement"), Tt.tagName = "qe-visual", Tt.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 ye = Tt;
410
- customElements.define(ye.tagName, ye);
411
- const Re = class Re {
409
+ let xe = zt;
410
+ customElements.define(xe.tagName, xe);
411
+ const dt = class dt {
412
412
  constructor(t) {
413
413
  return this.base = typeof t == "string" ? t : t.base, new Proxy(this, {
414
414
  get(e, s) {
415
415
  if (typeof s == "string" && /^[0-2]$/.test(s)) {
416
- const { r: i, g: n, b: r } = Re.parseColor(e.base);
416
+ const { r: i, g: n, b: r } = dt.parseColor(e.base);
417
417
  return [i, n, r][Number(s)];
418
418
  }
419
419
  return e[s];
@@ -427,29 +427,49 @@ const Re = class Re {
427
427
  this.base = t;
428
428
  }
429
429
  static parseColor(t) {
430
- if (t.startsWith("#")) {
431
- const e = parseInt(t.slice(1), 16);
432
- return {
433
- r: e >> 16 & 255,
434
- g: e >> 8 & 255,
435
- b: e & 255
436
- };
430
+ const e = String(t).trim();
431
+ if (/^#[0-9a-f]{6}([0-9a-f]{2})?$/i.test(e)) {
432
+ const n = parseInt(e.slice(1, 7), 16);
433
+ return { r: n >> 16 & 255, g: n >> 8 & 255, b: n & 255 };
437
434
  }
438
- throw new Error("Unsupported color format");
435
+ if (/^#[0-9a-f]{3}$/i.test(e)) {
436
+ const [n, r, a] = [1, 2, 3].map((h) => parseInt(e[h] + e[h], 16));
437
+ return { r: n, g: r, b: a };
438
+ }
439
+ const s = e.match(/^rgba?\(\s*([\d.]+)[,\s]+([\d.]+)[,\s]+([\d.]+)/i);
440
+ if (s) return { r: Math.round(+s[1]), g: Math.round(+s[2]), b: Math.round(+s[3]) };
441
+ const i = dt.resolveCss(e);
442
+ if (i) return dt.parseColor(i);
443
+ throw new Error(`Unsupported color format: ${t}`);
444
+ }
445
+ /** A CSS colour as "#rrggbb" / "rgba(...)", or null if it isn't one. */
446
+ static resolveCss(t) {
447
+ if (dt._cssCache.has(t)) return dt._cssCache.get(t);
448
+ dt._ctx === void 0 && (dt._ctx = typeof document < "u" ? document.createElement("canvas").getContext("2d") : null);
449
+ let e = null;
450
+ const s = dt._ctx;
451
+ if (s) {
452
+ s.fillStyle = "#000000", s.fillStyle = t;
453
+ const i = s.fillStyle;
454
+ s.fillStyle = "#ffffff", s.fillStyle = t;
455
+ const n = s.fillStyle;
456
+ i === n && (e = String(i));
457
+ }
458
+ return dt._cssCache.set(t, e), e;
439
459
  }
440
460
  static rgb(t, e, s) {
441
461
  return `rgb(${t}, ${e}, ${s})`;
442
462
  }
443
463
  };
444
- u(Re, "Color");
445
- let et = Re;
446
- const Zt = class Zt extends et {
464
+ u(dt, "Color"), dt._cssCache = /* @__PURE__ */ new Map();
465
+ let st = dt;
466
+ const Qt = class Qt extends st {
447
467
  constructor(t, e, s) {
448
468
  super(t), this.weight = e, this.alpha = s;
449
469
  }
450
470
  // Parse hex → HSV (h in [0, 360), s/v in [0, 1]).
451
471
  static toHSV(t) {
452
- const { r: e, g: s, b: i } = et.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;
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;
453
473
  let c = 0;
454
474
  if (l > 0)
455
475
  switch (h) {
@@ -481,12 +501,12 @@ const Zt = class Zt extends et {
481
501
  // #EE6677 have HSL lightness ≈ 67%, so 100% HSL saturation still looks
482
502
  // washed-out, whereas HSV value ≈ 0.93 gives the expected vivid output.
483
503
  toString() {
484
- const { h: t, v: e } = Zt.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));
485
- return Zt.hsvToRgba(t, s, e, i);
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);
486
506
  }
487
507
  };
488
- u(Zt, "WeightedColor");
489
- let xe = Zt;
508
+ u(Qt, "WeightedColor");
509
+ let we = Qt;
490
510
  const ns = class ns {
491
511
  constructor(t = null) {
492
512
  this._values = [1, 0, 0, 1, 0, 0], this._keys = ["a", "b", "c", "d", "e", "f"], t && (this.values = t);
@@ -565,8 +585,8 @@ const ns = class ns {
565
585
  }
566
586
  };
567
587
  u(ns, "Transform");
568
- let ee = ns;
569
- var se;
588
+ let se = ns;
589
+ var ie;
570
590
  ((d) => {
571
591
  ((t) => {
572
592
  function e(s) {
@@ -597,88 +617,88 @@ var se;
597
617
  }
598
618
  u(n, "rotate"), s.rotate = n;
599
619
  })(t.Point || (t.Point = {})), ((s) => {
600
- function i(f, v) {
601
- return (v[1] - f[1]) / (v[0] - f[0]);
620
+ function i(m, S) {
621
+ return (S[1] - m[1]) / (S[0] - m[0]);
602
622
  }
603
623
  u(i, "slope"), s.slope = i;
604
- function n(f, v) {
605
- const P = i(f, v);
606
- return f[1] - P * f[0];
624
+ function n(m, S) {
625
+ const R = i(m, S);
626
+ return m[1] - R * m[0];
607
627
  }
608
628
  u(n, "intercept"), s.intercept = n;
609
- function r(f, v) {
629
+ function r(m, S) {
610
630
  return {
611
- slope: i(f, v),
612
- intercept: n(f, v)
631
+ slope: i(m, S),
632
+ intercept: n(m, S)
613
633
  };
614
634
  }
615
635
  u(r, "slopeIntercept"), s.slopeIntercept = r;
616
- function a(f, v = 0) {
617
- const P = v, Y = (1 - P) * f[0][0] + P * f[1][0], q = (1 - P) * f[0][1] + P * f[1][1];
618
- return [Y, q];
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];
619
639
  }
620
640
  u(a, "point_along"), s.point_along = a;
621
- function h(f, v, P = 0.5) {
622
- return Array.isArray(f[0]) && (v = f[1], f = f[0]), [0, 1].map((Y) => (parseFloat(f[Y]) + parseFloat(v[Y])) * P);
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);
623
643
  }
624
644
  u(h, "midpoint"), s.midpoint = h;
625
- function o(f, v) {
626
- return Array.isArray(f[0]) && (v = f[1], f = f[0]), Math.sqrt(
627
- [0, 1].map((P) => Math.pow(v[P] - f[P], 2)).reduce((P, Y) => P + Y, 0)
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)
628
648
  );
629
649
  }
630
650
  u(o, "length"), s.length = o;
631
- function l(f, v = [0, 0]) {
632
- const P = [
633
- f[1][0] - v[0],
634
- f[1][1] - v[1]
635
- ], Y = [
636
- -P[1],
637
- P[0]
638
- ], q = [
639
- -Y[0],
640
- -Y[1]
641
- ], S = [
642
- Y[0] + v[0],
643
- Y[1] + v[1]
651
+ function l(m, S = [0, 0]) {
652
+ const R = [
653
+ m[1][0] - S[0],
654
+ m[1][1] - S[1]
644
655
  ], j = [
645
- q[0] + v[0],
646
- q[1] + v[1]
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]
647
667
  ];
648
- return [S, j];
668
+ return [v, F];
649
669
  }
650
670
  u(l, "rotate"), s.rotate = l;
651
- function _(f, v, P = 90) {
652
- const Y = d.Geometry.Line.slope(f[0], f[1]), q = d.Geometry.Line.intercept(f[0], f[1]), S = [0, q], j = [1, Y + q];
653
- f = [S, j];
654
- const nt = [f[0][0], f[1][0]], rt = [f[0][1], f[1][1]], st = v[0], lt = v[1], W = -2 * Math.PI * P / 360, Et = nt.map(
655
- (de, ct) => (de - st) * Math.cos(W) - (rt[ct] - lt) * Math.sin(W) + st
656
- ), kt = rt.map(
657
- (de, ct) => (nt[ct] - st) * Math.sin(W) - (de - lt) * Math.cos(W) + lt
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
658
678
  );
659
679
  return [
660
- [Et[0], kt[0]],
661
- [Et[1], kt[1]]
680
+ [It[0], Ot[0]],
681
+ [It[1], Ot[1]]
662
682
  ];
663
683
  }
664
684
  u(_, "rotate2"), s.rotate2 = _;
665
- function g(f, v) {
666
- const [[P, Y], [q, S]] = f, [[j, nt], [rt, st]] = v, lt = (P - q) * (nt - st) - (Y - S) * (j - rt), W = (P * S - Y * q) * (j - rt) - (P - q) * (j * st - nt * rt), Et = (P * S - Y * q) * (nt - st) - (Y - S) * (j * st - nt * rt);
667
- return [W / lt, Et / lt];
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];
668
688
  }
669
689
  u(g, "intersection"), s.intersection = g;
670
- function c(f, v, P) {
671
- let { slope: Y, intercept: q } = d.Geometry.Line.slopeIntercept(f[0], f[1]), S = 1 + Math.pow(Y, 2), j = 2 * Y * q - 2 * v[1] * Y - 2 * v[0], nt = Math.pow(v[0], 2) + Math.pow(q, 2) + Math.pow(v[1], 2) - 2 * v[1] * q - Math.pow(P, 2), rt = [[1 / 0, 1 / 0], [1 / 0, 1 / 0]];
672
- if (Math.sqrt(Math.pow(j, 2) - 4 * S * nt) >= 0) {
673
- let st = (-j + Math.sqrt(Math.pow(j, 2) - 4 * S * nt)) / (2 * S), lt = (-j - Math.sqrt(Math.pow(j, 2) - 4 * S * nt)) / (2 * S), W = Y * st + q, Et = Y * lt + q;
674
- rt = [[st, W], [lt, Et]];
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]];
675
695
  } else
676
696
  console.error("The line and the circumference do not intersect");
677
- return rt;
697
+ return ot;
678
698
  }
679
699
  u(c, "intersect_circle"), s.intersect_circle = c;
680
- function E(f) {
681
- return (v) => v === 0 ? f[0] : v === 1 ? f[1] : d.Geometry.Point.translate(f[0], d.Geometry.Angle.line(f), d.Geometry.Line.length(f) * v);
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);
682
702
  }
683
703
  u(E, "interpolate"), s.interpolate = E;
684
704
  })(t.Line || (t.Line = {}));
@@ -822,7 +842,7 @@ var se;
822
842
  u(r, "has"), s.has = r;
823
843
  })(t.Query || (t.Query = {}));
824
844
  })(d.URL || (d.URL = {}));
825
- })(se || (se = {}));
845
+ })(ie || (ie = {}));
826
846
  const rs = class rs {
827
847
  constructor() {
828
848
  this._state = /* @__PURE__ */ new Map(), this.listeners = /* @__PURE__ */ new Map();
@@ -863,8 +883,8 @@ const rs = class rs {
863
883
  }
864
884
  };
865
885
  u(rs, "EventBus");
866
- let we = rs;
867
- const { ArrayTools: qs } = se, Qt = class Qt extends Array {
886
+ let Ae = rs;
887
+ const { ArrayTools: qs } = ie, te = class te extends Array {
868
888
  constructor(...t) {
869
889
  super(...t);
870
890
  }
@@ -896,11 +916,11 @@ const { ArrayTools: qs } = se, Qt = class Qt extends Array {
896
916
  return this.reduce((t, e) => (t.push(e), e.layers && Array.isArray(e.layers) && t.push(...e.layers), t), []);
897
917
  }
898
918
  recurse(t, e, s = null, i = 0) {
899
- let n = new Qt();
919
+ let n = new te();
900
920
  for (const r of this) {
901
921
  let a = e(r, s, i);
902
922
  if (r[t] && Array.isArray(r[t])) {
903
- let h = new Qt(...r[t]).recurse(t, e, r, i + 1);
923
+ let h = new te(...r[t]).recurse(t, e, r, i + 1);
904
924
  h !== void 0 && n.push(...h);
905
925
  }
906
926
  n.push(a);
@@ -908,11 +928,11 @@ const { ArrayTools: qs } = se, Qt = class Qt extends Array {
908
928
  return console.log("Recurse results: ", n), n;
909
929
  }
910
930
  };
911
- u(Qt, "LayerArray");
912
- let Yt = Qt;
931
+ u(te, "LayerArray");
932
+ let qt = te;
913
933
  const os = class os {
914
934
  constructor(t, e, s) {
915
- this.__state__ = new we(), this.scale_x = 1, this.scale_y = 1, this.scale_objects = !0, this.layers = new Yt(), 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 ee(), s == null || s.__state__.addListener("graph_updated", "live", ({ key: i, newValue: n, oldValue: r }) => {
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 }) => {
916
936
  }), s == null || s.__state__.addListener(`graph_updated_${this.name}`, "live", ({ key: i, newValue: n, oldValue: r }) => {
917
937
  this.objects = n, this.__state__.setVariable("layer_updated", this);
918
938
  });
@@ -926,45 +946,45 @@ const os = class os {
926
946
  };
927
947
  u(os, "Layer");
928
948
  let We = os;
929
- var Rt, St;
949
+ var Lt, Mt;
930
950
  const Le = class Le extends Array {
931
951
  constructor(...e) {
932
952
  super(arguments.length);
933
- tt(this, Rt, !1);
934
- tt(this, St);
953
+ et(this, Lt, !1);
954
+ et(this, Mt);
935
955
  for (let s = 0; s < e.length; s++)
936
956
  this[s] = e[s];
937
- G(this, Rt, !1);
957
+ B(this, Lt, !1);
938
958
  }
939
959
  static fromArray(e) {
940
960
  const s = new Le();
941
961
  return e.forEach((i, n) => {
942
962
  s.push(i);
943
- }), G(s, St, e.names), s;
963
+ }), B(s, Mt, e.names), s;
944
964
  }
945
965
  flip() {
946
- G(this, Rt, !k(this, Rt));
966
+ B(this, Lt, !k(this, Lt));
947
967
  for (let e = 0; e < this.length; e++)
948
968
  this[e] = -this[e];
949
969
  return this;
950
970
  }
951
971
  get(e) {
952
- return typeof e == "number" ? this[e] : k(this, St) && k(this, St).includes(e) ? this[k(this, St).indexOf(e)] : void 0;
972
+ return typeof e == "number" ? this[e] : k(this, Mt) && k(this, Mt).includes(e) ? this[k(this, Mt).indexOf(e)] : void 0;
953
973
  }
954
974
  get flipped() {
955
- return k(this, Rt);
975
+ return k(this, Lt);
956
976
  }
957
977
  get names() {
958
- return k(this, St) ? k(this, St) : this.map((e, s) => `V${s + 1}`);
978
+ return k(this, Mt) ? k(this, Mt) : this.map((e, s) => `V${s + 1}`);
959
979
  }
960
980
  };
961
- Rt = new WeakMap(), St = new WeakMap(), u(Le, "DimensionVector");
962
- let $t = Le;
981
+ Lt = new WeakMap(), Mt = new WeakMap(), u(Le, "DimensionVector");
982
+ let Pt = Le;
963
983
  const as = class as {
964
984
  constructor(t, e) {
965
- 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 et("#000000"), this._size = 0, this.ID = e.ID, this._transform = new ee(), t instanceof $t ? this._dimensions = t : t instanceof Bt ? this._dimensions = $t.fromArray(t) : Array.isArray(t) ? this._dimensions = new $t(...t) : (console.warn("Invalid dimensions provided, using default DimensionVector(0, 0)"), this._dimensions = new $t(0, 0));
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));
966
986
  let s = { ...e };
967
- 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 et("#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);
987
+ 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);
968
988
  }
969
989
  get dimensions() {
970
990
  return this._dimensions;
@@ -1017,8 +1037,8 @@ const as = class as {
1017
1037
  }
1018
1038
  };
1019
1039
  u(as, "PlottedObject");
1020
- let It = as;
1021
- const hs = class hs extends It {
1040
+ let kt = as;
1041
+ const hs = class hs extends kt {
1022
1042
  // constructor(x: LineOptions) {
1023
1043
  // super([], x);
1024
1044
  // // const data = Object.assign({}, x);
@@ -1061,8 +1081,8 @@ const hs = class hs extends It {
1061
1081
  }
1062
1082
  };
1063
1083
  u(hs, "Line");
1064
- let Ht = hs;
1065
- const te = class te extends It {
1084
+ let Xt = hs;
1085
+ const ee = class ee extends kt {
1066
1086
  // constructor(dimensions: DimensionType, o: PointOptions) { //, graph?: any) {
1067
1087
  // super(dimensions, o);
1068
1088
  // this.active = o.active || false;
@@ -1078,7 +1098,7 @@ const te = class te extends It {
1078
1098
  constructor(t) {
1079
1099
  var n, r;
1080
1100
  let e, s, i;
1081
- t ? t instanceof Bt ? (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 = te.SHAPES.CIRCLE;
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;
1082
1102
  }
1083
1103
  set label(t) {
1084
1104
  this._label = t;
@@ -1099,9 +1119,9 @@ const te = class te extends It {
1099
1119
  this._y = parseFloat(t);
1100
1120
  }
1101
1121
  };
1102
- u(te, "Point"), te.SHAPES = { CIRCLE: "circle", SQUARE: "rect" };
1103
- let J = te;
1104
- const zt = class zt extends It {
1122
+ u(ee, "Point"), ee.SHAPES = { CIRCLE: "circle", SQUARE: "rect" };
1123
+ let J = ee;
1124
+ const Ft = class Ft extends kt {
1105
1125
  constructor(t, e) {
1106
1126
  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);
1107
1127
  }
@@ -1124,8 +1144,8 @@ const zt = class zt extends It {
1124
1144
  this._transform = t;
1125
1145
  }
1126
1146
  };
1127
- u(zt, "Label"), zt.DISPLAY_TYPES = { OFF: 0, AUTO: 1, CLICK: 2, ON: 3 }, zt.HIGHLIGHT = { OFF: 0, ON: 2 }, zt.POSITION = { OBJECT: 1, STATIC: 2, CONTAINER: 3, CUSTOM: 4 };
1128
- let B = zt;
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;
1129
1149
  const ls = class ls {
1130
1150
  constructor(t, e, s = 0, i = 0) {
1131
1151
  this.x_max = t, this.y_max = e, this.cx = s, this.cy = i;
@@ -1160,8 +1180,8 @@ const ls = class ls {
1160
1180
  }
1161
1181
  };
1162
1182
  u(ls, "Extremes");
1163
- let Pt = ls;
1164
- const cs = class cs extends It {
1183
+ let Rt = ls;
1184
+ const cs = class cs extends kt {
1165
1185
  constructor(t, e) {
1166
1186
  super(t, e), this.visible = !0, this.size = e.size;
1167
1187
  }
@@ -1204,25 +1224,25 @@ let Ve = cs, Ks = {
1204
1224
  size: 1,
1205
1225
  highlight: {
1206
1226
  color: "yellow",
1207
- labels: B.DISPLAY_TYPES.ON
1227
+ labels: H.DISPLAY_TYPES.ON
1208
1228
  },
1209
- labels: B.DISPLAY_TYPES.ON,
1210
- labelposition: B.POSITION.OBJECT
1229
+ labels: H.DISPLAY_TYPES.ON,
1230
+ labelposition: H.POSITION.OBJECT
1211
1231
  },
1212
1232
  POINT: {
1213
1233
  active: 2,
1214
1234
  size: 0.05,
1215
1235
  color: "#000",
1216
1236
  shape: J.SHAPES.CIRCLE,
1217
- labels: B.DISPLAY_TYPES.AUTO,
1218
- labelposition: B.POSITION.OBJECT
1237
+ labels: H.DISPLAY_TYPES.AUTO,
1238
+ labelposition: H.POSITION.OBJECT
1219
1239
  },
1220
1240
  MEAN: {
1221
1241
  shape: J.SHAPES.SQUARE,
1222
- labels: B.DISPLAY_TYPES.AUTO
1242
+ labels: H.DISPLAY_TYPES.AUTO
1223
1243
  },
1224
1244
  LABEL: {
1225
- highlight: B.HIGHLIGHT.OFF,
1245
+ highlight: H.HIGHLIGHT.OFF,
1226
1246
  position: ["top", "left"],
1227
1247
  container: "#label-container"
1228
1248
  },
@@ -1232,7 +1252,7 @@ let Ve = cs, Ks = {
1232
1252
  };
1233
1253
  const _s = class _s {
1234
1254
  constructor(t = { ...Ks }) {
1235
- this.__state__ = new we(), 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 ee(), this.scale_x = 1, this.scale_y = 1, this.SIZE_EFFECT = 1, this._mirror_y = !0, this._mirror_x = !1, this._layers = new Yt(
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(
1236
1256
  { name: "graph", tabindex: 0, layers: [
1237
1257
  {
1238
1258
  name: "axes",
@@ -1272,7 +1292,7 @@ const _s = class _s {
1272
1292
  { name: "labels", layers: [], tabindex: 0 }
1273
1293
  ] }
1274
1294
  ), this.options = t, this.origin = new Ve(
1275
- new $t(0, 0),
1295
+ new Pt(0, 0),
1276
1296
  {
1277
1297
  ID: "origin",
1278
1298
  x: 0,
@@ -1280,35 +1300,35 @@ const _s = class _s {
1280
1300
  size: 0,
1281
1301
  meta: {},
1282
1302
  graph: this,
1283
- color: new et("#FFFFFF"),
1284
- highlight: new et("#FFFFFF"),
1303
+ color: new st("#FFFFFF"),
1304
+ highlight: new st("#FFFFFF"),
1285
1305
  active: !1
1286
1306
  }
1287
1307
  );
1288
1308
  let e = 1;
1289
1309
  function s(r, a, h) {
1290
1310
  const o = new We(`${e}`, r, h);
1291
- return e += 1, o.parent = a || void 0, r.layers && Array.isArray(r.layers) && (o.layers = new Yt(...r.layers.map((l) => s(l, o, h)))), o;
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;
1292
1312
  }
1293
- u(s, "buildLayerTree"), this.layers = new Yt(...this._layers.map((r) => s(r, null, this)));
1313
+ u(s, "buildLayerTree"), this.layers = new qt(...this._layers.map((r) => s(r, null, this)));
1294
1314
  let i = this.layers.search("layers", "axis_points");
1295
1315
  i && i.objects.set(this.origin.ID, this.origin);
1296
1316
  let n = this.layers.search("layers", "axis_lines");
1297
1317
  if (n) {
1298
- let r = this.extremes || new Pt(1, 1), a = new Ht(
1318
+ let r = this.extremes || new Rt(1, 1), a = new Xt(
1299
1319
  {},
1300
1320
  new J({ ID: "axis-x-start", dimensions: [-r.x_max, 0], classes: ["ena.dimension", "ena.dimension"] }),
1301
1321
  new J({ ID: "axis-x-end", dimensions: [r.x_max, 0], classes: ["ena.dimension", "ena.dimension"] })
1302
1322
  );
1303
1323
  a.ID = "axis-x", n.objects.set(a.ID, a);
1304
- let h = new Ht(
1324
+ let h = new Xt(
1305
1325
  {},
1306
1326
  new J({ ID: "axis-y-start", dimensions: [0, -r.y_max], classes: ["ena.dimension", "ena.dimension"] }),
1307
1327
  new J({ ID: "axis-y-end", dimensions: [0, r.y_max], classes: ["ena.dimension", "ena.dimension"] })
1308
1328
  );
1309
1329
  h.ID = "axis-y", n.objects.set(h.ID, h), console.log("Added axis lines to layer: ", n);
1310
1330
  }
1311
- this.extremes = new Pt(t.GRAPH.x_max, t.GRAPH.y_max);
1331
+ this.extremes = new Rt(t.GRAPH.x_max, t.GRAPH.y_max);
1312
1332
  }
1313
1333
  set extremes(t) {
1314
1334
  this._extremes = t;
@@ -1347,7 +1367,7 @@ const _s = class _s {
1347
1367
  add_nodes(t) {
1348
1368
  let e = this;
1349
1369
  t.forEach((s) => {
1350
- s.label = new B(s.ID, s), e.labels.set(s.label.ID, s.label), e.nodes.set(s.ID, s);
1370
+ s.label = new H(s.ID, s), e.labels.set(s.label.ID, s.label), e.nodes.set(s.ID, s);
1351
1371
  const i = e.layers.search("layers", "nodes");
1352
1372
  i && i.objects.push(s);
1353
1373
  }), e.update_extremes();
@@ -1372,14 +1392,14 @@ const _s = class _s {
1372
1392
  this.layers.search("layers", "nodes")
1373
1393
  ].filter((s) => s !== void 0);
1374
1394
  if (e.length === 0)
1375
- this.extremes = new Pt(1, 1);
1395
+ this.extremes = new Rt(1, 1);
1376
1396
  else {
1377
1397
  let s = 1 / 0, i = -1 / 0, n = 1 / 0, r = -1 / 0;
1378
1398
  e.forEach((g) => g.objects.forEach((c) => {
1379
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));
1380
1400
  }));
1381
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;
1382
- this.extremes = new Pt(_, _, h, o);
1402
+ this.extremes = new Rt(_, _, h, o);
1383
1403
  }
1384
1404
  }
1385
1405
  /** Farthest node from (cx, cy), on either axis */
@@ -1419,7 +1439,7 @@ u(De, "DrawableElement"), De.style = `
1419
1439
  justify-content: center;
1420
1440
  }
1421
1441
  `;
1422
- let Ae = De;
1442
+ let ve = De;
1423
1443
  const hi = 1e-8;
1424
1444
  function Us(d, t = hi) {
1425
1445
  return d.filter((e) => Math.abs(e.x) > t || Math.abs(e.y) > t);
@@ -1493,20 +1513,20 @@ function Gs(d, t, e) {
1493
1513
  return Ze(n, Je(i, t));
1494
1514
  }
1495
1515
  u(Gs, "fitCoeffs");
1496
- function ve(d, t) {
1516
+ function Se(d, t) {
1497
1517
  let e = 0, s = 1;
1498
1518
  for (let i = 0; i < d.length; i++)
1499
1519
  e += d[i] * s, s *= t;
1500
1520
  return e;
1501
1521
  }
1502
- u(ve, "evalPoly");
1522
+ u(Se, "evalPoly");
1503
1523
  function ci(d, t, e, s) {
1504
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));
1505
1525
  let l = 0;
1506
1526
  for (let _ = 0; _ < d.length; _++) {
1507
1527
  const g = 1 - a[_];
1508
1528
  if (g <= 0) return 1 / 0;
1509
- const c = t[_] - ve(h, d[_]), E = e[_] - ve(o, d[_]);
1529
+ const c = t[_] - Se(h, d[_]), E = e[_] - Se(o, d[_]);
1510
1530
  l += (c / g) ** 2 + (E / g) ** 2;
1511
1531
  }
1512
1532
  return l;
@@ -1538,14 +1558,14 @@ function Bs(d, t = 100) {
1538
1558
  const e = [];
1539
1559
  for (let s = 0; s <= t; s++) {
1540
1560
  const i = s / t;
1541
- e.push({ x: ve(d.coeffsX, i), y: ve(d.coeffsY, i) });
1561
+ e.push({ x: Se(d.coeffsX, i), y: Se(d.coeffsY, i) });
1542
1562
  }
1543
1563
  return e;
1544
1564
  }
1545
1565
  u(Bs, "sampleCurve");
1546
- const Hs = 100, us = class us extends It {
1566
+ const Hs = 100, us = class us extends kt {
1547
1567
  constructor(t = {}) {
1548
- const e = t.color instanceof et ? t.color : new et(typeof t.color == "string" ? t.color : "#000000");
1568
+ const e = t.color instanceof st ? t.color : new st(typeof t.color == "string" ? t.color : "#000000");
1549
1569
  super([], {
1550
1570
  ID: t.ID || `traj-${Math.random().toString(36).substring(2, 9)}`,
1551
1571
  size: t.size || 1,
@@ -1590,8 +1610,8 @@ const Hs = 100, us = class us extends It {
1590
1610
  }
1591
1611
  };
1592
1612
  u(us, "Trajectory");
1593
- let Se = us;
1594
- const ti = 1, ds = class ds extends Ht {
1613
+ let Ee = us;
1614
+ const ti = 1, ds = class ds extends Xt {
1595
1615
  constructor(t, e, s, i = 0) {
1596
1616
  super(t, e, s), this._totalweight = 0, this._weight = i;
1597
1617
  }
@@ -1599,8 +1619,8 @@ const ti = 1, ds = class ds extends Ht {
1599
1619
  return this._color;
1600
1620
  }
1601
1621
  get color() {
1602
- const t = this._color || new et("#000000");
1603
- return new xe(t, Math.abs(this.weight));
1622
+ const t = this._color || new st("#000000");
1623
+ return new we(t, Math.abs(this.weight));
1604
1624
  }
1605
1625
  set color(t) {
1606
1626
  this._color = t;
@@ -1622,75 +1642,75 @@ const ti = 1, ds = class ds extends Ht {
1622
1642
  }
1623
1643
  };
1624
1644
  u(ds, "Edge");
1625
- let Ee = ds;
1626
- var Ut;
1627
- const gs = class gs extends It {
1645
+ let Me = ds;
1646
+ var Gt;
1647
+ const gs = class gs extends kt {
1628
1648
  constructor(e) {
1629
1649
  super(e.dimensions || [], e);
1630
- tt(this, Ut);
1631
- G(this, Ut, e);
1650
+ et(this, Gt);
1651
+ B(this, Gt, e);
1632
1652
  }
1633
1653
  get edge() {
1634
- return k(this, Ut);
1654
+ return k(this, Gt);
1635
1655
  }
1636
1656
  get path() {
1637
- const e = k(this, Ut), 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]);
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]);
1638
1658
  if (!(a > 0) || !(h > 0)) return "";
1639
- 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((q) => h / 2 * Math.max(0, 1 - q / a), "halfW"), c = /* @__PURE__ */ u((q, S) => `${s[0] + o[0] * q + _[0] * S} ${s[1] + o[1] * q + _[1] * S}`, "at"), E = 0.2 * a, f = Math.min(0.15 * a, 0.8 * 2 * g(E)), v = E + f / 2, P = E + f;
1640
- return `M${c(E, 0)} L${c(v, g(v))} L${c(P, g(P))} L${c(v, 0)} L${c(P, -g(P))} L${c(v, -g(v))}z`;
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`;
1641
1661
  }
1642
1662
  };
1643
- Ut = new WeakMap(), u(gs, "EdgeArrow");
1644
- let Me = gs;
1645
- var Gt, ue;
1646
- const Te = class Te extends Ee {
1663
+ Gt = new WeakMap(), u(gs, "EdgeArrow");
1664
+ let Ie = gs;
1665
+ var Bt, de;
1666
+ const Te = class Te extends Me {
1647
1667
  constructor(e, s, i) {
1648
1668
  super(e, s, i);
1649
- tt(this, Gt);
1650
- tt(this, ue);
1651
- this._path = "", G(this, Gt, !1), this._directions = [
1669
+ et(this, Bt);
1670
+ et(this, de);
1671
+ this._path = "", B(this, Bt, !1), this._directions = [
1652
1672
  "from",
1653
1673
  "to"
1654
1674
  /* TO */
1655
- ], this.towards = "to", k(this, Gt) === !0 && G(this, ue, new Me(this));
1675
+ ], this.towards = "to", k(this, Bt) === !0 && B(this, de, new Ie(this));
1656
1676
  }
1657
1677
  get path() {
1658
1678
  return `M${this.from.x} ${this.from.y} L${this.base_pts[0].join(" ")} L${this.base_pts[1].join(" ")}z`;
1659
1679
  }
1660
1680
  static calculate_base_points(e) {
1661
- const s = e.towards, i = e._directions.find((v) => v !== 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;
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;
1662
1682
  if (_ === 0 || !isFinite(g) || g === 0)
1663
1683
  return [[a, h], [a, h]];
1664
- const c = -l / _, E = o / _, f = g / 2;
1684
+ const c = -l / _, E = o / _, m = g / 2;
1665
1685
  return [
1666
- [a + c * f, h + E * f],
1667
- [a - c * f, h - E * f]
1686
+ [a + c * m, h + E * m],
1687
+ [a - c * m, h - E * m]
1668
1688
  ];
1669
1689
  }
1670
1690
  get base_pts() {
1671
1691
  return Te.calculate_base_points(this);
1672
1692
  }
1673
1693
  get arrow() {
1674
- return k(this, ue);
1694
+ return k(this, de);
1675
1695
  }
1676
1696
  get with_arrow() {
1677
- return k(this, Gt);
1697
+ return k(this, Bt);
1678
1698
  }
1679
1699
  get from_point() {
1680
1700
  return [this.from.x, this.from.y];
1681
1701
  }
1682
1702
  };
1683
- Gt = new WeakMap(), ue = new WeakMap(), u(Te, "TaperedEdge");
1684
- let Xt = Te;
1685
- const ze = class ze extends Xt {
1703
+ Bt = new WeakMap(), de = new WeakMap(), u(Te, "TaperedEdge");
1704
+ let Wt = Te;
1705
+ const ze = class ze extends Wt {
1686
1706
  constructor(t, e, s) {
1687
1707
  super(t, e, s), this._dataWeight = 0, this._totalweight = t.totalweight ?? 0, this._dataWeight = t.weight ?? this._weight;
1688
1708
  }
1689
1709
  get weighted_midpoint() {
1690
- return se.Geometry.Line.interpolate(this.line)(1 - this._dataWeight / this._totalweight);
1710
+ return ie.Geometry.Line.interpolate(this.line)(1 - this._dataWeight / this._totalweight);
1691
1711
  }
1692
1712
  get base_pts() {
1693
- return Xt.calculate_base_points(this);
1713
+ return Wt.calculate_base_points(this);
1694
1714
  }
1695
1715
  static build_path(t) {
1696
1716
  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"), "");
@@ -1704,7 +1724,7 @@ const ze = class ze extends Xt {
1704
1724
  };
1705
1725
  u(ze, "TaperedWeightedMidpointEdge");
1706
1726
  let Qe = ze;
1707
- const Fe = class Fe extends Ee {
1727
+ const Fe = class Fe extends Me {
1708
1728
  constructor(t, e, s) {
1709
1729
  super(t, e, s);
1710
1730
  }
@@ -1718,9 +1738,9 @@ const Fe = class Fe extends Ee {
1718
1738
  }
1719
1739
  };
1720
1740
  u(Fe, "NodeEdge");
1721
- let ie = Fe;
1722
- const ms = class ms {
1723
- constructor(t, e, s, i = new Nt()) {
1741
+ let ne = Fe;
1742
+ const fs = class fs {
1743
+ constructor(t, e, s, i = new Ct()) {
1724
1744
  this.__data__ = t, this.parent = e, this.graph = s, this.__children__ = i, this.svg_element = this.create();
1725
1745
  }
1726
1746
  get_size() {
@@ -1743,9 +1763,9 @@ const ms = class ms {
1743
1763
  u(a, "animate"), requestAnimationFrame(a);
1744
1764
  }
1745
1765
  };
1746
- u(ms, "Drawable");
1747
- let ne = ms;
1748
- const di = 0.04, gi = [0.25, 1], mi = [0.3, 1];
1766
+ u(fs, "Drawable");
1767
+ let re = fs;
1768
+ const di = 0.04, gi = [0.25, 1], fi = [0.3, 1];
1749
1769
  function Xs(d, t, e, s) {
1750
1770
  const i = Math.abs(d);
1751
1771
  if (!(i > 0)) return 0;
@@ -1754,7 +1774,7 @@ function Xs(d, t, e, s) {
1754
1774
  return s[0] + n * (s[1] - s[0]);
1755
1775
  }
1756
1776
  u(Xs, "rampFor");
1757
- const fi = 0.011, pi = 0.75, bi = 0.8, yi = 0.75, ei = 6e-3, xi = 0.6;
1777
+ const mi = 0.011, pi = 0.75, bi = 0.8, yi = 0.75, ei = 6e-3, xi = 0.6;
1758
1778
  function wi(d) {
1759
1779
  return 2 * d;
1760
1780
  }
@@ -1777,8 +1797,8 @@ function Si(d, t) {
1777
1797
  return `rgba(${Math.round(s * t)},${Math.round(i * t)},${Math.round(n * t)},${r})`;
1778
1798
  }
1779
1799
  u(Si, "darkenRgba");
1780
- const fs = class fs extends ne {
1781
- constructor(t, e, s, i = new Nt()) {
1800
+ const ms = class ms extends re {
1801
+ constructor(t, e, s, i = new Ct()) {
1782
1802
  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();
1783
1803
  }
1784
1804
  /** Stamp edge identity onto an element so <qe-graph> delegation can resolve
@@ -1788,11 +1808,11 @@ const fs = class fs extends ne {
1788
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)));
1789
1809
  }
1790
1810
  create() {
1791
- if (this.__data__ instanceof ie) {
1811
+ if (this.__data__ instanceof ne) {
1792
1812
  const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
1793
1813
  return e.setAttribute("fill", this.__data__.color.toString()), e.setAttribute("stroke", "none"), this.svg_element = e, e;
1794
1814
  }
1795
- if (this.__data__ instanceof Xt) {
1815
+ if (this.__data__ instanceof Wt) {
1796
1816
  const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
1797
1817
  return e.setAttribute("fill", this.__data__.color.toString()), e.setAttribute("stroke", "none"), this.svg_element = e, e;
1798
1818
  }
@@ -1805,19 +1825,19 @@ const fs = class fs extends ne {
1805
1825
  const t = ((s = this.graph.__data__.extremes) == null ? void 0 : s.x_max) ?? 1, e = this.__data__.meta ?? {};
1806
1826
  if (e.isMeanEdge) {
1807
1827
  this._stampEdge(this.svg_element);
1808
- 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 * fi * (i / (n || 1)), o = this.__data__._color || new et("#000000"), l = typeof e.saturation == "number" ? e.saturation : r, _ = new xe(o, l, r).toString();
1809
- if (this.__data__ instanceof ie)
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)
1810
1830
  this.__data__.weight = h, this.svg_element.setAttribute("d", this.__data__.path), this.svg_element.setAttribute("fill", _), this.svg_element.setAttribute("stroke", "none");
1811
- else if (this.__data__ instanceof Xt) {
1831
+ else if (this.__data__ instanceof Wt) {
1812
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)
1813
1833
  try {
1814
- const c = new Me(this.__data__).path;
1834
+ const c = new Ie(this.__data__).path;
1815
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"));
1816
1836
  } catch {
1817
1837
  }
1818
1838
  } else {
1819
- const g = this.__data__.from.x, c = this.__data__.from.y, E = this.__data__.to.x, f = this.__data__.to.y;
1820
- 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", f.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", f.toString()), this._hit_el.setAttribute("stroke-width", Math.max(h, t * 0.03).toString()), this._stampEdge(this._hit_el);
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);
1821
1841
  }
1822
1842
  } else {
1823
1843
  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());
@@ -1830,10 +1850,10 @@ const fs = class fs extends ne {
1830
1850
  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));
1831
1851
  }
1832
1852
  };
1833
- u(fs, "QELine");
1834
- let At = fs;
1835
- const ps = class ps extends ne {
1836
- constructor(t, e, s, i = new Nt()) {
1853
+ u(ms, "QELine");
1854
+ let St = ms;
1855
+ const ps = class ps extends re {
1856
+ constructor(t, e, s, i = new Ct()) {
1837
1857
  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();
1838
1858
  }
1839
1859
  get x() {
@@ -1924,9 +1944,9 @@ const ps = class ps extends ne {
1924
1944
  }
1925
1945
  };
1926
1946
  u(ps, "QEPoint");
1927
- let re = ps;
1928
- const bs = class bs extends ne {
1929
- constructor(t, e, s, i = new Nt()) {
1947
+ let oe = ps;
1948
+ const bs = class bs extends re {
1949
+ constructor(t, e, s, i = new Ct()) {
1930
1950
  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();
1931
1951
  }
1932
1952
  // Trajectory styling is specified in display pixels, while SVG paths use
@@ -1957,8 +1977,8 @@ const bs = class bs extends ne {
1957
1977
  if (this._segments_group.innerHTML = "", this.__data__.lineStyle === "tapered") {
1958
1978
  const s = this.__data__.pathPoints, i = s.length - 1, [n, r] = this.__data__.strokeWidthRange, [a, h] = this.__data__.opacityRange;
1959
1979
  for (let o = 0; o < i; o++) {
1960
- const l = s[o], _ = s[o + 1], g = i <= 1 ? 1 : o / (i - 1), c = n + (r - n) * g, E = a + (h - a) * g, f = document.createElementNS("http://www.w3.org/2000/svg", "path");
1961
- f.setAttribute("d", `M${l.x},${l.y} L${_.x},${_.y}`), f.setAttribute("fill", "none"), f.setAttribute("stroke", this.__data__.color.toString()), f.setAttribute("stroke-linecap", "round"), f.setAttribute("stroke-linejoin", "round"), f.setAttribute("stroke-width", this.graphUnitsForPixels(c).toString()), f.setAttribute("opacity", E.toString()), this._segments_group.appendChild(f);
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);
1962
1982
  }
1963
1983
  this._segments_group.style.display = "block";
1964
1984
  } else
@@ -1980,8 +2000,8 @@ const bs = class bs extends ne {
1980
2000
  }
1981
2001
  };
1982
2002
  u(bs, "QETrajectory");
1983
- let Ie = bs;
1984
- const { ArrayTools: Ws } = se, ys = class ys extends Array {
2003
+ let Ne = bs;
2004
+ const { ArrayTools: Ws } = ie, ys = class ys extends Array {
1985
2005
  constructor(...t) {
1986
2006
  super(...t);
1987
2007
  }
@@ -2014,19 +2034,19 @@ const { ArrayTools: Ws } = se, ys = class ys extends Array {
2014
2034
  }
2015
2035
  };
2016
2036
  u(ys, "QEArray");
2017
- let Nt = ys;
2037
+ let Ct = ys;
2018
2038
  const Ei = {
2019
- AxisPoint: re,
2020
- AxisLine: At,
2021
- Point: re,
2022
- Line: At,
2023
- Edge: At,
2024
- TaperedEdge: At,
2025
- TaperedWeightedMidpointEdge: At,
2026
- NodeEdge: At,
2027
- Trajectory: Ie
2028
- }, Ft = class Ft {
2029
- constructor(t, e, s, i = new Nt()) {
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()) {
2030
2050
  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 }) => {
2031
2051
  const h = /* @__PURE__ */ u((g) => {
2032
2052
  var c;
@@ -2041,9 +2061,9 @@ const Ei = {
2041
2061
  ).forEach((g) => {
2042
2062
  const c = g._typeName || g.constructor.name;
2043
2063
  let E = Ei[c];
2044
- E || (g instanceof Se ? E = Ie : g instanceof J ? E = re : E = At);
2045
- const f = new E(g, this.svg_element, this.graph);
2046
- this.__children__.push(f);
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);
2047
2067
  }), l.forEach((g) => {
2048
2068
  const c = r.objects.get(h(g));
2049
2069
  c && (g.__data__ = c), g.update();
@@ -2061,8 +2081,8 @@ const Ei = {
2061
2081
  if (!this.__data__)
2062
2082
  throw new Error("Layer is null");
2063
2083
  let t = this.__data__;
2064
- return this.svg_element = document.createElementNS("http://www.w3.org/2000/svg", Ft.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) => {
2065
- const s = new Ft(e, this.svg_element, this.graph);
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);
2066
2086
  this.__children__.push(s);
2067
2087
  }), this.svg_element;
2068
2088
  }
@@ -2083,11 +2103,11 @@ const Ei = {
2083
2103
  this.__children__.push(t);
2084
2104
  }
2085
2105
  };
2086
- u(Ft, "QELayer"), Ft.tagName = "g";
2087
- let ts = Ft;
2106
+ u(jt, "QELayer"), jt.tagName = "g";
2107
+ let ts = jt;
2088
2108
  const xs = class xs {
2089
- constructor(t, e, s, i, n = B.DISPLAY_TYPES.ON, r = B.POSITION.OBJECT, a, h) {
2090
- 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 === B.DISPLAY_TYPES.ON ? (this._visible = !0, this.svg_element.setAttribute("display", "block")) : (this._visible = !1, this.svg_element.setAttribute("display", "none"));
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"));
2091
2111
  }
2092
2112
  _create() {
2093
2113
  const t = document.createElementNS("http://www.w3.org/2000/svg", "text");
@@ -2131,22 +2151,22 @@ const xs = class xs {
2131
2151
  const e = this.graph._labelFont ?? {}, s = e.size ? e.size * this.graph.unitsPerPixel() : t * 0.06, i = s * 1.2;
2132
2152
  let n, r, a;
2133
2153
  switch (this.position) {
2134
- case B.POSITION.STATIC: {
2154
+ case H.POSITION.STATIC: {
2135
2155
  n = this.point.x, r = this.point.y - i * 0.3, a = "middle";
2136
2156
  break;
2137
2157
  }
2138
- case B.POSITION.CONTAINER: {
2158
+ case H.POSITION.CONTAINER: {
2139
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;
2140
2160
  n = o + _ * E, r = l + g * E - i * 0.3, a = _ >= 0 ? "start" : "end";
2141
2161
  break;
2142
2162
  }
2143
- case B.POSITION.CUSTOM:
2163
+ case H.POSITION.CUSTOM:
2144
2164
  if (this.customX != null && this.customY != null) {
2145
2165
  n = this.customX, r = this.customY, a = "start";
2146
2166
  break;
2147
2167
  }
2148
2168
  default:
2149
- case B.POSITION.OBJECT: {
2169
+ case H.POSITION.OBJECT: {
2150
2170
  const o = this.point.x >= 0 ? i : -i;
2151
2171
  a = this.point.x >= 0 ? "start" : "end", n = this.point.x + o, r = this.point.y - i * 0.4;
2152
2172
  break;
@@ -2172,37 +2192,37 @@ const xs = class xs {
2172
2192
  }
2173
2193
  };
2174
2194
  u(xs, "QELabel");
2175
- let Kt = xs;
2195
+ let Jt = xs;
2176
2196
  const je = class je extends HTMLElement {
2177
2197
  };
2178
2198
  u(je, "QENodesElement"), je.tagName = "qe-nodes";
2179
- let Ne = je;
2199
+ let ke = je;
2180
2200
  const Ye = class Ye extends HTMLElement {
2181
2201
  };
2182
2202
  u(Ye, "QEMeansElement"), Ye.tagName = "qe-means";
2183
- let ke = Ye;
2203
+ let Ce = Ye;
2184
2204
  const qe = class qe extends HTMLElement {
2185
2205
  };
2186
2206
  u(qe, "QEPointsElement"), qe.tagName = "qe-points";
2187
- let Ce = qe;
2207
+ let Oe = qe;
2188
2208
  const Ue = class Ue extends HTMLElement {
2189
2209
  };
2190
2210
  u(Ue, "QEEdgesElement"), Ue.tagName = "qe-edges";
2191
- let Oe = Ue;
2211
+ let $e = Ue;
2192
2212
  const Ge = class Ge extends HTMLElement {
2193
2213
  };
2194
2214
  u(Ge, "QETrajectoriesElement"), Ge.tagName = "qe-trajectories";
2195
- let $e = Ge;
2215
+ let Pe = Ge;
2196
2216
  const Be = class Be extends HTMLElement {
2197
2217
  };
2198
2218
  u(Be, "QEAxesElement"), Be.tagName = "qe-axes";
2199
- let Pe = Be;
2200
- customElements.define(Ne.tagName, Ne);
2219
+ let Re = Be;
2201
2220
  customElements.define(ke.tagName, ke);
2202
2221
  customElements.define(Ce.tagName, Ce);
2203
2222
  customElements.define(Oe.tagName, Oe);
2204
2223
  customElements.define($e.tagName, $e);
2205
2224
  customElements.define(Pe.tagName, Pe);
2225
+ customElements.define(Re.tagName, Re);
2206
2226
  const Vs = [
2207
2227
  "#4477AA",
2208
2228
  "#EE6677",
@@ -2230,13 +2250,13 @@ function Ii(d, t, e, s) {
2230
2250
  }
2231
2251
  u(Ii, "computeCIRect");
2232
2252
  const Ni = 0.5;
2233
- function fe(d, t, e) {
2253
+ function pe(d, t, e) {
2234
2254
  if (!d) return;
2235
2255
  const s = Math.min(Math.abs(t), Math.abs(e));
2236
2256
  s > 0 && (d.meta = { ...d.meta ?? {}, maxRadius: s * Ni });
2237
2257
  }
2238
- u(fe, "capMeanToInterval");
2239
- function pe(d, t, e, s = "") {
2258
+ u(pe, "capMeanToInterval");
2259
+ function be(d, t, e, s = "") {
2240
2260
  const i = /* @__PURE__ */ u((o) => {
2241
2261
  const l = d.names.indexOf(o), _ = l >= 0 ? d[l] : null;
2242
2262
  if (_ == null || _ === "") return;
@@ -2245,7 +2265,7 @@ function pe(d, t, e, s = "") {
2245
2265
  }, "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`);
2246
2266
  return n == null || r == null || a == null || h == null ? null : { x_low: n, x_high: r, y_low: a, y_high: h };
2247
2267
  }
2248
- u(pe, "readIntervalBounds");
2268
+ u(be, "readIntervalBounds");
2249
2269
  function ki(d) {
2250
2270
  var i, n;
2251
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)) ?? [];
@@ -2262,7 +2282,7 @@ function ki(d) {
2262
2282
  }
2263
2283
  u(ki, "parseEdgeLayer");
2264
2284
  function Ci(d) {
2265
- const { r: t, g: e, b: s } = et.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");
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");
2266
2286
  return `#${r(t)}${r(e)}${r(s)}`;
2267
2287
  }
2268
2288
  u(Ci, "complementColor");
@@ -2286,9 +2306,9 @@ function He(d, t) {
2286
2306
  }
2287
2307
  }
2288
2308
  u(He, "parseLabelMode");
2289
- const ut = class ut extends Ae {
2309
+ const gt = class gt extends ve {
2290
2310
  constructor() {
2291
- super(), this.zoom_level = 1, this.__children__ = new Nt(), 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) => {
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) => {
2292
2312
  var vs, Ss, Es, Ms, Is, Ns, ks, Cs, Os, $s, Ps, Rs, Ls, Ds, Ts;
2293
2313
  const e = ((vs = t.composedPath) == null ? void 0 : vs.call(t)[0]) ?? t.target;
2294
2314
  if (this._vizena && e !== this._vizena) return;
@@ -2302,224 +2322,224 @@ const ut = class ut extends Ae {
2302
2322
  const l = {}, _ = (Ss = s.palette) != null && Ss.length ? s.palette : Vs;
2303
2323
  if (h && ((Es = s.points) != null && Es.names)) {
2304
2324
  const C = s.points.col(h);
2305
- C && [...new Set([...C].map(String))].forEach((O, x) => {
2306
- l[O] = _[x % _.length];
2325
+ C && [...new Set([...C].map(String))].forEach(($, y) => {
2326
+ l[$] = _[y % _.length];
2307
2327
  });
2308
2328
  }
2309
2329
  (Ms = s.groups) != null && Ms.rows && s.groups.rows().length > 0 && s.groups.rows().forEach((C) => {
2310
- const I = C.rowName ?? String(C[0]), O = C.names.indexOf("color"), x = O >= 0 ? C[O] : null;
2311
- x && String(x) !== "NA" ? l[I] = String(x) : l[I] || (l[I] = _[Object.keys(l).length % _.length]);
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]);
2312
2332
  });
2313
2333
  const g = Object.keys(l), c = o.activeMeanGroups && o.activeMeanGroups.trim() ? new Set(
2314
2334
  o.activeMeanGroups.split(",").map((C) => C.trim()).filter((C) => l[C])
2315
2335
  // silently drop names not in model
2316
- ) : new Set(g), E = o.scalePoints, f = /* @__PURE__ */ u((C) => {
2336
+ ) : new Set(g), E = o.scalePoints, m = /* @__PURE__ */ u((C) => {
2317
2337
  let I = 0;
2318
- return C.forEach((O) => {
2319
- const x = O.names.indexOf(n[0]), m = n.length > 1 ? O.names.indexOf(n[1]) : -1;
2320
- x >= 0 && (I = Math.max(I, Math.abs(Number(O[x])))), m >= 0 && (I = Math.max(I, Math.abs(Number(O[m]))));
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]))));
2321
2341
  }), I;
2322
- }, "getExtent"), v = (Is = s.nodes) != null && Is.rows ? f(s.nodes.rows()) : 0, P = (Ns = s.points) != null && Ns.rows ? f(s.points.rows()) : 0, Y = (ks = s.trajectories) != null && ks.rows ? f(s.trajectories.rows()) : 0, q = P > 0 ? P : Y, S = o.pointScale !== null ? o.pointScale : E && q > 0 && v > 0 ? v / q : 1;
2323
- this._rangeExtent = o.range === "network" ? v * 1.2 : o.range === "points" ? q * S * 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;
2324
- const j = o.labelNodes, nt = o.labelMeans, rt = o.labelPoints, st = this._labelsGroup, lt = /* @__PURE__ */ u((C, I, O, x = 1) => {
2325
- const m = C.names.indexOf(I), $ = C.names.indexOf(n[0]), b = n.length > 1 ? C.names.indexOf(n[1]) : -1, y = new J({
2326
- ID: m >= 0 ? String(C[m]) : C.rowName || `pt-${Math.random().toString(36).slice(2)}`,
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)}`,
2327
2347
  dimensions: [
2328
- $ >= 0 ? Number(C[$]) * x : 0,
2329
- b >= 0 ? -Number(C[b]) * x : 0
2348
+ A >= 0 ? Number(C[A]) * y : 0,
2349
+ O >= 0 ? -Number(C[O]) * y : 0
2330
2350
  // negate Y: SVG y-down vs ENA y-up
2331
2351
  ],
2332
2352
  meta: {}
2333
2353
  });
2334
- return O && (y.color = new et(O)), y;
2335
- }, "rowToPoint"), W = {}, Et = o.showPoints, kt = s.pointsets;
2336
- if (o.pointSets.length && (kt != null && kt.rows)) {
2337
- const C = this.__children__.search("__children__", "points"), I = /* @__PURE__ */ u((O, x) => {
2338
- const m = O.names.indexOf(x);
2339
- return m >= 0 ? O[m] : null;
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;
2340
2360
  }, "col");
2341
- o.pointSets.forEach((O, x) => {
2342
- kt.rows().forEach((m) => {
2343
- if (String(I(m, "set")) !== O.set) return;
2344
- const $ = String(I(m, "id")), b = I(m, "group") != null && String(I(m, "group")) !== "NA" ? String(I(m, "group")) : null, y = I(m, "color") && String(I(m, "color")) !== "NA" ? String(I(m, "color")) : b && l[b] ? l[b] : _[x % _.length], M = lt(m, "id", y, S);
2345
- M.ID = `${O.set}::${$}`, M.size = O.size ?? o.pointSize ?? 2.5;
2346
- const F = I(m, "shape");
2347
- F && String(F) !== "NA" && (M.shape = String(F));
2348
- const R = I(m, "label");
2349
- M.meta = {
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 = {
2350
2370
  stroke: "#ffffff",
2351
2371
  kind: "point",
2352
- name: R != null && String(R) !== "NA" ? String(R) : $,
2353
- group: b ?? void 0,
2354
- unit: $,
2355
- set: O.set,
2356
- fixedSize: O.fixedSize
2357
- }, this.__data__.points.set(M.ID, M), C == null || C.__data__.objects.set(M.ID, M);
2372
+ name: q != null && String(q) !== "NA" ? String(q) : A,
2373
+ 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);
2358
2378
  });
2359
2379
  });
2360
2380
  }
2361
2381
  if ((Cs = s.points) != null && Cs.rows) {
2362
2382
  const C = this.__children__.search("__children__", "points");
2363
2383
  if (C) {
2364
- s.points.rows().forEach((x) => {
2365
- const m = h ? x.names.indexOf(h) : -1, $ = m >= 0 ? String(x[m]) : null, b = $ ? l[$] ?? "#888888" : "#888888";
2366
- if (Et) {
2367
- const y = lt(x, r, b, S);
2368
- y.size = o.pointSize ?? 2.5, y.meta = {
2369
- ...y.meta ?? {},
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 ?? {},
2370
2390
  stroke: "#ffffff",
2371
2391
  kind: "point",
2372
- name: y.ID,
2373
- group: $ ?? void 0,
2374
- unit: y.ID,
2392
+ name: p.ID,
2393
+ group: A ?? void 0,
2394
+ unit: p.ID,
2375
2395
  fixedSize: o.pointFixedSize
2376
- }, this.__data__.points.set(y.ID, y), C.__data__.objects.set(y.ID, y);
2396
+ }, this.__data__.points.set(p.ID, p), C.__data__.objects.set(p.ID, p);
2377
2397
  }
2378
- if ($) {
2379
- const y = x.names.indexOf(n[0]), M = n.length > 1 ? x.names.indexOf(n[1]) : -1;
2380
- W[$] || (W[$] = { x: 0, y: 0, x2: 0, y2: 0, xy: 0, n: 0, color: b });
2381
- const F = y >= 0 ? Number(x[y]) : 0, R = M >= 0 ? Number(x[M]) : 0;
2382
- W[$].x += F, W[$].y += R, W[$].x2 += F * F, W[$].y2 += R * R, W[$].xy += F * R, W[$].n += 1;
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;
2383
2403
  }
2384
2404
  });
2385
- const I = !!((Os = s.groups) != null && Os.rows && s.groups.rows().length > 0), O = o.showMeans && I ? s.groups.rows().filter((x) => {
2386
- const m = x.rowName ?? String(x[0]);
2387
- return c.size === 0 || c.has(m);
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);
2388
2408
  }) : [];
2389
2409
  if (o.showMeans) {
2390
- const x = C.svg_element, m = (v > 0 ? v : 1) * 8e-3;
2410
+ const y = C.svg_element, b = this._rangeExtent ? this._rangeExtent / 1.2 : S, A = (b > 0 ? b : 1) * 8e-3;
2391
2411
  if (I) {
2392
- const $ = new Set(O.map((b) => b.rowName ?? String(b[0])));
2393
- this._ciRects.forEach((b, y) => {
2394
- $.has(y) || (b.remove(), this._ciRects.delete(y));
2395
- }), this._outlierRects.forEach((b, y) => {
2396
- $.has(y) || (b.remove(), this._outlierRects.delete(y));
2397
- }), this._ciCross.forEach((b, y) => {
2398
- $.has(y.slice(2)) || (b.remove(), this._ciCross.delete(y));
2399
- }), O.forEach((b) => {
2400
- var w, N, T;
2401
- const y = b.rowName ?? String(b[0]), M = l[y] ?? "#888888", F = b.names.indexOf(n[0]), R = n.length > 1 ? b.names.indexOf(n[1]) : -1, H = F >= 0 ? Number(b[F]) * S : 0, dt = R >= 0 ? -Number(b[R]) * S : 0, Z = new J({
2402
- ID: `mean-${y}`,
2403
- dimensions: [H, dt],
2404
- meta: { kind: "mean", name: y, group: y, fixedSize: o.meanFixedSize }
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 }
2405
2425
  });
2406
- Z.color = new et(M), Z.size = 4;
2407
- const _t = b.names.indexOf("shape"), L = _t >= 0 ? b[_t] : null;
2426
+ Z.color = new st(P), Z.size = 4;
2427
+ const at = p.names.indexOf("shape"), L = at >= 0 ? p[at] : null;
2408
2428
  Z.shape = L && String(L) !== "NA" ? String(L) : "rect", this.__data__.points.set(Z.ID, Z), C.__data__.objects.set(Z.ID, Z);
2409
- const Ct = /* @__PURE__ */ u((A) => {
2410
- const z = b.names.indexOf(A), V = z >= 0 ? b[z] : null;
2411
- return V == null || String(V) === "NA" || String(V) === "" ? null : V;
2412
- }, "cell"), yt = Ct("intervals"), wt = yt === "box" || yt === "crosshairs" || yt === "none" ? yt : o.intervals, Ot = Ct("outlier"), U = (Ot == null ? o.showOutlier : Ot === !0 || String(Ot) === "true") ? pe(b, n[0], n[1], "o") : null;
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;
2413
2433
  if (!U)
2414
- (w = this._outlierRects.get(y)) == null || w.remove(), this._outlierRects.delete(y);
2434
+ (N = this._outlierRects.get(w)) == null || N.remove(), this._outlierRects.delete(w);
2415
2435
  else {
2416
- let A = this._outlierRects.get(y);
2417
- A || (A = document.createElementNS("http://www.w3.org/2000/svg", "rect"), A.setAttribute("data-outlier-group", y), this._outlierRects.set(y, A)), A.setAttribute("x", (U.x_low * S).toString()), A.setAttribute("y", (-U.y_high * S).toString()), A.setAttribute("width", ((U.x_high - U.x_low) * S).toString()), A.setAttribute("height", ((U.y_high - U.y_low) * S).toString()), A.setAttribute("fill", "none"), A.setAttribute("stroke", M), A.setAttribute("stroke-width", m.toString()), A.setAttribute("stroke-opacity", "0.5"), A.setAttribute("stroke-dasharray", `${m * 2} ${m * 2}`), x && !A.parentElement && x.insertBefore(A, x.firstChild);
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);
2418
2438
  }
2419
- const it = wt !== "none" ? pe(b, n[0], n[1]) : null, p = `x:${y}`;
2420
- if ((!it || wt !== "crosshairs") && ((N = this._ciCross.get(p)) == null || N.remove(), this._ciCross.delete(p)), it && wt === "crosshairs") {
2421
- (T = this._ciRects.get(y)) == null || T.remove(), this._ciRects.delete(y);
2422
- const A = it.x_low * S, z = it.x_high * S, V = -it.y_high * S, K = -it.y_low * S;
2423
- fe(Z, (z - A) / 2, (K - V) / 2);
2424
- let D = this._ciCross.get(p);
2425
- D || (D = document.createElementNS("http://www.w3.org/2000/svg", "path"), D.setAttribute("data-ci-group", y), D.setAttribute("data-ci-kind", "crosshairs"), this._ciCross.set(p, D)), D.setAttribute("d", `M${A} ${dt} L${z} ${dt} M${H} ${V} L${H} ${K}`), D.setAttribute("fill", "none"), D.setAttribute("stroke", M), D.setAttribute("stroke-width", (m * 1.25).toString()), D.setAttribute("stroke-opacity", "0.8"), x && !D.parentElement && x.insertBefore(D, x.firstChild);
2426
- } else if (it) {
2427
- const A = it.x_low * S, z = -it.y_high * S, V = (it.x_high - it.x_low) * S, K = (it.y_high - it.y_low) * S;
2428
- fe(Z, V / 2, K / 2);
2429
- let D = this._ciRects.get(y);
2430
- D || (D = document.createElementNS("http://www.w3.org/2000/svg", "rect"), D.setAttribute("data-ci-group", y), this._ciRects.set(y, D)), D.setAttribute("x", A.toString()), D.setAttribute("y", z.toString()), D.setAttribute("width", V.toString()), D.setAttribute("height", K.toString()), D.setAttribute("fill", "none"), D.setAttribute("stroke", M), D.setAttribute("stroke-width", m.toString()), D.setAttribute("stroke-opacity", "0.8"), D.setAttribute("stroke-dasharray", `${m * 4} ${m * 3}`), x && !D.parentElement && x.insertBefore(D, x.firstChild);
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);
2431
2451
  } else {
2432
- const A = this._ciRects.get(y);
2433
- A && (A.remove(), this._ciRects.delete(y));
2452
+ const M = this._ciRects.get(w);
2453
+ M && (M.remove(), this._ciRects.delete(w));
2434
2454
  }
2435
2455
  });
2436
2456
  } else
2437
- Object.entries(W).forEach(([b, { x: y, y: M, n: F, color: R }]) => {
2438
- const H = new J({
2439
- ID: `mean-${b}`,
2440
- dimensions: [y / F * S, -(M / F) * S],
2441
- meta: { kind: "mean", name: b, group: b, fixedSize: o.meanFixedSize }
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 }
2442
2462
  });
2443
- H.color = new et(R), H.size = 4, H.shape = "rect", this.__data__.points.set(H.ID, H), C.__data__.objects.set(H.ID, H);
2444
- }), o.showCI && (this._ciRects.forEach((b, y) => {
2445
- W[y] || (b.remove(), this._ciRects.delete(y));
2446
- }), ($s = s.confidence) != null && $s.rows ? s.confidence.rows().forEach((b) => {
2447
- const y = b.names.indexOf(h ?? "group"), M = y >= 0 ? String(b[y]) : b.rowName ?? null;
2448
- if (!M) return;
2449
- const F = l[M] ?? "#888888", R = pe(b, n[0], n[1]);
2450
- if (!R) return;
2451
- const H = R.x_low * S, dt = -R.y_high * S, Z = (R.x_high - R.x_low) * S, _t = (R.y_high - R.y_low) * S;
2452
- fe(
2453
- this.__data__.points.get(`mean-${M}`),
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}`),
2454
2474
  Z / 2,
2455
- _t / 2
2475
+ at / 2
2456
2476
  );
2457
- let L = this._ciRects.get(M);
2458
- L || (L = document.createElementNS("http://www.w3.org/2000/svg", "rect"), L.setAttribute("data-ci-group", M), this._ciRects.set(M, L)), L.setAttribute("x", H.toString()), L.setAttribute("y", dt.toString()), L.setAttribute("width", Z.toString()), L.setAttribute("height", _t.toString()), L.setAttribute("fill", "none"), L.setAttribute("stroke", F), L.setAttribute("stroke-width", m.toString()), L.setAttribute("stroke-opacity", "0.8"), L.setAttribute("stroke-dasharray", `${m * 4} ${m * 3}`), x && !L.parentElement && x.insertBefore(L, x.firstChild);
2459
- }) : Object.entries(W).forEach(([b, { x: y, y: M, x2: F, y2: R, n: H, color: dt }]) => {
2460
- if (H < 2) return;
2461
- const Z = y / H, _t = M / H, L = F / H - Z * Z, Ct = R / H - _t * _t, { halfW: yt, halfH: wt } = Ii(L, Ct, H, S), Ot = Z * S, Dt = -_t * S;
2462
- fe(
2463
- this.__data__.points.get(`mean-${b}`),
2464
- yt,
2465
- wt
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 }]) => {
2480
+ 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
2466
2486
  );
2467
- let U = this._ciRects.get(b);
2468
- U || (U = document.createElementNS("http://www.w3.org/2000/svg", "rect"), U.setAttribute("data-ci-group", b), this._ciRects.set(b, U)), U.setAttribute("x", (Ot - yt).toString()), U.setAttribute("y", (Dt - wt).toString()), U.setAttribute("width", (yt * 2).toString()), U.setAttribute("height", (wt * 2).toString()), U.setAttribute("fill", "none"), U.setAttribute("stroke", dt), U.setAttribute("stroke-width", m.toString()), U.setAttribute("stroke-opacity", "0.8"), U.setAttribute("stroke-dasharray", `${m * 4} ${m * 3}`), x && !U.parentElement && x.insertBefore(U, x.firstChild);
2469
- })), (Ps = s.outlier) != null && Ps.rows && (this._outlierRects.forEach((b, y) => {
2470
- l[y] || (b.remove(), this._outlierRects.delete(y));
2471
- }), s.outlier.rows().forEach((b) => {
2472
- const y = b.names.indexOf(h ?? "group"), M = y >= 0 ? String(b[y]) : b.rowName ?? null;
2473
- if (!M) return;
2474
- const F = l[M] ?? "#888888", R = pe(b, n[0], n[1]);
2475
- if (!R) return;
2476
- const H = R.x_low * S, dt = -R.y_high * S, Z = (R.x_high - R.x_low) * S, _t = (R.y_high - R.y_low) * S;
2477
- let L = this._outlierRects.get(M);
2478
- L || (L = document.createElementNS("http://www.w3.org/2000/svg", "rect"), L.setAttribute("data-outlier-group", M), this._outlierRects.set(M, L)), L.setAttribute("x", H.toString()), L.setAttribute("y", dt.toString()), L.setAttribute("width", Z.toString()), L.setAttribute("height", _t.toString()), L.setAttribute("fill", "none"), L.setAttribute("stroke", F), L.setAttribute("stroke-width", m.toString()), L.setAttribute("stroke-opacity", "0.5"), L.setAttribute("stroke-dasharray", `${m * 2} ${m * 2}`), x && !L.parentElement && x.insertBefore(L, x.firstChild);
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);
2479
2499
  }));
2480
2500
  }
2481
- st && (this._pointLabels.forEach((x, m) => {
2482
- C.__data__.objects.get(m) || (x.remove(), this._pointLabels.delete(m));
2483
- }), this._meanLabels.forEach((x, m) => {
2484
- C.__data__.objects.get(`mean-${m}`) || (x.remove(), this._meanLabels.delete(m));
2485
- }), rt !== 0 && s.points.rows().forEach((x) => {
2486
- const m = x.names.indexOf(r), $ = m >= 0 ? String(x[m]) : null;
2487
- if (!$) return;
2488
- const b = C.__data__.objects.get($);
2489
- if (!b) return;
2490
- const y = $;
2491
- let M = this._pointLabels.get($);
2492
- M ? rt === B.DISPLAY_TYPES.ON ? M.show() : M.hide() : (M = new Kt(y, b, st, this, rt), this._pointLabels.set($, M));
2493
- }), nt !== 0 && (I ? O.map((m) => m.rowName ?? String(m[0])) : Object.keys(W)).forEach((m) => {
2494
- const $ = `mean-${m}`, b = C.__data__.objects.get($);
2495
- if (!b) return;
2496
- let y = this._meanLabels.get(m);
2497
- y ? nt === B.DISPLAY_TYPES.ON ? y.show() : y.hide() : (y = new Kt(m, b, st, this, nt), this._meanLabels.set(m, y));
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));
2498
2518
  })), C.__data__.__state__.setVariable("layer_updated", C.__data__);
2499
2519
  }
2500
2520
  }
2501
- const Lt = this.__children__.search("__children__", "trajectories");
2502
- if (o.showTrajectories && Lt) {
2503
- Lt.__data__.objects.clear(), this.__data__.trajectories.clear();
2521
+ const Dt = this.__children__.search("__children__", "trajectories");
2522
+ if (o.showTrajectories && Dt) {
2523
+ Dt.__data__.objects.clear(), this.__data__.trajectories.clear();
2504
2524
  const C = (Rs = s.trajectories) != null && Rs.rows ? s.trajectories : s.points;
2505
2525
  if (C != null && C.rows) {
2506
- const I = {}, O = o.trajectoryUnits ? o.trajectoryUnits.split(",").map((m) => m.trim()) : null;
2507
- C.rows().forEach((m) => {
2508
- const $ = m.names.indexOf(r) >= 0 ? m.names.indexOf(r) : m.names.indexOf("unit") >= 0 ? m.names.indexOf("unit") : m.names.indexOf("ENA_UNIT") >= 0 ? m.names.indexOf("ENA_UNIT") : -1, b = $ >= 0 ? String(m[$]) : m.rowName || "unit-1";
2509
- if (O && !O.includes(b)) return;
2510
- const y = m.names.indexOf(n[0]), M = n.length > 1 ? m.names.indexOf(n[1]) : -1, F = m.names.indexOf("time") >= 0 ? m.names.indexOf("time") : m.names.indexOf("ActivityNumber") >= 0 ? m.names.indexOf("ActivityNumber") : m.names.indexOf("RowID") >= 0 ? m.names.indexOf("RowID") : -1, R = F >= 0 ? Number(m[F]) : I[b] ? I[b].length + 1 : 1;
2511
- y >= 0 && M >= 0 && (I[b] || (I[b] = []), I[b].push({
2512
- x: Number(m[y]) * S,
2513
- y: -Number(m[M]) * S,
2514
- time: R
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
2515
2535
  }));
2516
- }), Object.keys(I).forEach((m, $) => {
2517
- const b = I[m];
2518
- if (b.length === 0) return;
2519
- const y = _[$ % _.length], M = new Se({
2520
- ID: `traj-${m}`,
2521
- unitId: m,
2522
- color: new et(y),
2536
+ }), Object.keys(I).forEach((b, A) => {
2537
+ const O = I[b];
2538
+ 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),
2523
2543
  lineStyle: o.trajectoryLineStyle,
2524
2544
  strokeWidth: o.trajectoryStrokeWidth,
2525
2545
  strokeWidthRange: o.trajectoryStrokeWidthRange,
@@ -2530,210 +2550,210 @@ const ut = class ut extends Ae {
2530
2550
  currentTime: o.trajectoryPlayhead ?? 1 / 0,
2531
2551
  showPoints: o.trajectoryShowPoints,
2532
2552
  showTips: o.trajectoryShowTips,
2533
- points: b.map((F) => ({ x: F.x, y: F.y, time: F.time }))
2553
+ points: O.map((P) => ({ x: P.x, y: P.y, time: P.time }))
2534
2554
  });
2535
- this.__data__.trajectories.set(m, M), Lt.__data__.objects.set(M.ID, M);
2555
+ this.__data__.trajectories.set(b, w), Dt.__data__.objects.set(w.ID, w);
2536
2556
  });
2537
2557
  }
2538
- Lt.__data__.__state__.setVariable("layer_updated", Lt.__data__);
2558
+ Dt.__data__.__state__.setVariable("layer_updated", Dt.__data__);
2539
2559
  }
2540
- const ct = this.__children__.search("__children__", "network"), Vt = ct == null ? void 0 : ct.__children__.search("__children__", "edges"), gt = ct == null ? void 0 : ct.__children__.search("__children__", "nodes"), ge = ct == null ? void 0 : ct.__children__.search("__children__", "edgenodes"), si = o.showEdges;
2541
- if ((Ls = s.nodes) != null && Ls.rows && gt) {
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) {
2542
2562
  if (s.nodes.rows().forEach((I) => {
2543
- const O = lt(I, a, "#444444");
2544
- O.size = 2;
2545
- const x = I.names.indexOf("label"), m = x >= 0 ? I[x] : null;
2546
- O.meta = {
2547
- ...O.meta ?? {},
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 ?? {},
2548
2568
  kind: "node",
2549
- name: m != null && String(m) !== "NA" && String(m) !== "" ? String(m) : O.ID
2550
- }, gt.__data__.objects.set(O.ID, O);
2551
- }), si && Vt && ((Ds = s.edges) != null && Ds.rows)) {
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)) {
2552
2572
  const I = {};
2553
- h && ((Ts = s.points) != null && Ts.rows) && s.points.rows().forEach((p) => {
2554
- const w = p.names.indexOf(r), N = p.names.indexOf(h);
2555
- w >= 0 && N >= 0 && (I[String(p[w])] = String(p[N]));
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]));
2556
2576
  });
2557
- const O = s.nodes.rows().map((p) => {
2558
- const w = p.names.indexOf(a);
2559
- return w >= 0 ? String(p[w]) : "";
2560
- }).filter(Boolean), x = [];
2561
- (s.edges.names ?? []).forEach((p) => {
2562
- const w = Mi(p, O);
2563
- w && x.push({ col: p, pair: w });
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 });
2564
2584
  });
2565
- const m = /* @__PURE__ */ u((p) => {
2566
- const w = {};
2585
+ const b = /* @__PURE__ */ u((f) => {
2586
+ const x = {};
2567
2587
  return s.edges.rows().forEach((N) => {
2568
- const T = N.names.indexOf(r);
2569
- T < 0 || String(N[T]) !== p || x.forEach(({ col: A }) => {
2570
- const z = N.names.indexOf(A);
2571
- z >= 0 && (w[A] = Number(N[z]) || 0);
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);
2572
2592
  });
2573
- }), w;
2574
- }, "getUnitEdges"), $ = /* @__PURE__ */ u((p) => {
2575
- const w = {};
2593
+ }), x;
2594
+ }, "getUnitEdges"), A = /* @__PURE__ */ u((f) => {
2595
+ const x = {};
2576
2596
  let N = 0;
2577
- if (s.edges.rows().forEach((A) => {
2578
- const z = A.names.indexOf(r), V = z >= 0 ? String(A[z]) : null, K = h ? A.names.indexOf(h) : -1;
2579
- (K >= 0 ? String(A[K]) : V ? I[V] : null) === p && (N++, x.forEach(({ col: mt }) => {
2580
- const ft = A.names.indexOf(mt);
2581
- if (ft >= 0) {
2582
- const X = Number(A[ft]);
2583
- isNaN(X) || (w[mt] = (w[mt] ?? 0) + X);
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);
2584
2604
  }
2585
2605
  }));
2586
2606
  }), N === 0) return {};
2587
- const T = {};
2588
- return x.forEach(({ col: A }) => {
2589
- T[A] = (w[A] ?? 0) / N;
2590
- }), T;
2591
- }, "getGroupEdges"), b = /* @__PURE__ */ u((p) => {
2592
- if (l[p])
2593
- return { weights: $(p), color: l[p], label: p };
2594
- const w = I[p] ?? null, N = w ? l[w] ?? "#888888" : "#888888";
2595
- return { weights: m(p), color: N, label: p };
2596
- }, "resolve"), y = [], M = /* @__PURE__ */ u((p) => {
2597
- var A;
2598
- const w = s.networks, N = (A = w == null ? void 0 : w.rows) == null ? void 0 : A.call(w).find((z) => z.rowName === p);
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);
2599
2619
  if (!N) return null;
2600
- const T = {};
2601
- return x.forEach(({ col: z }) => {
2602
- const V = N.names.indexOf(z);
2603
- if (V >= 0) {
2604
- const K = Number(N[V]);
2605
- Number.isFinite(K) && (T[z] = K);
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);
2606
2626
  }
2607
- }), T;
2608
- }, "networkRow"), F = /* @__PURE__ */ u((p, w) => {
2609
- if (!w) return p;
2610
- const N = Math.abs(p);
2611
- return N < w[0] ? 0 : N > w[1] ? Math.sign(p) * w[1] : p;
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;
2612
2632
  }, "thresholded");
2613
- o.edgeLayers.forEach((p, w) => {
2614
- const N = /* @__PURE__ */ u((X, ot, Q, xt, at) => {
2615
- Q = F(Q, p.threshold), !(Math.abs(Q) < 1e-6) && y.push({ col: `${w}:${X}`, pair: ot, weight: Math.abs(Q), color: xt, layer: w, ...at });
2616
- }, "push"), T = /* @__PURE__ */ u((X, ot) => p.colors ? [p.colors[0], p.colors[1] ?? Ci(p.colors[0])] : [X, ot], "signColors");
2617
- if (p.network) {
2618
- const X = M(p.network);
2619
- if (!X) return;
2620
- const [ot, Q] = T(_[0], _[1]), xt = { name: p.name ?? p.network };
2621
- x.forEach(({ col: at, pair: zs }) => {
2622
- const me = X[at] ?? 0;
2623
- N(at, zs, me, me >= 0 ? ot : Q, xt);
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);
2639
+ 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);
2624
2644
  });
2625
2645
  return;
2626
2646
  }
2627
- const A = p.unit ?? p.group ?? null;
2628
- if (!A) return;
2629
- const z = b(A), V = p.compare ?? p.also ?? null, K = V ? b(V) : null, D = { name: p.name ?? A, group: p.group ?? void 0, unit: p.unit ?? void 0 }, [mt, ft] = T(z.color, (K == null ? void 0 : K.color) ?? z.color);
2630
- K && p.compare ? x.forEach(({ col: X, pair: ot }) => {
2631
- const Q = (z.weights[X] ?? 0) - (K.weights[X] ?? 0);
2632
- N(X, ot, Q, Q > 0 ? mt : ft, D);
2633
- }) : K && p.also ? x.forEach(({ col: X, pair: ot }) => {
2634
- const Q = z.weights[X] ?? 0, xt = K.weights[X] ?? 0;
2635
- Q > 0 && N(X + "-a", ot, Q, mt, D), xt > 0 && N(X + "-b", ot, xt, ft, { ...D, name: p.also ?? void 0, group: p.also ?? void 0 });
2636
- }) : x.forEach(({ col: X, pair: ot }) => {
2637
- const Q = z.weights[X] ?? 0;
2638
- Q > 0 && N(X, ot, Q, mt, D);
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);
2639
2659
  });
2640
- }), y.sort((p, w) => w.weight - p.weight);
2641
- const R = !!s.directed, H = wi(o.edgeWidth) * (o.edgeMagnify ?? 1), dt = /* @__PURE__ */ u((p) => {
2642
- const w = p.map(Math.abs).filter((N) => N > 0);
2643
- return w.length ? [Math.min(...w), Math.max(...w)] : [0, 0];
2644
- }, "rangeOf"), Z = /* @__PURE__ */ u((p) => {
2645
- const w = [];
2646
- return x.forEach(({ col: N, pair: T }) => {
2647
- if (T[0] === T[1] !== p) return;
2648
- const A = s.edges.col(N);
2649
- if (A) for (const z of A) w.push(Number(z));
2650
- }), dt(w);
2651
- }, "modelRange"), _t = /* @__PURE__ */ u((p) => dt(y.filter((w) => w.pair[0] === w.pair[1] === p).map((w) => w.weight)), "plotRange"), L = o.edgeColorScale, Ct = /* @__PURE__ */ u((p) => L === "plot" ? _t(p) : Z(p), "colourRange"), yt = Ct(!1), wt = Ct(!0), Ot = /* @__PURE__ */ u((p, w) => {
2652
- if (L === "absolute") {
2653
- const A = Math.min(1, Math.abs(p));
2654
- return { saturation: A, opacity: A };
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 };
2655
2675
  }
2656
- const [N, T] = w ? wt : yt;
2657
- return { saturation: Xs(p, N, T, gi), opacity: Xs(p, N, T, mi) };
2658
- }, "colourOf"), Dt = {};
2659
- y.forEach(({ pair: p, weight: w }) => {
2660
- if (p[0] === p[1] && !R) return;
2661
- const T = /* @__PURE__ */ u((A) => {
2662
- Dt[A] = (Dt[A] ?? 0) + Math.abs(w);
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);
2663
2683
  }, "add");
2664
- if (R) {
2665
- T(p[1]);
2684
+ if (q) {
2685
+ z(f[1]);
2666
2686
  return;
2667
2687
  }
2668
- T(p[0]), T(p[1]);
2669
- }), s.nodes.rows().forEach((p) => {
2670
- const w = p.names.indexOf(a), N = w >= 0 ? String(p[w]) : "";
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]) : "";
2671
2691
  if (!N) return;
2672
- const T = gt.__data__.objects.get(N);
2673
- if (!T) return;
2674
- const A = Dt[N] ?? 0, z = !(A > 0);
2675
- T.size = z ? o.hideUnconnectedNodes ? 0 : xi : Ai(A, H), T.meta = {
2676
- ...T.meta ?? {},
2677
- hidden: z && o.hideUnconnectedNodes
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
2678
2698
  };
2679
2699
  });
2680
- const U = {}, it = /* @__PURE__ */ u((p, w, N, T) => `${p}:${w ?? ""}:${N}.${T}`, "pairKey");
2681
- R && y.forEach(({ pair: p, weight: w, layer: N, name: T }) => {
2682
- const A = it(N, T, p[0], p[1]);
2683
- U[A] = (U[A] ?? 0) + w;
2684
- }), y.forEach(({ col: p, pair: w, weight: N, color: T, layer: A, name: z, group: V, unit: K }) => {
2685
- const D = gt.__data__.objects.get(w[0]), mt = gt.__data__.objects.get(w[1]);
2686
- if (!D || !mt) return;
2687
- const ft = w[0] === w[1];
2688
- if (ft && !R) return;
2689
- const { saturation: X, opacity: ot } = Ot(N, ft), Q = new J({ ID: `${w[0]}-src`, dimensions: [D.x, D.y], meta: {} }), xt = new J({ ID: `${w[1]}-dst`, dimensions: [mt.x, mt.y], meta: {} });
2690
- let at;
2691
- if (ft)
2692
- at = new ie({}, Q, xt), at.weight = 0;
2693
- else if (R) {
2694
- const me = U[it(A, z, w[0], w[1])] ?? N, ii = U[it(A, z, w[1], w[0])] ?? 0, ni = me + ii;
2695
- at = new Qe(
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(
2696
2716
  { weight: N, totalweight: ni },
2697
2717
  Q,
2698
- xt
2718
+ wt
2699
2719
  );
2700
2720
  } else
2701
- at = new Ht({}, Q, xt);
2702
- at.ID = `edge-${p}`, at.color = new et(T), at.meta = {
2721
+ lt = new Xt({}, Q, wt);
2722
+ lt.ID = `edge-${f}`, lt.color = new st(z), lt.meta = {
2703
2723
  isMeanEdge: !0,
2704
2724
  weight: N,
2705
2725
  // Width per unit weight (extent units), shared by all marks.
2706
- widthFrac: H,
2707
- saturation: X,
2708
- opacity: ot,
2709
- isDirected: R,
2710
- isSelf: ft,
2726
+ widthFrac: X,
2727
+ saturation: V,
2728
+ opacity: ht,
2729
+ isDirected: q,
2730
+ isSelf: pt,
2711
2731
  // Identity for the qe-edge-* interaction events.
2712
- source: w[0],
2713
- target: w[1],
2714
- group: V,
2715
- unit: K,
2716
- layer: z
2717
- }, (ft ? ge ?? Vt : Vt).__data__.objects.set(at.ID, at);
2718
- }), Vt.__data__.__state__.setVariable("layer_updated", Vt.__data__), ge && ge.__data__.__state__.setVariable("layer_updated", ge.__data__);
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__);
2719
2739
  }
2720
2740
  const C = o.showNodes;
2721
- gt.svg_element && (gt.svg_element.style.display = C ? "" : "none"), C || (this._nodeLabels.forEach((I) => I.remove()), this._nodeLabels.clear()), st && j !== 0 && C && (this._nodeLabels.forEach((I, O) => {
2722
- gt.__data__.objects.get(O) || (I.remove(), this._nodeLabels.delete(O));
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($));
2723
2743
  }), s.nodes.rows().forEach((I) => {
2724
- var y, M, F;
2725
- const O = I.names.indexOf(a), x = O >= 0 ? String(I[O]) : "";
2726
- if (!x) return;
2727
- const m = gt.__data__.objects.get(x);
2728
- if (!m) return;
2729
- if ((y = m.meta) != null && y.hidden) {
2730
- (M = this._nodeLabels.get(x)) == null || M.remove(), this._nodeLabels.delete(x);
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);
2731
2751
  return;
2732
2752
  }
2733
- const $ = String(((F = m.meta) == null ? void 0 : F.name) ?? x);
2734
- let b = this._nodeLabels.get(x);
2735
- b && b.text !== $ && (b.remove(), this._nodeLabels.delete(x), b = void 0), b ? j === B.DISPLAY_TYPES.ON ? b.show() : b.hide() : (b = new Kt($, m, st, this, j), this._nodeLabels.set(x, b));
2736
- })), gt.__data__.__state__.setVariable("layer_updated", gt.__data__);
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__);
2737
2757
  }
2738
2758
  const ws = this.__children__.search("__children__", "axis_points"), As = this.__children__.search("__children__", "axis_lines");
2739
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);
@@ -2784,14 +2804,14 @@ const ut = class ut extends Ae {
2784
2804
  var g;
2785
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) => {
2786
2806
  var E;
2787
- return ((E = r.find((f) => f.hasAttribute(c))) == null ? void 0 : E.getAttribute(c)) ?? null;
2807
+ return ((E = r.find((m) => m.hasAttribute(c))) == null ? void 0 : E.getAttribute(c)) ?? null;
2788
2808
  }, "firstAttr"), h = r.find((c) => c.hasAttribute("magnify")), o = this.querySelector("qe-trajectories"), l = this.querySelector("qe-axes"), _ = this.getAttribute("labels");
2789
2809
  return {
2790
2810
  // Nodes — always placed from the model (they anchor the coordinate
2791
2811
  // space); <qe-nodes> presence draws them, like every other layer.
2792
2812
  labelNodes: He(
2793
2813
  (t == null ? void 0 : t.getAttribute("label")) ?? this.getAttribute("label-nodes") ?? _,
2794
- B.DISPLAY_TYPES.ON
2814
+ H.DISPLAY_TYPES.ON
2795
2815
  ),
2796
2816
  showNodes: !!t,
2797
2817
  range: (() => {
@@ -2832,7 +2852,7 @@ const ut = class ut extends Ae {
2832
2852
  showOutlier: !!e && e.hasAttribute("outlier"),
2833
2853
  labelMeans: He(
2834
2854
  (e == null ? void 0 : e.getAttribute("label")) ?? this.getAttribute("label-means") ?? _,
2835
- B.DISPLAY_TYPES.ON
2855
+ H.DISPLAY_TYPES.ON
2836
2856
  ),
2837
2857
  // fixed-size keeps mean markers a constant on-screen px size (webENA parity).
2838
2858
  meanFixedSize: !!e && e.hasAttribute("fixed-size"),
@@ -2845,7 +2865,7 @@ const ut = class ut extends Ae {
2845
2865
  })),
2846
2866
  labelPoints: He(
2847
2867
  (i == null ? void 0 : i.getAttribute("label")) ?? this.getAttribute("label-points") ?? _,
2848
- B.DISPLAY_TYPES.OFF
2868
+ H.DISPLAY_TYPES.OFF
2849
2869
  ),
2850
2870
  pointSize: i != null && i.getAttribute("size") ? parseFloat(i.getAttribute("size")) : null,
2851
2871
  // fixed-size keeps unit dots a constant on-screen px size (webENA parity).
@@ -2892,7 +2912,7 @@ const ut = class ut extends Ae {
2892
2912
  connectedCallback() {
2893
2913
  var n;
2894
2914
  const t = this.getAttribute("width"), e = this.getAttribute("height");
2895
- 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), ut._instances.add(this), this._childObserver = new MutationObserver(() => this._scheduleRerender()), this._childObserver.observe(this, {
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, {
2896
2916
  childList: !0,
2897
2917
  attributes: !0,
2898
2918
  subtree: !0,
@@ -2956,15 +2976,15 @@ const ut = class ut extends Ae {
2956
2976
  }
2957
2977
  disconnectedCallback() {
2958
2978
  var t, e, s;
2959
- (t = this._childObserver) == null || t.disconnect(), this._childObserver = null, (e = this._resizeObs) == null || e.disconnect(), this._resizeObs = null, ut._instances.delete(this), (s = this._tooltipEl) == null || s.remove(), this._tooltipEl = null;
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;
2960
2980
  }
2961
2981
  /** All connected <qe-graph> instances (newest membership order). */
2962
2982
  static instances() {
2963
- return [...ut._instances];
2983
+ return [...gt._instances];
2964
2984
  }
2965
2985
  /** Look up a graph by its `id` or `plot-group` attribute. */
2966
2986
  static getGraph(t) {
2967
- for (const e of ut._instances)
2987
+ for (const e of gt._instances)
2968
2988
  if (e.id === t || e.getAttribute("plot-group") === t) return e;
2969
2989
  return null;
2970
2990
  }
@@ -3012,7 +3032,7 @@ const ut = class ut extends Ae {
3012
3032
  if (e === "line") return { t: "l", x1: s("x1"), y1: s("y1"), x2: s("x2"), y2: s("y2") };
3013
3033
  if (e === "path") {
3014
3034
  const i = t.getAttribute("d") || "";
3015
- return { t: "p", d: i, nums: (i.match(ut._PATH_NUM_RE) || []).map(Number) };
3035
+ return { t: "p", d: i, nums: (i.match(gt._PATH_NUM_RE) || []).map(Number) };
3016
3036
  }
3017
3037
  return null;
3018
3038
  }
@@ -3048,11 +3068,11 @@ const ut = class ut extends Ae {
3048
3068
  else {
3049
3069
  if (!c.nums || c.nums.length !== _.nums.length) return;
3050
3070
  let E = 0;
3051
- const f = _.d.replace(
3052
- ut._PATH_NUM_RE,
3071
+ const m = _.d.replace(
3072
+ gt._PATH_NUM_RE,
3053
3073
  () => String(r(c.nums[E], _.nums[E++], l))
3054
3074
  );
3055
- g.setAttribute("d", f);
3075
+ g.setAttribute("d", m);
3056
3076
  }
3057
3077
  }), this._tweenRaf = o < 1 ? requestAnimationFrame(a) : null;
3058
3078
  }, "step");
@@ -3208,7 +3228,7 @@ const ut = class ut extends Ae {
3208
3228
  const l = (c = (g = o.detail) == null ? void 0 : g.pointData) == null ? void 0 : c.ID;
3209
3229
  if (!l) return;
3210
3230
  const _ = this._pointLabels.get(l) ?? this._meanLabels.get(l.replace("mean-", "")) ?? this._nodeLabels.get(l);
3211
- _ && _.displayMode === B.DISPLAY_TYPES.CLICK && _.toggle();
3231
+ _ && _.displayMode === H.DISPLAY_TYPES.CLICK && _.toggle();
3212
3232
  }));
3213
3233
  const a = /* @__PURE__ */ u((o) => {
3214
3234
  var l;
@@ -3223,14 +3243,14 @@ const ut = class ut extends Ae {
3223
3243
  const l = a(o.target);
3224
3244
  if (!l) return;
3225
3245
  const _ = h(l);
3226
- (_ == null ? void 0 : _.displayMode) === B.DISPLAY_TYPES.AUTO && _.show();
3246
+ (_ == null ? void 0 : _.displayMode) === H.DISPLAY_TYPES.AUTO && _.show();
3227
3247
  }), this.svg_element.addEventListener("mouseout", (o) => {
3228
3248
  const l = a(o.target);
3229
3249
  if (!l) return;
3230
3250
  const _ = o.relatedTarget;
3231
3251
  if (a(_) === l) return;
3232
3252
  const c = h(l);
3233
- (c == null ? void 0 : c.displayMode) === B.DISPLAY_TYPES.AUTO && c.hide();
3253
+ (c == null ? void 0 : c.displayMode) === H.DISPLAY_TYPES.AUTO && c.hide();
3234
3254
  }), this._attachInteractionEvents();
3235
3255
  }
3236
3256
  /** Emit a namespaced CustomEvent on the public element (bubbles + composed). */
@@ -3386,7 +3406,7 @@ const ut = class ut extends Ae {
3386
3406
  const t = this.__data__;
3387
3407
  if (t.update_extremes(this._centerContent), this._rangeExtent && this._rangeExtent > 0) {
3388
3408
  const { cx: i, cy: n } = t.extremes, r = this._centerContent && this._rangeMode === "network" ? t.nodeExtentFrom(i, n) * 1.2 : this._rangeExtent;
3389
- t.extremes = new Pt(r, r, i, n);
3409
+ t.extremes = new Rt(r, r, i, n);
3390
3410
  }
3391
3411
  const e = (s = this.svg_element) == null ? void 0 : s.getBoundingClientRect();
3392
3412
  if (this.svg_element && e) {
@@ -3409,8 +3429,8 @@ const ut = class ut extends Ae {
3409
3429
  });
3410
3430
  }
3411
3431
  };
3412
- u(ut, "QEGraphElement"), ut.tagName = "qe-graph", ut.style = `
3413
- ${Ae.style}
3432
+ u(gt, "QEGraphElement"), gt.tagName = "qe-graph", gt.style = `
3433
+ ${ve.style}
3414
3434
 
3415
3435
  :host {
3416
3436
  display: block;
@@ -3427,33 +3447,33 @@ u(ut, "QEGraphElement"), ut.tagName = "qe-graph", ut.style = `
3427
3447
  aspect-ratio: 1 / 1;
3428
3448
  background-color: #FFF;
3429
3449
  }
3430
- `, ut._instances = /* @__PURE__ */ new Set(), ut._PATH_NUM_RE = /-?\d*\.?\d+(?:e[-+]?\d+)?/gi;
3431
- let Wt = ut;
3432
- customElements.define(Wt.tagName, Wt);
3433
- const Ri = /* @__PURE__ */ u((d) => Wt.getGraph(d), "getGraph"), Li = /* @__PURE__ */ u(() => Wt.instances(), "getGraphs");
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");
3434
3454
  export {
3435
- et as Color,
3436
- jt as DataFrame,
3437
- be as DataFrameColumn,
3455
+ st as Color,
3456
+ Yt as DataFrame,
3457
+ ye as DataFrameColumn,
3438
3458
  oi as DataFrameColumnType,
3439
- Bt as DataFrameRow,
3440
- Ee as Edge,
3459
+ Ht as DataFrameRow,
3460
+ Me as Edge,
3441
3461
  Ke as Graph,
3442
- Pe as QEAxesElement,
3443
- Oe as QEEdgesElement,
3444
- Wt as QEGraphElement,
3462
+ Re as QEAxesElement,
3463
+ $e as QEEdgesElement,
3464
+ Vt as QEGraphElement,
3445
3465
  ts as QELayer,
3446
- At as QELine,
3447
- ke as QEMeansElement,
3448
- Ne as QENodesElement,
3449
- re as QEPoint,
3450
- Ce as QEPointsElement,
3451
- $e as QETrajectoriesElement,
3452
- Ie as QETrajectory,
3453
- ye as QEVisualElement,
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,
3454
3474
  hi as TRAJECTORY_ZERO_EPS,
3455
- Se as Trajectory,
3456
- xe as WeightedColor,
3475
+ Ee as Trajectory,
3476
+ we as WeightedColor,
3457
3477
  ui as fitTrajectory,
3458
3478
  Ri as getGraph,
3459
3479
  Li as getGraphs,