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

701 lines
24 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
* Extracted from browser-delivered Turbopack chunk: fd0220e4d10052af.701bdafa2d.js
* Module id: 295903
* For reading/searching only; this factory depends on the original Turbopack runtime.
*/
const moduleFactory = (e) => {
"use strict";
var t = e.i(462214),
n = e.i(358379),
i = e.i(292002),
r = e.i(768924),
a = e.i(736317),
o = e.i(41671),
s = e.i(777784),
c = e.i(722573),
l = e.i(184656),
u = e.i(944733),
h = e.i(703962),
f = e.i(713118),
d = e.i(182004),
p = e.i(500724),
g = e.i(299750),
b = e.i(216257),
m = e.i(929286),
w = e.i(791997),
v = e.i(664115),
x = e.i(528225),
y = e.i(111581),
_ = e.i(306677),
S = e.i(36108),
E = e.i(464025),
M = e.i(329931),
T = e.i(316925),
k = e.i(959248),
C = e.i(706547),
A = e.i(380332),
N = e.i(710871),
I = e.i(260561),
P = e.i(276204),
R = e.i(124821),
L = e.i(799093),
D = e.i(439552),
j = e.i(934108),
O = e.i(979138);
let F = [
0.3, 0.5, 0.7, 0.4, 0.9, 0.6, 0.8, 0.3, 0.5, 0.7, 0.4, 0.6, 0.9, 0.5, 0.3,
0.8, 0.6, 0.4, 0.7, 0.5, 0.9, 0.3, 0.6, 0.8, 0.4, 0.7, 0.5, 0.3, 0.9, 0.6,
0.8, 0.4, 0.7, 0.5, 0.3, 0.6, 0.9, 0.5, 0.8, 0.4, 0.7, 0.3, 0.6, 0.5, 0.9,
0.4, 0.8, 0.3,
];
function U({ className: e = "", lightChrome: n }) {
return (0, t.jsx)("div", {
className: `flex h-16 w-full items-center justify-center gap-[3px] px-4 ${e}`,
children: Array.from({ length: 48 }, (e, i) =>
(0, t.jsx)(
"div",
{
className: "w-[3px] shrink-0 rounded-full",
style: {
height: `${(F[i % F.length] ?? 0.5) * 100}%`,
background: n
? "rgba(0, 0, 0, 0.12)"
: "rgba(255, 255, 255, 0.25)",
},
},
`bar-${i}`,
),
),
});
}
let B = (0, n.memo)(function ({ id: F, selected: B }) {
let H = (0, b.useCanvasStore)((e) => e.getNode(F)?.data),
z = (0, b.useCanvasStore)((0, m.selectHasIncomingEdge)(F)),
{
updateNodeData: G,
markDownstreamStale: $,
addNode: V,
addEdge: W,
applyNodeChanges: K,
} = (0, b.useCanvasStore)((e) => ({
updateNodeData: e.updateNodeData,
markDownstreamStale: e.markDownstreamStale,
addNode: e.addNode,
addEdge: e.addEdge,
applyNodeChanges: e.applyNodeChanges,
})),
q = (0, b.useCanvasStore)((e) => e.isReadonly),
X = (0, b.useCanvasStore)((e) => e.isBoxSelecting),
Y = "light" === (0, w.useCanvasThemeStore)((e) => e.theme),
J = (0, C.useIsParentGroupSelected)(F),
Z = !!H?.assetAudioAssetId,
Q =
(0, E.useShouldShowGenerator)(B, F) &&
(!(0, d.isResourceAction)(H?.action) || Z),
ee = (0, l.useIncomingNodeData)(F),
{ getNode: et, getNodes: en } = (0, r.useReactFlow)(),
ei = (0, n.useCallback)(
(e) => {
let t = en().map((t) => ({
type: "select",
id: t.id,
selected: t.id === e,
}));
t.push({ type: "select", id: e, selected: !0 }), K(t);
},
[en, K],
),
er = (0, r.useUpdateNodeInternals)(),
ea = (0, A.useNodeInteraction)(F, B),
{ pipelineNodeStatus: eo, pipelineBorderColor: es } = ea,
{ requestFileUpload: ec } = (0, y.useCanvasCallbacks)(),
el = (0, n.useRef)(null),
eu = (0, k.isTaskGenerating)(H?.taskInfo),
eh = (0, k.isTaskFailed)(H?.taskInfo),
ef = (0, n.useCallback)(() => {
let e = H?.taskInfo?.taskId;
e &&
(0, g.stopTaskBatch)([e]).then(() => {
let t = b.stores.canvas?.getNode(F),
n = t?.data;
n?.taskInfo?.taskId !== e ||
G(F, {
taskInfo: n?.prevTaskInfo ?? void 0,
prevTaskInfo: void 0,
});
});
}, [H?.taskInfo?.taskId, F, G]),
ed =
H?.taskInfo?.status === 0 &&
(H?.taskInfo?.delayInfo?.remainSeconds ?? 0) > 0,
ep = (0, n.useCallback)(() => {
ed
? ef()
: (0, u.confirm)({
title: "取消生成",
message: '"取消生成"算力不退还,确定要取消吗?',
confirmText: "确定",
cancelText: "取消",
onConfirm: ef,
});
}, [ed, ef]),
eg = H?.url?.[0],
eb = !!eg && eg.startsWith("blob:") && eg !== el.current,
em = eb ? void 0 : eg,
ew = !!em;
(0, n.useEffect)(() => {
eb &&
(console.warn(`[AudioNode ${F}] 检测到过期 blob URL,已清理`),
G(F, { url: [] }));
}, [eg]);
let ev = H?.name || H?.label || "音频",
ex = H?._pendingThirdAssetUuid,
ey = H?._starVideoCheckStatus,
{ isReviewing: e_ } = (0, M.useThirdAssetNodeSync)({
id: F,
nodeType: d.NodeType.AUDIO,
pendingUuid: ex,
updateNodeData: G,
}),
eS = e_ || "checking" === ey,
eE = "failed" === ey,
eM = (0, n.useMemo)(
() =>
eS
? (0, t.jsxs)("span", {
className:
"flex items-center gap-0.5 text-[12px] text-[#09CAF5]/80",
children: [
(0, t.jsx)("span", {
className:
"mr-0.5 inline-block h-1.5 w-1.5 animate-pulse rounded-full bg-[#09CAF5]",
}),
"校验中",
],
})
: eE
? (0, t.jsx)("span", {
className:
"flex items-center text-[12px] text-[#F5514F]/80",
children: "审核失败",
})
: Z
? (0, t.jsx)(c.Tooltip, {
label: "素材内容已合规,可用于Seedance2.0视频生成",
position: "top",
withArrow: !0,
zIndex: 720,
children: (0, t.jsx)("span", {
className: "flex shrink-0 items-center",
children: (0, t.jsx)(o.Icons.ShieldCheck, {
width: 14,
height: 14,
className: "text-[#09CAF5]",
}),
}),
})
: void 0,
[eS, eE, Z],
),
eT = (0, n.useCallback)((e) => G(F, { name: e }), [F, G]),
ek = (0, n.useCallback)(() => G(F, { isStale: !1 }), [F, G]),
eC = (0, n.useCallback)(
(e) => {
let t = b.stores.canvas;
if (!t) return;
let n = t.getNode(F);
if (!n) return;
let i = n.data;
if (!(0, d.isResourceAction)(i?.action)) return;
let r = n.resourceMeta;
if (!r?.items.length)
return void t.updateNodeData(F, {
resourceMeta: { items: [{ kind: "audio", durationSec: e }] },
});
let a = r.items[0];
"audio" !== a.kind ||
a.durationSec ||
t.updateNodeData(F, {
resourceMeta: {
items: [{ ...a, durationSec: e }, ...r.items.slice(1)],
},
});
},
[F],
),
eA = eu
? "generating"
: eh
? "failed"
: ew
? "resource"
: z
? "pending"
: "empty_generate";
(0, S.useFrozenEffect)(() => {
er(F);
}, [eA, F, er]);
let [eN, eI] = (0, n.useState)(1),
[eP, eR] = (0, n.useState)(0),
eL = (0, n.useCallback)(() => {
eI(1), eR((e) => e + 1);
}, []),
eD = (0, n.useCallback)(
({ cdnUrl: e, resourceMeta: t }) => {
em && (0, O.invalidatePeaks)(em);
let n = b.stores.canvas?.getNode(F);
G(F, {
url: [e],
resourceMeta: (0, _.mergeResourceMetaBundle)(n?.resourceMeta, t),
});
},
[F, em, G],
),
[ej, eO] = (0, n.useState)(!1);
(0, n.useEffect)(
() => () => {
el.current && (URL.revokeObjectURL(el.current), (el.current = null));
},
[],
);
let eF = (0, n.useCallback)(
(t) => {
if (!t.type.startsWith("audio/"))
return void (0, D.setUploadOverlay)(F, {
type: "error",
message: "请选择音频文件",
});
if (t.size > 0x3200000)
return void (0, D.setUploadOverlay)(F, {
type: "error",
message: "音频文件大小不能超过 50MB",
});
el.current && URL.revokeObjectURL(el.current);
let n = URL.createObjectURL(t);
el.current = n;
let i = (0, x.extractExtension)(t.name),
r = b.stores.canvas?.getNode(F)?.data ?? {},
a = Array.isArray(r.url) ? [...r.url] : [],
o = r.action,
c = r.resourceMeta,
l = () => {
a.length > 0
? G(F, { url: a, action: o, resourceMeta: c })
: G(F, { url: [], action: o });
};
G(F, {
url: [n],
action: d.NodeAction.AUDIO_RESOURCE,
resourceMeta: {
items: [
{
kind: "audio",
mimeType: t.type || void 0,
byteSize: Number.isFinite(t.size) ? t.size : void 0,
extension: i,
},
],
},
}),
eO(!0),
(0, D.setUploadOverlay)(F, { type: "uploading" }),
(async () => {
try {
let r,
{ getCookie: a } = await e.A(710867),
{ uploadViaPreSign: o, resolveUploadUrl: c } =
await e.A(33412),
{ USER_TOKEN_COOKIE_KEY: l, USER_UUID_COOKIE_KEY: u } =
await e.A(525723),
h = a(l),
f = a(u);
if (
!h ||
"string" != typeof h ||
!f ||
"string" != typeof f
) {
(0, D.clearUploadOverlay)(F), s.Notify.error("请先登录");
return;
}
let [d, p] = await Promise.all([
(0, x.probeAudioMeta)(n),
o(t, {
token: h,
uuid: f,
verify: !1,
onCalcHashEnd: (e) => {
r = e;
},
onProgress: (e) =>
(0, D.setUploadOverlay)(F, {
type: "uploading",
progress: e,
}),
}),
]),
g = c(p);
if (g) {
let { pollMediaAudit: a, AuditContentType: o } =
await e.A(638833);
await a(g, o.AUDIO),
URL.revokeObjectURL(n),
(el.current = null),
G(F, {
url: [g],
resourceMeta: {
items: [
{
kind: "audio",
mimeType: t.type || void 0,
byteSize: Number.isFinite(t.size)
? t.size
: void 0,
extension: i,
hashSha1: r,
...d,
},
],
},
}),
$(F);
}
(0, D.setUploadOverlay)(F, { type: "success" });
} catch (r) {
console.error("音频上传到 CDN 失败:", r);
let { FileReviewError: t, MediaAuditError: i } =
await e.A(638833);
r instanceof t || r instanceof i
? (l(),
(0, D.setUploadOverlay)(F, {
type: "error",
message: r.message,
}))
: (l(),
(0, D.clearUploadOverlay)(F),
s.Notify.error("音频上传失败,请重试")),
URL.revokeObjectURL(n),
(el.current = null);
} finally {
eO(!1);
}
})();
},
[F, G, $],
),
eU = (0, n.useCallback)(() => {
ec({ accept: ".mp3,audio/mpeg", onFile: eF });
}, [ec, eF]),
eB = (0, n.useCallback)(() => {
let e = et(F);
if (!e) return;
G(F, {
url: [p.AUDIO_PRESETS.audioToVideo.audioUrl],
action: d.NodeAction.AUDIO_RESOURCE,
});
let t = crypto.randomUUID(),
n = {
id: t,
type: d.NodeType.VIDEO,
data: {
type: d.NodeType.VIDEO,
name: "视频",
url: [],
poster: "",
action: d.NodeAction.VIDEO_GENERATE,
params: { prompt: p.AUDIO_PRESETS.audioToVideo.prompt },
},
position: {
x: e.position.x + f.NODE_WIDTH + f.NODE_GAP,
y: e.position.y,
},
sourcePosition: i.Position.Right,
targetPosition: i.Position.Left,
},
r = crypto.randomUUID(),
a = {
id: r,
type: d.NodeType.IMAGE,
data: {
type: d.NodeType.IMAGE,
name: "图片",
url: [p.AUDIO_PRESETS.audioToVideo.imageUrl],
alt: "图片",
action: d.NodeAction.IMAGE_RESOURCE,
},
position: {
x: e.position.x,
y: e.position.y + j.NODE_HEIGHT_AUDIO + f.NODE_GAP,
},
sourcePosition: i.Position.Right,
targetPosition: i.Position.Left,
};
V(n), V(a);
let o = {
id: crypto.randomUUID(),
source: F,
sourceHandle: "source",
target: t,
targetHandle: "target",
},
s = {
id: crypto.randomUUID(),
source: r,
sourceHandle: "source",
target: t,
targetHandle: "target",
};
W(o), W(s), ei(t);
}, [F, et, G, V, W, ei]),
eH = (0, n.useCallback)(() => {
eI((e) => {
let t = (j.PLAYBACK_RATES.indexOf(e) + 1) % j.PLAYBACK_RATES.length;
return j.PLAYBACK_RATES[t];
});
}, []),
ez = (0, n.useRef)(!1),
eG = (0, n.useCallback)(() => {
if (em && !ez.current) {
(ez.current = !0),
setTimeout(() => {
ez.current = !1;
}, 2e3);
try {
(0, v.triggerDownload)(
em,
(0, v.formatDownloadFileName)(ev, "mp3"),
);
} catch (e) {
console.error("下载失败:", e), s.Notify.error("下载失败,请重试");
}
}
}, [em, ev]),
e$ = "resource" === eA || "generating" === eA,
eV = {
width: `${f.NODE_WIDTH}px`,
height: `${e$ ? j.NODE_HEIGHT_AUDIO : f.NODE_HEIGHT_EMPTY}px`,
position: "relative",
background:
"empty_generate" === eA
? "var(--Surface-secondary-background, #262626)"
: "var(--Surface-Panel-background, #171717)",
border: "1px solid var(--canvas-node-border)",
backdropFilter: "blur(1.5px)",
...(0, I.getPipelineStyles)(
eo,
es,
B,
"var(--canvas-node-border-selected)",
),
},
eW =
("empty_generate" === eA || "pending" === eA) &&
!q &&
B &&
!J &&
!z &&
!X,
eK =
"resource" !== eA || q || !B || J || X
? eW
? (0, t.jsx)(h.default, {
children: (0, t.jsx)("div", {
className: "flex items-center",
style: j.FLOATING_TOOLBAR_STYLE,
children: (0, t.jsxs)("button", {
type: "button",
onClick: eU,
className:
"text-canvas-controls-text hover:bg-canvas-controls-hover flex h-6 items-center gap-1 rounded-md px-2 text-xs transition-colors",
children: [
(0, t.jsx)(j.UploadIcon, {
size: 14,
className: "shrink-0",
}),
(0, t.jsx)("span", { children: "上传" }),
],
}),
}),
})
: void 0
: (0, t.jsx)(h.default, {
children: (0, t.jsx)(j.AudioNodeToolbar, {
currentSpeed: eN,
onSpeedClick: eH,
onDownloadClick: eG,
}),
});
return (0, t.jsxs)(N.default, {
id: F,
selected: B,
label: ev,
titleIcon: (0, t.jsx)(j.MusicNoteIcon, { size: 14 }),
isStale: H?.isStale,
onDismissStale: ek,
isReadonly: q,
onLabelChange: eT,
maxWidth: f.NODE_WIDTH,
interaction: ea,
contentStyle: eV,
hideTargetHandle: (0, d.isResourceAction)(H?.action),
shouldShowGenerator: Q && "generating" !== eA,
nodeType: d.NodeType.AUDIO,
generatorType: H?.generatorType,
incomingData: ee,
beforeContent: eK,
labelSuffix: eM,
children: [
"failed" === eA &&
(0, t.jsx)(k.default, { taskInfo: H?.taskInfo, nodeId: F }),
"generating" === eA &&
(0, t.jsxs)("div", {
className: "flex h-full flex-col gap-3 p-3",
children: [
(0, t.jsxs)("div", {
className:
"relative w-full flex-1 overflow-hidden rounded-lg",
style: {
background: "var(--Surface-secondary-background, #262626)",
},
children: [
(0, t.jsx)(U, { lightChrome: Y }),
(0, t.jsx)("div", {
className:
"generating-breathing-grey absolute inset-0 rounded-lg",
style: {
backdropFilter: "blur(16px)",
WebkitBackdropFilter: "blur(16px)",
},
}),
(0, t.jsx)("div", {
className:
"absolute inset-0 flex items-center justify-center",
children: (0, t.jsx)(P.default, {
taskInfo: H?.taskInfo,
onCancel: ep,
}),
}),
],
}),
(0, t.jsx)("div", {
className: "flex w-full items-center justify-center",
children: (0, t.jsx)("div", {
className:
"flex size-8 items-center justify-center rounded-full",
style: {
background:
"var(--Surface-Panel-background-transparent, rgba(255,255,255,0.08))",
border:
"0.5px solid var(--stroke-medium, rgba(196,196,196,0.2))",
boxShadow:
"0px 4px 10px 0px rgba(0,0,0,0.12), 0px 2px 4px 0px rgba(0,0,0,0.2)",
},
children: (0, t.jsx)(o.Icons.PlayLine, {
width: 16,
height: 16,
className: "text-fg-muted",
}),
}),
}),
],
}),
"resource" === eA &&
em &&
(0, t.jsxs)("div", {
className: "relative h-full w-full",
children: [
(0, t.jsx)(
a.default,
{
url: em,
playbackRate: eN,
nodeId: F,
onDurationReady: eC,
chromeVariant: Y ? "canvasLight" : "default",
},
eP,
),
H?.action === d.NodeAction.AUDIO_RESOURCE &&
!H?.assetAudioAssetId &&
(0, t.jsx)(R.default, {
accept: ".mp3,audio/mpeg",
onUploaded: eD,
onBeforeUpload: eL,
isReadonly: q,
disabled: ej,
nodeId: F,
chromeVariant: Y ? "canvasLight" : "default",
}),
],
}),
"empty_generate" === eA &&
(0, t.jsx)(T.default, {
icon: (0, t.jsx)(o.Icons.AudioDisc, {
width: 66,
height: 66,
className: "text-fg-disabled shrink-0",
}),
isReadonly: q,
actions: [
{
icon: (0, t.jsx)(j.VideoCameraIcon, { size: 14 }),
label: "音频生视频",
onClick: eB,
},
],
}),
"pending" === eA && null,
(0, t.jsx)(L.default, {
nodeId: F,
hasContent: "resource" === eA && !!em,
}),
],
});
});
(B.displayName = "AudioNode"), e.s(["default", 0, B], 802913);
var H = e.i(386951),
z = e.i(210550);
function G({ id: e, data: n, selected: i }) {
let r = n?.label ?? "",
{
isConnectionTarget: a,
isConnectionBlocked: o,
isConnectionInvalid: s,
nodeHovered: c,
onNodeMouseEnter: l,
onNodeMouseLeave: u,
tiltStyle: h,
handleTiltMove: f,
} = (0, H.useConnection3DTilt)(e),
d = !!i || c;
return (0, t.jsxs)("div", {
className: "node-shell rounded-lg px-4 py-2 shadow-lg",
"data-nodeid": e,
style: {
background: "var(--Surface-secondary-background, #262626)",
color: "var(--canvas-controls-text)",
border: i
? "2px solid var(--canvas-node-border-selected)"
: "1px solid var(--canvas-node-border)",
minWidth: "120px",
textAlign: "center",
...h,
},
onMouseEnter: l,
onMouseLeave: u,
onMouseMove: f,
children: [
(0, t.jsx)(z.TargetHandle, { visible: d }),
(0, t.jsx)(H.default, { active: a, invalid: s }),
(0, t.jsx)(H.NodeFrostedOverlay, { active: o || s }),
(0, t.jsx)("div", { children: r }),
(0, t.jsx)(z.SourceHandle, { visible: d }),
],
});
}
e.s(["default", () => G], 295903);
};
export default moduleFactory;