95 lines
2.6 KiB
JavaScript
95 lines
2.6 KiB
JavaScript
/*
|
|
* Extracted from browser-delivered Turbopack chunk: fd0220e4d10052af.701bdafa2d.js
|
|
* Module id: 649342
|
|
* For reading/searching only; this factory depends on the original Turbopack runtime.
|
|
*/
|
|
|
|
const moduleFactory = (e) => {
|
|
"use strict";
|
|
var t = e.i(182004),
|
|
n = e.i(216257);
|
|
function i(e, i, r, a, o, s) {
|
|
if (0 === i.length || !n.stores.canvas) return;
|
|
let c = n.stores.canvas;
|
|
if (1 === i.length)
|
|
return void c.addEdge({
|
|
source: e,
|
|
target: i[0],
|
|
sourceHandle: "source",
|
|
targetHandle: "target",
|
|
});
|
|
let l = c.nodes,
|
|
u = l.filter((e) => i.includes(e.id));
|
|
if (u.length <= 1) return;
|
|
let h = 1 / 0,
|
|
f = 1 / 0,
|
|
d = -1 / 0,
|
|
p = -1 / 0,
|
|
g = (e) => {
|
|
let t = e.position.x,
|
|
n = e.position.y;
|
|
if (e.parentId) {
|
|
let i = l.find((t) => t.id === e.parentId);
|
|
i &&
|
|
((t = i.position.x + e.position.x),
|
|
(n = i.position.y + e.position.y));
|
|
}
|
|
return { absX: t, absY: n };
|
|
};
|
|
if (
|
|
(u.forEach((e) => {
|
|
let { absX: t, absY: n } = g(e);
|
|
(h = Math.min(h, t)),
|
|
(f = Math.min(f, n)),
|
|
(d = Math.max(d, t + r)),
|
|
(p = Math.max(p, n + a));
|
|
}),
|
|
!Number.isFinite(h) ||
|
|
!Number.isFinite(f) ||
|
|
!Number.isFinite(d) ||
|
|
!Number.isFinite(p))
|
|
)
|
|
return;
|
|
let b = h - 60,
|
|
m = f - 60,
|
|
w = d - h + 120,
|
|
v = p - f + 120,
|
|
x = crypto.randomUUID(),
|
|
y = {
|
|
id: x,
|
|
type: t.NodeType.GROUP,
|
|
position: { x: b, y: m },
|
|
zIndex: -1001,
|
|
data: { type: t.NodeType.GROUP, name: o, childNodeIds: i },
|
|
width: w,
|
|
height: v,
|
|
measured: { width: w, height: v },
|
|
},
|
|
_ = u.map((e) => {
|
|
let { absX: t, absY: n } = g(e);
|
|
return {
|
|
id: e.id,
|
|
updates: {
|
|
parentId: x,
|
|
position: { x: t - b, y: n - m },
|
|
selected: !1,
|
|
},
|
|
};
|
|
});
|
|
c.addNode(y, { skipOverlapResolution: !0 }),
|
|
c.updateNodes(_),
|
|
i.forEach((t) => {
|
|
c.addEdge({
|
|
source: e,
|
|
target: t,
|
|
sourceHandle: "source",
|
|
targetHandle: "target",
|
|
});
|
|
}),
|
|
s?.({ x: b, y: m, width: w, height: v });
|
|
}
|
|
e.s(["groupGridChildNodes", () => i]);
|
|
};
|
|
|
|
export default moduleFactory;
|