@pixerate/editor-react 0.92.0 → 0.93.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/dist/animation-editor/AnimationEditor.d.cts +11 -1
  2. package/dist/animation-editor/AnimationEditor.d.ts +11 -1
  3. package/dist/animation-editor/index.cjs +494 -366
  4. package/dist/animation-editor/index.js +48 -4
  5. package/dist/canvas/index.cjs +3 -2
  6. package/dist/canvas/index.js +4 -4
  7. package/dist/chart/ChartEditor.d.cts +12 -1
  8. package/dist/chart/ChartEditor.d.ts +12 -1
  9. package/dist/chart/index.cjs +187 -29
  10. package/dist/chart/index.js +74 -10
  11. package/dist/{chunk-6MDTFAPY.js → chunk-6YRSQW2V.js} +5 -5
  12. package/dist/chunk-7I73DW4V.js +43 -0
  13. package/dist/{chunk-GML6BYCN.js → chunk-GECXTPSH.js} +53 -3
  14. package/dist/{chunk-ECBC4HD7.js → chunk-IPVWWVSF.js} +3 -2
  15. package/dist/image-editor/index.cjs +3 -2
  16. package/dist/image-editor/index.js +2 -2
  17. package/dist/index.cjs +609 -527
  18. package/dist/index.js +10 -6
  19. package/dist/paint-editor/PaintEditor.d.cts +12 -1
  20. package/dist/paint-editor/PaintEditor.d.ts +12 -1
  21. package/dist/paint-editor/index.cjs +319 -164
  22. package/dist/paint-editor/index.js +84 -11
  23. package/dist/parameters/ParametersPanel.d.cts +11 -1
  24. package/dist/parameters/ParametersPanel.d.ts +11 -1
  25. package/dist/parameters/index.cjs +190 -41
  26. package/dist/parameters/index.js +23 -4
  27. package/dist/playback/index.d.cts +1 -0
  28. package/dist/playback/index.d.ts +1 -0
  29. package/dist/playback/useElementPlaybackSurface.d.cts +19 -0
  30. package/dist/playback/useElementPlaybackSurface.d.ts +19 -0
  31. package/dist/playback/usePlaybackSurface.d.cts +3 -1
  32. package/dist/playback/usePlaybackSurface.d.ts +3 -1
  33. package/dist/spreadsheet/SpreadsheetEditor.d.cts +10 -0
  34. package/dist/spreadsheet/SpreadsheetEditor.d.ts +10 -0
  35. package/dist/spreadsheet/index.cjs +443 -313
  36. package/dist/spreadsheet/index.js +2 -1
  37. package/dist/vector/index.cjs +3 -2
  38. package/dist/vector/index.js +5 -5
  39. package/dist/video-editor/VideoEditor.d.cts +6 -1
  40. package/dist/video-editor/VideoEditor.d.ts +6 -1
  41. package/dist/video-editor/VideoTimeline.d.cts +11 -1
  42. package/dist/video-editor/VideoTimeline.d.ts +11 -1
  43. package/dist/video-editor/index.cjs +463 -332
  44. package/dist/video-editor/index.js +53 -5
  45. package/package.json +3 -3
@@ -200,26 +200,115 @@ function ShotTimeline({ controller, className = "" }) {
200
200
  }
201
201
 
202
202
  // src/animation-editor/AnimationEditor.tsx
203
- var import_react15 = require("react");
203
+ var import_react18 = require("react");
204
+
205
+ // src/playback/AgentPlaybackContext.tsx
206
+ var import_react3 = require("react");
207
+ var import_jsx_runtime3 = require("react/jsx-runtime");
208
+ var AgentPlaybackContext = (0, import_react3.createContext)(null);
209
+ function useAgentPlayback() {
210
+ return (0, import_react3.useContext)(AgentPlaybackContext);
211
+ }
212
+
213
+ // src/playback/usePlaybackSurface.ts
214
+ var import_react4 = require("react");
215
+ var import_tools = require("@pixerate/editor/tools");
216
+ function usePlaybackSurface(playback, id, options = {}, sharedPresence) {
217
+ const ambient = useAgentPlayback();
218
+ const target = playback === void 0 ? ambient : playback;
219
+ const [ownPresence] = (0, import_react4.useState)(() => new import_tools.PresenceStore());
220
+ const presence = sharedPresence ?? ownPresence;
221
+ const latest = (0, import_react4.useRef)(options);
222
+ latest.current = options;
223
+ (0, import_react4.useEffect)(() => {
224
+ if (!target || !id) return;
225
+ const o = () => latest.current;
226
+ const surface = {
227
+ presence,
228
+ locate: (ref) => o().locate?.(ref) ?? null,
229
+ bounds: () => o().bounds?.() ?? null,
230
+ visible: () => o().visible?.() ?? true,
231
+ toViewport: (p) => o().toViewport?.(p) ?? p,
232
+ fromViewport: (p) => o().fromViewport?.(p) ?? p,
233
+ beginGesture: (key) => o().beginGesture?.(key),
234
+ endGesture: () => o().endGesture?.(),
235
+ reveal: () => o().reveal?.(),
236
+ open: (ref) => o().open?.(ref),
237
+ get defaultKind() {
238
+ return o().defaultKind;
239
+ }
240
+ };
241
+ const detach = target.attach(id, surface);
242
+ return () => {
243
+ detach();
244
+ for (const a of presence.getState().actors) presence.remove(a.id);
245
+ };
246
+ }, [target, id, presence]);
247
+ return presence;
248
+ }
249
+
250
+ // src/playback/PresenceLayer.tsx
251
+ var import_react5 = __toESM(require("react"), 1);
252
+ var import_jsx_runtime4 = require("react/jsx-runtime");
253
+ function PresenceLayer({ presence, viewport, className = "" }) {
254
+ const { actors } = (0, import_react5.useSyncExternalStore)(presence.subscribe, presence.getState, presence.getState);
255
+ if (!actors.length) return null;
256
+ const map = typeof viewport === "function" ? viewport : viewport ? (p) => ({ x: p.x * viewport.zoom + viewport.x, y: p.y * viewport.zoom + viewport.y }) : (p) => p;
257
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
258
+ "div",
259
+ {
260
+ className: `pixerate-presence ${className}`.trim(),
261
+ "aria-hidden": "true",
262
+ "data-testid": "presence-layer",
263
+ style: { position: "absolute", inset: 0, pointerEvents: "none", overflow: "hidden", zIndex: 50 },
264
+ children: actors.map((a) => {
265
+ const at = map(a);
266
+ const ring = a.focus && (() => {
267
+ const tl = map(a.focus);
268
+ const br = map({ x: a.focus.x + a.focus.width, y: a.focus.y + a.focus.height });
269
+ return { left: tl.x - 4, top: tl.y - 4, width: br.x - tl.x + 8, height: br.y - tl.y + 8 };
270
+ })();
271
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_react5.default.Fragment, { children: [
272
+ ring && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
273
+ "div",
274
+ {
275
+ "data-actor-focus": a.id,
276
+ style: { position: "absolute", ...ring, borderRadius: 8, border: `2px solid ${a.color}`, background: `${a.color}14`, transition: "all 160ms ease-out" }
277
+ }
278
+ ),
279
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { "data-actor": a.id, style: { position: "absolute", left: 0, top: 0, transform: `translate(${at.x}px, ${at.y}px)` }, children: [
280
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("svg", { width: "18", height: "20", viewBox: "0 0 12 18", style: { display: "block", transform: a.pressed ? "scale(0.85)" : void 0, transformOrigin: "0 0", filter: "drop-shadow(0 1px 2px rgba(0,0,0,.35))" }, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M0,0 L0,14 L4,10.5 L7,17 L9.5,16 L6.5,9.5 L11.5,9.5 Z", style: { fill: a.color, stroke: "#ffffff", strokeWidth: 1 } }) }),
281
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { style: { position: "absolute", left: 14, top: 16, display: "flex", flexDirection: "column", alignItems: "flex-start", gap: 4 }, children: [
282
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: { whiteSpace: "nowrap", borderRadius: 999, padding: "1px 7px", fontSize: 11, fontWeight: 600, color: "#ffffff", background: a.color }, children: a.name }),
283
+ a.message && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { "data-actor-message": a.id, style: { width: "max-content", maxWidth: 240, borderRadius: 8, borderTopLeftRadius: 0, padding: "4px 8px", fontSize: 12, color: "#1e293b", background: "#ffffff", boxShadow: "0 4px 12px rgba(15,23,42,.18)" }, children: a.message })
284
+ ] })
285
+ ] })
286
+ ] }, a.id);
287
+ })
288
+ }
289
+ );
290
+ }
291
+
292
+ // src/animation-editor/AnimationEditor.tsx
204
293
  var import_animation_editor10 = require("@pixerate/editor/animation-editor");
205
294
 
206
295
  // src/animation-editor/CommandInspector.tsx
207
- var import_react4 = __toESM(require("react"), 1);
296
+ var import_react7 = __toESM(require("react"), 1);
208
297
  var import_animation_editor4 = require("@pixerate/editor/animation-editor");
209
298
 
210
299
  // src/animation-editor/EasePicker.tsx
211
- var import_react3 = require("react");
300
+ var import_react6 = require("react");
212
301
  var import_animation_editor3 = require("@pixerate/editor/animation-editor");
213
- var import_jsx_runtime3 = require("react/jsx-runtime");
302
+ var import_jsx_runtime5 = require("react/jsx-runtime");
214
303
  var W = 72;
215
304
  var H = 44;
216
305
  function EasePicker({ value, onChange, disabled, className = "" }) {
217
306
  const key = (0, import_animation_editor3.motionEaseKey)(value);
218
- const curve = (0, import_react3.useMemo)(() => (0, import_animation_editor3.motionEasingCurve)(value ?? "ease-out"), [value]);
307
+ const curve = (0, import_react6.useMemo)(() => (0, import_animation_editor3.motionEasingCurve)(value ?? "ease-out"), [value]);
219
308
  const guides = (0, import_animation_editor3.motionEasingGuides)(curve, H);
220
309
  const spring = typeof value === "string" ? value.startsWith("spring") : value?.type === "spring";
221
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: `flex items-center gap-2 ${className}`, "data-ease-picker": "", children: [
222
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
310
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: `flex items-center gap-2 ${className}`, "data-ease-picker": "", children: [
311
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
223
312
  "select",
224
313
  {
225
314
  className: "min-w-0 flex-1 rounded border border-border bg-transparent px-1 py-0.5 text-xs",
@@ -231,17 +320,17 @@ function EasePicker({ value, onChange, disabled, className = "" }) {
231
320
  onChange(e.target.value ? e.target.value : void 0);
232
321
  },
233
322
  children: [
234
- import_animation_editor3.MOTION_EASE_CHOICES.map((c) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("option", { value: c.value, children: c.label }, c.value)),
235
- key === "custom" && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("option", { value: "custom", children: "Custom" })
323
+ import_animation_editor3.MOTION_EASE_CHOICES.map((c) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: c.value, children: c.label }, c.value)),
324
+ key === "custom" && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: "custom", children: "Custom" })
236
325
  ]
237
326
  }
238
327
  ),
239
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("svg", { width: W, height: H, viewBox: `0 0 ${W} ${H}`, className: "shrink-0 rounded border border-border", "data-ease-curve": key || "default", "aria-hidden": "true", children: [
240
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("line", { x1: 0, x2: W, y1: guides.zero, y2: guides.zero, stroke: "currentColor", strokeOpacity: 0.2 }),
241
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("line", { x1: 0, x2: W, y1: guides.one, y2: guides.one, stroke: "currentColor", strokeOpacity: 0.2, strokeDasharray: "2 2" }),
242
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: (0, import_animation_editor3.motionEasingPath)(curve, W, H), fill: "none", stroke: "#f43f5e", strokeWidth: 1.5 })
328
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("svg", { width: W, height: H, viewBox: `0 0 ${W} ${H}`, className: "shrink-0 rounded border border-border", "data-ease-curve": key || "default", "aria-hidden": "true", children: [
329
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("line", { x1: 0, x2: W, y1: guides.zero, y2: guides.zero, stroke: "currentColor", strokeOpacity: 0.2 }),
330
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("line", { x1: 0, x2: W, y1: guides.one, y2: guides.one, stroke: "currentColor", strokeOpacity: 0.2, strokeDasharray: "2 2" }),
331
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("path", { d: (0, import_animation_editor3.motionEasingPath)(curve, W, H), fill: "none", stroke: "#f43f5e", strokeWidth: 1.5 })
243
332
  ] }),
244
- spring && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: "text-[10px] tabular-nums text-muted-foreground", children: [
333
+ spring && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: "text-[10px] tabular-nums text-muted-foreground", children: [
245
334
  Math.round(curve.durationMs),
246
335
  " ms"
247
336
  ] })
@@ -249,9 +338,9 @@ function EasePicker({ value, onChange, disabled, className = "" }) {
249
338
  }
250
339
 
251
340
  // src/animation-editor/CommitInput.tsx
252
- var import_jsx_runtime4 = require("react/jsx-runtime");
341
+ var import_jsx_runtime6 = require("react/jsx-runtime");
253
342
  function CommitInput({ value, onCommit, ...rest }) {
254
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
343
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
255
344
  "input",
256
345
  {
257
346
  ...rest,
@@ -266,19 +355,19 @@ function CommitInput({ value, onCommit, ...rest }) {
266
355
  }
267
356
 
268
357
  // src/animation-editor/CommandInspector.tsx
269
- var import_jsx_runtime5 = require("react/jsx-runtime");
358
+ var import_jsx_runtime7 = require("react/jsx-runtime");
270
359
  var input = "w-full min-w-0 rounded border border-border bg-transparent px-1 py-0.5 text-xs";
271
360
  function CommandInspector({ controller, picked, className = "" }) {
272
361
  const state = useAnimationEditorState(controller);
273
362
  const { scene, selection, readOnly, error } = state;
274
- const [local, setLocalState] = (0, import_react4.useState)(null);
363
+ const [local, setLocalState] = (0, import_react7.useState)(null);
275
364
  const setLocal = (text) => setLocalState(text ? { text, revision: state.revision } : null);
276
- const elements = (0, import_react4.useMemo)(() => (0, import_animation_editor4.describeMotionElements)(scene), [scene.artwork]);
365
+ const elements = (0, import_react7.useMemo)(() => (0, import_animation_editor4.describeMotionElements)(scene), [scene.artwork]);
277
366
  const shot = selection ? scene.shots.find((s) => s.id === selection.shot) : void 0;
278
367
  const index = selection?.command;
279
368
  const command = shot && index !== void 0 ? shot.run[index] : void 0;
280
369
  if (!shot || index === void 0 || !command) {
281
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: `text-xs text-muted-foreground ${className}`, "data-command-inspector": "", children: "Select a command to edit it." });
370
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: `text-xs text-muted-foreground ${className}`, "data-command-inspector": "", children: "Select a command to edit it." });
282
371
  }
