@popcorn245/cornfield-components 0.51.7 → 0.52.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/README.md +1 -1
  2. package/dist/chunks/around-D7aqHejs.js +78 -0
  3. package/dist/chunks/corn-layers-g9AprK6G.js +275 -0
  4. package/dist/chunks/{corn-map-CL3X_1iT.js → corn-map-DE-pg-A0.js} +8 -5
  5. package/dist/chunks/corn-node-panel-CdtFb9IZ.js +42 -0
  6. package/dist/chunks/{corn-review-Cdr_e7yn.js → corn-review-9krtLSPK.js} +970 -2487
  7. package/dist/chunks/corn-search-BY1Po63S.js +484 -0
  8. package/dist/chunks/{engine-ClfnAsgM.js → engine-HIgX35hE.js} +3679 -3580
  9. package/dist/chunks/layers-n1mJVJs8.js +191 -0
  10. package/dist/chunks/{map-LS9aQk6z.js → map-CeP9M2_w.js} +794 -773
  11. package/dist/chunks/node-panel-CY5xnuKC.js +1291 -0
  12. package/dist/chunks/{review-source-CPiFTfyc.js → review-source-DWisOXyR.js} +1 -1
  13. package/dist/chunks/{scope-Dg_uzefP.js → scope-CUhp8mkf.js} +13 -12
  14. package/dist/chunks/sheets-TFCL_dIn.js +204 -0
  15. package/dist/chunks/source-address-C70zNPIj.js +79 -0
  16. package/dist/chunks/{status-CYQD5PwL.js → status-CsFpnQxw.js} +55 -54
  17. package/dist/corn-layers.js +1 -0
  18. package/dist/corn-map.js +1 -1
  19. package/dist/corn-node-panel.js +1 -0
  20. package/dist/corn-review.js +1 -1
  21. package/dist/corn-scope.js +3 -3
  22. package/dist/corn-search.js +1 -0
  23. package/dist/index.js +8 -5
  24. package/dist/manifest.json +101 -36
  25. package/dist/tokens.css +8 -2
  26. package/dist/types/components.d.ts +90 -0
  27. package/dist/types/corn-layers.d.ts +2 -0
  28. package/dist/types/corn-node-panel.d.ts +2 -0
  29. package/dist/types/corn-search.d.ts +2 -0
  30. package/dist/types/index.d.ts +3 -0
  31. package/dist/version.json +1 -1
  32. package/package.json +14 -2
  33. package/dist/chunks/source-address-B7hYRgt8.js +0 -251
