164 lines
5.0 KiB
JavaScript
164 lines
5.0 KiB
JavaScript
/*
|
|
* Extracted from browser-delivered Turbopack chunk: fd0220e4d10052af.701bdafa2d.js
|
|
* Module id: 856685
|
|
* For reading/searching only; this factory depends on the original Turbopack runtime.
|
|
*/
|
|
|
|
const moduleFactory = (e) => {
|
|
"use strict";
|
|
var t = e.i(182004);
|
|
let n = [
|
|
t.NodeAction.IMAGE_RESOURCE,
|
|
t.NodeAction.IMAGE_GENERATE,
|
|
t.NodeAction.IMAGE_EDIT,
|
|
],
|
|
i = [
|
|
t.NodeAction.VIDEO_RESOURCE,
|
|
t.NodeAction.VIDEO_GENERATE,
|
|
t.NodeAction.VIDEO_EDIT,
|
|
],
|
|
r = [t.NodeAction.AUDIO_RESOURCE, t.NodeAction.AUDIO_GENERATE];
|
|
function a(e) {
|
|
if (!e) return null;
|
|
let t = e.content,
|
|
n = Array.isArray(t) ? t.join("\n") : "string" == typeof t ? t : "";
|
|
return n.trim() ? n : null;
|
|
}
|
|
function o(e, o) {
|
|
let s,
|
|
c,
|
|
l,
|
|
u =
|
|
((s = new Map(o.map((e) => [e.id, e]))),
|
|
(c = []),
|
|
(l = new Set()),
|
|
!(function e(n) {
|
|
for (let i of n) {
|
|
if (l.has(i)) continue;
|
|
l.add(i);
|
|
let n = s.get(i);
|
|
n &&
|
|
(n.type === t.NodeType.GROUP
|
|
? e(n.data?.childNodeIds ?? [])
|
|
: c.push(i));
|
|
}
|
|
})(e),
|
|
c),
|
|
h = new Map(o.map((e) => [e.id, e])),
|
|
f = [];
|
|
for (let e of u) {
|
|
let o = h.get(e);
|
|
if (!o) continue;
|
|
let s = o.data,
|
|
c = s?.action,
|
|
l = o.type,
|
|
u = s?.type,
|
|
d = s?.label || s?.name || "",
|
|
p =
|
|
"script" === l ||
|
|
"storyboard" === l ||
|
|
"script" === u ||
|
|
"storyboard" === u;
|
|
if ("image" === l && null != c && n.includes(c)) {
|
|
let t = s?.url,
|
|
n = (Array.isArray(t) ? t : "string" == typeof t ? [t] : []).filter(
|
|
(e) => "string" == typeof e && !!e.trim(),
|
|
);
|
|
n.length > 0 &&
|
|
f.push({ nodeId: e, type: "image", urls: n, label: d || "图片" });
|
|
} else if ("video" === l && null != c && i.includes(c)) {
|
|
let t = s?.url,
|
|
n = (Array.isArray(t) ? t : "string" == typeof t ? [t] : []).filter(
|
|
(e) => "string" == typeof e && !!e.trim(),
|
|
);
|
|
n.length > 0 &&
|
|
f.push({ nodeId: e, type: "video", urls: n, label: d || "视频" });
|
|
} else if ("audio" === l && null != c && r.includes(c)) {
|
|
let t = s?.url,
|
|
n = (Array.isArray(t) ? t : "string" == typeof t ? [t] : []).filter(
|
|
(e) => "string" == typeof e && !!e.trim(),
|
|
);
|
|
n.length > 0 &&
|
|
f.push({ nodeId: e, type: "audio", urls: n, label: d || "音频" });
|
|
} else if (p) {
|
|
let t = s?.rows,
|
|
n = Array.isArray(t) ? t : [];
|
|
n.length > 0 &&
|
|
f.push({
|
|
nodeId: e,
|
|
type: "script",
|
|
rows: n,
|
|
label: d || "脚本",
|
|
shotColumns: s?.shotColumns,
|
|
});
|
|
} else if (l === t.NodeType.TEXT) {
|
|
let t = a(s);
|
|
t &&
|
|
f.push({
|
|
nodeId: e,
|
|
type: "text",
|
|
markdown: t,
|
|
label: d || "文字",
|
|
});
|
|
}
|
|
}
|
|
return f;
|
|
}
|
|
function s(e, n) {
|
|
let i = (e) =>
|
|
e.includes(",") ||
|
|
e.includes('"') ||
|
|
e.includes("\n") ||
|
|
e.includes("\r")
|
|
? `"${e.replace(/"/g, '""')}"`
|
|
: e,
|
|
r = e.reduce((e, t) => Math.max(e, t.characters?.length ?? 0), 0),
|
|
a = t.SCRIPT_FIELD_META.findIndex((e) => "plotDescription" === e.key),
|
|
o = a >= 0 ? a + 1 : t.SCRIPT_FIELD_META.length,
|
|
s = t.SCRIPT_FIELD_META.slice(0, o),
|
|
c = t.SCRIPT_FIELD_META.slice(o),
|
|
l = [];
|
|
for (let e = 1; e <= r; e++)
|
|
l.push(`角色${e}`, `角色描述${e}`, `角色图${e}`);
|
|
let u = [
|
|
...s.map((e) => (0, t.getFieldLabel)(e.key, n)),
|
|
...l,
|
|
...c.map((e) => (0, t.getFieldLabel)(e.key, n)),
|
|
],
|
|
h = (e, t) => {
|
|
if ("videoReference" === t.key)
|
|
return e.videoReference?.referenceFrameImage ?? "";
|
|
let n = e[t.key];
|
|
return "string" == typeof n
|
|
? n
|
|
: "number" == typeof n
|
|
? String(n)
|
|
: "";
|
|
},
|
|
f = e.map((e) => {
|
|
let t = s.map((t) => h(e, t)),
|
|
n = [];
|
|
for (let t = 0; t < r; t++) {
|
|
let i = e.characters?.[t];
|
|
n.push(
|
|
i?.characterName ?? "",
|
|
i?.characterDescription ?? "",
|
|
i?.characterImageUrl ?? "",
|
|
);
|
|
}
|
|
return [...t, ...n, ...c.map((t) => h(e, t))].map(i).join(",");
|
|
});
|
|
return [u.map(i).join(","), ...f].join("\n");
|
|
}
|
|
e.s([
|
|
"collectResourceNodesForDownload",
|
|
() => o,
|
|
"getTextNodeMarkdownForExportFromData",
|
|
() => a,
|
|
"scriptRowsToCsvContent",
|
|
() => s,
|
|
]);
|
|
};
|
|
|
|
export default moduleFactory;
|