283
372
  const values = command;
284
373
  const fields = (0, import_animation_editor4.motionCommandFields)(command.type);
@@ -297,45 +386,45 @@ function CommandInspector({ controller, picked, className = "" }) {
297
386
  const common = { disabled: readOnly, "aria-label": field.label, title: field.description };
298
387
  switch (field.kind) {
299
388
  case "targets":
300
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex flex-wrap items-center gap-1", "data-targets": "", children: [
301
- targets.map((id) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: "flex items-center gap-0.5 rounded bg-muted px-1 text-[11px]", "data-target": id, children: [
389
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex flex-wrap items-center gap-1", "data-targets": "", children: [
390
+ targets.map((id) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "flex items-center gap-0.5 rounded bg-muted px-1 text-[11px]", "data-target": id, children: [
302
391
  name(id),
303
- !readOnly && targets.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", "aria-label": `Remove ${id}`, onClick: () => commit(field, targets.filter((t) => t !== id)), children: "\xD7" })
392
+ !readOnly && targets.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", "aria-label": `Remove ${id}`, onClick: () => commit(field, targets.filter((t) => t !== id)), children: "\xD7" })
304
393
  ] }, id)),
305
- !readOnly && picked && !targets.includes(picked) && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("button", { type: "button", className: "rounded border border-rose-500 px-1 text-[11px] text-rose-500", onClick: () => commit(field, [...targets, picked]), "data-add-picked": "", children: [
394
+ !readOnly && picked && !targets.includes(picked) && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("button", { type: "button", className: "rounded border border-rose-500 px-1 text-[11px] text-rose-500", onClick: () => commit(field, [...targets, picked]), "data-add-picked": "", children: [
306
395
  "+ ",
307
396
  name(picked)
308
397
  ] }),
309
- !readOnly && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("select", { className: "rounded border border-border bg-transparent px-1 py-0.5 text-[11px]", "aria-label": "Add target", value: "", onChange: (e) => e.target.value && commit(field, [...targets, e.target.value]), children: [
310
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: "", children: "+ target\u2026" }),
311
- elements.filter((e) => !targets.includes(e.id)).map((e) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: e.id, children: e.name ? `${e.name} (${e.id})` : e.id }, e.id))
398
+ !readOnly && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("select", { className: "rounded border border-border bg-transparent px-1 py-0.5 text-[11px]", "aria-label": "Add target", value: "", onChange: (e) => e.target.value && commit(field, [...targets, e.target.value]), children: [
399
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("option", { value: "", children: "+ target\u2026" }),
400
+ elements.filter((e) => !targets.includes(e.id)).map((e) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("option", { value: e.id, children: e.name ? `${e.name} (${e.id})` : e.id }, e.id))
312
401
  ] })
313
402
  ] });
314
403
  case "node":
315
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("select", { className: input, ...common, value: typeof v === "string" ? v : "", onChange: (e) => commit(field, e.target.value), children: [
316
- !field.required && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: "", children: "\u2014" }),
317
- elements.filter((e) => field.name !== "path" || e.type === "path").map((e) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("option", { value: e.id, children: [
404
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("select", { className: input, ...common, value: typeof v === "string" ? v : "", onChange: (e) => commit(field, e.target.value), children: [
405
+ !field.required && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("option", { value: "", children: "\u2014" }),
406
+ elements.filter((e) => field.name !== "path" || e.type === "path").map((e) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("option", { value: e.id, children: [
318
407
  e.name ? `${e.name} (${e.id})` : e.id,
319
408
  e.hidden ? " \xB7 hidden" : ""
320
409
  ] }, e.id))
321
410
  ] });
322
411
  case "enum":
323
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("select", { className: input, ...common, value: typeof v === "string" ? v : "", onChange: (e) => commit(field, e.target.value), children: [
324
- !field.required && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: "", children: "default" }),
325
- field.options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: o, children: o }, o))
412
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("select", { className: input, ...common, value: typeof v === "string" ? v : "", onChange: (e) => commit(field, e.target.value), children: [
413
+ !field.required && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("option", { value: "", children: "default" }),
414
+ field.options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("option", { value: o, children: o }, o))
326
415
  ] });
327
416
  case "boolean":
328
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("input", { type: "checkbox", ...common, checked: v === true, onChange: (e) => commit(field, e.target.checked) });
417
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("input", { type: "checkbox", ...common, checked: v === true, onChange: (e) => commit(field, e.target.checked) });
329
418
  case "ease":
330
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(EasePicker, { value: v, disabled: readOnly, onChange: (ease) => commit(field, ease === void 0 ? "" : ease) });
419
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(EasePicker, { value: v, disabled: readOnly, onChange: (ease) => commit(field, ease === void 0 ? "" : ease) });
331
420
  case "color":
332
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex items-center gap-1", children: [
333
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("input", { type: "color", disabled: readOnly, "aria-label": `${field.label} swatch`, value: typeof v === "string" && /^#[0-9a-f]{6}$/i.test(v) ? v : "#000000", onChange: (e) => commit(field, e.target.value) }),
334
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(CommitInput, { className: input, ...common, value: typeof v === "string" ? v : "", placeholder: "unchanged", onCommit: (raw) => commit(field, raw) })
421
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex items-center gap-1", children: [
422
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("input", { type: "color", disabled: readOnly, "aria-label": `${field.label} swatch`, value: typeof v === "string" && /^#[0-9a-f]{6}$/i.test(v) ? v : "#000000", onChange: (e) => commit(field, e.target.value) }),
423
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(CommitInput, { className: input, ...common, value: typeof v === "string" ? v : "", placeholder: "unchanged", onCommit: (raw) => commit(field, raw) })
335
424
  ] });
336
425
  case "point": {
337
426
  const p = v ?? void 0;
338
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "flex items-center gap-1", children: ["x", "y"].map((axis) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
427
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "flex items-center gap-1", children: ["x", "y"].map((axis) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
339
428
  CommitInput,
340
429
  {
341
430
  className: input,
@@ -352,8 +441,8 @@ function CommandInspector({ controller, picked, className = "" }) {
352
441
  case "scale":
353
442
  case "number":
354
443
  case "integer":
355
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex items-center gap-1", children: [
356
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
444
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex items-center gap-1", children: [
445
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
357
446
  CommitInput,
358
447
  {
359
448
  className: input,
@@ -367,49 +456,49 @@ function CommandInspector({ controller, picked, className = "" }) {
367
456
  onCommit: (raw) => commit(field, raw)
368
457
  }
369
458
  ),
370
- field.unit && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "shrink-0 text-[10px] text-muted-foreground", children: field.unit })
459
+ field.unit && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "shrink-0 text-[10px] text-muted-foreground", children: field.unit })
371
460
  ] });
372
461
  default:
373
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(CommitInput, { className: input, ...common, value: typeof v === "string" ? v : "", onCommit: (raw) => commit(field, raw) });
462
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(CommitInput, { className: input, ...common, value: typeof v === "string" ? v : "", onCommit: (raw) => commit(field, raw) });
374
463
  }
375
464
  };
376
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: `flex flex-col gap-1.5 text-xs ${className}`, "data-command-inspector": "", "data-command-type": command.type, children: [
377
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex items-center gap-2", children: [
378
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: "font-medium", children: [
465
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: `flex flex-col gap-1.5 text-xs ${className}`, "data-command-inspector": "", "data-command-type": command.type, children: [
466
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex items-center gap-2", children: [
467
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "font-medium", children: [
379
468
  index + 1,
380
469
  ". ",
381
470
  command.type
382
471
  ] }),
383
- primitive ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("code", { className: "rounded bg-muted px-1 text-[10px]", "data-flair-primitive": primitive, title: "The Flair motion primitive this command plays", children: primitive }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "editor-only (no Flair primitive)" })
472
+ primitive ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("code", { className: "rounded bg-muted px-1 text-[10px]", "data-flair-primitive": primitive, title: "The Flair motion primitive this command plays", children: primitive }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "editor-only (no Flair primitive)" })
384
473
  ] }),
385
- ["main", "timing"].map((group) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("fieldset", { className: "grid grid-cols-[6.5rem_1fr] items-center gap-x-2 gap-y-1", children: [
386
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("legend", { className: "mb-1 text-[10px] uppercase tracking-wide text-muted-foreground", children: group === "main" ? "Command" : "Timing" }),
387
- fields.filter((f) => f.group === group).map((field) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_react4.default.Fragment, { children: [
388
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "truncate text-muted-foreground", title: field.description, children: [
474
+ ["main", "timing"].map((group) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("fieldset", { className: "grid grid-cols-[6.5rem_1fr] items-center gap-x-2 gap-y-1", children: [
475
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("legend", { className: "mb-1 text-[10px] uppercase tracking-wide text-muted-foreground", children: group === "main" ? "Command" : "Timing" }),
476
+ fields.filter((f) => f.group === group).map((field) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_react7.default.Fragment, { children: [
477
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { className: "truncate text-muted-foreground", title: field.description, children: [
389
478
  field.label,
390
479
  field.required ? " *" : ""
391
480
  ] }),
392
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { "data-field": field.name, children: control(field) })
481
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { "data-field": field.name, children: control(field) })
393
482
  ] }, field.name))
394
483
  ] }, group)),
395
- message && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "text-red-500", role: "alert", "data-edit-error": "", children: message })
484
+ message && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "text-red-500", role: "alert", "data-edit-error": "", children: message })
396
485
  ] });
397
486
  }
398
487
 
399
488
  // src/animation-editor/CommandList.tsx
400
- var import_react5 = require("react");
489
+ var import_react8 = require("react");
401
490
  var import_animation_editor5 = require("@pixerate/editor/animation-editor");
402
- var import_jsx_runtime6 = require("react/jsx-runtime");
491
+ var import_jsx_runtime8 = require("react/jsx-runtime");
403
492
  var btn = "rounded border border-border px-1.5 py-0.5 text-[11px] disabled:opacity-40";
404
493
  function CommandList({ controller, shot, targets, className = "" }) {
405
494
  const state = useAnimationEditorState(controller);
406
495
  const { scene, selection, readOnly, error } = state;
407
496
  const shotId = shot ?? selection?.shot ?? scene.shots[0]?.id;
408
497
  const current = scene.shots.find((s) => s.id === shotId);
409
- const [type, setType] = (0, import_react5.useState)("enter");
410
- const [local, setLocalState] = (0, import_react5.useState)(null);
498
+ const [type, setType] = (0, import_react8.useState)("enter");
499
+ const [local, setLocalState] = (0, import_react8.useState)(null);
411
500
  const setLocal = (text) => setLocalState(text ? { text, revision: state.revision } : null);
412
- if (!current) return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: `text-xs text-muted-foreground ${className}`, "data-command-list": "", children: "Add a shot to start." });
501
+ if (!current) return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: `text-xs text-muted-foreground ${className}`, "data-command-list": "", children: "Add a shot to start." });
413
502
  const rows = (0, import_animation_editor5.motionCommandRows)(scene, current.id);
414
503
  const selected = selection?.shot === current.id ? selection.command : void 0;
415
504
  const run = (edit, label) => {
@@ -425,15 +514,15 @@ function CommandList({ controller, shot, targets, className = "" }) {
425
514
  if (result.ok) controller.select({ shot: current.id, command: at });
426
515
  };
427
516
  const message = (local && local.revision === state.revision ? local.text : null) ?? error;
428
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: `flex flex-col gap-1 text-xs ${className}`, "data-command-list": "", "data-for-shot": current.id, children: [
429
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "font-medium", children: [
517
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: `flex flex-col gap-1 text-xs ${className}`, "data-command-list": "", "data-for-shot": current.id, children: [
518
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "font-medium", children: [
430
519
  "Commands in ",
431
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "text-rose-500", children: current.label ?? current.id })
520
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "text-rose-500", children: current.label ?? current.id })
432
521
  ] }),
