@field/cascade 0.10.0 → 0.12.0
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.
- package/AGENTS.md +25 -5
- package/ARCHITECTURE.md +5 -4
- package/CHANGELOG.md +382 -0
- package/README.md +1 -2
- package/dist/assets/AgentPanel-1JugFjE4.css +1 -0
- package/dist/assets/AgentPanel-BDL5MddA.js +5 -0
- package/dist/assets/{CodeEditor-DSZBpzdy.js → CodeEditor-C-xYG-Wn.js} +120 -120
- package/dist/assets/CodePanel-CtXd50m6.js +2 -0
- package/dist/assets/CookInfoPanel-B3NMhKJF.css +1 -0
- package/dist/assets/CookInfoPanel-DG4_TRsX.js +2 -0
- package/dist/assets/CustomNodeDialog-CHfZUs-r.js +1 -0
- package/dist/assets/DefinitionNode-CaRTXQ_b.js +1 -0
- package/dist/assets/DefinitionPanel-C3CxZY9r.js +1 -0
- package/dist/assets/DefinitionPanel-VNLnAiQD.css +1 -0
- package/dist/assets/OpenGraphDialog-BLdr6k_q.js +1 -0
- package/dist/assets/ProjectSettings-ZnvmIAir.js +2 -0
- package/dist/assets/{SettingsDialog-p25h3tj0.js → SettingsDialog-CBX3Wa87.js} +1 -1
- package/dist/assets/TimelinePanel-CDeR0arY.css +1 -0
- package/dist/assets/TimelinePanel-CWgnFH1e.js +1 -0
- package/dist/assets/{VersionHistoryDialog-DzFLUotB.js → VersionHistoryDialog-BOSoW1R-.js} +1 -1
- package/dist/assets/assert-BO2_erPD.js +1 -0
- package/dist/assets/assert-hvykGCnP.js +1 -0
- package/dist/assets/builder-BmBKcDix.js +1 -0
- package/dist/assets/camera-DFF7YA3F.js +1 -0
- package/dist/assets/checks-DAvyO9Gf.js +1 -0
- package/dist/assets/contactSheet-N1NcaWxw.js +2 -0
- package/dist/assets/{core-BICrEt0y.js → core-DB-MkGjj.js} +3 -4
- package/dist/assets/coreTypes-DtnDATZ7.js +1 -0
- package/dist/assets/{cssMode-D7TXw57I.js → cssMode-DPVckSOc.js} +1 -1
- package/dist/assets/definitions-B227e7f_.js +1 -0
- package/dist/assets/definitions-D0WOUJd7.js +1 -0
- package/dist/assets/{editor.api-DvkCO3ko.js → editor.api-Dkutg_Z1.js} +1 -1
- package/dist/assets/expressions-X-Z-GrgW.js +5 -0
- package/dist/assets/file-DAL6IfjV.js +1 -0
- package/dist/assets/filters-D3k1LRMa.js +1 -0
- package/dist/assets/{freemarker2-BA2lxsF1.js → freemarker2-CLiLKk3B.js} +1 -1
- package/dist/assets/generators-BhDxRAFC.js +1 -0
- package/dist/assets/geo-BsMImJIJ.js +1 -0
- package/dist/assets/geo-C4YngDob.js +2 -0
- package/dist/assets/{handlebars-BcDiyPd8.js → handlebars-CcD3aMeL.js} +1 -1
- package/dist/assets/{html-C7O4TyhX.js → html-DvZWGfqb.js} +1 -1
- package/dist/assets/{htmlMode-WaDGF3Mj.js → htmlMode-DUD3VaoN.js} +1 -1
- package/dist/assets/image-0SfH-snh.js +1 -0
- package/dist/assets/image-Ck-RdGU4.js +2 -0
- package/dist/assets/index-BWnrmIB9.js +137 -0
- package/dist/assets/index-DIaxEONI.css +1 -0
- package/dist/assets/io-BGmt2g0D.js +1 -0
- package/dist/assets/{javascript-CpIEK7tz.js → javascript-Cap2ahgh.js} +1 -1
- package/dist/assets/{jsonMode-B2FltW0f.js → jsonMode-B0uLjp9C.js} +1 -1
- package/dist/assets/{liquid-CN6FFHZE.js → liquid-CnxwhfLn.js} +1 -1
- package/dist/assets/{lspLanguageFeatures-QhV9XtLp.js → lspLanguageFeatures-Dn9hlKX6.js} +1 -1
- package/dist/assets/math-GeULS-sk.js +1 -0
- package/dist/assets/{mdx-DE89pafV.js → mdx-BV3jbrVa.js} +1 -1
- package/dist/assets/pop-KMF_qloi.js +1 -0
- package/dist/assets/preload-helper-Czpn1I53.js +1 -0
- package/dist/assets/{python-ByTllTB9.js → python-CGyFk4XK.js} +1 -1
- package/dist/assets/{razor-USYlRRCE.js → razor-CQfzX3-N.js} +1 -1
- package/dist/assets/remap-5SjXQU-q.js +1 -0
- package/dist/assets/renderMarkdown-ork0Oir7.js +67 -0
- package/dist/assets/studioImages-CAyH-0Pl.js +1 -0
- package/dist/assets/text-ZpX7qNkx.js +2 -0
- package/dist/assets/time-P_OiBhcf.js +1 -0
- package/dist/assets/{tsMode-BXpN8iUz.js → tsMode-BOeXzO9H.js} +1 -1
- package/dist/assets/{typescript-DInBjGQQ.js → typescript-J1SnE_Tu.js} +1 -1
- package/dist/assets/{workers-C7Ye5B7D.js → workers-CYwwTiVF.js} +1 -1
- package/dist/assets/{xml-U0Uocqyo.js → xml-DnPRNzK9.js} +1 -1
- package/dist/assets/{yaml-CBw_PVYf.js → yaml-BmmYBNa9.js} +1 -1
- package/dist/cli/DefinitionNode-P7AA4TAU.js +15 -0
- package/dist/cli/Graph-OB6EWSGL.js +2975 -0
- package/dist/cli/assert-GROGQNCQ.js +25 -0
- package/dist/cli/checks-3WB44XBL.js +189 -0
- package/dist/cli/chunk-2JEU3MGB.js +1125 -0
- package/dist/cli/chunk-2KXB47FP.js +115 -0
- package/dist/cli/chunk-3RXL5GHB.js +816 -0
- package/dist/cli/chunk-53LGFPWX.js +138 -0
- package/dist/cli/chunk-5ORUQ6ES.js +267 -0
- package/dist/cli/chunk-73S4JZXK.js +336 -0
- package/dist/cli/chunk-7QE2ZNSN.js +121 -0
- package/dist/cli/chunk-BP7UKF36.js +376 -0
- package/dist/cli/chunk-BPODRH52.js +201 -0
- package/dist/cli/chunk-BZ63XQ3I.js +1301 -0
- package/dist/cli/chunk-CKS2FQWR.js +89 -0
- package/dist/cli/chunk-CO22XHNG.js +593 -0
- package/dist/cli/chunk-CTPLRSWF.js +2197 -0
- package/dist/cli/chunk-DEQSEFFH.js +153 -0
- package/dist/cli/chunk-EU4ZFZ7Y.js +122 -0
- package/dist/cli/chunk-EZRWJ4G2.js +104 -0
- package/dist/cli/chunk-FWMSGKEH.js +71 -0
- package/dist/cli/chunk-G23A2BZZ.js +705 -0
- package/dist/cli/chunk-GRIN2DDP.js +1465 -0
- package/dist/cli/chunk-HFHWYL55.js +139 -0
- package/dist/cli/chunk-HSNOBIVT.js +263 -0
- package/dist/cli/chunk-ICH7N5PN.js +26 -0
- package/dist/cli/chunk-J7VK7MNF.js +418 -0
- package/dist/cli/chunk-JVOCK5W4.js +83 -0
- package/dist/cli/chunk-KBGUO27Q.js +15 -0
- package/dist/cli/chunk-KH4MUBKF.js +1551 -0
- package/dist/cli/chunk-L6B6FUQP.js +330 -0
- package/dist/cli/chunk-LTXWBXOM.js +438 -0
- package/dist/cli/chunk-MI5JLQYA.js +220 -0
- package/dist/cli/chunk-MP653A5O.js +3766 -0
- package/dist/cli/chunk-NJFMDXHR.js +320 -0
- package/dist/cli/chunk-OM6BEME6.js +267 -0
- package/dist/cli/chunk-OWWBYLHC.js +136 -0
- package/dist/cli/chunk-QQPA2ZHH.js +273 -0
- package/dist/cli/chunk-RUU3YWXU.js +99 -0
- package/dist/cli/chunk-RXDIMXN5.js +98 -0
- package/dist/cli/chunk-ST6LROUG.js +267 -0
- package/dist/cli/chunk-TJW67QSI.js +225 -0
- package/dist/cli/chunk-WD62JIP6.js +118 -0
- package/dist/cli/chunk-WGKPJZDY.js +364 -0
- package/dist/cli/chunk-X4WKAOQP.js +634 -0
- package/dist/cli/chunk-X566FWBV.js +156 -0
- package/dist/cli/chunk-YH637PDL.js +317 -0
- package/dist/cli/chunk-ZL4JTG5Y.js +37 -0
- package/dist/cli/chunk-ZSCUZE6I.js +112 -0
- package/dist/cli/cliCommands-JJN5Z3ZC.js +3470 -0
- package/dist/cli/commands-PHYFYA3F.js +1374 -0
- package/dist/cli/contactSheet-2PQVRUFW.js +11 -0
- package/dist/cli/definitions-BPOPW52L.js +32 -0
- package/dist/cli/doctorCommand-ORWQRNYP.js +106 -0
- package/dist/cli/edit-S5KEQ5RA.js +28 -0
- package/dist/cli/editorCommands-NFR32JOY.js +41 -0
- package/dist/cli/encode-ICPEPMH5.js +17 -0
- package/dist/cli/file-3HTQHPYQ.js +41 -0
- package/dist/cli/filters-6ODFWYK4.js +379 -0
- package/dist/cli/frames-LSAUBZ7P.js +16 -0
- package/dist/cli/generators-YU7GB4MD.js +210 -0
- package/dist/cli/geo-6ZPGKZRU.js +43 -0
- package/dist/cli/graphCommands-EOUOBOIJ.js +184 -0
- package/dist/cli/graphFile-YTGJB5F5.js +292 -0
- package/dist/cli/headlessCanvas-ENRHC7GS.js +16 -0
- package/dist/cli/helpCommand-PULH6ZYB.js +157 -0
- package/dist/cli/image-TXELZZK5.js +55 -0
- package/dist/cli/index.js +100 -30756
- package/dist/cli/math-RSYRQ3C6.js +16 -0
- package/dist/cli/mcp-JVZFQOEX.js +164 -0
- package/dist/cli/parity-X6DEH2DV.js +334 -0
- package/dist/cli/pop-B7SIIYKN.js +39 -0
- package/dist/cli/project-VYGIA7JX.js +12 -0
- package/dist/cli/projectDefinition-F3D7UIHJ.js +27 -0
- package/dist/cli/projectRuntime-2Q4JKEH3.js +55 -0
- package/dist/cli/registerStandardNodes-BXJCB6E4.js +744 -0
- package/dist/cli/render-PT4MWI6U.js +438 -0
- package/dist/cli/runCommand-HNPQVZMS.js +198 -0
- package/dist/cli/runner-5XPXVW7J.js +43 -0
- package/dist/cli/runtime/image.ts +302 -0
- package/dist/cli/runtime/io.ts +78 -0
- package/dist/cli/runtime/stage.ts +4 -1
- package/dist/cli/share-MHF6TNRK.js +166 -0
- package/dist/cli/stageCache-TY2BFZJR.js +15 -0
- package/dist/cli/stageRunner-KY2EJP7X.js +10 -0
- package/dist/cli/text-MB3EKR4H.js +126 -0
- package/dist/cli/verbs-PI2JH5FI.js +19 -0
- package/dist/cli/webBuild-WPPMGGW7.js +44 -0
- package/dist/contracts/capabilities.d.ts +18 -1
- package/dist/contracts/color.d.ts +8 -0
- package/dist/contracts/color.js +23 -0
- package/dist/contracts/definition.d.ts +10 -0
- package/dist/contracts/documentFormat.d.ts +18 -0
- package/dist/contracts/documentFormat.js +195 -0
- package/dist/contracts/editor.d.ts +17 -0
- package/dist/contracts/index.d.ts +1 -0
- package/dist/contracts/index.js +1 -0
- package/dist/contracts/schema.d.ts +1 -1
- package/dist/contracts/schema.js +1 -0
- package/dist/contracts/validate.js +11 -1
- package/dist/contracts/values.d.ts +24 -0
- package/dist/image.d.ts +156 -0
- package/dist/image.js +161 -0
- package/dist/index.html +8 -2
- package/dist/io.d.ts +29 -0
- package/dist/io.js +40 -0
- package/dist/player/app.js +3 -2
- package/dist/player/editor.js +35 -9
- package/dist/player/editorEngine.js +3 -2
- package/dist/runtime/builtins/assert/checks.d.ts +18 -0
- package/dist/runtime/builtins/assert/checks.js +207 -0
- package/dist/runtime/builtins/assert/definitions.d.ts +130 -0
- package/dist/runtime/builtins/assert/definitions.js +54 -0
- package/dist/runtime/builtins/assert/index.d.ts +152 -0
- package/dist/runtime/builtins/assert/index.js +36 -0
- package/dist/runtime/builtins/image/contactSheet.d.ts +64 -0
- package/dist/runtime/builtins/image/contactSheet.js +150 -0
- package/dist/runtime/builtins/image/definitions.d.ts +950 -0
- package/dist/runtime/builtins/image/definitions.js +343 -0
- package/dist/runtime/builtins/image/file.d.ts +8 -0
- package/dist/runtime/builtins/image/file.js +37 -0
- package/dist/runtime/builtins/image/filters.d.ts +8 -0
- package/dist/runtime/builtins/image/filters.js +394 -0
- package/dist/runtime/builtins/image/generators.d.ts +7 -0
- package/dist/runtime/builtins/image/generators.js +144 -0
- package/dist/runtime/builtins/image/index.d.ts +952 -0
- package/dist/runtime/builtins/image/index.js +44 -0
- package/dist/runtime/builtins/image/io.d.ts +100 -0
- package/dist/runtime/builtins/image/io.js +142 -0
- package/dist/runtime/builtins/image/planar.d.ts +55 -0
- package/dist/runtime/builtins/image/planar.js +274 -0
- package/dist/runtime/builtins/image/simplex.d.ts +22 -0
- package/dist/runtime/builtins/image/simplex.js +92 -0
- package/dist/runtime/builtins/image/text.d.ts +4 -0
- package/dist/runtime/builtins/image/text.js +141 -0
- package/dist/runtime/builtins/index.d.ts +3 -0
- package/dist/runtime/builtins/index.js +7 -0
- package/dist/runtime/gpu.d.ts +25 -0
- package/dist/runtime/gpu.js +40 -0
- package/dist/runtime/runtime.d.ts +2 -0
- package/dist/runtime/runtime.js +268 -44
- package/dist/runtime/types.d.ts +30 -0
- package/dist/stage.js +4 -1
- package/doc/CLI_REFERENCE.md +91 -2
- package/doc/EDITOR_EXPORT.md +37 -2
- package/doc/MCP.md +18 -1
- package/doc/NODE_REFERENCE.md +424 -10
- package/doc/PROJECT_AUTHORING.md +222 -7
- package/package.json +19 -4
- package/dist/assets/CodePanel-sY6sZa7B.js +0 -2
- package/dist/assets/CustomNodeDialog-BRKnqZhp.js +0 -1
- package/dist/assets/ExportDialog-C7dVGua4.js +0 -358
- package/dist/assets/ExportDialog-DOq0flMV.css +0 -1
- package/dist/assets/OpenGraphDialog-ZsgL-iwr.js +0 -1
- package/dist/assets/ProjectSettings-Cw17nNe3.js +0 -2
- package/dist/assets/definitions-DUww2Rt-.js +0 -1
- package/dist/assets/geo-C2RHOVHC.js +0 -1
- package/dist/assets/image-DR4oeyJB.js +0 -2062
- package/dist/assets/index-7vae6YFC.css +0 -1
- package/dist/assets/index-DyvDC6pS.js +0 -219
- package/dist/assets/math-DaDEgWKt.js +0 -1
- package/dist/assets/pop-pLH7L0PW.js +0 -1
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import {
|
|
2
|
+
registerDefinitionNodes
|
|
3
|
+
} from "./chunk-BPODRH52.js";
|
|
4
|
+
import "./chunk-CTPLRSWF.js";
|
|
5
|
+
import "./chunk-RUU3YWXU.js";
|
|
6
|
+
import {
|
|
7
|
+
cameraRegistration,
|
|
8
|
+
feedbackRegistration,
|
|
9
|
+
frozenRegistration,
|
|
10
|
+
packRegistration,
|
|
11
|
+
pickRegistration,
|
|
12
|
+
previousRegistration,
|
|
13
|
+
timeRegistration
|
|
14
|
+
} from "./chunk-X4WKAOQP.js";
|
|
15
|
+
import "./chunk-DEQSEFFH.js";
|
|
16
|
+
import "./chunk-RXDIMXN5.js";
|
|
17
|
+
import "./chunk-L6B6FUQP.js";
|
|
18
|
+
import "./chunk-HFHWYL55.js";
|
|
19
|
+
import "./chunk-CO22XHNG.js";
|
|
20
|
+
import "./chunk-FWMSGKEH.js";
|
|
21
|
+
|
|
22
|
+
// src/nodes/core/definitions.ts
|
|
23
|
+
registerDefinitionNodes([
|
|
24
|
+
cameraRegistration,
|
|
25
|
+
timeRegistration,
|
|
26
|
+
feedbackRegistration,
|
|
27
|
+
previousRegistration,
|
|
28
|
+
pickRegistration,
|
|
29
|
+
packRegistration,
|
|
30
|
+
frozenRegistration
|
|
31
|
+
]);
|
|
32
|
+
//# sourceMappingURL=definitions-BPOPW52L.js.map
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import {
|
|
2
|
+
provisionPythonEnv,
|
|
3
|
+
pythonEnvStatus
|
|
4
|
+
} from "./chunk-WD62JIP6.js";
|
|
5
|
+
|
|
6
|
+
// src/cli/doctorCommand.ts
|
|
7
|
+
import { execFile } from "node:child_process";
|
|
8
|
+
import fs from "node:fs";
|
|
9
|
+
import path from "node:path";
|
|
10
|
+
var DOCTOR_USAGE = "cascade doctor [project-directory] [--fix] [--json]";
|
|
11
|
+
async function runDoctorCommand(args) {
|
|
12
|
+
const fix = args.includes("--fix");
|
|
13
|
+
const json = args.includes("--json");
|
|
14
|
+
const root = path.resolve(args.slice(1).find((arg) => !arg.startsWith("-")) ?? ".");
|
|
15
|
+
if (!fs.existsSync(root) || !fs.statSync(root).isDirectory()) throw new Error(`${root} is not a directory`);
|
|
16
|
+
const checks = await doctor(root, { fix, log: (line) => {
|
|
17
|
+
if (!json) console.log(line);
|
|
18
|
+
} });
|
|
19
|
+
const ok = checks.every((check) => check.ok || check.optional);
|
|
20
|
+
if (json) process.stdout.write(`${JSON.stringify({ project: root, ok, checks })}
|
|
21
|
+
`);
|
|
22
|
+
else for (const check of checks) console.log(`${check.ok ? "ok " : check.optional ? "warn" : "FAIL"} ${check.name}: ${check.detail}`);
|
|
23
|
+
if (!ok) {
|
|
24
|
+
if (json) console.error(checks.filter((check) => !check.ok && !check.optional).map((check) => `${check.name}: ${check.detail}`).join("\n"));
|
|
25
|
+
process.exitCode = 1;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
async function doctor(root, options = {}) {
|
|
29
|
+
const checks = [];
|
|
30
|
+
let env;
|
|
31
|
+
try {
|
|
32
|
+
env = pythonEnvStatus(root);
|
|
33
|
+
if (env.declared && env.state !== "current" && options.fix) env = await provisionPythonEnv(root, options.log);
|
|
34
|
+
checks.push(env.state === "none" ? { name: "python environment", ok: true, detail: 'none declared (cascade.json "python": { "requirements": [...] } provisions one)' } : env.state === "current" ? { name: "python environment", ok: true, detail: `current, ${path.relative(root, env.directory)}` } : { name: "python environment", ok: false, detail: `${env.state}: ${env.reason}. Run cascade doctor --fix` });
|
|
35
|
+
} catch (error) {
|
|
36
|
+
checks.push({ name: "python environment", ok: false, detail: error instanceof Error ? error.message : String(error) });
|
|
37
|
+
}
|
|
38
|
+
if (hasStages(root)) {
|
|
39
|
+
try {
|
|
40
|
+
const { ProjectRoot } = await import("./project-VYGIA7JX.js");
|
|
41
|
+
const { readStageConfig } = await import("./stageRunner-KY2EJP7X.js");
|
|
42
|
+
const { stageSources } = await import("./stageCache-TY2BFZJR.js");
|
|
43
|
+
const project = new ProjectRoot(root);
|
|
44
|
+
const config = readStageConfig(project);
|
|
45
|
+
const { python } = config;
|
|
46
|
+
const version = await output(python, ["-c", "import sys; print(sys.version.split()[0], sys.executable)"], root);
|
|
47
|
+
checks.push({ name: "stage interpreter", ok: true, detail: `Python ${version}` });
|
|
48
|
+
if (env?.state === "none") {
|
|
49
|
+
const sources = stageSources(project, config);
|
|
50
|
+
const importer = sources.files().find((file) => importsModule(project.resolveMedia(file), "numpy"));
|
|
51
|
+
if (importer) {
|
|
52
|
+
try {
|
|
53
|
+
await output(python, ["-c", "import numpy"], root);
|
|
54
|
+
checks.push({ name: "stage imports", ok: true, detail: `numpy (imported by ${importer}) loads in ${python}` });
|
|
55
|
+
} catch {
|
|
56
|
+
checks.push({
|
|
57
|
+
name: "stage imports",
|
|
58
|
+
ok: false,
|
|
59
|
+
detail: `${importer} imports numpy, which ${python} (Python ${version.split(" ")[0]}) does not have, and no environment is declared. Declare one in cascade.json ("python": { "requirements": ["numpy"] }) and run cascade doctor --fix, or point exec.stages.python at an interpreter that has it`
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
} catch (error) {
|
|
65
|
+
checks.push({ name: "stage interpreter", ok: false, detail: error instanceof Error ? error.message : String(error) });
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
const { hasFfmpeg } = await import("./encode-ICPEPMH5.js");
|
|
69
|
+
checks.push(await hasFfmpeg() ? { name: "ffmpeg", ok: true, detail: "on the PATH" } : { name: "ffmpeg", ok: false, optional: true, detail: "not on the PATH: --mp4 and cascade render videos need it (brew install ffmpeg)" });
|
|
70
|
+
const { canvasAvailable, CANVAS_PACKAGE } = await import("./headlessCanvas-ENRHC7GS.js");
|
|
71
|
+
checks.push(await canvasAvailable() ? { name: "headless canvas", ok: true, detail: CANVAS_PACKAGE } : { name: "headless canvas", ok: false, optional: true, detail: `${CANVAS_PACKAGE} is not installed: drawing nodes cannot run headlessly (npm install ${CANVAS_PACKAGE})` });
|
|
72
|
+
return checks;
|
|
73
|
+
}
|
|
74
|
+
function hasStages(root) {
|
|
75
|
+
try {
|
|
76
|
+
const manifest = JSON.parse(fs.readFileSync(path.join(root, "cascade.json"), "utf8"));
|
|
77
|
+
return Boolean(manifest?.exec?.stages);
|
|
78
|
+
} catch {
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
function importsModule(file, module) {
|
|
83
|
+
let source;
|
|
84
|
+
try {
|
|
85
|
+
source = fs.readFileSync(file, "utf8");
|
|
86
|
+
} catch {
|
|
87
|
+
return false;
|
|
88
|
+
}
|
|
89
|
+
const name = module.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
90
|
+
return new RegExp(`^\\s*(?:import\\s+(?:[\\w.]+\\s*(?:as\\s+\\w+)?\\s*,\\s*)*${name}\\b|from\\s+${name}(?:\\.|\\s))`, "m").test(source);
|
|
91
|
+
}
|
|
92
|
+
function output(command, args, cwd) {
|
|
93
|
+
return new Promise((resolve, reject) => {
|
|
94
|
+
execFile(command, args, { cwd, timeout: 3e4 }, (error, stdout, stderr) => {
|
|
95
|
+
if (error) reject(new Error(`${command} does not start: ${(stderr || error.message).trim().slice(-500)}`));
|
|
96
|
+
else resolve(stdout.trim());
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
export {
|
|
101
|
+
DOCTOR_USAGE,
|
|
102
|
+
doctor,
|
|
103
|
+
importsModule,
|
|
104
|
+
runDoctorCommand
|
|
105
|
+
};
|
|
106
|
+
//# sourceMappingURL=doctorCommand-ORWQRNYP.js.map
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import {
|
|
2
|
+
GRAPH_EDIT_OPERATIONS,
|
|
3
|
+
GraphEditError,
|
|
4
|
+
GraphEditor,
|
|
5
|
+
applyOperation,
|
|
6
|
+
defaultIdFor,
|
|
7
|
+
flowStep,
|
|
8
|
+
placeNode,
|
|
9
|
+
readGraph,
|
|
10
|
+
readWire,
|
|
11
|
+
splitEndpoint,
|
|
12
|
+
wireLabel
|
|
13
|
+
} from "./chunk-BZ63XQ3I.js";
|
|
14
|
+
import "./chunk-FWMSGKEH.js";
|
|
15
|
+
export {
|
|
16
|
+
GRAPH_EDIT_OPERATIONS,
|
|
17
|
+
GraphEditError,
|
|
18
|
+
GraphEditor,
|
|
19
|
+
applyOperation,
|
|
20
|
+
defaultIdFor,
|
|
21
|
+
flowStep,
|
|
22
|
+
placeNode,
|
|
23
|
+
readGraph,
|
|
24
|
+
readWire,
|
|
25
|
+
splitEndpoint,
|
|
26
|
+
wireLabel
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=edit-S5KEQ5RA.js.map
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import {
|
|
2
|
+
EDITOR_COMMANDS,
|
|
3
|
+
EDITOR_HELP,
|
|
4
|
+
runEditorCommand,
|
|
5
|
+
sceneDocument
|
|
6
|
+
} from "./chunk-73S4JZXK.js";
|
|
7
|
+
import "./chunk-EZRWJ4G2.js";
|
|
8
|
+
import "./chunk-3RXL5GHB.js";
|
|
9
|
+
import "./chunk-OM6BEME6.js";
|
|
10
|
+
import "./chunk-MP653A5O.js";
|
|
11
|
+
import "./chunk-MI5JLQYA.js";
|
|
12
|
+
import "./chunk-GRIN2DDP.js";
|
|
13
|
+
import "./chunk-X4WKAOQP.js";
|
|
14
|
+
import "./chunk-DEQSEFFH.js";
|
|
15
|
+
import "./chunk-RXDIMXN5.js";
|
|
16
|
+
import "./chunk-QQPA2ZHH.js";
|
|
17
|
+
import "./chunk-KH4MUBKF.js";
|
|
18
|
+
import "./chunk-HSNOBIVT.js";
|
|
19
|
+
import "./chunk-L6B6FUQP.js";
|
|
20
|
+
import "./chunk-HFHWYL55.js";
|
|
21
|
+
import "./chunk-KBGUO27Q.js";
|
|
22
|
+
import "./chunk-ICH7N5PN.js";
|
|
23
|
+
import "./chunk-CO22XHNG.js";
|
|
24
|
+
import "./chunk-LTXWBXOM.js";
|
|
25
|
+
import "./chunk-BZ63XQ3I.js";
|
|
26
|
+
import "./chunk-YH637PDL.js";
|
|
27
|
+
import "./chunk-X566FWBV.js";
|
|
28
|
+
import "./chunk-WD62JIP6.js";
|
|
29
|
+
import "./chunk-5ORUQ6ES.js";
|
|
30
|
+
import "./chunk-2JEU3MGB.js";
|
|
31
|
+
import "./chunk-NJFMDXHR.js";
|
|
32
|
+
import "./chunk-J7VK7MNF.js";
|
|
33
|
+
import "./chunk-FWMSGKEH.js";
|
|
34
|
+
import "./chunk-JVOCK5W4.js";
|
|
35
|
+
export {
|
|
36
|
+
EDITOR_COMMANDS,
|
|
37
|
+
EDITOR_HELP,
|
|
38
|
+
runEditorCommand,
|
|
39
|
+
sceneDocument
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=editorCommands-NFR32JOY.js.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DEFAULT_CRF,
|
|
3
|
+
encodeMp4,
|
|
4
|
+
encodeSequence,
|
|
5
|
+
frameSequences,
|
|
6
|
+
hasFfmpeg,
|
|
7
|
+
timelineFrameSpec
|
|
8
|
+
} from "./chunk-7QE2ZNSN.js";
|
|
9
|
+
export {
|
|
10
|
+
DEFAULT_CRF,
|
|
11
|
+
encodeMp4,
|
|
12
|
+
encodeSequence,
|
|
13
|
+
frameSequences,
|
|
14
|
+
hasFfmpeg,
|
|
15
|
+
timelineFrameSpec
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=encode-ICPEPMH5.js.map
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import {
|
|
2
|
+
imageReference,
|
|
3
|
+
output,
|
|
4
|
+
readPlanar,
|
|
5
|
+
resample
|
|
6
|
+
} from "./chunk-WGKPJZDY.js";
|
|
7
|
+
|
|
8
|
+
// packages/runtime/src/builtins/image/file.ts
|
|
9
|
+
async function executeImage(context) {
|
|
10
|
+
const { props } = context;
|
|
11
|
+
const source = await readPlanar(context, imageReference(context.inputs.image) ?? imageReference(props.file));
|
|
12
|
+
if (!source) return;
|
|
13
|
+
if (props.resolutionMode === "original") {
|
|
14
|
+
await output(context, source);
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
if (props.resolutionMode === "max") {
|
|
18
|
+
const [maxWidth, maxHeight] = props.maxResolution;
|
|
19
|
+
const aspect = source.width / source.height;
|
|
20
|
+
let width2 = source.width;
|
|
21
|
+
let height2 = source.height;
|
|
22
|
+
if (width2 > maxWidth) {
|
|
23
|
+
width2 = maxWidth;
|
|
24
|
+
height2 = maxWidth / aspect;
|
|
25
|
+
}
|
|
26
|
+
if (height2 > maxHeight) {
|
|
27
|
+
height2 = maxHeight;
|
|
28
|
+
width2 = maxHeight * aspect;
|
|
29
|
+
}
|
|
30
|
+
width2 = Math.round(width2);
|
|
31
|
+
height2 = Math.round(height2);
|
|
32
|
+
await output(context, width2 !== source.width || height2 !== source.height ? resample(source, width2, height2) : source);
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
const [width, height] = props.fixedResolution;
|
|
36
|
+
await output(context, resample(source, width, height));
|
|
37
|
+
}
|
|
38
|
+
export {
|
|
39
|
+
executeImage
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=file-3HTQHPYQ.js.map
|
|
@@ -0,0 +1,379 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Planar,
|
|
3
|
+
output,
|
|
4
|
+
readPlanar,
|
|
5
|
+
resample,
|
|
6
|
+
resizeToFit,
|
|
7
|
+
resolveOutputSize
|
|
8
|
+
} from "./chunk-WGKPJZDY.js";
|
|
9
|
+
|
|
10
|
+
// packages/runtime/src/builtins/image/filters.ts
|
|
11
|
+
function boxesForGauss(sigma, n) {
|
|
12
|
+
const wIdeal = Math.sqrt(12 * sigma * sigma / n + 1);
|
|
13
|
+
let wl = Math.floor(wIdeal);
|
|
14
|
+
if (wl % 2 === 0) wl--;
|
|
15
|
+
const wu = wl + 2;
|
|
16
|
+
const mIdeal = (12 * sigma * sigma - n * wl * wl - 4 * n * wl - 3 * n) / (-4 * wl - 4);
|
|
17
|
+
const m = Math.round(mIdeal);
|
|
18
|
+
const sizes = [];
|
|
19
|
+
for (let i = 0; i < n; i++) sizes.push(i < m ? wl : wu);
|
|
20
|
+
return sizes.map((s) => (s - 1) / 2);
|
|
21
|
+
}
|
|
22
|
+
function boxBlurPass(data, w, h, r, wrap) {
|
|
23
|
+
if (r < 1) return;
|
|
24
|
+
const temp = new Float32Array(w * h);
|
|
25
|
+
const ri = Math.floor(r);
|
|
26
|
+
const invDiameter = 1 / (ri * 2 + 1);
|
|
27
|
+
for (let y = 0; y < h; y++) {
|
|
28
|
+
const row = y * w;
|
|
29
|
+
let sum = 0;
|
|
30
|
+
for (let i = -ri; i <= ri; i++) {
|
|
31
|
+
const px = wrap ? (i % w + w) % w : Math.max(0, Math.min(w - 1, i));
|
|
32
|
+
sum += data[row + px];
|
|
33
|
+
}
|
|
34
|
+
temp[row] = sum * invDiameter;
|
|
35
|
+
for (let x = 1; x < w; x++) {
|
|
36
|
+
const removeX = wrap ? ((x - ri - 1) % w + w) % w : Math.max(0, x - ri - 1);
|
|
37
|
+
const addX = wrap ? ((x + ri) % w + w) % w : Math.min(w - 1, x + ri);
|
|
38
|
+
sum -= data[row + removeX];
|
|
39
|
+
sum += data[row + addX];
|
|
40
|
+
temp[row + x] = sum * invDiameter;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
for (let x = 0; x < w; x++) {
|
|
44
|
+
let sum = 0;
|
|
45
|
+
for (let i = -ri; i <= ri; i++) {
|
|
46
|
+
const py = wrap ? (i % h + h) % h : Math.max(0, Math.min(h - 1, i));
|
|
47
|
+
sum += temp[py * w + x];
|
|
48
|
+
}
|
|
49
|
+
data[x] = sum * invDiameter;
|
|
50
|
+
for (let y = 1; y < h; y++) {
|
|
51
|
+
const removeY = wrap ? ((y - ri - 1) % h + h) % h : Math.max(0, y - ri - 1);
|
|
52
|
+
const addY = wrap ? ((y + ri) % h + h) % h : Math.min(h - 1, y + ri);
|
|
53
|
+
sum -= temp[removeY * w + x];
|
|
54
|
+
sum += temp[addY * w + x];
|
|
55
|
+
data[y * w + x] = sum * invDiameter;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
function boxBlur(source, radius, wrapEdges) {
|
|
60
|
+
if (radius <= 0) return source.clone();
|
|
61
|
+
const boxes = boxesForGauss(radius, 3);
|
|
62
|
+
const result = source.emptyClone();
|
|
63
|
+
for (let c = 0; c < source.channelCount; c++) {
|
|
64
|
+
const channel = new Float32Array(source.channels[c]);
|
|
65
|
+
for (const box of boxes) boxBlurPass(channel, source.width, source.height, box, wrapEdges);
|
|
66
|
+
result.channels[c].set(channel);
|
|
67
|
+
}
|
|
68
|
+
return result;
|
|
69
|
+
}
|
|
70
|
+
function gaussianBlur(source, radius, wrapEdges) {
|
|
71
|
+
if (radius <= 0) return source.clone();
|
|
72
|
+
const { width, height } = source;
|
|
73
|
+
const result = source.emptyClone();
|
|
74
|
+
const kernelSize = Math.ceil(radius * 3) * 2 + 1;
|
|
75
|
+
const kernel = new Float32Array(kernelSize);
|
|
76
|
+
const sigma = radius / 3;
|
|
77
|
+
const twoSigmaSq = 2 * sigma * sigma;
|
|
78
|
+
const half = kernelSize - 1 >> 1;
|
|
79
|
+
let sum = 0;
|
|
80
|
+
for (let i = 0; i < kernelSize; i++) {
|
|
81
|
+
const x = i - half;
|
|
82
|
+
const value = Math.exp(-(x * x) / twoSigmaSq);
|
|
83
|
+
kernel[i] = value;
|
|
84
|
+
sum += value;
|
|
85
|
+
}
|
|
86
|
+
const invSum = 1 / sum;
|
|
87
|
+
for (let i = 0; i < kernelSize; i++) kernel[i] *= invSum;
|
|
88
|
+
const wrapX = wrapEdges ? (coord) => (coord % width + width) % width : (coord) => coord < 0 ? 0 : coord >= width ? width - 1 : coord;
|
|
89
|
+
const wrapY = wrapEdges ? (coord) => (coord % height + height) % height : (coord) => coord < 0 ? 0 : coord >= height ? height - 1 : coord;
|
|
90
|
+
for (let c = 0; c < source.channelCount; c++) {
|
|
91
|
+
const src = source.channels[c];
|
|
92
|
+
const dst = result.channels[c];
|
|
93
|
+
const temp = new Float32Array(width * height);
|
|
94
|
+
for (let y = 0; y < height; y++) {
|
|
95
|
+
const row = y * width;
|
|
96
|
+
for (let x = 0; x < width; x++) {
|
|
97
|
+
let acc = 0;
|
|
98
|
+
for (let k = 0; k < kernelSize; k++) acc += src[row + wrapX(x + k - half)] * kernel[k];
|
|
99
|
+
temp[row + x] = acc;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
for (let x = 0; x < width; x++) {
|
|
103
|
+
for (let y = 0; y < height; y++) {
|
|
104
|
+
let acc = 0;
|
|
105
|
+
for (let k = 0; k < kernelSize; k++) acc += temp[wrapY(y + k - half) * width + x] * kernel[k];
|
|
106
|
+
dst[y * width + x] = acc;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
return result;
|
|
111
|
+
}
|
|
112
|
+
async function executeBlur(context) {
|
|
113
|
+
const source = await readPlanar(context, context.inputs.image);
|
|
114
|
+
if (!source) return;
|
|
115
|
+
const { method, radius, wrapEdges } = context.props;
|
|
116
|
+
await output(context, method === "gaussian" ? gaussianBlur(source, radius, wrapEdges) : boxBlur(source, radius, wrapEdges));
|
|
117
|
+
}
|
|
118
|
+
async function executeNormalMap(context) {
|
|
119
|
+
const source = await readPlanar(context, context.inputs.image);
|
|
120
|
+
if (!source) return;
|
|
121
|
+
const { scale, flipX, flipY } = context.props;
|
|
122
|
+
const { width, height } = source;
|
|
123
|
+
const result = Planar.rgba(width, height);
|
|
124
|
+
const heightMap = source.channels[0];
|
|
125
|
+
const [rOut, gOut, bOut, aOut] = result.channels;
|
|
126
|
+
for (let y = 0; y < height; y++) {
|
|
127
|
+
for (let x = 0; x < width; x++) {
|
|
128
|
+
const idx = y * width + x;
|
|
129
|
+
const h00 = heightMap[idx];
|
|
130
|
+
const h10 = heightMap[Math.min(x + 1, width - 1) + y * width];
|
|
131
|
+
const h01 = heightMap[x + Math.min(y + 1, height - 1) * width];
|
|
132
|
+
const dx = (h10 - h00) * scale;
|
|
133
|
+
const dy = (h01 - h00) * scale;
|
|
134
|
+
const nx = -(flipX ? -dx : dx);
|
|
135
|
+
const ny = -(flipY ? -dy : dy);
|
|
136
|
+
const nz = 1;
|
|
137
|
+
const length = Math.sqrt(nx * nx + ny * ny + nz * nz);
|
|
138
|
+
rOut[idx] = nx / length * 0.5 + 0.5;
|
|
139
|
+
gOut[idx] = ny / length * 0.5 + 0.5;
|
|
140
|
+
bOut[idx] = nz / length * 0.5 + 0.5;
|
|
141
|
+
aOut[idx] = 1;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
await output(context, result);
|
|
145
|
+
}
|
|
146
|
+
async function executeResize(context) {
|
|
147
|
+
const source = await readPlanar(context, context.inputs.image);
|
|
148
|
+
if (!source) return;
|
|
149
|
+
const { props } = context;
|
|
150
|
+
const scaled = props.mode === "scale";
|
|
151
|
+
const width = scaled ? Math.round(source.width * props.scale) : props.width;
|
|
152
|
+
const height = scaled ? Math.round(source.height * props.scale) : props.height;
|
|
153
|
+
await output(context, resample(source, width, height));
|
|
154
|
+
}
|
|
155
|
+
function pivotPoint(pivot, custom, width, height) {
|
|
156
|
+
switch (pivot) {
|
|
157
|
+
case "top-left":
|
|
158
|
+
return [0, 0];
|
|
159
|
+
case "top-right":
|
|
160
|
+
return [width, 0];
|
|
161
|
+
case "bottom-left":
|
|
162
|
+
return [0, height];
|
|
163
|
+
case "bottom-right":
|
|
164
|
+
return [width, height];
|
|
165
|
+
case "custom":
|
|
166
|
+
return [custom[0] * width, custom[1] * height];
|
|
167
|
+
default:
|
|
168
|
+
return [width / 2, height / 2];
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
function wrapCoord(coord, size, mode) {
|
|
172
|
+
if (mode === "clamp") return Math.max(0, Math.min(size - 1, coord));
|
|
173
|
+
if (mode === "repeat") {
|
|
174
|
+
coord = coord % size;
|
|
175
|
+
if (coord < 0) coord += size;
|
|
176
|
+
return coord;
|
|
177
|
+
}
|
|
178
|
+
if (mode === "mirror") {
|
|
179
|
+
const period = size * 2;
|
|
180
|
+
coord = Math.abs(coord % period);
|
|
181
|
+
if (coord >= size) coord = period - coord - 1;
|
|
182
|
+
return Math.max(0, Math.min(size - 1, coord));
|
|
183
|
+
}
|
|
184
|
+
return coord;
|
|
185
|
+
}
|
|
186
|
+
async function executeTransform(context) {
|
|
187
|
+
const input = await readPlanar(context, context.inputs.image);
|
|
188
|
+
if (!input) return;
|
|
189
|
+
const { props } = context;
|
|
190
|
+
const { width, height } = input;
|
|
191
|
+
const [tx, ty] = props.translate;
|
|
192
|
+
const rotation = props.rotation * Math.PI / 180;
|
|
193
|
+
const sx = props.scale[0];
|
|
194
|
+
const sy = props.uniformScale ? sx : props.scale[1];
|
|
195
|
+
const [pivotX, pivotY] = pivotPoint(props.pivot, props.customPivot, width, height);
|
|
196
|
+
const cosR = Math.cos(-rotation);
|
|
197
|
+
const sinR = Math.sin(-rotation);
|
|
198
|
+
const invSx = 1 / sx;
|
|
199
|
+
const invSy = 1 / sy;
|
|
200
|
+
const buffer = Planar.rgba(width, height);
|
|
201
|
+
const channelCount = Math.min(input.channelCount, 4);
|
|
202
|
+
const nearest = props.filter === "nearest";
|
|
203
|
+
const wrap = props.wrap;
|
|
204
|
+
for (let y = 0; y < height; y++) {
|
|
205
|
+
for (let x = 0; x < width; x++) {
|
|
206
|
+
const idx = y * width + x;
|
|
207
|
+
const dx = x - pivotX - tx;
|
|
208
|
+
const dy = y - pivotY - ty;
|
|
209
|
+
const srcX = (dx * cosR - dy * sinR) * invSx + pivotX;
|
|
210
|
+
const srcY = (dx * sinR + dy * cosR) * invSy + pivotY;
|
|
211
|
+
if (wrap === "transparent" && (srcX < 0 || srcX >= width || srcY < 0 || srcY >= height)) {
|
|
212
|
+
for (let c = 0; c < 4; c++) buffer.channels[c][idx] = 0;
|
|
213
|
+
continue;
|
|
214
|
+
}
|
|
215
|
+
if (nearest) {
|
|
216
|
+
const srcIdx = wrapCoord(Math.round(srcY), height, wrap) * width + wrapCoord(Math.round(srcX), width, wrap);
|
|
217
|
+
for (let c = 0; c < channelCount; c++) buffer.channels[c][idx] = input.channels[c][srcIdx];
|
|
218
|
+
} else {
|
|
219
|
+
const x0 = Math.floor(srcX);
|
|
220
|
+
const y0 = Math.floor(srcY);
|
|
221
|
+
const fx = srcX - x0;
|
|
222
|
+
const fy = srcY - y0;
|
|
223
|
+
const wx0 = wrapCoord(x0, width, wrap);
|
|
224
|
+
const wx1 = wrapCoord(x0 + 1, width, wrap);
|
|
225
|
+
const wy0 = wrapCoord(y0, height, wrap);
|
|
226
|
+
const wy1 = wrapCoord(y0 + 1, height, wrap);
|
|
227
|
+
for (let c = 0; c < channelCount; c++) {
|
|
228
|
+
const channel = input.channels[c];
|
|
229
|
+
const v00 = channel[wy0 * width + wx0];
|
|
230
|
+
const v10 = channel[wy0 * width + wx1];
|
|
231
|
+
const v01 = channel[wy1 * width + wx0];
|
|
232
|
+
const v11 = channel[wy1 * width + wx1];
|
|
233
|
+
const v0 = v00 + (v10 - v00) * fx;
|
|
234
|
+
const v1 = v01 + (v11 - v01) * fx;
|
|
235
|
+
buffer.channels[c][idx] = v0 + (v1 - v0) * fy;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
if (channelCount < 4) buffer.channels[3][idx] = 1;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
await output(context, buffer);
|
|
242
|
+
}
|
|
243
|
+
function blend(base, layer, mode, opacity) {
|
|
244
|
+
const { width, height } = base;
|
|
245
|
+
const result = Planar.rgba(width, height);
|
|
246
|
+
const [r1, g1, b1, a1] = (base.channelCount >= 4 ? base : base.toRGBA()).channels;
|
|
247
|
+
const [r2, g2, b2, a2] = (layer.channelCount >= 4 ? layer : layer.toRGBA()).channels;
|
|
248
|
+
const [rOut, gOut, bOut, aOut] = result.channels;
|
|
249
|
+
for (let i = 0; i < width * height; i++) {
|
|
250
|
+
const baseR = r1[i], baseG = g1[i], baseB = b1[i], baseA = a1[i];
|
|
251
|
+
const blendR = r2[i], blendG = g2[i], blendB = b2[i], blendA = a2[i];
|
|
252
|
+
let r, g, b;
|
|
253
|
+
switch (mode) {
|
|
254
|
+
case "normal":
|
|
255
|
+
r = blendR;
|
|
256
|
+
g = blendG;
|
|
257
|
+
b = blendB;
|
|
258
|
+
break;
|
|
259
|
+
case "multiply":
|
|
260
|
+
r = baseR * blendR;
|
|
261
|
+
g = baseG * blendG;
|
|
262
|
+
b = baseB * blendB;
|
|
263
|
+
break;
|
|
264
|
+
case "screen":
|
|
265
|
+
r = 1 - (1 - baseR) * (1 - blendR);
|
|
266
|
+
g = 1 - (1 - baseG) * (1 - blendG);
|
|
267
|
+
b = 1 - (1 - baseB) * (1 - blendB);
|
|
268
|
+
break;
|
|
269
|
+
case "overlay":
|
|
270
|
+
r = baseR < 0.5 ? 2 * baseR * blendR : 1 - 2 * (1 - baseR) * (1 - blendR);
|
|
271
|
+
g = baseG < 0.5 ? 2 * baseG * blendG : 1 - 2 * (1 - baseG) * (1 - blendG);
|
|
272
|
+
b = baseB < 0.5 ? 2 * baseB * blendB : 1 - 2 * (1 - baseB) * (1 - blendB);
|
|
273
|
+
break;
|
|
274
|
+
case "darken":
|
|
275
|
+
r = Math.min(baseR, blendR);
|
|
276
|
+
g = Math.min(baseG, blendG);
|
|
277
|
+
b = Math.min(baseB, blendB);
|
|
278
|
+
break;
|
|
279
|
+
case "lighten":
|
|
280
|
+
r = Math.max(baseR, blendR);
|
|
281
|
+
g = Math.max(baseG, blendG);
|
|
282
|
+
b = Math.max(baseB, blendB);
|
|
283
|
+
break;
|
|
284
|
+
case "color-dodge":
|
|
285
|
+
r = blendR === 1 ? 1 : Math.min(1, baseR / (1 - blendR));
|
|
286
|
+
g = blendG === 1 ? 1 : Math.min(1, baseG / (1 - blendG));
|
|
287
|
+
b = blendB === 1 ? 1 : Math.min(1, baseB / (1 - blendB));
|
|
288
|
+
break;
|
|
289
|
+
case "color-burn":
|
|
290
|
+
r = blendR === 0 ? 0 : Math.max(0, 1 - (1 - baseR) / blendR);
|
|
291
|
+
g = blendG === 0 ? 0 : Math.max(0, 1 - (1 - baseG) / blendG);
|
|
292
|
+
b = blendB === 0 ? 0 : Math.max(0, 1 - (1 - baseB) / blendB);
|
|
293
|
+
break;
|
|
294
|
+
case "hard-light":
|
|
295
|
+
r = blendR < 0.5 ? 2 * baseR * blendR : 1 - 2 * (1 - baseR) * (1 - blendR);
|
|
296
|
+
g = blendG < 0.5 ? 2 * baseG * blendG : 1 - 2 * (1 - baseG) * (1 - blendG);
|
|
297
|
+
b = blendB < 0.5 ? 2 * baseB * blendB : 1 - 2 * (1 - baseB) * (1 - blendB);
|
|
298
|
+
break;
|
|
299
|
+
case "soft-light":
|
|
300
|
+
r = blendR < 0.5 ? baseR - (1 - 2 * blendR) * baseR * (1 - baseR) : baseR + (2 * blendR - 1) * (Math.sqrt(baseR) - baseR);
|
|
301
|
+
g = blendG < 0.5 ? baseG - (1 - 2 * blendG) * baseG * (1 - baseG) : baseG + (2 * blendG - 1) * (Math.sqrt(baseG) - baseG);
|
|
302
|
+
b = blendB < 0.5 ? baseB - (1 - 2 * blendB) * baseB * (1 - baseB) : baseB + (2 * blendB - 1) * (Math.sqrt(baseB) - baseB);
|
|
303
|
+
break;
|
|
304
|
+
case "difference":
|
|
305
|
+
r = Math.abs(baseR - blendR);
|
|
306
|
+
g = Math.abs(baseG - blendG);
|
|
307
|
+
b = Math.abs(baseB - blendB);
|
|
308
|
+
break;
|
|
309
|
+
case "exclusion":
|
|
310
|
+
r = baseR + blendR - 2 * baseR * blendR;
|
|
311
|
+
g = baseG + blendG - 2 * baseG * blendG;
|
|
312
|
+
b = baseB + blendB - 2 * baseB * blendB;
|
|
313
|
+
break;
|
|
314
|
+
case "add":
|
|
315
|
+
case "linear-dodge":
|
|
316
|
+
r = Math.min(1, baseR + blendR);
|
|
317
|
+
g = Math.min(1, baseG + blendG);
|
|
318
|
+
b = Math.min(1, baseB + blendB);
|
|
319
|
+
break;
|
|
320
|
+
case "subtract":
|
|
321
|
+
r = Math.max(0, baseR - blendR);
|
|
322
|
+
g = Math.max(0, baseG - blendG);
|
|
323
|
+
b = Math.max(0, baseB - blendB);
|
|
324
|
+
break;
|
|
325
|
+
case "divide":
|
|
326
|
+
r = blendR === 0 ? 1 : Math.min(1, baseR / blendR);
|
|
327
|
+
g = blendG === 0 ? 1 : Math.min(1, baseG / blendG);
|
|
328
|
+
b = blendB === 0 ? 1 : Math.min(1, baseB / blendB);
|
|
329
|
+
break;
|
|
330
|
+
case "pin-light":
|
|
331
|
+
r = blendR < 0.5 ? Math.min(baseR, 2 * blendR) : Math.max(baseR, 2 * (blendR - 0.5));
|
|
332
|
+
g = blendG < 0.5 ? Math.min(baseG, 2 * blendG) : Math.max(baseG, 2 * (blendG - 0.5));
|
|
333
|
+
b = blendB < 0.5 ? Math.min(baseB, 2 * blendB) : Math.max(baseB, 2 * (blendB - 0.5));
|
|
334
|
+
break;
|
|
335
|
+
case "vivid-light":
|
|
336
|
+
r = blendR < 0.5 ? blendR === 0 ? 0 : 1 - (1 - baseR) / (2 * blendR) : blendR === 1 ? 1 : baseR / (2 * (1 - blendR));
|
|
337
|
+
g = blendG < 0.5 ? blendG === 0 ? 0 : 1 - (1 - baseG) / (2 * blendG) : blendG === 1 ? 1 : baseG / (2 * (1 - blendG));
|
|
338
|
+
b = blendB < 0.5 ? blendB === 0 ? 0 : 1 - (1 - baseB) / (2 * blendB) : blendB === 1 ? 1 : baseB / (2 * (1 - blendB));
|
|
339
|
+
break;
|
|
340
|
+
case "linear-burn":
|
|
341
|
+
r = Math.max(0, baseR + blendR - 1);
|
|
342
|
+
g = Math.max(0, baseG + blendG - 1);
|
|
343
|
+
b = Math.max(0, baseB + blendB - 1);
|
|
344
|
+
break;
|
|
345
|
+
default:
|
|
346
|
+
r = blendR;
|
|
347
|
+
g = blendG;
|
|
348
|
+
b = blendB;
|
|
349
|
+
}
|
|
350
|
+
rOut[i] = baseR + (r - baseR) * opacity * blendA;
|
|
351
|
+
gOut[i] = baseG + (g - baseG) * opacity * blendA;
|
|
352
|
+
bOut[i] = baseB + (b - baseB) * opacity * blendA;
|
|
353
|
+
aOut[i] = baseA + (blendA - baseA) * opacity;
|
|
354
|
+
}
|
|
355
|
+
return result;
|
|
356
|
+
}
|
|
357
|
+
async function executeComposite(context) {
|
|
358
|
+
const { props } = context;
|
|
359
|
+
const inputs = [await readPlanar(context, context.inputs.image1), await readPlanar(context, context.inputs.image2)];
|
|
360
|
+
const { width, height } = resolveOutputSize(
|
|
361
|
+
props.outputResolution,
|
|
362
|
+
inputs,
|
|
363
|
+
props.customResolution
|
|
364
|
+
);
|
|
365
|
+
const [base, layer] = inputs.map((buffer) => {
|
|
366
|
+
if (!buffer || buffer.width === width && buffer.height === height) return buffer;
|
|
367
|
+
return resizeToFit(buffer, width, height, props.fitMode);
|
|
368
|
+
});
|
|
369
|
+
if (!base || !layer) return;
|
|
370
|
+
await output(context, blend(base, layer, props.blendMode, props.opacity));
|
|
371
|
+
}
|
|
372
|
+
export {
|
|
373
|
+
executeBlur,
|
|
374
|
+
executeComposite,
|
|
375
|
+
executeNormalMap,
|
|
376
|
+
executeResize,
|
|
377
|
+
executeTransform
|
|
378
|
+
};
|
|
379
|
+
//# sourceMappingURL=filters-6ODFWYK4.js.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cookUntilSettled,
|
|
3
|
+
outputPorts,
|
|
4
|
+
parseFrameSpec,
|
|
5
|
+
renderFrameRange
|
|
6
|
+
} from "./chunk-BP7UKF36.js";
|
|
7
|
+
import "./chunk-RUU3YWXU.js";
|
|
8
|
+
import "./chunk-ICH7N5PN.js";
|
|
9
|
+
import "./chunk-CO22XHNG.js";
|
|
10
|
+
export {
|
|
11
|
+
cookUntilSettled,
|
|
12
|
+
outputPorts,
|
|
13
|
+
parseFrameSpec,
|
|
14
|
+
renderFrameRange
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=frames-LSAUBZ7P.js.map
|