@pixerate/editor-react 0.158.0 → 0.160.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -741,10 +741,10 @@ function VideoTimeline({ controller, pxPerSecond, onPxPerSecondChange, editable
741
741
  }
742
742
 
743
743
  // src/video-editor/ClipInspector.tsx
744
- var import_react20 = require("react");
744
+ var import_react21 = require("react");
745
745
 
746
746
  // src/video-editor/ClipCameraMoves.tsx
747
- var import_react19 = __toESM(require("react"), 1);
747
+ var import_react20 = __toESM(require("react"), 1);
748
748
  var import_video_editor6 = require("@pixerate/editor/video-editor");
749
749
 
750
750
  // src/effects/useEffects.ts
@@ -2013,10 +2013,10 @@ function ParameterNumberInput(props) {
2013
2013
  const resolved = resolveParameterComponents(components, ctx);
2014
2014
  const CustomInput = resolved.input;
2015
2015
  const plain = plainNumber(field2, value);
2016
- const handleCommit = (text, input2) => {
2016
+ const handleCommit = (text, input3) => {
2017
2017
  const n = (0, import_parameters.parseParameterNumberInput)(field2, text);
2018
2018
  if (n === null || n === value) {
2019
- if (input2) input2.value = plain;
2019
+ if (input3) input3.value = plain;
2020
2020
  } else {
2021
2021
  onChange(n);
2022
2022
  }
@@ -2959,9 +2959,126 @@ function DurationField({ duration, onCommit }) {
2959
2959
  );
2960
2960
  }
2961
2961
 
2962
- // src/video-editor/ClipCameraMoves.tsx
2962
+ // src/effects/EffectTemplates.tsx
2963
+ var import_react19 = require("react");
2964
+ var import_effects5 = require("@pixerate/editor/effects");
2963
2965
  var import_jsx_runtime15 = require("react/jsx-runtime");
2964
2966
  var input = "w-full min-w-0 rounded border border-border bg-transparent px-1 py-0.5 text-xs";
2967
+ var btn2 = "rounded border border-border px-2 py-0.5 text-[11px] disabled:opacity-40";
2968
+ function SlotField({ slot, value, error, onChange }) {
2969
+ const id = `template-slot-${slot.name}`;
2970
+ let field2;
2971
+ if (slot.type === "color") field2 = /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("input", { id, className: "h-6 w-10", type: "color", value: String(value), onChange: (e) => onChange(e.target.value) });
2972
+ else if (slot.type === "number")
2973
+ field2 = /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("input", { id, className: input, type: "number", min: slot.min, max: slot.max, step: slot.integer ? 1 : "any", value: String(value), onChange: (e) => onChange(e.target.value === "" ? "" : Number(e.target.value)) });
2974
+ else if (slot.type === "text")
2975
+ field2 = /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex items-center gap-1", children: [
2976
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("input", { id, className: input, maxLength: slot.maxLength, value: String(value), onChange: (e) => onChange(e.target.value) }),
2977
+ slot.maxLength !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "text-[10px] text-muted-foreground", children: [
2978
+ String(value).length,
2979
+ "/",
2980
+ slot.maxLength
2981
+ ] })
2982
+ ] });
2983
+ else
2984
+ field2 = /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2985
+ "input",
2986
+ {
2987
+ id,
2988
+ className: input,
2989
+ placeholder: slot.hasDefault ? "URL or <svg> (default: a placeholder)" : "URL or <svg> (empty: left open)",
2990
+ value: typeof value === "string" ? value : "",
2991
+ onChange: (e) => onChange(e.target.value)
2992
+ }
2993
+ );
2994
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex flex-col gap-0.5", "data-template-slot": slot.name, children: [
2995
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("label", { htmlFor: id, className: "text-muted-foreground", title: slot.description, children: slot.label }),
2996
+ field2,
2997
+ error && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { className: "text-[11px] text-destructive", children: error })
2998
+ ] });
2999
+ }
3000
+ function EffectTemplates({ provider, onFill, fillLabel = "Use template", disabled = false, className = "" }) {
3001
+ const [templates, setTemplates] = (0, import_react19.useState)([]);
3002
+ const [chosen, setChosen] = (0, import_react19.useState)("");
3003
+ const [description, setDescription] = (0, import_react19.useState)(null);
3004
+ const [values, setValues] = (0, import_react19.useState)({});
3005
+ const [message, setMessage] = (0, import_react19.useState)(null);
3006
+ const [busy, setBusy] = (0, import_react19.useState)(false);
3007
+ const supported = !!provider?.capabilities.supportsTemplates && !!provider.listTemplates && !!provider.describeTemplate;
3008
+ (0, import_react19.useEffect)(() => {
3009
+ let live = true;
3010
+ setTemplates([]);
3011
+ setChosen("");
3012
+ if (supported) void Promise.resolve(provider.listTemplates()).then((t) => live && setTemplates(t), () => live && setTemplates([]));
3013
+ return () => {
3014
+ live = false;
3015
+ };
3016
+ }, [provider, supported]);
3017
+ (0, import_react19.useEffect)(() => {
3018
+ let live = true;
3019
+ setDescription(null);
3020
+ setMessage(null);
3021
+ if (!chosen || !supported) return;
3022
+ void Promise.resolve(provider.describeTemplate(chosen)).then(
3023
+ (d) => {
3024
+ if (!live) return;
3025
+ setDescription(d);
3026
+ setValues(Object.fromEntries(d.slots.map((s) => [s.name, (0, import_effects5.isSubjectTemplateSlot)(s) ? "" : s.default])));
3027
+ },
3028
+ (e) => live && setMessage(e.message)
3029
+ );
3030
+ return () => {
3031
+ live = false;
3032
+ };
3033
+ }, [provider, supported, chosen]);
3034
+ if (!supported || !templates.length) return null;
3035
+ const given = Object.fromEntries(Object.entries(values).filter(([, v]) => v !== ""));
3036
+ const problems = description ? (0, import_effects5.checkTemplateValues)(description.slots, given) : [];
3037
+ const problemFor = (slot) => problems.find((p) => p.startsWith(`Slot "${slot}"`));
3038
+ const fill = async () => {
3039
+ if (!description || problems.length) return;
3040
+ setBusy(true);
3041
+ const r = await onFill(description.id, given);
3042
+ setBusy(false);
3043
+ if (r.ok) setChosen("");
3044
+ else setMessage(r.error);
3045
+ };
3046
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: `flex flex-col gap-1 text-xs ${className}`, "data-effect-templates": "", children: [
3047
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("select", { className: input, "aria-label": "Template", disabled, value: chosen, onChange: (e) => setChosen(e.target.value), children: [
3048
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("option", { value: "", children: "Templates\u2026" }),
3049
+ templates.map((t) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("option", { value: t.id, children: [
3050
+ t.name,
3051
+ " (",
3052
+ t.shots,
3053
+ " shots)"
3054
+ ] }, t.id))
3055
+ ] }),
3056
+ description && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
3057
+ "form",
3058
+ {
3059
+ className: "flex flex-col gap-1 rounded border border-border p-1",
3060
+ "data-template-form": description.id,
3061
+ onSubmit: (e) => {
3062
+ e.preventDefault();
3063
+ void fill();
3064
+ },
3065
+ children: [
3066
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { className: "text-[11px] text-muted-foreground", children: description.description }),
3067
+ description.slots.map((slot) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(SlotField, { slot, value: values[slot.name] ?? "", error: problemFor(slot.name), onChange: (v) => setValues({ ...values, [slot.name]: v }) }, slot.name)),
3068
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex gap-1", children: [
3069
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "submit", className: btn2, disabled: disabled || busy || problems.length > 0, children: fillLabel }),
3070
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: btn2, onClick: () => setChosen(""), children: "Cancel" })
3071
+ ] })
3072
+ ]
3073
+ }
3074
+ ),
3075
+ message && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { role: "alert", className: "text-[11px] text-destructive", children: message })
3076
+ ] });
3077
+ }
3078
+
3079
+ // src/video-editor/ClipCameraMoves.tsx
3080
+ var import_jsx_runtime16 = require("react/jsx-runtime");
3081
+ var input2 = "w-full min-w-0 rounded border border-border bg-transparent px-1 py-0.5 text-xs";
2965
3082
  var ROLES = [
2966
3083
  { role: "transition", label: "Move in", none: "none" },
2967
3084
  { role: "hold", label: "While holding", none: "none" }
@@ -2970,7 +3087,7 @@ function MoveControls({ controller, clip, role }) {
2970
3087
  const state = useVideoEditorState(controller);
2971
3088
  const move = (0, import_video_editor6.videoClipCameraMove)((0, import_video_editor6.findVideoClip)(state.project, clip)?.clip, role);
2972
3089
  const { description, error } = useEffectDescription(state.effectsProvider, move?.move);
2973
- const [message, setMessage] = (0, import_react19.useState)(null);
3090
+ const [message, setMessage] = (0, import_react20.useState)(null);
2974
3091
  if (!move) return null;
2975
3092
  const report = (r) => void r.then((x) => setMessage(x.ok ? null : x.error));
2976
3093
  const set = (changes, merge) => {
@@ -2978,15 +3095,15 @@ function MoveControls({ controller, clip, role }) {
2978
3095
  for (const k of Object.keys(next)) if (next[k] === null || k === "values" && !Object.keys(next[k]).length) delete next[k];
2979
3096
  report(controller.setClipCameraMove(clip, role, next, { merge: merge ?? void 0 }));
2980
3097
  };
2981
- if (error) return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { className: "text-[11px] text-amber-500", children: error });
3098
+ if (error) return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "text-[11px] text-amber-500", children: error });
2982
3099
  if (!description) return null;
2983
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex flex-col gap-1 border-l border-border pl-2", "data-camera-move-controls": role, children: [
2984
- role === "transition" && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("label", { className: "flex items-center gap-1 text-xs", children: [
2985
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "w-16 text-muted-foreground", children: "Length" }),
2986
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
3100
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex flex-col gap-1 border-l border-border pl-2", "data-camera-move-controls": role, children: [
3101
+ role === "transition" && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: "flex items-center gap-1 text-xs", children: [
3102
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "w-16 text-muted-foreground", children: "Length" }),
3103
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2987
3104
  "input",
2988
3105
  {
2989
- className: input,
3106
+ className: input2,
2990
3107
  type: "number",
2991
3108
  min: 0,
2992
3109
  step: 50,
@@ -3003,9 +3120,9 @@ function MoveControls({ controller, clip, role }) {
3003
3120
  },
3004
3121
  String(move.ms)
3005
3122
  ),
3006
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "ms" })
3123
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "ms" })
3007
3124
  ] }),
3008
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
3125
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3009
3126
  EffectParameters,
3010
3127
  {
3011
3128
  description,
@@ -3018,14 +3135,14 @@ function MoveControls({ controller, clip, role }) {
3018
3135
  onPresetName: (name) => set({ preset: name, values: {} })
3019
3136
  }
3020
3137
  ),
3021
- message && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { role: "alert", className: "text-[11px] text-destructive", children: message })
3138
+ message && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { role: "alert", className: "text-[11px] text-destructive", children: message })
3022
3139
  ] });
3023
3140
  }