433
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("ol", { className: "flex flex-col gap-1", "aria-label": "Commands", children: rows.map((row) => {
522
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("ol", { className: "flex flex-col gap-1", "aria-label": "Commands", children: rows.map((row) => {
434
523
  const c = row.command;
435
524
  const isSelected = row.index === selected;
436
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
525
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
437
526
  "li",
438
527
  {
439
528
  className: `flex flex-wrap items-center gap-1 rounded border px-1.5 py-1 ${isSelected ? "border-rose-500 bg-rose-500/10" : "border-border"}`,
@@ -441,18 +530,18 @@ function CommandList({ controller, shot, targets, className = "" }) {
441
530
  "data-selected": isSelected || void 0,
442
531
  onClick: () => controller.select({ shot: current.id, command: row.index }),
443
532
  children: [
444
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { className: "min-w-0 flex-1 truncate", title: row.summary, children: [
533
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("span", { className: "min-w-0 flex-1 truncate", title: row.summary, children: [
445
534
  row.index + 1,
446
535
  ". ",
447
536
  row.summary
448
537
  ] }),
449
- row.flairPrimitive && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("code", { className: "rounded bg-muted px-1 text-[10px] text-muted-foreground", "data-flair-primitive": row.flairPrimitive, children: row.flairPrimitive }),
450
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { className: "tabular-nums text-[10px] text-muted-foreground", children: [
538
+ row.flairPrimitive && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("code", { className: "rounded bg-muted px-1 text-[10px] text-muted-foreground", "data-flair-primitive": row.flairPrimitive, children: row.flairPrimitive }),
539
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("span", { className: "tabular-nums text-[10px] text-muted-foreground", children: [
451
540
  ((row.end - row.start) / 1e3).toFixed(2),
452
541
  " s"
453
542
  ] }),
454
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex w-full items-center gap-1", onClick: (e) => e.stopPropagation(), children: [
455
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
543
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex w-full items-center gap-1", onClick: (e) => e.stopPropagation(), children: [
544
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
456
545
  "select",
457
546
  {
458
547
  className: "rounded border border-border bg-transparent px-1 py-0.5 text-[11px]",
@@ -464,14 +553,14 @@ function CommandList({ controller, shot, targets, className = "" }) {
464
553
  "Change start"
465
554
  ),
466
555
  children: [
467
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("option", { value: "after", children: "after previous" }),
468
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("option", { value: "previous", children: "with previous" })
556
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: "after", children: "after previous" }),
557
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: "previous", children: "with previous" })
469
558
  ]
470
559
  }
471
560
  ),
472
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", { className: "flex items-center gap-0.5 text-muted-foreground", children: [
561
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { className: "flex items-center gap-0.5 text-muted-foreground", children: [
473
562
  "+",
474
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
563
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
475
564
  "input",
476
565
  {
477
566
  className: "w-14 rounded border border-border bg-transparent px-1 py-0.5 text-[11px] tabular-nums",
@@ -495,11 +584,11 @@ function CommandList({ controller, shot, targets, className = "" }) {
495
584
  ),
496
585
  "ms"
497
586
  ] }),
498
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { className: "ml-auto flex gap-0.5", children: [
499
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: btn, "aria-label": "Move up", disabled: readOnly || row.index === 0, onClick: () => run({ op: "move_command", shot: current.id, command: row.index, to: row.index - 1 }, "Move command").ok && controller.select({ shot: current.id, command: row.index - 1 }), children: "\u2191" }),
500
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: btn, "aria-label": "Move down", disabled: readOnly || row.index === rows.length - 1, onClick: () => run({ op: "move_command", shot: current.id, command: row.index, to: row.index + 1 }, "Move command").ok && controller.select({ shot: current.id, command: row.index + 1 }), children: "\u2193" }),
501
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: btn, "aria-label": "Duplicate", disabled: readOnly, onClick: () => run((0, import_animation_editor5.duplicateMotionCommandEdit)(scene, current.id, row.index), "Duplicate command").ok && controller.select({ shot: current.id, command: row.index + 1 }), children: "\u29C9" }),
502
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: btn, "aria-label": "Delete", disabled: readOnly, onClick: () => run({ op: "delete_commands", shot: current.id, commands: [row.index] }, "Delete command"), children: "\u2715" })
587
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("span", { className: "ml-auto flex gap-0.5", children: [
588
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { type: "button", className: btn, "aria-label": "Move up", disabled: readOnly || row.index === 0, onClick: () => run({ op: "move_command", shot: current.id, command: row.index, to: row.index - 1 }, "Move command").ok && controller.select({ shot: current.id, command: row.index - 1 }), children: "\u2191" }),
589
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { type: "button", className: btn, "aria-label": "Move down", disabled: readOnly || row.index === rows.length - 1, onClick: () => run({ op: "move_command", shot: current.id, command: row.index, to: row.index + 1 }, "Move command").ok && controller.select({ shot: current.id, command: row.index + 1 }), children: "\u2193" }),
590
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { type: "button", className: btn, "aria-label": "Duplicate", disabled: readOnly, onClick: () => run((0, import_animation_editor5.duplicateMotionCommandEdit)(scene, current.id, row.index), "Duplicate command").ok && controller.select({ shot: current.id, command: row.index + 1 }), children: "\u29C9" }),
591
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { type: "button", className: btn, "aria-label": "Delete", disabled: readOnly, onClick: () => run({ op: "delete_commands", shot: current.id, commands: [row.index] }, "Delete command"), children: "\u2715" })
503
592
  ] })
504
593
  ] })
505
594
  ]
@@ -507,18 +596,18 @@ function CommandList({ controller, shot, targets, className = "" }) {
507
596
  `${row.index}:${row.summary}`
508
597
  );
509
598
  }) }),
510
- !readOnly && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex items-center gap-1", children: [
511
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("select", { className: "flex-1 rounded border border-border bg-transparent px-1 py-0.5", "aria-label": "New command type", value: type, onChange: (e) => setType(e.target.value), children: import_animation_editor5.MOTION_COMMAND_TYPES.map((t) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("option", { value: t, children: t }, t)) }),
512
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: btn, onClick: add, "data-add-command": "", children: "Add command" })
599
+ !readOnly && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex items-center gap-1", children: [
600
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("select", { className: "flex-1 rounded border border-border bg-transparent px-1 py-0.5", "aria-label": "New command type", value: type, onChange: (e) => setType(e.target.value), children: import_animation_editor5.MOTION_COMMAND_TYPES.map((t) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: t, children: t }, t)) }),
601
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { type: "button", className: btn, onClick: add, "data-add-command": "", children: "Add command" })
513
602
  ] }),
514
- message && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "text-red-500", role: "alert", "data-edit-error": "", children: message })
603
+ message && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { className: "text-red-500", role: "alert", "data-edit-error": "", children: message })
515
604
  ] });
516
605
  }
517
606
 
518
607
  // src/animation-editor/PlayheadScrubber.tsx
519
- var import_react6 = require("react");
608
+ var import_react9 = require("react");
520
609
  var import_animation_editor6 = require("@pixerate/editor/animation-editor");
521
- var import_jsx_runtime7 = require("react/jsx-runtime");
610
+ var import_jsx_runtime9 = require("react/jsx-runtime");
522
611
  var seconds2 = (ms) => `${(ms / 1e3).toFixed(2)} s`;
523
612
  function worst2(issues) {
524
613
  if (issues.some((i) => i.severity === "error")) return "error";
@@ -529,9 +618,9 @@ function PlayheadScrubber({ controller, className = "" }) {
529
618
  const state = useAnimationEditorState(controller);
530
619
  const { duration, shots, time, playing, selection, issues, scene, readOnly } = state;
531
620
  const span = Math.max(1, duration);
532
- const track = (0, import_react6.useRef)(null);
533
- const [width, setWidth] = (0, import_react6.useState)(600);
534
- (0, import_react6.useEffect)(() => {
621
+ const track = (0, import_react9.useRef)(null);
622
+ const [width, setWidth] = (0, import_react9.useState)(600);
623
+ (0, import_react9.useEffect)(() => {
535
624
  const el = track.current;
536
625
  if (!el || typeof ResizeObserver === "undefined") return;
537
626
  const observer = new ResizeObserver(() => setWidth(el.clientWidth || 600));
@@ -548,16 +637,16 @@ function PlayheadScrubber({ controller, className = "" }) {
548
637
  if (scene.beat && scene.beat.bpm > 0) {
549
638
  for (let b = 0, t = (0, import_animation_editor6.motionBeatTime)(scene.beat, 0); t <= span && beats.length < 400; t = (0, import_animation_editor6.motionBeatTime)(scene.beat, ++b)) if (t >= 0) beats.push(t);
550
639
  }
551
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: `flex flex-col gap-1 ${className}`, "data-playhead-scrubber": "", "data-shot-timeline": "", children: [
552
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex items-center gap-2 text-xs", children: [
553
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", className: "rounded border border-border px-2 py-0.5", onClick: () => controller.toggle(), "aria-label": playing ? "Pause" : "Play", disabled: !shots.length, children: playing ? "Pause" : "Play" }),
554
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", className: "rounded border border-border px-2 py-0.5", onClick: () => {
640
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: `flex flex-col gap-1 ${className}`, "data-playhead-scrubber": "", "data-shot-timeline": "", children: [
641
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center gap-2 text-xs", children: [
642
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: "rounded border border-border px-2 py-0.5", onClick: () => controller.toggle(), "aria-label": playing ? "Pause" : "Play", disabled: !shots.length, children: playing ? "Pause" : "Play" }),
643
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: "rounded border border-border px-2 py-0.5", onClick: () => {
555
644
  controller.pause();
556
645
  controller.seek(0);
557
646
  }, "aria-label": "Back to start", children: "\u23EE" }),
558
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
647
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
559
648
  "Loop",
560
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
649
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
561
650
  "select",
562
651
  {
563
652
  className: "rounded border border-border bg-transparent px-1 py-0.5",
@@ -566,20 +655,20 @@ function PlayheadScrubber({ controller, className = "" }) {
566
655
  "aria-label": "Loop",
567
656
  onChange: (e) => controller.apply({ op: "set_settings", loop: e.target.value }, "Change loop"),
568
657
  children: [
569
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("option", { value: "none", children: "Off" }),
570
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("option", { value: "loop", children: "Loop" }),
571
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("option", { value: "ping-pong", children: "Ping-pong" })
658
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "none", children: "Off" }),
659
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "loop", children: "Loop" }),
660
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "ping-pong", children: "Ping-pong" })
572
661
  ]
573
662
  }
574
663
  )
575
664
  ] }),
576
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "ml-auto tabular-nums text-muted-foreground", "data-time": "", children: [
665
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "ml-auto tabular-nums text-muted-foreground", "data-time": "", children: [
577
666
  seconds2(time),
578
667
  " / ",
579
668
  seconds2(duration)
580
669
  ] })
581
670
  ] }),
582
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
671
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
583
672
  "div",
584
673
  {
585
674
  ref: track,
@@ -609,17 +698,17 @@ function PlayheadScrubber({ controller, className = "" }) {
609
698
  e.preventDefault();
610
699
  },
611
700
  children: [
612
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "relative h-5 border-b border-border text-[10px] text-muted-foreground", "data-ruler": "", children: [
613
- beats.map((t, i) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "absolute bottom-0 h-1.5 w-px bg-sky-500/60", style: { left: pct(t) }, "data-beat": i }, `b${i}`)),
614
- scene.narration?.words.map((w, i) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "absolute top-0 h-1.5 w-px bg-emerald-500/70", style: { left: pct(w.start) }, title: `\u201C${w.text}\u201D at ${seconds2(w.start)}`, "data-word": i }, `w${i}`)),
615
- ticks.map((t) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: `absolute bottom-0 w-px ${t.major ? "h-2.5 bg-muted-foreground/70" : "h-1 bg-muted-foreground/40"}`, style: { left: pct(t.time) }, children: t.label && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "absolute -top-0.5 left-1 whitespace-nowrap tabular-nums", children: t.label }) }, t.time))
701
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "relative h-5 border-b border-border text-[10px] text-muted-foreground", "data-ruler": "", children: [
702
+ beats.map((t, i) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "absolute bottom-0 h-1.5 w-px bg-sky-500/60", style: { left: pct(t) }, "data-beat": i }, `b${i}`)),
703
+ scene.narration?.words.map((w, i) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "absolute top-0 h-1.5 w-px bg-emerald-500/70", style: { left: pct(w.start) }, title: `\u201C${w.text}\u201D at ${seconds2(w.start)}`, "data-word": i }, `w${i}`)),
704
+ ticks.map((t) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: `absolute bottom-0 w-px ${t.major ? "h-2.5 bg-muted-foreground/70" : "h-1 bg-muted-foreground/40"}`, style: { left: pct(t.time) }, children: t.label && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "absolute -top-0.5 left-1 whitespace-nowrap tabular-nums", children: t.label }) }, t.time))
616
705
  ] }),
617
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "mt-1 flex w-full gap-px", role: "group", "aria-label": "Shots", children: shots.map((shot, i) => {
706
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "mt-1 flex w-full gap-px", role: "group", "aria-label": "Shots", children: shots.map((shot, i) => {
618
707
  const mark = worst2(issues.filter((x) => x.shot === shot.id));
619
708
  const selected = selection?.shot === shot.id;
620
709
  const cue = scene.shots[i]?.at;
621
710
  const cueTime = cue ? (0, import_animation_editor6.motionCueTime)(scene, cue) : void 0;
622
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
711
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
623
712
  "button",
624
713
  {
625
714
  type: "button",
@@ -634,14 +723,14 @@ function PlayheadScrubber({ controller, className = "" }) {
634
723
  controller.seekShot(shot.id);
635
724
  },
636
725
  children: [
637
- mark && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: mark === "error" ? "text-red-500" : "text-amber-500", children: "\u25CF " }),
726
+ mark && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: mark === "error" ? "text-red-500" : "text-amber-500", children: "\u25CF " }),
638
727
  shot.label ?? shot.id
639
728
  ]
640
729
  },
641
730
  shot.id
642
731
  );
643
732
  }) }),
644
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "pointer-events-none absolute inset-y-0 w-0.5 -translate-x-1/2 bg-rose-500", style: { left: pct(time) }, "data-playhead": "" })
733
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "pointer-events-none absolute inset-y-0 w-0.5 -translate-x-1/2 bg-rose-500", style: { left: pct(time) }, "data-playhead": "" })
645
734
  ]
646
735
  }
647
736
  )
@@ -649,18 +738,18 @@ function PlayheadScrubber({ controller, className = "" }) {
649
738
  }
650
739
 
651
740
  // src/animation-editor/SceneSettings.tsx
652
- var import_react7 = require("react");
741
+ var import_react10 = require("react");
653
742
  var import_animation_editor7 = require("@pixerate/editor/animation-editor");
654
- var import_jsx_runtime8 = require("react/jsx-runtime");
743
+ var import_jsx_runtime10 = require("react/jsx-runtime");
655
744
  var input2 = "w-full min-w-0 rounded border border-border bg-transparent px-1 py-0.5 text-xs";
656
745
  var btn2 = "rounded border border-border px-1.5 py-0.5 text-[11px] disabled:opacity-40";
