@floegence/floe-webapp-core 0.86.12 → 0.86.13

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,277 +1,276 @@
1
- import { AvoidLib as J } from "../../node_modules/.pnpm/libavoid-js@0.5.0-beta.5/node_modules/libavoid-js/dist/index.js";
2
- import Y from "../../node_modules/.pnpm/libavoid-js@0.5.0-beta.5/node_modules/libavoid-js/dist/libavoid.wasm.js";
3
- let j;
4
- const V = { NORTH: 1, SOUTH: 2, WEST: 4, EAST: 8 }, b = ["NORTH", "EAST", "SOUTH", "WEST"], E = (t) => t.delete();
5
- async function I(t, c = {}) {
6
- const p = c.edgeClearance ?? 4;
7
- if (!Number.isFinite(p) || p < 0)
1
+ import { AvoidLib as Y } from "../../node_modules/.pnpm/libavoid-js@0.5.0-beta.5/node_modules/libavoid-js/dist/index.js";
2
+ import tt from "../../node_modules/.pnpm/libavoid-js@0.5.0-beta.5/node_modules/libavoid-js/dist/libavoid.wasm.js";
3
+ let _;
4
+ const L = { NORTH: 1, SOUTH: 2, WEST: 4, EAST: 8 }, A = ["NORTH", "EAST", "SOUTH", "WEST"], S = (n) => n.delete();
5
+ async function et(n, o = {}) {
6
+ const a = o.edgeClearance ?? 4;
7
+ if (!Number.isFinite(a) || a < 0)
8
8
  throw new Error("Graph edge clearance must be finite and nonnegative");
9
- if (!t.nodes.length) return t;
10
- if (!t.edges.length) return X(t);
11
- await (j ??= J.load(Y).catch((o) => {
12
- throw j = void 0, o;
9
+ if (!n.nodes.length) return n;
10
+ if (!n.edges.length) return $(n);
11
+ await (_ ??= Y.load(tt).catch((r) => {
12
+ throw _ = void 0, r;
13
13
  }));
14
- const s = J.getInstance(), r = new Map(t.nodes.map((o) => [o.id, o])), m = (o) => {
15
- const e = [];
16
- for (let i = r.get(o).parentId; i; i = r.get(i).parentId)
17
- e.push(i);
18
- return e;
19
- }, d = /* @__PURE__ */ new Map();
20
- for (const o of t.edges) {
21
- const e = /* @__PURE__ */ new Set([...m(o.source), ...m(o.target)]), i = JSON.stringify([...e].sort()), u = d.get(i) ?? { open: e, edges: [] };
22
- u.edges.push(o), d.set(i, u);
14
+ const i = Y.getInstance(), h = new Map(n.nodes.map((r) => [r.id, r])), l = (r) => {
15
+ const c = [];
16
+ for (let s = h.get(r).parentId; s; s = h.get(s).parentId)
17
+ c.push(s);
18
+ return c;
19
+ }, f = /* @__PURE__ */ new Map();
20
+ for (const r of n.edges) {
21
+ const c = /* @__PURE__ */ new Set([...l(r.source), ...l(r.target)]), s = JSON.stringify([...c].sort()), M = f.get(s) ?? { open: c, edges: [] };
22
+ M.edges.push(r), f.set(s, M);
23
23
  }
24
- const S = /* @__PURE__ */ new Map();
25
- for (const { open: o, edges: e } of d.values()) {
26
- const i = new s.Router(2);
24
+ const T = /* @__PURE__ */ new Map();
25
+ for (const { open: r, edges: c } of f.values()) {
26
+ const s = new i.Router(2);
27
27
  try {
28
- i.setRoutingParameter(s.RoutingParameter.shapeBufferDistance, p), i.setRoutingParameter(s.RoutingParameter.idealNudgingDistance, 8), i.setRoutingParameter(s.RoutingParameter.crossingPenalty, 80), i.setRoutingParameter(s.RoutingParameter.fixedSharedPathPenalty, 120), i.setRoutingParameter(s.RoutingParameter.portDirectionPenalty, 0), i.setRoutingOption(s.RoutingOption.nudgeOrthogonalSegmentsConnectedToShapes, !1), i.setRoutingOption(s.RoutingOption.nudgeSharedPathsWithCommonEndPoint, !0);
29
- const u = new Map(
30
- t.nodes.filter((n) => !o.has(n.id) && m(n.id).every((x) => o.has(x))).map((n) => {
31
- const x = new s.Point(n.x, n.y), y = new s.Point(n.x + n.width, n.y + n.height), a = new s.Rectangle(x, y), h = new s.ShapeRef(i, a);
32
- return E(x), E(y), E(a), [n.id, h];
28
+ s.setRoutingParameter(i.RoutingParameter.shapeBufferDistance, a), s.setRoutingParameter(i.RoutingParameter.idealNudgingDistance, 8), s.setRoutingParameter(i.RoutingParameter.crossingPenalty, 80), s.setRoutingParameter(i.RoutingParameter.fixedSharedPathPenalty, 120), s.setRoutingParameter(i.RoutingParameter.portDirectionPenalty, 0), s.setRoutingOption(i.RoutingOption.nudgeOrthogonalSegmentsConnectedToShapes, !1), s.setRoutingOption(i.RoutingOption.nudgeSharedPathsWithCommonEndPoint, !0);
29
+ const M = new Map(
30
+ n.nodes.filter((t) => !r.has(t.id) && l(t.id).every((e) => r.has(e))).map((t) => {
31
+ const e = new i.Point(t.x, t.y), g = new i.Point(t.x + t.width, t.y + t.height), p = new i.Rectangle(e, g), x = new i.ShapeRef(s, p);
32
+ return S(e), S(g), S(p), [t.id, x];
33
33
  })
34
- ), v = /* @__PURE__ */ new Map(), l = t.nodes.filter((n) => u.has(n.id)), G = /* @__PURE__ */ new Map();
35
- e.forEach((n) => {
36
- const x = r.get(n.source), y = r.get(n.target), a = z(x, y), h = n.sourcePort ? x.ports.find((T) => T.id === n.sourcePort).side : n.targetPort ? D(y.ports.find((T) => T.id === n.targetPort).side) : a.source, g = n.targetPort ? y.ports.find((T) => T.id === n.targetPort).side : n.sourcePort ? D(x.ports.find((T) => T.id === n.sourcePort).side) : a.target, f = [n.source, n.target].sort().join("\0"), w = G.get(f) ?? 0;
37
- G.set(f, w + 1);
38
- const M = w % 2 === 0 ? -6 : 6, R = n.source === n.target ? void 0 : _(
39
- x,
40
- y,
41
- l,
42
- a,
43
- M,
44
- n.sourcePort ? h : void 0,
45
- n.targetPort ? g : void 0
46
- );
47
- v.set(n.id, {
48
- sourceSide: R?.source ?? h,
49
- targetSide: R?.target ?? g,
50
- offset: M
51
- });
52
- });
53
- let U = b.length + 2;
54
- const O = /* @__PURE__ */ new Map(), P = (n, x) => Math.max(0, Math.min(1, n / x));
55
- for (const n of t.nodes) {
56
- const x = u.get(n.id);
57
- if (!x) continue;
58
- const y = (a, h, g, f, w) => {
59
- const M = new s.ShapeConnectionPin(
60
- x,
61
- a,
62
- P(h, n.width),
63
- P(g, n.height),
34
+ ), O = /* @__PURE__ */ new Map(), E = /* @__PURE__ */ new Map();
35
+ for (const t of c) {
36
+ const e = [t.source, t.target].sort().join("\0"), g = O.get(e) ?? 0;
37
+ O.set(e, g + 1), E.set(t.id, g % 2 === 0 ? -6 : 6);
38
+ }
39
+ let Q = A.length + 2;
40
+ const B = /* @__PURE__ */ new Map(), b = (t, e) => Math.max(0, Math.min(1, t / e));
41
+ for (const t of n.nodes) {
42
+ const e = M.get(t.id);
43
+ if (!e) continue;
44
+ const g = (p, x, w, y, m) => {
45
+ const N = new i.ShapeConnectionPin(
46
+ e,
47
+ p,
48
+ b(x, t.width),
49
+ b(w, t.height),
64
50
  !0,
65
51
  0,
66
- f
52
+ y
67
53
  );
68
- M.setExclusive(w), M.setConnectionCost(
69
- n.width / 2 + n.height / 2 - Math.abs(h - n.width / 2) - Math.abs(g - n.height / 2)
54
+ N.setExclusive(m), N.setConnectionCost(
55
+ t.width / 2 + t.height / 2 - Math.abs(x - t.width / 2) - Math.abs(w - t.height / 2)
70
56
  );
71
57
  };
72
- for (const a of new Set(n.ports?.map((h) => h.side))) {
73
- const { x: h, y: g } = W(n, a), f = b.indexOf(a) + 2;
74
- y(f, h - n.x, g - n.y, V[a], !1), O.set(
58
+ for (const p of new Set(t.ports?.map((x) => x.side))) {
59
+ const { x, y: w } = q(t, p), y = A.indexOf(p) + 2;
60
+ g(y, x - t.x, w - t.y, L[p], !1), B.set(
75
61
  JSON.stringify([
76
- n.id,
77
- P(h - n.x, n.width),
78
- P(g - n.y, n.height),
79
- a
62
+ t.id,
63
+ b(x - t.x, t.width),
64
+ b(w - t.y, t.height),
65
+ p
80
66
  ]),
81
- f
67
+ y
82
68
  );
83
69
  }
84
70
  }
85
- const C = (n, x, y, a) => {
86
- const h = r.get(n), g = u.get(n);
87
- if (g && x)
88
- return new s.ConnEnd(
89
- g,
90
- b.indexOf(h.ports.find((R) => R.id === x).side) + 2
71
+ const F = /* @__PURE__ */ new Map(), Z = n.nodes.filter((t) => M.has(t.id)), J = (t, e, g, p, x, w = !1) => {
72
+ const y = M.get(t.id);
73
+ if (y && g)
74
+ return new i.ConnEnd(
75
+ y,
76
+ A.indexOf(t.ports.find((d) => d.id === g).side) + 2
91
77
  );
92
- if (g) {
93
- const R = P(y.x - h.x, h.width), T = P(y.y - h.y, h.height), A = JSON.stringify([n, R, T, a]), F = O.get(A);
94
- if (F !== void 0) return new s.ConnEnd(g, F);
95
- const B = U++;
96
- return O.set(A, B), new s.ShapeConnectionPin(
97
- g,
98
- B,
99
- R,
100
- T,
101
- !0,
102
- 0,
103
- V[a]
104
- ).setExclusive(!1), new s.ConnEnd(g, B);
78
+ const m = g ? [
79
+ {
80
+ side: t.ports.find((d) => d.id === g).side,
81
+ position: q(t, t.ports.find((d) => d.id === g).side)
82
+ }
83
+ ] : x ? [{ side: "EAST", position: x }] : (w ? [K(t, e).source] : A).flatMap((d) => {
84
+ const P = nt(t, d, e, p);
85
+ if (w) return [{ side: d, position: P }];
86
+ const R = d === "NORTH" || d === "SOUTH", H = R ? t.x : t.y, v = R ? t.width : t.height, C = H + Math.min(8, v / 4), j = H + v - Math.min(8, v / 4);
87
+ return [
88
+ R ? P.x : P.y,
89
+ C,
90
+ j,
91
+ ...Z.flatMap((u) => {
92
+ const k = R ? u.x : u.y, X = k + (R ? u.width : u.height);
93
+ return [k - a, X + a, k - a - 8, X + a + 8];
94
+ }).filter((u) => u >= C && u <= j)
95
+ ].map((u) => ({
96
+ side: d,
97
+ position: R ? { x: u, y: P.y } : { x: P.x, y: u }
98
+ }));
99
+ });
100
+ if (y) {
101
+ const d = (v, C) => JSON.stringify([
102
+ t.id,
103
+ b(C.x - t.x, t.width),
104
+ b(C.y - t.y, t.height),
105
+ v
106
+ ]), P = !!(g || x || w), R = P ? B.get(d(m[0].side, m[0].position)) : F.get(t.id);
107
+ if (P && R !== void 0) return new i.ConnEnd(y, R);
108
+ const H = R ?? Q++;
109
+ P || F.set(t.id, H);
110
+ for (const { side: v, position: C } of m) {
111
+ const j = d(v, C);
112
+ if (B.has(j)) continue;
113
+ B.set(j, H);
114
+ const D = C.x - t.x, u = C.y - t.y, k = new i.ShapeConnectionPin(
115
+ y,
116
+ H,
117
+ b(D, t.width),
118
+ b(u, t.height),
119
+ !0,
120
+ 0,
121
+ L[v]
122
+ );
123
+ k.setExclusive(!1), k.setConnectionCost(
124
+ t.width / 2 + t.height / 2 - Math.abs(D - t.width / 2) - Math.abs(u - t.height / 2)
125
+ );
126
+ }
127
+ return new i.ConnEnd(y, H);
105
128
  }
106
- const f = x ? W(h, h.ports.find((R) => R.id === x).side) : y, w = new s.Point(f.x, f.y), M = new s.ConnEnd(w);
107
- return E(w), M;
108
- }, N = e.map((n) => {
109
- const x = r.get(n.source), y = r.get(n.target), a = v.get(n.id), h = C(
110
- n.source,
111
- n.sourcePort,
112
- n.source === n.target ? { x: x.x + x.width, y: x.y + x.height / 3 } : k(x, a.sourceSide, y, a.offset),
113
- n.source === n.target ? "EAST" : a.sourceSide
114
- ), g = C(
115
- n.target,
116
- n.targetPort,
117
- n.source === n.target ? {
118
- x: y.x + y.width,
119
- y: y.y + y.height * 2 / 3
120
- } : k(y, a.targetSide, x, a.offset),
121
- n.source === n.target ? "EAST" : a.targetSide
122
- ), f = new s.ConnRef(i, h, g);
123
- if (E(h), E(g), n.source === n.target) {
124
- const w = r.get(n.source), M = new s.CheckpointVector();
125
- for (const R of [w.y + w.height / 3, w.y + w.height * 2 / 3]) {
126
- const T = new s.Point(w.x + w.width + Math.max(24, p + 4), R), A = new s.Checkpoint(T);
127
- M.push_back(A), E(T), E(A);
129
+ const N = K(t, e).source, G = m.find((d) => d.side === N)?.position ?? m[0].position, W = new i.Point(G.x, G.y), z = new i.ConnEnd(W);
130
+ return S(W), z;
131
+ }, V = (t) => +!!(t.sourcePort || t.targetPort || t.source === t.target || O.get([t.source, t.target].sort().join("\0")) > 1), I = [...c].sort((t, e) => V(e) - V(t)).map((t) => {
132
+ const e = h.get(t.source), g = h.get(t.target), p = t.source === t.target, x = O.get([t.source, t.target].sort().join("\0")) > 1, w = J(
133
+ e,
134
+ g,
135
+ t.sourcePort,
136
+ E.get(t.id),
137
+ p ? { x: e.x + e.width, y: e.y + e.height / 3 } : void 0,
138
+ x
139
+ ), y = J(
140
+ g,
141
+ e,
142
+ t.targetPort,
143
+ E.get(t.id),
144
+ p ? {
145
+ x: g.x + g.width,
146
+ y: g.y + g.height * 2 / 3
147
+ } : void 0,
148
+ x
149
+ ), m = new i.ConnRef(s, w, y);
150
+ if (S(w), S(y), p) {
151
+ const N = new i.CheckpointVector();
152
+ for (const G of [
153
+ e.y + e.height / 3,
154
+ e.y + e.height * 2 / 3
155
+ ]) {
156
+ const W = new i.Point(
157
+ e.x + e.width + Math.max(24, a + 4),
158
+ G
159
+ ), z = new i.Checkpoint(W);
160
+ N.push_back(z), S(W), S(z);
128
161
  }
129
- f.setRoutingCheckpoints(M), E(M);
162
+ m.setRoutingCheckpoints(N), S(N);
130
163
  }
131
- return { edge: n, connection: f };
164
+ return { edge: t, connection: m };
132
165
  });
133
- i.processTransaction();
134
- for (const { edge: n, connection: x } of N) {
135
- const y = x.displayRoute(), a = Array.from({ length: y.size() }, (h, g) => {
136
- const f = y.at(g), w = { x: f.x, y: f.y };
137
- return E(f), w;
166
+ s.processTransaction();
167
+ for (const { edge: t, connection: e } of I) {
168
+ const g = e.displayRoute(), p = Array.from({ length: g.size() }, (x, w) => {
169
+ const y = g.at(w), m = { x: y.x, y: y.y };
170
+ return S(y), m;
138
171
  });
139
- if (E(y), !x.hasValidRoute() || a.length < 2 || a.some((h) => !Number.isFinite(h.x) || !Number.isFinite(h.y)) || a.some((h, g) => g > 0 && h.x !== a[g - 1].x && h.y !== a[g - 1].y))
140
- throw new Error(`Graph edge cannot be routed: ${n.id}`);
141
- S.set(n.id, a);
172
+ if (S(g), !e.hasValidRoute() || p.length < 2 || p.some((x) => !Number.isFinite(x.x) || !Number.isFinite(x.y)) || p.some((x, w) => w > 0 && x.x !== p[w - 1].x && x.y !== p[w - 1].y))
173
+ throw new Error(`Graph edge cannot be routed: ${t.id}`);
174
+ T.set(t.id, p);
142
175
  }
143
176
  } finally {
144
- i.delete();
177
+ s.delete();
145
178
  }
146
179
  }
147
- const H = t.edges.map((o) => ({ ...o, sections: [S.get(o.id)] }));
148
- return X({
149
- nodes: t.nodes,
150
- edges: H,
151
- bounds: t.bounds
180
+ const U = n.edges.map((r) => ({ ...r, sections: [T.get(r.id)] }));
181
+ return $({
182
+ nodes: n.nodes,
183
+ edges: U,
184
+ bounds: n.bounds
152
185
  });
153
186
  }
154
- function X(t) {
155
- const c = [
156
- ...t.nodes.flatMap((r) => [
157
- { x: r.x, y: r.y },
158
- { x: r.x + r.width, y: r.y + r.height }
187
+ function $(n) {
188
+ const o = [
189
+ ...n.nodes.flatMap((h) => [
190
+ { x: h.x, y: h.y },
191
+ { x: h.x + h.width, y: h.y + h.height }
159
192
  ]),
160
- ...t.edges.flatMap((r) => r.sections.flat())
161
- ], p = Math.min(...c.map((r) => r.x)), s = Math.min(...c.map((r) => r.y));
193
+ ...n.edges.flatMap((h) => h.sections.flat())
194
+ ], a = Math.min(...o.map((h) => h.x)), i = Math.min(...o.map((h) => h.y));
162
195
  return {
163
- nodes: t.nodes,
164
- edges: t.edges,
196
+ nodes: n.nodes,
197
+ edges: n.edges,
165
198
  bounds: {
166
- x: p,
167
- y: s,
168
- width: Math.max(...c.map((r) => r.x)) - p,
169
- height: Math.max(...c.map((r) => r.y)) - s
199
+ x: a,
200
+ y: i,
201
+ width: Math.max(...o.map((h) => h.x)) - a,
202
+ height: Math.max(...o.map((h) => h.y)) - i
170
203
  }
171
204
  };
172
205
  }
173
- function W(t, c) {
206
+ function q(n, o) {
174
207
  return {
175
- x: c === "WEST" ? t.x : c === "EAST" ? t.x + t.width : t.x + t.width / 2,
176
- y: c === "NORTH" ? t.y : c === "SOUTH" ? t.y + t.height : t.y + t.height / 2
208
+ x: o === "WEST" ? n.x : o === "EAST" ? n.x + n.width : n.x + n.width / 2,
209
+ y: o === "NORTH" ? n.y : o === "SOUTH" ? n.y + n.height : n.y + n.height / 2
177
210
  };
178
211
  }
179
- function D(t) {
180
- return {
181
- NORTH: "SOUTH",
182
- EAST: "WEST",
183
- SOUTH: "NORTH",
184
- WEST: "EAST"
185
- }[t];
186
- }
187
- function _(t, c, p, s, r, m, d) {
188
- let S;
189
- const H = (o, e, i) => i === "NORTH" ? e.x === o.x && e.y < o.y : i === "SOUTH" ? e.x === o.x && e.y > o.y : i === "WEST" ? e.y === o.y && e.x < o.x : e.y === o.y && e.x > o.x;
190
- for (const o of m ? [m] : b)
191
- for (const e of d ? [d] : b) {
192
- const i = m ? W(t, o) : k(t, o, c, r), u = d ? W(c, e) : k(c, e, t, r), v = i.x === u.x || i.y === u.y ? [[i, u]] : [
193
- [i, { x: u.x, y: i.y }, u],
194
- [i, { x: i.x, y: u.y }, u]
195
- ];
196
- for (const l of v) {
197
- if (p.includes(t) && !H(i, l[1], o) || p.includes(c) && !H(u, l.at(-2), e) || l.slice(1).some((O, P) => {
198
- const C = l[P];
199
- return p.some(
200
- (N) => Math.max(C.x, O.x) > N.x && Math.min(C.x, O.x) < N.x + N.width && Math.max(C.y, O.y) > N.y && Math.min(C.y, O.y) < N.y + N.height
201
- );
202
- }))
203
- continue;
204
- const U = l.slice(1).reduce(
205
- (O, P, C) => O + Math.abs(P.x - l[C].x) + Math.abs(P.y - l[C].y),
206
- 0
207
- ) + (l.length - 2) * 32 + (o === s.source ? 0 : 16) + (e === s.target ? 0 : 16);
208
- (!S || U < S.score) && (S = { source: o, target: e, score: U });
209
- }
210
- }
211
- return S;
212
- }
213
- function z(t, c) {
214
- const p = (e, i) => i.x >= e.x && i.y >= e.y && i.x + i.width <= e.x + e.width && i.y + i.height <= e.y + e.height, s = p(t, c) ? t : p(c, t) ? c : void 0;
215
- if (s) {
216
- const e = s === t ? c : t, i = {
217
- NORTH: e.y - s.y,
218
- EAST: s.x + s.width - e.x - e.width,
219
- SOUTH: s.y + s.height - e.y - e.height,
220
- WEST: e.x - s.x
221
- }, u = [...b].sort((v, l) => i[v] - i[l])[0];
222
- return { source: u, target: u };
212
+ function K(n, o) {
213
+ const a = (c, s) => s.x >= c.x && s.y >= c.y && s.x + s.width <= c.x + c.width && s.y + s.height <= c.y + c.height, i = a(n, o) ? n : a(o, n) ? o : void 0;
214
+ if (i) {
215
+ const c = i === n ? o : n, s = {
216
+ NORTH: c.y - i.y,
217
+ EAST: i.x + i.width - c.x - c.width,
218
+ SOUTH: i.y + i.height - c.y - c.height,
219
+ WEST: c.x - i.x
220
+ }, M = [...A].sort((O, E) => s[O] - s[E])[0];
221
+ return { source: M, target: M };
223
222
  }
224
- const r = c.x + c.width / 2 - (t.x + t.width / 2), m = c.y + c.height / 2 - (t.y + t.height / 2), d = Math.max(t.x - (c.x + c.width), c.x - (t.x + t.width), 0), S = Math.max(
225
- t.y - (c.y + c.height),
226
- c.y - (t.y + t.height),
223
+ const h = o.x + o.width / 2 - (n.x + n.width / 2), l = o.y + o.height / 2 - (n.y + n.height / 2), f = Math.max(n.x - (o.x + o.width), o.x - (n.x + n.width), 0), T = Math.max(
224
+ n.y - (o.y + o.height),
225
+ o.y - (n.y + n.height),
227
226
  0
228
- ), o = (S === 0 && d > 0 ? !0 : d === 0 && S > 0 ? !1 : d === 0 && S === 0 ? Math.abs(r) >= Math.abs(m) : d <= S) ? r >= 0 ? "EAST" : "WEST" : m >= 0 ? "SOUTH" : "NORTH";
229
- return { source: o, target: D(o) };
227
+ ), r = (T === 0 && f > 0 ? !0 : f === 0 && T > 0 ? !1 : f === 0 && T === 0 ? Math.abs(h) >= Math.abs(l) : f <= T) ? h >= 0 ? "EAST" : "WEST" : l >= 0 ? "SOUTH" : "NORTH";
228
+ return { source: r, target: A[(A.indexOf(r) + 2) % 4] };
230
229
  }
231
- function k(t, c, p, s = 0) {
232
- const r = (o) => Math.min(8, o / 4), m = (o, e, i) => Math.max(e + r(i), Math.min(e + i - r(i), o)), d = (o, e, i, u) => {
233
- const v = Math.max(o, i), l = Math.min(o + e, i + u);
234
- return v < l ? (v + l) / 2 + s : void 0;
235
- }, S = p.x + p.width / 2, H = p.y + p.height / 2;
236
- switch (c) {
230
+ function nt(n, o, a, i = 0) {
231
+ const h = (r) => Math.min(8, r / 4), l = (r, c, s) => Math.max(c + h(s), Math.min(c + s - h(s), r)), f = (r, c, s, M) => {
232
+ const O = Math.max(r, s), E = Math.min(r + c, s + M);
233
+ return O < E ? (O + E) / 2 + i : void 0;
234
+ }, T = a.x + a.width / 2, U = a.y + a.height / 2;
235
+ switch (o) {
237
236
  case "NORTH":
238
237
  return {
239
- x: m(
240
- d(t.x, t.width, p.x, p.width) ?? S + s,
241
- t.x,
242
- t.width
238
+ x: l(
239
+ f(n.x, n.width, a.x, a.width) ?? T + i,
240
+ n.x,
241
+ n.width
243
242
  ),
244
- y: t.y
243
+ y: n.y
245
244
  };
246
245
  case "EAST":
247
246
  return {
248
- x: t.x + t.width,
249
- y: m(
250
- d(t.y, t.height, p.y, p.height) ?? H + s,
251
- t.y,
252
- t.height
247
+ x: n.x + n.width,
248
+ y: l(
249
+ f(n.y, n.height, a.y, a.height) ?? U + i,
250
+ n.y,
251
+ n.height
253
252
  )
254
253
  };
255
254
  case "SOUTH":
256
255
  return {
257
- x: m(
258
- d(t.x, t.width, p.x, p.width) ?? S + s,
259
- t.x,
260
- t.width
256
+ x: l(
257
+ f(n.x, n.width, a.x, a.width) ?? T + i,
258
+ n.x,
259
+ n.width
261
260
  ),
262
- y: t.y + t.height
261
+ y: n.y + n.height
263
262
  };
264
263
  case "WEST":
265
264
  return {
266
- x: t.x,
267
- y: m(
268
- d(t.y, t.height, p.y, p.height) ?? H + s,
269
- t.y,
270
- t.height
265
+ x: n.x,
266
+ y: l(
267
+ f(n.y, n.height, a.y, a.height) ?? U + i,
268
+ n.y,
269
+ n.height
271
270
  )
272
271
  };
273
272
  }
274
273
  }
275
274
  export {
276
- I as routeGraphGeometry
275
+ et as routeGraphGeometry
277
276
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@floegence/floe-webapp-core",
3
- "version": "0.86.12",
3
+ "version": "0.86.13",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",