3024
3141
  function ClipCameraMoves({ controller, clip, className = "" }) {
3025
3142
  const state = useVideoEditorState(controller);
3026
- const [moves, setMoves] = (0, import_react19.useState)({ transition: [], hold: [] });
3027
- const [message, setMessage] = (0, import_react19.useState)(null);
3028
- (0, import_react19.useEffect)(() => {
3143
+ const [moves, setMoves] = (0, import_react20.useState)({ transition: [], hold: [] });
3144
+ const [message, setMessage] = (0, import_react20.useState)(null);
3145
+ (0, import_react20.useEffect)(() => {
3029
3146
  let live = true;
3030
3147
  void Promise.all([controller.cameraMoves("transition"), controller.cameraMoves("hold")]).then(
3031
3148
  ([transition, hold]) => live && setMoves({ transition, hold }),
@@ -3039,48 +3156,48 @@ function ClipCameraMoves({ controller, clip, className = "" }) {
3039
3156
  if (!at || at.track.kind === "audio" || at.clip.type === "adjustment") return null;
3040
3157
  const current = at.clip;
3041
3158
  if (!moves.transition.length && !moves.hold.length)
3042
- return current.camera ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("p", { className: `text-[10px] text-muted-foreground ${className}`, "data-camera-moves": "unavailable", children: [
3159
+ return current.camera ? /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("p", { className: `text-[10px] text-muted-foreground ${className}`, "data-camera-moves": "unavailable", children: [
3043
3160
  "This clip's camera moves are baked into its keys; ",
3044
3161
  state.effectsProvider ? `${state.effectsProvider.name} has no camera moves` : "no effects provider is set",
3045
3162
  ", so they cannot be changed here."
3046
3163
  ] }) : null;
3047
3164
  const report = (r) => void r.then((x) => setMessage(x.ok ? null : x.error));
3048
3165
  const disabled = state.readOnly || !!at.track.locked;
3049
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: `flex flex-col gap-1 text-xs ${className}`, "data-camera-moves": "", children: [
3166
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: `flex flex-col gap-1 text-xs ${className}`, "data-camera-moves": "", children: [
3050
3167
  ROLES.map(({ role, label, none }) => {
3051
3168
  const move = (0, import_video_editor6.videoClipCameraMove)(current, role);
3052
3169
  const known = moves[role].some((m) => m.id === move?.move);
3053
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_react19.default.Fragment, { children: [
3054
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("label", { className: "grid grid-cols-[5.5rem_minmax(0,1fr)] items-center gap-2", children: [
3055
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "text-muted-foreground", children: label }),
3056
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
3170
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_react20.default.Fragment, { children: [
3171
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: "grid grid-cols-[5.5rem_minmax(0,1fr)] items-center gap-2", children: [
3172
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "text-muted-foreground", children: label }),
3173
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
3057
3174
  "select",
3058
3175
  {
3059
- className: input,
3176
+ className: input2,
3060
3177
  "aria-label": label,
3061
3178
  disabled,
3062
3179
  value: move?.move ?? "",
3063
3180
  onChange: (e) => report(e.target.value ? controller.setClipCameraMove(clip, role, e.target.value) : controller.clearClipCameraMove(clip, role)),
3064
3181
  children: [
3065
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("option", { value: "", children: none }),
3066
- move && !known && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("option", { value: move.move, children: [
3182
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: "", children: none }),
3183
+ move && !known && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("option", { value: move.move, children: [
3067
3184
  move.move,
3068
3185
  " (not in the provider)"
3069
3186
  ] }),
3070
- moves[role].map((m) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("option", { value: m.id, children: m.name }, m.id))
3187
+ moves[role].map((m) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: m.id, children: m.name }, m.id))
3071
3188
  ]
3072
3189
  }
3073
3190
  )
3074
3191
  ] }),
3075
- move && known && !disabled && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(MoveControls, { controller, clip, role })
3192
+ move && known && !disabled && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(MoveControls, { controller, clip, role })
3076
3193
  ] }, role);
3077
3194
  }),
3078
- current.camera && !disabled && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("label", { className: "grid grid-cols-[5.5rem_minmax(0,1fr)] items-center gap-2", children: [
3079
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "text-muted-foreground", children: "Camera zoom" }),
3080
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
3195
+ current.camera && !disabled && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: "grid grid-cols-[5.5rem_minmax(0,1fr)] items-center gap-2", children: [
3196
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "text-muted-foreground", children: "Camera zoom" }),
3197
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3081
3198
  "input",
3082
3199
  {
3083
- className: input,
3200
+ className: input2,
3084
3201
  type: "number",
3085
3202
  min: 0.1,
3086
3203
  step: 0.1,
@@ -3100,14 +3217,14 @@ function ClipCameraMoves({ controller, clip, className = "" }) {
3100
3217
  String(current.camera.framing?.zoom)
3101
3218
  )
3102
3219
  ] }),
3103
- message && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { className: "text-[11px] text-destructive", role: "alert", children: message })
3220
+ message && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "text-[11px] text-destructive", role: "alert", children: message })
3104
3221
  ] });
3105
3222
  }
3106
3223
 
3107
3224
  // src/video-editor/ClipInspector.tsx
3108
3225
  var import_video_editor7 = require("@pixerate/editor/video-editor");
3109
- var import_jsx_runtime16 = require("react/jsx-runtime");
3110
- var btn2 = "rounded border border-border px-1.5 py-0.5 text-[11px] disabled:opacity-40";
3226
+ var import_jsx_runtime17 = require("react/jsx-runtime");
3227
+ var btn3 = "rounded border border-border px-1.5 py-0.5 text-[11px] disabled:opacity-40";
3111
3228
  var field = "w-full rounded border border-border bg-transparent px-1 py-0.5 text-xs disabled:opacity-50";
3112
3229
  var DEFAULT_TRANSITION = 500;
3113
3230
  function Commit({
@@ -3120,7 +3237,7 @@ function Commit({
3120
3237
  if (raw !== value) onCommit(raw);
3121
3238
  };
3122
3239
  if (multiline)
3123
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3240
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3124
3241
  "textarea",
3125
3242
  {
3126
3243
  className: field,
@@ -3132,10 +3249,10 @@ function Commit({
3132
3249
  },
3133
3250
  value
3134
3251
  );
3135
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("input", { className: field, ...rest, defaultValue: value, onKeyDown: (e) => e.key === "Enter" && e.currentTarget.blur(), onBlur: (e) => commit(e.currentTarget.value) }, value);
3252
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("input", { className: field, ...rest, defaultValue: value, onKeyDown: (e) => e.key === "Enter" && e.currentTarget.blur(), onBlur: (e) => commit(e.currentTarget.value) }, value);
3136
3253
  }
3137
3254
  function LutControls({ controller, clip, disabled }) {
3138
- const [message, setMessage] = (0, import_react20.useState)(null);
3255
+ const [message, setMessage] = (0, import_react21.useState)(null);
3139
3256
  const lut = clip.grade?.lut;
3140
3257
  const apply = (setting, label) => {
3141
3258
  const r = controller.apply((0, import_video_editor7.videoLutEdits)(controller.getProject(), [clip.id], setting), label);
@@ -3159,16 +3276,16 @@ function LutControls({ controller, clip, disabled }) {
3159
3276
  setMessage(`${file.name}: ${e instanceof Error ? e.message : String(e)}`);
3160
3277
  }
3161
3278
  };
3162
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
3163
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Row, { label: "LUT", name: "grade.lut", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex min-w-0 gap-1", children: [
3164
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Commit, { value: lut?.src ?? "", placeholder: "look.cube", "aria-label": "LUT file", disabled, onCommit: (raw) => void choose(raw.trim()) }),
3165
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: `${btn2} cursor-pointer whitespace-nowrap`, title: "Load a .cube file", children: [
3279
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
3280
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Row, { label: "LUT", name: "grade.lut", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex min-w-0 gap-1", children: [
3281
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Commit, { value: lut?.src ?? "", placeholder: "look.cube", "aria-label": "LUT file", disabled, onCommit: (raw) => void choose(raw.trim()) }),
3282
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("label", { className: `${btn3} cursor-pointer whitespace-nowrap`, title: "Load a .cube file", children: [
3166
3283
  "Load",
3167
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("input", { type: "file", accept: ".cube", className: "sr-only", disabled, "aria-label": "Load a .cube LUT", onChange: (e) => void readFile(e.currentTarget.files?.[0]) })
3284
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("input", { type: "file", accept: ".cube", className: "sr-only", disabled, "aria-label": "Load a .cube LUT", onChange: (e) => void readFile(e.currentTarget.files?.[0]) })
3168
3285
  ] }),
3169
- lut && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", className: btn2, disabled, "aria-label": "Remove LUT", onClick: () => apply(null, "Remove LUT"), children: "\u2715" })
3286
+ lut && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: btn3, disabled, "aria-label": "Remove LUT", onClick: () => apply(null, "Remove LUT"), children: "\u2715" })
3170
3287
  ] }) }),
3171
- lut && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Row, { label: "LUT strength", name: "grade.lut.strength", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3288
+ lut && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Row, { label: "LUT strength", name: "grade.lut.strength", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3172
3289
  Commit,
3173
3290
  {
3174
3291
  type: "number",
@@ -3184,7 +3301,7 @@ function LutControls({ controller, clip, disabled }) {
3184
3301
  }
3185
3302
  }
3186
3303
  ) }),
3187
- lut && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Row, { label: "Protect skin", name: "grade.lut.preserveSkinTones", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3304
+ lut && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Row, { label: "Protect skin", name: "grade.lut.preserveSkinTones", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3188
3305
  Commit,
3189
3306
  {
3190
3307
  type: "number",
@@ -3204,12 +3321,12 @@ function LutControls({ controller, clip, disabled }) {
3204
3321
  }
3205
3322
  }
3206
3323
  ) }),
3207
- message && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "text-xs text-red-500", role: "alert", "data-lut-error": "", children: message })
3324
+ message && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "text-xs text-red-500", role: "alert", "data-lut-error": "", children: message })
3208
3325
  ] });
3209
3326
  }
3210
3327
  function Row({ label, name, children }) {
3211
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: "grid grid-cols-[5.5rem_minmax(0,1fr)] items-center gap-2 text-xs", "data-field": name, children: [
3212
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "text-muted-foreground", children: label }),
3328
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("label", { className: "grid grid-cols-[5.5rem_minmax(0,1fr)] items-center gap-2 text-xs", "data-field": name, children: [
3329
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "text-muted-foreground", children: label }),
3213
3330
  children
3214
3331
  ] });
3215
3332
  }
@@ -3217,7 +3334,7 @@ function ClipInspector({ controller, className = "" }) {
3217
3334
  const state = useVideoEditorState(controller);
3218
3335
  const { project, selection, readOnly, time } = state;
3219
3336
  if (selection.length !== 1)
3220
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: `text-xs text-muted-foreground ${className}`, "data-clip-inspector": "", children: selection.length ? `${selection.length} clips selected. Select one clip to edit it.` : "Select a clip on the timeline to edit it." });
3337
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: `text-xs text-muted-foreground ${className}`, "data-clip-inspector": "", children: selection.length ? `${selection.length} clips selected. Select one clip to edit it.` : "Select a clip on the timeline to edit it." });
3221
3338
  const at = (0, import_video_editor7.findVideoClip)(project, selection[0]);
3222
3339
  if (!at) return null;
3223
3340
  const clip = at.clip;
@@ -3234,24 +3351,24 @@ function ClipInspector({ controller, className = "" }) {
3234
3351
  };
3235
3352
  const text = (key, label) => {
3236
3353
  const value = clip[key];
3237
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Commit, { value: value === void 0 ? "" : String(value), "aria-label": label ?? key, disabled, onCommit: (raw) => set(key, raw.trim() || void 0, `Change ${label ?? key}`) });
3354
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Commit, { value: value === void 0 ? "" : String(value), "aria-label": label ?? key, disabled, onCommit: (raw) => set(key, raw.trim() || void 0, `Change ${label ?? key}`) });
3238
3355
  };
3239
3356
  const number = (key, label, attrs = {}) => {
3240
3357
  const value = clip[key];
3241
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Commit, { type: "number", value: value === void 0 ? "" : String(value), "aria-label": label, disabled, onCommit: (raw) => num(key, raw, `Change ${label.toLowerCase()}`), ...attrs });
3358
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Commit, { type: "number", value: value === void 0 ? "" : String(value), "aria-label": label, disabled, onCommit: (raw) => num(key, raw, `Change ${label.toLowerCase()}`), ...attrs });
3242
3359
  };
3243
3360
  const transition = clip.transition;