657
- var unit = (u) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "shrink-0 text-[10px] text-muted-foreground", children: u });
746
+ var unit = (u) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "shrink-0 text-[10px] text-muted-foreground", children: u });
658
747
  function SceneSettings({ controller, className = "" }) {
659
748
  const state = useAnimationEditorState(controller);
660
749
  const { scene, readOnly, error, duration } = state;
661
- const [local, setLocalState] = (0, import_react7.useState)(null);
750
+ const [local, setLocalState] = (0, import_react10.useState)(null);
662
751
  const setLocal = (text) => setLocalState(text ? { text, revision: state.revision } : null);
663
- const [fitTo, setFitTo] = (0, import_react7.useState)("");
752
+ const [fitTo, setFitTo] = (0, import_react10.useState)("");
664
753
  const apply = (edit, label) => {
665
754
  setLocal(null);
666
755
  return controller.apply(edit, label);
@@ -687,32 +776,32 @@ function SceneSettings({ controller, className = "" }) {
687
776
  };
688
777
  const beat = scene.beat;
689
778
  const message = (local && local.revision === state.revision ? local.text : null) ?? error;
690
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: `flex flex-col gap-1.5 text-xs ${className}`, "data-scene-settings": "", children: [
691
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "grid grid-cols-[6.5rem_1fr] items-center gap-x-2 gap-y-1", children: [
692
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("label", { className: "text-muted-foreground", children: "Loop" }),
693
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("select", { className: input2, "aria-label": "Scene loop", disabled: readOnly, value: scene.loop ?? "none", onChange: (e) => settings({ loop: e.target.value }, "Change loop"), children: [
694
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: "none", children: "Off" }),
695
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: "loop", children: "Loop" }),
696
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: "ping-pong", children: "Ping-pong" })
779
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: `flex flex-col gap-1.5 text-xs ${className}`, "data-scene-settings": "", children: [
780
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "grid grid-cols-[6.5rem_1fr] items-center gap-x-2 gap-y-1", children: [
781
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-muted-foreground", children: "Loop" }),
782
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("select", { className: input2, "aria-label": "Scene loop", disabled: readOnly, value: scene.loop ?? "none", onChange: (e) => settings({ loop: e.target.value }, "Change loop"), children: [
783
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "none", children: "Off" }),
784
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "loop", children: "Loop" }),
785
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "ping-pong", children: "Ping-pong" })
697
786
  ] }),
698
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("label", { className: "text-muted-foreground", children: "Motion blur" }),
699
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("select", { className: input2, "aria-label": "Motion blur", disabled: readOnly, value: scene.motionBlur ? String(scene.motionBlur.shutter ?? 180) : "", onChange: (e) => settings({ motionBlur: e.target.value ? { ...scene.motionBlur ?? {}, shutter: Number(e.target.value) } : null }, "Change motion blur"), children: [
700
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: "", children: "Off" }),
701
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: "90", children: "Light (90\xB0)" }),
702
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: "180", children: "Normal (180\xB0)" }),
703
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: "360", children: "Heavy (360\xB0)" })
787
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-muted-foreground", children: "Motion blur" }),
788
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("select", { className: input2, "aria-label": "Motion blur", disabled: readOnly, value: scene.motionBlur ? String(scene.motionBlur.shutter ?? 180) : "", onChange: (e) => settings({ motionBlur: e.target.value ? { ...scene.motionBlur ?? {}, shutter: Number(e.target.value) } : null }, "Change motion blur"), children: [
789
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "", children: "Off" }),
790
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "90", children: "Light (90\xB0)" }),
791
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "180", children: "Normal (180\xB0)" }),
792
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "360", children: "Heavy (360\xB0)" })
704
793
  ] }),
705
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("label", { className: "text-muted-foreground", children: "Plays on" }),
706
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("select", { className: input2, "aria-label": "Scene trigger", title: "How a viewer plays it when exported to Flair", disabled: readOnly, value: scene.trigger ?? "", onChange: (e) => settings({ trigger: e.target.value || null }, "Change trigger"), children: [
707
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: "", children: "Its own (autoplay)" }),
708
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: "click", children: "Click (a shot per click)" }),
709
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: "hover", children: "Hover" }),
710
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: "press", children: "Press" }),
711
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: "scroll", children: "Scroll" })
794
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-muted-foreground", children: "Plays on" }),
795
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("select", { className: input2, "aria-label": "Scene trigger", title: "How a viewer plays it when exported to Flair", disabled: readOnly, value: scene.trigger ?? "", onChange: (e) => settings({ trigger: e.target.value || null }, "Change trigger"), children: [
796
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "", children: "Its own (autoplay)" }),
797
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "click", children: "Click (a shot per click)" }),
798
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "hover", children: "Hover" }),
799
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "press", children: "Press" }),
800
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "scroll", children: "Scroll" })
712
801
  ] }),
713
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("label", { className: "text-muted-foreground", children: "Frame rate" }),
714
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex items-center gap-1", children: [
715
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
802
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-muted-foreground", children: "Frame rate" }),
803
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center gap-1", children: [
804
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
716
805
  CommitInput,
717
806
  {
718
807
  className: input2,
@@ -728,9 +817,9 @@ function SceneSettings({ controller, className = "" }) {
728
817
  ),
729
818
  unit("fps")
730
819
  ] }),
731
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("label", { className: "text-muted-foreground", title: "Hold changes on a grid of this many frames a second (12 = on twos); empty is smooth", children: "Steps" }),
732
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex items-center gap-1", children: [
733
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
820
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-muted-foreground", title: "Hold changes on a grid of this many frames a second (12 = on twos); empty is smooth", children: "Steps" }),
821
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center gap-1", children: [
822
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
734
823
  CommitInput,
735
824
  {
736
825
  className: input2,
@@ -746,9 +835,9 @@ function SceneSettings({ controller, className = "" }) {
746
835
  ),
747
836
  unit("fps")
748
837
  ] }),
749
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("label", { className: "text-muted-foreground", children: "Target length" }),
750
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex items-center gap-1", children: [
751
- [0, 1].map((i) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
838
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-muted-foreground", children: "Target length" }),
839
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center gap-1", children: [
840
+ [0, 1].map((i) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
752
841
  CommitInput,
753
842
  {
754
843
  className: input2,
@@ -771,15 +860,15 @@ function SceneSettings({ controller, className = "" }) {
771
860
  )),
772
861
  unit("s")
773
862
  ] }),
774
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("label", { className: "text-muted-foreground", children: "Fit to" }),
775
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex items-center gap-1", children: [
776
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("input", { className: input2, type: "number", min: 0.1, step: 0.5, "aria-label": "Fit to", value: fitSeconds, onChange: (e) => setFitTo(e.target.value) }),
863
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-muted-foreground", children: "Fit to" }),
864
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center gap-1", children: [
865
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("input", { className: input2, type: "number", min: 0.1, step: 0.5, "aria-label": "Fit to", value: fitSeconds, onChange: (e) => setFitTo(e.target.value) }),
777
866
  unit("s"),
778
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { type: "button", className: btn2, disabled: readOnly || !scene.shots.length, onClick: fit, "data-fit": "", title: "Change the shots' speeds so the scene lasts this long", children: "Fit" })
867
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", className: btn2, disabled: readOnly || !scene.shots.length, onClick: fit, "data-fit": "", title: "Change the shots' speeds so the scene lasts this long", children: "Fit" })
779
868
  ] }),
780
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("label", { className: "text-muted-foreground", children: "Beat grid" }),
781
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex items-center gap-1", "data-beat-grid": "", children: [
782
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
869
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "text-muted-foreground", children: "Beat grid" }),
870
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center gap-1", "data-beat-grid": "", children: [
871
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
783
872
  CommitInput,
784
873
  {
785
874
  className: input2,
@@ -792,7 +881,7 @@ function SceneSettings({ controller, className = "" }) {
792
881
  onCommit: (raw) => num(raw, "BPM must be above 0.", (n) => n > 0, (n) => settings({ beat: n === null ? null : { ...beat ?? {}, bpm: n } }, n === null ? "Clear beat grid" : "Change tempo"))
793
882
  }
794
883
  ),
795
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
884
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
796
885
  CommitInput,
797
886
  {
798
887
  className: input2,
@@ -804,7 +893,7 @@ function SceneSettings({ controller, className = "" }) {
804
893
  onCommit: (raw) => beat && num(raw, "The offset is a number of ms.", () => true, (n) => settings({ beat: { ...beat, offset: n ?? 0 } }, "Change beat offset"))
805
894
  }
806
895
  ),
807
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
896
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
808
897
  CommitInput,
809
898
  {
810
899
  className: input2,
@@ -820,9 +909,9 @@ function SceneSettings({ controller, className = "" }) {
820
909
  )
821
910
  ] })
822
911
  ] }),
823
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { className: "flex flex-col gap-0.5", children: [
824
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "text-muted-foreground", children: "Narration (a word a line: start ms, then the word)" }),
825
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
912
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { className: "flex flex-col gap-0.5", children: [
913
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-muted-foreground", children: "Narration (a word a line: start ms, then the word)" }),
914
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
826
915
  "textarea",
827
916
  {
828
917
  className: `${input2} h-20 font-mono`,
@@ -840,9 +929,9 @@ function SceneSettings({ controller, className = "" }) {
840
929
  (0, import_animation_editor7.formatMotionNarration)(scene.narration)
841
930
  )
842
931
  ] }),
843
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { className: "flex flex-col gap-0.5", children: [
844
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "text-muted-foreground", children: "Drivers (one a line: target.property <- source.property * factor)" }),
845
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
932
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { className: "flex flex-col gap-0.5", children: [
933
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-muted-foreground", children: "Drivers (one a line: target.property <- source.property * factor)" }),
934
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
846
935
  "textarea",
847
936
  {
848
937
  className: `${input2} h-14 font-mono`,
@@ -860,23 +949,23 @@ function SceneSettings({ controller, className = "" }) {
860
949
  (0, import_animation_editor7.formatMotionDrivers)(scene.drivers)
861
950
  )
862
951
  ] }),
863
- message && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { className: "text-red-500", role: "alert", "data-edit-error": "", children: message })
952
+ message && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "text-red-500", role: "alert", "data-edit-error": "", children: message })
864
953
  ] });
865
954
  }
866
955
 
867
956
  // src/animation-editor/ShotInspector.tsx
868
- var import_react8 = require("react");
957
+ var import_react11 = require("react");
869
958
  var import_animation_editor8 = require("@pixerate/editor/animation-editor");
870
- var import_jsx_runtime9 = require("react/jsx-runtime");
959
+ var import_jsx_runtime11 = require("react/jsx-runtime");
871
960
  var input3 = "w-full min-w-0 rounded border border-border bg-transparent px-1 py-0.5 text-xs";
872
961
  var btn3 = "rounded border border-border px-1.5 py-0.5 text-[11px] disabled:opacity-40";
873
962
  function ShotInspector({ controller, shot, className = "" }) {
874
963
  const state = useAnimationEditorState(controller);
875
964
  const { scene, selection, readOnly, error } = state;
876
- const [local, setLocalState] = (0, import_react8.useState)(null);
965
+ const [local, setLocalState] = (0, import_react11.useState)(null);
877
966
  const setLocal = (text) => setLocalState(text ? { text, revision: state.revision } : null);
878
- const elements = (0, import_react8.useMemo)(() => (0, import_animation_editor8.describeMotionElements)(scene), [scene.artwork]);
879
- const cues = (0, import_react8.useMemo)(() => (0, import_animation_editor8.motionCueChoices)(scene), [scene]);
967
+ const elements = (0, import_react11.useMemo)(() => (0, import_animation_editor8.describeMotionElements)(scene), [scene.artwork]);
968
+ const cues = (0, import_react11.useMemo)(() => (0, import_animation_editor8.motionCueChoices)(scene), [scene]);
880
969
  const id = shot ?? selection?.shot ?? scene.shots[0]?.id;
881
970
  const index = scene.shots.findIndex((s) => s.id === id);
882
971
  const current = scene.shots[index];
@@ -901,34 +990,34 @@ function ShotInspector({ controller, shot, className = "" }) {
901
990
  const message = (local && local.revision === state.revision ? local.text : null) ?? error;
902
991
  const cueKey = current ? (0, import_animation_editor8.motionCueKey)(current.at) : "";
903
992
  const frame = current?.camera && "frame" in current.camera ? current.camera.frame : "";
904
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: `flex flex-col gap-1.5 text-xs ${className}`, "data-shot-inspector": "", children: [
905
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center gap-1", children: [
906
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "font-medium", children: "Shot" }),
907
- current && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("code", { className: "text-[10px] text-muted-foreground", children: current.id }),
908
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "ml-auto flex gap-0.5", children: [
909
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: btn3, disabled: readOnly, onClick: addShot, "data-add-shot": "", children: "+ Shot" }),
910
- current && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
911
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: btn3, "aria-label": "Move shot earlier", disabled: readOnly || index === 0, onClick: () => apply({ op: "move_shot", shot: current.id, to: index - 1 }, "Move shot"), children: "\u2190" }),
912
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: btn3, "aria-label": "Move shot later", disabled: readOnly || index === scene.shots.length - 1, onClick: () => apply({ op: "move_shot", shot: current.id, to: index + 1 }, "Move shot"), children: "\u2192" }),
913
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: btn3, "aria-label": "Delete shot", disabled: readOnly, onClick: () => apply({ op: "delete_shots", shots: [current.id] }, "Delete shot"), children: "\u2715" })
993
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: `flex flex-col gap-1.5 text-xs ${className}`, "data-shot-inspector": "", children: [
994
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex items-center gap-1", children: [
995
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "font-medium", children: "Shot" }),
996
+ current && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("code", { className: "text-[10px] text-muted-foreground", children: current.id }),
997
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { className: "ml-auto flex gap-0.5", children: [
998
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", className: btn3, disabled: readOnly, onClick: addShot, "data-add-shot": "", children: "+ Shot" }),
999
+ current && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
1000
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", className: btn3, "aria-label": "Move shot earlier", disabled: readOnly || index === 0, onClick: () => apply({ op: "move_shot", shot: current.id, to: index - 1 }, "Move shot"), children: "\u2190" }),
1001
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", className: btn3, "aria-label": "Move shot later", disabled: readOnly || index === scene.shots.length - 1, onClick: () => apply({ op: "move_shot", shot: current.id, to: index + 1 }, "Move shot"), children: "\u2192" }),
1002
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", className: btn3, "aria-label": "Delete shot", disabled: readOnly, onClick: () => apply({ op: "delete_shots", shots: [current.id] }, "Delete shot"), children: "\u2715" })
914
1003
  ] })
