Your Name 1912bcd25b
Some checks failed
Lint / build (20) (push) Has been cancelled
Playwright Tests / test (push) Has been cancelled
chore: sync all remaining local workspace changes
2026-05-08 11:26:57 +08:00

426 lines
13 KiB
JavaScript

/*
* Extracted from browser-delivered Turbopack chunk: fd0220e4d10052af.701bdafa2d.js
* Module id: 790748
* For reading/searching only; this factory depends on the original Turbopack runtime.
*/
const moduleFactory = (e) => {
"use strict";
var t = e.i(768924);
function n(e) {
return (0, t.useStore)((t) => {
let n = t.nodeLookup.get(e);
if (!n?.parentId) return !1;
let i = t.nodeLookup.get(n.parentId);
return i?.selected === !0;
});
}
e.s(["useIsParentGroupSelected", () => n], 706547);
var i = e.i(462214),
r = e.i(358379),
a = e.i(216257),
o = e.i(929286),
s = e.i(36108);
let c = {
isConnectionTarget: !1,
isConnectionBlocked: !1,
isConnectionInvalid: !1,
isDraggingConnection: !1,
nodeHovered: !1,
onNodeMouseEnter: () => void 0,
onNodeMouseLeave: () => void 0,
tiltStyle: {},
handleTiltMove: () => void 0,
};
function l(e) {
let t = (0, s.useIsFrozen)(),
n = (0, a.useCanvasStore)((e) => (t ? null : e.connectingSourceId)),
i = (0, a.useCanvasStore)((e) => (t ? null : e.connectingSourceIds)),
l = (0, a.useCanvasStore)((e) =>
t ? null : e.multiSelectHoveredNodeId,
),
u = (0, a.useCanvasStore)((e) => (t ? null : e.multiSelectCursorPos)),
h = (0, r.useRef)(!1),
[f, d] = (0, r.useState)(!1),
[p, g] = (0, r.useState)(!1),
b = (i?.length ?? 0) > 0,
m = null !== n || b,
w = (0, r.useRef)(m);
w.current = m;
let v = (0, r.useCallback)(() => {
(h.current = !0), w.current || d(!0);
}, []),
x = (0, r.useCallback)(() => {
(h.current = !1), d(!1), w.current && g(!1);
}, []);
(0, r.useEffect)(() => {
!t && m && f && d(!1);
}, [m, t]),
(0, r.useEffect)(() => {
!t && (m || g(!1));
}, [m, t]);
let y = (0, a.useCanvasStore)(
t
? () => !1
: b
? (0, o.selectIsAnyConnected)(i ?? [], e)
: (0, o.selectIsConnected)(n, e),
),
_ = b ? (i?.includes(e) ?? !1) : n === e,
S = (0, a.useCanvasStore)((e) =>
t ? null : e.connectingInvalidTargetId,
),
E = (0, r.useRef)(!1),
M = m ? p || (b && l === e) : f,
T = m && M && !_ && !y && S === e;
E.current = T;
let k = m && M && !_ && !y && !T,
C = m && M && (_ || y),
[A, N] = (0, r.useState)({ x: 0, y: 0 }),
[I, P] = (0, r.useState)(!1),
R = (0, r.useCallback)(
(e) => {
let n = a.stores.canvas,
i = t ? null : (n?.connectingSourceIds ?? null),
r =
null !== (t ? null : (n?.connectingSourceId ?? null)) ||
(i?.length ?? 0) > 0;
if (
(r && h.current && g(!0), !r || _ || y || !h.current || E.current)
)
return;
let o = e.currentTarget.getBoundingClientRect(),
s = (e.clientX - (o.left + o.width / 2)) / (o.width / 2);
N({
x: Math.max(
-8,
Math.min(
8,
-(
8 *
((e.clientY - (o.top + o.height / 2)) / (o.height / 2))
),
),
),
y: Math.max(-8, Math.min(8, 8 * s)),
});
},
[_, y],
);
if (
((0, r.useEffect)(() => {
!t &&
(k ||
N((e) => ((0 !== e.x || 0 !== e.y) && P(!0), { x: 0, y: 0 })));
}, [k, m, T, t]),
(0, r.useEffect)(() => {
if (t || !I) return;
let e = setTimeout(() => {
P(!1);
}, 400);
return () => clearTimeout(e);
}, [I, t]),
(0, r.useEffect)(() => {
t || (!h.current && p && g(!1));
}, [f, p, t]),
(0, r.useEffect)(() => {
if (t || !b || l !== e || !u || _ || y || E.current) return;
let n = document.querySelector(`[data-nodeid="${CSS.escape(e)}"]`);
if (!n) return;
let i = n.getBoundingClientRect(),
r = (u.x - (i.left + i.width / 2)) / (i.width / 2);
N({
x: Math.max(
-8,
Math.min(
8,
-(8 * ((u.y - (i.top + i.height / 2)) / (i.height / 2))),
),
),
y: Math.max(-8, Math.min(8, 8 * r)),
});
}, [t, b, l, u, e, _, y]),
t)
)
return c;
let L = 0 !== A.x || 0 !== A.y,
D =
k || L || I
? {
transform: `perspective(800px) rotateX(${A.x}deg) rotateY(${A.y}deg)`,
transformOrigin: "center center",
transition: `transform ${k ? "80ms ease-out" : "400ms ease-out"}`,
}
: {};
return {
isConnectionTarget: k,
isConnectionBlocked: C,
isConnectionInvalid: T,
isDraggingConnection: m,
nodeHovered: f,
onNodeMouseEnter: v,
onNodeMouseLeave: x,
tiltStyle: D,
handleTiltMove: R,
};
}
let u = (0, r.memo)(function ({ active: e, invalid: t }) {
return t
? (0, i.jsx)("div", {
className: "node-glow-invalid-pulse pointer-events-none",
style: {
position: "absolute",
inset: -0,
borderRadius: 12,
zIndex: 50,
},
})
: e
? (0, i.jsxs)(i.Fragment, {
children: [
(0, i.jsx)("div", {
className: "node-glow-ambient pointer-events-none",
style: {
position: "absolute",
inset: -4,
borderRadius: 16,
zIndex: 49,
},
}),
(0, i.jsx)("div", {
className: "node-glow-diffuse pointer-events-none",
style: {
position: "absolute",
inset: -2,
borderRadius: 14,
zIndex: 49,
},
}),
(0, i.jsx)("div", {
className: "node-glow-border pointer-events-none",
style: {
position: "absolute",
inset: -0,
borderRadius: 12,
zIndex: 50,
},
}),
],
})
: null;
}),
h = (0, r.memo)(function ({ active: e }) {
return e
? (0, i.jsx)("div", {
style: {
position: "absolute",
inset: 0,
borderRadius: 12,
background: "rgba(0, 0, 0, 0.35)",
backdropFilter: "blur(6px)",
WebkitBackdropFilter: "blur(6px)",
zIndex: 50,
pointerEvents: "all",
},
})
: null;
});
e.s(
[
"NodeFrostedOverlay",
0,
h,
"default",
0,
u,
"useConnection3DTilt",
() => l,
],
386951,
);
var f = e.i(111581);
function d(e) {
let t,
{ pipelineStates: n, singlePipelineState: i } = (0,
f.useCanvasCallbacks)();
for (let i of Object.values(n))
if (i.nodeStatuses[e]) {
t = i.nodeStatuses[e];
break;
}
t || (t = i.nodeStatuses[e]);
let r = (() => {
switch (t) {
case "running":
return "#3B82F6";
case "pending":
return "#F59E0B";
case "success":
return "#22C55E";
case "failed":
return "#EF4444";
case "skipped":
return "#6B7280";
default:
return;
}
})();
return { pipelineNodeStatus: t, pipelineBorderColor: r };
}
function p(e, t, n, i) {
return {
outlineStyle: "solid",
outlineWidth: 2,
outlineColor: t || (n ? i : "transparent"),
outlineOffset: "-1px",
transition: "outline-color 0.2s ease, border-color 0.15s ease",
boxShadow:
"running" === e && t ? `0 0 12px ${t}40, 0 0 4px ${t}20` : void 0,
};
}
function g({ status: e, borderColor: t }) {
return e && "idle" !== e
? (0, i.jsxs)("div", {
className:
"absolute -top-7 right-0 z-10 flex items-center gap-1 rounded-md px-2 py-0.5 text-xs font-medium",
style: {
background: `${t}20`,
color: t,
border: `1px solid ${t}40`,
},
children: [
"running" === e &&
(0, i.jsx)("span", {
className: "inline-block h-2 w-2 animate-pulse rounded-full",
style: { background: t },
}),
"pending" === e && "等待中",
"running" === e && "执行中",
"success" === e && "✓ 完成",
"failed" === e && "✗ 失败",
"skipped" === e && "已跳过",
],
})
: null;
}
function b(e, t) {
let n = l(e),
i = !!t || n.nodeHovered,
r = d(e);
return { ...n, handleVisible: i, ...r };
}
e.s(
[
"PipelineStatusLabel",
() => g,
"getPipelineStyles",
() => p,
"usePipelineNodeStatus",
() => d,
],
260561,
),
e.s(["useNodeInteraction", () => b], 380332);
var m = e.i(524961),
w = e.i(778003),
v = e.i(182004);
let x = (0, r.lazy)(() => e.A(930269)),
y = (0, r.lazy)(() => e.A(12443)),
_ = (0, r.lazy)(() => e.A(801547)),
S = (0, r.lazy)(() => e.A(437134)),
E = (0, r.lazy)(() => e.A(787650)),
M = (0, r.lazy)(() => e.A(465890)),
T = (0, r.lazy)(() => e.A(854438)),
k = {
[v.NodeType.IMAGE]: {
[v.GeneratorType.DEFAULT]: x,
[v.GeneratorType.ENHANCE]: y,
},
[v.NodeType.VIDEO]: {
[v.GeneratorType.DEFAULT]: _,
[v.GeneratorType.ENHANCE]: S,
},
[v.NodeType.AUDIO]: { [v.GeneratorType.DEFAULT]: E },
[v.NodeType.TEXT]: { [v.GeneratorType.DEFAULT]: M },
[v.NodeType.SCRIPT]: { [v.GeneratorType.DEFAULT]: T },
};
function C({
nodeType: e,
generatorType: t,
nodeId: n,
incomingData: o,
layoutAnchorWidth: s,
}) {
let c = (0, a.useCanvasStore)((e) => e.isReadonly),
l = k[e];
if (!l) return null;
let u = l[t ?? v.GeneratorType.DEFAULT] ?? l[v.GeneratorType.DEFAULT];
if (!u) return null;
let h = (e) =>
!!c &&
!(!e || e.closest('[data-readonly-allow="true"]')) &&
!!e.closest(
'button, input, select, textarea, [role="button"], [contenteditable="true"]',
);
return (0, i.jsx)(A, {
children: (0, i.jsx)("div", {
"data-canvas-generator-root": "",
onMouseDownCapture: (e) => {
h(e.target) && (e.preventDefault(), e.stopPropagation());
},
onClickCapture: (e) => {
h(e.target) && (e.preventDefault(), e.stopPropagation());
},
onKeyDownCapture: (e) => {
h(e.target) && (e.preventDefault(), e.stopPropagation());
},
children: (0, i.jsx)(r.Suspense, {
fallback: null,
children: (0, i.jsx)(u, {
nodeId: n,
incomingData: o,
layoutAnchorWidth: s,
}),
}),
}),
});
}
function A({ children: e }) {
let [t, n] = (0, r.useState)(0);
return (0, i.jsx)(
w.ErrorBoundary,
{
fallback: ({ error: e, resetErrorBoundary: t }) =>
(0, i.jsxs)("div", {
className:
"flex flex-col items-center justify-center gap-2 p-4 text-center",
children: [
(0, i.jsx)("div", {
className: "text-sm text-red-400",
children: "生成器加载失败",
}),
(0, i.jsx)("div", {
className: "max-w-[200px] truncate text-xs text-white/50",
children: e.message,
}),
(0, i.jsx)(m.Button, {
onClick: () => {
t(), n((e) => e + 1);
},
variant: "subtle",
color: "gray",
size: "xs",
children: "点击重试",
}),
],
}),
children: e,
},
t,
);
}
e.s(["GeneratorFactory", () => C], 790748);
};
export default moduleFactory;