3244
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: `flex flex-col gap-1.5 ${className}`, "data-clip-inspector": "", "data-clip-id": clip.id, children: [
3245
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex items-center gap-2 text-xs", children: [
3246
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "font-medium", children: (0, import_video_editor7.videoClipHeading)(clip) }),
3247
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("code", { className: "text-muted-foreground", children: clip.id }),
3248
- at.track.locked && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "text-amber-500", children: "locked track" })
3361
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: `flex flex-col gap-1.5 ${className}`, "data-clip-inspector": "", "data-clip-id": clip.id, children: [
3362
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex items-center gap-2 text-xs", children: [
3363
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "font-medium", children: (0, import_video_editor7.videoClipHeading)(clip) }),
3364
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("code", { className: "text-muted-foreground", children: clip.id }),
3365
+ at.track.locked && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "text-amber-500", children: "locked track" })
3249
3366
  ] }),
3250
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Row, { label: "Name", name: "name", children: text("name", "Name") }),
3251
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Row, { label: "Start", name: "start", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "tabular-nums text-xs", children: (0, import_video_editor7.formatVideoSeconds)(clip.start) }) }),
3252
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Row, { label: "Duration", name: "duration", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "tabular-nums text-xs", children: (0, import_video_editor7.formatVideoSeconds)(clip.duration) }) }),
3253
- (0, import_video_editor7.videoKeyframeRows)(project, clip.id, time).map((row) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Row, { label: row.label, name: row.property, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { className: "flex min-w-0 items-center gap-1", "data-keyframe-row": row.property, children: [
3254
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3367
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Row, { label: "Name", name: "name", children: text("name", "Name") }),
3368
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Row, { label: "Start", name: "start", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "tabular-nums text-xs", children: (0, import_video_editor7.formatVideoSeconds)(clip.start) }) }),
3369
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Row, { label: "Duration", name: "duration", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "tabular-nums text-xs", children: (0, import_video_editor7.formatVideoSeconds)(clip.duration) }) }),
3370
+ (0, import_video_editor7.videoKeyframeRows)(project, clip.id, time).map((row) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Row, { label: row.label, name: row.property, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "flex min-w-0 items-center gap-1", "data-keyframe-row": row.property, children: [
3371
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3255
3372
  Commit,
3256
3373
  {
3257
3374
  type: "number",
@@ -3270,7 +3387,7 @@ function ClipInspector({ controller, className = "" }) {
3270
3387
  }
3271
3388
  }
3272
3389
  ),
3273
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3390
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3274
3391
  "button",
3275
3392
  {
3276
3393
  type: "button",
@@ -3287,11 +3404,11 @@ function ClipInspector({ controller, className = "" }) {
3287
3404
  children: row.onKey ? "\u25C6" : "\u25C7"
3288
3405
  }
3289
3406
  ),
3290
- row.keyed && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "shrink-0 text-[10px] tabular-nums text-muted-foreground", "data-keyframe-count": row.property, children: row.keys })
3407
+ row.keyed && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "shrink-0 text-[10px] tabular-nums text-muted-foreground", "data-keyframe-count": row.property, children: row.keys })
3291
3408
  ] }) }, row.property)),
3292
- at.track.kind === "video" && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Row, { label: "Blend", name: "blend", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("select", { className: field, value: clip.blend ?? "normal", disabled, "aria-label": "Blend mode", onChange: (e) => set("blend", e.target.value === "normal" ? void 0 : e.target.value, "Change blend mode"), children: import_video_editor7.VIDEO_BLEND_MODES.map((m) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: m, children: import_video_editor7.VIDEO_BLEND_MODE_LABELS[m] }, m)) }) }),
3293
- at.track.kind === "video" && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
3294
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Row, { label: "Look", name: "gradePreset", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
3409
+ at.track.kind === "video" && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Row, { label: "Blend", name: "blend", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("select", { className: field, value: clip.blend ?? "normal", disabled, "aria-label": "Blend mode", onChange: (e) => set("blend", e.target.value === "normal" ? void 0 : e.target.value, "Change blend mode"), children: import_video_editor7.VIDEO_BLEND_MODES.map((m) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("option", { value: m, children: import_video_editor7.VIDEO_BLEND_MODE_LABELS[m] }, m)) }) }),
3410
+ at.track.kind === "video" && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
3411
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Row, { label: "Look", name: "gradePreset", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
3295
3412
  "select",
3296
3413
  {
3297
3414
  className: field,
@@ -3303,12 +3420,12 @@ function ClipInspector({ controller, className = "" }) {
3303
3420
  if (grade) controller.apply({ op: "update_clip", clip: clip.id, set: { grade } }, `Apply ${e.target.value} look`);
3304
3421
  },
3305
3422
  children: [
3306
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: "", children: clip.grade ? "Graded" : "None" }),
3307
- import_video_editor7.VIDEO_GRADE_PRESET_NAMES.map((name) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: name, children: name.replace(/-/g, " ") }, name))
3423
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("option", { value: "", children: clip.grade ? "Graded" : "None" }),
3424
+ import_video_editor7.VIDEO_GRADE_PRESET_NAMES.map((name) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("option", { value: name, children: name.replace(/-/g, " ") }, name))
3308
3425
  ]
3309
3426
  }
3310
3427
  ) }),
3311
- import_video_editor7.VIDEO_GRADE_CONTROLS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Row, { label: c.label, name: `grade.${c.key}`, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3428
+ import_video_editor7.VIDEO_GRADE_CONTROLS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Row, { label: c.label, name: `grade.${c.key}`, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3312
3429
  Commit,
3313
3430
  {
3314
3431
  type: "number",
@@ -3327,10 +3444,10 @@ function ClipInspector({ controller, className = "" }) {
3327
3444
  }
3328
3445
  }
3329
3446
  ) }, c.key)),
3330
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(LutControls, { controller, clip, disabled })
3447
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(LutControls, { controller, clip, disabled })
3331
3448
  ] }),
3332
- clip.type === "adjustment" && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
3333
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Row, { label: "Changes", name: "scope", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3449
+ clip.type === "adjustment" && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
3450
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Row, { label: "Changes", name: "scope", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3334
3451
  "select",
3335
3452
  {
3336
3453
  className: field,
@@ -3343,13 +3460,13 @@ function ClipInspector({ controller, className = "" }) {
3343
3460
  if (scope === "track") controller.apply({ op: "update_clip", clip: clip.id, set: { scope, targetTrack: clip.targetTrack ?? target ?? at.track.id } }, "Change adjustment scope");
3344
3461
  else controller.apply({ op: "update_clip", clip: clip.id, ...scope === "underneath" ? { remove: ["scope", "targetTrack"] } : { set: { scope }, remove: ["targetTrack"] } }, "Change adjustment scope");
3345
3462
  },
3346
- children: import_video_editor7.VIDEO_ADJUSTMENT_SCOPES.map((s) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: s, children: import_video_editor7.VIDEO_ADJUSTMENT_SCOPE_LABELS[s] }, s))
3463
+ children: import_video_editor7.VIDEO_ADJUSTMENT_SCOPES.map((s) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("option", { value: s, children: import_video_editor7.VIDEO_ADJUSTMENT_SCOPE_LABELS[s] }, s))
3347
3464
  }
3348
3465
  ) }),
3349
- clip.scope === "track" && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Row, { label: "Track", name: "targetTrack", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("select", { className: field, value: clip.targetTrack ?? "", disabled, "aria-label": "Adjusted track", onChange: (e) => set("targetTrack", e.target.value, "Change adjusted track"), children: project.tracks.filter((t) => t.kind === "video").map((t) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: t.id, children: t.name ?? t.id }, t.id)) }) })
3466
+ clip.scope === "track" && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Row, { label: "Track", name: "targetTrack", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("select", { className: field, value: clip.targetTrack ?? "", disabled, "aria-label": "Adjusted track", onChange: (e) => set("targetTrack", e.target.value, "Change adjusted track"), children: project.tracks.filter((t) => t.kind === "video").map((t) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("option", { value: t.id, children: t.name ?? t.id }, t.id)) }) })
3350
3467
  ] }),
3351
- at.track.kind === "video" && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
3352
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Row, { label: "Mask", name: "mask", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
3468
+ at.track.kind === "video" && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
3469
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Row, { label: "Mask", name: "mask", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
3353
3470
  "select",
3354
3471
  {
3355
3472
  className: field,
@@ -3367,8 +3484,8 @@ function ClipInspector({ controller, className = "" }) {
3367
3484
  controller.apply((0, import_video_editor7.videoMaskEdit)(clip.id, shape ? { ...rest, shape, ...shape === "polygon" ? { points } : {} } : null), shape ? "Mask clip" : "Remove mask");
3368
3485
  },
3369
3486
  children: [
3370
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: "", children: "None" }),
3371
- import_video_editor7.VIDEO_MASK_SHAPES.map((s) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: s, children: import_video_editor7.VIDEO_MASK_SHAPE_LABELS[s] }, s))
3487
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("option", { value: "", children: "None" }),
3488
+ import_video_editor7.VIDEO_MASK_SHAPES.map((s) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("option", { value: s, children: import_video_editor7.VIDEO_MASK_SHAPE_LABELS[s] }, s))
3372
3489
  ]
3373
3490
  }
3374
3491
  ) }),
@@ -3377,7 +3494,7 @@ function ClipInspector({ controller, className = "" }) {
3377
3494
  ["height", "Mask height", 0.05],
3378
3495
  ["feather", "Feather (px)", 5],
3379
3496
  ["rotation", "Mask angle", 5]
3380
- ].map(([key, label, step]) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Row, { label, name: `mask.${key}`, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3497
+ ].map(([key, label, step]) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Row, { label, name: `mask.${key}`, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3381
3498
  Commit,
3382
3499
  {
3383
3500
  type: "number",
@@ -3395,7 +3512,7 @@ function ClipInspector({ controller, className = "" }) {
3395
3512
  }
3396
3513
  }
3397
3514
  ) }, key)),
3398
- clip.mask && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Row, { label: "Invert mask", name: "mask.inverted", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3515
+ clip.mask && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Row, { label: "Invert mask", name: "mask.inverted", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3399
3516
  "input",
3400
3517
  {
3401
3518
  type: "checkbox",
@@ -3410,7 +3527,7 @@ function ClipInspector({ controller, className = "" }) {
3410
3527
  }
3411
3528
  ) })
3412
3529
  ] }),
3413
- at.track.kind === "video" && ["animateIn", "animateOut"].map((key) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Row, { label: key === "animateIn" ? "Animate in" : "Animate out", name: key, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
3530
+ at.track.kind === "video" && ["animateIn", "animateOut"].map((key) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Row, { label: key === "animateIn" ? "Animate in" : "Animate out", name: key, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
3414
3531
  "select",
3415
3532
  {
3416
3533
  className: field,
@@ -3422,35 +3539,35 @@ function ClipInspector({ controller, className = "" }) {
3422
3539
  set(key, effect ? { ...clip[key], effect } : void 0, key === "animateIn" ? "Change entrance" : "Change exit");
3423
3540
  },
3424
3541
  children: [
3425
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: "", children: "None" }),
3426
- import_video_editor7.VIDEO_CLIP_ANIMATION_EFFECTS.map((effect) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: effect, children: import_video_editor7.VIDEO_CLIP_ANIMATION_LABELS[effect] }, effect))
3542
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("option", { value: "", children: "None" }),
3543
+ import_video_editor7.VIDEO_CLIP_ANIMATION_EFFECTS.map((effect) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("option", { value: effect, children: import_video_editor7.VIDEO_CLIP_ANIMATION_LABELS[effect] }, effect))
3427
3544
  ]
3428
3545
  }
3429
3546
  ) }, key)),