915
1004
  ] })
916
1005
  ] }),
917
- current && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "grid grid-cols-[6.5rem_1fr] items-center gap-x-2 gap-y-1", children: [
918
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-muted-foreground", children: "Label" }),
919
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(CommitInput, { className: input3, "aria-label": "Shot label", disabled: readOnly, value: current.label ?? "", onCommit: (raw) => apply(raw.trim() ? { op: "update_shot", shot: current.id, set: { label: raw.trim() } } : { op: "update_shot", shot: current.id, remove: ["label"] }, "Rename shot") }),
920
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-muted-foreground", children: "Hold" }),
921
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center gap-1", children: [
922
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(CommitInput, { className: input3, type: "number", min: 0, step: 50, "aria-label": "Hold", placeholder: "600", disabled: readOnly, value: current.hold !== void 0 ? String(current.hold) : "", onCommit: (raw) => number("hold", raw, "Change hold") }),
923
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "ms" })
1006
+ current && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "grid grid-cols-[6.5rem_1fr] items-center gap-x-2 gap-y-1", children: [
1007
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("label", { className: "text-muted-foreground", children: "Label" }),
1008
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(CommitInput, { className: input3, "aria-label": "Shot label", disabled: readOnly, value: current.label ?? "", onCommit: (raw) => apply(raw.trim() ? { op: "update_shot", shot: current.id, set: { label: raw.trim() } } : { op: "update_shot", shot: current.id, remove: ["label"] }, "Rename shot") }),
1009
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("label", { className: "text-muted-foreground", children: "Hold" }),
1010
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex items-center gap-1", children: [
1011
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(CommitInput, { className: input3, type: "number", min: 0, step: 50, "aria-label": "Hold", placeholder: "600", disabled: readOnly, value: current.hold !== void 0 ? String(current.hold) : "", onCommit: (raw) => number("hold", raw, "Change hold") }),
1012
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "ms" })
924
1013
  ] }),
925
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-muted-foreground", children: "Speed" }),
926
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center gap-1", children: [
927
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(CommitInput, { className: input3, type: "number", min: 0.05, step: 0.05, "aria-label": "Speed", placeholder: "1", disabled: readOnly, value: current.speed !== void 0 ? String(current.speed) : "", onCommit: (raw) => number("speed", raw, "Change speed") }),
928
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "\xD7" })
1014
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("label", { className: "text-muted-foreground", children: "Speed" }),
1015
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex items-center gap-1", children: [
1016
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(CommitInput, { className: input3, type: "number", min: 0.05, step: 0.05, "aria-label": "Speed", placeholder: "1", disabled: readOnly, value: current.speed !== void 0 ? String(current.speed) : "", onCommit: (raw) => number("speed", raw, "Change speed") }),
1017
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "\xD7" })
929
1018
  ] }),
930
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-muted-foreground", children: "Camera" }),
931
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
1019
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("label", { className: "text-muted-foreground", children: "Camera" }),
1020
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
932
1021
  "select",
933
1022
  {
934
1023
  className: input3,
@@ -941,17 +1030,17 @@ function ShotInspector({ controller, shot, className = "" }) {
941
1030
  else if (v.startsWith("frame:")) apply({ op: "update_shot", shot: current.id, set: { camera: { frame: v.slice(6), padding: 24 } } }, "Frame camera");
942
1031
  },
943
1032
  children: [
944
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "", children: "keep framing" }),
945
- current.camera && !frame && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "rect", children: "a rectangle" }),
946
- elements.map((e) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("option", { value: `frame:${e.id}`, children: [
1033
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("option", { value: "", children: "keep framing" }),
1034
+ current.camera && !frame && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("option", { value: "rect", children: "a rectangle" }),
1035
+ elements.map((e) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("option", { value: `frame:${e.id}`, children: [
947
1036
  "frame ",
948
1037
  e.name ?? e.id
949
1038
  ] }, e.id))
950
1039
  ]
951
1040
  }
952
1041
  ),
953
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-muted-foreground", children: "Starts on" }),
954
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
1042
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("label", { className: "text-muted-foreground", children: "Starts on" }),
1043
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
955
1044
  "select",
956
1045
  {
957
1046
  className: input3,
@@ -963,30 +1052,30 @@ function ShotInspector({ controller, shot, className = "" }) {
963
1052
  apply(cue ? { op: "update_shot", shot: current.id, set: { at: cue } } : { op: "update_shot", shot: current.id, remove: ["at"] }, "Cue shot");
964
1053
  },
965
1054
  children: [
966
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "", children: "after the shot before" }),
967
- cueKey && !cues.some((c) => c.value === cueKey) && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: cueKey, children: cueKey }),
968
- cues.map((c) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: c.value, children: c.label }, c.value))
1055
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("option", { value: "", children: "after the shot before" }),
1056
+ cueKey && !cues.some((c) => c.value === cueKey) && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("option", { value: cueKey, children: cueKey }),
1057
+ cues.map((c) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("option", { value: c.value, children: c.label }, c.value))
969
1058
  ]
970
1059
  }
971
1060
  ),
972
- !cues.length && index > 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "col-span-2 text-[10px] text-muted-foreground", children: "Add a beat grid or narration in the scene settings to cue shots to them." })
1061
+ !cues.length && index > 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "col-span-2 text-[10px] text-muted-foreground", children: "Add a beat grid or narration in the scene settings to cue shots to them." })
973
1062
  ] }),
974
- message && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "text-red-500", role: "alert", "data-edit-error": "", children: message })
1063
+ message && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "text-red-500", role: "alert", "data-edit-error": "", children: message })
975
1064
  ] });
976
1065
  }
977
1066
 
978
1067
  // src/effects/useEffects.ts
979
- var import_react9 = require("react");
1068
+ var import_react12 = require("react");
980
1069
  function useEffects(host, provider) {
981
- (0, import_react9.useEffect)(() => {
1070
+ (0, import_react12.useEffect)(() => {
982
1071
  if (!host || !provider) return;
983
1072
  return host.useEffects(provider);
984
1073
  }, [host, provider]);
985
1074
  }
986
1075
  function useEffectDescription(provider, effect) {
987
- const [state, setState] = (0, import_react9.useState)({ key: "", description: null, error: null });
1076
+ const [state, setState] = (0, import_react12.useState)({ key: "", description: null, error: null });
988
1077
  const key = provider && effect ? `${provider.id}:${effect}` : "";
989
- (0, import_react9.useEffect)(() => {
1078
+ (0, import_react12.useEffect)(() => {
990
1079
  if (!provider || !effect) return;
991
1080
  let live = true;
992
1081
  Promise.resolve().then(() => provider.describe(effect)).then(
@@ -1001,13 +1090,13 @@ function useEffectDescription(provider, effect) {
1001
1090
  }
1002
1091
 
1003
1092
  // src/effects/EffectThumbnail.tsx
1004
- var import_react10 = require("react");
1093
+ var import_react13 = require("react");
1005
1094
  var import_effects = require("@pixerate/editor/effects");
1006
- var import_jsx_runtime10 = require("react/jsx-runtime");
1095
+ var import_jsx_runtime12 = require("react/jsx-runtime");
1007
1096
  function EffectThumbnail({ provider, effect, width = 96, height = 54, className = "" }) {
1008
- const ref = (0, import_react10.useRef)(null);
1009
- const [failed, setFailed] = (0, import_react10.useState)(effect.kind === "motion");
1010
- (0, import_react10.useEffect)(() => {
1097
+ const ref = (0, import_react13.useRef)(null);
1098
+ const [failed, setFailed] = (0, import_react13.useState)(effect.kind === "motion");
1099
+ (0, import_react13.useEffect)(() => {
1011
1100
  if (effect.kind === "motion") return;
1012
1101
  let live = true;
1013
1102
  (0, import_effects.renderEffectThumbnail)(provider, effect, { width, height }).then(
@@ -1022,28 +1111,28 @@ function EffectThumbnail({ provider, effect, width = 96, height = 54, className
1022
1111
  live = false;
1023
1112
  };
1024
1113
  }, [provider, effect, width, height]);
1025
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1114
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1026
1115
  "div",
1027
1116
  {
1028
1117
  className: `relative overflow-hidden rounded border border-border bg-[repeating-conic-gradient(#8884_0_25%,transparent_0_50%)] bg-[length:12px_12px] ${className}`,
1029
1118
  style: { aspectRatio: `${width} / ${height}` },
1030
1119
  "data-effect-thumbnail": effect.id,
1031
- children: failed ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "absolute inset-0 flex items-center justify-center text-[10px] text-muted-foreground", children: effect.kind === "motion" ? "Motion" : "No preview" }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("canvas", { ref, width, height, className: "h-full w-full", "aria-hidden": "true" })
1120
+ children: failed ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "absolute inset-0 flex items-center justify-center text-[10px] text-muted-foreground", children: effect.kind === "motion" ? "Motion" : "No preview" }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("canvas", { ref, width, height, className: "h-full w-full", "aria-hidden": "true" })
1032
1121
  }
1033
1122
  );
1034
1123
  }
1035
1124
 
1036
1125
  // src/effects/EffectsBrowser.tsx
1037
- var import_react11 = require("react");
1126
+ var import_react14 = require("react");
1038
1127
  var import_effects2 = require("@pixerate/editor/effects");
1039
- var import_jsx_runtime11 = require("react/jsx-runtime");
1128
+ var import_jsx_runtime13 = require("react/jsx-runtime");
1040
1129
  function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, title = "Effects", className = "" }) {
1041
- const [all, setAll] = (0, import_react11.useState)([]);
1042
- const [query, setQuery] = (0, import_react11.useState)("");
1043
- const [category, setCategory] = (0, import_react11.useState)("");
1044
- const [use, setUse] = (0, import_react11.useState)("");
1045
- const [error, setError] = (0, import_react11.useState)(null);
1046
- (0, import_react11.useEffect)(() => {
1130
+ const [all, setAll] = (0, import_react14.useState)([]);
1131
+ const [query, setQuery] = (0, import_react14.useState)("");
1132
+ const [category, setCategory] = (0, import_react14.useState)("");
1133
+ const [use, setUse] = (0, import_react14.useState)("");
1134
+ const [error, setError] = (0, import_react14.useState)(null);
1135
+ (0, import_react14.useEffect)(() => {
1047
1136
  if (!provider) return setAll([]);
1048
1137
  let live = true;
1049
1138
  Promise.resolve().then(() => provider.list()).then(
@@ -1054,8 +1143,8 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
1054
1143
  live = false;
1055
1144
  };
1056
1145
  }, [provider]);
1057
- const [found, setFound] = (0, import_react11.useState)([]);
1058
- (0, import_react11.useEffect)(() => {
1146
+ const [found, setFound] = (0, import_react14.useState)([]);
1147
+ (0, import_react14.useEffect)(() => {
1059
1148
  if (!provider) return setFound([]);
1060
1149
  let live = true;
1061
1150
  Promise.resolve().then(() => provider.search(query, { ...category ? { category } : {}, ...use ? { use } : {} })).then((list) => live && setFound(list), () => live && setFound([]));
@@ -1064,14 +1153,14 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
1064
1153
  };
1065
1154
  }, [provider, query, category, use]);
1066
1155
  const allowed = (e) => (!kinds || kinds.includes(e.kind)) && (uses ? e.kind !== "motion" || uses.includes("motion") : e.kind !== "motion") && (!uses || e.uses.some((u) => uses.includes(u)));
1067
- const categories = (0, import_react11.useMemo)(() => [...new Set(all.filter(allowed).map((e) => e.category))], [all, uses, kinds]);
1156
+ const categories = (0, import_react14.useMemo)(() => [...new Set(all.filter(allowed).map((e) => e.category))], [all, uses, kinds]);
1068
1157
  const shown = found.filter(allowed);
1069
1158
  if (!provider)
1070
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: `rounded-md border border-dashed border-border p-3 text-xs text-muted-foreground ${className}`, "data-effects-browser": "", "data-effects-unavailable": "", children: "No effects provider is registered, so effects cannot be added. Effects already in the document are kept." });
1071
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("section", { className: `flex flex-col gap-2 ${className}`, "data-effects-browser": "", "aria-label": "Effects browser", children: [
1072
- title && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("h3", { className: "text-xs font-semibold", children: title }),
1073
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
1074
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1159
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: `rounded-md border border-dashed border-border p-3 text-xs text-muted-foreground ${className}`, "data-effects-browser": "", "data-effects-unavailable": "", children: "No effects provider is registered, so effects cannot be added. Effects already in the document are kept." });
1160
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("section", { className: `flex flex-col gap-2 ${className}`, "data-effects-browser": "", "aria-label": "Effects browser", children: [
1161
+ title && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("h3", { className: "text-xs font-semibold", children: title }),
1162
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
1163
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1075
1164
  "input",
1076
1165
  {
1077
1166
  type: "search",
@@ -1082,17 +1171,17 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
1082
1171
  onChange: (e) => setQuery(e.currentTarget.value)
1083
1172
  }
1084
1173
  ),
1085
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("select", { className: "rounded border border-border bg-transparent px-1 py-0.5 text-xs", "aria-label": "Category", value: category, onChange: (e) => setCategory(e.currentTarget.value), children: [
1086
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("option", { value: "", children: "All categories" }),
1087
- categories.map((c) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("option", { value: c, children: c }, c))
1174
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("select", { className: "rounded border border-border bg-transparent px-1 py-0.5 text-xs", "aria-label": "Category", value: category, onChange: (e) => setCategory(e.currentTarget.value), children: [
1175
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("option", { value: "", children: "All categories" }),
1176
+ categories.map((c) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("option", { value: c, children: c }, c))
1088
1177
  ] }),
1089
- uses && uses.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("select", { className: "rounded border border-border bg-transparent px-1 py-0.5 text-xs", "aria-label": "Use", value: use, onChange: (e) => setUse(e.currentTarget.value), children: [
1090
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("option", { value: "", children: "Any use" }),
1091
- uses.map((u) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("option", { value: u, children: import_effects2.EFFECT_USE_LABELS[u] }, u))
1178
+ uses && uses.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("select", { className: "rounded border border-border bg-transparent px-1 py-0.5 text-xs", "aria-label": "Use", value: use, onChange: (e) => setUse(e.currentTarget.value), children: [
1179
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("option", { value: "", children: "Any use" }),
1180
+ uses.map((u) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("option", { value: u, children: import_effects2.EFFECT_USE_LABELS[u] }, u))
1092
1181
  ] })
1093
1182
  ] }),
1094
- error && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { role: "alert", className: "text-[11px] text-destructive", children: error }),
1095
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("ul", { className: "grid max-h-96 grid-cols-[repeat(auto-fill,minmax(6.5rem,1fr))] gap-1.5 overflow-y-auto", role: "list", children: shown.map((e) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
1183
+ error && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { role: "alert", className: "text-[11px] text-destructive", children: error }),
1184
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("ul", { className: "grid max-h-96 grid-cols-[repeat(auto-fill,minmax(6.5rem,1fr))] gap-1.5 overflow-y-auto", role: "list", children: shown.map((e) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
1096
1185
  "button",
1097
1186
  {
1098
1187
  type: "button",
@@ -1101,25 +1190,25 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
1101
1190
  "data-effect-id": e.id,
1102
1191
  onClick: () => onPick(e),
1103
1192
  children: [
1104
- thumbnails && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(EffectThumbnail, { provider, effect: e }),
1105
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "truncate text-[11px] font-medium", children: e.name }),
1106
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "truncate text-[10px] text-muted-foreground", children: e.uses.map((u) => import_effects2.EFFECT_USE_LABELS[u]).join(" \xB7 ") })
1193
+ thumbnails && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(EffectThumbnail, { provider, effect: e }),
1194
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "truncate text-[11px] font-medium", children: e.name }),
1195
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "truncate text-[10px] text-muted-foreground", children: e.uses.map((u) => import_effects2.EFFECT_USE_LABELS[u]).join(" \xB7 ") })
1107
1196
  ]
1108
1197
  }
1109
1198
  ) }, e.id)) }),
1110
- !shown.length && !error && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No effects match." })
1199
+ !shown.length && !error && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No effects match." })
1111
1200
  ] });
1112
1201
  }
1113
1202
 
1114
1203
  // src/effects/EffectParameters.tsx
1115
- var import_react13 = __toESM(require("react"), 1);
1204
+ var import_react16 = __toESM(require("react"), 1);
1116
1205
  var import_effects3 = require("@pixerate/editor/effects");
1117
1206
  var import_parameters2 = require("@pixerate/editor/parameters");
1118
1207
 
1119
1208
  // src/parameters/fields.tsx
1120
- var import_react12 = require("react");
1209
+ var import_react15 = require("react");
1121
1210
  var import_parameters = require("@pixerate/editor/parameters");
1122
- var import_jsx_runtime12 = require("react/jsx-runtime");
1211
+ var import_jsx_runtime14 = require("react/jsx-runtime");
1123
1212
  var parameterInputClass = "h-7 w-full min-w-0 rounded-md border border-input bg-background px-2 text-xs text-foreground tabular-nums focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary disabled:cursor-not-allowed disabled:opacity-50";
1124
1213
  var parameterButtonClass = "inline-flex h-7 items-center justify-center gap-1 rounded-md border border-input bg-background px-2 text-xs text-foreground hover:bg-muted focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary disabled:pointer-events-none disabled:opacity-50";
1125
1214
  var rangeClass = "h-4 w-full min-w-0 flex-1 cursor-pointer accent-primary disabled:cursor-not-allowed disabled:opacity-50";
@@ -1143,7 +1232,7 @@ function ParameterCommitInput({ value, onCommit, multiline, className, onKeyDown
1143
1232
  onKeyDown: keyDown,
1144
1233
  ...rest
1145
1234
  };
1146
- return multiline ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("textarea", { ...props, className: `${props.className} h-auto min-h-[3.5rem] py-1` }, value) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("input", { type: "text", ...props }, value);
1235
+ return multiline ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("textarea", { ...props, className: `${props.className} h-auto min-h-[3.5rem] py-1` }, value) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("input", { type: "text", ...props }, value);
1147
1236
  }
1148
1237
  var plainNumber = (field, value) => (0, import_parameters.formatParameterNumber)({ ...field, unit: void 0 }, value);
1149
1238
  function ParameterNumberInput({
@@ -1154,8 +1243,8 @@ function ParameterNumberInput({
1154
1243
  id,
1155
1244
  "aria-label": ariaLabel
1156
1245
  }) {
1157
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "relative min-w-0 flex-1", children: [
1158
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1246
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "relative min-w-0 flex-1", children: [
1247
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1159
1248
  ParameterCommitInput,
1160
1249
  {
1161
1250
  id,
@@ -1177,21 +1266,21 @@ function ParameterNumberInput({
1177
1266
  }
1178
1267
  }
1179
1268
  ),
1180
- field.unit && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "pointer-events-none absolute right-2 top-1/2 -translate-y-1/2 text-[10px] text-muted-foreground", children: field.unit })
1269
+ field.unit && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "pointer-events-none absolute right-2 top-1/2 -translate-y-1/2 text-[10px] text-muted-foreground", children: field.unit })
1181
1270
  ] });