@@ -1,36 +1,36 @@
1
- import { $ as e, At as t, B as n, Ct as r, Dt as i, Et as a, F as o, G as s, H as c, I as l, J as u, L as d, M as f, N as p, Ot as m, P as h, Q as g, Qt as _, St as v, Tt as y, U as b, V as x, W as S, X as C, Y as w, Z as T, _ as E, an as D, at as O, b as ee, c as k, d as A, g as j, gt as M, h as N, ht as te, it as P, j as F, ln as ne, lt as I, mt as L, o as R, on as re, q as z, rt as ie, s as B, sn as V, tt as H, u as ae, ut as U, v as W, vt as G, wt as K, xt as oe, yt as se, z as ce } from "./engine-ClfnAsgM.js";
2
- var q = 96, le = "letters:", ue = (e) => `${le}${e}`, de = (e) => typeof e == "string" && e.startsWith(le), fe = (e) => e.slice(8), pe = (e, t) => !!e.letters && !e.icon && e.r * 2 * t >= 14, me = /* @__PURE__ */ new Map();
3
- function he(e, t = null) {
1
+ import { $ as e, $t as t, A as n, An as r, At as i, C as a, Ct as o, E as s, G as c, H as l, Ht as u, J as d, Jt as f, K as p, Mt as m, O as h, Qt as g, S as _, Sn as v, Tn as y, Ut as b, V as x, W as S, Wt as C, X as w, Xt as T, Y as E, Yt as D, Zt as O, _ as k, b as A, bn as ee, c as j, d as M, en as N, f as P, g as F, gn as I, hn as te, i as L, j as R, jt as z, l as ne, m as B, n as V, p as H, q as U, qt as W, r as G, rt as K, sn as re, tn as q, u as ie, v as J, w as ae, wn as oe, xn as se } from "./engine-HIgX35hE.js";
2
+ var Y = 96, ce = "letters:", le = (e) => `${ce}${e}`, ue = (e) => typeof e == "string" && e.startsWith(ce), de = (e) => e.slice(8), fe = (e, t) => !!e.letters && !e.icon && e.r * 2 * t >= 14, pe = /* @__PURE__ */ new Map();
3
+ function me(e, t = null) {
4
4
  if (typeof e != "string" || !e) return null;
5
5
  let n = `${typeof t == "string" ? t : ""}|${e}`;
6
- if (me.has(n)) return me.get(n);
7
- if (me.size >= 128) return null;
6
+ if (pe.has(n)) return pe.get(n);
7
+ if (pe.size >= 128) return null;
8
8
  let r = null;
9
9
  try {
10
- let n = typeof OffscreenCanvas < "u" ? new OffscreenCanvas(q, q) : typeof document < "u" ? Object.assign(document.createElement("canvas"), {
11
- width: q,
12
- height: q
10
+ let n = typeof OffscreenCanvas < "u" ? new OffscreenCanvas(Y, Y) : typeof document < "u" ? Object.assign(document.createElement("canvas"), {
11
+ width: Y,
12
+ height: Y
13
13
  }) : null, i = n && n.getContext && n.getContext("2d");
14
14
  if (i && i.fillText) {
15
- i.font = `700 ${e.length > 1 ? 56 : 72}px ${z}`, i.textAlign = "center", i.textBaseline = "middle", i.lineJoin = "round", i.lineWidth = 10;
16
- let a = typeof t == "string" ? t : se;
17
- i.strokeStyle = y(a) === "#ffffff" ? "rgba(11, 18, 32, 0.92)" : "rgba(255, 255, 255, 0.92)", i.strokeText(e, q / 2, 51), i.fillStyle = a, i.fillText(e, q / 2, 51), r = n;
15
+ i.font = `700 ${e.length > 1 ? 56 : 72}px ${F}`, i.textAlign = "center", i.textBaseline = "middle", i.lineJoin = "round", i.lineWidth = 10;
16
+ let a = typeof t == "string" ? t : l;
17
+ i.strokeStyle = d(a) === "#ffffff" ? "rgba(11, 18, 32, 0.92)" : "rgba(255, 255, 255, 0.92)", i.strokeText(e, Y / 2, 51), i.fillStyle = a, i.fillText(e, Y / 2, 51), r = n;
18
18
  }
19
19
  } catch {
20
20
  r = null;
21
21
  }
22
- return me.set(n, r), r;
22
+ return pe.set(n, r), r;
23
23
  }
24
24
  // ../explorer/renderer-canvas2d.js
25
- var ge = Math.PI * 2, _e = 1.5, J = (e, t, n, r) => {
26
- e.beginPath(), e.arc(t, n, r, 0, ge);
25
+ var he = Math.PI * 2, ge = 1.5, _e = (e, t, n, r) => {
26
+ e.beginPath(), e.arc(t, n, r, 0, he);
27
27
  };
28
28
  function ve(e, t, n, r, i) {
29
29
  if (t === "rounded-square" || t === "square") {
30
- let a = i * (t === "square" ? C.squareHalf : C.roundedHalf), o = i * (t === "square" ? C.squareCorner : C.roundedCorner);
30
+ let a = i * (t === "square" ? A.squareHalf : A.roundedHalf), o = i * (t === "square" ? A.squareCorner : A.roundedCorner);
31
31
  e.beginPath(), e.roundRect ? e.roundRect(n - a, r - a, a * 2, a * 2, o) : e.rect(n - a, r - a, a * 2, a * 2);
32
32
  } else if (t === "hexagon") {
33
- let t = i * C.hexInradius / Math.cos(Math.PI / 6);
33
+ let t = i * A.hexInradius / Math.cos(Math.PI / 6);
34
34
  e.beginPath();
35
35
  for (let i = 0; i < 6; i++) {
36
36
  let a = Math.PI / 6 + i * Math.PI / 3, o = n + t * Math.cos(a), s = r + t * Math.sin(a);
@@ -38,9 +38,9 @@ function ve(e, t, n, r, i) {
38
38
  }
39
39
  e.closePath();
40
40
  } else if (t === "diamond") {
41
- let t = i * C.diamondHalf;
41
+ let t = i * A.diamondHalf;
42
42
  e.beginPath(), e.moveTo(n, r - t), e.lineTo(n + t, r), e.lineTo(n, r + t), e.lineTo(n - t, r), e.closePath();
43
- } else J(e, n, r, i);
43
+ } else _e(e, n, r, i);
44
44
  }
45
45
  function ye(e, t, n, r, i) {
46
46
  let a = -n.x / n.zoom - t.margin, o = (r - n.x) / n.zoom + t.margin, s = -n.y / n.zoom - t.margin, c = (i - n.y) / n.zoom + t.margin;
@@ -51,7 +51,7 @@ function ye(e, t, n, r, i) {
51
51
  }
52
52
  function be(e, t) {
53
53
  e.save(), t.forEach((t) => {
54
- e.lineWidth = t.width, e.setLineDash(t.dash), e.strokeStyle = t.color, J(e, t.x, t.y, t.r), e.stroke();
54
+ e.lineWidth = t.width, e.setLineDash(t.dash), e.strokeStyle = t.color, _e(e, t.x, t.y, t.r), e.stroke();
55
55
  }), e.restore();
56
56
  }
57
57
  function xe(e, t) {
@@ -59,51 +59,51 @@ function xe(e, t) {
59
59
  e.fillStyle = t.fill, e.strokeStyle = t.stroke, e.lineWidth = t.strokeWidth, e.beginPath(), e.roundRect(t.x, t.y, t.w, t.h, t.radius), e.fill(), e.stroke();
60
60
  }), e.restore();
61
61
  }
62
- function Se(t, n, r, i, a = !0) {
63
- if (t.save(), t.globalAlpha = n.alpha, t.beginPath(), t.moveTo(n.x1, n.y1), n.curve ? t.quadraticCurveTo(n.curve.cx, n.curve.cy, n.x2, n.y2) : t.lineTo(n.x2, n.y2), t.strokeStyle = n.color, t.lineWidth = n.mark && n.mark !== "none" ? Math.max(n.width, w.edge / i) : n.width, t.setLineDash(n.dash || []), n.glow && n.glow * i >= _e) {
64
- let e = t.lineWidth;
65
- t.save(), t.globalAlpha = n.alpha * .3, t.strokeStyle = n.glowColor || n.color, t.lineWidth = e + n.glow * .6, t.stroke(), t.restore();
62
+ function Se(e, t, n, r, i = !0) {
63
+ if (e.save(), e.globalAlpha = t.alpha, e.beginPath(), e.moveTo(t.x1, t.y1), t.curve ? e.quadraticCurveTo(t.curve.cx, t.curve.cy, t.x2, t.y2) : e.lineTo(t.x2, t.y2), e.strokeStyle = t.color, e.lineWidth = t.mark && t.mark !== "none" ? Math.max(t.width, J.edge / r) : t.width, e.setLineDash(t.dash || []), t.glow && t.glow * r >= ge) {
64
+ let n = e.lineWidth;
65
+ e.save(), e.globalAlpha = t.alpha * .3, e.strokeStyle = t.glowColor || t.color, e.lineWidth = n + t.glow * .6, e.stroke(), e.restore();
66
66
  }
67
- if (t.stroke(), t.setLineDash([]), n.mark === "removed") {
68
- let r = e(n, .5), a = Math.hypot(n.x2 - n.x1, n.y2 - n.y1), [o, s] = a > 0 ? [(n.x2 - n.x1) / a, (n.y2 - n.y1) / a] : [1, 0];
69
- t.beginPath(), t.moveTo(r.x - s * S.halfLength, r.y + o * S.halfLength), t.lineTo(r.x + s * S.halfLength, r.y - o * S.halfLength), t.lineWidth = Math.max(S.width, 1.5 / i), t.stroke();
67
+ if (e.stroke(), e.setLineDash([]), t.mark === "removed") {
68
+ let n = ae(t, .5), i = Math.hypot(t.x2 - t.x1, t.y2 - t.y1), [a, o] = i > 0 ? [(t.x2 - t.x1) / i, (t.y2 - t.y1) / i] : [1, 0];
69
+ e.beginPath(), e.moveTo(n.x - o * H.halfLength, n.y + a * H.halfLength), e.lineTo(n.x + o * H.halfLength, n.y - a * H.halfLength), e.lineWidth = Math.max(H.width, 1.5 / r), e.stroke();
70
70
  }
71
- if (n.ticks && we(t, n, i), n.arrow) {
72
- let { cx: e, cy: r } = n.curve || {
73
- cx: n.x1,
74
- cy: n.y1
71
+ if (t.ticks && we(e, t, r), t.arrow) {
72
+ let { cx: n, cy: i } = t.curve || {
73
+ cx: t.x1,
74
+ cy: t.y1
75
75
  };
76
- Ce(t, n, Math.atan2(n.y2 - r, n.x2 - e), i);
76
+ Ce(e, t, Math.atan2(t.y2 - i, t.x2 - n), r);
77
77
  }
78
- a && n.packet && Te(t, n, r, i), t.restore();
78
+ i && t.packet && Te(e, t, n, r), e.restore();
79
79
  }
80
80
  function Ce(e, t, n, r) {
81
- let i = t.end || "triangle", { x2: a, y2: o, color: l } = t, u = Math.cos(n), d = Math.sin(n), f = (e, t) => [a - u * e - d * t, o - d * e + u * t], p = Math.max(s.strokeWidth, 1.2 / r);
82
- if (e.beginPath(), i === "triangle") e.moveTo(a, o), e.lineTo(a - Math.cos(n - c.spread) * c.length, o - Math.sin(n - c.spread) * c.length), e.lineTo(a - Math.cos(n + c.spread) * c.length, o - Math.sin(n + c.spread) * c.length), e.closePath(), e.fillStyle = l, e.fill();
81
+ let i = t.end || "triangle", { x2: a, y2: o, color: s } = t, c = Math.cos(n), l = Math.sin(n), u = (e, t) => [a - c * e - l * t, o - l * e + c * t], d = Math.max(B.strokeWidth, 1.2 / r);
82
+ if (e.beginPath(), i === "triangle") e.moveTo(a, o), e.lineTo(a - Math.cos(n - M.spread) * M.length, o - Math.sin(n - M.spread) * M.length), e.lineTo(a - Math.cos(n + M.spread) * M.length, o - Math.sin(n + M.spread) * M.length), e.closePath(), e.fillStyle = s, e.fill();
83
83
  else {
84
- if (e.strokeStyle = l, e.lineWidth = p, e.lineJoin = "miter", i === "chevron") {
85
- let t = c.length * Math.cos(c.spread), n = c.length * Math.sin(c.spread);
86
- e.moveTo(...f(t, n)), e.lineTo(a, o), e.lineTo(...f(t, -n));
87
- } else if (i === "bar") e.moveTo(...f(p / 2, s.barHalf)), e.lineTo(...f(p / 2, -s.barHalf));
84
+ if (e.strokeStyle = s, e.lineWidth = d, e.lineJoin = "miter", i === "chevron") {
85
+ let t = M.length * Math.cos(M.spread), n = M.length * Math.sin(M.spread);
86
+ e.moveTo(...u(t, n)), e.lineTo(a, o), e.lineTo(...u(t, -n));
87
+ } else if (i === "bar") e.moveTo(...u(d / 2, B.barHalf)), e.lineTo(...u(d / 2, -B.barHalf));
88
88
  else {
89
- let t = s.diamondHalf;
90
- e.moveTo(a, o), e.lineTo(...f(t, s.diamondAcross)), e.lineTo(...f(2 * t, 0)), e.lineTo(...f(t, -s.diamondAcross)), e.closePath();
89
+ let t = B.diamondHalf;
90
+ e.moveTo(a, o), e.lineTo(...u(t, B.diamondAcross)), e.lineTo(...u(2 * t, 0)), e.lineTo(...u(t, -B.diamondAcross)), e.closePath();
91
91
  }
92
92
  e.stroke();
93
93
  }
94
94
  }
95
- function we(t, n, r) {
96
- let i = Math.hypot(n.x2 - n.x1, n.y2 - n.y1), [a, o] = i > 0 ? [(n.x2 - n.x1) / i, (n.y2 - n.y1) / i] : [1, 0], c = e(n, .5);
97
- t.beginPath();
98
- for (let e = 0; e < n.ticks; e++) {
99
- let r = (e - (n.ticks - 1) / 2) * s.tickGap, i = c.x + a * r, l = c.y + o * r;
100
- t.moveTo(i - o * s.tickHalf, l + a * s.tickHalf), t.lineTo(i + o * s.tickHalf, l - a * s.tickHalf);
95
+ function we(e, t, n) {
96
+ let r = Math.hypot(t.x2 - t.x1, t.y2 - t.y1), [i, a] = r > 0 ? [(t.x2 - t.x1) / r, (t.y2 - t.y1) / r] : [1, 0], o = ae(t, .5);
97
+ e.beginPath();
98
+ for (let n = 0; n < t.ticks; n++) {
99
+ let r = (n - (t.ticks - 1) / 2) * B.tickGap, s = o.x + i * r, c = o.y + a * r;
100
+ e.moveTo(s - a * B.tickHalf, c + i * B.tickHalf), e.lineTo(s + a * B.tickHalf, c - i * B.tickHalf);
101
101
  }
102
- t.strokeStyle = n.color, t.lineWidth = Math.max(s.tickWidth, 1.5 / r), t.setLineDash([]), t.stroke();
102
+ e.strokeStyle = t.color, e.lineWidth = Math.max(B.tickWidth, 1.5 / n), e.setLineDash([]), e.stroke();
103
103
  }
104
104
  function Te(e, t, n, r) {
105
- let i = O(t, n), { packet: a } = t;
106
- a.glow && a.glow * r >= _e && (e.beginPath(), e.arc(i.x, i.y, a.radius + a.glow * .5, 0, ge), e.globalAlpha = t.alpha * .3, e.fillStyle = a.glowColor || a.color, e.fill(), e.globalAlpha = t.alpha), e.beginPath(), e.arc(i.x, i.y, a.radius, 0, ge), e.fillStyle = a.color, e.fill();
105
+ let i = R(t, n), { packet: a } = t;
106
+ a.glow && a.glow * r >= ge && (e.beginPath(), e.arc(i.x, i.y, a.radius + a.glow * .5, 0, he), e.globalAlpha = t.alpha * .3, e.fillStyle = a.glowColor || a.color, e.fill(), e.globalAlpha = t.alpha), e.beginPath(), e.arc(i.x, i.y, a.radius, 0, he), e.fillStyle = a.color, e.fill();
107
107
  }
108
108
  function Ee(e, t, n, r) {
109
109
  e.save(), e.globalAlpha = t.alpha, Te(e, t, n, r), e.restore();
@@ -121,75 +121,75 @@ function Ae(e, t, n, r) {
121
121
  for (let t = 0; t < e.edges.length; t++) i[t * 4 + 2] < s || i[t * 4] > l || i[t * 4 + 3] < c || i[t * 4 + 1] > u || d.push(e.edges[t]);
122
122
  return d;
123
123
  }
124
- function je(e, t, n, r, a) {
124
+ function je(e, t, n, r, i) {
125
125
  e.save(), e.globalAlpha = t.alpha;
126
- let o = r.halo[t.halo];
127
- o && (o.fill && (J(e, t.x, t.y, t.r + o.fillR), e.fillStyle = o.fill, e.fill()), J(e, t.x, t.y, t.r + o.ringR), e.strokeStyle = o.ring, e.lineWidth = o.ringWidth, e.stroke());
128
- let s = r.mark[t.mark];
129
- if (s) {
130
- let r = t.r + Math.max(s.ringR, w.gap / n);
131
- J(e, t.x, t.y, r), e.strokeStyle = s.color, e.lineWidth = Math.max(s.ringWidth, w.ring / n), e.setLineDash(s.ringDash || []), e.stroke(), e.setLineDash([]), t.mark === "removed" && (e.beginPath(), e.moveTo(t.x - r, t.y), e.lineTo(t.x + r, t.y), e.stroke());
132
- }
133
- ve(e, t.shape, t.x, t.y, t.r), t.glow && t.glow * n >= _e && (e.save(), e.globalAlpha = t.alpha * .28, J(e, t.x, t.y, t.r + t.glow * .7), e.fillStyle = t.color, e.fill(), e.restore(), ve(e, t.shape, t.x, t.y, t.r)), e.fillStyle = t.color, e.fill();
134
- let c = t.icon && a.icons ? a.icons.get(t.icon) : null, u = !c && pe(t, n), d = !c && !u && i(t, n) ? oe(t.glyph, v(t, a)) : null;
135
- if (d || (J(e, t.x, t.y, t.r * b), e.fillStyle = r.core, e.fill()), t.stroke && (ve(e, t.shape, t.x, t.y, Math.max(0, t.r - t.stroke.width / 2)), e.strokeStyle = t.stroke.color, e.lineWidth = t.stroke.width, e.stroke()), c) {
136
- let n = t.r * l;
137
- e.imageSmoothingEnabled = !a.pixelated, e.drawImage(c, t.x - n / 2, t.y - n / 2, n, n);
138
- } else if (u) {
139
- let n = he(t.letters, a.values && a.values["--corn-map-glyph"]);
126
+ let a = r.halo[t.halo];
127
+ a && (a.fill && (_e(e, t.x, t.y, t.r + a.fillR), e.fillStyle = a.fill, e.fill()), _e(e, t.x, t.y, t.r + a.ringR), e.strokeStyle = a.ring, e.lineWidth = a.ringWidth, e.stroke());
128
+ let o = r.mark[t.mark];
129
+ if (o) {
130
+ let r = t.r + Math.max(o.ringR, J.gap / n);
131
+ _e(e, t.x, t.y, r), e.strokeStyle = o.color, e.lineWidth = Math.max(o.ringWidth, J.ring / n), e.setLineDash(o.ringDash || []), e.stroke(), e.setLineDash([]), t.mark === "removed" && (e.beginPath(), e.moveTo(t.x - r, t.y), e.lineTo(t.x + r, t.y), e.stroke());
132
+ }
133
+ ve(e, t.shape, t.x, t.y, t.r), t.glow && t.glow * n >= ge && (e.save(), e.globalAlpha = t.alpha * .28, _e(e, t.x, t.y, t.r + t.glow * .7), e.fillStyle = t.color, e.fill(), e.restore(), ve(e, t.shape, t.x, t.y, t.r)), e.fillStyle = t.color, e.fill();
134
+ let s = t.icon && i.icons ? i.icons.get(t.icon) : null, l = !s && fe(t, n), u = !s && !l && w(t, n) ? S(t.glyph, c(t, i)) : null;
135
+ if (u || (_e(e, t.x, t.y, t.r * P), e.fillStyle = r.core, e.fill()), t.stroke && (ve(e, t.shape, t.x, t.y, Math.max(0, t.r - t.stroke.width / 2)), e.strokeStyle = t.stroke.color, e.lineWidth = t.stroke.width, e.stroke()), s) {
136
+ let n = t.r * G;
137
+ e.imageSmoothingEnabled = !i.pixelated, e.drawImage(s, t.x - n / 2, t.y - n / 2, n, n);
138
+ } else if (l) {
139
+ let n = me(t.letters, i.values && i.values["--corn-map-glyph"]);
140
140
  if (n) {
141
141
  let r = t.r * 1;
142
142
  e.imageSmoothingEnabled = !0, e.drawImage(n, t.x - r / 2, t.y - r / 2, r, r);
143
143
  }
144
- } else if (d) {
145
- let n = t.r * G;
146
- e.imageSmoothingEnabled = !0, e.drawImage(d, t.x - n / 2, t.y - n / 2, n, n);
144
+ } else if (u) {
145
+ let n = t.r * x;
146
+ e.imageSmoothingEnabled = !0, e.drawImage(u, t.x - n / 2, t.y - n / 2, n, n);
147
147
  }
148
148
  e.restore();
149
149
  }
150
150
  function Me(e, t = {}) {
151
- let n = t.mapStyle || (() => d), r = e.getContext("2d"), i = 0, a = 0, o = 1, s = null, c = null, l = null, u = () => {
152
- if (s) return s;
151
+ let r = t.mapStyle || (() => L), i = e.getContext("2d"), a = 0, o = 0, s = 1, c = null, l = null, u = null, d = () => {
152
+ if (c) return c;
153
153
  try {
154
- s = typeof OffscreenCanvas < "u" ? new OffscreenCanvas(e.width || 1, e.height || 1) : e.ownerDocument ? e.ownerDocument.createElement("canvas") : null, c = s && s.getContext ? s.getContext("2d") : null;
154
+ c = typeof OffscreenCanvas < "u" ? new OffscreenCanvas(e.width || 1, e.height || 1) : e.ownerDocument ? e.ownerDocument.createElement("canvas") : null, l = c && c.getContext ? c.getContext("2d") : null;
155
155
  } catch {
156
- c = null;
156
+ l = null;
157
157
  }
158
- return c || (s = null), s;
158
+ return l || (c = null), c;
159
159
  }, f = t.layerMinEdges ?? 600, p = /* @__PURE__ */ new WeakMap(), m = (e) => (p.has(e) || p.set(e, e.edges.some((e) => e.packet)), p.get(e));
160
160
  function h(e, t, n) {
161
161
  e.save(), e.translate(n.x, n.y), e.scale(n.zoom, n.zoom);
162
162
  let { decor: r } = t;
163
- r.grid && ye(e, r.grid, n, i, a), r.lanes.length && xe(e, r.lanes), r.rings.length && be(e, r.rings), Ae(t, n, i, a).forEach((t) => Se(e, t, 0, n.zoom, !1)), e.restore();
163
+ r.grid && ye(e, r.grid, n, a, o), r.lanes.length && xe(e, r.lanes), r.rings.length && be(e, r.rings), Ae(t, n, a, o).forEach((t) => Se(e, t, 0, n.zoom, !1)), e.restore();
164
164
  }
165
165
  return {
166
166
  kind: "canvas2d",
167
- resize(t, n, u) {
168
- i = t, a = n, o = u, e.width = t * u, e.height = n * u, r.setTransform(u, 0, 0, u, 0, 0), l = null, s && (s.width = e.width, s.height = e.height, c.setTransform(u, 0, 0, u, 0, 0));
167
+ resize(t, n, r) {
168
+ a = t, o = n, s = r, e.width = t * r, e.height = n * r, i.setTransform(r, 0, 0, r, 0, 0), u = null, c && (c.width = e.width, c.height = e.height, l.setTransform(r, 0, 0, r, 0, 0));
169
169
  },
170
- draw(t, d, p) {
171
- let g = n(), _ = x(t, g);
172
- r.clearRect(0, 0, i, a);
173
- let v = ce(P(_.theme), g), y = Ae(_, d, i, a);
174
- if (m(_) && y.length > f && u()) {
175
- l && l.scene === _ && l.x === d.x && l.y === d.y && l.zoom === d.zoom && l.w === e.width && l.h === e.height || ((s.width !== e.width || s.height !== e.height) && (s.width = e.width, s.height = e.height), c.setTransform(o, 0, 0, o, 0, 0), c.clearRect(0, 0, i, a), h(c, _, d), l = {
176
- scene: _,
177
- x: d.x,
178
- y: d.y,
179
- zoom: d.zoom,
170
+ draw(t, p, g) {
171
+ let _ = r(), v = ie(t, _);
172
+ i.clearRect(0, 0, a, o);
173
+ let y = j(n(v.theme), _), b = Ae(v, p, a, o);
174
+ if (m(v) && b.length > f && d()) {
175
+ u && u.scene === v && u.x === p.x && u.y === p.y && u.zoom === p.zoom && u.w === e.width && u.h === e.height || ((c.width !== e.width || c.height !== e.height) && (c.width = e.width, c.height = e.height), l.setTransform(s, 0, 0, s, 0, 0), l.clearRect(0, 0, a, o), h(l, v, p), u = {
176
+ scene: v,
177
+ x: p.x,
178
+ y: p.y,
179
+ zoom: p.zoom,
180
180
  w: e.width,
181
181
  h: e.height
182
- }), r.save(), r.setTransform(1, 0, 0, 1, 0, 0), r.drawImage(s, 0, 0), r.restore(), r.save(), r.translate(d.x, d.y), r.scale(d.zoom, d.zoom), y.forEach((e) => {
183
- e.packet && Ee(r, e, p, d.zoom);
184
- }), _.nodes.forEach((e) => je(r, e, d.zoom, v, g)), r.restore();
182
+ }), i.save(), i.setTransform(1, 0, 0, 1, 0, 0), i.drawImage(c, 0, 0), i.restore(), i.save(), i.translate(p.x, p.y), i.scale(p.zoom, p.zoom), b.forEach((e) => {
183
+ e.packet && Ee(i, e, g, p.zoom);
184
+ }), v.nodes.forEach((e) => je(i, e, p.zoom, y, _)), i.restore();
185
185
  return;
186
186
  }
187
- r.save(), r.translate(d.x, d.y), r.scale(d.zoom, d.zoom);
188
- let { decor: b } = _;
189
- b.grid && ye(r, b.grid, d, i, a), b.lanes.length && xe(r, b.lanes), b.rings.length && be(r, b.rings), y.forEach((e) => Se(r, e, p, d.zoom)), _.nodes.forEach((e) => je(r, e, d.zoom, v, g)), r.restore();
187
+ i.save(), i.translate(p.x, p.y), i.scale(p.zoom, p.zoom);
188
+ let { decor: x } = v;
189
+ x.grid && ye(i, x.grid, p, a, o), x.lanes.length && xe(i, x.lanes), x.rings.length && be(i, x.rings), b.forEach((e) => Se(i, e, g, p.zoom)), v.nodes.forEach((e) => je(i, e, p.zoom, y, _)), i.restore();
190
190
  },
191
191
  destroy() {
192
- s = null, c = null, l = null;
192
+ c = null, l = null, u = null;
193
193
  }
194
194
  };
195
195
  }
@@ -335,7 +335,7 @@ function He(e) {
335
335
  };
336
336
  return x;
337
337
  }
338
- var Ue = 1, We = .3, Ge = .58, Ke = 3, qe = 100, Y = 64, X = {
338
+ var Ue = 1, We = .3, Ge = .58, Ke = 3, qe = 100, X = 64, Z = {
339
339
  selected: 0,
340
340
  current: 1,
341
341
  match: 2,
@@ -344,7 +344,7 @@ var Ue = 1, We = .3, Ge = .58, Ke = 3, qe = 100, Y = 64, X = {
344
344
  hub: 5,
345
345
  rest: 6,
346
346
  greyed: 7
347
- }, Je = 1.5, Ye = (e) => Number.isFinite(e) && e >= 9 ? Math.max(11, e) : 11, Xe = (e) => Ye(e.labelMin), Ze = (e) => u.includes(e.type) && !e.greyed, Qe = (e, t) => e.selected ? X.selected : e.current ? X.current : e.match ? X.match : t && e.connected ? X.lit : e.mark && e.mark !== "none" || e.labelKeep && !Ze(e) ? X.marked : e.greyed ? X.greyed : Ze(e) ? X.hub : X.rest;
347
+ }, Je = 1.5, Ye = (e) => Number.isFinite(e) && e >= 9 ? Math.max(11, e) : 11, Xe = (e) => Ye(e.labelMin), Ze = (e) => k.includes(e.type) && !e.greyed, Qe = (e, t) => e.selected ? Z.selected : e.current ? Z.current : e.match ? Z.match : t && e.connected ? Z.lit : e.mark && e.mark !== "none" || e.labelKeep && !Ze(e) ? Z.marked : e.greyed ? Z.greyed : Ze(e) ? Z.hub : Z.rest;
348
348
  function $e(e, t, n = {}) {
349
349
  let { measure: r = null } = n, i = Xe(e), a = e.nodes.some((e) => e.selected || !e.connected), o = [];
350
350
  e.nodes.forEach((e, t) => {
@@ -356,7 +356,7 @@ function $e(e, t, n = {}) {
356
356
  }), o.sort((e, t) => e.tier - t.tier || t.node.r - e.node.r || (t.node.degree || 0) - (e.node.degree || 0) || e.index - t.index);
357
357
  let s = /* @__PURE__ */ new Map(), c = (e, t) => (e + 8192) * 16384 + (t + 8192), l = [], u = Math.max(Ke, Ke * t);
358
358
  for (let { node: e, index: n, tier: a } of o) {
359
- let o = Ze(e), d = !e.greyed && (!!e.labelBold || o), f = Math.max(o ? i + 2 : i, e.labelSize * t), p = r ? r(e.label, qe, d) * f / qe : e.label.length * f * Ge, m = e.x * t, h = e.y * t + e.r * t + u + f, g = m - p / 2, _ = m + p / 2, v = h - f * Ue, y = h + f * We, b = a === X.greyed ? 2 + f * Je : 2, x = Math.floor((g - b) / Y), S = Math.floor((_ + b) / Y), C = Math.floor((v - b) / Y), w = Math.floor((y + b) / Y), T = !1;
359
+ let o = Ze(e), d = !e.greyed && (!!e.labelBold || o), f = Math.max(o ? i + 2 : i, e.labelSize * t), p = r ? r(e.label, qe, d) * f / qe : e.label.length * f * Ge, m = e.x * t, h = e.y * t + e.r * t + u + f, g = m - p / 2, _ = m + p / 2, v = h - f * Ue, y = h + f * We, b = a === Z.greyed ? 2 + f * Je : 2, x = Math.floor((g - b) / X), S = Math.floor((_ + b) / X), C = Math.floor((v - b) / X), w = Math.floor((y + b) / X), T = !1;
360
360
  for (let e = x; e <= S && !T; e++) for (let t = C; t <= w && !T; t++) {
361
361
  let n = s.get(c(e, t));
362
362
  if (n) for (let e = 0; e < n.length; e++) {
@@ -386,21 +386,21 @@ function $e(e, t, n = {}) {
386
386
  b: y
387
387
  };
388
388
  l.push(E);
389
- let D = Math.floor(g / Y), O = Math.floor(_ / Y), ee = Math.floor(v / Y), k = Math.floor(y / Y);
390
- for (let e = D; e <= O; e++) for (let t = ee; t <= k; t++) {
389
+ let D = Math.floor(g / X), O = Math.floor(_ / X), k = Math.floor(v / X), A = Math.floor(y / X);
390
+ for (let e = D; e <= O; e++) for (let t = k; t <= A; t++) {
391
391
  let n = c(e, t), r = s.get(n);
392
392
  r ? r.push(E) : s.set(n, [E]);
393
393
  }
394
394
  }
395
395
  return l;
396
396
  }
397
- function et(e, t, n, r = {}) {
398
- let { max: i = 400, margin: a = 32, measure: o = null, hover: s = null } = r, c = [], l = e.labelOutline || P(e.theme).labelOutline;
397
+ function et(e, t, r, i = {}) {
398
+ let { max: a = 400, margin: o = 32, measure: s = null, hover: c = null } = i, l = [], u = e.labelOutline || n(e.theme).labelOutline;
399
399
  for (let t of e.decor.lanes) for (let n of [
400
400
  t.title,
401
401
  t.note,
402
402
  t.arrow
403
- ]) n && c.push({
403
+ ]) n && l.push({
404
404
  kind: "lane",
405
405
  text: n.text,
406
406
  x: n.x,
@@ -414,12 +414,12 @@ function et(e, t, n, r = {}) {
414
414
  align: "center",
415
415
  family: e.labelFont || "\"Segoe UI\", -apple-system, BlinkMacSystemFont, Roboto, sans-serif"
416
416
  });
417
- let { zoom: u } = t, d = r.placed || $e(e, u, { measure: o }), f = -a - t.x, p = n.width + a - t.x, m = -a - t.y, h = n.height + a - t.y, g = d.filter((e) => e.r >= f && e.l <= p && e.b >= m && e.t <= h);
418
- g.length > i && (g = g.slice(0, Math.max(0, i))), g.sort((e, t) => e.index - t.index);
419
- let _ = e.labelFont || "\"Segoe UI\", -apple-system, BlinkMacSystemFont, Roboto, sans-serif";
420
- for (let e of g) {
421
- let t = Math.max(1, 1 / u);
422
- c.push({
417
+ let { zoom: d } = t, f = i.placed || $e(e, d, { measure: s }), p = -o - t.x, m = r.width + o - t.x, h = -o - t.y, g = r.height + o - t.y, _ = f.filter((e) => e.r >= p && e.l <= m && e.b >= h && e.t <= g);
418
+ _.length > a && (_ = _.slice(0, Math.max(0, a))), _.sort((e, t) => e.index - t.index);
419
+ let v = e.labelFont || "\"Segoe UI\", -apple-system, BlinkMacSystemFont, Roboto, sans-serif";
420
+ for (let e of _) {
421
+ let t = Math.max(1, 1 / d);
422
+ l.push({
423
423
  kind: "node",
424
424
  id: e.id,
425
425
  text: e.node.label,
@@ -430,87 +430,87 @@ function et(e, t, n, r = {}) {
430
430
  italic: !1,
431
431
  color: e.node.labelColor,
432
432
  alpha: e.node.labelAlpha,
433
- outline: l.node ? {
434
- color: l.node.color,
435
- width: l.node.width * t
433
+ outline: u.node ? {
434
+ color: u.node.color,
435
+ width: u.node.width * t
436
436
  } : null,
437
437
  align: "center",
438
- family: _,
438
+ family: v,
439
439
  strike: !!e.node.labelStrike,
440
440
  px: e.px,
441
441
  screen: e.screen
442
442
  });
443
443
  }
444
- let v = Xe(e), y = g.map((e) => ({
444
+ let y = Xe(e), b = _.map((e) => ({
445
445
  l: t.x + e.l,
446
446
  r: t.x + e.r,
447
447
  t: t.y + e.t,
448
448
  b: t.y + e.b
449
449
  }));
450
- for (let r of e.nodes) {
451
- if (r.alpha < .5) continue;
452
- let e = t.x + r.x * u, i = t.y + r.y * u, a = r.r * u;
453
- e + a < 0 || e - a > n.width || i + a < 0 || i - a > n.height || y.push({
450
+ for (let n of e.nodes) {
451
+ if (n.alpha < .5) continue;
452
+ let e = t.x + n.x * d, i = t.y + n.y * d, a = n.r * d;
453
+ e + a < 0 || e - a > r.width || i + a < 0 || i - a > r.height || b.push({
454
454
  l: e - a,
455
455
  r: e + a,
456
456
  t: i - a,
457
457
  b: i + a
458
458
  });
459
459
  }
460
- let b = 0;
461
- for (let r of e.edges) {
462
- let i = r.label;
463
- if (!i || b >= 120) continue;
464
- let a = t.x + i.x * u, s = t.y + i.y * u;
465
- if (a < 0 || a > n.width || s < 0 || s > n.height) continue;
466
- let d = (o ? o(i.text, v, !1) : i.text.length * v * .55) / 2 + 2, f = {
467
- l: a - d,
468
- r: a + d,
469
- t: s - v * .6 - 2,
470
- b: s + v * .6 + 2
460
+ let x = 0;
461
+ for (let n of e.edges) {
462
+ let i = n.label;
463
+ if (!i || x >= 120) continue;
464
+ let a = t.x + i.x * d, o = t.y + i.y * d;
465
+ if (a < 0 || a > r.width || o < 0 || o > r.height) continue;
466
+ let c = (s ? s(i.text, y, !1) : i.text.length * y * .55) / 2 + 2, f = {
467
+ l: a - c,
468
+ r: a + c,
469
+ t: o - y * .6 - 2,
470
+ b: o + y * .6 + 2
471
471
  };
472
- y.some((e) => f.l < e.r && f.r > e.l && f.t < e.b && f.b > e.t) || (y.push(f), b++, c.push({
472
+ b.some((e) => f.l < e.r && f.r > e.l && f.t < e.b && f.b > e.t) || (b.push(f), x++, l.push({
473
473
  kind: "edge",
474
474
  text: i.text,
475
475
  x: i.x,
476
- y: i.y + v * .35 / u,
477
- size: v / u,
478
- px: v,
476
+ y: i.y + y * .35 / d,
477
+ size: y / d,
478
+ px: y,
479
479
  screen: !0,
480
480
  bold: !1,
481
481
  italic: !!i.italic,
482
482
  color: i.color,
483
- alpha: r.alpha,
484
- outline: l.edge,
483
+ alpha: n.alpha,
484
+ outline: u.edge,
485
485
  align: "center",
486
486
  family: e.labelFont || "\"Segoe UI\", -apple-system, sans-serif"
487
487
  }));
488
488
  }
489
- if (s) {
490
- let n = e.nodes.find((e) => e.id === s);
491
- if (n && n.label && !d.some((e) => e.id === s && g.includes(e))) {
492
- let r = Xe(e), i = t.y + n.y * u - n.r * u > 40 ? n.y - n.r - 5 / u : n.y + n.r + (5 + r) / u;
493
- c.push({
489
+ if (c) {
490
+ let n = e.nodes.find((e) => e.id === c);
491
+ if (n && n.label && !f.some((e) => e.id === c && _.includes(e))) {
492
+ let r = Xe(e), i = t.y + n.y * d - n.r * d > 40 ? n.y - n.r - 5 / d : n.y + n.r + (5 + r) / d;
493
+ l.push({
494
494
  kind: "chip",
495
495
  id: n.id,
496
496
  text: n.label,
497
497
  x: n.x,
498
498
  y: i,
499
- size: r / u,
499
+ size: r / d,
500
500
  px: r,
501
501
  screen: !0,
502
502
  bold: !1,
503
503
  italic: !1,
504
504
  color: (e.nodes.find((e) => e.connected) || n).labelColor,
505
505
  alpha: 1,
506
- outline: l.node,
506
+ outline: u.node,
507
507
  align: "center",
508
- family: _,
508
+ family: v,
509
509
  strike: !1
510
510
  });
511
511
  }
512
512
  }
513
- return c;
513
+ return l;
514
514
  }
515
515
  var tt = (e) => `${e.italic ? "italic " : ""}${e.bold ? "bold " : ""}${e.screen ? e.px : e.size}px ${e.family}`, nt = {
516
516
  ox: 0,
@@ -557,58 +557,58 @@ function ot(e, t, n, r) {
557
557
  return i ? i.id : null;
558
558
  }
559
559
  function st(e, t = {}) {
560
- let n = t.mapStyle || (() => d), r = e.getContext("2d"), i = 0, a = 0, o = 1, s = null, c, l, u, f, p, m, h = null, g = !0, _ = !1, v = /* @__PURE__ */ new Map(), y = z, b = (e, t, n) => {
561
- let i = `${n ? "b" : "n"}${t}|${y}|${e}`, a = v.get(i);
562
- return a === void 0 && (v.size > 2e4 && v.clear(), r.font = tt({
560
+ let n = t.mapStyle || (() => L), r = e.getContext("2d"), i = 0, a = 0, o = 1, s = null, c, l, u, d, f, p, m = null, h = !0, g = !1, _ = /* @__PURE__ */ new Map(), v = F, y = (e, t, n) => {
561
+ let i = `${n ? "b" : "n"}${t}|${v}|${e}`, a = _.get(i);
562
+ return a === void 0 && (_.size > 2e4 && _.clear(), r.font = tt({
563
563
  italic: !1,
564
564
  bold: n,
565
565
  size: t,
566
- family: y
567
- }), a = r.measureText(e).width, v.set(i, a)), a;
566
+ family: v
567
+ }), a = r.measureText(e).width, _.set(i, a)), a;
568
568
  };
569
569
  return {
570
570
  hit(e, t) {
571
- return h && s ? ot(h, {
571
+ return m && s ? ot(m, {
572
572
  x: l,
573
573
  y: u,
574
- zoom: f
574
+ zoom: d
575
575
  }, e, t) : null;
576
576
  },
577
577
  resize(t, n, s) {
578
- i = t, a = n, o = s, e.width = t * s, e.height = n * s, r.setTransform(s, 0, 0, s, 0, 0), g = !0;
578
+ i = t, a = n, o = s, e.width = t * s, e.height = n * s, r.setTransform(s, 0, 0, s, 0, 0), h = !0;
579
579
  },
580
- draw(e, t, d = {}) {
581
- if (_) return !1;
582
- let v = n(), S = v.plain ? 0 : v.version, C = d.hover || null;
583
- if (!g && e === s && e.version === c && t.x === l && t.y === u && t.zoom === f && S === p && C === m) return !1;
584
- let w = h && e === s && e.version === c && t.zoom === f && S === p && !g;
585
- s = e, c = e.version, l = t.x, u = t.y, f = t.zoom, p = S, m = C, g = !1;
586
- let T = x(e, v);
587
- y = T.labelFont || "\"Segoe UI\", -apple-system, BlinkMacSystemFont, Roboto, sans-serif", r.setTransform(o, 0, 0, o, 0, 0), r.clearRect(0, 0, i, a), r.save(), r.translate(t.x, t.y), r.scale(t.zoom, t.zoom), w || (h = $e(T, t.zoom, { measure: b }));
588
- let E = et(T, t, {
580
+ draw(e, t, _ = {}) {
581
+ if (g) return !1;
582
+ let b = n(), x = b.plain ? 0 : b.version, S = _.hover || null;
583
+ if (!h && e === s && e.version === c && t.x === l && t.y === u && t.zoom === d && x === f && S === p) return !1;
584
+ let C = m && e === s && e.version === c && t.zoom === d && x === f && !h;
585
+ s = e, c = e.version, l = t.x, u = t.y, d = t.zoom, f = x, p = S, h = !1;
586
+ let w = ie(e, b);
587
+ v = w.labelFont || "\"Segoe UI\", -apple-system, BlinkMacSystemFont, Roboto, sans-serif", r.setTransform(o, 0, 0, o, 0, 0), r.clearRect(0, 0, i, a), r.save(), r.translate(t.x, t.y), r.scale(t.zoom, t.zoom), C || (m = $e(w, t.zoom, { measure: y }));
588
+ let T = et(w, t, {
589
589
  width: i,
590
590
  height: a
591
591
  }, {
592
- measure: b,
593
- hover: C,
594
- placed: h
595
- }), D = it();
596
- for (let e of E) e.kind === "lane" && at(r, e, D);
597
- for (let e of E) e.kind === "node" && !e.screen && at(r, e, D);
592
+ measure: y,
593
+ hover: S,
594
+ placed: m
595
+ }), E = it();
596
+ for (let e of T) e.kind === "lane" && at(r, e, E);
597
+ for (let e of T) e.kind === "node" && !e.screen && at(r, e, E);
598
598
  r.restore();
599
- let O = {
599
+ let D = {
600
600
  ox: t.x,
601
601
  oy: t.y,
602
602
  k: t.zoom
603
603
  };
604
- D = it();
605
- for (let e of E) e.kind === "node" && e.screen && at(r, e, D, O);
606
- for (let e of E) e.kind === "edge" && at(r, e, D, O);
607
- for (let e of E) e.kind === "chip" && at(r, e, D, O);
604
+ E = it();
605
+ for (let e of T) e.kind === "node" && e.screen && at(r, e, E, D);
606
+ for (let e of T) e.kind === "edge" && at(r, e, E, D);
607
+ for (let e of T) e.kind === "chip" && at(r, e, E, D);
608
608
  return !0;
609
609
  },
610
610
  destroy() {
611
- _ = !0, s = null, h = null, v.clear(), r.setTransform(1, 0, 0, 1, 0, 0), r.clearRect(0, 0, i, a);
611
+ g = !0, s = null, m = null, _.clear(), r.setTransform(1, 0, 0, 1, 0, 0), r.clearRect(0, 0, i, a);
612
612
  }
613
613
  };
614
614
  }
@@ -625,62 +625,62 @@ var ct = [
625
625
  ];
626
626
  function lt(e, t = {}) {
627
627
  if (e.map) return e.map;
628
- let { state: r } = e, i = t.measureCovered || (() => r.coveredBottom || 0), a = n(e).get, o = !1, s = (e) => ie(r, e), c = (e) => ie(r, e, { viewer: !0 }), l = (t, n = e.viewEdges(), i = {
629
- throughChildren: !!r.throughChildren,
630
- kind: r.selectedKind || null
631
- }) => H(t, n, i), u = g((t) => T(t, { reduceMotion: e.reducedMotion })), d = () => u.get(r), f = () => u.builds, p = Ie(), m = () => p.get(d()), h = () => p.builds, _ = null, v = null;
632
- function y() {
633
- return _ && v === r.canvas || (_ && _.destroy(), _ = Me(r.canvas, { mapStyle: a }), v = r.canvas, r.width && _.resize(r.width, r.height, e.dpr())), _;
628
+ let { state: n } = e, r = t.measureCovered || (() => n.coveredBottom || 0), i = ne(e).get, o = !1, c = (e) => h(n, e), l = (e) => h(n, e, { viewer: !0 }), u = (t, r = e.viewEdges(), i = {
629
+ throughChildren: !!n.throughChildren,
630
+ kind: n.selectedKind || null
631
+ }) => s(t, r, i), d = a((t) => _(t, { reduceMotion: e.reducedMotion })), f = () => d.get(n), p = () => d.builds, m = Ie(), g = () => m.get(f()), v = () => m.builds, y = null, b = null;
632
+ function x() {
633
+ return y && b === n.canvas || (y && y.destroy(), y = Me(n.canvas, { mapStyle: i }), b = n.canvas, n.width && y.resize(n.width, n.height, e.dpr())), y;
634
+ }
635
+ let S = null, C = null;
636
+ function w() {
637
+ return n.labelCanvas ? (S && C === n.labelCanvas || (S && S.destroy(), S = st(n.labelCanvas, { mapStyle: i }), C = n.labelCanvas, n.width && S.resize(n.width, n.height, e.dpr())), S) : null;
634
638
  }
635
- let b = null, x = null;
636
- function S() {
637
- return r.labelCanvas ? (b && x === r.labelCanvas || (b && b.destroy(), b = st(r.labelCanvas, { mapStyle: a }), x = r.labelCanvas, r.width && b.resize(r.width, r.height, e.dpr())), b) : null;
639
+ function T(t) {
640
+ y && y !== t && y.destroy(), y = t, b = n.canvas, n.width && y.resize(n.width, n.height, e.dpr()), G();
638
641
  }
639
- function C(t) {
640
- _ && _ !== t && _.destroy(), _ = t, v = r.canvas, r.width && _.resize(r.width, r.height, e.dpr()), V();
642
+ function E() {
643
+ let { canvas: t } = n, r = `${n.width}x${n.height}`;
644
+ n.width = t.parentElement.clientWidth, n.height = t.parentElement.clientHeight, x().resize(n.width, n.height, e.dpr());
645
+ let i = w();
646
+ i && i.resize(n.width, n.height, e.dpr()), r !== `${n.width}x${n.height}` && O(), G();
641
647
  }
642
- function w() {
643
- let { canvas: t } = r, n = `${r.width}x${r.height}`;
644
- r.width = t.parentElement.clientWidth, r.height = t.parentElement.clientHeight, y().resize(r.width, r.height, e.dpr());
645
- let i = S();
646
- i && i.resize(r.width, r.height, e.dpr()), n !== `${r.width}x${r.height}` && D(), V();
647
- }
648
- let E = e.slot("fit", () => ({
648
+ let D = e.slot("fit", () => ({
649
649
  lastFit: null,
650
650
  waiting: null
651
651
  }));
652
- function D() {
653
- if (!r.width || !r.height) return;
654
- if (E.waiting) {
655
- let { padding: e, only: t } = E.waiting;
656
- M(e === null ? N() : e, t);
652
+ function O() {
653
+ if (!n.width || !n.height) return;
654
+ if (D.waiting) {
655
+ let { padding: e, only: t } = D.waiting;
656
+ N(e === null ? P() : e, t);
657
657
  return;
658
658
  }
659
- let { camera: e } = r, t = E.lastFit;
660
- t && e.x === t.x && e.y === t.y && e.zoom === t.zoom && M(t.auto ? N() : t.padding, t.only);
659
+ let { camera: e } = n, t = D.lastFit;
660
+ t && e.x === t.x && e.y === t.y && e.zoom === t.zoom && N(t.auto ? P() : t.padding, t.only);
661
661
  }
662
- function O() {
663
- let t = r.canvas && r.canvas.parentElement, n = e.win && e.win.ResizeObserver;
664
- if (!t || !n) return () => {};
665
- let i = new n(() => {
666
- r.canvas && (t.clientWidth !== r.width || t.clientHeight !== r.height) && w();
662
+ function k() {
663
+ let t = n.canvas && n.canvas.parentElement, r = e.win && e.win.ResizeObserver;
664
+ if (!t || !r) return () => {};
665
+ let i = new r(() => {
666
+ n.canvas && (t.clientWidth !== n.width || t.clientHeight !== n.height) && E();
667
667
  });
668
668
  i.observe(t);
669
669
  let a = () => i.disconnect();
670
670
  return e.own(a), a;
671
671
  }
672
- function ee(e, t = null) {
673
- let { nodes: n, width: a, height: o } = r, c = n.filter(s);
672
+ function A(e, t = null) {
673
+ let { nodes: i, width: a, height: o } = n, s = i.filter(c);
674
674
  if (t) {
675
- let e = c.filter((e) => t.has(e.id));
676
- e.length && (c = e);
675
+ let e = s.filter((e) => t.has(e.id));
676
+ e.length && (s = e);
677
677
  }
678
- if (c.length === 0) return null;
679
- let l = Math.max(160, o - i()), u = Infinity, d = -Infinity, f = Infinity, p = -Infinity;
680
- c.forEach((e) => {
678
+ if (s.length === 0) return null;
679
+ let l = Math.max(160, o - r()), u = Infinity, d = -Infinity, f = Infinity, p = -Infinity;
680
+ s.forEach((e) => {
681
681
  let t = e.r || 18;
682
682
  u = Math.min(u, e.x - t - 25), d = Math.max(d, e.x + t + 25), f = Math.min(f, e.y - t - 25), p = Math.max(p, e.y + t + 35);
683
- }), r.view === "dataflow" && r.flow && (f = Math.min(f, r.flow.top - 10)), r.view === "house" && r.house && r.house.fit && !t && ({minX: u, maxX: d, minY: f, maxY: p} = r.house.fit);
683
+ }), n.view === "dataflow" && n.flow && (f = Math.min(f, n.flow.top - 10)), n.view === "house" && n.house && n.house.fit && !t && ({minX: u, maxX: d, minY: f, maxY: p} = n.house.fit);
684
684
  let m = Math.max(160, a - e * 2), h = Math.max(160, l - e * 2), g = Math.min(m / (d - u), h / (p - f));
685
685
  return {
686
686
  minX: u,
@@ -691,139 +691,142 @@ function lt(e, t = {}) {
691
691
  raw: g
692
692
  };
693
693
  }
694
- let k = "", A = U;
695
- function j() {
696
- let e = `${r.sceneVersion}|${r.width}|${r.height}|${r.view}|${i()}`;
697
- if (e !== k) {
698
- k = e;
699
- let t = ee(N());
700
- A = t && t.raw > 0 && Number.isFinite(t.raw) ? Math.max(I, Math.min(U, t.raw)) : U;
694
+ let ee = "", j = I;
695
+ function M() {
696
+ let e = `${n.sceneVersion}|${n.width}|${n.height}|${n.view}|${r()}`;
697
+ if (e !== ee) {
698
+ ee = e;
699
+ let t = A(P());
700
+ j = t && t.raw > 0 && Number.isFinite(t.raw) ? Math.max(te, Math.min(I, t.raw)) : I;
701
701
  }
702
- return A;
702
+ return j;
703
703
  }
704
- function M(e = 40, t = null) {
705
- let { width: n, height: i, camera: a } = r;
706
- if (!n || !i) {
707
- r.nodes.length && (E.waiting = {
708
- padding: e === N() ? null : e,
704
+ function N(e = 40, t = null) {
705
+ let { width: r, height: i, camera: a } = n;
706
+ if (!r || !i) {
707
+ n.nodes.length && (D.waiting = {
708
+ padding: e === P() ? null : e,
709
709
  only: t
710
710
  });
711
711
  return;
712
712
  }
713
- E.waiting = null;
714
- let o = ee(e, t);
713
+ D.waiting = null;
714
+ let o = A(e, t);
715
715
  if (!o) return;
716
- let { minX: s, maxX: c, minY: l, maxY: u, mapHeight: d } = o, f = Math.min(1, Math.max(I, o.raw));
717
- a.zoom = f, a.x = n / 2 - (s + c) / 2 * f, a.y = d / 2 - (l + u) / 2 * f, E.lastFit = {
716
+ let { minX: s, maxX: c, minY: l, maxY: u, mapHeight: d } = o, f = Math.min(1, Math.max(te, o.raw));
717
+ a.zoom = f, a.x = r / 2 - (s + c) / 2 * f, a.y = d / 2 - (l + u) / 2 * f, D.lastFit = {
718
718
  padding: e,
719
- auto: e === N(),
719
+ auto: e === P(),
720
720
  only: t,
721
721
  x: a.x,
722
722
  y: a.y,
723
723
  zoom: a.zoom
724
- }, V();
725
- }
726
- let N = () => r.width < 640 ? 24 : 48, te = (e, t) => ({
727
- x: (e - r.camera.x) / r.camera.zoom,
728
- y: (t - r.camera.y) / r.camera.zoom
729
- }), P = -1;
730
- function F() {
731
- if (!r.canvas) return;
732
- let e = d();
733
- P = e.version, y().draw(e, r.camera, performance.now());
734
- let t = S();
735
- t && t.draw(e, r.camera, { hover: r.hoverNodeId }), R.forEach((t) => t(e, r.camera));
736
- }
737
- function ne(e, t) {
738
- let n = S();
724
+ }, G();
725
+ }
726
+ let P = () => n.width < 640 ? 24 : 48, F = (e, t) => ({
727
+ x: (e - n.camera.x) / n.camera.zoom,
728
+ y: (t - n.camera.y) / n.camera.zoom
729
+ }), L = -1;
730
+ function R() {
731
+ if (!n.canvas) return;
732
+ let e = f();
733
+ L = e.version, x().draw(e, n.camera, performance.now());
734
+ let t = w();
735
+ t && t.draw(e, n.camera, { hover: n.hoverNodeId }), V.forEach((t) => t(e, n.camera));
736
+ }
737
+ function z(e, t) {
738
+ let n = w();
739
739
  return n ? n.hit(e, t) : null;
740
740
  }
741
- function L(e) {
741
+ function B(e) {
742
742
  let t = e || null;
743
- if (r.hoverNodeId === t) return;
744
- r.hoverNodeId = t;
745
- let n = S();
746
- n && r.canvas && r.width && n.draw(d(), r.camera, { hover: t });
747
- }
748
- let R = /* @__PURE__ */ new Set(), re = (e) => (R.add(e), () => R.delete(e)), z = /* @__PURE__ */ new Set(), B = He({
749
- draw: F,
750
- packetsVisible: () => !!r.canvas && ze(d(), r.camera, r.width, r.height),
743
+ if (n.hoverNodeId === t) return;
744
+ n.hoverNodeId = t;
745
+ let r = w();
746
+ r && n.canvas && n.width && r.draw(f(), n.camera, { hover: t });
747
+ }
748
+ let V = /* @__PURE__ */ new Set(), H = (e) => (V.add(e), () => V.delete(e)), U = /* @__PURE__ */ new Set(), W = He({
749
+ draw: R,
750
+ packetsVisible: () => !!n.canvas && ze(f(), n.camera, n.width, n.height),
751
751
  isHidden: () => e.hidden(),
752
752
  tickClients: (e) => {
753
753
  let t = !1;
754
- return z.forEach((n) => {
754
+ return U.forEach((n) => {
755
755
  n.tick(e), n.wants() && (t = !0);
756
756
  }), t;
757
757
  },
758
- clientsWant: () => [...z].some((e) => e.wants()),
758
+ clientsWant: () => [...U].some((e) => e.wants()),
759
759
  reduceMotion: () => e.reducedMotion,
760
- extraDirty: () => r.sceneVersion !== P,
760
+ extraDirty: () => n.sceneVersion !== L,
761
761
  now: () => performance.now(),
762
762
  raf: (e) => requestAnimationFrame(e),
763
763
  caf: (e) => cancelAnimationFrame(e)
764
764
  });
765
- function V() {
766
- !o && r.canvas && B.markDirty();
765
+ function G() {
766
+ !o && n.canvas && W.markDirty();
767
767
  }
768
- function ae() {
769
- !o && r.canvas && B.drawNow();
768
+ function K() {
769
+ !o && n.canvas && W.drawNow();
770
770
  }
771
- function W(e) {
772
- return z.add(e), () => z.delete(e);
771
+ function re(e) {
772
+ return U.add(e), () => U.delete(e);
773
773
  }
774
+ let q = [];
774
775
  if (e.root) {
775
- let t = () => B.noteInput();
776
- for (let n of ct) e.listen(e.root, n, t, {
776
+ let t = () => W.noteInput();
777
+ for (let n of ct) q.push(e.listen(e.root, n, t, {
777
778
  passive: !0,
778
779
  capture: !0
779
- });
780
+ }));
780
781
  }
781
- e.onShown(() => B.shown()), e.onShown(() => {
782
- let e = r.canvas && r.canvas.parentElement;
783
- !o && e && e.clientWidth && e.clientHeight && (e.clientWidth !== r.width || e.clientHeight !== r.height) && w();
784
- });
785
- function G() {
786
- o = !0, e.map === K && (e.map = null), B.cancel(), _ && (_.release ? _.release() : _.destroy(), _ = null, v = null), b && (b.destroy(), b = null, x = null), R.clear(), z.clear();
787
- }
788
- let K = {
789
- isNodeVisible: s,
790
- isNodeVisibleToViewer: c,
791
- getActiveSubgraph: l,
792
- getScene: d,
793
- sceneBuilds: f,
794
- getSpatialIndex: m,
795
- spatialBuilds: h,
796
- getRenderer: y,
797
- setRenderer: C,
798
- resize: w,
799
- watchSize: O,
800
- getMinZoom: j,
801
- fitGraphToViewport: M,
802
- fitPadding: N,
803
- screenToWorld: te,
804
- labelNodeAt: ne,
805
- setHoverNode: L,
806
- onPaint: re,
807
- render: V,
808
- renderNow: ae,
809
- addFrameClient: W,
782
+ q.push(e.onShown(() => W.shown())), q.push(e.onShown(() => {
783
+ let e = n.canvas && n.canvas.parentElement;
784
+ !o && e && e.clientWidth && e.clientHeight && (e.clientWidth !== n.width || e.clientHeight !== n.height) && E();
785
+ }));
786
+ function ie() {
787
+ o = !0;
788
+ for (let e of q.splice(0)) e();
789
+ e.map === J && (e.map = null), W.cancel(), y && (y.release ? y.release() : y.destroy(), y = null, b = null), S && (S.destroy(), S = null, C = null), V.clear(), U.clear();
790
+ }
791
+ let J = {
792
+ isNodeVisible: c,
793
+ isNodeVisibleToViewer: l,
794
+ getActiveSubgraph: u,
795
+ getScene: f,
796
+ sceneBuilds: p,
797
+ getSpatialIndex: g,
798
+ spatialBuilds: v,
799
+ getRenderer: x,
800
+ setRenderer: T,
801
+ resize: E,
802
+ watchSize: k,
803
+ getMinZoom: M,
804
+ fitGraphToViewport: N,
805
+ fitPadding: P,
806
+ screenToWorld: F,
807
+ labelNodeAt: z,
808
+ setHoverNode: B,
809
+ onPaint: H,
810
+ render: G,
811
+ renderNow: K,
812
+ addFrameClient: re,
810
813
  queueFrameWork: (e, t) => {
811
- o || B.queue(e, t);
814
+ o || W.queue(e, t);
812
815
  },
813
816
  frameStats: () => ({
814
- frames: B.frames,
815
- draws: B.draws
817
+ frames: W.frames,
818
+ draws: W.draws
816
819
  }),
817
820
  holdFrames: (e) => {
818
- o || B.hold(e);
821
+ o || W.hold(e);
819
822
  },
820
- cancelFrame: () => B.cancel(),
823
+ cancelFrame: () => W.cancel(),
821
824
  ensureFlowLoop: () => {
822
- o || B.wake();
825
+ o || W.wake();
823
826
  },
824
- destroy: G
827
+ destroy: ie
825
828
  };
826
- return e.map = K, e.own(G), K;
829
+ return e.map = J, e.own(ie), J;
827
830
  }
828
831
  // ../explorer/flow-build.js
829
832
  function ut(e, t) {
@@ -928,25 +931,25 @@ function ft(e, t) {
928
931
  }
929
932
  function pt(e, { placeLive: t } = {}) {
930
933
  let { state: n } = e;
931
- F(e), n.view === "dataflow" && n.flow ? (n.flow.tiers.forEach((e) => e.nodes.forEach((e) => {
934
+ T(e), n.view === "dataflow" && n.flow ? (n.flow.tiers.forEach((e) => e.nodes.forEach((e) => {
932
935
  e.r = Math.min(e.r, 13);
933
- })), n.proposal && n.baseNodes && ht(e) || f(e, n.flow)) : n.baseNodes && (n.proposal || n.nodes.some((e) => e.live)) ? gt(e, t) : p(e);
936
+ })), n.proposal && n.baseNodes && ht(e) || O(e, n.flow)) : n.baseNodes && (n.proposal || n.nodes.some((e) => e.live)) ? gt(e, t) : g(e);
934
937
  }
935
938
  function mt(e, t, n) {
936
939
  let { state: r } = e;
937
- r.mapNodes = t, r.mapEdges = n, r.nodes = t, r.edges = n, r.flow = ut(t, n), D(r.flow), e.touchScene(), pt(e);
940
+ r.mapNodes = t, r.mapEdges = n, r.nodes = t, r.edges = n, r.flow = ut(t, n), i(r.flow), e.touchScene(), pt(e);
938
941
  }
939
942
  function ht(e) {
940
943
  let { state: t } = e, n = {
941
944
  nodes: t.nodes,
942
945
  edges: t.edges
943
946
  }, r = t.baseNodes.map((e) => ({ ...e }));
944
- t.nodes = r, t.edges = t.baseEdges, F(e);
947
+ t.nodes = r, t.edges = t.baseEdges, T(e);
945
948
  let i = ut(r, t.baseEdges);
946
949
  i.tiers.forEach((e) => e.nodes.forEach((e) => {
947
950
  e.r = Math.min(e.r, 13);
948
- })), f(e, i), t.nodes = n.nodes, t.edges = n.edges;
949
- let a = re(t.flow, i);
951
+ })), O(e, i), t.nodes = n.nodes, t.edges = n.edges;
952
+ let a = z(t.flow, i);
950
953
  return e.touchScene(), a;
951
954
  }
952
955
  function gt(e, t) {
@@ -954,15 +957,15 @@ function gt(e, t) {
954
957
  nodes: n.nodes,
955
958
  edges: n.edges
956
959
  }, i = n.baseNodes.map((e) => ({ ...e }));
957
- n.nodes = i, n.edges = n.baseEdges, F(e), p(e);
960
+ n.nodes = i, n.edges = n.baseEdges, T(e), g(e);
958
961
  let a = new Map(i.map((e) => [e.id, e]));
959
- n.nodes = r.nodes, n.edges = r.edges, F(e), n.nodes.forEach((e) => {
962
+ n.nodes = r.nodes, n.edges = r.edges, T(e), n.nodes.forEach((e) => {
960
963
  let t = a.get(e.id);
961
964
  t && (e.x = t.x, e.y = t.y, e.r = t.r);
962
- }), V(n.nodes, n.edges), t && t(n.nodes, n.edges), e.touchScene();
965
+ }), m(n.nodes, n.edges), t && t(n.nodes, n.edges), e.touchScene();
963
966
  }
964
967
  // ../explorer/shaders.js
965
- var Z = "#version 300 es\nprecision highp float;\nuniform vec2 u_viewport;\nuniform vec3 u_cam;\nuniform float u_dpr;\n", _t = "\nvec4 toClip(vec2 pos) {\n return vec4(pos.x / u_viewport.x * 2.0 - 1.0, 1.0 - pos.y / u_viewport.y * 2.0, 0.0, 1.0);\n}\n", Q = "\nout vec4 outColor;\n\n// Coverage of one device pixel by the half plane d < 0 (d: signed distance in CSS px, pix: the pixel's size)\nfloat coverEdge(float d, float pix) {\n return clamp(0.5 - d / pix, 0.0, 1.0);\n}\n\n// Coverage of one pixel by a band of half width hw around dist = 0 (dist >= 0: distance from the centre line)\nfloat coverBand(float dist, float hw, float pix) {\n float hi = min(hw, dist + 0.5 * pix);\n float lo = max(-hw, dist - 0.5 * pix);\n return clamp((hi - lo) / pix, 0.0, 1.0);\n}\n\n// Coverage by a dash pattern along an arc (on / off in world units; on <= 0 or off <= 0 is solid)\nfloat coverDash(float arc, float on, float off, float pixWorld) {\n if (on <= 0.0 || off <= 0.0) return 1.0;\n float period = on + off;\n float u = mod(arc - on * 0.5 + period * 0.5, period) - period * 0.5;\n return clamp((on * 0.5 - abs(u)) / pixWorld + 0.5, 0.0, 1.0);\n}\n\n// Straight colour at alpha a, composited over acc (premultiplied)\nvoid over(inout vec4 acc, vec3 rgb, float a) {\n acc = vec4(rgb * a, a) + acc * (1.0 - a);\n}\n\n// What Canvas 2D's shadowBlur gives a disc of radius R at distance len from its centre: a blurred copy\n// of the disc. s is the blur's sigma in CSS px (shadowBlur is in DEVICE px and sigma = blur / 2). A big\n// disc has a straight-edge profile (a logistic stands in for the Gaussian's CDF); a small one is a\n// Gaussian bump whose height is what the blur leaves of it.\nfloat glowDisc(float len, float R, float s) {\n float wide = 1.0 / (1.0 + exp(clamp(1.702 * (len - R) / s, -30.0, 30.0)));\n float narrow = (1.0 - exp(-R * R / (2.0 * s * s))) * exp(-len * len / (2.0 * s * s));\n return mix(narrow, wide, smoothstep(0.5 * s, 2.5 * s, R));\n}\n\n// The normal distribution's CDF, as the same logistic (error under 0.01)\nfloat phi(float x) {\n return 1.0 / (1.0 + exp(clamp(-1.702 * x, -30.0, 30.0)));\n}\n", vt = `${Z}
968
+ var Q = "#version 300 es\nprecision highp float;\nuniform vec2 u_viewport;\nuniform vec3 u_cam;\nuniform float u_dpr;\n", _t = "\nvec4 toClip(vec2 pos) {\n return vec4(pos.x / u_viewport.x * 2.0 - 1.0, 1.0 - pos.y / u_viewport.y * 2.0, 0.0, 1.0);\n}\n", vt = "\nout vec4 outColor;\n\n// Coverage of one device pixel by the half plane d < 0 (d: signed distance in CSS px, pix: the pixel's size)\nfloat coverEdge(float d, float pix) {\n return clamp(0.5 - d / pix, 0.0, 1.0);\n}\n\n// Coverage of one pixel by a band of half width hw around dist = 0 (dist >= 0: distance from the centre line)\nfloat coverBand(float dist, float hw, float pix) {\n float hi = min(hw, dist + 0.5 * pix);\n float lo = max(-hw, dist - 0.5 * pix);\n return clamp((hi - lo) / pix, 0.0, 1.0);\n}\n\n// Coverage by a dash pattern along an arc (on / off in world units; on <= 0 or off <= 0 is solid)\nfloat coverDash(float arc, float on, float off, float pixWorld) {\n if (on <= 0.0 || off <= 0.0) return 1.0;\n float period = on + off;\n float u = mod(arc - on * 0.5 + period * 0.5, period) - period * 0.5;\n return clamp((on * 0.5 - abs(u)) / pixWorld + 0.5, 0.0, 1.0);\n}\n\n// Straight colour at alpha a, composited over acc (premultiplied)\nvoid over(inout vec4 acc, vec3 rgb, float a) {\n acc = vec4(rgb * a, a) + acc * (1.0 - a);\n}\n\n// What Canvas 2D's shadowBlur gives a disc of radius R at distance len from its centre: a blurred copy\n// of the disc. s is the blur's sigma in CSS px (shadowBlur is in DEVICE px and sigma = blur / 2). A big\n// disc has a straight-edge profile (a logistic stands in for the Gaussian's CDF); a small one is a\n// Gaussian bump whose height is what the blur leaves of it.\nfloat glowDisc(float len, float R, float s) {\n float wide = 1.0 / (1.0 + exp(clamp(1.702 * (len - R) / s, -30.0, 30.0)));\n float narrow = (1.0 - exp(-R * R / (2.0 * s * s))) * exp(-len * len / (2.0 * s * s));\n return mix(narrow, wide, smoothstep(0.5 * s, 2.5 * s, R));\n}\n\n// The normal distribution's CDF, as the same logistic (error under 0.01)\nfloat phi(float x) {\n return 1.0 / (1.0 + exp(clamp(-1.702 * x, -30.0, 30.0)));\n}\n", yt = `${Q}
966
969
  layout(location = 0) in vec2 a_corner;
967
970
  layout(location = 1) in vec4 a_grid; // size, width
968
971
  layout(location = 2) in vec4 a_color;
@@ -975,7 +978,7 @@ void main() {
975
978
  v_color = a_color;
976
979
  gl_Position = vec4(a_corner, 0.0, 1.0);
977
980
  }
978
- `, yt = `${Z}${Q}
981
+ `, bt = `${Q}${vt}
979
982
  in vec2 v_pos;
980
983
  flat in vec4 v_grid;
981
984
  flat in vec4 v_color;
@@ -988,7 +991,7 @@ void main() {
988
991
  float cover = max(coverBand(dist.x, hw, pix), coverBand(dist.y, hw, pix));
989
992
  outColor = vec4(v_color.rgb * v_color.a, v_color.a) * cover;
990
993
  }
991
- `, bt = `${Z}${_t}
994
+ `, xt = `${Q}${_t}
992
995
  layout(location = 0) in vec2 a_corner;
993
996
  layout(location = 1) in vec4 a_rect; // x, y, w, h (world)
994
997
  layout(location = 2) in vec4 a_fill;
@@ -1012,7 +1015,7 @@ void main() {
1012
1015
  v_stroke = a_stroke;
1013
1016
  gl_Position = toClip(pos);
1014
1017
  }
1015
- `, xt = `${Z}${Q}
1018
+ `, St = `${Q}${vt}
1016
1019
  in vec2 v_local;
1017
1020
  flat in vec2 v_half;
1018
1021
  flat in vec2 v_style;
@@ -1029,7 +1032,7 @@ void main() {
1029
1032
  over(acc, v_stroke.rgb, v_stroke.a * coverBand(abs(sd), v_style.y * zoom * 0.5, pix));
1030
1033
  outColor = acc;
1031
1034
  }
1032
- `, St = `${Z}${_t}
1035
+ `, Ct = `${Q}${_t}
1033
1036
  layout(location = 0) in vec2 a_corner;
1034
1037
  layout(location = 1) in vec4 a_geom; // x, y, r, width (world)
1035
1038
  layout(location = 2) in vec4 a_color;
@@ -1049,7 +1052,7 @@ void main() {
1049
1052
  v_dash = a_dash;
1050
1053
  gl_Position = toClip(pos);
1051
1054
  }
1052
- `, Ct = `${Z}${Q}
1055
+ `, wt = `${Q}${vt}
1053
1056
  in vec2 v_local;
1054
1057
  flat in vec4 v_geom;
1055
1058
  flat in vec4 v_color;
@@ -1064,7 +1067,7 @@ void main() {
1064
1067
  cover *= coverDash(arc, v_dash.x, v_dash.y, pix / zoom);
1065
1068
  outColor = vec4(v_color.rgb * v_color.a, v_color.a) * cover;
1066
1069
  }
1067
- `, wt = `${Z}${_t}
1070
+ `, Tt = `${Q}${_t}
1068
1071
  layout(location = 0) in vec2 a_corner;
1069
1072
  layout(location = 1) in vec4 a_geom; // x, y, r (world), alpha
1070
1073
  layout(location = 2) in vec4 a_color; // r, g, b (0..1), glow (px)
@@ -1092,7 +1095,7 @@ void main() {
1092
1095
  v_kind = a_kind;
1093
1096
  gl_Position = toClip(centre + v_local);
1094
1097
  }
1095
- `, Tt = `${Z}${Q}
1098
+ `, Et = `${Q}${vt}
1096
1099
  in vec2 v_local;
1097
1100
  flat in vec4 v_geom;
1098
1101
  flat in vec4 v_color;
@@ -1182,7 +1185,7 @@ void main() {
1182
1185
 
1183
1186
  outColor = acc;
1184
1187
  }
1185
- `, Et = "\nvec2 bez(vec2 a, vec2 c, vec2 b, float t) {\n float u = 1.0 - t;\n return u * u * a + 2.0 * u * t * c + t * t * b;\n}\nvec2 bezD(vec2 a, vec2 c, vec2 b, float t) {\n return 2.0 * (1.0 - t) * (c - a) + 2.0 * t * (b - c);\n}\n// Arc length from 0 to t, in world units (midpoint rule, 8 steps: the speed is smooth)\nfloat bezArc(vec2 a, vec2 c, vec2 b, float t) {\n float sum = 0.0;\n for (int j = 0; j < 8; j++) sum += length(bezD(a, c, b, (float(j) + 0.5) * t / 8.0));\n return sum * t / 8.0;\n}\n", Dt = "\nvec2 packetPos(vec4 ends, vec4 mot, float timeSec) {\n float k = fract(timeSec * mot.z + mot.w);\n return bez(ends.xy, mot.xy, ends.zw, k);\n}\n", Ot = (e) => `${Z}${Et}
1188
+ `, Dt = "\nvec2 bez(vec2 a, vec2 c, vec2 b, float t) {\n float u = 1.0 - t;\n return u * u * a + 2.0 * u * t * c + t * t * b;\n}\nvec2 bezD(vec2 a, vec2 c, vec2 b, float t) {\n return 2.0 * (1.0 - t) * (c - a) + 2.0 * t * (b - c);\n}\n// Arc length from 0 to t, in world units (midpoint rule, 8 steps: the speed is smooth)\nfloat bezArc(vec2 a, vec2 c, vec2 b, float t) {\n float sum = 0.0;\n for (int j = 0; j < 8; j++) sum += length(bezD(a, c, b, (float(j) + 0.5) * t / 8.0));\n return sum * t / 8.0;\n}\n", Ot = "\nvec2 packetPos(vec4 ends, vec4 mot, float timeSec) {\n float k = fract(timeSec * mot.z + mot.w);\n return bez(ends.xy, mot.xy, ends.zw, k);\n}\n", kt = (e) => `${Q}${Dt}
1186
1189
  #define SEGS ${e}
1187
1190
  layout(location = 1) in vec4 a_ends; // x1, y1, x2, y2 (world)
1188
1191
  layout(location = 2) in vec4 a_geom; // control x, y (world), width (world), glow blur (px)
@@ -1224,7 +1227,7 @@ void main() {
1224
1227
  v_dash = a_dash;
1225
1228
  gl_Position = vec4(pos.x / u_viewport.x * 2.0 - 1.0, 1.0 - pos.y / u_viewport.y * 2.0, 0.0, 1.0);
1226
1229
  }
1227
- `, kt = `${Z}${Q}
1230
+ `, At = `${Q}${vt}
1228
1231
  in float v_across;
1229
1232
  in float v_arc;
1230
1233
  flat in float v_len;
@@ -1274,7 +1277,7 @@ void main() {
1274
1277
  over(acc, v_color.rgb, v_color.a * cover);
1275
1278
  outColor = acc;
1276
1279
  }
1277
- `, At = `${Z}${_t}
1280
+ `, jt = `${Q}${_t}
1278
1281
  layout(location = 0) in vec2 a_corner;
1279
1282
  layout(location = 1) in vec4 a_tip; // x, y (world), direction x, y (unit)
1280
1283
  layout(location = 2) in vec4 a_color;
@@ -1294,7 +1297,7 @@ void main() {
1294
1297
  v_kind = a_kind;
1295
1298
  gl_Position = toClip(u_cam.xy + a_tip.xy * zoom + off);
1296
1299
  }
1297
- `, jt = `${Z}${Q}
1300
+ `, Mt = `${Q}${vt}
1298
1301
  in vec2 v_local;
1299
1302
  flat in vec4 v_color;
1300
1303
  flat in float v_kind;
@@ -1350,7 +1353,7 @@ void main() {
1350
1353
  }
1351
1354
  outColor = vec4(v_color.rgb * v_color.a, v_color.a) * coverEdge(sd, pix);
1352
1355
  }
1353
- `, Mt = `${Z}${_t}${Et}${Dt}
1356
+ `, Nt = `${Q}${_t}${Dt}${Ot}
1354
1357
  layout(location = 0) in vec2 a_corner;
1355
1358
  layout(location = 1) in vec4 a_ends; // x1, y1, x2, y2 (world)
1356
1359
  layout(location = 2) in vec4 a_mot; // control x, y (world), speed (trips per second), phase
@@ -1371,7 +1374,7 @@ void main() {
1371
1374
  v_glow = a_glow;
1372
1375
  gl_Position = toClip(centre + v_local);
1373
1376
  }
1374
- `, Nt = `${Z}${Q}
1377
+ `, Pt = `${Q}${vt}
1375
1378
  in vec2 v_local;
1376
1379
  flat in vec4 v_size;
1377
1380
  flat in vec4 v_color;
@@ -1386,7 +1389,7 @@ void main() {
1386
1389
  over(acc, v_color.rgb, v_color.a * coverEdge(len - R, pix));
1387
1390
  outColor = acc;
1388
1391
  }
1389
- `, Pt = `${Z}${_t}
1392
+ `, Ft = `${Q}${_t}
1390
1393
  layout(location = 0) in vec2 a_corner;
1391
1394
  layout(location = 1) in vec4 a_geom; // x, y, side (world), alpha
1392
1395
  uniform float u_minR; // letters and glyphs: the least on-screen radius (px) of a node that shows them; 0 for a theme's icon
@@ -1401,7 +1404,7 @@ void main() {
1401
1404
  v_alpha = a_geom.w;
1402
1405
  gl_Position = toClip(pos);
1403
1406
  }
1404
- `, Ft = `${Z}
1407
+ `, It = `${Q}
1405
1408
  uniform sampler2D u_tex;
1406
1409
  in vec2 v_uv;
1407
1410
  flat in float v_alpha;
@@ -1409,34 +1412,34 @@ out vec4 outColor;
1409
1412
  void main() {
1410
1413
  outColor = texture(u_tex, v_uv) * v_alpha; // the texture is uploaded premultiplied
1411
1414
  }
1412
- `, It = {
1415
+ `, Lt = {
1413
1416
  none: 0,
1414
1417
  selected: 1,
1415
1418
  match: 2,
1416
1419
  child: 3
1417
- }, Lt = {
1420
+ }, Rt = {
1418
1421
  arrow: 1,
1419
1422
  strike: 2,
1420
1423
  chevron: 3,
1421
1424
  bar: 4,
1422
1425
  diamond: 5,
1423
1426
  tick: 6
1424
- }, Rt = Object.freeze(Object.fromEntries(_.map((e, t) => [e, t]))), zt = {
1427
+ }, zt = Object.freeze(Object.fromEntries(o.map((e, t) => [e, t]))), Bt = {
1425
1428
  none: 0,
1426
1429
  added: 1,
1427
1430
  changed: 2,
1428
1431
  removed: 3,
1429
1432
  edit: 4
1430
1433
  }, $ = (e) => {
1431
- let [n, r, i, a] = t(e);
1434
+ let [t, n, r, i] = K(e);
1432
1435
  return [
1436
+ t / 255,
1433
1437
  n / 255,
1434
1438
  r / 255,
1435
- i / 255,
1436
- a
1439
+ i
1437
1440
  ];
1438
- }, Bt = (e, t) => Object.hasOwn(e, t) ? e[t] : 0;
1439
- function Vt(e) {
1441
+ }, Vt = (e, t) => Object.hasOwn(e, t) ? e[t] : 0;
1442
+ function Ht(e) {
1440
1443
  let { nodes: t } = e, n = new Float32Array(t.length * 12);
1441
1444
  return t.forEach((e, t) => {
1442
1445
  let [r, i, a, o] = $(e.color);
@@ -1449,10 +1452,10 @@ function Vt(e) {
1449
1452
  i,
1450
1453
  a,
1451
1454
  e.glow || 0,
1452
- Bt(It, e.halo),
1453
- Bt(zt, e.mark),
1455
+ Vt(Lt, e.halo),
1456
+ Vt(Bt, e.mark),
1454
1457
  o,
1455
- Bt(Rt, e.shape) + (e.glyph && !e.icon && !e.letters ? 8 : 0)
1458
+ Vt(zt, e.shape) + (e.glyph && !e.icon && !e.letters ? 8 : 0)
1456
1459
  ], t * 12);
1457
1460
  }), {
1458
1461
  data: n,
@@ -1460,7 +1463,7 @@ function Vt(e) {
1460
1463
  stride: 12
1461
1464
  };
1462
1465
  }
1463
- function Ht(e) {
1466
+ function Ut(e) {
1464
1467
  let { grid: t, rings: n, lanes: r } = e.decor, i = new Float32Array(t ? 8 : 0);
1465
1468
  t && i.set([
1466
1469
  t.size,
@@ -1512,110 +1515,110 @@ function Ht(e) {
1512
1515
  }
1513
1516
  };
1514
1517
  }
1515
- function Ut(t) {
1516
- let n = {
1518
+ function Wt(e) {
1519
+ let t = {
1517
1520
  straight: [],
1518
1521
  curved: [],
1519
1522
  tips: [],
1520
1523
  packets: []
1521
1524
  };
1522
- t.edges.forEach((t) => {
1523
- let [r, i, a, o] = $(t.color), c = t.alpha, l = o * c, [u, d] = t.dash && t.dash.length >= 2 ? t.dash : [0, 0], f = t.glow > 0 && !!t.glowColor, [p, m, h, g] = f ? $(t.glowColor) : [
1525
+ e.edges.forEach((e) => {
1526
+ let [n, r, i, a] = $(e.color), o = e.alpha, s = a * o, [c, l] = e.dash && e.dash.length >= 2 ? e.dash : [0, 0], u = e.glow > 0 && !!e.glowColor, [d, f, p, m] = u ? $(e.glowColor) : [
1524
1527
  0,
1525
1528
  0,
1526
1529
  0,
1527
1530
  0
1528
- ], _ = t.curve ? t.curve.cx : (t.x1 + t.x2) / 2, v = t.curve ? t.curve.cy : (t.y1 + t.y2) / 2, y = t.mark && t.mark !== "none" ? 1 : 0;
1529
- if (n[t.curve ? "curved" : "straight"].push([
1530
- t.x1,
1531
- t.y1,
1532
- t.x2,
1533
- t.y2,
1534
- _,
1535
- v,
1536
- t.width,
1537
- f ? t.glow : 0,
1531
+ ], h = e.curve ? e.curve.cx : (e.x1 + e.x2) / 2, g = e.curve ? e.curve.cy : (e.y1 + e.y2) / 2, _ = e.mark && e.mark !== "none" ? 1 : 0;
1532
+ if (t[e.curve ? "curved" : "straight"].push([
1533
+ e.x1,
1534
+ e.y1,
1535
+ e.x2,
1536
+ e.y2,
1537
+ h,
1538
+ g,
1539
+ e.width,
1540
+ u ? e.glow : 0,
1541
+ n,
1538
1542
  r,
1539
1543
  i,
1540
- a,
1541
- l,
1542
- p,
1543
- m,
1544
- h,
1545
- g * l,
1546
- u,
1544
+ s,
1547
1545
  d,
1548
- y
1549
- ]), t.arrow) {
1550
- let e = Math.atan2(t.y2 - (t.curve ? t.curve.cy : t.y1), t.x2 - (t.curve ? t.curve.cx : t.x1)), o = t.end && t.end !== "triangle" && Bt(Lt, t.end) || Lt.arrow;
1551
- n.tips.push([
1552
- t.x2,
1553
- t.y2,
1554
- Math.cos(e),
1555
- Math.sin(e),
1546
+ f,
1547
+ p,
1548
+ m * s,
1549
+ c,
1550
+ l,
1551
+ _
1552
+ ]), e.arrow) {
1553
+ let a = Math.atan2(e.y2 - (e.curve ? e.curve.cy : e.y1), e.x2 - (e.curve ? e.curve.cx : e.x1)), o = e.end && e.end !== "triangle" && Vt(Rt, e.end) || Rt.arrow;
1554
+ t.tips.push([
1555
+ e.x2,
1556
+ e.y2,
1557
+ Math.cos(a),
1558
+ Math.sin(a),
1559
+ n,
1556
1560
  r,
1557
1561
  i,
1558
- a,
1559
- l,
1562
+ s,
1560
1563
  o
1561
1564
  ]);
1562
1565
  }
1563
- if (t.ticks) {
1564
- let o = e(t, .5), c = Math.hypot(t.x2 - t.x1, t.y2 - t.y1), [u, d] = c > 0 ? [(t.x2 - t.x1) / c, (t.y2 - t.y1) / c] : [1, 0];
1565
- for (let e = 0; e < t.ticks; e++) {
1566
- let c = (e - (t.ticks - 1) / 2) * s.tickGap;
1567
- n.tips.push([
1568
- o.x + u * c,
1569
- o.y + d * c,
1570
- u,
1571
- d,
1566
+ if (e.ticks) {
1567
+ let a = ae(e, .5), o = Math.hypot(e.x2 - e.x1, e.y2 - e.y1), [c, l] = o > 0 ? [(e.x2 - e.x1) / o, (e.y2 - e.y1) / o] : [1, 0];
1568
+ for (let o = 0; o < e.ticks; o++) {
1569
+ let u = (o - (e.ticks - 1) / 2) * B.tickGap;
1570
+ t.tips.push([
1571
+ a.x + c * u,
1572
+ a.y + l * u,
1573
+ c,
1574
+ l,
1575
+ n,
1572
1576
  r,
1573
1577
  i,
1574
- a,
1575
- l,
1576
- Lt.tick
1578
+ s,
1579
+ Rt.tick
1577
1580
  ]);
1578
1581
  }
1579
1582
  }
1580
- if (t.mark === "removed") {
1581
- let o = e(t, .5), s = Math.hypot(t.x2 - t.x1, t.y2 - t.y1), [c, u] = s > 0 ? [(t.x2 - t.x1) / s, (t.y2 - t.y1) / s] : [1, 0];
1582
- n.tips.push([
1583
- o.x,
1584
- o.y,
1583
+ if (e.mark === "removed") {
1584
+ let a = ae(e, .5), o = Math.hypot(e.x2 - e.x1, e.y2 - e.y1), [c, l] = o > 0 ? [(e.x2 - e.x1) / o, (e.y2 - e.y1) / o] : [1, 0];
1585
+ t.tips.push([
1586
+ a.x,
1587
+ a.y,
1585
1588
  c,
1586
- u,
1589
+ l,
1590
+ n,
1587
1591
  r,
1588
1592
  i,
1589
- a,
1590
- l,
1591
- Lt.strike
1593
+ s,
1594
+ Rt.strike
1592
1595
  ]);
1593
1596
  }
1594
- if (t.packet) {
1595
- let e = t.packet, [r, i, a, o] = $(e.color), [s, l, u, d] = $(e.glowColor);
1596
- n.packets.push([
1597
- t.x1,
1598
- t.y1,
1599
- t.x2,
1600
- t.y2,
1601
- _,
1602
- v,
1603
- e.speed,
1604
- e.phase,
1597
+ if (e.packet) {
1598
+ let n = e.packet, [r, i, a, s] = $(n.color), [c, l, u, d] = $(n.glowColor);
1599
+ t.packets.push([
1600
+ e.x1,
1601
+ e.y1,
1602
+ e.x2,
1603
+ e.y2,
1604
+ h,
1605
+ g,
1606
+ n.speed,
1607
+ n.phase,
1605
1608
  r,
1606
1609
  i,
1607
1610
  a,
1608
- o * c,
1609
- s,
1611
+ s * o,
1612
+ c,
1610
1613
  l,
1611
1614
  u,
1612
- d * o * c,
1613
- e.radius,
1614
- e.glow
1615
+ d * s * o,
1616
+ n.radius,
1617
+ n.glow
1615
1618
  ]);
1616
1619
  }
1617
1620
  });
1618
- let r = (e, t) => {
1621
+ let n = (e, t) => {
1619
1622
  let n = new Float32Array(e.length * t);
1620
1623
  return e.forEach((e, r) => n.set(e, r * t)), {
1621
1624
  data: n,
@@ -1624,18 +1627,18 @@ function Ut(t) {
1624
1627
  };
1625
1628
  };
1626
1629
  return {
1627
- straight: r(n.straight, 19),
1628
- curved: r(n.curved, 19),
1629
- tips: r(n.tips, 9),
1630
- packets: r(n.packets, 18)
1630
+ straight: n(t.straight, 19),
1631
+ curved: n(t.curved, 19),
1632
+ tips: n(t.tips, 9),
1633
+ packets: n(t.packets, 18)
1631
1634
  };
1632
1635
  }
1633
- var Wt = (e) => ({
1634
- ...Ht(e),
1635
- nodes: Vt(e),
1636
- ...Ut(e)
1636
+ var Gt = (e) => ({
1637
+ ...Ut(e),
1638
+ nodes: Ht(e),
1639
+ ...Wt(e)
1637
1640
  });
1638
- function Gt(e) {
1641
+ function Kt(e) {
1639
1642
  let t = [];
1640
1643
  e.nodes.forEach((e) => {
1641
1644
  if (!e.stroke) return;
@@ -1660,87 +1663,87 @@ function Gt(e) {
1660
1663
  stride: 10
1661
1664
  };
1662
1665
  }
1663
- function Kt(e, t, n = null) {
1664
- let i = /* @__PURE__ */ new Map();
1666
+ function qt(e, t, n = null) {
1667
+ let r = /* @__PURE__ */ new Map();
1665
1668
  e.nodes.forEach((e) => {
1666
- let a = e.icon && t(e.icon) ? e.icon : null, o = e.r * l;
1667
- if (!a && !e.icon && e.letters && t(ue(e.letters)) && (a = ue(e.letters), o = e.r * 1), !a && !e.icon && !e.letters && e.glyph) {
1668
- let i = r(e.glyph, v(e, n));
1669
- t(i) && (a = i, o = e.r * G);
1669
+ let i = e.icon && t(e.icon) ? e.icon : null, a = e.r * G;
1670
+ if (!i && !e.icon && e.letters && t(le(e.letters)) && (i = le(e.letters), a = e.r * 1), !i && !e.icon && !e.letters && e.glyph) {
1671
+ let r = p(e.glyph, c(e, n));
1672
+ t(r) && (i = r, a = e.r * x);
1670
1673
  }
1671
- if (!a) return;
1672
- i.has(a) || i.set(a, {
1674
+ if (!i) return;
1675
+ r.has(i) || r.set(i, {
1673
1676
  rows: [],
1674
1677
  minR: Infinity,
1675
1678
  maxR: 0
1676
1679
  });
1677
- let s = i.get(a);
1678
- s.maxR = Math.max(s.maxR, e.r), s.rows.push([
1680
+ let o = r.get(i);
1681
+ o.maxR = Math.max(o.maxR, e.r), o.rows.push([
1679
1682
  e.x,
1680
1683
  e.y,
1681
- o,
1684
+ a,
1682
1685
  e.alpha
1683
- ]), s.minR = Math.min(s.minR, e.r);
1686
+ ]), o.minR = Math.min(o.minR, e.r);
1684
1687
  });
1685
- let a = [], o = [];
1686
- for (let [e, { rows: t, minR: n, maxR: r }] of i) a.push({
1688
+ let i = [], a = [];
1689
+ for (let [e, { rows: t, minR: n, maxR: o }] of r) i.push({
1687
1690
  kind: e,
1688
- first: o.length,
1691
+ first: a.length,
1689
1692
  count: t.length,
1690
1693
  minR: n,
1691
- maxR: r
1692
- }), o.push(...t);
1693
- let s = new Float32Array(o.length * 4);
1694
- return o.forEach((e, t) => s.set(e, t * 4)), {
1695
- data: s,
1696
- count: o.length,
1694
+ maxR: o
1695
+ }), a.push(...t);
1696
+ let o = new Float32Array(a.length * 4);
1697
+ return a.forEach((e, t) => o.set(e, t * 4)), {
1698
+ data: o,
1699
+ count: a.length,
1697
1700
  stride: 4,
1698
- groups: a
1701
+ groups: i
1699
1702
  };
1700
1703
  }
1701
- function qt(e = "dark", t = null) {
1702
- let { halo: n, mark: r, core: i } = t ? ce(P(e), t) : P(e), a = /* @__PURE__ */ new Float32Array(16), o = /* @__PURE__ */ new Float32Array(16), s = /* @__PURE__ */ new Float32Array(16);
1703
- Object.entries(It).forEach(([e, t]) => {
1704
- let r = n[e];
1705
- t && r && (a.set($(r.fill), t * 4), o.set($(r.ring), t * 4), s.set([
1706
- r.fillR,
1707
- r.ringR,
1708
- r.ringWidth,
1704
+ function Jt(e = "dark", t = null) {
1705
+ let { halo: r, mark: i, core: a } = t ? j(n(e), t) : n(e), o = /* @__PURE__ */ new Float32Array(16), s = /* @__PURE__ */ new Float32Array(16), c = /* @__PURE__ */ new Float32Array(16);
1706
+ Object.entries(Lt).forEach(([e, t]) => {
1707
+ let n = r[e];
1708
+ t && n && (o.set($(n.fill), t * 4), s.set($(n.ring), t * 4), c.set([
1709
+ n.fillR,
1710
+ n.ringR,
1711
+ n.ringWidth,
1709
1712
  0
1710
1713
  ], t * 4));
1711
1714
  });
1712
- let c = /* @__PURE__ */ new Float32Array(20), l = /* @__PURE__ */ new Float32Array(20);
1713
- return Object.entries(zt).forEach(([e, t]) => {
1715
+ let l = /* @__PURE__ */ new Float32Array(20), u = /* @__PURE__ */ new Float32Array(20);
1716
+ return Object.entries(Bt).forEach(([e, t]) => {
1714
1717
  if (!t) return;
1715
- let n = r[e];
1716
- c.set($(n.color), t * 4);
1717
- let [i, a] = n.ringDash || [0, 0];
1718
- l.set([
1718
+ let n = i[e];
1719
+ l.set($(n.color), t * 4);
1720
+ let [r, a] = n.ringDash || [0, 0];
1721
+ u.set([
1719
1722
  n.ringR,
1720
1723
  n.ringWidth,
1721
- i,
1724
+ r,
1722
1725
  a
1723
1726
  ], t * 4);
1724
1727
  }), {
1725
- haloFill: a,
1726
- haloRing: o,
1727
- haloGeom: s,
1728
- markColor: c,
1729
- markGeom: l,
1728
+ haloFill: o,
1729
+ haloRing: s,
1730
+ haloGeom: c,
1731
+ markColor: l,
1732
+ markGeom: u,
1730
1733
  markMin: new Float32Array([
1731
- w.ring,
1732
- w.edge,
1733
- w.gap
1734
+ J.ring,
1735
+ J.edge,
1736
+ J.gap
1734
1737
  ]),
1735
- core: new Float32Array($(i)),
1736
- coreRatio: b
1738
+ core: new Float32Array($(a)),
1739
+ coreRatio: P
1737
1740
  };
1738
1741
  }
1739
- var Jt = [
1742
+ var Yt = [
1740
1743
  {
1741
1744
  name: "grid",
1742
- vert: vt,
1743
- frag: yt,
1745
+ vert: yt,
1746
+ frag: bt,
1744
1747
  stride: 8,
1745
1748
  attribs: [[
1746
1749
  1,
@@ -1754,8 +1757,8 @@ var Jt = [
1754
1757
  },
1755
1758
  {
1756
1759
  name: "lanes",
1757
- vert: bt,
1758
- frag: xt,
1760
+ vert: xt,
1761
+ frag: St,
1759
1762
  stride: 14,
1760
1763
  attribs: [
1761
1764
  [
@@ -1782,8 +1785,8 @@ var Jt = [
1782
1785
  },
1783
1786
  {
1784
1787
  name: "rings",
1785
- vert: St,
1786
- frag: Ct,
1788
+ vert: Ct,
1789
+ frag: wt,
1787
1790
  stride: 10,
1788
1791
  attribs: [
1789
1792
  [
@@ -1805,8 +1808,8 @@ var Jt = [
1805
1808
  },
1806
1809
  {
1807
1810
  name: "straight",
1808
- vert: Ot(1),
1809
- frag: kt,
1811
+ vert: kt(1),
1812
+ frag: At,
1810
1813
  stride: 19,
1811
1814
  verts: 8,
1812
1815
  attribs: [
@@ -1845,8 +1848,8 @@ var Jt = [
1845
1848
  },
1846
1849
  {
1847
1850
  name: "curved",
1848
- vert: Ot(24),
1849
- frag: kt,
1851
+ vert: kt(24),
1852
+ frag: At,
1850
1853
  stride: 19,
1851
1854
  verts: 54,
1852
1855
  attribs: [
@@ -1885,8 +1888,8 @@ var Jt = [
1885
1888
  },
1886
1889
  {
1887
1890
  name: "tips",
1888
- vert: At,
1889
- frag: jt,
1891
+ vert: jt,
1892
+ frag: Mt,
1890
1893
  stride: 9,
1891
1894
  attribs: [
1892
1895
  [
@@ -1909,8 +1912,8 @@ var Jt = [
1909
1912
  },
1910
1913
  {
1911
1914
  name: "packets",
1912
- vert: Mt,
1913
- frag: Nt,
1915
+ vert: Nt,
1916
+ frag: Pt,
1914
1917
  stride: 18,
1915
1918
  attribs: [
1916
1919
  [
@@ -1943,8 +1946,8 @@ var Jt = [
1943
1946
  },
1944
1947
  {
1945
1948
  name: "nodes",
1946
- vert: wt,
1947
- frag: Tt,
1949
+ vert: Tt,
1950
+ frag: Et,
1948
1951
  stride: 12,
1949
1952
  attribs: [
1950
1953
  [
@@ -1965,17 +1968,17 @@ var Jt = [
1965
1968
  ],
1966
1969
  constants: "nodes"
1967
1970
  }
1968
- ], Yt = {
1971
+ ], Xt = {
1969
1972
  nodes(e, t, n) {
1970
- e.uniform4fv(t("u_haloFill"), n.haloFill), e.uniform4fv(t("u_haloRing"), n.haloRing), e.uniform4fv(t("u_haloGeom"), n.haloGeom), e.uniform4fv(t("u_markColor"), n.markColor), e.uniform4fv(t("u_markGeom"), n.markGeom), e.uniform3fv(t("u_markMin"), n.markMin), e.uniform4fv(t("u_core"), n.core), e.uniform1f(t("u_coreRatio"), n.coreRatio), e.uniform4f(t("u_shape"), C.roundedHalf, C.roundedCorner, C.hexInradius, C.squareHalf), e.uniform2f(t("u_shape2"), C.squareCorner, C.diamondHalf), e.uniform1f(t("u_glyphMin"), 14);
1973
+ e.uniform4fv(t("u_haloFill"), n.haloFill), e.uniform4fv(t("u_haloRing"), n.haloRing), e.uniform4fv(t("u_haloGeom"), n.haloGeom), e.uniform4fv(t("u_markColor"), n.markColor), e.uniform4fv(t("u_markGeom"), n.markGeom), e.uniform3fv(t("u_markMin"), n.markMin), e.uniform4fv(t("u_core"), n.core), e.uniform1f(t("u_coreRatio"), n.coreRatio), e.uniform4f(t("u_shape"), A.roundedHalf, A.roundedCorner, A.hexInradius, A.squareHalf), e.uniform2f(t("u_shape2"), A.squareCorner, A.diamondHalf), e.uniform1f(t("u_glyphMin"), 14);
1971
1974
  },
1972
1975
  edges(e, t, n) {
1973
1976
  e.uniform3fv(t("u_markMin"), n.markMin);
1974
1977
  },
1975
1978
  tips(e, t) {
1976
- e.uniform4f(t("u_tip"), c.length, c.spread, S.halfLength, S.width), e.uniform4f(t("u_end"), s.strokeWidth, s.barHalf, s.diamondHalf, s.diamondAcross), e.uniform2f(t("u_tick"), s.tickHalf, s.tickWidth);
1979
+ e.uniform4f(t("u_tip"), M.length, M.spread, H.halfLength, H.width), e.uniform4f(t("u_end"), B.strokeWidth, B.barHalf, B.diamondHalf, B.diamondAcross), e.uniform2f(t("u_tick"), B.tickHalf, B.tickWidth);
1977
1980
  }
1978
- }, Xt = {
1981
+ }, Zt = {
1979
1982
  alpha: !0,
1980
1983
  premultipliedAlpha: !0,
1981
1984
  antialias: !1,
@@ -1984,7 +1987,7 @@ var Jt = [
1984
1987
  preserveDrawingBuffer: !1,
1985
1988
  powerPreference: "high-performance"
1986
1989
  };
1987
- function Zt(e, t, n, r) {
1990
+ function Qt(e, t, n, r) {
1988
1991
  let i = e.createShader(t);
1989
1992
  if (e.shaderSource(i, n), e.compileShader(i), !e.getShaderParameter(i, e.COMPILE_STATUS)) {
1990
1993
  let t = e.getShaderInfoLog(i);
@@ -1992,23 +1995,23 @@ function Zt(e, t, n, r) {
1992
1995
  }
1993
1996
  return i;
1994
1997
  }
1995
- function Qt(e, t, n, r) {
1996
- let i = Zt(e, e.VERTEX_SHADER, t, `${r} vertex`), a = Zt(e, e.FRAGMENT_SHADER, n, `${r} fragment`), o = e.createProgram();
1998
+ function $t(e, t, n, r) {
1999
+ let i = Qt(e, e.VERTEX_SHADER, t, `${r} vertex`), a = Qt(e, e.FRAGMENT_SHADER, n, `${r} fragment`), o = e.createProgram();
1997
2000
  if (e.attachShader(o, i), e.attachShader(o, a), e.linkProgram(o), e.deleteShader(i), e.deleteShader(a), !e.getProgramParameter(o, e.LINK_STATUS)) {
1998
2001
  let t = e.getProgramInfoLog(o);
1999
2002
  throw e.deleteProgram(o), Error(`${r} program did not link: ${t}`);
2000
2003
  }
2001
2004
  return o;
2002
2005
  }
2003
- var $t = (e) => !e || e.plain ? 0 : e.version;
2004
- function en(e, t, n, r = null) {
2005
- let i = qt(n, r);
2006
+ var en = (e) => !e || e.plain ? 0 : e.version;
2007
+ function tn(e, t, n, r = null) {
2008
+ let i = Jt(n, r);
2006
2009
  t.passes.forEach((t) => {
2007
- t.spec.constants && (e.useProgram(t.program), Yt[t.spec.constants](e, t.at, i));
2008
- }), t.theme = n, t.styleKey = $t(r);
2010
+ t.spec.constants && (e.useProgram(t.program), Xt[t.spec.constants](e, t.at, i));
2011
+ }), t.theme = n, t.styleKey = en(r);
2009
2012
  }
2010
- function tn(e, t, n) {
2011
- let r = Qt(e, t.vert, t.frag, t.name), i = e.createVertexArray(), a = e.createBuffer();
2013
+ function nn(e, t, n) {
2014
+ let r = $t(e, t.vert, t.frag, t.name), i = e.createVertexArray(), a = e.createBuffer();
2012
2015
  e.bindVertexArray(i), t.verts || (e.bindBuffer(e.ARRAY_BUFFER, n), e.enableVertexAttribArray(0), e.vertexAttribPointer(0, 2, e.FLOAT, !1, 0, 0), e.vertexAttribDivisor(0, 0)), e.bindBuffer(e.ARRAY_BUFFER, a), t.attribs.forEach(([n, r, i]) => {
2013
2016
  e.enableVertexAttribArray(n), e.vertexAttribPointer(n, r, e.FLOAT, !1, t.stride * 4, i * 4), e.vertexAttribDivisor(n, 1);
2014
2017
  }), e.bindVertexArray(null);
@@ -2028,11 +2031,11 @@ function tn(e, t, n) {
2028
2031
  }
2029
2032
  };
2030
2033
  }
2031
- var nn = {
2034
+ var rn = {
2032
2035
  strokes: {
2033
2036
  name: "strokes",
2034
- vert: St,
2035
- frag: Ct,
2037
+ vert: Ct,
2038
+ frag: wt,
2036
2039
  stride: 10,
2037
2040
  attribs: [
2038
2041
  [
@@ -2054,8 +2057,8 @@ var nn = {
2054
2057
  },
2055
2058
  icons: {
2056
2059
  name: "icons",
2057
- vert: Pt,
2058
- frag: Ft,
2060
+ vert: Ft,
2061
+ frag: It,
2059
2062
  stride: 4,
2060
2063
  attribs: [[
2061
2064
  1,
@@ -2064,7 +2067,7 @@ var nn = {
2064
2067
  ]]
2065
2068
  }
2066
2069
  };
2067
- function rn(e, t = "dark", n = null) {
2070
+ function an(e, t = "dark", n = null) {
2068
2071
  let r = e.createBuffer();
2069
2072
  e.bindBuffer(e.ARRAY_BUFFER, r), e.bufferData(e.ARRAY_BUFFER, new Float32Array([
2070
2073
  -1,
@@ -2078,7 +2081,7 @@ function rn(e, t = "dark", n = null) {
2078
2081
  ]), e.STATIC_DRAW);
2079
2082
  let i = {
2080
2083
  corners: r,
2081
- passes: Jt.map((t) => tn(e, t, r)),
2084
+ passes: Yt.map((t) => nn(e, t, r)),
2082
2085
  theme: t,
2083
2086
  styleKey: 0,
2084
2087
  extras: {
@@ -2088,41 +2091,41 @@ function rn(e, t = "dark", n = null) {
2088
2091
  textures: /* @__PURE__ */ new Map(),
2089
2092
  iconStore: null
2090
2093
  };
2091
- return en(e, i, t, n), i;
2094
+ return tn(e, i, t, n), i;
2092
2095
  }
2093
- function an(e, t) {
2096
+ function on(e, t) {
2094
2097
  e.deleteBuffer(t.corners), t.textures.forEach(({ texture: t }) => e.deleteTexture(t)), [...t.passes, ...Object.values(t.extras).filter(Boolean)].forEach((t) => {
2095
2098
  e.deleteProgram(t.program), e.deleteVertexArray(t.vao), e.deleteBuffer(t.buffer);
2096
2099
  });
2097
2100
  }
2098
- function on(e, t = {}) {
2099
- let n = t.gl || e.getContext("webgl2", Xt);
2101
+ function sn(e, t = {}) {
2102
+ let n = t.gl || e.getContext("webgl2", Zt);
2100
2103
  if (!n) throw Error("WebGL2 is not available");
2101
- let r = t.mapStyle || (() => d), i = {
2104
+ let r = t.mapStyle || (() => L), i = {
2102
2105
  uploads: 0,
2103
2106
  draws: 0
2104
- }, s = rn(n), c = !1, l = 0, u = 0, f = null, p = null, m, h = null;
2105
- function g(e) {
2106
- return s.extras[e] || (s.extras[e] = tn(n, nn[e], s.corners)), s.extras[e];
2107
+ }, a = an(n), o = !1, s = 0, c = 0, l = null, u = null, d, f = null;
2108
+ function p(e) {
2109
+ return a.extras[e] || (a.extras[e] = nn(n, rn[e], a.corners)), a.extras[e];
2107
2110
  }
2108
- function _() {
2109
- s.passes.forEach((e) => {
2110
- let t = f[e.spec.name];
2111
+ function m() {
2112
+ a.passes.forEach((e) => {
2113
+ let t = l[e.spec.name];
2111
2114
  e.count = t.count, t.count && (n.bindBuffer(n.ARRAY_BUFFER, e.buffer), n.bufferData(n.ARRAY_BUFFER, t.data, n.DYNAMIC_DRAW));
2112
2115
  });
2113
- for (let e of Object.keys(nn)) {
2114
- let t = f[e];
2115
- if (!t.count && !s.extras[e]) continue;
2116
- let r = g(e);
2116
+ for (let e of Object.keys(rn)) {
2117
+ let t = l[e];
2118
+ if (!t.count && !a.extras[e]) continue;
2119
+ let r = p(e);
2117
2120
  r.count = t.count, t.count && (n.bindBuffer(n.ARRAY_BUFFER, r.buffer), n.bufferData(n.ARRAY_BUFFER, t.data, n.DYNAMIC_DRAW));
2118
2121
  }
2119
2122
  i.uploads++;
2120
2123
  }
2121
- function v(e, t) {
2124
+ function h(e, t) {
2122
2125
  n.bindTexture(n.TEXTURE_2D, e), n.texParameteri(n.TEXTURE_2D, n.TEXTURE_MIN_FILTER, t ? n.NEAREST : n.LINEAR_MIPMAP_LINEAR), n.texParameteri(n.TEXTURE_2D, n.TEXTURE_MAG_FILTER, t ? n.NEAREST : n.LINEAR);
2123
2126
  }
2124
- function y(e, t, r) {
2125
- let i = s.textures.get(e);
2127
+ function g(e, t, r) {
2128
+ let i = a.textures.get(e);
2126
2129
  if (!i || i.image !== t) {
2127
2130
  i && n.deleteTexture(i.texture);
2128
2131
  let r = n.createTexture();
@@ -2130,92 +2133,92 @@ function on(e, t = {}) {
2130
2133
  image: t,
2131
2134
  texture: r,
2132
2135
  pixelated: null
2133
- }, s.textures.set(e, i);
2136
+ }, a.textures.set(e, i);
2134
2137
  }
2135
- return i.pixelated !== r && (v(i.texture, r), i.pixelated = r), i.texture;
2138
+ return i.pixelated !== r && (h(i.texture, r), i.pixelated = r), i.texture;
2136
2139
  }
2137
- function b(t, d, g) {
2138
- if (h = [
2140
+ function _(t, p, h) {
2141
+ if (f = [
2139
2142
  t,
2140
- d,
2141
- g
2142
- ], c || !s || !l || !u) return;
2143
- let v = r(), b = x(t, v), S = v.values ? v.values[o] : void 0;
2144
- (s.iconStore !== v.icons || s.glyphInk !== S) && (s.textures.forEach(({ texture: e }) => n.deleteTexture(e)), s.textures.clear(), s.iconStore = v.icons, s.glyphInk = S, p = null), (b !== p || b.version !== m) && (f = {
2145
- ...Wt(b),
2146
- strokes: Gt(b),
2147
- icons: Kt(b, (e) => de(e) ? !!he(fe(e), S) : a(e) ? !!oe(K(e).type, K(e).ink) : !!(v.icons && v.icons.get(e)), v)
2148
- }, p = b, m = b.version, _());
2149
- let C = b.theme || "dark";
2150
- (s.theme !== C || s.styleKey !== $t(v)) && en(n, s, C, v), n.viewport(0, 0, e.width, e.height), n.clearColor(0, 0, 0, 0), n.clear(n.COLOR_BUFFER_BIT), n.enable(n.BLEND), n.blendFunc(n.ONE, n.ONE_MINUS_SRC_ALPHA), s.passes.forEach((t) => {
2151
- t.count && (n.useProgram(t.program), n.uniform2f(t.uniforms.viewport, l, u), n.uniform3f(t.uniforms.cam, d.x, d.y, d.zoom), n.uniform1f(t.uniforms.dpr, e.width / l), n.bindVertexArray(t.vao), t.uniforms.time && n.uniform1f(t.uniforms.time, (g || 0) / 1e3), n.drawArraysInstanced(n.TRIANGLE_STRIP, 0, t.spec.verts || 4, t.count), i.draws++);
2143
+ p,
2144
+ h
2145
+ ], o || !a || !s || !c) return;
2146
+ let _ = r(), v = ie(t, _), y = _.values ? _.values[V] : void 0;
2147
+ (a.iconStore !== _.icons || a.glyphInk !== y) && (a.textures.forEach(({ texture: e }) => n.deleteTexture(e)), a.textures.clear(), a.iconStore = _.icons, a.glyphInk = y, u = null), (v !== u || v.version !== d) && (l = {
2148
+ ...Gt(v),
2149
+ strokes: Kt(v),
2150
+ icons: qt(v, (e) => ue(e) ? !!me(de(e), y) : E(e) ? !!S(U(e).type, U(e).ink) : !!(_.icons && _.icons.get(e)), _)
2151
+ }, u = v, d = v.version, m());
2152
+ let b = v.theme || "dark";
2153
+ (a.theme !== b || a.styleKey !== en(_)) && tn(n, a, b, _), n.viewport(0, 0, e.width, e.height), n.clearColor(0, 0, 0, 0), n.clear(n.COLOR_BUFFER_BIT), n.enable(n.BLEND), n.blendFunc(n.ONE, n.ONE_MINUS_SRC_ALPHA), a.passes.forEach((t) => {
2154
+ t.count && (n.useProgram(t.program), n.uniform2f(t.uniforms.viewport, s, c), n.uniform3f(t.uniforms.cam, p.x, p.y, p.zoom), n.uniform1f(t.uniforms.dpr, e.width / s), n.bindVertexArray(t.vao), t.uniforms.time && n.uniform1f(t.uniforms.time, (h || 0) / 1e3), n.drawArraysInstanced(n.TRIANGLE_STRIP, 0, t.spec.verts || 4, t.count), i.draws++);
2152
2155
  });
2153
- let w = s.extras.strokes;
2154
- w && w.count && (n.useProgram(w.program), n.uniform2f(w.uniforms.viewport, l, u), n.uniform3f(w.uniforms.cam, d.x, d.y, d.zoom), n.uniform1f(w.uniforms.dpr, e.width / l), n.bindVertexArray(w.vao), n.drawArraysInstanced(n.TRIANGLE_STRIP, 0, 4, w.count), i.draws++);
2155
- let T = s.extras.icons;
2156
- if (T && T.count) {
2157
- n.useProgram(T.program), n.uniform2f(T.uniforms.viewport, l, u), n.uniform3f(T.uniforms.cam, d.x, d.y, d.zoom), n.uniform1f(T.uniforms.dpr, e.width / l), n.uniform1i(T.at("u_tex"), 0), n.activeTexture(n.TEXTURE0), n.bindVertexArray(T.vao), n.bindBuffer(n.ARRAY_BUFFER, T.buffer);
2158
- for (let e of f.icons.groups) {
2159
- let t = de(e.kind), r = a(e.kind), o = t || r ? 14 : 0;
2160
- if (o && e.maxR * 2 * d.zoom < o) continue;
2161
- n.uniform1f(T.at("u_minR"), o / 2), n.uniform1f(T.at("u_sideRatio"), t ? 1 : r ? G : 1);
2162
- let s = t ? he(fe(e.kind), v.values && v.values["--corn-map-glyph"]) : r ? oe(K(e.kind).type, K(e.kind).ink) : v.icons && v.icons.get(e.kind);
2163
- s && (n.bindTexture(n.TEXTURE_2D, y(e.kind, s, !!v.pixelated && !t && !r)), n.vertexAttribPointer(1, 4, n.FLOAT, !1, 16, e.first * 4 * 4), n.drawArraysInstanced(n.TRIANGLE_STRIP, 0, 4, e.count), i.draws++);
2156
+ let C = a.extras.strokes;
2157
+ C && C.count && (n.useProgram(C.program), n.uniform2f(C.uniforms.viewport, s, c), n.uniform3f(C.uniforms.cam, p.x, p.y, p.zoom), n.uniform1f(C.uniforms.dpr, e.width / s), n.bindVertexArray(C.vao), n.drawArraysInstanced(n.TRIANGLE_STRIP, 0, 4, C.count), i.draws++);
2158
+ let w = a.extras.icons;
2159
+ if (w && w.count) {
2160
+ n.useProgram(w.program), n.uniform2f(w.uniforms.viewport, s, c), n.uniform3f(w.uniforms.cam, p.x, p.y, p.zoom), n.uniform1f(w.uniforms.dpr, e.width / s), n.uniform1i(w.at("u_tex"), 0), n.activeTexture(n.TEXTURE0), n.bindVertexArray(w.vao), n.bindBuffer(n.ARRAY_BUFFER, w.buffer);
2161
+ for (let e of l.icons.groups) {
2162
+ let t = ue(e.kind), r = E(e.kind), a = t || r ? 14 : 0;
2163
+ if (a && e.maxR * 2 * p.zoom < a) continue;
2164
+ n.uniform1f(w.at("u_minR"), a / 2), n.uniform1f(w.at("u_sideRatio"), t ? 1 : r ? x : 1);
2165
+ let o = t ? me(de(e.kind), _.values && _.values["--corn-map-glyph"]) : r ? S(U(e.kind).type, U(e.kind).ink) : _.icons && _.icons.get(e.kind);
2166
+ o && (n.bindTexture(n.TEXTURE_2D, g(e.kind, o, !!_.pixelated && !t && !r)), n.vertexAttribPointer(1, 4, n.FLOAT, !1, 16, e.first * 4 * 4), n.drawArraysInstanced(n.TRIANGLE_STRIP, 0, 4, e.count), i.draws++);
2164
2167
  }
2165
2168
  }
2166
2169
  n.bindVertexArray(null);
2167
2170
  }
2168
- let S = (e) => {
2169
- e.preventDefault(), c = !0, s = null;
2170
- }, C = () => {
2171
+ let v = (e) => {
2172
+ e.preventDefault(), o = !0, a = null;
2173
+ }, y = () => {
2171
2174
  try {
2172
- s = rn(n, h && h[0].theme || "dark", r()), c = !1, f && _(), h && b(...h);
2175
+ a = an(n, f && f[0].theme || "dark", r()), o = !1, l && m(), f && _(...f);
2173
2176
  } catch (e) {
2174
2177
  console.warn("WebGL2 context restored but the renderer could not be rebuilt:", e.message);
2175
2178
  }
2176
2179
  };
2177
- return e.addEventListener("webglcontextlost", S), e.addEventListener("webglcontextrestored", C), {
2180
+ return e.addEventListener("webglcontextlost", v), e.addEventListener("webglcontextrestored", y), {
2178
2181
  kind: "webgl2",
2179
2182
  stats: i,
2180
2183
  resize(t, n, r) {
2181
- l = t, u = n, e.width = Math.round(t * r), e.height = Math.round(n * r), h && b(...h);
2184
+ s = t, c = n, e.width = Math.round(t * r), e.height = Math.round(n * r), f && _(...f);
2182
2185
  },
2183
- draw: b,
2184
- destroy: w,
2186
+ draw: _,
2187
+ destroy: b,
2185
2188
  release() {
2186
- let e = c;
2187
- w();
2189
+ let e = o;
2190
+ b();
2188
2191
  try {
2189
2192
  let t = !e && n.getExtension ? n.getExtension("WEBGL_lose_context") : null;
2190
2193
  t && t.loseContext();
2191
2194
  } catch {}
2192
2195
  }
2193
2196
  };
2194
- function w() {
2195
- e.removeEventListener("webglcontextlost", S), e.removeEventListener("webglcontextrestored", C), s && !c && an(n, s), s = null, c = !0;
2197
+ function b() {
2198
+ e.removeEventListener("webglcontextlost", v), e.removeEventListener("webglcontextrestored", y), a && !o && on(n, a), a = null, o = !0;
2196
2199
  }
2197
2200
  }
2198
2201
  // ../explorer/renderer.js
2199
- function sn(e) {
2202
+ function cn(e) {
2200
2203
  let t = e.ownerDocument.createElement("canvas");
2201
2204
  return t.className = "hx-overlay", t.setAttribute("data-corn", "map-overlay"), t.setAttribute("part", "map-overlay"), t.setAttribute("aria-hidden", "true"), e.after(t), t;
2202
2205
  }
2203
- function cn(e, t = {}) {
2206
+ function ln(e, t = {}) {
2204
2207
  let n = t.prefer || null, r = t.mapStyle ? { mapStyle: t.mapStyle } : {};
2205
2208
  if (n === "canvas2d") return Me(e, r);
2206
2209
  let i = null;
2207
2210
  try {
2208
- i = e.getContext("webgl2", Xt);
2211
+ i = e.getContext("webgl2", Zt);
2209
2212
  } catch {}
2210
2213
  if (!i) return Me(e, r);
2211
2214
  try {
2212
- return on(e, {
2215
+ return sn(e, {
2213
2216
  gl: i,
2214
2217
  ...r
2215
2218
  });
2216
2219
  } catch (n) {
2217
2220
  console.warn(`WebGL2 renderer unavailable, drawing with Canvas 2D: ${n.message}`);
2218
- let i = (t.makeStandIn || sn)(e), a = Me(i, r);
2221
+ let i = (t.makeStandIn || cn)(e), a = Me(i, r);
2219
2222
  return {
2220
2223
  ...a,
2221
2224
  destroy() {
@@ -2225,7 +2228,7 @@ function cn(e, t = {}) {
2225
2228
  }
2226
2229
  }
2227
2230
  // ../explorer/cluster.js
2228
- function ln(e, t) {
2231
+ function un(e, t) {
2229
2232
  let n = /* @__PURE__ */ new Map();
2230
2233
  for (let e of t) !e.kind && !e.dashed && e.from && e.to && (n.get(e.from) || n.set(e.from, []).get(e.from)).push(e.to);
2231
2234
  let r = /* @__PURE__ */ new Set([e]), i = [e];
@@ -2233,139 +2236,139 @@ function ln(e, t) {
2233
2236
  return r;
2234
2237
  }
2235
2238
  // ../explorer/input.js
2236
- function un(e) {
2237
- let { state: t } = e, { render: n, getSpatialIndex: r, queueFrameWork: i, screenToWorld: a, getMinZoom: o, setHoverNode: s, labelNodeAt: c, fitGraphToViewport: l, fitPadding: d } = e.map, f = (t) => e.emit("select", t), p = () => e.emit("background"), m = () => e.emit("grab"), g = !1, _ = null, v = {
2239
+ function dn(e) {
2240
+ let { state: n } = e, { render: r, getSpatialIndex: i, queueFrameWork: a, screenToWorld: o, getMinZoom: s, setHoverNode: c, labelNodeAt: l, fitGraphToViewport: u, fitPadding: d } = e.map, f = (t) => e.emit("select", t), p = () => e.emit("background"), m = () => e.emit("grab"), h = !1, g = null, _ = {
2238
2241
  x: 0,
2239
2242
  y: 0
2240
2243
  }, y = {
2241
2244
  x: 0,
2242
2245
  y: 0
2243
- }, b = !1, x = null, S = null, C = 0, w = null, T = !1, E = null, D = null, O = null, ee = !1, k = "", A = () => t.isFreeform && t.view === "orbit";
2244
- function j(e) {
2245
- let n = t.canvas.getBoundingClientRect(), r = e.touches ? e.touches[0] : e, i = n.width && t.width ? t.width / n.width : 1, a = n.height && t.height ? t.height / n.height : 1;
2246
+ }, b = !1, x = null, S = null, C = 0, w = null, T = !1, E = null, D = null, O = null, A = !1, j = "", M = () => n.isFreeform && n.view === "orbit";
2247
+ function N(e) {
2248
+ let t = n.canvas.getBoundingClientRect(), r = e.touches ? e.touches[0] : e, i = t.width && n.width ? n.width / t.width : 1, a = t.height && n.height ? n.height / t.height : 1;
2246
2249
  return {
2247
- x: (r.clientX - n.left) * i,
2248
- y: (r.clientY - n.top) * a
2250
+ x: (r.clientX - t.left) * i,
2251
+ y: (r.clientY - t.top) * a
2249
2252
  };
2250
2253
  }
2251
- let N = {
2254
+ let P = {
2252
2255
  nodes: null,
2253
2256
  size: -1,
2254
2257
  map: null
2255
2258
  };
2256
- function P(e) {
2257
- return (N.nodes !== t.nodes || N.size !== t.nodes.length) && (N = {
2258
- nodes: t.nodes,
2259
- size: t.nodes.length,
2260
- map: new Map(t.nodes.map((e) => [e.id, e]))
2261
- }), N.map.get(e) || null;
2262
- }
2263
- function F(e, n, i) {
2264
- let a = Fe(r(), t.camera, e, n, i);
2265
- return a ? P(a.id) : null;
2266
- }
2267
- let ne = (e) => Math.hypot(e.touches[0].clientX - e.touches[1].clientX, e.touches[0].clientY - e.touches[1].clientY);
2268
- function I(e) {
2269
- let n = t.canvas.getBoundingClientRect();
2259
+ function F(e) {
2260
+ return (P.nodes !== n.nodes || P.size !== n.nodes.length) && (P = {
2261
+ nodes: n.nodes,
2262
+ size: n.nodes.length,
2263
+ map: new Map(n.nodes.map((e) => [e.id, e]))
2264
+ }), P.map.get(e) || null;
2265
+ }
2266
+ function I(e, t, r) {
2267
+ let a = Fe(i(), n.camera, e, t, r);
2268
+ return a ? F(a.id) : null;
2269
+ }
2270
+ let te = (e) => Math.hypot(e.touches[0].clientX - e.touches[1].clientX, e.touches[0].clientY - e.touches[1].clientY);
2271
+ function L(e) {
2272
+ let t = n.canvas.getBoundingClientRect();
2270
2273
  return {
2271
- x: (e.touches[0].clientX + e.touches[1].clientX) / 2 - n.left,
2272
- y: (e.touches[0].clientY + e.touches[1].clientY) / 2 - n.top
2274
+ x: (e.touches[0].clientX + e.touches[1].clientX) / 2 - t.left,
2275
+ y: (e.touches[0].clientY + e.touches[1].clientY) / 2 - t.top
2273
2276
  };
2274
2277
  }
2275
2278
  function R(e) {
2276
- if (T = !0, m(), s(null), e.touches && e.touches.length === 2) {
2277
- w = te(t.camera, ne(e), I(e)), E = null, g = !1, _ = null, x = null;
2279
+ if (T = !0, m(), c(null), e.touches && e.touches.length === 2) {
2280
+ w = se(n.camera, te(e), L(e)), E = null, h = !1, g = null, x = null;
2278
2281
  return;
2279
2282
  }
2280
- let n = !!(e.touches && e.touches.length > 0), r = j(e);
2283
+ let t = !!(e.touches && e.touches.length > 0), r = N(e);
2281
2284
  y = {
2282
2285
  x: r.x,
2283
2286
  y: r.y
2284
- }, b = !1, E = null, x = F(r.x, r.y, n), A() && x ? (_ = x, e.cancelable && e.preventDefault()) : (g = !0, v = r);
2285
- }
2286
- function re() {
2287
- D && w && Object.assign(t.camera, L(w, D.dist, D.mid, o())), D = null;
2288
- let n = E;
2289
- if (E = null, n) {
2290
- if (_ && A()) {
2291
- let r = a(n.x, n.y);
2292
- _.x = r.x, _.y = r.y, t.freeformPositions[_.id] = {
2293
- x: r.x,
2294
- y: r.y
2295
- }, e.touchScene(), h(e);
2296
- } else g && (t.camera.x += n.x - v.x, t.camera.y += n.y - v.y, v = n);
2297
- }
2287
+ }, b = !1, E = null, x = I(r.x, r.y, t), M() && x ? (g = x, e.cancelable && e.preventDefault()) : (h = !0, _ = r);
2298
2288
  }
2299
2289
  function z() {
2300
- let e = O;
2301
- if (O = null, !e || g || _) return;
2302
- let t = F(e.x, e.y, !1);
2303
- ie(!!t), s(t ? t.id : null);
2290
+ D && w && Object.assign(n.camera, ee(w, D.dist, D.mid, s())), D = null;
2291
+ let r = E;
2292
+ if (E = null, r) {
2293
+ if (g && M()) {
2294
+ let i = o(r.x, r.y);
2295
+ g.x = i.x, g.y = i.y, n.freeformPositions[g.id] = {
2296
+ x: i.x,
2297
+ y: i.y
2298
+ }, e.touchScene(), t(e);
2299
+ } else h && (n.camera.x += r.x - _.x, n.camera.y += r.y - _.y, _ = r);
2300
+ }
2304
2301
  }
2305
- function ie(e) {
2306
- e !== ee && t.canvas && (e && (k = t.canvas.style.cursor), ee = e, t.canvas.style.cursor = e ? "pointer" : k);
2302
+ function ne() {
2303
+ let e = O;
2304
+ if (O = null, !e || h || g) return;
2305
+ let t = I(e.x, e.y, !1);
2306
+ B(!!t), c(t ? t.id : null);
2307
2307
  }
2308
2308
  function B(e) {
2309
+ e !== A && n.canvas && (e && (j = n.canvas.style.cursor), A = e, n.canvas.style.cursor = e ? "pointer" : j);
2310
+ }
2311
+ function V(e) {
2309
2312
  if (e.touches && e.touches.length === 2 && w) {
2310
2313
  e.cancelable && e.preventDefault(), D = {
2311
- dist: ne(e),
2312
- mid: I(e)
2313
- }, i(re);
2314
+ dist: te(e),
2315
+ mid: L(e)
2316
+ }, a(z);
2314
2317
  return;
2315
2318
  }
2316
- let t = j(e);
2317
- Math.hypot(t.x - y.x, t.y - y.y) > 8 && (b = !0), _ && A() || g ? (e.cancelable && e.preventDefault(), E = t, i(re)) : e.touches || (O = t, i(z, { draw: !1 }));
2319
+ let t = N(e);
2320
+ Math.hypot(t.x - y.x, t.y - y.y) > 8 && (b = !0), g && M() || h ? (e.cancelable && e.preventDefault(), E = t, a(z)) : e.touches || (O = t, a(ne, { draw: !1 }));
2318
2321
  }
2319
- function V(e) {
2320
- re();
2321
- let n = !!(e.changedTouches && e.changedTouches.length > 0), r = t.canvas.getBoundingClientRect(), i = n ? {
2322
+ function H(e) {
2323
+ z();
2324
+ let t = !!(e.changedTouches && e.changedTouches.length > 0), r = n.canvas.getBoundingClientRect(), i = t ? {
2322
2325
  x: e.changedTouches[0].clientX - r.left,
2323
2326
  y: e.changedTouches[0].clientY - r.top
2324
- } : j(e);
2327
+ } : N(e);
2325
2328
  if (!b && T) {
2326
2329
  if (x) {
2327
- let e = F(i.x, i.y, n);
2330
+ let e = I(i.x, i.y, t);
2328
2331
  if (e && e.id === x.id) {
2329
- if (!A()) f(x);
2332
+ if (!M()) f(x);
2330
2333
  else {
2331
2334
  let e = Date.now();
2332
2335
  S && S.id === x.id && e - C < 380 ? (f(x), S = null, C = 0) : (S = x, C = e);
2333
2336
  }
2334
2337
  }
2335
2338
  } else {
2336
- let e = P(c(i.x, i.y));
2337
- e && u.includes(e.type) && e.id !== "root" ? l(d(), ln(e.id, t.edges)) : t.selectedNode && p();
2339
+ let e = F(l(i.x, i.y));
2340
+ e && k.includes(e.type) && e.id !== "root" ? u(d(), un(e.id, n.edges)) : n.selectedNode && p();
2338
2341
  }
2339
2342
  }
2340
- g = !1, _ = null, x = null, w = null, D = null, T = !1;
2341
- }
2342
- let { canvas: H } = t, ae = !(e.root && e.root.nodeType === 9), U = (r) => {
2343
- if (ae && !r.ctrlKey && !r.metaKey && e.active() !== t.canvas) return;
2344
- r.preventDefault(), m();
2345
- let i = j(r);
2346
- Object.assign(t.camera, M(t.camera, r.deltaY < 0 ? 1.12 : .88, i.x, i.y, o())), n();
2347
- }, W = e.root || H, G = [
2348
- e.listen(H, "mousedown", R),
2349
- e.listen(H, "mousemove", B),
2350
- e.listen(H, "mouseleave", () => {
2351
- O = null, ie(!1), s(null);
2343
+ h = !1, g = null, x = null, w = null, D = null, T = !1;
2344
+ }
2345
+ let { canvas: U } = n, W = !(e.root && e.root.nodeType === 9), G = (t) => {
2346
+ if (W && !t.ctrlKey && !t.metaKey && e.active() !== n.canvas) return;
2347
+ t.preventDefault(), m();
2348
+ let i = N(t);
2349
+ Object.assign(n.camera, v(n.camera, t.deltaY < 0 ? 1.12 : .88, i.x, i.y, s())), r();
2350
+ }, K = e.root || U, re = [
2351
+ e.listen(U, "mousedown", R),
2352
+ e.listen(U, "mousemove", V),
2353
+ e.listen(U, "mouseleave", () => {
2354
+ O = null, B(!1), c(null);
2352
2355
  }),
2353
- e.listen(W, "mouseup", V),
2354
- e.listen(H, "touchstart", R, { passive: !1 }),
2355
- e.listen(H, "touchmove", B, { passive: !1 }),
2356
- e.listen(W, "touchend", V, { passive: !1 }),
2357
- e.listen(W, "touchcancel", V, { passive: !1 }),
2358
- e.listen(H, "wheel", U, { passive: !1 })
2356
+ e.listen(K, "mouseup", H),
2357
+ e.listen(U, "touchstart", R, { passive: !1 }),
2358
+ e.listen(U, "touchmove", V, { passive: !1 }),
2359
+ e.listen(K, "touchend", H, { passive: !1 }),
2360
+ e.listen(K, "touchcancel", H, { passive: !1 }),
2361
+ e.listen(U, "wheel", G, { passive: !1 })
2359
2362
  ];
2360
- return () => G.forEach((e) => e());
2363
+ return () => re.forEach((e) => e());
2361
2364
  }
2362
2365
  // ../explorer/pieces/map.js
2363
- var dn = "Arrow keys pan, plus and minus zoom, 0 fits the map. N and P select the next and the previous node, Home and End the first and the last. F frames the selected node and what it lights. Escape clears the selection.", fn = "<canvas id=\"graph-canvas\" data-corn=\"map-canvas\" tabindex=\"0\" role=\"application\" aria-roledescription=\"map\" aria-label=\"Topology map\" aria-describedby=\"map-keys-help\"></canvas>", pn = ({ keysHelp: e = dn } = {}) => ({ stage: `${fn}
2364
- <p id="map-keys-help" class="hx-sr-only">${k(e)}</p>
2366
+ var fn = "Arrow keys pan, plus and minus zoom, 0 fits the map. N and P select the next and the previous node, Home and End the first and the last. F frames the selected node and what it lights. Escape clears the selection.", pn = "<canvas id=\"graph-canvas\" data-corn=\"map-canvas\" tabindex=\"0\" role=\"application\" aria-roledescription=\"map\" aria-label=\"Topology map\" aria-describedby=\"map-keys-help\"></canvas>", mn = ({ keysHelp: e = fn } = {}) => ({ stage: `${pn}
2367
+ <p id="map-keys-help" class="hx-sr-only">${C(e)}</p>
2365
2368
  <p id="map-announcer" class="hx-sr-only" role="status" aria-live="polite"></p>
2366
2369
  <canvas id="label-canvas" data-corn="label-canvas" aria-hidden="true"></canvas>` });
2367
- function mn(e, t, n) {
2368
- let r = ae(t, e, "<div data-corn=\"map-stage\"></div>", null, "stage"), i = n.mountStatus(r[0], t, { follow: !1 });
2370
+ function hn(e, t, n) {
2371
+ let r = oe(t, e, "<div data-corn=\"map-stage\"></div>", null, "stage"), i = n.mountStatus(r[0], t, { follow: !1 });
2369
2372
  i.refuse("second-map"), t.emit("piece:refused", {
2370
2373
  piece: "map",
2371
2374
  reason: "second-map",
@@ -2376,6 +2379,7 @@ function mn(e, t, n) {
2376
2379
  return {
2377
2380
  inst: t,
2378
2381
  refused: !0,
2382
+ selection: () => null,
2379
2383
  update: a,
2380
2384
  fit: a,
2381
2385
  refresh: a,
@@ -2387,16 +2391,16 @@ function mn(e, t, n) {
2387
2391
  }
2388
2392
  };
2389
2393
  }
2390
- function hn(e) {
2394
+ function gn(e) {
2391
2395
  let t = e.nodeType === 11 ? e.host : e;
2392
2396
  return t && typeof t.getRootNode == "function" ? t.getRootNode() : null;
2393
2397
  }
2394
- function gn(e, t, n = {}) {
2395
- return !t && n.src !== void 0 && n.src !== null && n.src !== "" ? _n(e, n) : vn(e, t, n, null);
2398
+ function _n(e, t, n = {}) {
2399
+ return !t && n.src !== void 0 && n.src !== null && n.src !== "" ? vn(e, n) : yn(e, t, n, null);
2396
2400
  }
2397
- function _n(e, t) {
2401
+ function vn(e, t) {
2398
2402
  let n = e.nodeType === 11 ? e.host : e, r = {}, i = null, a = !1;
2399
- return import("./scope-Dg_uzefP.js").then((e) => e.n).then(({ mountScope: o }) => {
2403
+ return import("./scope-CUhp8mkf.js").then((e) => e.n).then(({ mountScope: o }) => {
2400
2404
  if (a) return;
2401
2405
  let s = o(n, {
2402
2406
  src: t.src,
@@ -2408,7 +2412,7 @@ function _n(e, t) {
2408
2412
  onAuth: t.onAuth,
2409
2413
  onError: t.onError
2410
2414
  });
2411
- i = vn(e, s.instance, {
2415
+ i = yn(e, s.instance, {
2412
2416
  ...t,
2413
2417
  ...r
2414
2418
  }, s);
@@ -2424,6 +2428,9 @@ function _n(e, t) {
2424
2428
  get map() {
2425
2429
  return i ? i.map : null;
2426
2430
  },
2431
+ selection() {
2432
+ return i ? i.selection() : null;
2433
+ },
2427
2434
  update(e = {}) {
2428
2435
  i ? i.update(e) : Object.assign(r, e);
2429
2436
  },
@@ -2444,178 +2451,192 @@ function _n(e, t) {
2444
2451
  }
2445
2452
  };
2446
2453
  }
2447
- function vn(e, t, r, i) {
2448
- let a = !t;
2449
- a && (t = ne({
2450
- root: e,
2451
- base: r.base || "",
2452
- fetch: r.fetch,
2453
- strings: r.strings
2454
+ function yn(t, n, i, a) {
2455
+ let o = !n;
2456
+ o && (n = r({
2457
+ root: t,
2458
+ base: i.base || "",
2459
+ fetch: i.fetch,
2460
+ strings: i.strings
2454
2461
  }));
2455
- let o = R(t), s = () => {};
2456
- if (o) try {
2457
- s = t.attach(e);
2462
+ let s = u(n), c = () => {};
2463
+ if (s) try {
2464
+ c = n.attach(t);
2458
2465
  } catch {
2459
- return i && i.destroy(), mn(e, t, o);
2460
- }
2461
- let { state: c } = t, l = o ? o.source : null;
2462
- if (r.tokens) {
2463
- let t = hn(e);
2464
- t && B(t.nodeType === 9 ? t : t.ownerDocument, r.tokens), t && t.nodeType === 11 && B(t, r.tokens);
2465
- }
2466
- let u = A(t);
2467
- u.own(s), i && u.own(() => i.destroy());
2468
- let d = (e) => e === "canvas2d" ? "canvas2d" : "auto", f = (e) => e === "light" || e === "dark" ? e : "auto", p = {
2469
- renderer: d(r.renderer),
2470
- theme: f(r.theme),
2466
+ return a && a.destroy(), hn(t, n, s);
2467
+ }
2468
+ let { state: l } = n, d = s ? s.source : null;
2469
+ if (i.tokens) {
2470
+ let e = gn(t);
2471
+ e && b(e.nodeType === 9 ? e : e.ownerDocument, i.tokens), e && e.nodeType === 11 && b(e, i.tokens);
2472
+ }
2473
+ let p = y(n);
2474
+ p.own(c), a && p.own(() => a.destroy());
2475
+ let m = (e) => e === "canvas2d" ? "canvas2d" : "auto", h = (e) => e === "light" || e === "dark" ? e : "auto", g = {
2476
+ renderer: m(i.renderer),
2477
+ theme: h(i.theme),
2471
2478
  topology: void 0
2472
- }, h = r.topology !== void 0 && r.topology !== null, g = !1, _ = !1, v = pn({ keysHelp: r.keysHelp }).stage, y = r.slots && r.slots.stage ? r.slots : null, b = ae(t, e, y ? v : `<div data-corn="map-stage">${v}</div>`, y, "stage"), x = (e) => b.map((t) => t.matches(e) ? t : t.querySelector(e)).find(Boolean);
2473
- u.own(() => {
2474
- for (let e of [...b, c.canvas]) e && e.remove();
2479
+ }, _ = i.topology !== void 0 && i.topology !== null, v = !1, x = !1, S = mn({ keysHelp: i.keysHelp }).stage, C = i.slots && i.slots.stage ? i.slots : null, w = oe(n, t, C ? S : `<div data-corn="map-stage">${S}</div>`, C, "stage"), T = (e) => w.map((t) => t.matches(e) ? t : t.querySelector(e)).find(Boolean);
2480
+ p.own(() => {
2481
+ for (let e of [...w, l.canvas]) e && e.remove();
2475
2482
  });
2476
- let S = b.find((e) => e.matches("[data-corn=\"map-stage\"]")) || null;
2477
- if (l && S) {
2478
- let e = o.mountStatus(S, t, {
2479
- onRetry: () => l.load(),
2483
+ let E = T("#map-announcer");
2484
+ if (E) {
2485
+ let e = D(n, E);
2486
+ p.on("announce:write", (t) => (e(t), !0));
2487
+ }
2488
+ let O = w.find((e) => e.matches("[data-corn=\"map-stage\"]")) || null;
2489
+ if (d && O) {
2490
+ let e = s.mountStatus(O, n, {
2491
+ onRetry: () => d.load(),
2480
2492
  focusMap: () => {
2481
- c.canvas && c.canvas.focus();
2493
+ l.canvas && l.canvas.focus();
2482
2494
  }
2483
2495
  });
2484
- u.own(e.destroy);
2485
- }
2486
- c.canvas = x("[data-corn=\"map-canvas\"]"), c.labelCanvas = x("[data-corn=\"label-canvas\"]"), c.ctx = t.doc.createElement("canvas").getContext("2d");
2487
- let C = lt(t, r.measureCovered ? { measureCovered: r.measureCovered } : {}), w = n(t);
2488
- u.own(w.watch()), u.own(w.onChange(() => C.render()));
2489
- let T = () => p.renderer === "canvas2d" ? "canvas2d" : null, D = () => C.setRenderer(cn(c.canvas, {
2490
- prefer: T(),
2491
- mapStyle: w.get
2492
- })), O = t.win && t.win.matchMedia ? t.win.matchMedia("(prefers-color-scheme: light)") : null;
2493
- function k() {
2494
- if (p.theme === "light" || p.theme === "dark") return p.theme;
2495
- if (o && (o.theme === "light" || o.theme === "dark")) return o.theme;
2496
- let e = t.doc && t.doc.documentElement, n = e ? e.getAttribute("data-theme") : null;
2497
- return n === "light" || n === "dark" ? n : m("system", !!(O && O.matches));
2496
+ p.own(e.destroy);
2497
+ }
2498
+ l.canvas = T("[data-corn=\"map-canvas\"]"), l.labelCanvas = T("[data-corn=\"label-canvas\"]"), l.ctx = n.doc.createElement("canvas").getContext("2d");
2499
+ let k = lt(n, i.measureCovered ? { measureCovered: i.measureCovered } : {}), A = ne(n);
2500
+ p.own(A.watch()), p.own(A.onChange(() => k.render()));
2501
+ let ee = () => g.renderer === "canvas2d" ? "canvas2d" : null, j = () => k.setRenderer(ln(l.canvas, {
2502
+ prefer: ee(),
2503
+ mapStyle: A.get
2504
+ })), M = n.win && n.win.matchMedia ? n.win.matchMedia("(prefers-color-scheme: light)") : null;
2505
+ function P() {
2506
+ if (g.theme === "light" || g.theme === "dark") return g.theme;
2507
+ if (s && (s.theme === "light" || s.theme === "dark")) return s.theme;
2508
+ let t = n.doc && n.doc.documentElement, r = t ? t.getAttribute("data-theme") : null;
2509
+ return r === "light" || r === "dark" ? r : e("system", !!(M && M.matches));
2498
2510
  }
2499
- function M() {
2500
- if (g) return;
2501
- let e = k();
2502
- w.refresh(), c.theme !== e && (c.theme = e, t.touchScene()), C.render();
2503
- }
2504
- c.theme = k(), o && u.own(o.serverTheme.adopt(e)), o && (u.on("theme", () => M()), u.on("scope:theme", () => M())), O && O.addEventListener && (O.addEventListener("change", M), u.own(() => O.removeEventListener("change", M)));
2505
- let te = t.win && t.win.MutationObserver;
2506
- if (te && t.doc && t.doc.documentElement) {
2507
- let e = new te(M);
2508
- e.observe(t.doc.documentElement, {
2511
+ function F() {
2512
+ if (v) return;
2513
+ let e = P();
2514
+ A.refresh(), l.theme !== e && (l.theme = e, n.touchScene()), k.render();
2515
+ }
2516
+ l.theme = P(), s && p.own(s.serverTheme.adopt(t)), s && (p.on("theme", () => F()), p.on("scope:theme", () => F())), M && M.addEventListener && (M.addEventListener("change", F), p.own(() => M.removeEventListener("change", F)));
2517
+ let I = n.win && n.win.MutationObserver;
2518
+ if (I && n.doc && n.doc.documentElement) {
2519
+ let e = new I(F);
2520
+ e.observe(n.doc.documentElement, {
2509
2521
  attributes: !0,
2510
2522
  attributeFilter: ["data-theme", "class"]
2511
- }), u.own(() => e.disconnect());
2512
- }
2513
- D();
2514
- let P = () => pt(t), F = () => {
2515
- c.nodes.length && C.fitGraphToViewport(C.fitPadding());
2516
- }, I = (e) => c.nodes.find((t) => t.id === e) || null, L = null;
2517
- u.on("select", (e) => W(t, e, { source: "tap" })), u.on("background", () => E(t, { source: "tap" })), u.on("grab", () => ee(t)), u.on("selection", ({ node: e, edge: t, source: n }) => {
2518
- g || ((e || t) && (L = null), r.onSelect && (e ? r.onSelect({
2523
+ }), p.own(() => e.disconnect());
2524
+ }
2525
+ j();
2526
+ let te = () => pt(n), L = () => {
2527
+ l.nodes.length && k.fitGraphToViewport(k.fitPadding());
2528
+ }, R = (e) => l.nodes.find((t) => t.id === e) || null, z = null;
2529
+ p.on("select", (e) => q(n, e, { source: "tap" })), p.on("background", () => N(n, { source: "tap" })), p.on("grab", () => re(n)), p.on("selection", ({ node: e, edge: t, source: n }) => {
2530
+ v || ((e || t) && (z = null), i.onSelect && (e ? i.onSelect({
2519
2531
  id: e.id,
2520
2532
  kind: "node",
2521
2533
  source: n
2522
- }) : t ? r.onSelect({
2534
+ }) : t ? i.onSelect({
2523
2535
  id: `${t.from}->${t.to}`,
2524
2536
  kind: "edge",
2525
2537
  from: t.from,
2526
2538
  to: t.to,
2527
2539
  source: n
2528
- }) : r.onSelect({
2540
+ }) : i.onSelect({
2529
2541
  id: null,
2530
2542
  kind: null,
2531
2543
  source: n
2532
2544
  })));
2533
2545
  });
2534
- function re(e) {
2535
- let n = I(String(e));
2536
- return !n || g ? !1 : (W(t, n, {
2546
+ function B(e) {
2547
+ let t = R(String(e));
2548
+ return !t || v ? !1 : (q(n, t, {
2537
2549
  frame: !0,
2538
2550
  source: "api"
2539
2551
  }), !0);
2540
2552
  }
2541
- let z = () => {}, ie = !!t.root && t.root.nodeType === 9;
2542
- function V() {
2543
- let e = c.canvas, n = [un(t)];
2544
- ie || n.push(t.listen(e, "pointerdown", (t) => {
2553
+ let V = () => {}, H = !!n.root && n.root.nodeType === 9;
2554
+ function U() {
2555
+ let e = l.canvas, t = [dn(n)];
2556
+ H || t.push(n.listen(e, "pointerdown", (t) => {
2545
2557
  if (t.pointerType === "mouse" && e.setPointerCapture) try {
2546
2558
  e.setPointerCapture(t.pointerId);
2547
2559
  } catch {}
2548
- })), j(t), N(t), n.push(() => j(t)), z = () => n.forEach((e) => e());
2560
+ })), f(n), W(n), t.push(() => f(n)), V = () => t.forEach((e) => e());
2549
2561
  }
2550
- u.own(C.onPaint(() => {
2551
- !_ && c.nodes.length && (_ = !0, r.onReady && r.onReady());
2552
- })), V(), u.own(() => z());
2553
- let H = () => {
2554
- !h && l && l.topology && l.topology !== p.topology && (p.topology = l.topology, U(l.topology));
2562
+ p.own(k.onPaint(() => {
2563
+ !x && l.nodes.length && (x = !0, i.onReady && i.onReady());
2564
+ })), U(), p.own(() => V());
2565
+ let G = () => {
2566
+ !_ && d && d.topology && d.topology !== g.topology && (g.topology = d.topology, K(d.topology));
2555
2567
  };
2556
- l && u.on("source", (e) => {
2557
- e.state === "ready" && H();
2558
- }), u.own(C.watchSize()), C.resize();
2559
- function U(e) {
2560
- let n = c.selectedNode ? c.selectedNode.id : null;
2561
- ft(t, e);
2562
- let r = n ? I(n) : null;
2563
- c.nodes.length && (P(), F());
2564
- let i = !r && L ? I(L) : null;
2565
- i && W(t, i, { source: "api" }), C.render(), C.ensureFlowLoop();
2566
- }
2567
- function G(e) {
2568
- let n = e === "dataflow" ? "dataflow" : "orbit";
2569
- c.view !== n && (c.view = n, t.touchScene(), c.nodes.length && (P(), F(), C.ensureFlowLoop()));
2568
+ d && p.on("source", (e) => {
2569
+ e.state === "ready" && G();
2570
+ }), p.own(k.watchSize()), k.resize();
2571
+ function K(e) {
2572
+ let t = l.selectedNode ? l.selectedNode.id : null;
2573
+ ft(n, e);
2574
+ let r = t ? R(t) : null;
2575
+ l.nodes.length && (te(), L());
2576
+ let i = !r && z ? R(z) : null;
2577
+ i && q(n, i, { source: "api" }), k.render(), k.ensureFlowLoop();
2570
2578
  }
2571
- function K() {
2572
- let e = C.getRenderer();
2573
- e.release ? e.release() : e.destroy(), z();
2574
- let n = t.doc.createElement("template");
2575
- n.innerHTML = fn;
2576
- let r = n.content.firstElementChild;
2579
+ function ie(e) {
2580
+ let t = e === "dataflow" ? "dataflow" : "orbit";
2581
+ l.view !== t && (l.view = t, n.touchScene(), l.nodes.length && (te(), L(), k.ensureFlowLoop()));
2582
+ }
2583
+ function J() {
2584
+ let e = k.getRenderer();
2585
+ e.release ? e.release() : e.destroy(), V();
2586
+ let t = n.doc.createElement("template");
2587
+ t.innerHTML = pn;
2588
+ let r = t.content.firstElementChild;
2577
2589
  r.setAttribute("part", "map-canvas");
2578
- let i = t.active() === c.canvas;
2579
- c.canvas.replaceWith(r), c.canvas = r, V(), D(), C.resize(), i && r.focus();
2590
+ let i = n.active() === l.canvas;
2591
+ l.canvas.replaceWith(r), l.canvas = r, U(), j(), k.resize(), i && r.focus();
2580
2592
  }
2581
- function oe(e = {}) {
2582
- if (!g) {
2593
+ function ae(e = {}) {
2594
+ if (!v) {
2583
2595
  if ("renderer" in e) {
2584
- let t = d(e.renderer);
2585
- t !== p.renderer && (p.renderer = t, K());
2596
+ let t = m(e.renderer);
2597
+ t !== g.renderer && (g.renderer = t, J());
2586
2598
  }
2587
2599
  if ("theme" in e) {
2588
- let t = f(e.theme);
2589
- t !== p.theme && (p.theme = t, M());
2600
+ let t = h(e.theme);
2601
+ t !== g.theme && (g.theme = t, F());
2590
2602
  }
2591
- if ("topology" in e && (h = e.topology !== void 0 && e.topology !== null, h && e.topology !== p.topology ? (p.topology = e.topology, U(e.topology)) : !h && l && l.topology ? (p.topology = void 0, H()) : !h && e.topology !== p.topology && (p.topology = e.topology, U(e.topology))), "view" in e && G(e.view === "dataflow" ? "dataflow" : "orbit"), "node" in e) {
2592
- let n = e.node == null || e.node === "" ? null : String(e.node);
2593
- if (n === null) L = null, (c.selectedNode || c.selectedEdge) && E(t, { source: "api" });
2603
+ if ("topology" in e && (_ = e.topology !== void 0 && e.topology !== null, _ && e.topology !== g.topology ? (g.topology = e.topology, K(e.topology)) : !_ && d && d.topology ? (g.topology = void 0, G()) : !_ && e.topology !== g.topology && (g.topology = e.topology, K(e.topology))), "view" in e && ie(e.view === "dataflow" ? "dataflow" : "orbit"), "node" in e) {
2604
+ let t = e.node == null || e.node === "" ? null : String(e.node);
2605
+ if (t === null) z = null, (l.selectedNode || l.selectedEdge) && N(n, { source: "api" });
2594
2606
  else {
2595
- let e = I(n);
2596
- e ? c.selectedNode && c.selectedNode.id === n || W(t, e, { source: "api" }) : L = n;
2607
+ let e = R(t);
2608
+ e ? l.selectedNode && l.selectedNode.id === t || q(n, e, { source: "api" }) : z = t;
2597
2609
  }
2598
2610
  }
2599
2611
  }
2600
2612
  }
2601
2613
  function se() {
2602
- g || (g = !0, u.destroy(), C.destroy(), a && t.destroy());
2614
+ v || (v = !0, p.destroy(), k.destroy(), o && n.destroy());
2603
2615
  }
2604
- let ce = {};
2616
+ let Y = {};
2605
2617
  for (let e of [
2606
2618
  "topology",
2607
2619
  "view",
2608
2620
  "node"
2609
- ]) r[e] !== void 0 && (ce[e] = r[e]);
2610
- return oe(ce), H(), M(), {
2611
- inst: t,
2612
- map: C,
2613
- update: oe,
2621
+ ]) i[e] !== void 0 && (Y[e] = i[e]);
2622
+ return ae(Y), G(), F(), p.own(() => n.emit("map:gone")), n.emit("map:ready"), {
2623
+ inst: n,
2624
+ map: k,
2625
+ selection() {
2626
+ return l.selectedNode ? {
2627
+ id: l.selectedNode.id,
2628
+ kind: "node"
2629
+ } : l.selectedEdge ? {
2630
+ id: `${l.selectedEdge.from}->${l.selectedEdge.to}`,
2631
+ kind: "edge"
2632
+ } : null;
2633
+ },
2634
+ update: ae,
2614
2635
  destroy: se,
2615
- fit: F,
2616
- focusNode: re,
2617
- refresh: M,
2618
- applyTheme: (e) => w.applyTheme(e)
2636
+ fit: L,
2637
+ focusNode: B,
2638
+ refresh: F,
2639
+ applyTheme: (e) => A.applyTheme(e)
2619
2640
  };
2620
2641
  }
2621
- export { ft as i, pt as n, mt as r, gn as t };
2642
+ export { ft as i, pt as n, mt as r, _n as t };