3430
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Row, { label: "Fade in (ms)", name: "fadeIn", children: number("fadeIn", "Fade in", { min: 0, step: 100 }) }),
3431
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Row, { label: "Fade out (ms)", name: "fadeOut", children: number("fadeOut", "Fade out", { min: 0, step: 100 }) }),
3432
- clip.type === "media" && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
3433
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Row, { label: "Speed", name: "speed", children: clip.timeRemap ? /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { className: "flex items-center gap-1", "data-ramped": "", children: [
3434
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "text-muted-foreground", children: "ramped" }),
3435
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", className: btn2, disabled, onClick: () => controller.apply({ op: "set_time_remap", clip: clip.id, keys: null, ripple: true }, "Remove speed ramp"), children: "Remove ramp" })
3547
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Row, { label: "Fade in (ms)", name: "fadeIn", children: number("fadeIn", "Fade in", { min: 0, step: 100 }) }),
3548
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Row, { label: "Fade out (ms)", name: "fadeOut", children: number("fadeOut", "Fade out", { min: 0, step: 100 }) }),
3549
+ clip.type === "media" && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
3550
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Row, { label: "Speed", name: "speed", children: clip.timeRemap ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "flex items-center gap-1", "data-ramped": "", children: [
3551
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "text-muted-foreground", children: "ramped" }),
3552
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: btn3, disabled, onClick: () => controller.apply({ op: "set_time_remap", clip: clip.id, keys: null, ripple: true }, "Remove speed ramp"), children: "Remove ramp" })
3436
3553
  ] }) : number("speed", "Speed", { min: 0.1, step: 0.25 }) }),
3437
- project.assets.find((a) => a.id === clip.asset)?.kind !== "image" && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Row, { label: "Retime", name: "retime", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { className: "flex flex-wrap gap-1", children: [
3438
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3554
+ project.assets.find((a) => a.id === clip.asset)?.kind !== "image" && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Row, { label: "Retime", name: "retime", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "flex flex-wrap gap-1", children: [
3555
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3439
3556
  "button",
3440
3557
  {
3441
3558
  type: "button",
3442
- className: btn2,
3559
+ className: btn3,
3443
3560
  disabled: disabled || time < clip.start || time > clip.start + clip.duration,
3444
3561
  title: "Hold the frame at the playhead for a second, pushing later clips along",
3445
3562
  onClick: () => controller.apply((0, import_video_editor7.videoFreezeFrameEdit)(clip, time - clip.start, 1e3), "Freeze frame"),
3446
3563
  children: "Freeze 1 s here"
3447
3564
  }
3448
3565
  ),
3449
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", className: btn2, disabled, title: "Normal speed, then a glide into 0.3\xD7 slow motion", onClick: () => controller.apply((0, import_video_editor7.videoSpeedRampEdit)(clip, (0, import_video_editor7.videoSlowMotionRamp)(clip.duration)), "Speed ramp"), children: "Slow-mo ramp" })
3566
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: btn3, disabled, title: "Normal speed, then a glide into 0.3\xD7 slow motion", onClick: () => controller.apply((0, import_video_editor7.videoSpeedRampEdit)(clip, (0, import_video_editor7.videoSlowMotionRamp)(clip.duration)), "Speed ramp"), children: "Slow-mo ramp" })
3450
3567
  ] }) }),
3451
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Row, { label: "Muted", name: "muted", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("input", { type: "checkbox", className: "justify-self-start", checked: !!clip.muted, disabled, "aria-label": "Muted", onChange: (e) => set("muted", e.target.checked || void 0, e.target.checked ? "Mute clip" : "Unmute clip") }) }),
3568
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Row, { label: "Muted", name: "muted", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("input", { type: "checkbox", className: "justify-self-start", checked: !!clip.muted, disabled, "aria-label": "Muted", onChange: (e) => set("muted", e.target.checked || void 0, e.target.checked ? "Mute clip" : "Unmute clip") }) }),
3452
3569
  ["fadeInCurve", "fadeOutCurve"].map(
3453
- (key) => (key === "fadeInCurve" ? clip.fadeIn : clip.fadeOut) ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Row, { label: key === "fadeInCurve" ? "Fade in sound" : "Fade out sound", name: key, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3570
+ (key) => (key === "fadeInCurve" ? clip.fadeIn : clip.fadeOut) ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Row, { label: key === "fadeInCurve" ? "Fade in sound" : "Fade out sound", name: key, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3454
3571
  "select",
3455
3572
  {
3456
3573
  className: field,
@@ -3461,28 +3578,28 @@ function ClipInspector({ controller, className = "" }) {
3461
3578
  const curve = e.target.value;
3462
3579
  set(key, curve === "linear" ? void 0 : curve, key === "fadeInCurve" ? "Change fade in curve" : "Change fade out curve");
3463
3580
  },
3464
- children: import_video_editor7.VIDEO_FADE_CURVES.map((c) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: c, children: import_video_editor7.VIDEO_FADE_CURVE_LABELS[c] }, c))
3581
+ children: import_video_editor7.VIDEO_FADE_CURVES.map((c) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("option", { value: c, children: import_video_editor7.VIDEO_FADE_CURVE_LABELS[c] }, c))
3465
3582
  }
3466
3583
  ) }, key) : null
3467
3584
  )
3468
3585
  ] }),
3469
- clip.type === "text" && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
3470
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Row, { label: "Text", name: "text", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Commit, { multiline: true, value: clip.text, "aria-label": "Text", disabled, onCommit: (raw) => set("text", raw, "Change text") }) }),
3471
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Row, { label: "Colour", name: "color", children: text("color", "Colour") }),
3472
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Row, { label: "Font size", name: "fontSize", children: number("fontSize", "Font size", { min: 1, step: 2 }) }),
3473
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Row, { label: "Background", name: "background", children: text("background", "Background") })
3586
+ clip.type === "text" && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
3587
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Row, { label: "Text", name: "text", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Commit, { multiline: true, value: clip.text, "aria-label": "Text", disabled, onCommit: (raw) => set("text", raw, "Change text") }) }),
3588
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Row, { label: "Colour", name: "color", children: text("color", "Colour") }),
3589
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Row, { label: "Font size", name: "fontSize", children: number("fontSize", "Font size", { min: 1, step: 2 }) }),
3590
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Row, { label: "Background", name: "background", children: text("background", "Background") })
3474
3591
  ] }),
3475
- clip.type === "sequence" && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
3476
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Row, { label: "Sequence", name: "sequence", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { className: "truncate", title: "A compound clip plays its sequence as one picture and sound; its clips cannot be edited here yet", children: [
3592
+ clip.type === "sequence" && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
3593
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Row, { label: "Sequence", name: "sequence", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "truncate", title: "A compound clip plays its sequence as one picture and sound; its clips cannot be edited here yet", children: [
3477
3594
  project.sequences?.find((q) => q.id === clip.sequence)?.name ?? clip.sequence,
3478
3595
  " \xB7 from ",
3479
3596
  (0, import_video_editor7.formatVideoSeconds)(clip.in ?? 0)
3480
3597
  ] }) }),
3481
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Row, { label: "Muted", name: "muted", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("input", { type: "checkbox", className: "justify-self-start", checked: !!clip.muted, disabled, "aria-label": "Muted", onChange: (e) => set("muted", e.target.checked || void 0, e.target.checked ? "Mute clip" : "Unmute clip") }) })
3598
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Row, { label: "Muted", name: "muted", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("input", { type: "checkbox", className: "justify-self-start", checked: !!clip.muted, disabled, "aria-label": "Muted", onChange: (e) => set("muted", e.target.checked || void 0, e.target.checked ? "Mute clip" : "Unmute clip") }) })
3482
3599
  ] }),
3483
- clip.type === "effect" && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Row, { label: "Effect", name: "effect", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "truncate text-xs", title: "Change its controls in the Effects panel", children: clip.name ?? clip.effect }) }),
3484
- clip.type === "color" && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Row, { label: "Colour", name: "color", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Commit, { value: clip.color, "aria-label": "Colour", disabled, onCommit: (raw) => raw.trim() && set("color", raw.trim(), "Change colour") }) }),
3485
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Row, { label: "Transition in", name: "transition", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
3600
+ clip.type === "effect" && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Row, { label: "Effect", name: "effect", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "truncate text-xs", title: "Change its controls in the Effects panel", children: clip.name ?? clip.effect }) }),
3601
+ clip.type === "color" && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Row, { label: "Colour", name: "color", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Commit, { value: clip.color, "aria-label": "Colour", disabled, onCommit: (raw) => raw.trim() && set("color", raw.trim(), "Change colour") }) }),
3602
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Row, { label: "Transition in", name: "transition", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
3486
3603
  "select",
3487
3604
  {
3488
3605
  className: field,
@@ -3498,12 +3615,12 @@ function ClipInspector({ controller, className = "" }) {
3498
3615
  );
3499
3616
  },
3500
3617
  children: [
3501
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: "", children: "None" }),
3502
- import_video_editor7.VIDEO_TRANSITION_TYPES.filter((t) => t !== "effect" || transition?.type === "effect").map((t) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: t, children: t === "effect" ? `Effect: ${transition?.effect?.name ?? transition?.effect?.effect}` : import_video_editor7.VIDEO_TRANSITION_LABELS[t] }, t))
3618
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("option", { value: "", children: "None" }),
3619
+ import_video_editor7.VIDEO_TRANSITION_TYPES.filter((t) => t !== "effect" || transition?.type === "effect").map((t) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("option", { value: t, children: t === "effect" ? `Effect: ${transition?.effect?.name ?? transition?.effect?.effect}` : import_video_editor7.VIDEO_TRANSITION_LABELS[t] }, t))
3503
3620
  ]
3504
3621
  }
3505
3622
  ) }),
3506
- transition && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Row, { label: "Length (ms)", name: "transitionDuration", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3623
+ transition && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Row, { label: "Length (ms)", name: "transitionDuration", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3507
3624
  Commit,
3508
3625
  {
3509
3626
  type: "number",
@@ -3518,7 +3635,7 @@ function ClipInspector({ controller, className = "" }) {
3518
3635
  }
3519
3636
  }
3520
3637
  ) }),
3521
- transition && (0, import_video_editor7.videoTransitionHasDirection)(transition.type) && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Row, { label: "Direction", name: "transitionDirection", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3638
+ transition && (0, import_video_editor7.videoTransitionHasDirection)(transition.type) && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Row, { label: "Direction", name: "transitionDirection", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3522
3639
  "select",
3523
3640
  {
3524
3641
  className: field,
@@ -3526,10 +3643,10 @@ function ClipInspector({ controller, className = "" }) {
3526
3643
  disabled,
3527
3644
  "aria-label": "Transition direction",
3528
3645
  onChange: (e) => controller.apply({ op: "set_transition", clip: clip.id, transition: { ...transition, direction: e.target.value } }, "Change transition direction"),
3529
- children: import_video_editor7.VIDEO_WIPE_DIRECTIONS.map((d) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: d, children: d }, d))
3646
+ children: import_video_editor7.VIDEO_WIPE_DIRECTIONS.map((d) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("option", { value: d, children: d }, d))
3530
3647
  }
3531
3648
  ) }),
3532
- transition && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Row, { label: "Transition sound", name: "transitionAudioCurve", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3649
+ transition && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Row, { label: "Transition sound", name: "transitionAudioCurve", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3533
3650
  "select",
3534
3651
  {
3535
3652
  className: field,
@@ -3542,26 +3659,26 @@ function ClipInspector({ controller, className = "" }) {
3542
3659
  const next = curve === (0, import_video_editor7.videoTransitionAudioCurve)(rest) ? rest : { ...rest, audioCurve: curve };
3543
3660
  controller.apply({ op: "set_transition", clip: clip.id, transition: next }, "Change transition sound");
3544
3661
  },
3545
- children: import_video_editor7.VIDEO_FADE_CURVES.map((c) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: c, children: import_video_editor7.VIDEO_FADE_CURVE_LABELS[c] }, c))
3662
+ children: import_video_editor7.VIDEO_FADE_CURVES.map((c) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("option", { value: c, children: import_video_editor7.VIDEO_FADE_CURVE_LABELS[c] }, c))
3546
3663
  }
3547
3664
  ) }),
3548
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ClipCameraMoves, { controller, clip: clip.id })
3665
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ClipCameraMoves, { controller, clip: clip.id })
3549
3666
  ] });
3550
3667
  }
3551
3668
 
3552
3669
  // src/video-editor/MediaBin.tsx
3553
- var import_react21 = require("react");
3670
+ var import_react22 = require("react");
3554
3671
  var import_video_editor8 = require("@pixerate/editor/video-editor");