1182
1271
  }
1183
1272
  function ParameterSlider(props) {
1184
1273
  const { field, value, onChange, onGestureStart, onGestureEnd, disabled } = props;
1185
- const dragging = (0, import_react12.useRef)(false);
1274
+ const dragging = (0, import_react15.useRef)(false);
1186
1275
  const end = () => {
1187
1276
  if (!dragging.current) return;
1188
1277
  dragging.current = false;
1189
1278
  onGestureEnd?.();
1190
1279
  };
1191
- if (!(0, import_parameters.isSliderField)(field)) return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ParameterNumberInput, { ...props });
1280
+ if (!(0, import_parameters.isSliderField)(field)) return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ParameterNumberInput, { ...props });
1192
1281
  const step = (0, import_parameters.parameterStep)(field);
1193
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center gap-2", children: [
1194
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1282
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex items-center gap-2", children: [
1283
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1195
1284
  "input",
1196
1285
  {
1197
1286
  type: "range",
@@ -1214,11 +1303,11 @@ function ParameterSlider(props) {
1214
1303
  onChange: (e) => onChange((0, import_parameters.clampParameterNumber)(field, Number(e.target.value)))
1215
1304
  }
1216
1305
  ),
1217
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "w-20 shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ParameterNumberInput, { ...props, id: props.id, "aria-label": `${(0, import_parameters.parameterLabel)(field)} value` }) })
1306
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "w-20 shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ParameterNumberInput, { ...props, id: props.id, "aria-label": `${(0, import_parameters.parameterLabel)(field)} value` }) })
1218
1307
  ] });
1219
1308
  }
1220
1309
  function ParameterToggle({ field, value, onChange, disabled, id }) {
1221
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1310
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1222
1311
  "button",
1223
1312
  {
1224
1313
  type: "button",
@@ -1229,7 +1318,7 @@ function ParameterToggle({ field, value, onChange, disabled, id }) {
1229
1318
  disabled: disabled || field.readOnly,
1230
1319
  onClick: () => onChange(!value),
1231
1320
  className: `relative inline-flex h-5 w-9 shrink-0 items-center rounded-full border border-transparent transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary disabled:opacity-50 ${value ? "bg-primary" : "bg-muted"}`,
1232
- children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1321
+ children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1233
1322
  "span",
1234
1323
  {
1235
1324
  className: `pointer-events-none block h-4 w-4 rounded-full bg-background shadow transition-transform ${value ? "translate-x-4" : "translate-x-0.5"}`
@@ -1242,7 +1331,7 @@ function ParameterSelect({ field, value, onChange, disabled, id }) {
1242
1331
  const options = (0, import_parameters.getChoiceOptions)(field);
1243
1332
  const off = disabled || field.readOnly;
1244
1333
  if (field.control === "segmented") {
1245
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { role: "radiogroup", "aria-label": (0, import_parameters.parameterLabel)(field), className: "inline-flex flex-wrap rounded-md border border-input bg-muted p-0.5", children: options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1334
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { role: "radiogroup", "aria-label": (0, import_parameters.parameterLabel)(field), className: "inline-flex flex-wrap rounded-md border border-input bg-muted p-0.5", children: options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1246
1335
  "button",
1247
1336
  {
1248
1337
  type: "button",
@@ -1258,7 +1347,7 @@ function ParameterSelect({ field, value, onChange, disabled, id }) {
1258
1347
  )) });
1259
1348
  }
1260
1349
  const index = options.findIndex((o) => o.value === value);
1261
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1350
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1262
1351
  "select",
1263
1352
  {
1264
1353
  id,
@@ -1270,12 +1359,12 @@ function ParameterSelect({ field, value, onChange, disabled, id }) {
1270
1359
  if (option) onChange(option.value);
1271
1360
  },
1272
1361
  className: parameterInputClass,
1273
- children: options.map((o, i) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: String(i), title: o.description, children: (0, import_parameters.choiceOptionLabel)(o) }, String(o.value)))
1362
+ children: options.map((o, i) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: String(i), title: o.description, children: (0, import_parameters.choiceOptionLabel)(o) }, String(o.value)))
1274
1363
  }
1275
1364
  );
1276
1365
  }
1277
1366
  function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd, disabled, id }) {
1278
- const picking = (0, import_react12.useRef)(false);
1367
+ const picking = (0, import_react15.useRef)(false);
1279
1368
  const alpha = !!field.alpha;
1280
1369
  const hex = (0, import_parameters.normalizeHexColor)(value, true) ?? "#000000ff";
1281
1370
  const rgb = hex.slice(0, 7);
@@ -1291,11 +1380,11 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
1291
1380
  picking.current = false;
1292
1381
  onGestureEnd?.();
1293
1382
  };
1294
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "space-y-1.5", children: [
1295
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center gap-2", children: [
1296
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { className: "relative h-7 w-9 shrink-0 overflow-hidden rounded-md border border-input bg-[repeating-conic-gradient(#d4d4d8_0_25%,#fff_0_50%)] bg-[length:8px_8px]", children: [
1297
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "absolute inset-0", style: { background: alpha ? hex : rgb } }),
1298
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1383
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "space-y-1.5", children: [
1384
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex items-center gap-2", children: [
1385
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "relative h-7 w-9 shrink-0 overflow-hidden rounded-md border border-input bg-[repeating-conic-gradient(#d4d4d8_0_25%,#fff_0_50%)] bg-[length:8px_8px]", children: [
1386
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "absolute inset-0", style: { background: alpha ? hex : rgb } }),
1387
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1299
1388
  "input",
1300
1389
  {
1301
1390
  type: "color",
@@ -1311,7 +1400,7 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
1311
1400
  }
1312
1401
  )
1313
1402
  ] }),
1314
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1403
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1315
1404
  ParameterCommitInput,
1316
1405
  {
1317
1406
  id,
@@ -1327,7 +1416,7 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
1327
1416
  }
1328
1417
  )
1329
1418
  ] }),
1330
- alpha && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1419
+ alpha && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1331
1420
  "input",
1332
1421
  {
1333
1422
  type: "range",
@@ -1345,10 +1434,10 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
1345
1434
  onChange: (e) => onChange(`${rgb}${Number(e.target.value).toString(16).padStart(2, "0")}`)
1346
1435
  }
1347
1436
  ),
1348
- field.swatches && field.swatches.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "flex flex-wrap gap-1", children: field.swatches.map((s) => {
1437
+ field.swatches && field.swatches.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "flex flex-wrap gap-1", children: field.swatches.map((s) => {
1349
1438
  const swatch = (0, import_parameters.normalizeHexColor)(s, alpha);
1350
1439
  if (!swatch) return null;
1351
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1440
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1352
1441
  "button",
1353
1442
  {
1354
1443
  type: "button",
@@ -1367,11 +1456,11 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
1367
1456
  }
1368
1457
  function ParameterVector({ field, value, onChange, disabled, id }) {
1369
1458
  const size = (0, import_parameters.vectorSize)(field);
1370
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "grid gap-1.5", style: { gridTemplateColumns: `repeat(${size}, minmax(0, 1fr))` }, children: Array.from({ length: size }, (_, i) => {
1459
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "grid gap-1.5", style: { gridTemplateColumns: `repeat(${size}, minmax(0, 1fr))` }, children: Array.from({ length: size }, (_, i) => {
1371
1460
  const component = (0, import_parameters.vectorComponentField)(field, i);
1372
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("label", { className: "flex min-w-0 items-center gap-1", children: [
1373
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "w-3 shrink-0 text-[10px] uppercase text-muted-foreground", children: component.label }),
1374
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1461
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { className: "flex min-w-0 items-center gap-1", children: [
1462
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "w-3 shrink-0 text-[10px] uppercase text-muted-foreground", children: component.label }),
1463
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1375
1464
  ParameterNumberInput,
1376
1465
  {
1377
1466
  field: component,
@@ -1388,11 +1477,11 @@ function ParameterVector({ field, value, onChange, disabled, id }) {
1388
1477
  function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
1389
1478
  const off = disabled || field.readOnly;
1390
1479
  const name = (0, import_parameters.parameterLabel)(field);
1391
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "space-y-1.5", children: [
1392
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center gap-2", children: [
1393
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "flex h-12 w-16 shrink-0 items-center justify-center overflow-hidden rounded-md border border-input bg-muted", children: value ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("img", { src: value, alt: name, className: "h-full w-full object-cover" }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "None" }) }),
1394
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
1395
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1480
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "space-y-1.5", children: [
1481
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex items-center gap-2", children: [
1482
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "flex h-12 w-16 shrink-0 items-center justify-center overflow-hidden rounded-md border border-input bg-muted", children: value ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("img", { src: value, alt: name, className: "h-full w-full object-cover" }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "None" }) }),
1483
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
1484
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1396
1485
  ParameterCommitInput,
1397
1486
  {
1398
1487
  id,
@@ -1403,10 +1492,10 @@ function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
1403
1492
  onCommit: (text) => onChange(text.trim())
1404
1493
  }
1405
1494
  ),
1406
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex gap-1", children: [
1407
- resolveFile && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("label", { className: `${parameterButtonClass} cursor-pointer ${off ? "pointer-events-none opacity-50" : ""}`, children: [
1495
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex gap-1", children: [
1496
+ resolveFile && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { className: `${parameterButtonClass} cursor-pointer ${off ? "pointer-events-none opacity-50" : ""}`, children: [
1408
1497
  "Choose file\u2026",
1409
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1498
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1410
1499
  "input",
1411
1500
  {
1412
1501
  type: "file",
@@ -1422,11 +1511,11 @@ function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
1422
1511
  }
1423
1512
  )
1424
1513
  ] }),
1425
- value && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", className: parameterButtonClass, disabled: off, onClick: () => onChange(""), "aria-label": `Clear ${name}`, children: "Clear" })
1514
+ value && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", className: parameterButtonClass, disabled: off, onClick: () => onChange(""), "aria-label": `Clear ${name}`, children: "Clear" })
1426
1515
  ] })
1427
1516
  ] })
1428
1517
  ] }),
