@lincyaw/aegis-ui 0.13.0 → 0.14.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.
@@ -1,90 +1,90 @@
1
- import { jsx as u, jsxs as H, Fragment as ge } from "react/jsx-runtime";
2
- import { useId as ie, useState as se, useMemo as D, useCallback as z, useContext as ue, useEffect as me } from "react";
3
- import { graphlib as fe, layout as he } from "@dagrejs/dagre";
4
- import { ReactFlowProvider as ve, Position as A, useReactFlow as J, ReactFlow as be, Background as _e, BackgroundVariant as we, Controls as ye, MiniMap as xe, useStoreApi as Se, useStore as W, getViewportForBounds as q, Handle as ee, useInternalNode as Ne } from "@xyflow/react";
5
- import { useIsomorphicLayoutEffect as Y } from "../../hooks/useIsomorphicLayoutEffect.js";
6
- import { useMediaQuery as Me } from "../../hooks/useMediaQuery.js";
1
+ import { jsx as u, jsxs as H, Fragment as me } from "react/jsx-runtime";
2
+ import { useId as ne, useState as Y, useMemo as D, useCallback as z, useContext as fe, useEffect as he } from "react";
3
+ import { graphlib as ve, layout as be } from "@dagrejs/dagre";
4
+ import { ReactFlowProvider as _e, Position as A, useReactFlow as Q, ReactFlow as we, Background as ye, BackgroundVariant as xe, Controls as Se, MiniMap as Ne, useStoreApi as Me, useStore as X, getViewportForBounds as te, Handle as oe, useInternalNode as Ee } from "@xyflow/react";
5
+ import { useIsomorphicLayoutEffect as J } from "../../hooks/useIsomorphicLayoutEffect.js";
6
+ import { useMediaQuery as Re } from "../../hooks/useMediaQuery.js";
7
7
  /* empty css */