3555
- var import_jsx_runtime17 = require("react/jsx-runtime");
3556
- var btn3 = "rounded border border-border px-2 py-0.5 text-xs disabled:opacity-40";
3672
+ var import_jsx_runtime18 = require("react/jsx-runtime");
3673
+ var btn4 = "rounded border border-border px-2 py-0.5 text-xs disabled:opacity-40";
3557
3674
  function MediaBin({ controller, editable = true, fileToUrl, probe = import_video_editor8.probeVideoMedia, className = "" }) {
3558
3675
  const { project, readOnly } = useVideoEditorState(controller);
3559
3676
  const canEdit = editable && !readOnly;
3560
- const [url, setUrl] = (0, import_react21.useState)("");
3561
- const [urlKind, setUrlKind] = (0, import_react21.useState)("");
3562
- const [busy, setBusy] = (0, import_react21.useState)(0);
3563
- const [problem, setProblem] = (0, import_react21.useState)(null);
3564
- const [over, setOver] = (0, import_react21.useState)(false);
3677
+ const [url, setUrl] = (0, import_react22.useState)("");
3678
+ const [urlKind, setUrlKind] = (0, import_react22.useState)("");
3679
+ const [busy, setBusy] = (0, import_react22.useState)(0);
3680
+ const [problem, setProblem] = (0, import_react22.useState)(null);
3681
+ const [over, setOver] = (0, import_react22.useState)(false);
3565
3682
  const addSource = async (src, kind, name) => {
3566
3683
  setBusy((n) => n + 1);
3567
3684
  try {
@@ -3609,7 +3726,7 @@ function MediaBin({ controller, editable = true, fileToUrl, probe = import_video
3609
3726
  if (added) controller.select([added]);
3610
3727
  }
3611
3728
  };
3612
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
3729
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
3613
3730
  "div",
3614
3731
  {
3615
3732
  className: `flex flex-col gap-2 rounded ${over ? "ring-2 ring-rose-500/60" : ""} ${className}`,
@@ -3627,21 +3744,21 @@ function MediaBin({ controller, editable = true, fileToUrl, probe = import_video
3627
3744
  void addFiles(e.dataTransfer.files);
3628
3745
  },
3629
3746
  children: [
3630
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "text-xs font-medium", children: "Media" }),
3631
- project.assets.length ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("ul", { className: "flex flex-col gap-1", "aria-label": "Media assets", children: project.assets.map((asset) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("li", { className: "flex items-center gap-2 text-xs", "data-asset": asset.id, children: [
3632
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "rounded bg-muted px-1 text-[10px] uppercase text-muted-foreground", "data-asset-kind": "", children: asset.kind }),
3633
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "min-w-0 flex-1 truncate", title: asset.src, children: asset.name ?? asset.id }),
3634
- asset.proxies?.length ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "rounded bg-muted px-1 text-[10px] text-muted-foreground", title: `Proxies: ${asset.proxies.map((p) => `${p.scale * 100}%`).join(", ")} (the preview can play these; exports use the original)`, "data-asset-proxies": "", children: "proxy" }) : null,
3635
- asset.duration !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "tabular-nums text-muted-foreground", children: (0, import_video_editor8.formatVideoSeconds)(asset.duration) }),
3636
- editable && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: btn3, disabled: !canEdit, onClick: () => addToTimeline(asset), "data-add-to-timeline": "", children: "Add to timeline" })
3637
- ] }, asset.id)) }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("p", { className: "text-xs text-muted-foreground", children: [
3747
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "text-xs font-medium", children: "Media" }),
3748
+ project.assets.length ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("ul", { className: "flex flex-col gap-1", "aria-label": "Media assets", children: project.assets.map((asset) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("li", { className: "flex items-center gap-2 text-xs", "data-asset": asset.id, children: [
3749
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "rounded bg-muted px-1 text-[10px] uppercase text-muted-foreground", "data-asset-kind": "", children: asset.kind }),
3750
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "min-w-0 flex-1 truncate", title: asset.src, children: asset.name ?? asset.id }),
3751
+ asset.proxies?.length ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "rounded bg-muted px-1 text-[10px] text-muted-foreground", title: `Proxies: ${asset.proxies.map((p) => `${p.scale * 100}%`).join(", ")} (the preview can play these; exports use the original)`, "data-asset-proxies": "", children: "proxy" }) : null,
3752
+ asset.duration !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "tabular-nums text-muted-foreground", children: (0, import_video_editor8.formatVideoSeconds)(asset.duration) }),
3753
+ editable && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: btn4, disabled: !canEdit, onClick: () => addToTimeline(asset), "data-add-to-timeline": "", children: "Add to timeline" })
3754
+ ] }, asset.id)) }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("p", { className: "text-xs text-muted-foreground", children: [
3638
3755
  "No media yet.",
3639
3756
  editable ? " Choose or drop files, or add a URL." : ""
3640
3757
  ] }),
3641
- editable && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
3642
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("label", { className: "flex flex-col gap-1 rounded border border-dashed border-border p-2 text-xs text-muted-foreground", children: [
3758
+ editable && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
3759
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { className: "flex flex-col gap-1 rounded border border-dashed border-border p-2 text-xs text-muted-foreground", children: [
3643
3760
  "Choose or drop video, audio or image files",
3644
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3761
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3645
3762
  "input",
3646
3763
  {
3647
3764
  type: "file",
@@ -3658,7 +3775,7 @@ function MediaBin({ controller, editable = true, fileToUrl, probe = import_video
3658
3775
  }
3659
3776
  )
3660
3777
  ] }),
3661
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
3778
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
3662
3779
  "form",
3663
3780
  {
3664
3781
  className: "flex items-center gap-1",
@@ -3667,7 +3784,7 @@ function MediaBin({ controller, editable = true, fileToUrl, probe = import_video
3667
3784
  void addUrl();
3668
3785
  },
3669
3786
  children: [
3670
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3787
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3671
3788
  "input",
3672
3789
  {
3673
3790
  className: "min-w-0 flex-1 rounded border border-border bg-transparent px-1 py-0.5 text-xs",
@@ -3678,37 +3795,37 @@ function MediaBin({ controller, editable = true, fileToUrl, probe = import_video
3678
3795
  onChange: (e) => setUrl(e.target.value)
3679
3796
  }
3680
3797
  ),
3681
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("select", { className: "rounded border border-border bg-transparent px-1 py-0.5 text-xs", value: urlKind, disabled: !canEdit, "aria-label": "Media kind", onChange: (e) => setUrlKind(e.target.value), children: [
3682
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("option", { value: "", children: "Auto" }),
3683
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("option", { value: "video", children: "Video" }),
3684
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("option", { value: "audio", children: "Audio" }),
3685
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("option", { value: "image", children: "Image" })
3798
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("select", { className: "rounded border border-border bg-transparent px-1 py-0.5 text-xs", value: urlKind, disabled: !canEdit, "aria-label": "Media kind", onChange: (e) => setUrlKind(e.target.value), children: [
3799
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("option", { value: "", children: "Auto" }),
3800
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("option", { value: "video", children: "Video" }),
3801
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("option", { value: "audio", children: "Audio" }),
3802
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("option", { value: "image", children: "Image" })
3686
3803
  ] }),
3687
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "submit", className: btn3, disabled: !canEdit || !url.trim(), "data-add-url": "", children: "Add" })
3804
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "submit", className: btn4, disabled: !canEdit || !url.trim(), "data-add-url": "", children: "Add" })
3688
3805
  ]
3689
3806
  }
3690
3807
  )
3691
3808
  ] }),
3692
- busy > 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "text-xs text-muted-foreground", children: "Reading media\u2026" }),
3693
- problem && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "text-xs text-red-500", role: "alert", "data-media-error": "", children: problem })
3809
+ busy > 0 && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "text-xs text-muted-foreground", children: "Reading media\u2026" }),
3810
+ problem && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "text-xs text-red-500", role: "alert", "data-media-error": "", children: problem })
3694
3811
  ]
3695
3812
  }
3696
3813
  );
3697
3814
  }
3698
3815
 
3699
3816
  // src/video-editor/TranscriptPanel.tsx
3700
- var import_react22 = __toESM(require("react"), 1);
3817
+ var import_react23 = __toESM(require("react"), 1);
3701
3818
  var import_video_editor9 = require("@pixerate/editor/video-editor");
3702
- var import_jsx_runtime18 = require("react/jsx-runtime");
3703
- var btn4 = "rounded border border-border px-1.5 py-0.5 text-[11px] disabled:opacity-40";
3819
+ var import_jsx_runtime19 = require("react/jsx-runtime");
3820
+ var btn5 = "rounded border border-border px-1.5 py-0.5 text-[11px] disabled:opacity-40";
3704
3821
  function TranscriptPanel({ controller, track, editable = true, className = "" }) {
3705
3822
  const state = useVideoEditorState(controller);
3706
3823
  const { project, time, readOnly } = state;
3707
3824
  const canEdit = editable && !readOnly;
3708
- const [anchor, setAnchor] = (0, import_react22.useState)(null);
3709
- const [focus, setFocus] = (0, import_react22.useState)(null);
3710
- const [message, setMessage] = (0, import_react22.useState)(null);
3711
- const words = (0, import_react22.useMemo)(() => {
3825
+ const [anchor, setAnchor] = (0, import_react23.useState)(null);
3826
+ const [focus, setFocus] = (0, import_react23.useState)(null);
3827
+ const [message, setMessage] = (0, import_react23.useState)(null);
3828
+ const words = (0, import_react23.useMemo)(() => {
3712
3829
  try {
3713
3830
  return (0, import_video_editor9.videoTimelineTranscript)(project, { track });
3714
3831
  } catch {
@@ -3734,9 +3851,9 @@ function TranscriptPanel({ controller, track, editable = true, className = "" })
3734
3851
  setMessage(e instanceof Error ? e.message : String(e));
3735
3852
  }
3736
3853
  };
3737
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: `flex flex-col gap-2 text-xs ${className}`, "data-transcript-panel": "", children: [
3738
- words.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
3739
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3854
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: `flex flex-col gap-2 text-xs ${className}`, "data-transcript-panel": "", children: [
3855
+ words.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
3856
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
3740
3857
  "div",
3741
3858
  {
3742
3859
  className: "max-h-48 overflow-y-auto leading-6",
@@ -3752,8 +3869,8 @@ function TranscriptPanel({ controller, track, editable = true, className = "" })
3752
3869
  },
3753
3870
  children: words.map((w, i) => {
3754
3871
  const inSelection = selected !== null && i >= selected[0] && i <= selected[1];
3755
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_react22.default.Fragment, { children: [
3756
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3872
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_react23.default.Fragment, { children: [
3873
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
3757
3874
  "span",
3758
3875
  {
3759
3876
  role: "option",
@@ -3779,51 +3896,51 @@ function TranscriptPanel({ controller, track, editable = true, className = "" })
3779
3896
  })
3780
3897
  }
3781
3898
  ),
3782
- canEdit && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
3783
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: btn4, disabled: !selected, onClick: () => selected && cut([(0, import_video_editor9.videoWordsRange)(words, selected[0], selected[1])], "Cut words", "Select words to cut."), children: "Delete selected words" }),
3784
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: btn4, onClick: () => cut((0, import_video_editor9.findVideoFillers)(words), "Remove fillers", "No filler words found."), children: "Remove fillers" }),
3785
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: btn4, onClick: () => cut((0, import_video_editor9.findVideoTranscriptPauses)(words, { fps: project.fps }), "Tighten pauses", "No long pauses found."), children: "Tighten pauses" })
3899
+ canEdit && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
3900
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", className: btn5, disabled: !selected, onClick: () => selected && cut([(0, import_video_editor9.videoWordsRange)(words, selected[0], selected[1])], "Cut words", "Select words to cut."), children: "Delete selected words" }),
3901
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", className: btn5, onClick: () => cut((0, import_video_editor9.findVideoFillers)(words), "Remove fillers", "No filler words found."), children: "Remove fillers" }),
3902
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", className: btn5, onClick: () => cut((0, import_video_editor9.findVideoTranscriptPauses)(words, { fps: project.fps }), "Tighten pauses", "No long pauses found."), children: "Tighten pauses" })
3786
3903
  ] })