1429
- field.options && field.options.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "flex flex-wrap gap-1", children: field.options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1518
+ field.options && field.options.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "flex flex-wrap gap-1", children: field.options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1430
1519
  "button",
1431
1520
  {
1432
1521
  type: "button",
@@ -1436,14 +1525,14 @@ function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
1436
1525
  disabled: off,
1437
1526
  onClick: () => onChange(o.url),
1438
1527
  className: "h-9 w-12 overflow-hidden rounded border border-input aria-pressed:ring-2 aria-pressed:ring-primary",
1439
- children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("img", { src: o.url, alt: "", className: "h-full w-full object-cover" })
1528
+ children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("img", { src: o.url, alt: "", className: "h-full w-full object-cover" })
1440
1529
  },
1441
1530
  o.url
1442
1531
  )) })
1443
1532
  ] });
1444
1533
  }
1445
1534
  function ParameterText({ field, value, onChange, disabled, id }) {
1446
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1535
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1447
1536
  ParameterCommitInput,
1448
1537
  {
1449
1538
  id,
@@ -1462,31 +1551,31 @@ function ParameterFieldControl({ field, value, onChange, resolveFile, ...rest })
1462
1551
  switch (field.type) {
1463
1552
  case "number":
1464
1553
  case "int":
1465
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ParameterSlider, { field, value, onChange: set, ...rest });
1554
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ParameterSlider, { field, value, onChange: set, ...rest });
1466
1555
  case "boolean":
1467
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ParameterToggle, { field, value, onChange: set, ...rest });
1556
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ParameterToggle, { field, value, onChange: set, ...rest });
1468
1557
  case "choice":
1469
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ParameterSelect, { field, value, onChange: set, ...rest });
1558
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ParameterSelect, { field, value, onChange: set, ...rest });
1470
1559
  case "color":
1471
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ParameterColor, { field, value, onChange: set, ...rest });
1560
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ParameterColor, { field, value, onChange: set, ...rest });
1472
1561
  case "vector":
1473
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ParameterVector, { field, value, onChange: set, ...rest });
1562
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ParameterVector, { field, value, onChange: set, ...rest });
1474
1563
  case "image":
1475
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ParameterImage, { field, value, onChange: set, resolveFile, ...rest });
1564
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ParameterImage, { field, value, onChange: set, resolveFile, ...rest });
1476
1565
  case "text":
1477
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ParameterText, { field, value, onChange: set, ...rest });
1566
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ParameterText, { field, value, onChange: set, ...rest });
1478
1567
  }
1479
1568
  }
1480
1569
 
1481
1570
  // src/effects/EffectParameters.tsx
1482
- var import_jsx_runtime13 = require("react/jsx-runtime");
1571
+ var import_jsx_runtime15 = require("react/jsx-runtime");
1483
1572
  function EffectParameters({ description, values, onChange, onReset, keyframed, onPreset, disabled = false, className = "" }) {
1484
- const fields = (0, import_react13.useMemo)(() => (0, import_effects3.effectParameterFields)(description), [description]);
1485
- const idBase = (0, import_react13.useId)();
1486
- const gesture = import_react13.default.useRef(null);
1487
- const count = import_react13.default.useRef(0);
1488
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: `space-y-2 ${className}`, "data-effect-parameters": description.id, children: [
1489
- onPreset && description.presets.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
1573
+ const fields = (0, import_react16.useMemo)(() => (0, import_effects3.effectParameterFields)(description), [description]);
1574
+ const idBase = (0, import_react16.useId)();
1575
+ const gesture = import_react16.default.useRef(null);
1576
+ const count = import_react16.default.useRef(0);
1577
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: `space-y-2 ${className}`, "data-effect-parameters": description.id, children: [
1578
+ onPreset && description.presets.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
1490
1579
  "select",
1491
1580
  {
1492
1581
  className: "w-full rounded border border-border bg-transparent px-1 py-0.5 text-xs",
@@ -1498,8 +1587,8 @@ function EffectParameters({ description, values, onChange, onReset, keyframed, o
1498
1587
  if (preset) onPreset({ ...description.defaults, ...preset.values });
1499
1588
  },
1500
1589
  children: [
1501
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("option", { value: "", children: "Presets\u2026" }),
1502
- description.presets.map((p) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("option", { value: p.name, children: p.name }, p.name))
1590
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("option", { value: "", children: "Presets\u2026" }),
1591
+ description.presets.map((p) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("option", { value: p.name, children: p.name }, p.name))
1503
1592
  ]
1504
1593
  }
1505
1594
  ),
@@ -1509,13 +1598,13 @@ function EffectParameters({ description, values, onChange, onReset, keyframed, o
1509
1598
  const keyed = keyframed?.has(field.id) ?? false;
1510
1599
  const value = (0, import_effects3.effectFieldValue)(field, values[field.id]);
1511
1600
  const changed = !keyed && !(0, import_parameters2.parameterValuesEqual)(value, field.default);
1512
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "space-y-1", "data-effect-control": field.id, children: [
1513
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex items-center gap-1.5", children: [
1514
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("label", { htmlFor: inputId, className: "min-w-0 flex-1 truncate text-xs font-medium", title: field.description, children: label }),
1515
- keyed && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "keyframed" }),
1516
- onReset && changed && !disabled && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", className: "rounded px-1 text-[11px] text-muted-foreground hover:text-foreground", "aria-label": `Reset ${label}`, onClick: () => onReset(field.id), children: "\u21BA" })
1601
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "space-y-1", "data-effect-control": field.id, children: [
1602
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex items-center gap-1.5", children: [
1603
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("label", { htmlFor: inputId, className: "min-w-0 flex-1 truncate text-xs font-medium", title: field.description, children: label }),
1604
+ keyed && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "keyframed" }),
1605
+ onReset && changed && !disabled && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: "rounded px-1 text-[11px] text-muted-foreground hover:text-foreground", "aria-label": `Reset ${label}`, onClick: () => onReset(field.id), children: "\u21BA" })
1517
1606
  ] }),
1518
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1607
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1519
1608
  ParameterFieldControl,
1520
1609
  {
1521
1610
  field,
@@ -1529,25 +1618,25 @@ function EffectParameters({ description, values, onChange, onReset, keyframed, o
1529
1618
  )
1530
1619
  ] }, field.id);
1531
1620
  }),
1532
- !fields.length && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No controls." })
1621
+ !fields.length && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No controls." })
1533
1622
  ] });
1534
1623
  }
1535
1624
 
1536
1625
  // src/animation-editor/AnimationEffectsPanel.tsx
1537
- var import_react14 = require("react");
1626
+ var import_react17 = require("react");
1538
1627
  var import_animation_editor9 = require("@pixerate/editor/animation-editor");
1539
- var import_jsx_runtime14 = require("react/jsx-runtime");
1628
+ var import_jsx_runtime16 = require("react/jsx-runtime");
1540
1629
  var btn4 = "rounded border border-border px-1.5 py-0.5 text-[11px] disabled:opacity-40";
1541
1630
  function Controls({ controller, instance, effect, values }) {
1542
1631
  const provider = controller.effectsProvider;
1543
1632
  const { description, error } = useEffectDescription(provider, effect);
1544
- const [message, setMessage] = (0, import_react14.useState)(null);
1633
+ const [message, setMessage] = (0, import_react17.useState)(null);
1545
1634
  const report = (r) => void r.then((x) => setMessage(x.ok ? null : x.error));
1546
- if (!provider) return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No effects provider: its commands are kept as they are." });
1547
- if (error) return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "text-[11px] text-amber-500", children: error });
1548
- if (!description) return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "Loading\u2026" });
1549
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
1550
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1635
+ if (!provider) return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No effects provider: its commands are kept as they are." });
1636
+ if (error) return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "text-[11px] text-amber-500", children: error });
1637
+ if (!description) return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "Loading\u2026" });
1638
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
1639
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1551
1640
  EffectParameters,
1552
1641
  {
1553
1642
  description,
@@ -1557,67 +1646,103 @@ function Controls({ controller, instance, effect, values }) {
1557
1646
  onPreset: (v) => report(controller.updateMotionEffect(instance, v))
1558
1647
  }
1559
1648
  ),
1560
- message && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { role: "alert", className: "text-[11px] text-destructive", children: message })
1649
+ message && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { role: "alert", className: "text-[11px] text-destructive", children: message })
1561
1650
  ] });
1562
1651
  }
1563
1652
  function AnimationEffectsPanel({ controller, node, className = "" }) {
1564
1653
  const state = useAnimationEditorState(controller);
1565
1654
  const provider = state.effectsProvider;
1566
- const nodes = (0, import_react14.useMemo)(() => [...(0, import_animation_editor9.indexMotionNodes)(state.scene.artwork.nodes).keys()], [state.scene.artwork]);
1567
- const [chosen, setChosen] = (0, import_react14.useState)("");
1655
+ const nodes = (0, import_react17.useMemo)(() => [...(0, import_animation_editor9.indexMotionNodes)(state.scene.artwork.nodes).keys()], [state.scene.artwork]);
1656
+ const [chosen, setChosen] = (0, import_react17.useState)("");
1568
1657
  const target = node && nodes.includes(node) ? node : chosen && nodes.includes(chosen) ? chosen : "";
1569
- const [browse, setBrowse] = (0, import_react14.useState)(null);
1570
- const [open, setOpen] = (0, import_react14.useState)(null);
1571
- const [message, setMessage] = (0, import_react14.useState)(null);
1658
+ const [browse, setBrowse] = (0, import_react17.useState)(null);
1659
+ const [open, setOpen] = (0, import_react17.useState)(null);
1660
+ const [message, setMessage] = (0, import_react17.useState)(null);
1572
1661
  const report = (r) => void Promise.resolve(r).then((x) => setMessage(x.ok ? x.notes.length ? x.notes.join(" ") : null : x.error));
1573
- const applied = (0, import_react14.useMemo)(() => controller.appliedEffects(), [controller, state.scene]);
1662
+ const applied = (0, import_react17.useMemo)(() => controller.appliedEffects(), [controller, state.scene]);
1574
1663
  const disabled = state.readOnly;
1575
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("section", { className: `flex flex-col gap-2 text-xs ${className}`, "aria-label": "Effects", "data-animation-effects": "", children: [
1576
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
1577
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "flex-1 font-semibold", children: "Effects" }),
1578
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("select", { className: "rounded border border-border bg-transparent px-1 py-0.5 text-[11px]", "aria-label": "Node to animate", value: target, disabled: !!node, onChange: (e) => setChosen(e.currentTarget.value), children: [
1579
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: "", children: "Node\u2026" }),
1580
- nodes.map((id) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: id, children: id }, id))
1664
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("section", { className: `flex flex-col gap-2 text-xs ${className}`, "aria-label": "Effects", "data-animation-effects": "", children: [
1665
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
1666
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "flex-1 font-semibold", children: "Effects" }),
1667
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("select", { className: "rounded border border-border bg-transparent px-1 py-0.5 text-[11px]", "aria-label": "Node to animate", value: target, disabled: !!node, onChange: (e) => setChosen(e.currentTarget.value), children: [
1668
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: "", children: "Node\u2026" }),
1669
+ nodes.map((id) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: id, children: id }, id))
1581
1670
  ] }),
1582
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", className: btn4, disabled: disabled || !provider || !target, "aria-pressed": browse === "motion", onClick: () => setBrowse(browse === "motion" ? null : "motion"), children: "Animate\u2026" }),
1583
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", className: btn4, disabled: disabled || !provider, "aria-pressed": browse === "vector", onClick: () => setBrowse(browse === "vector" ? null : "vector"), children: "Vector effect\u2026" })
1671
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", className: btn4, disabled: disabled || !provider || !target, "aria-pressed": browse === "motion", onClick: () => setBrowse(browse === "motion" ? null : "motion"), children: "Animate\u2026" }),
1672
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", className: btn4, disabled: disabled || !provider, "aria-pressed": browse === "vector", onClick: () => setBrowse(browse === "vector" ? null : "vector"), children: "Vector effect\u2026" })
1584
1673
  ] }),