8
- import { StatusDot as Ee } from "./StatusDot.js";
9
- import { SelectedRowDetailContext as Re } from "./selectedRowDetail.js";
10
- import { useStrings as Oe } from "../../locale/useStrings.js";
11
- const K = 180, Q = 64, Le = 320, ne = 28, Te = 64, $e = {
12
- "--aegis-service-map-node-w": `${String(K)}px`,
13
- "--aegis-service-map-node-h": `${String(Q)}px`,
14
- "--aegis-service-map-node-max-w": `${String(Le)}px`,
15
- "--aegis-service-map-group-label-h": `${String(ne)}px`
16
- }, De = { width: K, height: Q };
17
- function Ae(t, i, r, n) {
18
- const a = t.map((o) => o.id), p = new Set(a);
8
+ import { StatusDot as Oe } from "./StatusDot.js";
9
+ import { SelectedRowDetailContext as Le } from "./selectedRowDetail.js";
10
+ import { useStrings as Te } from "../../locale/useStrings.js";
11
+ const q = 180, ee = 64, $e = 320, ae = 28, De = 64, Ae = {
12
+ "--aegis-service-map-node-w": `${String(q)}px`,
13
+ "--aegis-service-map-node-h": `${String(ee)}px`,
14
+ "--aegis-service-map-node-max-w": `${String($e)}px`,
15
+ "--aegis-service-map-group-label-h": `${String(ae)}px`
16
+ }, He = { width: q, height: ee };
17
+ function Ie(e, n, i, a) {
18
+ const r = e.map((o) => o.id), p = new Set(r);
19
19
  return {
20
- direction: n,
21
- ids: a,
22
- links: i.filter((o) => p.has(o.source) && p.has(o.target)).map((o) => [o.source, o.target]),
23
- groups: r
20
+ direction: a,
21
+ ids: r,
22
+ links: n.filter((o) => p.has(o.source) && p.has(o.target)).map((o) => [o.source, o.target]),
23
+ groups: i
24
24
  };
25
25
  }
26
- function He(t, i) {
27
- const r = new Set(t), n = /* @__PURE__ */ new Set(), a = i.map((o) => {
26
+ function Pe(e, n) {
27
+ const i = new Set(e), a = /* @__PURE__ */ new Set(), r = n.map((o) => {
28
28
  const l = [...new Set(o.nodeIds)].filter(
29
- (s) => r.has(s) && !n.has(s)
29
+ (s) => i.has(s) && !a.has(s)
30
30
  );
31
- return l.forEach((s) => n.add(s)), { group: o, ids: l };
32
- }), p = t.filter((o) => !n.has(o));
33
- return [...a, { ids: p }].filter((o) => o.ids.length > 0);
31
+ return l.forEach((s) => a.add(s)), { group: o, ids: l };
32
+ }), p = e.filter((o) => !a.has(o));
33
+ return [...r, { ids: p }].filter((o) => o.ids.length > 0);
34
34
  }
35
- function Ie(t, i, r, n) {
36
- const a = new fe.Graph();
37
- a.setDefaultEdgeLabel(() => ({})), a.setGraph({
38
- rankdir: r,
35
+ function Fe(e, n, i, a) {
36
+ const r = new ve.Graph();
37
+ r.setDefaultEdgeLabel(() => ({})), r.setGraph({
38
+ rankdir: i,
39
39
  nodesep: 40,
40
40
  ranksep: 80,
41
41
  marginx: 16,
42
42
  marginy: 16
43
43
  });
44
- for (const s of t)
45
- a.setNode(s, { ...n(s) });
46
- for (const [s, e] of i)
47
- a.hasNode(s) && a.hasNode(e) && a.setEdge(s, e);
48
- he(a);
44
+ for (const s of e)
45
+ r.setNode(s, { ...a(s) });
46
+ for (const [s, t] of n)
47
+ r.hasNode(s) && r.hasNode(t) && r.setEdge(s, t);
48
+ be(r);
49
49
  const p = new Map(
50
- t.map((s) => {
51
- const { x: e = 0, y: g = 0 } = a.node(s), m = n(s);
52
- return [s, { x: e - m.width / 2, y: g - m.height / 2 }];
50
+ e.map((s) => {
51
+ const { x: t = 0, y: d = 0 } = r.node(s), m = a(s);
52
+ return [s, { x: t - m.width / 2, y: d - m.height / 2 }];
53
53
  })
54
- ), { width: o = 0, height: l = 0 } = a.graph();
54
+ ), { width: o = 0, height: l = 0 } = r.graph();
55
55
  return { positions: p, width: o, height: l };
56
56
  }
57
- function Pe(t, i, r) {
58
- const n = (e) => `${r}-group-${String(t.groups.indexOf(e))}`, a = t.direction === "LR", p = He(t.ids, t.groups).map((e) => {
59
- const g = Ie(e.ids, t.links, t.direction, (f) => i.get(f) ?? De), m = e.group === void 0 ? 0 : ne;
57
+ function ze(e, n, i) {
58
+ const a = (t) => `${i}-group-${String(e.groups.indexOf(t))}`, r = e.direction === "LR", p = Pe(e.ids, e.groups).map((t) => {
59
+ const d = Fe(t.ids, e.links, e.direction, (f) => n.get(f) ?? He), m = t.group === void 0 ? 0 : ae;
60
60
  return {
61
- ...e,
62
- ...g,
61
+ ...t,
62
+ ...d,
63
63
  labelHeight: m,
64
- boxHeight: g.height + m
64
+ boxHeight: d.height + m
65
65
  };
66
66
  }), o = Math.max(
67
67
  0,
68
- ...p.map((e) => a ? e.boxHeight : e.width)
68
+ ...p.map((t) => r ? t.boxHeight : t.width)
69
69
  );
70
70
  let l = 0;
71
- const s = p.map((e) => {
72
- const g = a ? { x: l, y: (o - e.boxHeight) / 2 } : { x: (o - e.width) / 2, y: l };
73
- return l += (a ? e.width : e.boxHeight) + Te, { ...e, origin: g };
71
+ const s = p.map((t) => {
72
+ const d = r ? { x: l, y: (o - t.boxHeight) / 2 } : { x: (o - t.width) / 2, y: l };
73
+ return l += (r ? t.width : t.boxHeight) + De, { ...t, origin: d };
74
74
  });
75
75
  return {
76
76
  groups: s.flatMap(
77
- (e) => e.group === void 0 ? [] : [
77
+ (t) => t.group === void 0 ? [] : [
78
78
  {
79
79
  // Prefixed, so a group may share an id with a node.
80
- id: `group:${e.group.id}`,
80
+ id: `group:${t.group.id}`,
81
81
  type: "serviceGroup",
82
- position: e.origin,
83
- width: e.width,
84
- height: e.boxHeight,
82
+ position: t.origin,
83
+ width: t.width,
84
+ height: t.boxHeight,
85
85
  data: {
86
- label: e.group.label,
87
- labelId: n(e.group)
86
+ label: t.group.label,
87
+ labelId: a(t.group)
88
88
  },
89
89
  // Not a group for assistive technology: the box contains no
90
90
  // nodes in the DOM, so its label is plain text, which its
@@ -108,50 +108,50 @@ function Pe(t, i, r) {
108
108
  ),
109
109
  positions: new Map(
110
110
  s.flatMap(
111
- (e) => [...e.positions].map(([g, m]) => [
112
- g,
111
+ (t) => [...t.positions].map(([d, m]) => [
112
+ d,
113
113
  {
114
- x: e.origin.x + m.x,
115
- y: e.origin.y + e.labelHeight + m.y
114
+ x: t.origin.x + m.x,
115
+ y: t.origin.y + t.labelHeight + m.y
116
116
  }
117
117
  ])
118
118
  )
119
119
  ),
120
120
  groupLabels: new Map(
121
- s.flatMap((e) => {
122
- const { group: g } = e;
123
- return g === void 0 ? [] : e.ids.map((m) => [m, n(g)]);
121
+ s.flatMap((t) => {
122
+ const { group: d } = t;
123
+ return d === void 0 ? [] : t.ids.map((m) => [m, a(d)]);
124
124
  })
125
125
  )
126
126
  };
127
127
  }
128
- function Fe({
129
- data: t
128
+ function Be({
129
+ data: e
130
130
  }) {
131
- return /* @__PURE__ */ u("div", { className: "aegis-service-map__group", children: /* @__PURE__ */ u("span", { id: t.labelId, className: "aegis-service-map__group-label", children: t.label }) });
131
+ return /* @__PURE__ */ u("div", { className: "aegis-service-map__group", children: /* @__PURE__ */ u("span", { id: e.labelId, className: "aegis-service-map__group-label", children: e.label }) });
132
132
  }
133
- const ze = {
133
+ const Ge = {
134
134
  ok: "ink",
135
135
  active: "ink",
136
136
  warn: "caution",
137
137
  error: "warning",
138
138
  muted: "muted"
139
139
  };
140
- function Be({
141
- data: t
140
+ function ke({
141
+ data: e
142
142
  }) {
143
- const { node: i, selected: r } = t, n = i.status ?? "ok", a = ze[n];
143
+ const { node: n, selected: i } = e, a = n.status ?? "ok", r = Ge[a];
144
144
  return /* @__PURE__ */ H(
145
145
  "div",
146
146
  {
147
147
  className: [
148
148
  "aegis-service-map__node",
149
- `aegis-service-map__node--${n}`,
150
- r ? "aegis-service-map__node--selected" : ""
149
+ `aegis-service-map__node--${a}`,
150
+ i ? "aegis-service-map__node--selected" : ""
151
151
  ].filter(Boolean).join(" "),
152
152
  children: [
153
153
  /* @__PURE__ */ u(
154
- ee,
154
+ oe,
155
155
  {
156
156
  type: "target",
157
157
  position: A.Left,
@@ -161,25 +161,25 @@ function Be({
161
161
  /* @__PURE__ */ H("div", { className: "aegis-service-map__node-body", children: [
162
162
  /* @__PURE__ */ H("div", { className: "aegis-service-map__node-label", children: [
163
163
  /* @__PURE__ */ u(
164
- Ee,
164
+ Oe,
165
165
  {
166
- pulse: n === "active",
167
- tone: r && a === "ink" ? "inverted" : a
166
+ pulse: a === "active",
167
+ tone: i && r === "ink" ? "inverted" : r
168
168
  }
169
169
  ),
170
- /* @__PURE__ */ u("span", { className: "aegis-service-map__node-label-text", children: i.label })
170
+ /* @__PURE__ */ u("span", { className: "aegis-service-map__node-label-text", children: n.label })
171
171
  ] }),
172
- i.sublabel !== void 0 && /* @__PURE__ */ u("div", { className: "aegis-service-map__node-sublabel", children: i.sublabel })
172
+ n.sublabel !== void 0 && /* @__PURE__ */ u("div", { className: "aegis-service-map__node-sublabel", children: n.sublabel })
173
173
  ] }),
174
- i.badge !== void 0 && i.badge !== "" && /* @__PURE__ */ u(
174
+ n.badge !== void 0 && n.badge !== "" && /* @__PURE__ */ u(
175
175
  "span",
176
176
  {
177
- className: `aegis-service-map__node-badge aegis-service-map__node-badge--${n}`,
178
- children: i.badge
177
+ className: `aegis-service-map__node-badge aegis-service-map__node-badge--${a}`,
178
+ children: n.badge
179
179
  }
180
180
  ),
181
181
  /* @__PURE__ */ u(
182
- ee,
182
+ oe,
183
183
  {
184
184
  type: "source",
185
185
  position: A.Right,
@@ -190,15 +190,15 @@ function Be({
190
190
  }
191
191
  );
192
192
  }
193
- function Ge(t) {
194
- const { sourceX: i, sourceY: r, targetX: n, targetY: a, label: p, markerEnd: o, style: l } = t, s = ie(), e = (i + n) / 2, g = `M${i},${r} C${e},${r} ${e},${a} ${n},${a}`;
195
- return /* @__PURE__ */ H(ge, { children: [
196
- /* @__PURE__ */ u("path", { d: g, className: "aegis-service-map__edge-focus", fill: "none" }),
193
+ function Ce(e) {
194
+ const { sourceX: n, sourceY: i, targetX: a, targetY: r, label: p, markerEnd: o, style: l } = e, s = ne(), t = (n + a) / 2, d = `M${n},${i} C${t},${i} ${t},${r} ${a},${r}`;
195
+ return /* @__PURE__ */ H(me, { children: [
196
+ /* @__PURE__ */ u("path", { d, className: "aegis-service-map__edge-focus", fill: "none" }),
197
197
  /* @__PURE__ */ u(
198
198
  "path",
199
199
  {
200
200
  id: s,
201
- d: g,
201
+ d,
202
202
  className: "aegis-service-map__edge-path",
203
203
  markerEnd: o,
204
204
  style: l,
@@ -208,51 +208,51 @@ function Ge(t) {
208
208
  p !== void 0 && p !== "" && /* @__PURE__ */ u("text", { className: "aegis-service-map__edge-label", children: /* @__PURE__ */ u("textPath", { href: `#${s}`, startOffset: "50%", textAnchor: "middle", children: p }) })
209
209
  ] });
210
210
  }
211
- const ke = { service: Be, serviceGroup: Fe }, Ce = { service: Ge }, Ze = "(max-width: 768px)", E = 24, X = 0.1, C = 1, te = 11 / 13, U = 15, oe = 28, ae = 200, Z = (t) => `${t}px`;
212
- function Ve(t, i) {
211
+ const Ze = { service: ke, serviceGroup: Be }, Ve = { service: Ce }, je = "(max-width: 768px)", E = 24, K = 0.1, Z = 1, ie = 11 / 13, W = 15, se = 28, re = 200, V = (e) => `${e}px`;
212
+ function Ue(e, n) {
213
213
  return [
214
214
  .../* @__PURE__ */ new Set([
215
- t,
216
- ...i.filter(([r]) => r === t).map(([, r]) => r),
217
- ...i.filter(([, r]) => r === t).map(([r]) => r)
215
+ e,
216
+ ...n.filter(([i]) => i === e).map(([, i]) => i),
217
+ ...n.filter(([, i]) => i === e).map(([i]) => i)
218
218
  ])
219
219
  ];
220
220
  }
221
- function je(t) {
222
- return t.type === "serviceGroup" ? "aegis-service-map__minimap-group" : "";
221
+ function We(e) {
222
+ return e.type === "serviceGroup" ? "aegis-service-map__minimap-group" : "";
223
223
  }
224
- function Ue(t, i, r, n, a, p) {
225
- const { fitView: o, getNodes: l, getNodesBounds: s, setViewport: e } = J(), g = Se(), m = W((b) => b.width > 0 && b.height > 0), f = D(
226
- () => n !== void 0 && t.ids.includes(n) ? { id: n, near: Ve(n, t.links) } : void 0,
227
- [n, t]
228
- ), [x, I] = se();
229
- return me(() => {
230
- if (m && r) {
224
+ function Ye(e, n, i, a, r, p) {
225
+ const { fitView: o, getNodes: l, getNodesBounds: s, setViewport: t } = Q(), d = Me(), m = X((b) => b.width > 0 && b.height > 0), f = D(
226
+ () => a !== void 0 && e.ids.includes(a) ? { id: a, near: Ue(a, e.links) } : void 0,
227
+ [a, e]
228
+ ), [x, I] = Y();
229
+ return he(() => {
230
+ if (m && i) {
231
231
  const b = () => {
232
232
  I(f?.id ?? null);
233
233
  }, _ = {
234
- top: Z(E),
235
- bottom: Z(E),
236
- left: Z(U + oe + E),
237
- right: Z(
238
- a ? U + ae + E : E
234
+ top: V(E),
235
+ bottom: V(E),
236
+ left: V(W + se + E),
237
+ right: V(
238
+ r ? W + re + E : E
239
239
  )
240
- }, { width: S, height: y } = g.getState();
240
+ }, { width: S, height: y } = d.getState();
241
241
  if (f === void 0) {
242
- const R = l(), N = s(R), O = q(
242
+ const R = l(), N = s(R), O = te(
243
243
  N,
244
244
  S,
245
245
  y,
246
- X,
246
+ K,
247
247
  1,
248
248
  _
249
249
  );
250
- if (p && O.zoom < te) {
251
- const v = te, L = t.direction === "LR", B = (w) => L ? w.position.x : w.position.y, P = R.filter((w) => w.type === "service").reduce((w, F) => B(F) < B(w) ? F : w), { width: G = K, height: V = Q } = P.measured ?? {};
252
- e(
250
+ if (p && O.zoom < ie) {
251
+ const v = ie, L = e.direction === "LR", B = (w) => L ? w.position.x : w.position.y, P = R.filter((w) => w.type === "service").reduce((w, F) => B(F) < B(w) ? F : w), { width: G = q, height: j = ee } = P.measured ?? {};
252
+ t(
253
253
  L ? {
254
- x: U + oe + E - N.x * v,
255
- y: y / 2 - (P.position.y + V / 2) * v,
254
+ x: W + se + E - N.x * v,
255
+ y: y / 2 - (P.position.y + j / 2) * v,
256
256
  zoom: v
257
257
  } : {
258
258
  x: S / 2 - (P.position.x + G / 2) * v,
@@ -263,137 +263,138 @@ function Ue(t, i, r, n, a, p) {
263
263
  } else
264
264
  o({ maxZoom: 1, padding: _ }).then(b);
265
265
  } else {
266
- const R = q(
266
+ const R = te(
267
267
  s(f.near),
268
268
  S,
269
269
  y,
270
- X,
271
- C,
270
+ K,
271
+ Z,
272
272
  _
273
- ).zoom >= C;
273
+ ).zoom >= Z;
274
274
  o({
275
275
  nodes: (R ? f.near : [f.id]).map((N) => ({ id: N })),
276
- minZoom: C,
277
- maxZoom: C,
276
+ minZoom: Z,
277
+ maxZoom: Z,
278
278
  padding: _
279
279
  }).then(b);
280
280
  }
281
281
  }
282
282
  }, [
283
283
  m,
284
- r,
285
284
  i,
285
+ n,
286
286
  f,
287
- a,
287
+ r,
288
288
  p,
289
- t.direction,
290
- g,
289
+ e.direction,
290
+ d,
291
291
  o,
292
292
  l,
293
293
  s,
294
- e
294
+ t
295
295
  ]), x === (f?.id ?? null);
296
296
  }
297
- function We({
298
- nodeId: t,
297
+ function Xe({
298
+ nodeId: e,
299
+ fitted: n,
299
300
  selection: i
300
301
  }) {
301
- const r = W((e) => e.transform), n = W((e) => e.domNode), a = Ne(t);
302
- Y(
302
+ const a = X((d) => d.transform), r = X((d) => d.domNode), p = Ee(e);
303
+ J(
303
304
  () => () => {
304
305
  i.placeRow(null);
305
306
  },
306
307
  [i]
307
- ), Y(() => {
308
- const e = n?.querySelector(
309
- `.react-flow__node[data-id="${CSS.escape(t)}"]`
308
+ ), J(() => {
309
+ const d = r?.querySelector(
310
+ `.react-flow__node[data-id="${CSS.escape(e)}"]`
310
311
  );
311
- e instanceof HTMLElement && i.placeRow(e);
312
- }, [i, n, t, r]);
313
- const p = a?.measured.height;
314
- if (i.inline === null || a === void 0 || p === void 0)
312
+ n && d instanceof HTMLElement && i.placeRow(d);
313
+ }, [i, r, e, a, n]);
314
+ const o = p?.measured.height;
315
+ if (i.inline === null || p === void 0 || o === void 0)
315
316
  return null;
316
- const [, o, l] = r, s = (a.internals.positionAbsolute.y + p) * l + o;
317
+ const [, l, s] = a, t = (p.internals.positionAbsolute.y + o) * s + l;
317
318
  return /* @__PURE__ */ u(
318
319
  "div",
319
320
  {
320
321
  className: "aegis-service-map__detail",
321
- style: { marginTop: Math.max(s, 0) },
322
+ style: { marginTop: Math.max(t, 0) },
322
323
  children: i.inline
323
324
  }
324
325
  );
325
326
  }
326
- function Ye() {
327
- const { getViewport: t, setViewport: i } = J();
327
+ function Je() {
328
+ const { getViewport: e, setViewport: n } = Q();
328
329
  return z(
329
- (r) => {
330
- const n = r.target;
331
- if (!(n instanceof Element) || !n.matches(
330
+ (i) => {
331
+ const a = i.target;
332
+ if (!(a instanceof Element) || !a.matches(
332
333
  ".react-flow__node:focus-visible, .react-flow__edge:focus-visible"
333
334
  ))
334
335
  return;
335
- const { scrollLeft: a, scrollTop: p } = r.currentTarget, o = r.currentTarget.getBoundingClientRect(), l = n.getBoundingClientRect(), s = l.left - o.left + a, e = l.top - o.top + p;
336
- if (s >= 0 && e >= 0 && s + l.width <= o.width && e + l.height <= o.height)
336
+ const { scrollLeft: r, scrollTop: p } = i.currentTarget, o = i.currentTarget.getBoundingClientRect(), l = a.getBoundingClientRect(), s = l.left - o.left + r, t = l.top - o.top + p;
337
+ if (s >= 0 && t >= 0 && s + l.width <= o.width && t + l.height <= o.height)
337
338
  return;
338
- const { x: g, y: m, zoom: f } = t();
339
- i({
340
- x: g + o.width / 2 - (s + l.width / 2),
341
- y: m + o.height / 2 - (e + l.height / 2),
339
+ const { x: d, y: m, zoom: f } = e();
340
+ n({
341
+ x: d + o.width / 2 - (s + l.width / 2),
342
+ y: m + o.height / 2 - (t + l.height / 2),
342
343
  zoom: f
343
344
  });
344
345
  },
345
- [t, i]
346
+ [e, n]
346
347
  );
347
348
  }
348
- function Xe({
349
- nodes: t,
350
- edges: i,
351
- groups: r = [],
352
- direction: n = "LR",
353
- height: a,
349
+ function Ke({
350
+ nodes: e,
351
+ edges: n,
352
+ groups: i = [],
353
+ direction: a = "LR",
354
+ height: r,
354
355
  fillViewport: p = !1,
355
356
  onNodeClick: o,
356
357
  onEdgeClick: l,
357
358
  selectedNodeId: s,
358
- focusNodeId: e,
359
- minimap: g = e === void 0,
359
+ focusNodeId: t,
360
+ minimap: d = t === void 0,
360
361
  ariaLabel: m,
361
362
  className: f
362
363
  }) {
363
- const x = Oe(), I = ie(), b = `aegis-service-map${I.replace(/:/g, "-")}`, _ = o !== void 0, S = l !== void 0, [y, R] = se(
364
+ const x = Te(), I = ne(), b = `aegis-service-map${I.replace(/:/g, "-")}`, _ = o !== void 0, S = l !== void 0, [y, R] = Y(
364
365
  () => /* @__PURE__ */ new Map()
365
366
  ), N = D(
366
- () => JSON.stringify(Ae(t, i, r, n)),
367
- [t, i, r, n]
367
+ () => JSON.stringify(Ie(e, n, i, a)),
368
+ [e, n, i, a]
368
369
  ), O = D(() => JSON.parse(N), [N]), v = D(
369
- () => Pe(O, y, I),
370
+ () => ze(O, y, I),
370
371
  [O, y, I]
371
- ), L = n === "LR", B = D(
372
+ ), L = a === "LR", B = D(
372
373
  () => [
373
374
  ...v.groups,
374
- ...t.map((d) => {
375
+ ...e.map((g) => {
375
376
  const c = [
376
- v.groupLabels.get(d.id),
377
+ v.groupLabels.get(g.id),
377
378
  _ ? `react-flow__node-desc-${b}` : void 0
378
379
  ].filter(Boolean).join(" ");
379
380
  return {
380
- id: d.id,
381
+ id: g.id,
381
382
  type: "service",
382
- position: v.positions.get(d.id) ?? { x: 0, y: 0 },
383
+ position: v.positions.get(g.id) ?? { x: 0, y: 0 },
383
384
  // Handed back as applyNodeChanges would, so React Flow keeps the
384
385
  // size it measured instead of measuring the node again.
385
- measured: y.get(d.id),
386
- ariaLabel: d.label,
386
+ measured: y.get(g.id),
387
+ ariaLabel: g.label,
387
388
  // React Flow gives only a focusable node a role, and the role
388
389
  // description below needs one.
389
390
  ariaRole: "group",
390
391
  domAttributes: {
391
392
  "aria-roledescription": x.serviceMapNodeRole,
392
393
  // A group takes no aria-selected.
393
- "aria-current": s === d.id ? !0 : void 0,
394
+ "aria-current": s === g.id ? !0 : void 0,
394
395
  "aria-describedby": c === "" ? void 0 : c
395
396
  },
396
- data: { node: d, selected: s === d.id },
397
+ data: { node: g, selected: s === g.id },
397
398
  sourcePosition: L ? A.Right : A.Bottom,
398
399
  targetPosition: L ? A.Left : A.Top,
399
400
  draggable: !1,
@@ -405,7 +406,7 @@ function Xe({
405
406
  ],
406
407
  [
407
408
  v,
408
- t,
409
+ e,
409
410
  y,
410
411
  s,
411
412
  L,
@@ -414,14 +415,14 @@ function Xe({
414
415
  x
415
416
  ]
416
417
  ), P = D(() => {
417
- const d = new Map(t.map((c) => [c.id, c.label]));
418
- return i.map((c) => ({
418
+ const g = new Map(e.map((c) => [c.id, c.label]));
419
+ return n.map((c) => ({
419
420
  id: c.id,
420
421
  source: c.source,
421
422
  target: c.target,
422
423
  ariaLabel: x.serviceMapEdgeName(
423
- d.get(c.source) ?? c.source,
424
- d.get(c.target) ?? c.target
424
+ g.get(c.source) ?? c.source,
425
+ g.get(c.target) ?? c.target
425
426
  ),
426
427
  // React Flow makes an unfocusable edge an img; aria-roledescription needs a group.
427
428
  ariaRole: "group",
@@ -433,9 +434,9 @@ function Xe({
433
434
  focusable: S,
434
435
  className: `aegis-service-map__edge aegis-service-map__edge--${c.status ?? "ok"}`
435
436
  }));
436
- }, [t, i, S, x]), { getNode: G } = J(), V = z(
437
- (d) => {
438
- const c = d.flatMap(
437
+ }, [e, n, S, x]), { getNode: G } = Q(), j = z(
438
+ (g) => {
439
+ const c = g.flatMap(
439
440
  (h) => h.type === "dimensions" && h.dimensions !== void 0 && G(h.id)?.type === "service" ? [[h.id, h.dimensions]] : []
440
441
  );
441
442
  R(
@@ -445,50 +446,50 @@ function Xe({
445
446
  );
446
447
  },
447
448
  [G]
448
- ), w = Me(Ze), F = g && !w, T = ue(Re), j = Ue(
449
+ ), w = Re(je), F = d && !w, T = fe(Le), k = Ye(
449
450
  O,
450
451
  v,
451
- t.every((d) => y.has(d.id)),
452
- e,
452
+ e.every((g) => y.has(g.id)),
453
+ t,
453
454
  F,
454
455
  w
455
- ), k = s !== void 0 && O.ids.includes(s) ? s : void 0;
456
- Y(() => {
457
- if (!(T === null || k === void 0 || j))
456
+ ), C = s !== void 0 && O.ids.includes(s) ? s : void 0, [U, ce] = Y();
457
+ k && U !== C && ce(C), J(() => {
458
+ if (!(T === null || C === void 0 || k))
458
459
  return T.awaitRow(), () => {
459
460
  T.placeRow(null);
460
461
  };
461
- }, [T, k, j]);
462
- const re = Ye(), ce = z(
463
- (d, c) => {
462
+ }, [T, C, k]);
463
+ const le = Je(), de = z(
464
+ (g, c) => {
464
465
  c.type === "service" && o?.(c.data.node);
465
466
  },
466
467
  [o]
467
- ), le = z(
468
- (d, c) => {
468
+ ), pe = z(
469
+ (g, c) => {
469
470
  c.data && l?.(c.data.edge);
470
471
  },
471
472
  [l]
472
- ), de = z(
473
- (d) => {
474
- if (d.key !== "Enter" && d.key !== " " || d.repeat)
473
+ ), ge = z(
474
+ (g) => {
475
+ if (g.key !== "Enter" && g.key !== " " || g.repeat)
475
476
  return;
476
- const c = d.target;
477
+ const c = g.target;
477
478
  if (!(c instanceof Element))
478
479
  return;
479
480
  const h = c.getAttribute("data-id");
480
481
  if (c.classList.contains("react-flow__node")) {
481
- const M = t.find(($) => $.id === h);
482
- M && o && (d.preventDefault(), o(M));
482
+ const M = e.find(($) => $.id === h);
483
+ M && o && (g.preventDefault(), o(M));
483
484
  } else if (c.classList.contains("react-flow__edge")) {
484
- const M = i.find(($) => $.id === h);
485
- M && l && (d.preventDefault(), l(M));
485
+ const M = n.find(($) => $.id === h);
486
+ M && l && (g.preventDefault(), l(M));
486
487
  }
487
488
  },
488
- [t, i, o, l]
489
- ), pe = {
490
- ...$e,
491
- height: a === void 0 ? void 0 : `${String(a)}px`
489
+ [e, n, o, l]
490
+ ), ue = {
491
+ ...Ae,
492
+ height: r === void 0 ? void 0 : `${String(r)}px`
492
493
  };
493
494
  return /* @__PURE__ */ H(
494
495
  "div",
@@ -498,18 +499,18 @@ function Xe({
498
499
  p ? "aegis-service-map--fill-viewport" : "",
499
500
  f
500
501
  ].filter(Boolean).join(" "),
501
- style: pe,
502
+ style: ue,
502
503
  children: [
503
504
  /* @__PURE__ */ u("div", { className: "aegis-service-map__pane", children: /* @__PURE__ */ H(
504
- be,
505
+ we,
505
506
  {
506
507
  id: b,
507
508
  "aria-label": m,
508
509
  nodes: B,
509
510
  edges: P,
510
- nodeTypes: ke,
511
- edgeTypes: Ce,
512
- minZoom: X,
511
+ nodeTypes: Ze,
512
+ edgeTypes: Ve,
513
+ minZoom: K,
513
514
  nodesDraggable: !1,
514
515
  nodesConnectable: !1,
515
516
  autoPanOnNodeFocus: !1,
@@ -517,36 +518,43 @@ function Xe({
517
518
  zoomOnScroll: !0,
518
519
  proOptions: { hideAttribution: !0 },
519
520
  ariaLabelConfig: x.serviceMapAriaLabels,
520
- onNodesChange: V,
521
- onNodeClick: _ ? ce : void 0,
522
- onEdgeClick: S ? le : void 0,
523
- onKeyDown: de,
524
- onFocus: re,
521
+ onNodesChange: j,
522
+ onNodeClick: _ ? de : void 0,
523
+ onEdgeClick: S ? pe : void 0,
524
+ onKeyDown: ge,
525
+ onFocus: le,
525
526
  children: [
526
- /* @__PURE__ */ u(_e, { variant: we.Dots, gap: 16, size: 1 }),
527
- /* @__PURE__ */ u(ye, { showInteractive: !1, position: "top-left" }),
527
+ /* @__PURE__ */ u(ye, { variant: xe.Dots, gap: 16, size: 1 }),
528
+ /* @__PURE__ */ u(Se, { showInteractive: !1, position: "top-left" }),
528
529
  F && /* @__PURE__ */ u(
529
- xe,
530
+ Ne,
530
531
  {
531
532
  pannable: !0,
532
533
  zoomable: !0,
533
534
  position: "bottom-right",
534
- style: { width: ae },
535
- nodeClassName: je
535
+ style: { width: re },
536
+ nodeClassName: We
536
537
  }
537
538
  )
538
539
  ]
539
540
  }
540
541
  ) }),
541
- T !== null && j && k !== void 0 && /* @__PURE__ */ u(We, { nodeId: k, selection: T })
542
+ T !== null && U !== void 0 && /* @__PURE__ */ u(
543
+ Xe,
544
+ {
545
+ nodeId: U,
546
+ fitted: k,
547
+ selection: T
548
+ }
549
+ )
542
550
  ]
543
551
  }
544
552
  );
545
553
  }
546
- function at(t) {
547
- return /* @__PURE__ */ u(ve, { children: /* @__PURE__ */ u(Xe, { ...t }) });
554
+ function ct(e) {
555
+ return /* @__PURE__ */ u(_e, { children: /* @__PURE__ */ u(Ke, { ...e }) });
548
556
  }
549
557
  export {
550
- at as ServiceMap
558
+ ct as ServiceMap
551
559
  };
552
560
  //# sourceMappingURL=ServiceMap.js.map