3787
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "text-muted-foreground", "data-transcript-empty": "", children: "No transcribed media on the timeline. Load a transcript (Whisper JSON, .srt or .vtt) for a video or audio asset to edit by text." }),
3788
- canEdit && sound.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("details", { children: [
3789
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("summary", { className: "cursor-pointer text-muted-foreground", children: "Transcripts" }),
3790
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("ul", { className: "mt-1 space-y-1", children: sound.map((a) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("li", { className: "flex items-center gap-2", children: [
3791
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { className: "min-w-0 flex-1 truncate", children: [
3904
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "text-muted-foreground", "data-transcript-empty": "", children: "No transcribed media on the timeline. Load a transcript (Whisper JSON, .srt or .vtt) for a video or audio asset to edit by text." }),
3905
+ canEdit && sound.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("details", { children: [
3906
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("summary", { className: "cursor-pointer text-muted-foreground", children: "Transcripts" }),
3907
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("ul", { className: "mt-1 space-y-1", children: sound.map((a) => /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("li", { className: "flex items-center gap-2", children: [
3908
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { className: "min-w-0 flex-1 truncate", children: [
3792
3909
  a.name ?? a.id,
3793
3910
  " ",
3794
3911
  a.transcript ? `\xB7 ${a.transcript.length} words` : ""
3795
3912
  ] }),
3796
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("input", { type: "file", accept: ".json,.srt,.vtt,application/json,text/vtt", "aria-label": `Load a transcript for ${a.name ?? a.id}`, className: "w-40 text-[10px]", onChange: (e) => void load(a.id, e.target.files?.[0]) })
3913
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("input", { type: "file", accept: ".json,.srt,.vtt,application/json,text/vtt", "aria-label": `Load a transcript for ${a.name ?? a.id}`, className: "w-40 text-[10px]", onChange: (e) => void load(a.id, e.target.files?.[0]) })
3797
3914
  ] }, a.id)) })
3798
3915
  ] }),
3799
- message && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "text-red-500", role: "alert", "data-transcript-error": "", children: message })
3916
+ message && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "text-red-500", role: "alert", "data-transcript-error": "", children: message })
3800
3917
  ] });
3801
3918
  }
3802
3919
 
3803
3920
  // src/video-editor/TranscriptEditor.tsx
3804
- var import_react24 = __toESM(require("react"), 1);
3921
+ var import_react25 = __toESM(require("react"), 1);
3805
3922
 
3806
3923
  // src/video-editor/useTranscriptVideo.ts
3807
- var import_react23 = require("react");
3924
+ var import_react24 = require("react");
3808
3925
  var import_video_editor10 = require("@pixerate/editor/video-editor");
3809
3926
  function useTranscriptVideoController(controller, options = {}) {
3810
- const ref = (0, import_react23.useRef)(null);
3927
+ const ref = (0, import_react24.useRef)(null);
3811
3928
  const key = `${options.track ?? ""}|${options.planFirst ? 1 : 0}`;
3812
3929
  if (!ref.current || ref.current.editor !== controller || ref.current.key !== key) {
3813
3930
  ref.current?.transcript.destroy();
3814
3931
  ref.current = { key, editor: controller, transcript: new import_video_editor10.TranscriptVideoController(controller, options) };
3815
3932
  }
3816
3933
  const transcript = ref.current.transcript;
3817
- (0, import_react23.useEffect)(() => () => transcript.destroy(), [transcript]);
3934
+ (0, import_react24.useEffect)(() => () => transcript.destroy(), [transcript]);
3818
3935
  return transcript;
3819
3936
  }
3820
3937
  function useTranscriptVideoState(transcript) {
3821
- return (0, import_react23.useSyncExternalStore)(transcript.subscribe, transcript.getState, transcript.getState);
3938
+ return (0, import_react24.useSyncExternalStore)(transcript.subscribe, transcript.getState, transcript.getState);
3822
3939
  }
3823
3940
 
3824
3941
  // src/video-editor/TranscriptEditor.tsx
3825
- var import_jsx_runtime19 = require("react/jsx-runtime");
3826
- var btn5 = "rounded border border-border px-1.5 py-0.5 text-[11px] disabled:opacity-40";
3942
+ var import_jsx_runtime20 = require("react/jsx-runtime");
3943
+ var btn6 = "rounded border border-border px-1.5 py-0.5 text-[11px] disabled:opacity-40";
3827
3944
  var CHIP = {
3828
3945
  filler: "bg-amber-400/30 text-amber-700 dark:text-amber-300",
3829
3946
  pause: "bg-sky-400/25 text-sky-700 dark:text-sky-300",
@@ -3833,13 +3950,13 @@ var KIND_LABEL = { filler: "filler", pause: "pause", repetition: "repeat" };
3833
3950
  function TranscriptEditor({ controller, track, planFirst = false, editable = true, className = "" }) {
3834
3951
  const transcript = useTranscriptVideoController(controller, { track, planFirst });
3835
3952
  const state = useTranscriptVideoState(transcript);
3836
- const [anchor, setAnchor] = (0, import_react24.useState)(null);
3953
+ const [anchor, setAnchor] = (0, import_react25.useState)(null);
3837
3954
  const canEdit = editable && state.editable;
3838
3955
  const { words, current, selection, disfluencies, flags } = state;
3839
3956
  if (!words.length)
3840
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: `text-xs text-muted-foreground ${className}`, "data-transcript-editor": "", "data-transcript-empty": "", children: "No transcribed media on the timeline. Attach a transcript (Whisper JSON, .srt or .vtt) to edit by text." });
3841
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: `flex flex-col gap-2 text-xs ${className}`, "data-transcript-editor": "", children: [
3842
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
3957
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: `text-xs text-muted-foreground ${className}`, "data-transcript-editor": "", "data-transcript-empty": "", children: "No transcribed media on the timeline. Attach a transcript (Whisper JSON, .srt or .vtt) to edit by text." });
3958
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: `flex flex-col gap-2 text-xs ${className}`, "data-transcript-editor": "", children: [
3959
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3843
3960
  "div",
3844
3961
  {
3845
3962
  className: "max-h-56 overflow-y-auto leading-6",
@@ -3856,8 +3973,8 @@ function TranscriptEditor({ controller, track, planFirst = false, editable = tru
3856
3973
  children: words.map((w, i) => {
3857
3974
  const selected = !!selection && i >= selection[0] && i <= selection[1];
3858
3975
  const kinds = flags[i];
3859
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_react24.default.Fragment, { children: [
3860
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
3976
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_react25.default.Fragment, { children: [
3977
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3861
3978
  "span",
3862
3979
  {
3863
3980
  role: "option",
@@ -3880,62 +3997,62 @@ function TranscriptEditor({ controller, track, planFirst = false, editable = tru
3880
3997
  children: w.word
3881
3998
  }
3882
3999
  ),
3883
- kinds?.includes("pause") ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "mx-0.5 text-sky-500", "aria-hidden": "true", children: "\u23F8" }) : " "
4000
+ kinds?.includes("pause") ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "mx-0.5 text-sky-500", "aria-hidden": "true", children: "\u23F8" }) : " "
3884
4001
  ] }, `${w.clip}:${w.index}`);
3885
4002
  })
3886
4003
  }
3887
4004
  ),
3888
- canEdit && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
3889
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", className: btn5, disabled: !selection, onClick: () => transcript.deleteSelection(), "data-delete-words": "", children: planFirst ? "Propose deleting words" : "Delete words" }),
3890
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("button", { type: "button", className: btn5, disabled: !disfluencies.length, onClick: () => transcript.planCleanup(), "data-plan-cleanup": "", children: [
4005
+ canEdit && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
4006
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", className: btn6, disabled: !selection, onClick: () => transcript.deleteSelection(), "data-delete-words": "", children: planFirst ? "Propose deleting words" : "Delete words" }),
4007
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("button", { type: "button", className: btn6, disabled: !disfluencies.length, onClick: () => transcript.planCleanup(), "data-plan-cleanup": "", children: [
3891
4008
  "Plan cleanup (",
3892
4009
  disfluencies.length,
3893
4010
  ")"
3894
4011
  ] })
3895
4012
  ] }),