1585
- !provider && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No effects provider is registered. Commands effects made are kept." }),
1586
- browse === "motion" && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(EffectsBrowser, { provider, uses: ["motion"], kinds: ["motion"], title: `Motion for ${target}`, onPick: (e) => (setBrowse(null), report(controller.applyMotionEffect(e.id, [target]))) }),
1587
- browse === "vector" && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(EffectsBrowser, { provider, kinds: ["vector"], title: "Vector effects", onPick: (e) => (setBrowse(null), report(controller.addVectorEffect(e.id))) }),
1588
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("ol", { className: "space-y-1", children: applied.map((e) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("li", { className: "rounded border border-border p-1", "data-motion-effect": e.instance, children: [
1589
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex items-center gap-1", children: [
1590
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("button", { type: "button", className: "min-w-0 flex-1 truncate text-left", "aria-expanded": open === e.instance, onClick: () => setOpen(open === e.instance ? null : e.instance), children: [
1674
+ !provider && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No effects provider is registered. Commands effects made are kept." }),
1675
+ browse === "motion" && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(EffectsBrowser, { provider, uses: ["motion"], kinds: ["motion"], title: `Motion for ${target}`, onPick: (e) => (setBrowse(null), report(controller.applyMotionEffect(e.id, [target]))) }),
1676
+ browse === "vector" && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(EffectsBrowser, { provider, kinds: ["vector"], title: "Vector effects", onPick: (e) => (setBrowse(null), report(controller.addVectorEffect(e.id))) }),
1677
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("ol", { className: "space-y-1", children: applied.map((e) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("li", { className: "rounded border border-border p-1", "data-motion-effect": e.instance, children: [
1678
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex items-center gap-1", children: [
1679
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("button", { type: "button", className: "min-w-0 flex-1 truncate text-left", "aria-expanded": open === e.instance, onClick: () => setOpen(open === e.instance ? null : e.instance), children: [
1591
1680
  e.name ?? e.effect,
1592
1681
  " ",
1593
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "text-muted-foreground", children: [
1682
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { className: "text-muted-foreground", children: [
1594
1683
  "\xB7 ",
1595
1684
  e.kind === "vector" ? "picture" : e.targets.join(", ")
1596
1685
  ] })
1597
1686
  ] }),
1598
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", className: btn4, disabled, "aria-label": `Remove ${e.name ?? e.effect}`, onClick: () => report(controller.removeMotionEffect(e.instance)), children: "\u2715" })
1687
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", className: btn4, disabled, "aria-label": `Remove ${e.name ?? e.effect}`, onClick: () => report(controller.removeMotionEffect(e.instance)), children: "\u2715" })
1599
1688
  ] }),
1600
- open === e.instance && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "mt-1", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Controls, { controller, instance: e.instance, effect: e.effect, values: e.values }) })
1689
+ open === e.instance && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "mt-1", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Controls, { controller, instance: e.instance, effect: e.effect, values: e.values }) })
1601
1690
  ] }, e.instance)) }),
1602
- !applied.length && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No provider effects in this scene." }),
1603
- message && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { role: "status", className: "text-[11px] text-muted-foreground", "data-effects-message": "", children: message })
1691
+ !applied.length && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No provider effects in this scene." }),
1692
+ message && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { role: "status", className: "text-[11px] text-muted-foreground", "data-effects-message": "", children: message })
1604
1693
  ] });
1605
1694
  }
1606
1695
 
1607
1696
  // src/animation-editor/AnimationEditor.tsx
1608
- var import_jsx_runtime15 = require("react/jsx-runtime");
1697
+ var import_jsx_runtime17 = require("react/jsx-runtime");
1609
1698
  var ONION = { before: 3, after: 1 };
1610
1699
  var btn5 = "rounded border border-border px-2 py-0.5 text-xs disabled:opacity-40";
1611
- function AnimationEditor({ controller, values, onionSkin, motionPaths, showIssues = true, editable = true, effects, className = "" }) {
1700
+ function AnimationEditor({ controller, values, onionSkin, motionPaths, showIssues = true, editable = true, effects, className = "", playback, playbackId = "animation", onPlaybackReveal }) {
1612
1701
  const state = useAnimationEditorState(controller);
1702
+ const rootRef = (0, import_react18.useRef)(null);
1703
+ const ambientPlayback = useAgentPlayback();
1704
+ const playing = (playback === void 0 ? ambientPlayback : playback) ?? null;
1705
+ const rectIn = (el) => {
1706
+ const box = rootRef.current?.getBoundingClientRect();
1707
+ const r = el?.getBoundingClientRect();
1708
+ return box && r && r.width > 0 ? { x: r.left - box.left, y: r.top - box.top, width: r.width, height: r.height } : null;
1709
+ };
1710
+ const agentPresence = usePlaybackSurface(playing, playbackId, {
1711
+ defaultKind: "shot",
1712
+ locate: (ref) => {
1713
+ const root = rootRef.current;
1714
+ if (!root) return null;
1715
+ if (ref.kind === "shot") return rectIn(root.querySelector(`[data-shot="${CSS.escape(ref.id)}"]`));
1716
+ if (ref.kind === "element") return rectIn(root.querySelector(`[data-animation-stage] [id="ae-${CSS.escape(ref.id)}"]`));
1717
+ return null;
1718
+ },
1719
+ bounds: () => {
1720
+ const r = rootRef.current?.getBoundingClientRect();
1721
+ return r && r.width > 0 ? { x: 0, y: 0, width: r.width, height: r.height } : null;
1722
+ },
1723
+ visible: () => {
1724
+ const r = rootRef.current?.getBoundingClientRect();
1725
+ return !!r && r.width > 0 && r.height > 0 && !(typeof document !== "undefined" && document.visibilityState === "hidden");
1726
+ },
1727
+ toViewport: (p) => {
1728
+ const r = rootRef.current?.getBoundingClientRect();
1729
+ return { x: (r?.left ?? 0) + p.x, y: (r?.top ?? 0) + p.y };
1730
+ },
1731
+ fromViewport: (p) => {
1732
+ const r = rootRef.current?.getBoundingClientRect();
1733
+ return { x: p.x - (r?.left ?? 0), y: p.y - (r?.top ?? 0) };
1734
+ },
1735
+ reveal: () => onPlaybackReveal?.()
1736
+ });
1737
+ const presenceLayer = playing ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(PresenceLayer, { presence: agentPresence }) : null;
1613
1738
  useEffects(controller, effects);
1614
1739
  const { issues, scene, selection, readOnly } = state;
1615
- const [picked, setPicked] = (0, import_react15.useState)(null);
1616
- const [onion, setOnion] = (0, import_react15.useState)(false);
1617
- const [paths, setPaths] = (0, import_react15.useState)(false);
1740
+ const [picked, setPicked] = (0, import_react18.useState)(null);
1741
+ const [onion, setOnion] = (0, import_react18.useState)(false);
1742
+ const [paths, setPaths] = (0, import_react18.useState)(false);
1618
1743
  const command = selection?.command !== void 0 ? scene.shots.find((s) => s.id === selection.shot)?.run[selection.command] : void 0;
1619
1744
  const targets = command && "targets" in command ? command.targets : [];
1620
- const nodes = (0, import_react15.useMemo)(() => (0, import_animation_editor10.indexMotionNodes)(scene.artwork.nodes), [scene.artwork]);
1745
+ const nodes = (0, import_react18.useMemo)(() => (0, import_animation_editor10.indexMotionNodes)(scene.artwork.nodes), [scene.artwork]);
1621
1746
  const pickedValid = picked && nodes.has(picked) ? picked : null;
1622
1747
  const onPick = (id, event) => {
1623
1748
  if (event.shiftKey && id && command && "targets" in command && selection?.command !== void 0 && !readOnly) {
@@ -1627,7 +1752,7 @@ function AnimationEditor({ controller, values, onionSkin, motionPaths, showIssue
1627
1752
  }
1628
1753
  setPicked(id);
1629
1754
  };
1630
- const stage = /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1755
+ const stage = /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
1631
1756
  AnimationStage,
1632
1757
  {
1633
1758
  controller,
@@ -1639,17 +1764,19 @@ function AnimationEditor({ controller, values, onionSkin, motionPaths, showIssue
1639
1764
  className: "rounded-md border border-border bg-muted/40"
1640
1765
  }
1641
1766
  );
1642
- const issueList = showIssues && issues.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("ul", { className: "space-y-0.5 text-xs", "aria-label": "Animation issues", children: issues.map((issue, i) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("li", { className: issue.severity === "error" ? "text-red-500" : issue.severity === "warning" ? "text-amber-500" : "text-muted-foreground", children: (0, import_animation_editor10.motionIssueLine)(issue) }, i)) });
1767
+ const issueList = showIssues && issues.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("ul", { className: "space-y-0.5 text-xs", "aria-label": "Animation issues", children: issues.map((issue, i) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("li", { className: issue.severity === "error" ? "text-red-500" : issue.severity === "warning" ? "text-amber-500" : "text-muted-foreground", children: (0, import_animation_editor10.motionIssueLine)(issue) }, i)) });
1643
1768
  if (!editable)
1644
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: `flex flex-col gap-2 ${className}`, "data-animation-editor": "", children: [
1769
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { ref: rootRef, className: `relative flex flex-col gap-2 ${className}`, "data-animation-editor": "", children: [
1770
+ presenceLayer,
1645
1771
  stage,
1646
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(PlayheadScrubber, { controller }),
1772
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(PlayheadScrubber, { controller }),
1647
1773
  issueList
1648
1774
  ] });
1649
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
1775
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
1650
1776
  "div",
1651
1777
  {
1652
- className: `grid gap-3 lg:grid-cols-[minmax(0,1fr)_20rem] ${className}`,
1778
+ ref: rootRef,
1779
+ className: `relative grid gap-3 lg:grid-cols-[minmax(0,1fr)_20rem] ${className}`,
1653
1780
  "data-animation-editor": "",
1654
1781
  onKeyDown: (e) => {
1655
1782
  const el = e.target;
@@ -1659,40 +1786,41 @@ function AnimationEditor({ controller, values, onionSkin, motionPaths, showIssue
1659
1786
  else controller.undo();
1660
1787
  },
1661
1788
  children: [
1662
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex min-w-0 flex-col gap-2", children: [
1789
+ presenceLayer,
1790
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex min-w-0 flex-col gap-2", children: [
1663
1791
  stage,
1664
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(PlayheadScrubber, { controller }),
1665
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex flex-wrap items-center gap-2 text-xs text-muted-foreground", children: [
1666
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: btn5, onClick: () => controller.undo(), disabled: !state.canUndo, title: state.canUndo ? `Undo ${state.undoLabel}` : "Nothing to undo", "data-undo": "", children: "Undo" }),
1667
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: btn5, onClick: () => controller.redo(), disabled: !state.canRedo, title: state.canRedo ? `Redo ${state.redoLabel}` : "Nothing to redo", "data-redo": "", children: "Redo" }),
1668
- onionSkin === void 0 && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("label", { className: "flex items-center gap-1", children: [
1669
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("input", { type: "checkbox", checked: onion, onChange: (e) => setOnion(e.target.checked) }),
1792
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(PlayheadScrubber, { controller }),
1793
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex flex-wrap items-center gap-2 text-xs text-muted-foreground", children: [
1794
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: btn5, onClick: () => controller.undo(), disabled: !state.canUndo, title: state.canUndo ? `Undo ${state.undoLabel}` : "Nothing to undo", "data-undo": "", children: "Undo" }),
1795
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: btn5, onClick: () => controller.redo(), disabled: !state.canRedo, title: state.canRedo ? `Redo ${state.redoLabel}` : "Nothing to redo", "data-redo": "", children: "Redo" }),
1796
+ onionSkin === void 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("label", { className: "flex items-center gap-1", children: [
1797
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("input", { type: "checkbox", checked: onion, onChange: (e) => setOnion(e.target.checked) }),
1670
1798
  " Onion skin"
1671
1799
  ] }),
1672
- motionPaths === void 0 && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("label", { className: "flex items-center gap-1", children: [
1673
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("input", { type: "checkbox", checked: paths, onChange: (e) => setPaths(e.target.checked) }),
1800
+ motionPaths === void 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("label", { className: "flex items-center gap-1", children: [
1801
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("input", { type: "checkbox", checked: paths, onChange: (e) => setPaths(e.target.checked) }),
1674
1802
  " Motion paths"
1675
1803
  ] }),
1676
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "ml-auto", "data-picked-element": pickedValid ?? void 0, children: pickedValid ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
1804
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "ml-auto", "data-picked-element": pickedValid ?? void 0, children: pickedValid ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
1677
1805
  "Picked ",
1678
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("code", { className: "text-rose-500", children: pickedValid }),
1806
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("code", { className: "text-rose-500", children: pickedValid }),
1679
1807
  " ",
1680
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: "underline", onClick: () => setPicked(null), children: "clear" })
1808
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: "underline", onClick: () => setPicked(null), children: "clear" })
1681
1809
  ] }) : "Click the stage to pick an element; shift-click to toggle it as a target." })
1682
1810
  ] }),
1683
1811
  issueList
1684
1812
  ] }),
1685
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex min-w-0 flex-col gap-3", children: [
1686
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(CommandList, { controller, targets: pickedValid ? [pickedValid] : void 0 }),
1687
- (state.effectsProvider || controller.appliedEffects().length > 0) && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(AnimationEffectsPanel, { controller, node: pickedValid, className: "border-t border-border pt-2" }),
1688
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(CommandInspector, { controller, picked: pickedValid, className: "border-t border-border pt-2" }),
1689
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("details", { open: true, className: "border-t border-border pt-2", children: [
1690
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("summary", { className: "cursor-pointer text-xs font-medium", children: "Shot" }),
1691
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ShotInspector, { controller, className: "mt-1" })
1813
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex min-w-0 flex-col gap-3", children: [
1814
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(CommandList, { controller, targets: pickedValid ? [pickedValid] : void 0 }),
1815
+ (state.effectsProvider || controller.appliedEffects().length > 0) && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(AnimationEffectsPanel, { controller, node: pickedValid, className: "border-t border-border pt-2" }),
1816
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(CommandInspector, { controller, picked: pickedValid, className: "border-t border-border pt-2" }),
1817
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("details", { open: true, className: "border-t border-border pt-2", children: [
1818
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("summary", { className: "cursor-pointer text-xs font-medium", children: "Shot" }),
1819
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ShotInspector, { controller, className: "mt-1" })
1692
1820
  ] }),
1693
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("details", { className: "border-t border-border pt-2", children: [
1694
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("summary", { className: "cursor-pointer text-xs font-medium", children: "Scene settings" }),
1695
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(SceneSettings, { controller, className: "mt-1" })
1821
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("details", { className: "border-t border-border pt-2", children: [
1822
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("summary", { className: "cursor-pointer text-xs font-medium", children: "Scene settings" }),
1823
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(SceneSettings, { controller, className: "mt-1" })
1696
1824
  ] })
1697
1825
  ] })
1698
1826
  ]