One-click character swap for videos: an open-source, local Higgsfield Genjutsu alternative built on ComfyUI and MiniMax H3, with FLUX.3 Klein relighting.
Add Openjutsu simple motion transfer app
D3voz21aeaa8a506b
diff --git a/.env.example b/.env.examplenew file mode 100644index 0000000..1cdc22d--- /dev/null+++ b/.env.example@@ -0,0 +1,4 @@+# Local ComfyUI behind comfy-api-proxy (no key needed).+COMFY_BASE_URL=http://127.0.0.1:8189+# Only for a Comfy Developer Platform deployment or Comfy Cloud.+COMFY_API_KEY=diff --git a/.gitattributes b/.gitattributesnew file mode 100644index 0000000..6313b56--- /dev/null+++ b/.gitattributes@@ -0,0 +1 @@+* text=auto eol=lfdiff --git a/.gitignore b/.gitignorenew file mode 100644index 0000000..a9a252b--- /dev/null+++ b/.gitignore@@ -0,0 +1,9 @@+.env.local+.DS_Store+node_modules+.next+.venv-proxy+*.tsbuildinfo+AGENTS.md+CLAUDE.md+public/_testdiff --git a/LICENSE b/LICENSEnew file mode 100644index 0000000..ba75aad--- /dev/null+++ b/LICENSE@@ -0,0 +1,21 @@+MIT License++Copyright (c) 2026 D3voz++Permission is hereby granted, free of charge, to any person obtaining a copy+of this software and associated documentation files (the "Software"), to deal+in the Software without restriction, including without limitation the rights+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell+copies of the Software, and to permit persons to whom the Software is+furnished to do so, subject to the following conditions:++The above copyright notice and this permission notice shall be included in all+copies or substantial portions of the Software.++THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE+SOFTWARE.diff --git a/README.md b/README.mdnew file mode 100644index 0000000..7de0e25--- /dev/null+++ b/README.md@@ -0,0 +1,116 @@+# Openjutsu++An open-source, Genjutsu-style character swap for video. Drop a video and 1–4 character photos, press **Generate**, and every person in the video is replaced by your characters. The camera, cuts, motion and soundtrack stay. Everything runs on open weights on your own GPU: MiniMax H3 for the video, SAM 3.1 to track people, and Qwen3-VL 8B to describe the pictures and shots.++The app is a small Next.js front end over a ComfyUI workflow. It uses [`@comfyorg/sdk`](https://www.npmjs.com/package/@comfyorg/sdk), following Comfy's [comfy-reshoot](https://github.com/Comfy-Org/comfy-reshoot) reference app.++## Modes++- **Simple motion transfer**: available. Runs `workflows/simple.api.json`.+- **Advanced motion transfer** (pick who becomes who with role-coloured tracks) and **Object swap**: coming soon, as separate workflow files.++## Requirements++- An NVIDIA GPU. Tested on an RTX 4060 Ti 16 GB with 64 GB of system RAM; the H3 int8 models stream from RAM.+- [ComfyUI](https://github.com/comfyanonymous/ComfyUI) 0.41.2 or newer. Core provides MiniMax H3, SAM 3.1 and TextGenerate.+- Node.js 22.6 or newer, and Python for `comfy-api-proxy`.++### Custom nodes++Install these into `ComfyUI/custom_nodes` (ComfyUI Manager finds the first three by name):++| Pack | Used for |+| --- | --- |+| [ComfyUI-MiniMaxH3-Context-Loop](https://github.com/ethanfel/ComfyUI-MiniMaxH3-Context-Loop) 0.7.3+ | clip loop, checkpoints, final assembly |+| [ComfyUI-Fantastic-MiniMaxH3-PromptBuilder](https://github.com/Adudeguyman/ComfyUI-Fantastic-MiniMaxH3-PromptBuilder) | masked video-edit latent |+| [ComfyUI-KJNodes](https://github.com/kijai/ComfyUI-KJNodes) | Grow Mask With Blur |+| [ComfyUI-VideoHelperSuite](https://github.com/Kosinkadink/ComfyUI-VideoHelperSuite) | video loading |+| `comfyui-h3-oneclick-swap` | swap plan, people mask, grey mannequins, cut finder, shot list (TODO: link the published pack) |++Restart ComfyUI after installing them.++### Models++| Folder in `ComfyUI/models` | File |+| --- | --- |+| `diffusion_models` | `minimax_h3_ref2va_pruned_int8_convrot.safetensors` |+| `loras` | `minimax_h3_DMAD_4step_full_lora_avg_rank_39_bf16.safetensors` |+| `text_encoders` | `qwen3vl_32b_minimax_h3_int4_convrot.safetensors` (H3 text encoder) |+| `text_encoders` | `qwen3vl_8b_int8_convrot.safetensors` (describer) |+| `vae` | `minimax_h3_video_vae_int8_convrot.safetensors`, `minimax_h3_audio_vae_fp32.safetensors` |+| `checkpoints` | `sam3.1_multiplex_fp16.safetensors` |++## Run it locally++1. Start ComfyUI on `127.0.0.1:8188`. On Windows, set `AIOHTTP_NOSENDFILE=1` first (PowerShell: `$env:AIOHTTP_NOSENDFILE = "1"`). Without it, the first partial-file request (the video player sends one when you seek) can stall ComfyUI's `/view`, and every later file download hangs until ComfyUI restarts.+2. Install and start the proxy, which serves the Comfy API v2 on `127.0.0.1:8189`. Raise the upload cap for longer videos (the default is 100 MB):++ ```sh+ pip install comfy-api-proxy+ comfy-api-proxy run --max-upload-mb 500+ ```++3. Install and start the app:++ ```sh+ git clone <this repo> openjutsu+ cd openjutsu+ cp .env.example .env.local+ npm ci+ npm run dev+ ```++4. Open <http://127.0.0.1:3000>.++`.env.local` sets `COMFY_BASE_URL=http://127.0.0.1:8189`. Leave `COMFY_API_KEY` empty for a local proxy.++A 6 s clip at 480p takes about 6–13 minutes on a 4060 Ti, most of it in H3 sampling. 736p is the default; 1080p is about 2.5× slower than 736p and needs much more memory.++## Tips++- One photo per person in the video. Every person SAM finds is regenerated.+- **Replaces who?** names a role or position (`the singer`, `the drummer`, `the person on the left`), never clothes: clothing words leak into the result. Leave all of them blank to match pictures to people by screen time.+- **Hat fix** also masks hats, so they are replaced too (about 45 s more per clip).+- Change the **seed** (under Advanced) for a new take. Running the same inputs again resumes from the last finished clip.++## How it works++`workflows/simple.api.json` is one API export of the ComfyUI workflow with all four picture branches and the hat fix enabled. For each request, `lib/simple.ts`:++- removes the picture branches (Load Image → Shrink → Describe) for unused pictures, and their links into the Swap Plan (`picture_k`, `picture_k_text`) and Reference Conditioning (`ref_images.ref_image_k`);+- without the hat fix, removes the hat nodes and connects Grow Mask to the People Mask output;+- sets the Swap Plan's resolution, seed, clip length and roles (one line per picture).++`lib/comfy.ts` binds the uploaded video to `VHS_LoadVideo` and the photos to the `LoadImage` nodes, then submits with the SDK. `/api/jobs/[id]/events` streams `job.events()` to the page as server-sent events. Node ids are turned into node titles and clip numbers there: each clip after the first is a graph expansion whose node ids carry a prefix per clip (`64`, `70.0.0.64`, `70.0.0.Recurse.0.0.64`). The final MP4 is the output of the Final Video node (`MiniMaxH3ChainAssemble`, node `71`).++To change the workflow, open it in ComfyUI, enable every picture group and the hat-fix group, export **Workflow (API)**, and replace `workflows/simple.api.json`. If node ids change, update `NODES` in `lib/simple.ts`. `npm test` checks the pruning against the export.++## Deploy on the Comfy Developer Platform++Not tested yet. The app code does not change, only `.env.local`:++1. Package the prepared ComfyUI install (with the custom nodes and models above) as a Build, and deploy it:++ ```sh+ pip install comfy-cli+ comfy setup --where cloud+ cd /path/to/ComfyUI+ comfy build init --name openjutsu --models-dir ./models --custom-nodes-dir ./custom_nodes+ comfy build status+ comfy build push --release --target linux/nvidia+ comfy deploy refs compute+ ```++2. Create a deployment from the released Build on the Developer Platform. The workflow has only been run on a 16 GB card with 64 GB of system RAM, so choose at least that.+3. Set `COMFY_BASE_URL` to the deployment URL and `COMFY_API_KEY` to a key from the workspace that owns it. The key stays on the server; never put it in a `NEXT_PUBLIC_` variable.+4. Host the Next.js app anywhere that runs Node (`npm run build && npm start`). Streaming progress needs a host that keeps long responses open.++Notes:++- Resuming relies on clip checkpoints in ComfyUI's `output/` folder, which a fresh serverless worker does not have.+- A job runs for many minutes; check the deployment's request time limit.+- Stop or delete the deployment when you finish, to end GPU charges.++## License++MIT, see [`LICENSE`](LICENSE). Model licences are separate.diff --git a/app/api/jobs/[id]/events/route.ts b/app/api/jobs/[id]/events/route.tsnew file mode 100644index 0000000..701fafd--- /dev/null+++ b/app/api/jobs/[id]/events/route.ts@@ -0,0 +1,44 @@+import { getJob, loadSimpleGraph, publicJob, rawJobEvents, TERMINAL } from "../../../../../lib/comfy.ts";+import { nodeDescriber } from "../../../../../lib/progress.ts";++export const runtime = "nodejs";+export const dynamic = "force-dynamic";++// Server-sent events for the progress view, with node ids turned into node titles and clip+// numbers. One upstream connection per request; the page's EventSource reconnects.+export async function GET(request: Request, { params }: { params: Promise<{ id: string }> }) {+ const { id } = await params;+ const describe = nodeDescriber(await loadSimpleGraph());+ const encoder = new TextEncoder();++ const stream = new ReadableStream({+ async start(controller) {+ const send = (data: unknown) => controller.enqueue(encoder.encode(`data: ${JSON.stringify(data)}\n\n`));+ try {+ const job = await getJob(id);+ controller.enqueue(encoder.encode("retry: 2000\n\n"));+ send({ type: "job", job: publicJob(job) });+ if (!TERMINAL.has(job.status)) {+ for await (const { event, data } of rawJobEvents(job, request.signal)) {+ if (event === "progress") {+ send({ type: "progress", node: describe(typeof data.current_node === "string" ? data.current_node : null), step: data.step ?? null, steps: data.steps ?? null });+ } else if (event === "status") {+ send({ type: "status", status: data.status, queuePosition: data.queue_position ?? null });+ if (TERMINAL.has(String(data.status))) break;+ } else if (event === "output" && String(data.content_type).startsWith("image/")) {+ send({ type: "preview", url: `/api/jobs/${id}/outputs/${data.id}` });+ }+ }+ send({ type: "job", job: publicJob(await job.refresh()) });+ }+ } catch (error) {+ if (!request.signal.aborted) send({ type: "error", message: error instanceof Error ? error.message : "Lost the job stream." });+ }+ if (!request.signal.aborted) controller.close();+ },+ });++ return new Response(stream, {+ headers: { "Content-Type": "text/event-stream", "Cache-Control": "no-cache, no-transform", Connection: "keep-alive" },+ });+}diff --git a/app/api/jobs/[id]/outputs/[outputId]/route.ts b/app/api/jobs/[id]/outputs/[outputId]/route.tsnew file mode 100644index 0000000..40ae504--- /dev/null+++ b/app/api/jobs/[id]/outputs/[outputId]/route.ts@@ -0,0 +1,21 @@+import { getOutput } from "../../../../../../lib/comfy.ts";++export const runtime = "nodejs";++export async function GET(request: Request, { params }: { params: Promise<{ id: string; outputId: string }> }) {+ try {+ const { id, outputId } = await params;+ const { name, response } = await getOutput(id, outputId, request.headers.get("Range"));+ if (!response.ok || !response.body) return Response.json({ error: "The output is not ready." }, { status: 502 });++ const headers = new Headers({ "Cache-Control": "private, max-age=300" });+ for (const header of ["Content-Type", "Content-Length", "Content-Range", "Accept-Ranges"]) {+ const value = response.headers.get(header);+ if (value) headers.set(header, value);+ }+ if (new URL(request.url).searchParams.has("download")) headers.set("Content-Disposition", `attachment; filename="${name.replace(/"/g, "")}"`);+ return new Response(response.body, { status: response.status, headers });+ } catch (error) {+ return Response.json({ error: error instanceof Error ? error.message : "Unable to download the output." }, { status: 502 });+ }+}diff --git a/app/api/jobs/[id]/route.ts b/app/api/jobs/[id]/route.tsnew file mode 100644index 0000000..64959f4--- /dev/null+++ b/app/api/jobs/[id]/route.ts@@ -0,0 +1,23 @@+import { NextResponse } from "next/server";+import { getJob, publicJob } from "../../../../lib/comfy.ts";++export const runtime = "nodejs";++export async function GET(_: Request, { params }: { params: Promise<{ id: string }> }) {+ try {+ const { id } = await params;+ return NextResponse.json(publicJob(await getJob(id)));+ } catch (error) {+ return NextResponse.json({ error: error instanceof Error ? error.message : "Unable to check the job." }, { status: 502 });+ }+}++export async function DELETE(_: Request, { params }: { params: Promise<{ id: string }> }) {+ try {+ const { id } = await params;+ const job = await getJob(id);+ return NextResponse.json(publicJob(await job.cancel()));+ } catch (error) {+ return NextResponse.json({ error: error instanceof Error ? error.message : "Unable to cancel the job." }, { status: 502 });+ }+}diff --git a/app/api/jobs/route.ts b/app/api/jobs/route.tsnew file mode 100644index 0000000..a80d7d0--- /dev/null+++ b/app/api/jobs/route.ts@@ -0,0 +1,51 @@+import { NextResponse } from "next/server";+import { submitSimple } from "../../../lib/comfy.ts";+import { CLIP_SECONDS, MAX_PICTURES, MAX_SEED, RESOLUTIONS, type Resolution, type SimpleSettings } from "../../../lib/simple.ts";++export const runtime = "nodejs";++function parse(form: FormData) {+ if (form.get("mode") !== "simple") throw new Error("Only Simple motion transfer is available so far.");++ const video = form.get("video");+ if (!(video instanceof File) || video.size === 0) throw new Error("Drop a source video.");+ if (!video.type.startsWith("video/") && !/\.(mp4|mov|mkv|webm|avi)$/i.test(video.name)) throw new Error("The source must be a video file.");++ const pictures: File[] = [];+ const roles: string[] = [];+ for (let i = 1; i <= MAX_PICTURES; i++) {+ const picture = form.get(`picture_${i}`);+ if (!(picture instanceof File) || picture.size === 0) break;+ if (!picture.type.startsWith("image/")) throw new Error(`Character ${i} must be an image.`);+ pictures.push(picture);+ roles.push(String(form.get(`role_${i}`) ?? "").slice(0, 200));+ }+ if (!pictures.length) throw new Error("Add at least one character photo.");++ const resolution = String(form.get("resolution"));+ if (!RESOLUTIONS.includes(resolution as Resolution)) throw new Error("Choose a supported resolution.");+ const seed = Number(form.get("seed"));+ if (!Number.isInteger(seed) || seed < 0 || seed > MAX_SEED) throw new Error(`Seed must be a whole number from 0 to ${MAX_SEED}.`);+ const clipSeconds = Number(form.get("clip_seconds"));+ if (!(clipSeconds >= CLIP_SECONDS.min && clipSeconds <= CLIP_SECONDS.max)) {+ throw new Error(`Clip length must be ${CLIP_SECONDS.min}-${CLIP_SECONDS.max} s.`);+ }++ const settings: SimpleSettings = { roles, resolution: resolution as Resolution, hatFix: form.get("hat_fix") === "true", seed, clipSeconds };+ return { video, pictures, settings };+}++export async function POST(request: Request) {+ let input: ReturnType<typeof parse>;+ try {+ input = parse(await request.formData());+ } catch (error) {+ return NextResponse.json({ error: error instanceof Error ? error.message : "Invalid request." }, { status: 400 });+ }++ try {+ return NextResponse.json(await submitSimple(input.video, input.pictures, input.settings), { status: 202 });+ } catch (error) {+ return NextResponse.json({ error: error instanceof Error ? error.message : "Unable to submit the job." }, { status: 502 });+ }+}diff --git a/app/globals.css b/app/globals.cssnew file mode 100644index 0000000..dfac909--- /dev/null+++ b/app/globals.css@@ -0,0 +1,134 @@+:root {+ --bg: #0d0d10;+ --panel: #16161b;+ --panel-2: #1e1e25;+ --line: #2a2a33;+ --text: #ececf1;+ --muted: #9a9aa8;+ --accent: #d6ff3f;+ --accent-ink: #12140a;+ --danger: #ff6b6b;+ color-scheme: dark;+}++* { box-sizing: border-box; }++body {+ margin: 0;+ background: radial-gradient(1200px 600px at 80% -10%, #23261a 0%, transparent 60%), var(--bg);+ color: var(--text);+ font: 15px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;+ min-height: 100vh;+}++button, input { font: inherit; color: inherit; }+button { cursor: pointer; }+button:disabled { cursor: not-allowed; }+small { color: var(--muted); font-size: 0.82em; }++.shell { max-width: 1080px; margin: 0 auto; padding: 32px 16px 64px; display: grid; gap: 20px; }++.top .brand { display: flex; gap: 14px; align-items: center; }+.mark {+ width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center;+ background: var(--accent); color: var(--accent-ink); font-size: 26px; font-weight: 700;+}+h1 { margin: 0; font-size: 28px; letter-spacing: -0.02em; }+.top p { margin: 0; color: var(--muted); }++.modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }+.mode {+ text-align: left; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--line);+ background: var(--panel); display: grid; gap: 2px; align-content: start;+}+.mode span { color: var(--muted); font-size: 0.88em; }+.mode.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }+.mode:disabled { opacity: 0.55; }+.mode em {+ justify-self: start; margin-top: 6px; font-style: normal; font-size: 0.72em; padding: 2px 8px;+ border-radius: 99px; background: var(--panel-2); color: var(--muted);+}++.inputs { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }+.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 18px; display: grid; gap: 14px; align-content: start; }+.panel h2 { margin: 0; font-size: 16px; display: flex; align-items: center; gap: 10px; }+.panel h2 > span {+ width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 13px;+ background: var(--panel-2); color: var(--accent);+}+.panel h2 small { margin-left: auto; font-weight: 400; }+.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }+.hint { margin: 0; color: var(--muted); font-size: 0.86em; }+.error { margin: 0; color: var(--danger); }++.drop {+ border: 1.5px dashed var(--line); border-radius: 14px; display: grid; place-items: center; text-align: center;+ gap: 4px; padding: 20px; cursor: pointer; color: var(--muted); transition: border-color 0.15s, background 0.15s;+}+.drop strong { color: var(--text); }+.drop:hover, .drop.over { border-color: var(--accent); background: #d6ff3f0d; }+.drop.big { min-height: 260px; }+.drop.link { border: 0; padding: 0; color: var(--accent); }+.drop.link:hover { background: none; text-decoration: underline; }++.video-pick { display: grid; gap: 8px; }+video { width: 100%; border-radius: 12px; background: #000; max-height: 420px; }++.characters { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }+.character { position: relative; background: var(--panel-2); border-radius: 14px; overflow: hidden; display: grid; }+.character img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; display: block; }+.character label { display: grid; gap: 4px; padding: 10px; font-size: 0.82em; color: var(--muted); }+.character input, .seed input {+ background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; width: 100%;+}+.character input:focus, .seed input:focus { outline: none; border-color: var(--accent); }+.remove {+ position: absolute; top: 8px; right: 8px; width: 28px; height: 28px; border-radius: 50%; border: 0;+ background: #000a; font-size: 18px; line-height: 1;+}+.drop.add { aspect-ratio: 3 / 4; min-height: 0; }+.drop.add strong { font-size: 32px; font-weight: 300; }++.settings { gap: 12px; }+.setting { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }+.setting > span { display: grid; }+.segmented { display: flex; background: var(--panel-2); border-radius: 10px; padding: 3px; flex-wrap: wrap; }+.segmented button { border: 0; background: none; padding: 6px 12px; border-radius: 8px; color: var(--muted); }+.segmented button.on { background: var(--accent); color: var(--accent-ink); font-weight: 600; }+.toggle { cursor: pointer; }+.toggle input { position: absolute; opacity: 0; pointer-events: none; }+.toggle i { width: 42px; height: 24px; border-radius: 99px; background: var(--panel-2); border: 1px solid var(--line); position: relative; flex: none; }+.toggle i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--muted); transition: transform 0.15s; }+.toggle input:checked + i { background: var(--accent); border-color: var(--accent); }+.toggle input:checked + i::after { transform: translateX(18px); background: var(--accent-ink); }+.toggle input:focus-visible + i { outline: 2px solid var(--accent); outline-offset: 2px; }+details { border-top: 1px solid var(--line); padding-top: 12px; display: grid; gap: 12px; }+details[open] { display: grid; }+summary { cursor: pointer; color: var(--muted); }+details .setting { margin-top: 12px; }+.seed { display: flex; gap: 6px; }+.seed input { width: 150px; }+.seed button { border: 1px solid var(--line); background: var(--panel-2); border-radius: 8px; padding: 0 10px; }+input[type="range"] { accent-color: var(--accent); width: 220px; max-width: 100%; }++.go { display: grid; justify-items: center; gap: 8px; }+.primary {+ background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 12px; padding: 12px 28px;+ font-weight: 700; font-size: 16px; text-decoration: none; display: inline-block;+}+.primary:disabled { opacity: 0.4; }+.go .primary { min-width: 240px; }+.secondary { background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 20px; justify-self: start; }++.progress .time { color: var(--muted); font-variant-numeric: tabular-nums; }+.bar { height: 8px; background: var(--panel-2); border-radius: 99px; overflow: hidden; }+.bar div { height: 100%; background: var(--accent); transition: width 0.4s; min-width: 4px; }+.node { margin: 0; }+.preview { max-width: 100%; max-height: 360px; border-radius: 12px; justify-self: start; }+.result video { max-height: 70vh; }++@media (max-width: 760px) {+ .shell { padding-top: 20px; }+ .modes, .inputs { grid-template-columns: 1fr; }+ .drop.big { min-height: 180px; }+}diff --git a/app/layout.tsx b/app/layout.tsxnew file mode 100644index 0000000..09774bc--- /dev/null+++ b/app/layout.tsx@@ -0,0 +1,15 @@+import type { Metadata } from "next";+import "./globals.css";++export const metadata: Metadata = {+ title: "Openjutsu",+ description: "Open-source character swap for video, powered by ComfyUI and MiniMax H3.",+};++export default function RootLayout({ children }: Readonly<{ children: React.ReactNode }>) {+ return (+ <html lang="en">+ <body>{children}</body>+ </html>+ );+}diff --git a/app/page.tsx b/app/page.tsxnew file mode 100644index 0000000..b7683ce--- /dev/null+++ b/app/page.tsx@@ -0,0 +1,5 @@+import { Openjutsu } from "../components/openjutsu.tsx";++export default function Page() {+ return <Openjutsu />;+}diff --git a/components/openjutsu.tsx b/components/openjutsu.tsxnew file mode 100644index 0000000..2be164e--- /dev/null+++ b/components/openjutsu.tsx@@ -0,0 +1,369 @@+"use client";++import { useEffect, useState, type DragEvent, type ReactNode } from "react";+import type { PublicJob } from "../lib/comfy.ts";+import type { NodeInfo } from "../lib/progress.ts";+import { clipCount } from "../lib/clips.ts";+import { CLIP_SECONDS, MAX_PICTURES, MAX_SEED, RESOLUTIONS, type Resolution } from "../lib/simple.ts";++type Character = { file: File; url: string; role: string };+type Run = { id: string; clips: number; startedAt: number };+type Progress = NodeInfo & { step: number | null; steps: number | null };++const TERMINAL = new Set(["succeeded", "failed", "canceled", "expired"]);+const RUN_KEY = "openjutsu.run";++const MODES = [+ { id: "simple", title: "Simple motion transfer", text: "Swap everyone in a video for your characters.", ready: true },+ { id: "advanced", title: "Advanced motion transfer", text: "Pick who becomes who by colour-coded tracks.", ready: false },+ { id: "object", title: "Object swap", text: "Replace a prop or product instead of a person.", ready: false },+];++function readRun(): Run | null {+ try {+ return JSON.parse(localStorage.getItem(RUN_KEY) ?? "null");+ } catch {+ return null;+ }+}++function writeRun(run: Run | null) {+ try {+ if (run) localStorage.setItem(RUN_KEY, JSON.stringify(run));+ else localStorage.removeItem(RUN_KEY);+ } catch {}+}++function droppedFiles(event: DragEvent, kind: "video" | "image") {+ event.preventDefault();+ return [...event.dataTransfer.files].filter((file) => file.type.startsWith(`${kind}/`) || (kind === "video" && /\.(mkv|mov|avi)$/i.test(file.name)));+}++function elapsed(ms: number) {+ const s = Math.max(0, Math.floor(ms / 1000));+ return `${Math.floor(s / 60)}:${String(s % 60).padStart(2, "0")}`;+}++// Rough share of a clip done at each node: the sampler is most of the time.+function clipShare(progress: Progress) {+ if (progress.classType === "SamplerCustomAdvanced") return 0.15 + 0.75 * (progress.steps ? (progress.step ?? 0) / progress.steps : 0);+ if (["VAEDecode", "VAEDecodeAudio", "MiniMaxH3LoopTrim", "MiniMaxH3ChainSegmentSave", "MiniMaxH3ChainReview"].includes(progress.classType)) return 0.95;+ return 0.05;+}++function DropZone({ accept, onFiles, multiple, children, className }: {+ accept: string; onFiles: (files: File[]) => void; multiple?: boolean; children: ReactNode; className?: string;+}) {+ const [over, setOver] = useState(false);+ const kind = accept.startsWith("video") ? "video" : "image";+ return (+ <label+ className={`drop ${over ? "over" : ""} ${className ?? ""}`}+ onDragOver={(event) => { event.preventDefault(); setOver(true); }}+ onDragLeave={() => setOver(false)}+ onDrop={(event) => { setOver(false); onFiles(droppedFiles(event, kind)); }}+ >+ <input type="file" accept={accept} multiple={multiple} hidden onChange={(event) => { onFiles([...(event.target.files ?? [])]); event.target.value = ""; }} />+ {children}+ </label>+ );+}++export function Openjutsu() {+ const [video, setVideo] = useState<{ file: File; url: string; duration: number } | null>(null);+ const [characters, setCharacters] = useState<Character[]>([]);+ const [resolution, setResolution] = useState<Resolution>("736p");+ const [hatFix, setHatFix] = useState(false);+ const [seed, setSeed] = useState(0);+ const [clipSeconds, setClipSeconds] = useState(CLIP_SECONDS.default);+ const [submitting, setSubmitting] = useState(false);+ const [formError, setFormError] = useState("");++ const [run, setRun] = useState<Run | null>(null);+ const [job, setJob] = useState<PublicJob | null>(null);+ const [progress, setProgress] = useState<Progress | null>(null);+ const [preview, setPreview] = useState("");+ const [streamError, setStreamError] = useState("");+ const [now, setNow] = useState(Date.now());++ useEffect(() => setRun(readRun()), []);++ useEffect(() => {+ if (!run) return;+ const source = new EventSource(`/api/jobs/${run.id}/events`);+ source.onmessage = (message) => {+ const event = JSON.parse(message.data);+ if (event.type === "job") {+ setJob(event.job);+ setStreamError("");+ if (TERMINAL.has(event.job.status)) source.close();+ } else if (event.type === "status") {+ setJob((current) => current && { ...current, status: event.status, queuePosition: event.queuePosition });+ } else if (event.type === "progress" && event.node) {+ setProgress({ ...event.node, step: event.step, steps: event.steps });+ } else if (event.type === "preview") {+ setPreview(event.url);+ } else if (event.type === "error") {+ setStreamError(event.message);+ }+ };+ return () => source.close();+ }, [run]);++ const running = !!run && !(job && TERMINAL.has(job.status));+ useEffect(() => {+ if (!running) return;+ const timer = setInterval(() => setNow(Date.now()), 1000);+ return () => clearInterval(timer);+ }, [running]);++ function chooseVideo(files: File[]) {+ const file = files[0];+ if (!file) return;+ if (video) URL.revokeObjectURL(video.url);+ const url = URL.createObjectURL(file);+ setVideo({ file, url, duration: 0 });+ const probe = document.createElement("video");+ probe.preload = "metadata";+ probe.onloadedmetadata = () => setVideo((current) => (current?.url === url ? { ...current, duration: probe.duration } : current));+ probe.src = url;+ }++ function addCharacters(files: File[]) {+ setCharacters((current) => [+ ...current,+ ...files.slice(0, MAX_PICTURES - current.length).map((file) => ({ file, url: URL.createObjectURL(file), role: "" })),+ ]);+ }++ function removeCharacter(index: number) {+ URL.revokeObjectURL(characters[index].url);+ setCharacters(characters.filter((_, i) => i !== index));+ }++ const clips = video?.duration ? clipCount(video.duration, clipSeconds) : 0;++ async function generate() {+ if (!video || !characters.length) return;+ setSubmitting(true);+ setFormError("");+ const form = new FormData();+ form.set("mode", "simple");+ form.set("video", video.file);+ characters.forEach((character, i) => {+ form.set(`picture_${i + 1}`, character.file);+ form.set(`role_${i + 1}`, character.role);+ });+ form.set("resolution", resolution);+ form.set("hat_fix", String(hatFix));+ form.set("seed", String(seed));+ form.set("clip_seconds", String(clipSeconds));+ try {+ const response = await fetch("/api/jobs", { method: "POST", body: form });+ const body = await response.json();+ if (!response.ok) throw new Error(body.error ?? "Could not start the job.");+ const next = { id: body.id, clips: Math.max(clips, 1), startedAt: Date.now() };+ writeRun(next);+ setJob(body);+ setProgress(null);+ setPreview("");+ setStreamError("");+ setRun(next);+ } catch (error) {+ setFormError(error instanceof Error ? error.message : "Could not start the job.");+ } finally {+ setSubmitting(false);+ }+ }++ async function cancel() {+ if (!run) return;+ const response = await fetch(`/api/jobs/${run.id}`, { method: "DELETE" });+ if (response.ok) setJob(await response.json());+ }++ function reset() {+ writeRun(null);+ setRun(null);+ setJob(null);+ setProgress(null);+ setPreview("");+ setStreamError("");+ }++ return (+ <main className="shell">+ <header className="top">+ <div className="brand">+ <span className="mark" aria-hidden>忍</span>+ <div>+ <h1>Openjutsu</h1>+ <p>Swap the people in any video for your own characters. Open weights, on your own GPU.</p>+ </div>+ </div>+ </header>++ <nav className="modes" aria-label="Mode">+ {MODES.map((mode) => (+ <button key={mode.id} className={`mode ${mode.ready ? "active" : ""}`} disabled={!mode.ready} aria-pressed={mode.ready}>+ <strong>{mode.title}</strong>+ <span>{mode.text}</span>+ {!mode.ready && <em>Coming soon</em>}+ </button>+ ))}+ </nav>++ {run ? (+ <RunView+ run={run} job={job} progress={progress} preview={preview} streamError={streamError} now={now}+ onCancel={cancel} onReset={reset}+ />+ ) : (+ <>+ <section className="inputs">+ <div className="panel">+ <h2><span>1</span> Source video</h2>+ {video ? (+ <div className="video-pick">+ <video src={video.url} controls muted playsInline />+ <div className="row">+ <small>{video.file.name}{video.duration ? ` · ${video.duration.toFixed(1)} s` : ""}</small>+ <DropZone accept="video/*,.mkv" onFiles={chooseVideo} className="link">Replace</DropZone>+ </div>+ </div>+ ) : (+ <DropZone accept="video/*,.mkv" onFiles={chooseVideo} className="big">+ <strong>Drop a video</strong>+ <span>or click to browse. Its camera, cuts, motion and soundtrack are kept.</span>+ </DropZone>+ )}+ </div>++ <div className="panel">+ <h2><span>2</span> Characters <small>{characters.length}/{MAX_PICTURES}</small></h2>+ <div className="characters">+ {characters.map((character, i) => (+ <div className="character" key={character.url}>+ <img src={character.url} alt={`Character ${i + 1}`} />+ <button className="remove" onClick={() => removeCharacter(i)} aria-label={`Remove character ${i + 1}`}>×</button>+ <label>+ <span>Replaces who?</span>+ <input+ value={character.role}+ maxLength={200}+ placeholder={i === 0 ? "e.g. the singer" : "e.g. the drummer"}+ onChange={(event) => setCharacters(characters.map((c, j) => (j === i ? { ...c, role: event.target.value } : c)))}+ />+ </label>+ </div>+ ))}+ {characters.length < MAX_PICTURES && (+ <DropZone accept="image/*" multiple onFiles={addCharacters} className="add">+ <strong>+</strong>+ <span>{characters.length ? "Add another" : "Drop 1-4 photos"}</span>+ </DropZone>+ )}+ </div>+ <p className="hint">+ One photo per person in the video. Leave “replaces who?” blank to match by screen time. Name a role or position+ (“the drummer”, “the person on the left”), not clothes.+ </p>+ </div>+ </section>++ <section className="panel settings">+ <h2><span>3</span> Settings</h2>+ <div className="setting">+ <span>Resolution</span>+ <div className="segmented">+ {RESOLUTIONS.map((r) => (+ <button key={r} className={r === resolution ? "on" : ""} onClick={() => setResolution(r)}>{r}</button>+ ))}+ </div>+ </div>+ <label className="setting toggle">+ <span>Hat fix <small>Also replaces hats (about 45 s more per clip).</small></span>+ <input type="checkbox" checked={hatFix} onChange={(event) => setHatFix(event.target.checked)} />+ <i aria-hidden />+ </label>+ <details>+ <summary>Advanced</summary>+ <div className="setting">+ <span>Seed <small>Change it for a new take.</small></span>+ <div className="seed">+ <input type="number" min={0} max={MAX_SEED} value={seed} onChange={(event) => setSeed(Math.min(MAX_SEED, Math.max(0, Math.floor(Number(event.target.value) || 0))))} />+ <button onClick={() => setSeed(Math.floor(Math.random() * MAX_SEED))} aria-label="Random seed">🎲</button>+ </div>+ </div>+ <div className="setting">+ <span>Clip length <small>{clipSeconds.toFixed(1)} s per H3 generation</small></span>+ <input type="range" min={CLIP_SECONDS.min} max={CLIP_SECONDS.max} step={0.5} value={clipSeconds} onChange={(event) => setClipSeconds(Number(event.target.value))} />+ </div>+ </details>+ </section>++ <div className="go">+ {formError && <p className="error">{formError}</p>}+ <button className="primary" disabled={!video || !characters.length || submitting} onClick={generate}>+ {submitting ? "Uploading…" : "Generate"}+ </button>+ <small>{clips ? `${clips} clip${clips > 1 ? "s" : ""} at ${resolution}` : "Add a video and at least one character."}</small>+ </div>+ </>+ )}+ </main>+ );+}++function RunView({ run, job, progress, preview, streamError, now, onCancel, onReset }: {+ run: Run; job: PublicJob | null; progress: Progress | null; preview: string; streamError: string; now: number;+ onCancel: () => void; onReset: () => void;+}) {+ const status = job?.status ?? "queued";+ const clips = Math.max(run.clips, progress?.clip ?? 1);++ if (status === "succeeded" && job?.video) {+ return (+ <section className="panel result">+ <video src={job.video.url} controls autoPlay playsInline />+ <div className="row">+ <a className="primary" href={`${job.video.url}?download`} download={job.video.name}>Download MP4</a>+ <button className="secondary" onClick={onReset}>New swap</button>+ </div>+ </section>+ );+ }++ if (TERMINAL.has(status)) {+ return (+ <section className="panel">+ <h2>{status === "canceled" ? "Canceled" : status === "succeeded" ? "Finished without a video" : status === "expired" ? "Job no longer available" : "Something went wrong"}</h2>+ {job?.error && <p className="error">{job.error}</p>}+ {status === "expired" && <p className="hint">ComfyUI no longer knows this job, for example after a restart. Finished videos are in ComfyUI's output/h3_oneclick_swap folder.</p>}+ <button className="secondary" onClick={onReset}>Back</button>+ </section>+ );+ }++ let fraction = 0;+ if (progress?.classType === "MiniMaxH3ChainAssemble") fraction = 0.99;+ else if (progress?.clip) fraction = (progress.clip - 1 + clipShare(progress)) / clips;++ return (+ <section className="panel progress">+ <div className="row">+ <h2>{status === "queued" ? `Queued${job?.queuePosition ? ` (#${job.queuePosition})` : ""}` : progress?.clip ? `Clip ${progress.clip} of ${clips}` : "Preparing"}</h2>+ <span className="time">{elapsed(now - run.startedAt)}</span>+ </div>+ <div className="bar"><div style={{ width: `${Math.round(fraction * 100)}%` }} /></div>+ <p className="node">+ {progress ? progress.title : status === "queued" ? "Waiting for ComfyUI…" : "Working…"}+ {progress?.steps ? ` · step ${progress.step ?? 0}/${progress.steps}` : ""}+ </p>+ {preview && <img className="preview" src={preview} alt="Mask preview: white areas are regenerated" />}+ {streamError && <p className="error">{streamError}</p>}+ <p className="hint">Each clip is saved as it finishes, so a rerun with the same inputs resumes where it stopped. You can close this page and come back.</p>+ <button className="secondary" onClick={onCancel}>Cancel</button>+ </section>+ );+}diff --git a/lib/clips.ts b/lib/clips.tsnew file mode 100644index 0000000..b017fa2--- /dev/null+++ b/lib/clips.ts@@ -0,0 +1,21 @@+// Mirrors clip_lengths() in the H3OneClickSwapPlan node, so the page can show "clip k of N".+const FPS = 24;+const OVERLAP = 39;++const gridFloor = (frames: number) => Math.floor((frames - 5) / 17) * 17 + 5;+const gridCeil = (frames: number) => Math.ceil((frames - 5) / 17) * 17 + 5;++export function clipCount(durationSeconds: number, clipSeconds: number) {+ const total = Math.floor(durationSeconds * FPS);+ const clipFrames = Math.floor(clipSeconds * FPS);+ let rem = total - Math.min(gridFloor(clipFrames), gridFloor(total));+ const count = rem >= 17 ? Math.ceil(rem / (gridFloor(clipFrames) - OVERLAP)) : 0;+ let clips = 1;+ for (let j = 0; j < count; j++) {+ const length = Math.min(gridCeil(Math.ceil(rem / (count - j)) + OVERLAP), gridFloor(rem + OVERLAP));+ if (length - OVERLAP < 17) break;+ clips++;+ rem -= length - OVERLAP;+ }+ return clips;+}diff --git a/lib/comfy.ts b/lib/comfy.tsnew file mode 100644index 0000000..b53da92--- /dev/null+++ b/lib/comfy.ts@@ -0,0 +1,80 @@+import { readFile } from "node:fs/promises";+import { join } from "node:path";+import { Comfy, resolveBaseUrl, resolveCredentials, type Job } from "@comfyorg/sdk";+import { ComfyLow } from "@comfyorg/sdk/low";+import { NODES, pruneSimple, type ApiGraph, type SimpleSettings } from "./simple.ts";++export type PublicJob = {+ id: string;+ status: string;+ queuePosition: number | null;+ error: string | null;+ video: { id: string; name: string; url: string } | null;+};++export const TERMINAL = new Set(["succeeded", "failed", "canceled", "expired"]);++// COMFY_BASE_URL and the optional COMFY_API_KEY come from .env.local; the SDK reads both.+export function client() {+ return new Comfy({ clientInfo: "openjutsu" });+}++// job.events() drops progress frames whose value is lower than the last one, but the proxy+// reports each node's own step fraction, so the next node's progress would be hidden. The raw+// stream has every frame; the browser's EventSource reconnects when it ends.+export function rawJobEvents(job: Job, signal: AbortSignal) {+ return new ComfyLow(resolveBaseUrl(), resolveCredentials(), { clientInfo: "openjutsu" }).getJobEvents(job.urls.events || job.id, { signal });+}++export async function loadSimpleGraph(): Promise<ApiGraph> {+ return JSON.parse(await readFile(join(process.cwd(), "workflows", "simple.api.json"), "utf8"));+}++function jobErrorMessage(error: unknown) {+ const message = error && typeof error === "object" && typeof Reflect.get(error, "message") === "string"+ ? (Reflect.get(error, "message") as string)+ : typeof error === "string" ? error : "";+ const missingNode = message.match(/Node ['"]([^'"]+)['"] not found/i)?.[1];+ if (missingNode) return `ComfyUI is missing the "${missingNode}" node. Install the custom nodes listed in the README and restart ComfyUI.`;+ return message || "ComfyUI could not run this workflow. Check the ComfyUI console.";+}++export function publicJob(job: Job): PublicJob {+ const video = job.outputs.find((output) => output.nodeId === NODES.final && output.contentType.startsWith("video/"));+ return {+ id: job.id,+ status: job.status,+ queuePosition: job.queuePosition,+ error: job.error ? jobErrorMessage(job.error) : null,+ video: video ? { id: video.id, name: video.name, url: `/api/jobs/${job.id}/outputs/${video.id}` } : null,+ };+}++function upload(comfy: Comfy, file: File) {+ return file.arrayBuffer().then((bytes) =>+ comfy.assets.fromBytes(new Uint8Array(bytes), {+ filename: file.name.replace(/[^\w.\- ]+/g, "_").slice(-100) || "upload",+ contentType: file.type || "application/octet-stream",+ }),+ );+}++export async function submitSimple(video: File, pictures: File[], settings: SimpleSettings) {+ const comfy = client();+ const workflow = comfy.workflows.fromJson(pruneSimple(await loadSimpleGraph(), settings));+ workflow.setInput(NODES.video, "video", await upload(comfy, video));+ for (const [i, picture] of pictures.entries()) workflow.setInput(NODES.pictures[i].load, "image", await upload(comfy, picture));+ return publicJob(await comfy.submit(workflow));+}++export function getJob(id: string) {+ return client().jobs.get(id);+}++export async function getOutput(jobId: string, outputId: string, range: string | null) {+ const job = await getJob(jobId);+ const output = job.outputs.find((candidate) => candidate.id === outputId);+ if (!output) throw new Error("Output not found on this job.");+ const { url } = await output.getDownloadUrl();+ return { name: output.name, response: await fetch(url, { headers: range ? { Range: range } : {} }) };+}diff --git a/lib/progress.ts b/lib/progress.tsnew file mode 100644index 0000000..1688b3b--- /dev/null+++ b/lib/progress.ts@@ -0,0 +1,37 @@+import { NODES, isLink, type ApiGraph } from "./simple.ts";++export type NodeInfo = { title: string; classType: string; clip: number | null };++// Each clip after the first is a GraphBuilder expansion of the clip loop, which prefixes the+// node ids with "<parent>.<call>.<graph>." and renames Loop End to "Recurse":+// "64" (clip 1), "70.0.0.64" (clip 2), "70.0.0.Recurse.0.0.64" (clip 3).+export function nodeDescriber(graph: ApiGraph) {+ const children = new Map<string, string[]>();+ for (const [id, node] of Object.entries(graph)) {+ for (const value of Object.values(node.inputs)) {+ if (isLink(value)) children.set(value[0], [...(children.get(value[0]) ?? []), id]);+ }+ }+ const downstream = (root: string) => {+ const seen = new Set([root]);+ const stack = [root];+ while (stack.length) for (const child of children.get(stack.pop()!) ?? []) if (!seen.has(child)) seen.add(child), stack.push(child);+ return seen;+ };+ const afterLoop = downstream(NODES.loopEnd);+ afterLoop.delete(NODES.loopEnd);+ const inLoop = new Set([...downstream(NODES.loopStart)].filter((id) => !afterLoop.has(id)));++ return (nodeId: string | null): NodeInfo | null => {+ if (!nodeId) return null;+ const parts = nodeId.split(".");+ const base = parts.at(-1) === "Recurse" ? NODES.loopEnd : parts.at(-1)!;+ const node = graph[base];+ if (!node) return null;+ return {+ title: node._meta?.title ?? node.class_type,+ classType: node.class_type,+ clip: inLoop.has(base) ? 1 + Math.floor((parts.length - 1) / 3) : null,+ };+ };+}diff --git a/lib/simple.ts b/lib/simple.tsnew file mode 100644index 0000000..716cdd9--- /dev/null+++ b/lib/simple.ts@@ -0,0 +1,92 @@+// Simple motion transfer: workflows/simple.api.json is one export with all four+// picture branches and the hat fix enabled. Each request prunes what it does not use.++export type ApiNode = { class_type: string; inputs: Record<string, unknown>; _meta?: { title?: string } };+export type ApiGraph = Record<string, ApiNode>;++export const RESOLUTIONS = ["480p", "576p", "736p", "768p", "1080p"] as const;+export type Resolution = (typeof RESOLUTIONS)[number];++export const MAX_PICTURES = 4;+export const CLIP_SECONDS = { min: 2.5, max: 15, default: 6 };+export const MAX_SEED = 0xffffffff;++export type SimpleSettings = {+ roles: string[]; // one entry per picture, "" when the user left it blank+ resolution: Resolution;+ hatFix: boolean;+ seed: number;+ clipSeconds: number;+};++// Node ids in workflows/simple.api.json.+export const NODES = {+ video: "14",+ plan: "20",+ reference: "39",+ peopleMask: "46",+ growMask: "48",+ loopStart: "37",+ loopEnd: "70",+ final: "71",+ pictures: [+ { load: "2", shrink: "3", describe: "4" },+ { load: "5", shrink: "6", describe: "7" },+ { load: "8", shrink: "9", describe: "10" },+ { load: "11", shrink: "12", describe: "13" },+ ],+ hat: ["53", "54", "55", "56"],+};++export function isLink(value: unknown): value is [string, number] {+ return Array.isArray(value) && value.length === 2 && typeof value[0] === "string" && typeof value[1] === "number";+}++// The Swap Plan falls back to "the person with the most screen time", "... second most ..." when roles is blank.+// A partly filled list keeps that fallback for the blank lines so every line stays on its own picture.+function ordinalRole(index: number, count: number) {+ if (count === 1) return "the main person";+ return `the person with the ${["", "second ", "third ", "fourth "][index]}most screen time`;+}++export function rolesText(roles: string[]) {+ const clean = roles.map((role) => role.replace(/\s+/g, " ").trim());+ if (clean.every((role) => !role)) return "";+ return clean.map((role, i) => role || ordinalRole(i, clean.length)).join("\n");+}++export function pruneSimple(source: ApiGraph, settings: SimpleSettings): ApiGraph {+ const count = settings.roles.length;+ if (count < 1 || count > MAX_PICTURES) throw new Error(`Use 1 to ${MAX_PICTURES} pictures.`);++ const graph: ApiGraph = structuredClone(source);+ const plan = graph[NODES.plan].inputs;+ const reference = graph[NODES.reference].inputs;++ for (const [i, picture] of NODES.pictures.entries()) {+ if (i < count) continue;+ delete graph[picture.load];+ delete graph[picture.shrink];+ delete graph[picture.describe];+ delete plan[`picture_${i + 1}`];+ delete plan[`picture_${i + 1}_text`];+ delete reference[`ref_images.ref_image_${i}`];+ }++ if (!settings.hatFix) {+ for (const id of NODES.hat) delete graph[id];+ graph[NODES.growMask].inputs.mask = [NODES.peopleMask, 0];+ }++ for (const [id, node] of Object.entries(graph)) {+ for (const [name, value] of Object.entries(node.inputs)) {+ if (isLink(value) && !graph[value[0]]) throw new Error(`Node ${id}.${name} still links to removed node ${value[0]}.`);+ }+ }++ plan.resolution = settings.resolution;+ plan.seed = settings.seed;+ plan.clip_seconds = settings.clipSeconds;+ plan.roles = rolesText(settings.roles);+ return graph;+}diff --git a/next-env.d.ts b/next-env.d.tsnew file mode 100644index 0000000..a419cbe--- /dev/null+++ b/next-env.d.ts@@ -0,0 +1,7 @@+/// <reference types="next" />+/// <reference types="next/image-types/global" />+import "./.next/dev/types/routes.d.ts";+import "./.next/dev/types/root-params.d.ts";++// NOTE: This file should not be edited+// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.diff --git a/next.config.ts b/next.config.tsnew file mode 100644index 0000000..cb651cd--- /dev/null+++ b/next.config.ts@@ -0,0 +1,5 @@+import type { NextConfig } from "next";++const nextConfig: NextConfig = {};++export default nextConfig;diff --git a/package-lock.json b/package-lock.jsonnew file mode 100644index 0000000..dc2dc07--- /dev/null+++ b/package-lock.json@@ -0,0 +1,1421 @@+{+ "name": "openjutsu",+ "lockfileVersion": 3,+ "requires": true,+ "packages": {+ "": {+ "name": "openjutsu",+ "license": "MIT",+ "dependencies": {+ "@comfyorg/sdk": "0.5.0",+ "next": "^16.4.2",+ "react": "^19.3.1",+ "react-dom": "^19.3.1"+ },+ "devDependencies": {+ "@types/node": "^26.6.5",+ "@types/react": "^19.3.0",+ "@types/react-dom": "^19.3.0",+ "typescript": "^7.0.2"+ },+ "engines": {+ "node": ">=22.6.0"+ }+ },+ "node_modules/@comfyorg/sdk": {+ "version": "0.5.0",+ "resolved": "https://registry.npmjs.org/@comfyorg/sdk/-/sdk-0.5.0.tgz",+ "integrity": "sha512-zBOIHmXxlPivt18/Ds6P4m1zwn0hys6MG9waFND2zHKi2oCXi0aZPFLu4lr4uxf0tnGmy3oqabPTcqICH7hA0Q==",+ "license": "MIT",+ "dependencies": {+ "eventsource-parser": "^4.1.0",+ "hash-wasm": "^4.11.0",+ "zod": "^4.4.3"+ },+ "engines": {+ "node": ">=22"+ }+ },+ "node_modules/@emnapi/runtime": {+ "version": "1.11.3",+ "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.11.3.tgz",+ "integrity": "sha512-Xz4Tpyki7XyrpbUK1jR1AhdAdaXyhhY4lZ3neLodmhpuWfy2PAQN5B46sAiU4liOXGLkHypn/qU+jvfWSCYYLA==",+ "license": "MIT",+ "optional": true,+ "dependencies": {+ "tslib": "^2.4.0"+ }+ },+ "node_modules/@img/colour": {+ "version": "1.1.0",+ "resolved": "https://registry.npmjs.org/@img/colour/-/colour-1.1.0.tgz",+ "integrity": "sha512-Td76q7j57o/tLVdgS746cYARfSyxk8iEfRxewL9h4OMzYhbW4TAcppl0mT4eyqXddh6L/jwoM75mo7ixa/pCeQ==",+ "license": "MIT",+ "optional": true,+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@img/sharp-darwin-arm64": {+ "version": "0.35.5",+ "resolved": "https://registry.npmjs.org/@img/sharp-darwin-arm64/-/sharp-darwin-arm64-0.35.5.tgz",+ "integrity": "sha512-QRUlFQ0WxvdWyqqG/WtI3iupfD5rBzmCHXSdPsY91sAtVtTo7Q4cb6zOccZ3gqEqkr0f1As1ehLqmEpDsRf+lg==",+ "cpu": [+ "arm64"+ ],+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "darwin"+ ],+ "engines": {+ "node": ">=20.9.0"+ },+ "funding": {+ "url": "https://opencollective.com/libvips"+ },+ "optionalDependencies": {+ "@img/sharp-libvips-darwin-arm64": "1.3.4"+ }+ },+ "node_modules/@img/sharp-darwin-x64": {+ "version": "0.35.5",+ "resolved": "https://registry.npmjs.org/@img/sharp-darwin-x64/-/sharp-darwin-x64-0.35.5.tgz",+ "integrity": "sha512-+BR255RhDlpygUpOc/Jdt1nT6DQ3XG/ERo5wbcdOf5Q320dKtPCKPLR1LJs9VGXRaMa8l1uUa0tkCNOXiAxZUw==",+ "cpu": [+ "x64"+ ],+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "darwin"+ ],+ "engines": {+ "node": ">=20.9.0"+ },+ "funding": {+ "url": "https://opencollective.com/libvips"+ },+ "optionalDependencies": {+ "@img/sharp-libvips-darwin-x64": "1.3.4"+ }+ },+ "node_modules/@img/sharp-freebsd-wasm32": {+ "version": "0.35.5",+ "resolved": "https://registry.npmjs.org/@img/sharp-freebsd-wasm32/-/sharp-freebsd-wasm32-0.35.5.tgz",+ "integrity": "sha512-Y/z91nEZ4uIBX5X3nfTovjU9lHNKFYbL2lpHCLVNmXQK03VIZvXBBt0KxbPGp2SdGSF+2mQU4e+hQaWOt86iAw==",+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "freebsd"+ ],+ "dependencies": {+ "@img/sharp-wasm32": "0.35.5"+ },+ "engines": {+ "node": ">=20.9.0"+ },+ "funding": {+ "url": "https://opencollective.com/libvips"+ }+ },+ "node_modules/@img/sharp-libvips-darwin-arm64": {+ "version": "1.3.4",+ "resolved": "https://registry.npmjs.org/@img/sharp-libvips-darwin-arm64/-/sharp-libvips-darwin-arm64-1.3.4.tgz",+ "integrity": "sha512-5R89nBYiRdUlSWJxPhO+GVtaXzXSxKnRu/xqMn3KTA3L9EB9Oy/P+Nn2f2vlhPuUdy/Zusb2DarbyTpGCfEDuw==",+ "cpu": [+ "arm64"+ ],+ "license": "LGPL-3.0-or-later",+ "optional": true,+ "os": [+ "darwin"+ ],+ "funding": {+ "url": "https://opencollective.com/libvips"+ }+ },+ "node_modules/@img/sharp-libvips-darwin-x64": {+ "version": "1.3.4",+ "resolved": "https://registry.npmjs.org/@img/sharp-libvips-darwin-x64/-/sharp-libvips-darwin-x64-1.3.4.tgz",+ "integrity": "sha512-iR2OKH80yi0U+dUplyh3/xdpFvps6YkCwsXenIJxqxR1v9o+xtKTGbS9H7cps+2Vxjc8B1j96p75NmTGjIhtpQ==",+ "cpu": [+ "x64"+ ],+ "license": "LGPL-3.0-or-later",+ "optional": true,+ "os": [+ "darwin"+ ],+ "funding": {+ "url": "https://opencollective.com/libvips"+ }+ },+ "node_modules/@img/sharp-libvips-linux-arm": {+ "version": "1.3.4",+ "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-arm/-/sharp-libvips-linux-arm-1.3.4.tgz",+ "integrity": "sha512-LmRtTsOHuvM2+wlO2Db37dx5MiZhB0FvSunciw48YjdOkZz9KAiRbm8ujeMOA1INqmei5NapFxYEK1D1ZSidmw==",+ "cpu": [+ "arm"+ ],+ "license": "LGPL-3.0-or-later",+ "optional": true,+ "os": [+ "linux"+ ],+ "funding": {+ "url": "https://opencollective.com/libvips"+ }+ },+ "node_modules/@img/sharp-libvips-linux-arm64": {+ "version": "1.3.4",+ "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-arm64/-/sharp-libvips-linux-arm64-1.3.4.tgz",+ "integrity": "sha512-Y3dgX/6lE2QhQb+Gxy0WZxfg9MEm/JBjamZpS2IklP7xIQoKN4hzAm7KcMVGtaVDt3neE9OKBC7vAfonA/Lr1A==",+ "cpu": [+ "arm64"+ ],+ "license": "LGPL-3.0-or-later",+ "optional": true,+ "os": [+ "linux"+ ],+ "funding": {+ "url": "https://opencollective.com/libvips"+ }+ },+ "node_modules/@img/sharp-libvips-linux-ppc64": {+ "version": "1.3.4",+ "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-ppc64/-/sharp-libvips-linux-ppc64-1.3.4.tgz",+ "integrity": "sha512-Le6boB8Tai0Nis+gIxIpKx68UDVVIqdR8Tin5Yf1z2LJJQLDJvCDRqRu+jC2qCoD+eIomonmOwB4smBRxfVpYQ==",+ "cpu": [+ "ppc64"+ ],+ "license": "LGPL-3.0-or-later",+ "optional": true,+ "os": [+ "linux"+ ],+ "funding": {+ "url": "https://opencollective.com/libvips"+ }+ },+ "node_modules/@img/sharp-libvips-linux-riscv64": {+ "version": "1.3.4",+ "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-riscv64/-/sharp-libvips-linux-riscv64-1.3.4.tgz",+ "integrity": "sha512-aHkkIEHPRdQEegJN20MLmGtxYD9R2wQr3Cwpddnu5+YKMt6Uzax7S9h5gpZTo8wyrGuZSlfQ63OevL5mTyOC7Q==",+ "cpu": [+ "riscv64"+ ],+ "license": "LGPL-3.0-or-later",+ "optional": true,+ "os": [+ "linux"+ ],+ "funding": {+ "url": "https://opencollective.com/libvips"+ }+ },+ "node_modules/@img/sharp-libvips-linux-s390x": {+ "version": "1.3.4",+ "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-s390x/-/sharp-libvips-linux-s390x-1.3.4.tgz",+ "integrity": "sha512-ra/mB6MikESDUO7Yg+Mi95bFBb9GsObURuhnOv3OqknjGe9sZrG8tCe9q0xSIGrtLgvgw0gKnFWcK4blSgQOuQ==",+ "cpu": [+ "s390x"+ ],+ "license": "LGPL-3.0-or-later",+ "optional": true,+ "os": [+ "linux"+ ],+ "funding": {+ "url": "https://opencollective.com/libvips"+ }+ },+ "node_modules/@img/sharp-libvips-linux-x64": {+ "version": "1.3.4",+ "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-x64/-/sharp-libvips-linux-x64-1.3.4.tgz",+ "integrity": "sha512-GJ//SSXbnwSDes02umB3nDJLFcQzw8a18V8fyhqr6tV515tOEMdImjjxj1AoafMRz56F3PHgftnj1QEKSU1zkw==",+ "cpu": [+ "x64"+ ],+ "license": "LGPL-3.0-or-later",+ "optional": true,+ "os": [+ "linux"+ ],+ "funding": {+ "url": "https://opencollective.com/libvips"+ }+ },+ "node_modules/@img/sharp-libvips-linuxmusl-arm64": {+ "version": "1.3.4",+ "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-arm64/-/sharp-libvips-linuxmusl-arm64-1.3.4.tgz",+ "integrity": "sha512-hvulFwtjUcagsis6BBxHwGFwWoNZjgYmULGVrZcyfNbjA8hKILbRxGg15/7w5HDyXHXUos/j6baAWqnCyQ2DWA==",+ "cpu": [+ "arm64"+ ],+ "license": "LGPL-3.0-or-later",+ "optional": true,+ "os": [+ "linux"+ ],+ "funding": {+ "url": "https://opencollective.com/libvips"+ }+ },+ "node_modules/@img/sharp-libvips-linuxmusl-x64": {+ "version": "1.3.4",+ "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-x64/-/sharp-libvips-linuxmusl-x64-1.3.4.tgz",+ "integrity": "sha512-6zXKeE/p39I1AmA3cJG35eyBGNqNddLnUXjhwBnsGjFPWqf5VKkDBEqaEkPDoTEtkxwi2vv8Tcr2mDyP4So7Fg==",+ "cpu": [+ "x64"+ ],+ "license": "LGPL-3.0-or-later",+ "optional": true,+ "os": [+ "linux"+ ],+ "funding": {+ "url": "https://opencollective.com/libvips"+ }+ },+ "node_modules/@img/sharp-linux-arm": {+ "version": "0.35.5",+ "resolved": "https://registry.npmjs.org/@img/sharp-linux-arm/-/sharp-linux-arm-0.35.5.tgz",+ "integrity": "sha512-LEaXK2WdXVK5ykcw0buWyPMsmLLL2vpHLD6yrNSW+JGEL3BZPA4tpKN6iaMc4AxTTAoaX/sU1rOL51lcIz48ZQ==",+ "cpu": [+ "arm"+ ],+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">=20.9.0"+ },+ "funding": {+ "url": "https://opencollective.com/libvips"+ },+ "optionalDependencies": {+ "@img/sharp-libvips-linux-arm": "1.3.4"+ }+ },+ "node_modules/@img/sharp-linux-arm64": {+ "version": "0.35.5",+ "resolved": "https://registry.npmjs.org/@img/sharp-linux-arm64/-/sharp-linux-arm64-0.35.5.tgz",+ "integrity": "sha512-LYVx5JTsOM2CBzmxreh+nl64/3H6Xb09iSLknqH47z2T2DFFxDeFLP5y4dJwe6H7uGQlHPyEEtIqyo3DYsRwdQ==",+ "cpu": [+ "arm64"+ ],+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">=20.9.0"+ },+ "funding": {+ "url": "https://opencollective.com/libvips"+ },+ "optionalDependencies": {+ "@img/sharp-libvips-linux-arm64": "1.3.4"+ }+ },+ "node_modules/@img/sharp-linux-ppc64": {+ "version": "0.35.5",+ "resolved": "https://registry.npmjs.org/@img/sharp-linux-ppc64/-/sharp-linux-ppc64-0.35.5.tgz",+ "integrity": "sha512-QVxAAq8evVRI9ia2vqgwrmWucn5Dfv+JdWzj75pD8omHLPSP7f8p20O8jxzjCcuCEQEOtYOZUmX1hkiZ0kdevA==",+ "cpu": [+ "ppc64"+ ],+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">=20.9.0"+ },+ "funding": {+ "url": "https://opencollective.com/libvips"+ },+ "optionalDependencies": {+ "@img/sharp-libvips-linux-ppc64": "1.3.4"+ }+ },+ "node_modules/@img/sharp-linux-riscv64": {+ "version": "0.35.5",+ "resolved": "https://registry.npmjs.org/@img/sharp-linux-riscv64/-/sharp-linux-riscv64-0.35.5.tgz",+ "integrity": "sha512-LtdreXguaavKODPIfzJ4kffx7UNt1omwtK0rch4EBbbSTXPnxWmYSayXdLJw0fJzQ97kHt1gL/yh4tvU+nCyRQ==",+ "cpu": [+ "riscv64"+ ],+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">=20.9.0"+ },+ "funding": {+ "url": "https://opencollective.com/libvips"+ },+ "optionalDependencies": {+ "@img/sharp-libvips-linux-riscv64": "1.3.4"+ }+ },+ "node_modules/@img/sharp-linux-s390x": {+ "version": "0.35.5",+ "resolved": "https://registry.npmjs.org/@img/sharp-linux-s390x/-/sharp-linux-s390x-0.35.5.tgz",+ "integrity": "sha512-UZasTOFiYzotTsGOCu42BfUzP6Tu6Do/947iRm1RsLKvlllxwGcn4RN27LibGWceix4Y+Pmw3jsnTcCQIgWjqA==",+ "cpu": [+ "s390x"+ ],+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">=20.9.0"+ },+ "funding": {+ "url": "https://opencollective.com/libvips"+ },+ "optionalDependencies": {+ "@img/sharp-libvips-linux-s390x": "1.3.4"+ }+ },+ "node_modules/@img/sharp-linux-x64": {+ "version": "0.35.5",+ "resolved": "https://registry.npmjs.org/@img/sharp-linux-x64/-/sharp-linux-x64-0.35.5.tgz",+ "integrity": "sha512-SxFtLTeJInhAA9Q836kux2vZNeOBQEx658qvbboZScr0wIARym3IcGmW7KpVD5sbVg0Ojy+udFQdayYIZyoNog==",+ "cpu": [+ "x64"+ ],+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">=20.9.0"+ },+ "funding": {+ "url": "https://opencollective.com/libvips"+ },+ "optionalDependencies": {+ "@img/sharp-libvips-linux-x64": "1.3.4"+ }+ },+ "node_modules/@img/sharp-linuxmusl-arm64": {+ "version": "0.35.5",+ "resolved": "https://registry.npmjs.org/@img/sharp-linuxmusl-arm64/-/sharp-linuxmusl-arm64-0.35.5.tgz",+ "integrity": "sha512-9HbMclmI1zlNkFRs3z9/eBtDjfD0sGlrX1z6b1qwmiFY5ElDLh4BC0LPBdVp7z1DXFiKlIcznf+ZlsuZzLxQqg==",+ "cpu": [+ "arm64"+ ],+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">=20.9.0"+ },+ "funding": {+ "url": "https://opencollective.com/libvips"+ },+ "optionalDependencies": {+ "@img/sharp-libvips-linuxmusl-arm64": "1.3.4"+ }+ },+ "node_modules/@img/sharp-linuxmusl-x64": {+ "version": "0.35.5",+ "resolved": "https://registry.npmjs.org/@img/sharp-linuxmusl-x64/-/sharp-linuxmusl-x64-0.35.5.tgz",+ "integrity": "sha512-4KOphqB035HrVdqLZfCgMzzERrQkkzOwRhl4OAkRO1YCldbaFjySXMaK534Mo0V+LndnlJk+sbUyLeU0ULyD1A==",+ "cpu": [+ "x64"+ ],+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">=20.9.0"+ },+ "funding": {+ "url": "https://opencollective.com/libvips"+ },+ "optionalDependencies": {+ "@img/sharp-libvips-linuxmusl-x64": "1.3.4"+ }+ },+ "node_modules/@img/sharp-wasm32": {+ "version": "0.35.5",+ "resolved": "https://registry.npmjs.org/@img/sharp-wasm32/-/sharp-wasm32-0.35.5.tgz",+ "integrity": "sha512-Ptsga1su4tQx+LLF1ECS9U6nz5kmrXKo6XVbtR48Ke3ZRxxgaWBu7IDtEe1quo8hiupwm6WFqxVlXaSf7IINGQ==",+ "license": "Apache-2.0 AND LGPL-3.0-or-later AND MIT",+ "optional": true,+ "dependencies": {+ "@emnapi/runtime": "^1.11.3"+ },+ "engines": {+ "node": ">=20.9.0"+ },+ "funding": {+ "url": "https://opencollective.com/libvips"+ }+ },+ "node_modules/@img/sharp-webcontainers-wasm32": {+ "version": "0.35.5",+ "resolved": "https://registry.npmjs.org/@img/sharp-webcontainers-wasm32/-/sharp-webcontainers-wasm32-0.35.5.tgz",+ "integrity": "sha512-hfhF/FmoQyTUkA0bIKFOtw536BQSeBMe6BF6QyWlrPxT754+TFLaZ7sKKTfvvM0yJgKgaYTwnFCIZ/GuDw5SUA==",+ "cpu": [+ "wasm32"+ ],+ "license": "Apache-2.0",+ "optional": true,+ "dependencies": {+ "@img/sharp-wasm32": "0.35.5"+ },+ "engines": {+ "node": ">=20.9.0"+ },+ "funding": {+ "url": "https://opencollective.com/libvips"+ }+ },+ "node_modules/@img/sharp-win32-arm64": {+ "version": "0.35.5",+ "resolved": "https://registry.npmjs.org/@img/sharp-win32-arm64/-/sharp-win32-arm64-0.35.5.tgz",+ "integrity": "sha512-X4t7g+7ZA5DKblCBEXGjUqqemj4vczING/5viFwAL8h4N3qYeyjwdCvRLHi4EdOUI+2Z7UFlp1VM+p/AuEtm6Q==",+ "cpu": [+ "arm64"+ ],+ "license": "Apache-2.0 AND LGPL-3.0-or-later",+ "optional": true,+ "os": [+ "win32"+ ],+ "engines": {+ "node": ">=20.9.0"+ },+ "funding": {+ "url": "https://opencollective.com/libvips"+ }+ },+ "node_modules/@img/sharp-win32-ia32": {+ "version": "0.35.5",+ "resolved": "https://registry.npmjs.org/@img/sharp-win32-ia32/-/sharp-win32-ia32-0.35.5.tgz",+ "integrity": "sha512-5Zm82LoBc43nhwNybZlG7Y1KO//Zhsn306fQl29ZOuStHLGTo3BWL83q3cznX0poxSAMuYL1On/BHBxkBeKr6A==",+ "cpu": [+ "ia32"+ ],+ "license": "Apache-2.0 AND LGPL-3.0-or-later",+ "optional": true,+ "os": [+ "win32"+ ],+ "engines": {+ "node": "^20.9.0"+ },+ "funding": {+ "url": "https://opencollective.com/libvips"+ }+ },+ "node_modules/@img/sharp-win32-x64": {+ "version": "0.35.5",+ "resolved": "https://registry.npmjs.org/@img/sharp-win32-x64/-/sharp-win32-x64-0.35.5.tgz",+ "integrity": "sha512-x76eH0vEiHlcMQu8Y8IenntaACtddpT6W0wmXtWrnKcnKI7ME5DdgqhAD6SEWOEl1v2zDvkZDhFA9KnURwpfqg==",+ "cpu": [+ "x64"+ ],+ "license": "Apache-2.0 AND LGPL-3.0-or-later",+ "optional": true,+ "os": [+ "win32"+ ],+ "engines": {+ "node": ">=20.9.0"+ },+ "funding": {+ "url": "https://opencollective.com/libvips"+ }+ },+ "node_modules/@next/env": {+ "version": "16.4.2",+ "resolved": "https://registry.npmjs.org/@next/env/-/env-16.4.2.tgz",+ "integrity": "sha512-nTUTFH7G5/J/fmpkjVLegOkqyKOP0CEsJcMsyO4UCYeN1su+YMW/MfaSErnJskL7XM+UDK6aTvslxsRCyya/sA==",+ "license": "MIT"+ },+ "node_modules/@next/swc-darwin-arm64": {+ "version": "16.4.2",+ "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-16.4.2.tgz",+ "integrity": "sha512-ONkhFvZNFWlsEHOM/81AtxdyuJP2KRYKYR0JxPwvcu1AuPMMMgcL+wW2luldJvMtZwKtUxoSkCychW5wIeoYSw==",+ "cpu": [+ "arm64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "darwin"+ ],+ "engines": {+ "node": ">= 10"+ }+ },+ "node_modules/@next/swc-darwin-x64": {+ "version": "16.4.2",+ "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-16.4.2.tgz",+ "integrity": "sha512-luPCMbOsCoaF+kXJEUjmjmOZg1lC3BflhmUu+ZmW4tBu2vW/4AXak8JBFvePizGkxVmNiAw/r9ra+6UviCWtWQ==",+ "cpu": [+ "x64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "darwin"+ ],+ "engines": {+ "node": ">= 10"+ }+ },+ "node_modules/@next/swc-linux-arm64-gnu": {+ "version": "16.4.2",+ "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-16.4.2.tgz",+ "integrity": "sha512-xhwFTAncJyaCNy5KqKKuKaIIdCy1/1ZV1s5S1G0hhT7wGMkDTlfJ6aQbfRFnIG/s3/kDrxQ8aycVe+c5QnP8ow==",+ "cpu": [+ "arm64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">= 10"+ }+ },+ "node_modules/@next/swc-linux-arm64-musl": {+ "version": "16.4.2",+ "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-16.4.2.tgz",+ "integrity": "sha512-T1PNmfbPcxr5ndtWUL/3wQtLXsz808lq6sc2GrNT5k2oquF7UyqZddHSuAewHVsWsGXe6nsl9HoN1YNriVjuSg==",+ "cpu": [+ "arm64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">= 10"+ }+ },+ "node_modules/@next/swc-linux-x64-gnu": {+ "version": "16.4.2",+ "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-16.4.2.tgz",+ "integrity": "sha512-N9cDUOCGtkJG5PNKDFZUF3xXndrJJcpLp121uAGjIGvO/U2p9tfdNOM9htj7+5f72l0m8rMw/cvYacUJBQoudg==",+ "cpu": [+ "x64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">= 10"+ }+ },+ "node_modules/@next/swc-linux-x64-musl": {+ "version": "16.4.2",+ "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-16.4.2.tgz",+ "integrity": "sha512-yY2uh1YhX6ufuYy2FCbw1dqblbhI57GLYAJfCkqD9auTv6pLrH67Uccjc3QMKBeCYAG6lkgu08ExmX1bbjejjQ==",+ "cpu": [+ "x64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">= 10"+ }+ },+ "node_modules/@next/swc-win32-arm64-msvc": {+ "version": "16.4.2",+ "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-16.4.2.tgz",+ "integrity": "sha512-j/ArWRIHpMMB6wYLMhr2puTguBt70lNU/Cmjl9p6dTDE8DGknYJMP9PdwPk2dqpCNL/KIX9yfngDvIesxJPmsg==",+ "cpu": [+ "arm64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "win32"+ ],+ "engines": {+ "node": ">= 10"+ }+ },+ "node_modules/@next/swc-win32-x64-msvc": {+ "version": "16.4.2",+ "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-16.4.2.tgz",+ "integrity": "sha512-AA4edyWHDko3NCSo0x6GomsdgFb0oR1J3MXU1b5xt6FRFg4AucrMPW3S0hCe/9onU0O1BbpGQBsqo1r0Gneu1g==",+ "cpu": [+ "x64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "win32"+ ],+ "engines": {+ "node": ">= 10"+ }+ },+ "node_modules/@swc/helpers": {+ "version": "0.5.23",+ "resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.5.23.tgz",+ "integrity": "sha512-5lSsMOTXURePglDfvuAQUqkGek9Hg2kksOYay2m0+XR++b2NWYL/4sWyuvVBIs8oKnJaxkdi9whaL/sqN13afw==",+ "license": "Apache-2.0",+ "dependencies": {+ "tslib": "^2.8.0"+ }+ },+ "node_modules/@types/node": {+ "version": "26.6.5",+ "resolved": "https://registry.npmjs.org/@types/node/-/node-26.6.5.tgz",+ "integrity": "sha512-uMzsv9stDdofIZBx4UGh4Z9ZgXnGC9seRDscilBcTHAeOFk67MZg/k9bWVfO+bk4qZmG+l52hRnLwUiH2LnJTg==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "undici-types": "~8.9.0"+ }+ },+ "node_modules/@types/react": {+ "version": "19.3.0",+ "resolved": "https://registry.npmjs.org/@types/react/-/react-19.3.0.tgz",+ "integrity": "sha512-N0rFCuH9YoxG9/m61l9MfpJKfmLOVU0em7ipIz6TRgSSkvReLB9vL85GB+yr8Bs5leqpvg96JSwF4ZS1s4viQg==",+ "dev": true,+ "license": "MIT",+ "peer": true,+ "dependencies": {+ "csstype": "^3.2.2"+ }+ },+ "node_modules/@types/react-dom": {+ "version": "19.3.0",+ "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-19.3.0.tgz",+ "integrity": "sha512-ZI7bU42mZXXKHn/qNLEw2IrbiINU7X5+vfgdixBHkCNpYWXjKgfQ/P+uyGb5CjOLB9UcnTeg3rylQtV2hym44Q==",+ "dev": true,+ "license": "MIT",+ "peerDependencies": {+ "@types/react": "^19.3.0"+ }+ },+ "node_modules/@typescript/typescript-aix-ppc64": {+ "version": "7.0.2",+ "resolved": "https://registry.npmjs.org/@typescript/typescript-aix-ppc64/-/typescript-aix-ppc64-7.0.2.tgz",+ "integrity": "sha512-MTKKkWB7p/0E9xi1d1tHtZ5PiLkGEMIq88pK2CubZjOsLtYTLqhgIgi6zepFa+9GHZ6h05NMCkQxGKiPXMxXtQ==",+ "cpu": [+ "ppc64"+ ],+ "dev": true,+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "aix"+ ],+ "engines": {+ "node": ">=16.20.0"+ }+ },+ "node_modules/@typescript/typescript-darwin-arm64": {+ "version": "7.0.2",+ "resolved": "https://registry.npmjs.org/@typescript/typescript-darwin-arm64/-/typescript-darwin-arm64-7.0.2.tgz",+ "integrity": "sha512-gowzar9MwS/aRWp6f3a4KUqzRjAZjOsmGNCM6LcTgXum+dBfgsBVMN+AgvOCCbguXyick6LJhpBszxMebJ8syA==",+ "cpu": [+ "arm64"+ ],+ "dev": true,+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "darwin"+ ],+ "engines": {+ "node": ">=16.20.0"+ }+ },+ "node_modules/@typescript/typescript-darwin-x64": {+ "version": "7.0.2",+ "resolved": "https://registry.npmjs.org/@typescript/typescript-darwin-x64/-/typescript-darwin-x64-7.0.2.tgz",+ "integrity": "sha512-SZ9xZInqApNlNGc9s0W1VSsktYSOe9cFqNOIqmN1Gs8SmkjKZYFt017G4VwPxASInODuAdbTW7sXiFUf893RgA==",+ "cpu": [+ "x64"+ ],+ "dev": true,+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "darwin"+ ],+ "engines": {+ "node": ">=16.20.0"+ }+ },+ "node_modules/@typescript/typescript-freebsd-arm64": {+ "version": "7.0.2",+ "resolved": "https://registry.npmjs.org/@typescript/typescript-freebsd-arm64/-/typescript-freebsd-arm64-7.0.2.tgz",+ "integrity": "sha512-W5NH4y/J0plIIS5b2xvTEkU7JFxyqdMAOgf+Ilhl0vHQXKO5dZoxd+C/jEtq56c4F3wk71RB4BMRQ2XdI+bwYQ==",+ "cpu": [+ "arm64"+ ],+ "dev": true,+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "freebsd"+ ],+ "engines": {+ "node": ">=16.20.0"+ }+ },+ "node_modules/@typescript/typescript-freebsd-x64": {+ "version": "7.0.2",+ "resolved": "https://registry.npmjs.org/@typescript/typescript-freebsd-x64/-/typescript-freebsd-x64-7.0.2.tgz",+ "integrity": "sha512-UMGDx5sTpzNw3WiPebH7l90IWfJggEd+egHt/q6p7/Cm3zqoV7VxkGXt+3DxPIw8CcmvAB0j3sVVfbhX+M4Tpw==",+ "cpu": [+ "x64"+ ],+ "dev": true,+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "freebsd"+ ],+ "engines": {+ "node": ">=16.20.0"+ }+ },+ "node_modules/@typescript/typescript-linux-arm": {+ "version": "7.0.2",+ "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-arm/-/typescript-linux-arm-7.0.2.tgz",+ "integrity": "sha512-gffT3xPz9sR7j/YJExkyPntrI0P2EP9XbOyWzth2/Gs0RstK+90RBcO0ncXoXy/beYll1SXw846Nf2zdnEz0QQ==",+ "cpu": [+ "arm"+ ],+ "dev": true,+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">=16.20.0"+ }+ },+ "node_modules/@typescript/typescript-linux-arm64": {+ "version": "7.0.2",+ "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-arm64/-/typescript-linux-arm64-7.0.2.tgz",+ "integrity": "sha512-Qh4eU4/y3yDjnfjjyPYihMj5/ODIlmt+Bzu17OI+fiSRDW57QmU5SiN63exPRNJPKUzcc1INa1NXdrJ+MqHjUQ==",+ "cpu": [+ "arm64"+ ],+ "dev": true,+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">=16.20.0"+ }+ },+ "node_modules/@typescript/typescript-linux-loong64": {+ "version": "7.0.2",+ "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-loong64/-/typescript-linux-loong64-7.0.2.tgz",+ "integrity": "sha512-uEHck9i8hoAzXPiYRib1O7miOnz23SxIeVl6F4LXox+qov1K35jHcEW6VHKvZI+pyvl7fZEP4MCU5LYvIq1GuQ==",+ "cpu": [+ "loong64"+ ],+ "dev": true,+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">=16.20.0"+ }+ },+ "node_modules/@typescript/typescript-linux-mips64el": {+ "version": "7.0.2",+ "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-mips64el/-/typescript-linux-mips64el-7.0.2.tgz",+ "integrity": "sha512-R4KvAMnE43W5Qeqb0Ly56O3mWMWIAgsMyz36DCaycd5nbg/9kzm0liw3JocfRqyJY0KPmzFjbswozXyW0DnIYA==",+ "cpu": [+ "mips64el"+ ],+ "dev": true,+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">=16.20.0"+ }+ },+ "node_modules/@typescript/typescript-linux-ppc64": {+ "version": "7.0.2",+ "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-ppc64/-/typescript-linux-ppc64-7.0.2.tgz",+ "integrity": "sha512-DORx5b3sd/4S7eayxm4FQv+A7CrkUIGRaHiwI8oiHTAI1fAPWhF4J0vAlkC8biAlHSVVwxMQ3tjZ2/DVbnQiiA==",+ "cpu": [+ "ppc64"+ ],+ "dev": true,+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">=16.20.0"+ }+ },+ "node_modules/@typescript/typescript-linux-riscv64": {+ "version": "7.0.2",+ "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-riscv64/-/typescript-linux-riscv64-7.0.2.tgz",+ "integrity": "sha512-wf0jqEDOjrPRnKwYRyyJDRo11KMbvMFrU+q4zqKyChODBzvlkbhNQfKvLxQCcwTpdDaXSHZTVuh0JoCrKCUMHQ==",+ "cpu": [+ "riscv64"+ ],+ "dev": true,+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">=16.20.0"+ }+ },+ "node_modules/@typescript/typescript-linux-s390x": {+ "version": "7.0.2",+ "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-s390x/-/typescript-linux-s390x-7.0.2.tgz",+ "integrity": "sha512-IkwJc3L7yhytWd/ewjyxNDfOmswCm9GWMJT/ue/dU4aZNbwZeYAetq42VyLmsmSjvoX7z74X6ZaYCtzAr0EuGw==",+ "cpu": [+ "s390x"+ ],+ "dev": true,+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">=16.20.0"+ }+ },+ "node_modules/@typescript/typescript-linux-x64": {+ "version": "7.0.2",+ "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-x64/-/typescript-linux-x64-7.0.2.tgz",+ "integrity": "sha512-EYdf2cNg7rgCWJnxCdJ+F3V39O8ihb37eHAu1LK8oAFizgTQbPOK7zHHXbPt8rX24COqODXeI3sIf0fCXG7H/A==",+ "cpu": [+ "x64"+ ],+ "dev": true,+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">=16.20.0"+ }+ },+ "node_modules/@typescript/typescript-netbsd-arm64": {+ "version": "7.0.2",+ "resolved": "https://registry.npmjs.org/@typescript/typescript-netbsd-arm64/-/typescript-netbsd-arm64-7.0.2.tgz",+ "integrity": "sha512-+polYF4MF04aPpO5FTkHran9yUQDSXqy5GiSDKpsll5jy3l3+g9QLhpf39T+ePtefhXLOGrLl0QIjkQP6VnelA==",+ "cpu": [+ "arm64"+ ],+ "dev": true,+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "netbsd"+ ],+ "engines": {+ "node": ">=16.20.0"+ }+ },+ "node_modules/@typescript/typescript-netbsd-x64": {+ "version": "7.0.2",+ "resolved": "https://registry.npmjs.org/@typescript/typescript-netbsd-x64/-/typescript-netbsd-x64-7.0.2.tgz",+ "integrity": "sha512-8YIT0EHM/3dq10ZOVF/A7pc/YSMtbcecct4rWtexrnSCHOPcpC2KTLXfTCR6vDpnSiY12heNb1GiN/wu+T/FyA==",+ "cpu": [+ "x64"+ ],+ "dev": true,+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "netbsd"+ ],+ "engines": {+ "node": ">=16.20.0"+ }+ },+ "node_modules/@typescript/typescript-openbsd-arm64": {+ "version": "7.0.2",+ "resolved": "https://registry.npmjs.org/@typescript/typescript-openbsd-arm64/-/typescript-openbsd-arm64-7.0.2.tgz",+ "integrity": "sha512-APT8+ClYnuYm1u9+kgGXoMj2VzWzcymwh2gNSQVySHfkRDGOTVkoWLjCmOQSaO+PoqQ57B0flRp9SA+7GnnkzQ==",+ "cpu": [+ "arm64"+ ],+ "dev": true,+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "openbsd"+ ],+ "engines": {+ "node": ">=16.20.0"+ }+ },+ "node_modules/@typescript/typescript-openbsd-x64": {+ "version": "7.0.2",+ "resolved": "https://registry.npmjs.org/@typescript/typescript-openbsd-x64/-/typescript-openbsd-x64-7.0.2.tgz",+ "integrity": "sha512-yX7s+Q0Dln0Dt9tEzZsAjXXR/+ytBM7AlglaqyeMPxQszJ1JhlJdZ6jLA+IzldHtflX81em7lDao1xXu+aRRkg==",+ "cpu": [+ "x64"+ ],+ "dev": true,+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "openbsd"+ ],+ "engines": {+ "node": ">=16.20.0"+ }+ },+ "node_modules/@typescript/typescript-sunos-x64": {+ "version": "7.0.2",+ "resolved": "https://registry.npmjs.org/@typescript/typescript-sunos-x64/-/typescript-sunos-x64-7.0.2.tgz",+ "integrity": "sha512-dLJDGaLZ1D4HPQn62u1n8mBDkJREwMsAkCdkwd4Ieqw+x3TUyTsqY0YiBCtE6H6OzzgGk3iuZ3vFWRS+E8/d1g==",+ "cpu": [+ "x64"+ ],+ "dev": true,+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "sunos"+ ],+ "engines": {+ "node": ">=16.20.0"+ }+ },+ "node_modules/@typescript/typescript-win32-arm64": {+ "version": "7.0.2",+ "resolved": "https://registry.npmjs.org/@typescript/typescript-win32-arm64/-/typescript-win32-arm64-7.0.2.tgz",+ "integrity": "sha512-Gyl1Vy6OsWesLzmq+EP0Fb7b4Nid5232AvcA2SFcdYreldpNtYFFofPjnt62y9hQy7VTaZp65ICJjuAQRaVcIQ==",+ "cpu": [+ "arm64"+ ],+ "dev": true,+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "win32"+ ],+ "engines": {+ "node": ">=16.20.0"+ }+ },+ "node_modules/@typescript/typescript-win32-x64": {+ "version": "7.0.2",+ "resolved": "https://registry.npmjs.org/@typescript/typescript-win32-x64/-/typescript-win32-x64-7.0.2.tgz",+ "integrity": "sha512-0BQ3HkAHHlKLSp1qRvf3SUhGpGsDuhB/jgFw75guyqbxJqEaS0Cw/VFO8i2nHglJUzQCRtMMR/IBAKE3ETMC4g==",+ "cpu": [+ "x64"+ ],+ "dev": true,+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "win32"+ ],+ "engines": {+ "node": ">=16.20.0"+ }+ },+ "node_modules/baseline-browser-mapping": {+ "version": "2.11.29",+ "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.11.29.tgz",+ "integrity": "sha512-YeesxhUmR4h5y5V8KF8iBCqJb8YFrBJ++XBTeGcWIaQOYXGN19JM0FoiOjAhwuDoln8owMgXcWBmgHtYSkky2w==",+ "license": "Apache-2.0",+ "bin": {+ "baseline-browser-mapping": "dist/cli.cjs"+ },+ "engines": {+ "node": ">=6.0.0"+ }+ },+ "node_modules/caniuse-lite": {+ "version": "1.0.30001816",+ "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001816.tgz",+ "integrity": "sha512-+8Yx7BXCoqk6IF8yTicjfUR6D/ldJzdlsodlEOiOSPmhK844WIgk67/zIQaGAOxNkZyyvBlrRFnLvqKIoqbAFw==",+ "funding": [+ {+ "type": "opencollective",+ "url": "https://opencollective.com/browserslist"+ },+ {+ "type": "tidelift",+ "url": "https://tidelift.com/funding/github/npm/caniuse-lite"+ },+ {+ "type": "github",+ "url": "https://github.com/sponsors/ai"+ }+ ],+ "license": "CC-BY-4.0"+ },+ "node_modules/client-only": {+ "version": "0.0.1",+ "resolved": "https://registry.npmjs.org/client-only/-/client-only-0.0.1.tgz",+ "integrity": "sha512-IV3Ou0jSMzZrd3pZ48nLkT9DA7Ag1pnPzaiQhpW7c3RbcqqzvzzVu+L8gfqMp/8IM2MQtSiqaCxrrcfu8I8rMA==",+ "license": "MIT"+ },+ "node_modules/csstype": {+ "version": "3.2.3",+ "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz",+ "integrity": "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/detect-libc": {+ "version": "2.1.2",+ "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz",+ "integrity": "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==",+ "license": "Apache-2.0",+ "optional": true,+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/eventsource-parser": {+ "version": "4.1.2",+ "resolved": "https://registry.npmjs.org/eventsource-parser/-/eventsource-parser-4.1.2.tgz",+ "integrity": "sha512-N9b0EvATDJfZj+Szg3m8WwqseQhei/mtTd6V0rCciGbI/yG24o3yBk0YVyfOZZsLVMZHWs++Zk3Aqd2y2EztnQ==",+ "license": "MIT",+ "engines": {+ "node": ">=22.12"+ }+ },+ "node_modules/hash-wasm": {+ "version": "4.12.0",+ "resolved": "https://registry.npmjs.org/hash-wasm/-/hash-wasm-4.12.0.tgz",+ "integrity": "sha512-+/2B2rYLb48I/evdOIhP+K/DD2ca2fgBjp6O+GBEnCDk2e4rpeXIK8GvIyRPjTezgmWn9gmKwkQjjx6BtqDHVQ==",+ "license": "MIT"+ },+ "node_modules/nanoid": {+ "version": "3.3.20",+ "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.20.tgz",+ "integrity": "sha512-uKdg2G3GNCKQn9byYOpxbGqrT2fGO5KRt5J/8b3pok8rT6qxGWF6hxMyJiEYtAf+FVyYuD9hRaDqX5uPFYJ4ZQ==",+ "funding": [+ {+ "type": "github",+ "url": "https://github.com/sponsors/ai"+ }+ ],+ "license": "MIT",+ "bin": {+ "nanoid": "bin/nanoid.cjs"+ },+ "engines": {+ "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1"+ }+ },+ "node_modules/next": {+ "version": "16.4.2",+ "resolved": "https://registry.npmjs.org/next/-/next-16.4.2.tgz",+ "integrity": "sha512-r+oBJojfefUjOiWkBhXgLS+igxX/7BWyK59uHnyOyplMSLtBZ+QLP3okrdYTbrfrbrmNTVWLBPaHDX9KRaIt3w==",+ "license": "MIT",+ "dependencies": {+ "@next/env": "16.4.2",+ "@swc/helpers": "0.5.23",+ "baseline-browser-mapping": "^2.9.19",+ "caniuse-lite": "^1.0.30001579",+ "postcss": "8.5.23",+ "styled-jsx": "5.1.6"+ },+ "bin": {+ "next": "dist/bin/next"+ },+ "engines": {+ "node": ">=20.9.0"+ },+ "optionalDependencies": {+ "@next/swc-darwin-arm64": "16.4.2",+ "@next/swc-darwin-x64": "16.4.2",+ "@next/swc-linux-arm64-gnu": "16.4.2",+ "@next/swc-linux-arm64-musl": "16.4.2",+ "@next/swc-linux-x64-gnu": "16.4.2",+ "@next/swc-linux-x64-musl": "16.4.2",+ "@next/swc-win32-arm64-msvc": "16.4.2",+ "@next/swc-win32-x64-msvc": "16.4.2",+ "sharp": "^0.35.5"+ },+ "peerDependencies": {+ "@opentelemetry/api": "^1.1.0",+ "@playwright/test": "^1.51.1",+ "babel-plugin-react-compiler": "*",+ "react": "^18.2.0 || 19.0.0-rc-de68d2f4-20241204 || ^19.0.0",+ "react-dom": "^18.2.0 || 19.0.0-rc-de68d2f4-20241204 || ^19.0.0",+ "sass": "^1.3.0"+ },+ "peerDependenciesMeta": {+ "@opentelemetry/api": {+ "optional": true+ },+ "@playwright/test": {+ "optional": true+ },+ "babel-plugin-react-compiler": {+ "optional": true+ },+ "sass": {+ "optional": true+ }+ }+ },+ "node_modules/picocolors": {+ "version": "1.1.1",+ "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz",+ "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==",+ "license": "ISC"+ },+ "node_modules/postcss": {+ "version": "8.5.23",+ "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.23.tgz",+ "integrity": "sha512-g50586zr4bZmwFiTlflMu8E0bDTb5I5gertgwAKmsdUlTQIhZtunzUlD1WSzwcVWPoAVpsrA6vlfCD7oXvRwgg==",+ "funding": [+ {+ "type": "opencollective",+ "url": "https://opencollective.com/postcss/"+ },+ {+ "type": "tidelift",+ "url": "https://tidelift.com/funding/github/npm/postcss"+ },+ {+ "type": "github",+ "url": "https://github.com/sponsors/ai"+ }+ ],+ "license": "MIT",+ "dependencies": {+ "nanoid": "^3.3.16",+ "picocolors": "^1.1.1",+ "source-map-js": "^1.2.1"+ },+ "engines": {+ "node": "^10 || ^12 || >=14"+ }+ },+ "node_modules/react": {+ "version": "19.3.1",+ "resolved": "https://registry.npmjs.org/react/-/react-19.3.1.tgz",+ "integrity": "sha512-QNhWdt7nrgVWWQG58QuGsAR3jv3Hbe4mb4vz7w2csnHavciZJgda1CPNaldF6eVxv90ud3jUXpKlHL69gO38yw==",+ "license": "MIT",+ "peer": true,+ "engines": {+ "node": ">=0.10.0"+ }+ },+ "node_modules/react-dom": {+ "version": "19.3.1",+ "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.3.1.tgz",+ "integrity": "sha512-Y0bARz53lhEC1NMCASs0/j+faB/zqt3R8hpvg1e8+61ZVJ4UL0UdC4cBbXfZMcIuhrfgeILTLe+ZeBCavQPtKQ==",+ "license": "MIT",+ "peer": true,+ "dependencies": {+ "scheduler": "^0.28.0"+ },+ "peerDependencies": {+ "react": "^19.3.1"+ }+ },+ "node_modules/scheduler": {+ "version": "0.28.0",+ "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.28.0.tgz",+ "integrity": "sha512-juorfCmIkIw8tT+p5BXSm6PJjQF/ycEYmKyzURCIt/RaZIhL+PulbQ9Yu2z1HdOJDdqDTlxA1+xKBmHXJsczAw==",+ "license": "MIT"+ },+ "node_modules/semver": {+ "version": "7.8.5",+ "resolved": "https://registry.npmjs.org/semver/-/semver-7.8.5.tgz",+ "integrity": "sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA==",+ "license": "ISC",+ "optional": true,+ "bin": {+ "semver": "bin/semver.js"+ },+ "engines": {+ "node": ">=10"+ }+ },+ "node_modules/sharp": {+ "version": "0.35.5",+ "resolved": "https://registry.npmjs.org/sharp/-/sharp-0.35.5.tgz",+ "integrity": "sha512-Ywn4OnzGukp7CDMrp08RQ50YKmuwG47brZgIVPTvBaaAfQlRlygrRqSrxdCiL9M+LlzLBiJ68IR1QqvzHyjC7g==",+ "license": "Apache-2.0",+ "optional": true,+ "dependencies": {+ "@img/colour": "^1.1.0",+ "detect-libc": "^2.1.2",+ "semver": "^7.8.5"+ },+ "engines": {+ "node": ">=20.9.0"+ },+ "funding": {+ "url": "https://opencollective.com/libvips"+ },+ "optionalDependencies": {+ "@img/sharp-darwin-arm64": "0.35.5",+ "@img/sharp-darwin-x64": "0.35.5",+ "@img/sharp-freebsd-wasm32": "0.35.5",+ "@img/sharp-libvips-darwin-arm64": "1.3.4",+ "@img/sharp-libvips-darwin-x64": "1.3.4",+ "@img/sharp-libvips-linux-arm": "1.3.4",+ "@img/sharp-libvips-linux-arm64": "1.3.4",+ "@img/sharp-libvips-linux-ppc64": "1.3.4",+ "@img/sharp-libvips-linux-riscv64": "1.3.4",+ "@img/sharp-libvips-linux-s390x": "1.3.4",+ "@img/sharp-libvips-linux-x64": "1.3.4",+ "@img/sharp-libvips-linuxmusl-arm64": "1.3.4",+ "@img/sharp-libvips-linuxmusl-x64": "1.3.4",+ "@img/sharp-linux-arm": "0.35.5",+ "@img/sharp-linux-arm64": "0.35.5",+ "@img/sharp-linux-ppc64": "0.35.5",+ "@img/sharp-linux-riscv64": "0.35.5",+ "@img/sharp-linux-s390x": "0.35.5",+ "@img/sharp-linux-x64": "0.35.5",+ "@img/sharp-linuxmusl-arm64": "0.35.5",+ "@img/sharp-linuxmusl-x64": "0.35.5",+ "@img/sharp-webcontainers-wasm32": "0.35.5",+ "@img/sharp-win32-arm64": "0.35.5",+ "@img/sharp-win32-ia32": "0.35.5",+ "@img/sharp-win32-x64": "0.35.5"+ },+ "peerDependenciesMeta": {+ "@types/node": {+ "optional": true+ }+ }+ },+ "node_modules/source-map-js": {+ "version": "1.2.2",+ "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.2.tgz",+ "integrity": "sha512-KGj/8Y43x35aZVDtt+J4mK1hoLGHULMYfSkODJNQjNDC3oW1PqPoxMwo0pLUsWM/UEGzON/NxeHywEfNXNP3Vw==",+ "license": "BSD-3-Clause",+ "engines": {+ "node": ">=0.10.0"+ }+ },+ "node_modules/styled-jsx": {+ "version": "5.1.6",+ "resolved": "https://registry.npmjs.org/styled-jsx/-/styled-jsx-5.1.6.tgz",+ "integrity": "sha512-qSVyDTeMotdvQYoHWLNGwRFJHC+i+ZvdBRYosOFgC+Wg1vx4frN2/RG/NA7SYqqvKNLf39P2LSRA2pu6n0XYZA==",+ "license": "MIT",+ "dependencies": {+ "client-only": "0.0.1"+ },+ "engines": {+ "node": ">= 12.0.0"+ },+ "peerDependencies": {+ "react": ">= 16.8.0 || 17.x.x || ^18.0.0-0 || ^19.0.0-0"+ },+ "peerDependenciesMeta": {+ "@babel/core": {+ "optional": true+ },+ "babel-plugin-macros": {+ "optional": true+ }+ }+ },+ "node_modules/tslib": {+ "version": "2.8.1",+ "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz",+ "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==",+ "license": "0BSD"+ },+ "node_modules/typescript": {+ "version": "7.0.2",+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-7.0.2.tgz",+ "integrity": "sha512-8FYau96o3NKOhbjKi/qNvG/W5jhzxkbdm5sj9AbZ/5T5sWqn3hJgLfGx27sRKZWTvyzCP8dLRBTf5tBTSRVUNA==",+ "dev": true,+ "license": "Apache-2.0",+ "bin": {+ "tsc": "bin/tsc"+ },+ "engines": {+ "node": ">=16.20.0"+ },+ "optionalDependencies": {+ "@typescript/typescript-aix-ppc64": "7.0.2",+ "@typescript/typescript-darwin-arm64": "7.0.2",+ "@typescript/typescript-darwin-x64": "7.0.2",+ "@typescript/typescript-freebsd-arm64": "7.0.2",+ "@typescript/typescript-freebsd-x64": "7.0.2",+ "@typescript/typescript-linux-arm": "7.0.2",+ "@typescript/typescript-linux-arm64": "7.0.2",+ "@typescript/typescript-linux-loong64": "7.0.2",+ "@typescript/typescript-linux-mips64el": "7.0.2",+ "@typescript/typescript-linux-ppc64": "7.0.2",+ "@typescript/typescript-linux-riscv64": "7.0.2",+ "@typescript/typescript-linux-s390x": "7.0.2",+ "@typescript/typescript-linux-x64": "7.0.2",+ "@typescript/typescript-netbsd-arm64": "7.0.2",+ "@typescript/typescript-netbsd-x64": "7.0.2",+ "@typescript/typescript-openbsd-arm64": "7.0.2",+ "@typescript/typescript-openbsd-x64": "7.0.2",+ "@typescript/typescript-sunos-x64": "7.0.2",+ "@typescript/typescript-win32-arm64": "7.0.2",+ "@typescript/typescript-win32-x64": "7.0.2"+ }+ },+ "node_modules/undici-types": {+ "version": "8.9.0",+ "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-8.9.0.tgz",+ "integrity": "sha512-KTDyRTYX8sWmKXAikPHHSyc63CRPETMctyjKFupcC6OBLXT3xsN0e9aF7m+mIXutFWpUXuedtowG7iLOzp0kQg==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/zod": {+ "version": "4.6.7",+ "resolved": "https://registry.npmjs.org/zod/-/zod-4.6.7.tgz",+ "integrity": "sha512-g8W2D2kU6a8untc053fX1uVBKzM7yqAxW/3zwk83+6RyF2+SKOuV+c0wBDhUwzV1PaGapmZH+rmcUzPf+3CGwg==",+ "license": "MIT",+ "funding": {+ "url": "https://github.com/sponsors/colinhacks"+ }+ }+ }+}diff --git a/package.json b/package.jsonnew file mode 100644index 0000000..69e2959--- /dev/null+++ b/package.json@@ -0,0 +1,27 @@+{+ "name": "openjutsu",+ "private": true,+ "type": "module",+ "scripts": {+ "dev": "next dev --hostname 127.0.0.1",+ "build": "next build",+ "start": "next start --hostname 127.0.0.1",+ "test": "node --test --experimental-strip-types test/*.test.ts && tsc --noEmit"+ },+ "engines": {+ "node": ">=22.6.0"+ },+ "dependencies": {+ "@comfyorg/sdk": "0.5.0",+ "next": "^16.4.2",+ "react": "^19.3.1",+ "react-dom": "^19.3.1"+ },+ "devDependencies": {+ "@types/node": "^26.6.5",+ "@types/react": "^19.3.0",+ "@types/react-dom": "^19.3.0",+ "typescript": "^7.0.2"+ },+ "license": "MIT"+}diff --git a/test/simple.test.ts b/test/simple.test.tsnew file mode 100644index 0000000..1eb239e--- /dev/null+++ b/test/simple.test.ts@@ -0,0 +1,54 @@+import assert from "node:assert/strict";+import { readFileSync } from "node:fs";+import test from "node:test";+import { clipCount } from "../lib/clips.ts";+import { nodeDescriber } from "../lib/progress.ts";+import { NODES, pruneSimple, rolesText, type ApiGraph, type SimpleSettings } from "../lib/simple.ts";++const graph: ApiGraph = JSON.parse(readFileSync(new URL("../workflows/simple.api.json", import.meta.url), "utf8"));+const settings = (roles: string[], hatFix = false): SimpleSettings => ({ roles, resolution: "480p", hatFix, seed: 7, clipSeconds: 6 });++test("one picture without hat fix drops pictures 2-4 and the hat nodes", () => {+ const pruned = pruneSimple(graph, settings(["the singer"]));+ for (const id of ["5", "6", "7", "8", "9", "10", "11", "12", "13", ...NODES.hat]) assert.equal(pruned[id], undefined);+ const plan = pruned[NODES.plan].inputs;+ assert.deepEqual(Object.keys(plan).filter((k) => k.startsWith("picture_")), ["picture_1", "picture_1_text"]);+ assert.deepEqual(Object.keys(pruned[NODES.reference].inputs).filter((k) => k.startsWith("ref_images.")), ["ref_images.ref_image_0"]);+ assert.deepEqual(pruned[NODES.growMask].inputs.mask, [NODES.peopleMask, 0]);+ assert.equal(plan.resolution, "480p");+ assert.equal(plan.seed, 7);+ assert.equal(plan.roles, "the singer");+ assert.ok(graph["13"], "the source graph is not modified");+});++test("four pictures with hat fix keep the full graph", () => {+ const pruned = pruneSimple(graph, settings(["", "", "", ""], true));+ assert.equal(Object.keys(pruned).length, Object.keys(graph).length);+ assert.deepEqual(pruned[NODES.growMask].inputs.mask, ["56", 0]);+ assert.equal(pruned[NODES.plan].inputs.roles, "");+});++test("blank roles keep their line with the plan's own fallback", () => {+ assert.equal(rolesText(["", " the drummer "]), "the person with the most screen time\nthe drummer");+ assert.equal(rolesText(["", ""]), "");+});++test("node ids map to titles and clip numbers", () => {+ const describe = nodeDescriber(graph);+ assert.deepEqual(describe("4"), { title: "Describe picture 1", classType: "TextGenerate", clip: null });+ assert.equal(describe("64")?.clip, 1);+ assert.equal(describe("70.0.0.64")?.clip, 2);+ assert.equal(describe("70.0.0.Recurse.0.0.64")?.clip, 3);+ assert.equal(describe("70.0.0.Recurse")?.title, "Loop End");+ assert.equal(describe("71")?.clip, null);+});++test("clip count follows the Swap Plan grid", () => {+ assert.equal(clipCount(6, 6), 1);+ assert.equal(clipCount(16, 6), 4);+});++test("clip count matches the Python plan on longer videos", () => {+ assert.equal(clipCount(30, 6), 7);+ assert.equal(clipCount(10, 15), 1);+});diff --git a/tsconfig.json b/tsconfig.jsonnew file mode 100644index 0000000..acb5504--- /dev/null+++ b/tsconfig.json@@ -0,0 +1,41 @@+{+ "compilerOptions": {+ "target": "ES2022",+ "lib": [+ "dom",+ "dom.iterable",+ "es2022"+ ],+ "allowJs": false,+ "skipLibCheck": true,+ "strict": true,+ "noEmit": true,+ "module": "esnext",+ "moduleResolution": "bundler",+ "resolveJsonModule": true,+ "isolatedModules": true,+ "allowImportingTsExtensions": true,+ "jsx": "react-jsx",+ "incremental": true,+ "plugins": [+ {+ "name": "next"+ }+ ],+ "esModuleInterop": true+ },+ "include": [+ "next-env.d.ts",+ "app/**/*.ts",+ "app/**/*.tsx",+ "components/**/*.ts",+ "components/**/*.tsx",+ "lib/**/*.ts",+ "test/**/*.ts",+ ".next/types/**/*.ts",+ ".next/dev/types/**/*.ts"+ ],+ "exclude": [+ "node_modules"+ ]+}diff --git a/workflows/simple.api.json b/workflows/simple.api.jsonnew file mode 100644index 0000000..28c3ba1--- /dev/null+++ b/workflows/simple.api.json@@ -0,0 +1,1259 @@+{+ "2": {+ "inputs": {+ "image": "Twilight Rest Stop Portrait.png"+ },+ "class_type": "LoadImage",+ "_meta": {+ "title": "Picture 1"+ }+ },+ "3": {+ "inputs": {+ "upscale_method": "area",+ "largest_size": 768,+ "image": [+ "2",+ 0+ ]+ },+ "class_type": "ImageScaleToMaxDimension",+ "_meta": {+ "title": "Shrink for the describer"+ }+ },+ "4": {+ "inputs": {+ "prompt": "Describe the person in this picture for a casting sheet, in one sentence of about 40 words: apparent age and gender, hair, facial hair, skin tone, build, and their complete outfit including footwear. No preamble, no background.",+ "max_length": 120,+ "sampling_mode": "off",+ "thinking": false,+ "use_default_template": true,+ "mtp": "auto",+ "clip": [+ "22",+ 0+ ],+ "image": [+ "3",+ 0+ ]+ },+ "class_type": "TextGenerate",+ "_meta": {+ "title": "Describe picture 1"+ }+ },+ "5": {+ "inputs": {+ "image": "Gemini_Generated_Image_afg9p7afg9p7afg9.png"+ },+ "class_type": "LoadImage",+ "_meta": {+ "title": "Picture 2"+ }+ },+ "6": {+ "inputs": {+ "upscale_method": "area",+ "largest_size": 768,+ "image": [+ "5",+ 0+ ]+ },+ "class_type": "ImageScaleToMaxDimension",+ "_meta": {+ "title": "Shrink for the describer"+ }+ },+ "7": {+ "inputs": {+ "prompt": "Describe the person in this picture for a casting sheet, in one sentence of about 40 words: apparent age and gender, hair, facial hair, skin tone, build, and their complete outfit including footwear. No preamble, no background.",+ "max_length": 120,+ "sampling_mode": "off",+ "thinking": false,+ "use_default_template": true,+ "mtp": "auto",+ "clip": [+ "22",+ 0+ ],+ "image": [+ "6",+ 0+ ]+ },+ "class_type": "TextGenerate",+ "_meta": {+ "title": "Describe picture 2"+ }+ },+ "8": {+ "inputs": {+ "image": "example.png"+ },+ "class_type": "LoadImage",+ "_meta": {+ "title": "Picture 3"+ }+ },+ "9": {+ "inputs": {+ "upscale_method": "area",+ "largest_size": 768,+ "image": [+ "8",+ 0+ ]+ },+ "class_type": "ImageScaleToMaxDimension",+ "_meta": {+ "title": "Shrink for the describer"+ }+ },+ "10": {+ "inputs": {+ "prompt": "Describe the person in this picture for a casting sheet, in one sentence of about 40 words: apparent age and gender, hair, facial hair, skin tone, build, and their complete outfit including footwear. No preamble, no background.",+ "max_length": 120,+ "sampling_mode": "off",+ "thinking": false,+ "use_default_template": true,+ "mtp": "auto",+ "clip": [+ "22",+ 0+ ],+ "image": [+ "9",+ 0+ ]+ },+ "class_type": "TextGenerate",+ "_meta": {+ "title": "Describe picture 3"+ }+ },+ "11": {+ "inputs": {+ "image": "example.png"+ },+ "class_type": "LoadImage",+ "_meta": {+ "title": "Picture 4"+ }+ },+ "12": {+ "inputs": {+ "upscale_method": "area",+ "largest_size": 768,+ "image": [+ "11",+ 0+ ]+ },+ "class_type": "ImageScaleToMaxDimension",+ "_meta": {+ "title": "Shrink for the describer"+ }+ },+ "13": {+ "inputs": {+ "prompt": "Describe the person in this picture for a casting sheet, in one sentence of about 40 words: apparent age and gender, hair, facial hair, skin tone, build, and their complete outfit including footwear. No preamble, no background.",+ "max_length": 120,+ "sampling_mode": "off",+ "thinking": false,+ "use_default_template": true,+ "mtp": "auto",+ "clip": [+ "22",+ 0+ ],+ "image": [+ "12",+ 0+ ]+ },+ "class_type": "TextGenerate",+ "_meta": {+ "title": "Describe picture 4"+ }+ },+ "14": {+ "inputs": {+ "video": "generation.mp4",+ "force_rate": 24,+ "custom_width": 0,+ "custom_height": 0,+ "frame_load_cap": 0,+ "skip_first_frames": 0,+ "select_every_nth": 1,+ "format": "None"+ },+ "class_type": "VHS_LoadVideo",+ "_meta": {+ "title": "Source video (people get replaced)"+ }+ },+ "15": {+ "inputs": {+ "start_index": 0,+ "duration": 2048,+ "audio": [+ "14",+ 2+ ]+ },+ "class_type": "TrimAudioDuration",+ "_meta": {+ "title": "Soundtrack (whole video)"+ }+ },+ "16": {+ "inputs": {+ "select_every_nth": 48,+ "skip_first_images": 24,+ "images": [+ "14",+ 0+ ]+ },+ "class_type": "VHS_SelectEveryNthImage",+ "_meta": {+ "title": "One frame every 2 s"+ }+ },+ "17": {+ "inputs": {+ "batch_index": 0,+ "length": 20,+ "image": [+ "16",+ 0+ ]+ },+ "class_type": "ImageFromBatch",+ "_meta": {+ "title": "At most 20 frames"+ }+ },+ "18": {+ "inputs": {+ "upscale_method": "area",+ "largest_size": 640,+ "image": [+ "17",+ 0+ ]+ },+ "class_type": "ImageScaleToMaxDimension",+ "_meta": {+ "title": "Shrink for the describer"+ }+ },+ "19": {+ "inputs": {+ "prompt": "These are frames from one video, in time order. List the people who appear most, up to four, the person with the most screen time first. Write one numbered line per person: first their role in the video in two to four words, without gender, that stays true in every shot, then \" - \" and how they look, like \"1. the guitarist - tall man with a grey beard in a denim jacket\". Each person appears once. Output only the list.",+ "max_length": 160,+ "sampling_mode": "off",+ "thinking": false,+ "use_default_template": true,+ "mtp": "auto",+ "clip": [+ "22",+ 0+ ],+ "image": [+ "18",+ 0+ ]+ },+ "class_type": "TextGenerate",+ "_meta": {+ "title": "Who is in the video"+ }+ },+ "20": {+ "inputs": {+ "clip_seconds": 6,+ "overlap_frames": 39,+ "resolution": "736p",+ "steps": 6,+ "seed": 0,+ "roles": "",+ "source_frames": [+ "14",+ 0+ ],+ "picture_1": [+ "2",+ 0+ ],+ "picture_2": [+ "5",+ 0+ ],+ "picture_3": [+ "8",+ 0+ ],+ "picture_4": [+ "11",+ 0+ ],+ "picture_1_text": [+ "4",+ 0+ ],+ "picture_2_text": [+ "7",+ 0+ ],+ "picture_3_text": [+ "10",+ 0+ ],+ "picture_4_text": [+ "13",+ 0+ ],+ "video_people": [+ "19",+ 0+ ]+ },+ "class_type": "H3OneClickSwapPlan",+ "_meta": {+ "title": "Swap Plan (roles, seed, size)"+ }+ },+ "22": {+ "inputs": {+ "clip_name": "qwen3vl_8b_int8_convrot.safetensors",+ "type": "stable_diffusion",+ "device": "default"+ },+ "class_type": "CLIPLoader",+ "_meta": {+ "title": "Describer: Qwen3-VL 8B"+ }+ },+ "24": {+ "inputs": {+ "unet_name": "minimax_h3_ref2va_pruned_int8_convrot.safetensors",+ "weight_dtype": "default"+ },+ "class_type": "UNETLoader",+ "_meta": {+ "title": "H3 Diffusion Model"+ }+ },+ "25": {+ "inputs": {+ "lora_name": "minimax_h3_DMAD_4step_full_lora_avg_rank_39_bf16.safetensors",+ "strength_model": 1,+ "model": [+ "24",+ 0+ ]+ },+ "class_type": "LoraLoaderModelOnly",+ "_meta": {+ "title": "DMAD LoRA"+ }+ },+ "26": {+ "inputs": {+ "attention": "comfy kitchen attention",+ "model": [+ "25",+ 0+ ]+ },+ "class_type": "ModelAttentionBackend",+ "_meta": {+ "title": "Comfy Kitchen Attention"+ }+ },+ "27": {+ "inputs": {+ "shift_video": 12,+ "shift_audio": 2,+ "model": [+ "26",+ 0+ ]+ },+ "class_type": "MiniMaxH3SigmaShift",+ "_meta": {+ "title": "Sigma Shift"+ }+ },+ "28": {+ "inputs": {+ "clip_name": "qwen3vl_32b_minimax_h3_int4_convrot.safetensors",+ "type": "minimax",+ "device": "default"+ },+ "class_type": "CLIPLoader",+ "_meta": {+ "title": "H3 Text Encoder"+ }+ },+ "29": {+ "inputs": {+ "vae_name": "minimax_h3_video_vae_int8_convrot.safetensors"+ },+ "class_type": "VAELoader",+ "_meta": {+ "title": "Video VAE"+ }+ },+ "30": {+ "inputs": {+ "vae_name": "minimax_h3_audio_vae_fp32.safetensors"+ },+ "class_type": "VAELoader",+ "_meta": {+ "title": "Audio VAE"+ }+ },+ "31": {+ "inputs": {+ "sampler_name": "euler"+ },+ "class_type": "KSamplerSelect",+ "_meta": {+ "title": "Sampler"+ }+ },+ "32": {+ "inputs": {+ "ckpt_name": "sam3.1_multiplex_fp16.safetensors"+ },+ "class_type": "CheckpointLoaderSimple",+ "_meta": {+ "title": "SAM 3.1"+ }+ },+ "33": {+ "inputs": {+ "text": "person",+ "clip": [+ "32",+ 1+ ]+ },+ "class_type": "CLIPTextEncode",+ "_meta": {+ "title": "SAM: what to replace"+ }+ },+ "34": {+ "inputs": {+ "scene_continuity": "Hard picture + protected audio",+ "audio_profile": "Generate audio"+ },+ "class_type": "MiniMaxH3GenerationProfile",+ "_meta": {+ "title": "Generation Profile"+ }+ },+ "35": {+ "inputs": {+ "plan_json": "{\n \"shots\": [\n {\n \"id\": \"intro\",\n \"prompt\": \"Describe the opening shot.\"\n },\n {\n \"id\": \"continuation\",\n \"prompt\": \"Continue the same take.\"\n }\n ]\n}",+ "run_name": [+ "20",+ 3+ ],+ "generation_fingerprint": "",+ "width": [+ "20",+ 1+ ],+ "height": [+ "20",+ 2+ ],+ "encode_mode": "video",+ "crop": "center",+ "default_duration_seconds": 15,+ "default_steps": 6,+ "base_seed": 0,+ "segment_crf": 16,+ "video_blend_frames": 0,+ "chain_policy": [+ "34",+ 0+ ],+ "plan_json_input": [+ "20",+ 0+ ]+ },+ "class_type": "MiniMaxH3ChainPlanModern",+ "_meta": {+ "title": "Production Plan (filled by Swap Plan)"+ }+ },+ "36": {+ "inputs": {+ "video_path": "",+ "audio_path": "",+ "embedded_audio": "auto",+ "skip_first_frames": 0,+ "source_audio": [+ "15",+ 0+ ]+ },+ "class_type": "MiniMaxH3SourceTimeline",+ "_meta": {+ "title": "Source soundtrack"+ }+ },+ "37": {+ "inputs": {+ "start_clip": 1,+ "scene_range": "",+ "verify_resume_history": true,+ "plan": [+ "35",+ 0+ ],+ "source_timeline": [+ "36",+ 0+ ]+ },+ "class_type": "MiniMaxH3ChainLoopStart",+ "_meta": {+ "title": "Loop Start"+ }+ },+ "38": {+ "inputs": {+ "align_audio_reference": false,+ "state": [+ "37",+ 1+ ]+ },+ "class_type": "MiniMaxH3ChainCurrent",+ "_meta": {+ "title": "Current Clip"+ }+ },+ "39": {+ "inputs": {+ "prompt": [+ "51",+ 0+ ],+ "width": [+ "38",+ 8+ ],+ "height": [+ "38",+ 9+ ],+ "length": [+ "38",+ 6+ ],+ "ref_image_size": "match",+ "clip": [+ "28",+ 0+ ],+ "vae": [+ "29",+ 0+ ],+ "audio_vae": [+ "30",+ 0+ ],+ "ref_images.ref_image_0": [+ "2",+ 0+ ],+ "ref_images.ref_image_1": [+ "5",+ 0+ ],+ "ref_images.ref_image_2": [+ "8",+ 0+ ],+ "ref_images.ref_image_3": [+ "11",+ 0+ ],+ "ref_videos.ref_video_0": [+ "47",+ 0+ ],+ "ref_video_audios.ref_video_audio_0": [+ "38",+ 12+ ]+ },+ "class_type": "MiniMaxH3ReferenceToVideo",+ "_meta": {+ "title": "Reference Conditioning"+ }+ },+ "40": {+ "inputs": {+ "source_fps": 24,+ "crop": "center",+ "state": [+ "38",+ 0+ ],+ "latent": [+ "39",+ 1+ ],+ "vae": [+ "29",+ 0+ ],+ "audio_vae": [+ "30",+ 0+ ],+ "source_frames": [+ "14",+ 0+ ],+ "source_audio": [+ "15",+ 0+ ]+ },+ "class_type": "MiniMaxH3ContexLoopSourceAVTarget",+ "_meta": {+ "title": "Source clip (frames + audio)"+ }+ },+ "41": {+ "inputs": {+ "upscale_method": "area",+ "largest_size": 512,+ "image": [+ "14",+ 0+ ]+ },+ "class_type": "ImageScaleToMaxDimension",+ "_meta": {+ "title": "Motion reference video (~512 px)"+ }+ },+ "42": {+ "inputs": {+ "expression": "round(a * 24)",+ "values.a": [+ "38",+ 10+ ]+ },+ "class_type": "ComfyMathExpression",+ "_meta": {+ "title": "Clip start frame"+ }+ },+ "43": {+ "inputs": {+ "batch_index": [+ "42",+ 1+ ],+ "length": [+ "38",+ 6+ ],+ "image": [+ "41",+ 0+ ]+ },+ "class_type": "ImageFromBatch",+ "_meta": {+ "title": "Motion reference for this clip"+ }+ },+ "44": {+ "inputs": {+ "noise_seed": [+ "38",+ 5+ ]+ },+ "class_type": "RandomNoise",+ "_meta": {+ "title": "Clip Seed"+ }+ },+ "45": {+ "inputs": {+ "detection_threshold": 0.35,+ "max_objects": 0,+ "detect_interval": 1,+ "images": [+ "43",+ 0+ ],+ "model": [+ "32",+ 0+ ],+ "conditioning": [+ "33",+ 0+ ]+ },+ "class_type": "SAM3_VideoTrack",+ "_meta": {+ "title": "SAM 3.1 track every person"+ }+ },+ "46": {+ "inputs": {+ "headroom": 0.2,+ "hold_frames": 4,+ "track_data": [+ "45",+ 0+ ]+ },+ "class_type": "H3PeopleMask",+ "_meta": {+ "title": "All tracked people (+ headroom per person)"+ }+ },+ "47": {+ "inputs": {+ "blur": 0.02,+ "images": [+ "43",+ 0+ ],+ "mask": [+ "48",+ 0+ ],+ "size": [+ "46",+ 1+ ]+ },+ "class_type": "H3GreyMannequins",+ "_meta": {+ "title": "Hide the original people (grey mannequins)"+ }+ },+ "48": {+ "inputs": {+ "expand": 10,+ "incremental_expandrate": 0,+ "tapered_corners": true,+ "flip_input": false,+ "blur_radius": 0,+ "lerp_alpha": 1,+ "decay_factor": 1,+ "fill_holes": true,+ "mask": [+ "56",+ 0+ ]+ },+ "class_type": "GrowMaskWithBlur",+ "_meta": {+ "title": "Grow mask (~25 px at full size)"+ }+ },+ "49": {+ "inputs": {+ "cut_threshold": 40,+ "images": [+ "43",+ 0+ ],+ "shot_prompt": [+ "20",+ 4+ ]+ },+ "class_type": "H3ClipShots",+ "_meta": {+ "title": "Find this clip's cuts"+ }+ },+ "50": {+ "inputs": {+ "prompt": [+ "49",+ 1+ ],+ "max_length": 500,+ "sampling_mode": "off",+ "thinking": false,+ "use_default_template": true,+ "mtp": "auto",+ "clip": [+ "22",+ 0+ ],+ "image": [+ "49",+ 0+ ]+ },+ "class_type": "TextGenerate",+ "_meta": {+ "title": "Write this clip's shot list (Qwen3-VL)"+ }+ },+ "51": {+ "inputs": {+ "prompt": [+ "38",+ 4+ ],+ "shots": [+ "50",+ 0+ ]+ },+ "class_type": "H3FillShots",+ "_meta": {+ "title": "Insert shot list into prompt"+ }+ },+ "52": {+ "inputs": {+ "source": [+ "51",+ 0+ ]+ },+ "class_type": "PreviewAny",+ "_meta": {+ "title": "Clip prompt (what H3 gets)"+ }+ },+ "53": {+ "inputs": {+ "text": "hat",+ "clip": [+ "32",+ 1+ ]+ },+ "class_type": "CLIPTextEncode",+ "_meta": {+ "title": "SAM: hats"+ }+ },+ "54": {+ "inputs": {+ "detection_threshold": 0.35,+ "max_objects": 0,+ "detect_interval": 1,+ "images": [+ "43",+ 0+ ],+ "model": [+ "32",+ 0+ ],+ "conditioning": [+ "53",+ 0+ ]+ },+ "class_type": "SAM3_VideoTrack",+ "_meta": {+ "title": "SAM 3.1 track hats"+ }+ },+ "55": {+ "inputs": {+ "object_indices": "",+ "track_data": [+ "54",+ 0+ ]+ },+ "class_type": "SAM3_TrackToMask",+ "_meta": {+ "title": "All hats"+ }+ },+ "56": {+ "inputs": {+ "x": 0,+ "y": 0,+ "operation": "add",+ "destination": [+ "46",+ 0+ ],+ "source": [+ "55",+ 0+ ]+ },+ "class_type": "MaskComposite",+ "_meta": {+ "title": "People + hats"+ }+ },+ "57": {+ "inputs": {+ "cell_selection": "runtime exact (latent max)",+ "cell_adjust": 0,+ "preview_frame": 0,+ "overlay_opacity": 0.38,+ "show_grid": true,+ "show_source_outline": true,+ "mask_meaning": "white = generate",+ "image": [+ "47",+ 0+ ],+ "mask": [+ "48",+ 0+ ]+ },+ "class_type": "MiniMaxH3ContexMaskGridPreview",+ "_meta": {+ "title": "Mask preview"+ }+ },+ "58": {+ "inputs": {+ "images": [+ "57",+ 1+ ]+ },+ "class_type": "PreviewImage",+ "_meta": {+ "title": "Mask preview (white = regenerated)"+ }+ },+ "59": {+ "inputs": {+ "grow": 0,+ "keep_audio": true,+ "megapixels": 0,+ "vae": [+ "29",+ 0+ ],+ "images": [+ "40",+ 1+ ],+ "mask": [+ "48",+ 0+ ],+ "audio_vae": [+ "30",+ 0+ ],+ "audio": [+ "40",+ 2+ ]+ },+ "class_type": "MiniMaxH3FantasticVideoEditLatent",+ "_meta": {+ "title": "Edit latent (source + mask + audio)"+ }+ },+ "60": {+ "inputs": {+ "mask_meaning": "white = generate",+ "audio_mode": "preserve source audio",+ "mask_conversion": "H3 exact (causal/token max)",+ "target_latent": [+ "59",+ 0+ ],+ "mask": [+ "48",+ 0+ ]+ },+ "class_type": "MiniMaxH3ContexMaskedTarget",+ "_meta": {+ "title": "Masked target"+ }+ },+ "61": {+ "inputs": {+ "state": [+ "38",+ 0+ ],+ "conditioning": [+ "39",+ 0+ ],+ "vae": [+ "29",+ 0+ ],+ "latent": [+ "60",+ 0+ ],+ "audio_vae": [+ "30",+ 0+ ]+ },+ "class_type": "MiniMaxH3ChainContext",+ "_meta": {+ "title": "Apply Clip Context"+ }+ },+ "62": {+ "inputs": {+ "model": [+ "27",+ 0+ ],+ "conditioning": [+ "61",+ 0+ ]+ },+ "class_type": "BasicGuider",+ "_meta": {+ "title": "Guider"+ }+ },+ "63": {+ "inputs": {+ "scheduler": "simple",+ "steps": [+ "38",+ 7+ ],+ "denoise": 1,+ "model": [+ "27",+ 0+ ]+ },+ "class_type": "BasicScheduler",+ "_meta": {+ "title": "Schedule"+ }+ },+ "64": {+ "inputs": {+ "noise": [+ "44",+ 0+ ],+ "guider": [+ "62",+ 0+ ],+ "sampler": [+ "31",+ 0+ ],+ "sigmas": [+ "63",+ 0+ ],+ "latent_image": [+ "61",+ 3+ ]+ },+ "class_type": "SamplerCustomAdvanced",+ "_meta": {+ "title": "Sample Video + Audio"+ }+ },+ "65": {+ "inputs": {+ "samples": [+ "64",+ 0+ ],+ "vae": [+ "29",+ 0+ ]+ },+ "class_type": "VAEDecode",+ "_meta": {+ "title": "Decode Video"+ }+ },+ "66": {+ "inputs": {+ "samples": [+ "64",+ 0+ ],+ "vae": [+ "30",+ 0+ ]+ },+ "class_type": "VAEDecodeAudio",+ "_meta": {+ "title": "Decode Audio"+ }+ },+ "67": {+ "inputs": {+ "trim_frames": [+ "61",+ 1+ ],+ "fps": 24,+ "match_tail": true,+ "audio_trim_mode": "sync_with_video",+ "images": [+ "65",+ 0+ ],+ "audio": [+ "66",+ 0+ ],+ "state": [+ "38",+ 0+ ]+ },+ "class_type": "MiniMaxH3LoopTrim",+ "_meta": {+ "title": "Trim Overlap"+ }+ },+ "68": {+ "inputs": {+ "state": [+ "38",+ 0+ ],+ "images": [+ "67",+ 0+ ],+ "sampled_latent": [+ "64",+ 0+ ],+ "audio": [+ "67",+ 1+ ],+ "images_with_overlap": [+ "67",+ 2+ ]+ },+ "class_type": "MiniMaxH3ChainSegmentSave",+ "_meta": {+ "title": "Save Clip + Checkpoint"+ }+ },+ "69": {+ "inputs": {+ "enabled": false,+ "play_notification_sound": false,+ "auto_continue_timeout_minutes": 0,+ "unload_models_while_waiting": false,+ "assemble_partial_on_stop": true,+ "partial_audio_source": "checkpointed",+ "candidate_count": 1,+ "review_each_candidate": false,+ "state": [+ "38",+ 0+ ],+ "segment": [+ "68",+ 0+ ],+ "audio": [+ "67",+ 1+ ]+ },+ "class_type": "MiniMaxH3ChainReview",+ "_meta": {+ "title": "Review (off = no pause)"+ }+ },+ "70": {+ "inputs": {+ "between_scene_cleanup": "off",+ "execution_mode": "recursive",+ "flow": [+ "37",+ 0+ ],+ "state": [+ "38",+ 0+ ],+ "images": [+ "67",+ 0+ ],+ "sampled_latent": [+ "64",+ 0+ ],+ "segment": [+ "69",+ 0+ ]+ },+ "class_type": "MiniMaxH3ChainLoopEnd",+ "_meta": {+ "title": "Loop End"+ }+ },+ "71": {+ "inputs": {+ "audio_source": "source",+ "filename": "swap_%date:yyyy-MM-dd%",+ "audio_bitrate": 256,+ "copy_to_output": true,+ "output_subfolder": "h3_oneclick_swap",+ "blend_schedule": "plan",+ "boundary_tone_match": "off",+ "color_stabilization": "off",+ "delete_checkpoints_after_assembly": false,+ "generated_audio_join": "av_overlap",+ "manifest": [+ "70",+ 0+ ]+ },+ "class_type": "MiniMaxH3ChainAssemble",+ "_meta": {+ "title": "Final Video"+ }+ }+}\ No newline at end of file