3896
- disfluencies.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("ul", { className: "flex flex-wrap gap-1", "aria-label": "Disfluencies", "data-disfluencies": "", children: disfluencies.map((d, i) => /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("li", { className: `flex items-center gap-1 rounded px-1 ${CHIP[d.kind]}`, "data-disfluency-chip": d.kind, children: [
3897
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("button", { type: "button", className: "tabular-nums", title: "Go to it", onClick: () => controller.seek(d.from), children: [
4013
+ disfluencies.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("ul", { className: "flex flex-wrap gap-1", "aria-label": "Disfluencies", "data-disfluencies": "", children: disfluencies.map((d, i) => /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("li", { className: `flex items-center gap-1 rounded px-1 ${CHIP[d.kind]}`, "data-disfluency-chip": d.kind, children: [
4014
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("button", { type: "button", className: "tabular-nums", title: "Go to it", onClick: () => controller.seek(d.from), children: [
3898
4015
  KIND_LABEL[d.kind],
3899
4016
  ": ",
3900
4017
  d.kind === "pause" ? `${((d.to - d.from) / 1e3).toFixed(1)} s` : d.text
3901
4018
  ] }),
3902
- canEdit && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", "aria-label": `Cut ${KIND_LABEL[d.kind]} ${d.text}`, onClick: () => transcript.removeDisfluency(i), "data-cut-disfluency": i, children: "\u2715" })
4019
+ canEdit && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", "aria-label": `Cut ${KIND_LABEL[d.kind]} ${d.text}`, onClick: () => transcript.removeDisfluency(i), "data-cut-disfluency": i, children: "\u2715" })
3903
4020
  ] }, `${d.kind}:${d.from}`)) }),
3904
- state.error && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "text-red-500", role: "alert", "data-transcript-error": "", children: state.error })
4021
+ state.error && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "text-red-500", role: "alert", "data-transcript-error": "", children: state.error })
3905
4022
  ] });
3906
4023
  }
3907
4024
 
3908
4025
  // src/video-editor/EditPlanPreview.tsx
3909
- var import_react25 = require("react");
4026
+ var import_react26 = require("react");
3910
4027
  var import_video_editor11 = require("@pixerate/editor/video-editor");
3911
- var import_jsx_runtime20 = require("react/jsx-runtime");
3912
- var btn6 = "rounded border border-border px-2 py-0.5 text-[11px] disabled:opacity-40";
4028
+ var import_jsx_runtime21 = require("react/jsx-runtime");
4029
+ var btn7 = "rounded border border-border px-2 py-0.5 text-[11px] disabled:opacity-40";
3913
4030
  function EditPlanPreview({ controller, editable = true, className = "" }) {
3914
4031
  const state = useVideoEditorState(controller);
3915
- const [message, setMessage] = (0, import_react25.useState)(null);
4032
+ const [message, setMessage] = (0, import_react26.useState)(null);
3916
4033
  if (!state.plans.length) return null;
3917
4034
  const total = Math.max(1, state.duration);
3918
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("section", { className: `flex flex-col gap-2 rounded-md border border-amber-500/50 bg-amber-500/5 p-2 text-xs ${className}`, "aria-label": "Proposed edits", "data-edit-plans": "", children: [
4035
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("section", { className: `flex flex-col gap-2 rounded-md border border-amber-500/50 bg-amber-500/5 p-2 text-xs ${className}`, "aria-label": "Proposed edits", "data-edit-plans": "", children: [
3919
4036
  state.plans.map((plan) => {
3920
4037
  const s = plan.summary;
3921
4038
  const stale = controller.isPlanStale(plan.id);
3922
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("article", { className: "flex flex-col gap-1", "data-edit-plan": plan.id, children: [
3923
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center gap-2", children: [
3924
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("h3", { className: "flex-1 font-semibold", children: plan.title }),
3925
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { className: `tabular-nums ${s.durationDelta < 0 ? "text-emerald-600" : "text-muted-foreground"}`, "data-plan-delta": "", children: [
4039
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("article", { className: "flex flex-col gap-1", "data-edit-plan": plan.id, children: [
4040
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-2", children: [
4041
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("h3", { className: "flex-1 font-semibold", children: plan.title }),
4042
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { className: `tabular-nums ${s.durationDelta < 0 ? "text-emerald-600" : "text-muted-foreground"}`, "data-plan-delta": "", children: [
3926
4043
  s.durationDelta < 0 ? "\u2212" : s.durationDelta > 0 ? "+" : "\xB1",
3927
4044
  (0, import_video_editor11.formatVideoSeconds)(Math.abs(s.durationDelta))
3928
4045
  ] })
3929
4046
  ] }),
3930
- plan.description && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "text-muted-foreground", children: plan.description }),
3931
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("p", { className: "text-muted-foreground", "data-plan-summary": "", children: [
4047
+ plan.description && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "text-muted-foreground", children: plan.description }),
4048
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("p", { className: "text-muted-foreground", "data-plan-summary": "", children: [
3932
4049
  (0, import_video_editor11.describeVideoEditPlan)(plan),
3933
4050
  " \xB7 ",
3934
4051
  (0, import_video_editor11.formatVideoSeconds)(s.durationBefore),
3935
4052
  " \u2192 ",
3936
4053
  (0, import_video_editor11.formatVideoSeconds)(s.durationAfter)
3937
4054
  ] }),
3938
- plan.ranges && plan.ranges.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "relative h-3 w-full overflow-hidden rounded bg-muted", "aria-label": "Stretches the plan cuts", "data-plan-strip": "", children: plan.ranges.map((r, i) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
4055
+ plan.ranges && plan.ranges.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "relative h-3 w-full overflow-hidden rounded bg-muted", "aria-label": "Stretches the plan cuts", "data-plan-strip": "", children: plan.ranges.map((r, i) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3939
4056
  "button",
3940
4057
  {
3941
4058
  type: "button",
@@ -3947,7 +4064,7 @@ function EditPlanPreview({ controller, editable = true, className = "" }) {
3947
4064
  },
3948
4065
  i
3949
4066
  )) }),
3950
- s.newIssues.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("p", { className: "text-amber-600", children: [
4067
+ s.newIssues.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("p", { className: "text-amber-600", children: [
3951
4068
  "It would add ",
3952
4069
  s.newIssues.length,
3953
4070
  " problem",
@@ -3955,13 +4072,13 @@ function EditPlanPreview({ controller, editable = true, className = "" }) {
3955
4072
  ": ",
3956
4073
  s.newIssues[0].message
3957
4074
  ] }),
3958
- stale && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "text-amber-600", "data-plan-stale": "", children: "The project changed since this plan was made; it is checked again when accepted." }),
3959
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex gap-1", children: [
3960
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
4075
+ stale && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "text-amber-600", "data-plan-stale": "", children: "The project changed since this plan was made; it is checked again when accepted." }),
4076
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex gap-1", children: [
4077
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3961
4078
  "button",
3962
4079
  {
3963
4080
  type: "button",
3964
- className: btn6,
4081
+ className: btn7,
3965
4082
  disabled: !editable || state.readOnly,
3966
4083
  "data-accept-plan": "",
3967
4084
  onClick: () => {
@@ -3971,22 +4088,22 @@ function EditPlanPreview({ controller, editable = true, className = "" }) {
3971
4088
  children: "Accept plan"
3972
4089
  }
3973
4090
  ),
3974
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", className: btn6, "data-discard-plan": "", onClick: () => (controller.discardPlan(plan.id), setMessage(null)), children: "Discard" })
4091
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", className: btn7, "data-discard-plan": "", onClick: () => (controller.discardPlan(plan.id), setMessage(null)), children: "Discard" })
3975
4092
  ] })
3976
4093
  ] }, plan.id);
3977
4094
  }),
3978
- message && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "text-red-500", role: "alert", "data-plan-error": "", children: message })
4095
+ message && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "text-red-500", role: "alert", "data-plan-error": "", children: message })
3979
4096
  ] });
3980
4097
  }
3981
4098
 
3982
4099
  // src/video-editor/VideoEditor.tsx
3983
- var import_react27 = require("react");
4100
+ var import_react28 = require("react");
3984
4101
 
3985
4102
  // src/video-editor/VideoEffectsPanel.tsx
3986
- var import_react26 = require("react");
4103
+ var import_react27 = require("react");
3987
4104
  var import_video_editor12 = require("@pixerate/editor/video-editor");
3988
- var import_jsx_runtime21 = require("react/jsx-runtime");
3989
- var btn7 = "rounded border border-border px-1.5 py-0.5 text-[11px] disabled:opacity-40";
4105
+ var import_jsx_runtime22 = require("react/jsx-runtime");
4106
+ var btn8 = "rounded border border-border px-1.5 py-0.5 text-[11px] disabled:opacity-40";
3990
4107
  var keyedOf = (values) => new Set(Object.entries(values ?? {}).filter(([, v]) => (0, import_video_editor12.isVideoKeyframes)(v)).map(([k]) => k));
3991
4108
  function EffectControls({
3992
4109
  provider,
@@ -3998,23 +4115,23 @@ function EffectControls({
3998
4115
  onPreset
3999
4116
  }) {
4000
4117
  const { description, error } = useEffectDescription(provider, effect);
4001
- if (!provider) return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("p", { className: "text-[11px] text-muted-foreground", children: [
4118
+ if (!provider) return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("p", { className: "text-[11px] text-muted-foreground", children: [
4002
4119
  'No effects provider: "',
4003
4120
  name ?? effect,
4004
4121
  '" is kept and shown as a placeholder.'
4005
4122
  ] });
4006
- if (error) return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "text-[11px] text-amber-500", children: error });
4007
- if (!description) return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "Loading\u2026" });
4008
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(EffectParameters, { description, values: values ?? {}, keyframed: keyedOf(values), disabled, onChange, onReset: (k) => onChange(k, description.defaults[k], null), onPreset });
4123
+ if (error) return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "text-[11px] text-amber-500", children: error });
4124
+ if (!description) return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "Loading\u2026" });
4125
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(EffectParameters, { description, values: values ?? {}, keyframed: keyedOf(values), disabled, onChange, onReset: (k) => onChange(k, description.defaults[k], null), onPreset });
4009
4126
  }
4010
4127
  function VideoEffectsPanel({ controller, className = "" }) {
4011
4128
  const state = useVideoEditorState(controller);
4012
4129
  const provider = state.effectsProvider;
4013
- const [browse, setBrowse] = (0, import_react26.useState)(null);
4014
- const [message, setMessage] = (0, import_react26.useState)(null);
4015
- const [open, setOpen] = (0, import_react26.useState)(null);
4016
- const [authoring, setAuthoring] = (0, import_react26.useState)(null);
4017
- (0, import_react26.useEffect)(() => () => authoring?.dispose(), [authoring]);
4130
+ const [browse, setBrowse] = (0, import_react27.useState)(null);
4131
+ const [message, setMessage] = (0, import_react27.useState)(null);
4132
+ const [open, setOpen] = (0, import_react27.useState)(null);
4133
+ const [authoring, setAuthoring] = (0, import_react27.useState)(null);
4134
+ (0, import_react27.useEffect)(() => () => authoring?.dispose(), [authoring]);
4018
4135
  const selected = state.selection[0];
4019
4136
  const at = selected ? (0, import_video_editor12.findVideoClip)(state.project, selected) : null;
4020
4137
  const clip = at?.clip ?? null;
@@ -4025,18 +4142,19 @@ function VideoEffectsPanel({ controller, className = "" }) {
4025
4142
  if (!track) return setMessage("Add a video track first.");
4026
4143
  report(controller.addEffectClip(track, effect, { start: Math.round(state.time), mode: "overwrite" }).then((r) => (r.ok && r.clip && controller.select([r.clip]), r)));
4027
4144
  };
4028
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("section", { className: `flex flex-col gap-2 rounded-md border border-border p-2 text-xs ${className}`, "aria-label": "Effects", "data-video-effects": "", children: [
4029
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-1", children: [
4030
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("h3", { className: "flex-1 font-semibold", children: "Effects" }),
4031
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", className: btn7, disabled: disabled || !provider, onClick: () => setBrowse(browse === "generator" ? null : "generator"), "aria-pressed": browse === "generator", children: "Add effect clip" })
4145
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("section", { className: `flex flex-col gap-2 rounded-md border border-border p-2 text-xs ${className}`, "aria-label": "Effects", "data-video-effects": "", children: [
4146
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center gap-1", children: [
4147
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("h3", { className: "flex-1 font-semibold", children: "Effects" }),
4148
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", className: btn8, disabled: disabled || !provider, onClick: () => setBrowse(browse === "generator" ? null : "generator"), "aria-pressed": browse === "generator", children: "Add effect clip" })
4032
4149
  ] }),
4033
- !provider && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No effects provider is registered. Effects in the project are kept and drawn as placeholders." }),
4034
- browse === "generator" && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(EffectsBrowser, { provider, uses: ["generator", "title", "overlay"], title: "Generators and titles", onPick: (e) => (setBrowse(null), addEffectClip(e.id)) }),
4035
- !clip && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "Select a clip to see its effects." }),
4036
- clip && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
4037
- clip.type === "effect" && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "space-y-1", "data-effect-part": "generator", children: [
4038
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "font-medium", children: clip.name ?? clip.effect }),
4039
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4150
+ !provider && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No effects provider is registered. Effects in the project are kept and drawn as placeholders." }),
4151
+ browse === "generator" && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(EffectsBrowser, { provider, uses: ["generator", "title", "overlay"], title: "Generators and titles", onPick: (e) => (setBrowse(null), addEffectClip(e.id)) }),
4152
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(EffectTemplates, { provider, disabled, fillLabel: "Insert template", onFill: (t, v) => controller.fillTemplate(t, v, { at: Math.round(state.time) }).then((r) => (r.ok && r.notes.length && setMessage(r.notes.join(" ")), r)) }),
4153
+ !clip && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "Select a clip to see its effects." }),
4154
+ clip && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
4155
+ clip.type === "effect" && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "space-y-1", "data-effect-part": "generator", children: [
4156
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "font-medium", children: clip.name ?? clip.effect }),
4157
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
4040
4158
  EffectControls,
4041
4159
  {
4042
4160
  provider,
@@ -4049,13 +4167,13 @@ function VideoEffectsPanel({ controller, className = "" }) {
4049
4167
  }
4050
4168
  )
4051
4169
  ] }),
4052
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "space-y-1", "data-effect-part": "transition", children: [
4053
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-1", children: [
4054
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "flex-1 font-medium", children: "Transition in" }),
4055
- clip.transition?.type === "effect" ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", className: btn7, disabled, onClick: () => report(controller.apply({ op: "set_transition", clip: clip.id, transition: null }, "Remove transition")), children: "Remove" }) : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", className: btn7, disabled: disabled || !provider, "aria-pressed": browse === "transition", onClick: () => setBrowse(browse === "transition" ? null : "transition"), children: "Effect transition\u2026" })
4170
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "space-y-1", "data-effect-part": "transition", children: [
4171
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center gap-1", children: [
4172
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "flex-1 font-medium", children: "Transition in" }),
4173
+ clip.transition?.type === "effect" ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", className: btn8, disabled, onClick: () => report(controller.apply({ op: "set_transition", clip: clip.id, transition: null }, "Remove transition")), children: "Remove" }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", className: btn8, disabled: disabled || !provider, "aria-pressed": browse === "transition", onClick: () => setBrowse(browse === "transition" ? null : "transition"), children: "Effect transition\u2026" })
4056
4174
  ] }),
4057
- browse === "transition" && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(EffectsBrowser, { provider, uses: ["transition"], title: "Transitions", onPick: (e) => (setBrowse(null), report(controller.setEffectTransition(clip.id, e.id))) }),
4058
- clip.transition?.type === "effect" && clip.transition.effect && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4175
+ browse === "transition" && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(EffectsBrowser, { provider, uses: ["transition"], title: "Transitions", onPick: (e) => (setBrowse(null), report(controller.setEffectTransition(clip.id, e.id))) }),
4176
+ clip.transition?.type === "effect" && clip.transition.effect && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
4059
4177
  EffectControls,
4060
4178
  {
4061
4179
  provider,
@@ -4068,23 +4186,23 @@ function VideoEffectsPanel({ controller, className = "" }) {
4068
4186
  }
4069
4187
  )
4070
4188
  ] }),
4071
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "space-y-1", "data-effect-part": "stack", children: [
4072
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-1", children: [
4073
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "flex-1 font-medium", children: "On this clip" }),
4074
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", className: btn7, disabled: disabled || !provider, "aria-pressed": browse === "clip", onClick: () => setBrowse(browse === "clip" ? null : "clip"), children: "Add effect\u2026" })
4189
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "space-y-1", "data-effect-part": "stack", children: [
4190
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center gap-1", children: [
4191
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "flex-1 font-medium", children: "On this clip" }),
4192
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", className: btn8, disabled: disabled || !provider, "aria-pressed": browse === "clip", onClick: () => setBrowse(browse === "clip" ? null : "clip"), children: "Add effect\u2026" })
4075
4193
  ] }),
4076
- browse === "clip" && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(EffectsBrowser, { provider, uses: ["filter", "overlay"], title: "Filters and overlays", onPick: (e) => (setBrowse(null), report(controller.applyClipEffect(clip.id, e.id))) }),
4077
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("ol", { className: "space-y-1", children: (clip.effects ?? []).map((e, i, all) => /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("li", { className: "rounded border border-border p-1", "data-clip-effect": e.id, children: [
4078
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-1", children: [
4079
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("input", { type: "checkbox", checked: e.enabled !== false, disabled, "aria-label": `${e.name ?? e.effect} on`, onChange: (ev) => report(controller.updateClipEffect(clip.id, e.id, { enabled: ev.currentTarget.checked })) }),
4080
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", className: "min-w-0 flex-1 truncate text-left", "aria-expanded": open === e.id, onClick: () => setOpen(open === e.id ? null : e.id), children: e.name ?? e.effect }),
4081
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", className: btn7, disabled: disabled || i === 0, "aria-label": "Move up", onClick: () => report(controller.updateClipEffect(clip.id, e.id, { index: i - 1 })), children: "\u2191" }),
4082
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", className: btn7, disabled: disabled || i === all.length - 1, "aria-label": "Move down", onClick: () => report(controller.updateClipEffect(clip.id, e.id, { index: i + 1 })), children: "\u2193" }),
4083
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4194
+ browse === "clip" && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(EffectsBrowser, { provider, uses: ["filter", "overlay"], title: "Filters and overlays", onPick: (e) => (setBrowse(null), report(controller.applyClipEffect(clip.id, e.id))) }),
4195
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("ol", { className: "space-y-1", children: (clip.effects ?? []).map((e, i, all) => /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("li", { className: "rounded border border-border p-1", "data-clip-effect": e.id, children: [
4196
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center gap-1", children: [
4197
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("input", { type: "checkbox", checked: e.enabled !== false, disabled, "aria-label": `${e.name ?? e.effect} on`, onChange: (ev) => report(controller.updateClipEffect(clip.id, e.id, { enabled: ev.currentTarget.checked })) }),
4198
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", className: "min-w-0 flex-1 truncate text-left", "aria-expanded": open === e.id, onClick: () => setOpen(open === e.id ? null : e.id), children: e.name ?? e.effect }),
4199
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", className: btn8, disabled: disabled || i === 0, "aria-label": "Move up", onClick: () => report(controller.updateClipEffect(clip.id, e.id, { index: i - 1 })), children: "\u2191" }),
4200
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", className: btn8, disabled: disabled || i === all.length - 1, "aria-label": "Move down", onClick: () => report(controller.updateClipEffect(clip.id, e.id, { index: i + 1 })), children: "\u2193" }),
4201
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
4084
4202
  "button",
4085
4203
  {
4086
4204
  type: "button",
4087
- className: btn7,
4205
+ className: btn8,
4088
4206
  disabled: disabled || !provider,
4089
4207
  "aria-label": `Author ${e.name ?? e.effect}`,
4090
4208
  title: "Tune and keyframe it in the effect authoring editor",
@@ -4096,12 +4214,12 @@ function VideoEffectsPanel({ controller, className = "" }) {
4096
4214
  children: "\u270E"
4097
4215
  }
4098
4216
  ),
4099
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", className: btn7, disabled, "aria-label": `Remove ${e.name ?? e.effect}`, onClick: () => report(controller.removeClipEffect(clip.id, e.id)), children: "\u2715" })
4217
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", className: btn8, disabled, "aria-label": `Remove ${e.name ?? e.effect}`, onClick: () => report(controller.removeClipEffect(clip.id, e.id)), children: "\u2715" })
4100
4218
  ] }),
4101
- open === e.id && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "mt-1 space-y-2", children: [
4102
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center gap-1", children: [
4103
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "w-14 text-[11px]", children: "Opacity" }),
4104
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4219
+ open === e.id && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "mt-1 space-y-2", children: [
4220
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("label", { className: "flex items-center gap-1", children: [
4221
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "w-14 text-[11px]", children: "Opacity" }),
4222
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
4105
4223
  "input",
4106
4224
  {
4107
4225
  type: "range",
@@ -4116,7 +4234,7 @@ function VideoEffectsPanel({ controller, className = "" }) {
4116
4234
  }
4117
4235
  )
4118
4236
  ] }),
4119
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4237
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
4120
4238
  EffectControls,
4121
4239
  {
4122
4240
  provider,
@@ -4130,17 +4248,17 @@ function VideoEffectsPanel({ controller, className = "" }) {
4130
4248
  )
4131
4249
  ] })
4132
4250
  ] }, e.id)) }),
4133
- !clip.effects?.length && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No effects on this clip." })
4251
+ !clip.effects?.length && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No effects on this clip." })
4134
4252
  ] })
4135
4253
  ] }),
4136
- authoring && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "space-y-1 rounded border border-border p-1", "data-effect-authoring": authoring.instance, children: [
4137
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(EffectAuthoringEditor, { session: authoring.session, showSource: false, previewSize: { width: 240, height: 135 } }),
4138
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex gap-1", children: [
4139
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4254
+ authoring && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "space-y-1 rounded border border-border p-1", "data-effect-authoring": authoring.instance, children: [
4255
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(EffectAuthoringEditor, { session: authoring.session, showSource: false, previewSize: { width: 240, height: 135 } }),
4256
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex gap-1", children: [
4257
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
4140
4258
  "button",
4141
4259
  {
4142
4260
  type: "button",
4143
- className: btn7,
4261
+ className: btn8,
4144
4262
  disabled,
4145
4263
  "data-apply-authoring": "",
4146
4264
  onClick: () => void authoring.commit().then((r) => {
@@ -4150,43 +4268,43 @@ function VideoEffectsPanel({ controller, className = "" }) {
4150
4268
  children: "Apply to clip"
4151
4269
  }
4152
4270
  ),
4153
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", className: btn7, onClick: () => setAuthoring(null), children: "Close" })
4271
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", className: btn8, onClick: () => setAuthoring(null), children: "Close" })
4154
4272
  ] })
4155
4273
  ] }),
4156
- message && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { role: "alert", className: "text-[11px] text-destructive", children: message })
4274
+ message && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { role: "alert", className: "text-[11px] text-destructive", children: message })
4157
4275
  ] });
4158
4276
  }
4159
4277
 
4160
4278
  // src/video-editor/VideoEditor.tsx
4161
- var import_jsx_runtime22 = require("react/jsx-runtime");
4279
+ var import_jsx_runtime23 = require("react/jsx-runtime");
4162
4280
  function VideoEditor({ controller: given, options, editable = true, pxPerSecond, onPxPerSecondChange, resolution, showIssues = true, showTranscript = true, transcriptMode = "panel", showScopes = false, effects, showEffects, className = "", playback, onPlaybackReveal }) {
4163
4281
  const { controller, state } = useVideoEditor(given ?? options ?? {});
4164
4282
  useEffects(controller, effects);
4165
4283
  const effectsShown = showEffects ?? !!(state.effectsProvider || state.project.tracks.some((t) => t.clips.some((c) => c.type === "effect" || c.type === "adjustment" || c.effects?.length || c.transition?.type === "effect")));
4166
- (0, import_react27.useEffect)(() => {
4284
+ (0, import_react28.useEffect)(() => {
4167
4285
  if (editable) return;
4168
4286
  const was = controller.getState().readOnly;
4169
4287
  controller.setReadOnly(true);
4170
4288
  return () => controller.setReadOnly(was);
4171
4289
  }, [controller, editable]);
4172
4290
  const { issues } = state;
4173
- const issueList = showIssues && issues.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("ul", { className: "space-y-0.5 text-xs", "aria-label": "Video issues", "data-video-issues": "", children: issues.map((issue, i) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("li", { className: issue.severity === "error" ? "text-red-500" : issue.severity === "warning" ? "text-amber-500" : "text-muted-foreground", "data-issue": issue.code, children: issue.message }, i)) });
4174
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: `flex flex-col gap-3 ${className}`, "data-video-editor": "", children: [
4175
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: `grid gap-3 ${editable ? "lg:grid-cols-[16rem_minmax(0,1fr)_18rem]" : ""}`, children: [
4176
- editable && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(MediaBin, { controller, className: "min-w-0" }),
4177
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex min-w-0 flex-col gap-2", children: [
4178
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(VideoPreview, { controller, resolution, className: "rounded-md border border-border" }),
4179
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(VideoTransport, { controller, editable }),
4180
- showScopes && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(VideoScopes, { controller })
4291
+ const issueList = showIssues && issues.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("ul", { className: "space-y-0.5 text-xs", "aria-label": "Video issues", "data-video-issues": "", children: issues.map((issue, i) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("li", { className: issue.severity === "error" ? "text-red-500" : issue.severity === "warning" ? "text-amber-500" : "text-muted-foreground", "data-issue": issue.code, children: issue.message }, i)) });
4292
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: `flex flex-col gap-3 ${className}`, "data-video-editor": "", children: [
4293
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: `grid gap-3 ${editable ? "lg:grid-cols-[16rem_minmax(0,1fr)_18rem]" : ""}`, children: [
4294
+ editable && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(MediaBin, { controller, className: "min-w-0" }),
4295
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex min-w-0 flex-col gap-2", children: [
4296
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(VideoPreview, { controller, resolution, className: "rounded-md border border-border" }),
4297
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(VideoTransport, { controller, editable }),
4298
+ showScopes && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(VideoScopes, { controller })
4181
4299
  ] }),
4182
- editable && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex min-w-0 flex-col gap-3", children: [
4183
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ClipInspector, { controller, className: "min-w-0" }),
4184
- effectsShown && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(VideoEffectsPanel, { controller, className: "min-w-0" })
4300
+ editable && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex min-w-0 flex-col gap-3", children: [
4301
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ClipInspector, { controller, className: "min-w-0" }),
4302
+ effectsShown && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(VideoEffectsPanel, { controller, className: "min-w-0" })
4185
4303
  ] })
4186
4304
  ] }),
4187
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(VideoTimeline, { controller, editable, pxPerSecond, onPxPerSecondChange, playback, onPlaybackReveal }),
4188
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(EditPlanPreview, { controller, editable }),
4189
- showTranscript && (transcriptMode === "editor" ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TranscriptEditor, { controller, editable }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TranscriptPanel, { controller, editable })),
4305
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(VideoTimeline, { controller, editable, pxPerSecond, onPxPerSecondChange, playback, onPlaybackReveal }),
4306
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(EditPlanPreview, { controller, editable }),
4307
+ showTranscript && (transcriptMode === "editor" ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(TranscriptEditor, { controller, editable }) : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(TranscriptPanel, { controller, editable })),
4190
4308
  issueList
4191
4309
  ] });
4192
4310
  }