@pixerate/editor-react 0.114.2 → 0.115.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.
Files changed (42) hide show
  1. package/dist/animation-editor/index.cjs +361 -216
  2. package/dist/animation-editor/index.js +2 -2
  3. package/dist/canvas/index.cjs +539 -394
  4. package/dist/canvas/index.js +2 -2
  5. package/dist/{chunk-2INOKIJN.js → chunk-2KXZLZAS.js} +381 -364
  6. package/dist/{chunk-5LFQ2UQZ.js → chunk-5RPB4WGT.js} +240 -102
  7. package/dist/{chunk-BWEARAWR.js → chunk-6BWTJ3EE.js} +40 -18
  8. package/dist/effects/EffectParameters.d.cts +4 -1
  9. package/dist/effects/EffectParameters.d.ts +4 -1
  10. package/dist/effects/index.cjs +367 -222
  11. package/dist/effects/index.js +2 -2
  12. package/dist/image-editor/ImageEffectControls.d.cts +4 -1
  13. package/dist/image-editor/ImageEffectControls.d.ts +4 -1
  14. package/dist/image-editor/ImageProviderEffectsPanel.d.cts +4 -1
  15. package/dist/image-editor/ImageProviderEffectsPanel.d.ts +4 -1
  16. package/dist/image-editor/controls/controls.d.cts +19 -0
  17. package/dist/image-editor/controls/controls.d.ts +19 -0
  18. package/dist/image-editor/controls/parameterControls.d.cts +4 -0
  19. package/dist/image-editor/controls/parameterControls.d.ts +4 -0
  20. package/dist/image-editor/index.cjs +924 -765
  21. package/dist/image-editor/index.d.cts +1 -1
  22. package/dist/image-editor/index.d.ts +1 -1
  23. package/dist/image-editor/index.js +5 -3
  24. package/dist/index.cjs +1444 -1285
  25. package/dist/index.js +5 -3
  26. package/dist/paint-editor/index.cjs +354 -209
  27. package/dist/paint-editor/index.js +2 -2
  28. package/dist/parameters/ParametersPanel.d.cts +4 -1
  29. package/dist/parameters/ParametersPanel.d.ts +4 -1
  30. package/dist/parameters/controls.d.cts +92 -0
  31. package/dist/parameters/controls.d.ts +92 -0
  32. package/dist/parameters/fields.d.cts +20 -7
  33. package/dist/parameters/fields.d.ts +20 -7
  34. package/dist/parameters/index.cjs +369 -184
  35. package/dist/parameters/index.d.cts +1 -0
  36. package/dist/parameters/index.d.ts +1 -0
  37. package/dist/parameters/index.js +70 -14
  38. package/dist/vector/index.cjs +340 -195
  39. package/dist/vector/index.js +2 -2
  40. package/dist/video-editor/index.cjs +437 -292
  41. package/dist/video-editor/index.js +2 -2
  42. package/package.json +3 -3
@@ -1615,7 +1615,7 @@ function EditPlanPreview({ controller, editable = true, className = "" }) {
1615
1615
  }
1616
1616
 
1617
1617
  // src/video-editor/VideoEditor.tsx
1618
- var import_react25 = require("react");
1618
+ var import_react26 = require("react");
1619
1619
 
1620
1620
  // src/effects/useEffects.ts
1621
1621
  var import_react14 = require("react");
@@ -1754,12 +1754,12 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
1754
1754
  }
1755
1755
 
1756
1756
  // src/effects/EffectParameters.tsx
1757
- var import_react21 = __toESM(require("react"), 1);
1757
+ var import_react22 = __toESM(require("react"), 1);
1758
1758
  var import_effects3 = require("@pixerate/editor/effects");
1759
1759
  var import_parameters2 = require("@pixerate/editor/parameters");
1760
1760
 
1761
1761
  // src/parameters/fields.tsx
1762
- var import_react20 = require("react");
1762
+ var import_react21 = require("react");
1763
1763
  var import_parameters = require("@pixerate/editor/parameters");
1764
1764
 
1765
1765
  // src/color/index.ts
@@ -2801,18 +2801,58 @@ function useResolvedColor(value, scheme) {
2801
2801
  // src/color/index.ts
2802
2802
  __reExport(color_exports, require("@pixerate/editor/color"));
2803
2803
 
2804
- // src/parameters/fields.tsx
2804
+ // src/parameters/controls.tsx
2805
+ var import_react20 = require("react");
2805
2806
  var import_jsx_runtime16 = require("react/jsx-runtime");
2807
+ var ParameterComponentsContext = (0, import_react20.createContext)({});
2808
+ function useParameterComponents() {
2809
+ return (0, import_react20.useContext)(ParameterComponentsContext);
2810
+ }
2811
+ function resolveParameterComponents(explicit, context) {
2812
+ return {
2813
+ input: explicit?.input ?? context?.input,
2814
+ slider: explicit?.slider ?? context?.slider,
2815
+ select: explicit?.select ?? context?.select,
2816
+ color: explicit?.color ?? context?.color
2817
+ };
2818
+ }
2819
+
2820
+ // src/parameters/fields.tsx
2821
+ var import_jsx_runtime17 = require("react/jsx-runtime");
2822
+ var parameterInputStyle = import_parameters.parameterThemeStyles.input;
2823
+ var parameterSelectStyle = import_parameters.parameterThemeStyles.select;
2824
+ var parameterButtonStyle = import_parameters.parameterThemeStyles.button;
2825
+ var parameterRangeStyle = import_parameters.parameterThemeStyles.range;
2806
2826
  var parameterInputClass = "h-7 w-full min-w-0 rounded-md border border-input bg-background px-2 text-xs text-foreground tabular-nums focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary disabled:cursor-not-allowed disabled:opacity-50";
2807
2827
  var parameterButtonClass = "inline-flex h-7 items-center justify-center gap-1 rounded-md border border-input bg-background px-2 text-xs text-foreground hover:bg-muted focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary disabled:pointer-events-none disabled:opacity-50";
2808
2828
  var rangeClass = "h-4 w-full min-w-0 flex-1 cursor-pointer accent-primary disabled:cursor-not-allowed disabled:opacity-50";
2809
- function ParameterCommitInput({ value, onCommit, multiline, className, onKeyDown, ...rest }) {
2829
+ function ParameterCommitInput({ value, onCommit, multiline, className, onKeyDown, style, ...rest }) {
2830
+ const inputRef = (0, import_react21.useRef)(null);
2831
+ const lastCommitted = (0, import_react21.useRef)(null);
2832
+ (0, import_react21.useLayoutEffect)(() => {
2833
+ lastCommitted.current = null;
2834
+ const el = inputRef.current;
2835
+ if (el && el.value !== value) el.value = value;
2836
+ }, [value]);
2810
2837
  const commit = (el) => {
2811
- if (el.value !== value) onCommit(el.value, el);
2838
+ const text = el.value;
2839
+ if (text === value || text === lastCommitted.current) return;
2840
+ onCommit(text, el);
2841
+ lastCommitted.current = el.value === text ? text : null;
2812
2842
  };
2843
+ const commitRef = (0, import_react21.useRef)(commit);
2844
+ commitRef.current = commit;
2845
+ (0, import_react21.useEffect)(() => {
2846
+ const el = inputRef.current;
2847
+ if (!el) return;
2848
+ const change = () => commitRef.current(el);
2849
+ el.addEventListener("change", change);
2850
+ return () => el.removeEventListener("change", change);
2851
+ }, [multiline]);
2813
2852
  const keyDown = (e) => {
2814
2853
  onKeyDown?.(e);
2815
2854
  if (e.defaultPrevented) return;
2855
+ if (e.key === "Tab") commit(e.currentTarget);
2816
2856
  if (e.key === "Enter" && (!multiline || e.metaKey || e.ctrlKey)) {
2817
2857
  e.preventDefault();
2818
2858
  commit(e.currentTarget);
@@ -2822,86 +2862,114 @@ function ParameterCommitInput({ value, onCommit, multiline, className, onKeyDown
2822
2862
  const props = {
2823
2863
  defaultValue: value,
2824
2864
  className: className ?? parameterInputClass,
2865
+ style: { ...parameterInputStyle, ...style },
2825
2866
  onBlur: (e) => commit(e.currentTarget),
2826
2867
  onKeyDown: keyDown,
2827
2868
  ...rest
2828
2869
  };
2829
- return multiline ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("textarea", { ...props, className: `${props.className} h-auto min-h-[3.5rem] py-1` }, value) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("input", { type: "text", ...props }, value);
2870
+ const forwarded = rest.ref;
2871
+ const setRef = (el) => {
2872
+ inputRef.current = el;
2873
+ if (typeof forwarded === "function") forwarded(el);
2874
+ else if (forwarded) forwarded.current = el;
2875
+ };
2876
+ return multiline ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("textarea", { ...props, ref: setRef, className: `${props.className} h-auto min-h-[3.5rem] py-1` }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("input", { type: "text", ...props, ref: setRef });
2830
2877
  }
2831
2878
  var plainNumber = (field2, value) => (0, import_parameters.formatParameterNumber)({ ...field2, unit: void 0 }, value);
2832
- function ParameterNumberInput({
2833
- field: field2,
2834
- value,
2835
- onChange,
2836
- disabled,
2837
- id,
2838
- "aria-label": ariaLabel
2839
- }) {
2840
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "relative min-w-0 flex-1", children: [
2841
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2842
- ParameterCommitInput,
2843
- {
2844
- id,
2845
- inputMode: "decimal",
2846
- "aria-label": ariaLabel ?? (0, import_parameters.parameterLabel)(field2),
2847
- value: plainNumber(field2, value),
2848
- disabled: disabled || field2.readOnly,
2849
- className: `${parameterInputClass} ${field2.unit ? "pr-6" : ""}`,
2850
- onCommit: (text, input) => {
2851
- const n = (0, import_parameters.parseParameterNumberInput)(field2, text);
2852
- if (n === null || n === value) input.value = plainNumber(field2, value);
2853
- else onChange(n);
2854
- },
2855
- onKeyDown: (e) => {
2856
- if (e.key !== "ArrowUp" && e.key !== "ArrowDown") return;
2857
- e.preventDefault();
2858
- const step = (0, import_parameters.parameterStep)(field2) * (e.shiftKey ? 10 : 1);
2859
- onChange((0, import_parameters.clampParameterNumber)(field2, value + (e.key === "ArrowUp" ? step : -step)));
2860
- }
2861
- }
2862
- ),
2863
- field2.unit && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "pointer-events-none absolute right-2 top-1/2 -translate-y-1/2 text-[10px] text-muted-foreground", children: field2.unit })
2879
+ function ParameterNumberInput(props) {
2880
+ const { field: field2, value, onChange, disabled, id, components, "aria-label": ariaLabel } = props;
2881
+ const ctx = useParameterComponents();
2882
+ const resolved = resolveParameterComponents(components, ctx);
2883
+ const CustomInput = resolved.input;
2884
+ const plain = plainNumber(field2, value);
2885
+ const handleCommit = (text, input) => {
2886
+ const n = (0, import_parameters.parseParameterNumberInput)(field2, text);
2887
+ if (n === null || n === value) {
2888
+ if (input) input.value = plain;
2889
+ } else {
2890
+ onChange(n);
2891
+ }
2892
+ };
2893
+ const handleKeyDown = (e) => {
2894
+ if (e.key !== "ArrowUp" && e.key !== "ArrowDown") return;
2895
+ e.preventDefault();
2896
+ const step = (0, import_parameters.parameterStep)(field2) * (e.shiftKey ? 10 : 1);
2897
+ onChange((0, import_parameters.clampParameterNumber)(field2, value + (e.key === "ArrowUp" ? step : -step)));
2898
+ };
2899
+ const inputProps = {
2900
+ id,
2901
+ inputMode: "decimal",
2902
+ "aria-label": ariaLabel ?? (0, import_parameters.parameterLabel)(field2),
2903
+ value: plain,
2904
+ disabled: disabled || field2.readOnly,
2905
+ className: `${parameterInputClass} ${field2.unit ? "pr-6" : ""}`,
2906
+ style: parameterInputStyle,
2907
+ onCommit: handleCommit,
2908
+ onKeyDown: handleKeyDown
2909
+ };
2910
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "relative min-w-0 flex-1", children: [
2911
+ CustomInput ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(CustomInput, { ...inputProps, label: (0, import_parameters.parameterLabel)(field2) }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ParameterCommitInput, { ...inputProps }),
2912
+ field2.unit && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "pointer-events-none absolute right-2 top-1/2 -translate-y-1/2 text-[10px] text-muted-foreground", children: field2.unit })
2864
2913
  ] });
2865
2914
  }
2866
2915
  function ParameterSlider(props) {
2867
- const { field: field2, value, onChange, onGestureStart, onGestureEnd, disabled } = props;
2868
- const dragging = (0, import_react20.useRef)(false);
2916
+ const { field: field2, value, onChange, onGestureStart, onGestureEnd, disabled, components } = props;
2917
+ const ctx = useParameterComponents();
2918
+ const resolved = resolveParameterComponents(components, ctx);
2919
+ const CustomSlider = resolved.slider;
2920
+ const dragging = (0, import_react21.useRef)(false);
2921
+ const start = () => {
2922
+ if (dragging.current) return;
2923
+ dragging.current = true;
2924
+ onGestureStart?.();
2925
+ };
2869
2926
  const end = () => {
2870
2927
  if (!dragging.current) return;
2871
2928
  dragging.current = false;
2872
2929
  onGestureEnd?.();
2873
2930
  };
2874
- if (!(0, import_parameters.isSliderField)(field2)) return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ParameterNumberInput, { ...props });
2931
+ if (!(0, import_parameters.isSliderField)(field2)) return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ParameterNumberInput, { ...props });
2875
2932
  const step = (0, import_parameters.parameterStep)(field2);
2876
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex items-center gap-2", children: [
2877
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2933
+ const sliderProps = {
2934
+ "aria-label": (0, import_parameters.parameterLabel)(field2),
2935
+ "aria-valuetext": (0, import_parameters.formatParameterNumber)(field2, value),
2936
+ // A `control: 'slider'` field may leave out a bound: the range input's own defaults.
2937
+ min: field2.min ?? 0,
2938
+ max: field2.max ?? 100,
2939
+ step,
2940
+ value,
2941
+ disabled: disabled || field2.readOnly,
2942
+ className: rangeClass,
2943
+ style: parameterRangeStyle
2944
+ };
2945
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex items-center gap-2", children: [
2946
+ CustomSlider ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2947
+ CustomSlider,
2948
+ {
2949
+ ...sliderProps,
2950
+ id: props.id ? `${props.id}-slider` : void 0,
2951
+ label: (0, import_parameters.parameterLabel)(field2),
2952
+ onChange: (v) => onChange((0, import_parameters.clampParameterNumber)(field2, v)),
2953
+ onGestureStart: start,
2954
+ onGestureEnd: end
2955
+ }
2956
+ ) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2878
2957
  "input",
2879
2958
  {
2880
2959
  type: "range",
2881
- "aria-label": (0, import_parameters.parameterLabel)(field2),
2882
- "aria-valuetext": (0, import_parameters.formatParameterNumber)(field2, value),
2883
- min: field2.min,
2884
- max: field2.max,
2885
- step,
2886
- value,
2887
- disabled: disabled || field2.readOnly,
2888
- className: rangeClass,
2889
- onPointerDown: () => {
2890
- if (dragging.current) return;
2891
- dragging.current = true;
2892
- onGestureStart?.();
2893
- },
2960
+ ...sliderProps,
2961
+ onPointerDown: start,
2894
2962
  onPointerUp: end,
2895
2963
  onPointerCancel: end,
2896
2964
  onBlur: end,
2897
2965
  onChange: (e) => onChange((0, import_parameters.clampParameterNumber)(field2, Number(e.target.value)))
2898
2966
  }
2899
2967
  ),
2900
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "w-20 shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ParameterNumberInput, { ...props, id: props.id, "aria-label": `${(0, import_parameters.parameterLabel)(field2)} value` }) })
2968
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "w-20 shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ParameterNumberInput, { ...props, id: props.id, "aria-label": `${(0, import_parameters.parameterLabel)(field2)} value` }) })
2901
2969
  ] });
2902
2970
  }
2903
2971
  function ParameterToggle({ field: field2, value, onChange, disabled, id }) {
2904
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2972
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2905
2973
  "button",
2906
2974
  {
2907
2975
  type: "button",
@@ -2912,7 +2980,7 @@ function ParameterToggle({ field: field2, value, onChange, disabled, id }) {
2912
2980
  disabled: disabled || field2.readOnly,
2913
2981
  onClick: () => onChange(!value),
2914
2982
  className: `relative inline-flex h-5 w-9 shrink-0 items-center rounded-full border border-transparent transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary disabled:opacity-50 ${value ? "bg-primary" : "bg-muted"}`,
2915
- children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2983
+ children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2916
2984
  "span",
2917
2985
  {
2918
2986
  className: `pointer-events-none block h-4 w-4 rounded-full bg-background shadow transition-transform ${value ? "translate-x-4" : "translate-x-0.5"}`
@@ -2921,11 +2989,15 @@ function ParameterToggle({ field: field2, value, onChange, disabled, id }) {
2921
2989
  }
2922
2990
  );
2923
2991
  }
2924
- function ParameterSelect({ field: field2, value, onChange, disabled, id }) {
2992
+ function ParameterSelect(props) {
2993
+ const { field: field2, value, onChange, disabled, id, components } = props;
2994
+ const ctx = useParameterComponents();
2995
+ const resolved = resolveParameterComponents(components, ctx);
2996
+ const CustomSelect = resolved.select;
2925
2997
  const options = (0, import_parameters.getChoiceOptions)(field2);
2926
2998
  const off = disabled || field2.readOnly;
2927
2999
  if (field2.control === "segmented") {
2928
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { role: "radiogroup", "aria-label": (0, import_parameters.parameterLabel)(field2), className: "inline-flex flex-wrap rounded-md border border-input bg-muted p-0.5", children: options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3000
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { role: "radiogroup", "aria-label": (0, import_parameters.parameterLabel)(field2), className: "inline-flex flex-wrap rounded-md border border-input bg-muted p-0.5", children: options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2929
3001
  "button",
2930
3002
  {
2931
3003
  type: "button",
@@ -2940,8 +3012,25 @@ function ParameterSelect({ field: field2, value, onChange, disabled, id }) {
2940
3012
  String(o.value)
2941
3013
  )) });
2942
3014
  }
3015
+ if (CustomSelect) {
3016
+ const customOptions = options.map((o) => ({ value: o.value, label: (0, import_parameters.choiceOptionLabel)(o), description: o.description }));
3017
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3018
+ CustomSelect,
3019
+ {
3020
+ id,
3021
+ label: (0, import_parameters.parameterLabel)(field2),
3022
+ "aria-label": (0, import_parameters.parameterLabel)(field2),
3023
+ value,
3024
+ options: customOptions,
3025
+ disabled: off,
3026
+ className: parameterInputClass,
3027
+ style: parameterSelectStyle,
3028
+ onChange: (v) => onChange((0, import_parameters.matchParameterOptionValue)(options, v))
3029
+ }
3030
+ );
3031
+ }
2943
3032
  const index = options.findIndex((o) => o.value === value);
2944
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3033
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2945
3034
  "select",
2946
3035
  {
2947
3036
  id,
@@ -2953,22 +3042,24 @@ function ParameterSelect({ field: field2, value, onChange, disabled, id }) {
2953
3042
  if (option) onChange(option.value);
2954
3043
  },
2955
3044
  className: parameterInputClass,
2956
- children: options.map((o, i) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: String(i), title: o.description, children: (0, import_parameters.choiceOptionLabel)(o) }, String(o.value)))
3045
+ style: parameterSelectStyle,
3046
+ children: options.map((o, i) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("option", { value: String(i), title: o.description, style: parameterSelectStyle, children: (0, import_parameters.choiceOptionLabel)(o) }, String(o.value)))
2957
3047
  }
2958
3048
  );
2959
3049
  }
2960
- function ParameterColor({ field: field2, value, onChange, onGestureStart, onGestureEnd, disabled, id }) {
2961
- const [open, setOpen] = (0, import_react20.useState)(false);
2962
- const containerRef = (0, import_react20.useRef)(null);
2963
- const buttonRef = (0, import_react20.useRef)(null);
2964
- const popoverRef = (0, import_react20.useRef)(null);
3050
+ function ParameterColor({ field: field2, value, onChange, onGestureStart, onGestureEnd, disabled, id, components }) {
3051
+ const CustomColor = resolveParameterComponents(components, useParameterComponents()).color;
3052
+ const [open, setOpen] = (0, import_react21.useState)(false);
3053
+ const containerRef = (0, import_react21.useRef)(null);
3054
+ const buttonRef = (0, import_react21.useRef)(null);
3055
+ const popoverRef = (0, import_react21.useRef)(null);
2965
3056
  const alpha = !!field2.alpha;
2966
3057
  const hex = (0, import_parameters.normalizeHexColor)(value, true) ?? "#000000ff";
2967
3058
  const rgb = hex.slice(0, 7);
2968
3059
  const shown = alpha ? hex : rgb;
2969
3060
  const off = disabled || field2.readOnly;
2970
3061
  const name = (0, import_parameters.parameterLabel)(field2);
2971
- (0, import_react20.useEffect)(() => {
3062
+ (0, import_react21.useEffect)(() => {
2972
3063
  if (!open) return;
2973
3064
  const onPointerDown = (e) => {
2974
3065
  if (containerRef.current && !containerRef.current.contains(e.target)) {
@@ -2989,9 +3080,25 @@ function ParameterColor({ field: field2, value, onChange, onGestureStart, onGest
2989
3080
  window.removeEventListener("keydown", onKeyDown, true);
2990
3081
  };
2991
3082
  }, [open]);
2992
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { ref: containerRef, className: "relative space-y-1.5", children: [
2993
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex items-center gap-2", children: [
2994
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3083
+ if (CustomColor) {
3084
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3085
+ CustomColor,
3086
+ {
3087
+ id,
3088
+ value: shown,
3089
+ alpha,
3090
+ swatches: field2.swatches,
3091
+ disabled: off,
3092
+ label: name,
3093
+ onChange,
3094
+ onGestureStart,
3095
+ onGestureEnd
3096
+ }
3097
+ );
3098
+ }
3099
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { ref: containerRef, className: "relative space-y-1.5", children: [
3100
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex items-center gap-2", children: [
3101
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2995
3102
  "button",
2996
3103
  {
2997
3104
  ref: buttonRef,
@@ -3002,10 +3109,10 @@ function ParameterColor({ field: field2, value, onChange, onGestureStart, onGest
3002
3109
  disabled: off,
3003
3110
  onClick: () => setOpen((prev) => !prev),
3004
3111
  className: "relative h-7 w-9 shrink-0 overflow-hidden rounded-md border border-input bg-[repeating-conic-gradient(#d4d4d8_0_25%,#fff_0_50%)] bg-[length:8px_8px] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary disabled:cursor-not-allowed disabled:opacity-50",
3005
- children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "absolute inset-0", style: { background: shown } })
3112
+ children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "absolute inset-0", style: { background: shown } })
3006
3113
  }
3007
3114
  ),
3008
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3115
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3009
3116
  ParameterCommitInput,
3010
3117
  {
3011
3118
  id,
@@ -3021,7 +3128,7 @@ function ParameterColor({ field: field2, value, onChange, onGestureStart, onGest
3021
3128
  }
3022
3129
  )
3023
3130
  ] }),
3024
- open && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3131
+ open && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3025
3132
  "div",
3026
3133
  {
3027
3134
  ref: popoverRef,
@@ -3035,7 +3142,7 @@ function ParameterColor({ field: field2, value, onChange, onGestureStart, onGest
3035
3142
  },
3036
3143
  className: "absolute left-0 top-full z-50 mt-1 w-64 rounded-lg border border-border bg-popover p-2 text-popover-foreground shadow-xl",
3037
3144
  style: { background: "var(--popover, var(--background, #fff))" },
3038
- children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3145
+ children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3039
3146
  ColorPicker,
3040
3147
  {
3041
3148
  value: shown,
@@ -3051,13 +3158,13 @@ function ParameterColor({ field: field2, value, onChange, onGestureStart, onGest
3051
3158
  )
3052
3159
  ] });
3053
3160
  }
3054
- function ParameterVector({ field: field2, value, onChange, disabled, id }) {
3161
+ function ParameterVector({ field: field2, value, onChange, disabled, id, components }) {
3055
3162
  const size = (0, import_parameters.vectorSize)(field2);
3056
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "grid gap-1.5", style: { gridTemplateColumns: `repeat(${size}, minmax(0, 1fr))` }, children: Array.from({ length: size }, (_, i) => {
3163
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "grid gap-1.5", style: { gridTemplateColumns: `repeat(${size}, minmax(0, 1fr))` }, children: Array.from({ length: size }, (_, i) => {
3057
3164
  const component = (0, import_parameters.vectorComponentField)(field2, i);
3058
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: "flex min-w-0 items-center gap-1", children: [
3059
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "w-3 shrink-0 text-[10px] uppercase text-muted-foreground", children: component.label }),
3060
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3165
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("label", { className: "flex min-w-0 items-center gap-1", children: [
3166
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "w-3 shrink-0 text-[10px] uppercase text-muted-foreground", children: component.label }),
3167
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3061
3168
  ParameterNumberInput,
3062
3169
  {
3063
3170
  field: component,
@@ -3065,6 +3172,7 @@ function ParameterVector({ field: field2, value, onChange, disabled, id }) {
3065
3172
  id: i === 0 ? id : void 0,
3066
3173
  "aria-label": `${(0, import_parameters.parameterLabel)(field2)} ${component.label}`,
3067
3174
  disabled: disabled || field2.readOnly,
3175
+ components,
3068
3176
  onChange: (n) => onChange(Array.from({ length: size }, (_2, j) => j === i ? n : value[j] ?? 0))
3069
3177
  }
3070
3178
  )
@@ -3074,11 +3182,11 @@ function ParameterVector({ field: field2, value, onChange, disabled, id }) {
3074
3182
  function ParameterImage({ field: field2, value, onChange, disabled, id, resolveFile }) {
3075
3183
  const off = disabled || field2.readOnly;
3076
3184
  const name = (0, import_parameters.parameterLabel)(field2);
3077
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "space-y-1.5", children: [
3078
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex items-center gap-2", children: [
3079
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "flex h-12 w-16 shrink-0 items-center justify-center overflow-hidden rounded-md border border-input bg-muted", children: value ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("img", { src: value, alt: name, className: "h-full w-full object-cover" }) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "None" }) }),
3080
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
3081
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3185
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "space-y-1.5", children: [
3186
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex items-center gap-2", children: [
3187
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "flex h-12 w-16 shrink-0 items-center justify-center overflow-hidden rounded-md border border-input bg-muted", children: value ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("img", { src: value, alt: name, className: "h-full w-full object-cover" }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "None" }) }),
3188
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
3189
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3082
3190
  ParameterCommitInput,
3083
3191
  {
3084
3192
  id,
@@ -3089,30 +3197,48 @@ function ParameterImage({ field: field2, value, onChange, disabled, id, resolveF
3089
3197
  onCommit: (text) => onChange(text.trim())
3090
3198
  }
3091
3199
  ),
3092
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex gap-1", children: [
3093
- resolveFile && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: `${parameterButtonClass} cursor-pointer ${off ? "pointer-events-none opacity-50" : ""}`, children: [
3094
- "Choose file\u2026",
3095
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3096
- "input",
3097
- {
3098
- type: "file",
3099
- className: "sr-only",
3100
- accept: field2.accept ?? "image/*",
3101
- disabled: off,
3102
- "aria-label": `${name} file`,
3103
- onChange: async (e) => {
3104
- const file = e.target.files?.[0];
3105
- e.target.value = "";
3106
- if (file) onChange(await resolveFile(file));
3107
- }
3108
- }
3109
- )
3110
- ] }),
3111
- value && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", className: parameterButtonClass, disabled: off, onClick: () => onChange(""), "aria-label": `Clear ${name}`, children: "Clear" })
3200
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex gap-1", children: [
3201
+ resolveFile && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
3202
+ "label",
3203
+ {
3204
+ style: parameterButtonStyle,
3205
+ className: `${parameterButtonClass} cursor-pointer ${off ? "pointer-events-none opacity-50" : ""}`,
3206
+ children: [
3207
+ "Choose file\u2026",
3208
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3209
+ "input",
3210
+ {
3211
+ type: "file",
3212
+ className: "sr-only",
3213
+ accept: field2.accept ?? "image/*",
3214
+ disabled: off,
3215
+ "aria-label": `${name} file`,
3216
+ onChange: async (e) => {
3217
+ const file = e.target.files?.[0];
3218
+ e.target.value = "";
3219
+ if (file) onChange(await resolveFile(file));
3220
+ }
3221
+ }
3222
+ )
3223
+ ]
3224
+ }
3225
+ ),
3226
+ value && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3227
+ "button",
3228
+ {
3229
+ type: "button",
3230
+ style: parameterButtonStyle,
3231
+ className: parameterButtonClass,
3232
+ disabled: off,
3233
+ onClick: () => onChange(""),
3234
+ "aria-label": `Clear ${name}`,
3235
+ children: "Clear"
3236
+ }
3237
+ )
3112
3238
  ] })
3113
3239
  ] })
3114
3240
  ] }),
3115
- field2.options && field2.options.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "flex flex-wrap gap-1", children: field2.options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3241
+ field2.options && field2.options.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "flex flex-wrap gap-1", children: field2.options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3116
3242
  "button",
3117
3243
  {
3118
3244
  type: "button",
@@ -3122,14 +3248,14 @@ function ParameterImage({ field: field2, value, onChange, disabled, id, resolveF
3122
3248
  disabled: off,
3123
3249
  onClick: () => onChange(o.url),
3124
3250
  className: "h-9 w-12 overflow-hidden rounded border border-input aria-pressed:ring-2 aria-pressed:ring-primary",
3125
- children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("img", { src: o.url, alt: "", className: "h-full w-full object-cover" })
3251
+ children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("img", { src: o.url, alt: "", className: "h-full w-full object-cover" })
3126
3252
  },
3127
3253
  o.url
3128
3254
  )) })
3129
3255
  ] });
3130
3256
  }
3131
3257
  function ParameterText({ field: field2, value, onChange, disabled, id }) {
3132
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3258
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3133
3259
  ParameterCommitInput,
3134
3260
  {
3135
3261
  id,
@@ -3148,24 +3274,24 @@ function ParameterFieldControl({ field: field2, value, onChange, resolveFile, ..
3148
3274
  switch (field2.type) {
3149
3275
  case "number":
3150
3276
  case "int":
3151
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ParameterSlider, { field: field2, value, onChange: set, ...rest });
3277
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ParameterSlider, { field: field2, value, onChange: set, ...rest });
3152
3278
  case "boolean":
3153
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ParameterToggle, { field: field2, value, onChange: set, ...rest });
3279
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ParameterToggle, { field: field2, value, onChange: set, ...rest });
3154
3280
  case "choice":
3155
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ParameterSelect, { field: field2, value, onChange: set, ...rest });
3281
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ParameterSelect, { field: field2, value, onChange: set, ...rest });
3156
3282
  case "color":
3157
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ParameterColor, { field: field2, value, onChange: set, ...rest });
3283
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ParameterColor, { field: field2, value, onChange: set, ...rest });
3158
3284
  case "vector":
3159
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ParameterVector, { field: field2, value, onChange: set, ...rest });
3285
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ParameterVector, { field: field2, value, onChange: set, ...rest });
3160
3286
  case "image":
3161
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ParameterImage, { field: field2, value, onChange: set, resolveFile, ...rest });
3287
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ParameterImage, { field: field2, value, onChange: set, resolveFile, ...rest });
3162
3288
  case "text":
3163
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ParameterText, { field: field2, value, onChange: set, ...rest });
3289
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ParameterText, { field: field2, value, onChange: set, ...rest });
3164
3290
  }
3165
3291
  }
3166
3292
 
3167
3293
  // src/effects/EffectParameters.tsx
3168
- var import_jsx_runtime17 = require("react/jsx-runtime");
3294
+ var import_jsx_runtime18 = require("react/jsx-runtime");
3169
3295
  function EffectParameters({
3170
3296
  description,
3171
3297
  values,
@@ -3177,56 +3303,75 @@ function EffectParameters({
3177
3303
  renderControlAddon,
3178
3304
  fonts,
3179
3305
  disabled = false,
3180
- className = ""
3306
+ className = "",
3307
+ components
3181
3308
  }) {
3182
- const fields = (0, import_react21.useMemo)(() => (0, import_effects3.effectParameterFields)(description, { fonts }), [description, fonts]);
3183
- const idBase = (0, import_react21.useId)();
3184
- const gesture = import_react21.default.useRef(null);
3185
- const count = import_react21.default.useRef(0);
3186
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: `space-y-2 ${className}`, "data-effect-parameters": description.id, children: [
3187
- (onPreset || onPresetName) && description.presets.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
3309
+ const fields = (0, import_react22.useMemo)(() => (0, import_effects3.effectParameterFields)(description, { fonts }), [description, fonts]);
3310
+ const idBase = (0, import_react22.useId)();
3311
+ const gesture = import_react22.default.useRef(null);
3312
+ const count = import_react22.default.useRef(0);
3313
+ const CustomPresetSelect = resolveParameterComponents(components, useParameterComponents()).select;
3314
+ const handlePresetSelect = (name) => {
3315
+ if (!name) return;
3316
+ if (onPresetName) {
3317
+ onPresetName(name);
3318
+ } else if (onPreset) {
3319
+ const preset = description.presets.find((p) => p.name === name);
3320
+ if (preset) onPreset({ ...description.defaults, ...preset.values });
3321
+ }
3322
+ };
3323
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: `space-y-2 ${className}`, "data-effect-parameters": description.id, children: [
3324
+ (onPreset || onPresetName) && description.presets.length > 0 && (CustomPresetSelect ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3325
+ CustomPresetSelect,
3326
+ {
3327
+ "aria-label": `${description.name} presets`,
3328
+ label: `${description.name} presets`,
3329
+ value: "",
3330
+ disabled,
3331
+ className: "w-full rounded border border-border px-1 py-0.5 text-xs",
3332
+ style: parameterSelectStyle,
3333
+ options: [
3334
+ { value: "", label: "Presets\u2026" },
3335
+ ...description.presets.map((p) => ({ value: p.name, label: p.name }))
3336
+ ],
3337
+ onChange: (name) => handlePresetSelect(String(name))
3338
+ }
3339
+ ) : /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
3188
3340
  "select",
3189
3341
  {
3190
- className: "w-full rounded border border-border bg-transparent px-1 py-0.5 text-xs",
3342
+ className: "w-full rounded border border-border px-1 py-0.5 text-xs",
3343
+ style: parameterSelectStyle,
3191
3344
  "aria-label": `${description.name} presets`,
3192
3345
  value: "",
3193
3346
  disabled,
3194
- onChange: (e) => {
3195
- const name = e.currentTarget.value;
3196
- if (!name) return;
3197
- if (onPresetName) {
3198
- onPresetName(name);
3199
- } else if (onPreset) {
3200
- const preset = description.presets.find((p) => p.name === name);
3201
- if (preset) onPreset({ ...description.defaults, ...preset.values });
3202
- }
3203
- },
3347
+ onChange: (e) => handlePresetSelect(e.currentTarget.value),
3204
3348
  children: [
3205
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("option", { value: "", children: "Presets\u2026" }),
3206
- description.presets.map((p) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("option", { value: p.name, children: p.name }, p.name))
3349
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("option", { value: "", style: parameterSelectStyle, children: "Presets\u2026" }),
3350
+ description.presets.map((p) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("option", { value: p.name, style: parameterSelectStyle, children: p.name }, p.name))
3207
3351
  ]
3208
3352
  }
3209
- ),
3353
+ )),
3210
3354
  fields.map((field2) => {
3211
3355
  const label = (0, import_parameters2.parameterLabel)(field2);
3212
3356
  const inputId = `${idBase}-${field2.id}`;
3213
3357
  const keyed = keyframed?.has(field2.id) ?? false;
3214
3358
  const value = (0, import_effects3.effectFieldValue)(field2, values[field2.id]);
3215
3359
  const changed = !keyed && !(0, import_parameters2.parameterValuesEqual)(value, field2.default);
3216
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "space-y-1", "data-effect-control": field2.id, children: [
3217
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex items-center gap-1.5", children: [
3218
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("label", { htmlFor: inputId, className: "min-w-0 flex-1 truncate text-xs font-medium", title: field2.description, children: label }),
3219
- keyed && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "keyframed" }),
3360
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "space-y-1", "data-effect-control": field2.id, children: [
3361
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center gap-1.5", children: [
3362
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("label", { htmlFor: inputId, className: "min-w-0 flex-1 truncate text-xs font-medium", title: field2.description, children: label }),
3363
+ keyed && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "keyframed" }),
3220
3364
  renderControlAddon?.(field2.id),
3221
- onReset && changed && !disabled && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: "rounded px-1 text-[11px] text-muted-foreground hover:text-foreground", "aria-label": `Reset ${label}`, onClick: () => onReset(field2.id), children: "\u21BA" })
3365
+ onReset && changed && !disabled && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: "rounded px-1 text-[11px] text-muted-foreground hover:text-foreground", "aria-label": `Reset ${label}`, onClick: () => onReset(field2.id), children: "\u21BA" })
3222
3366
  ] }),
3223
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3367
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3224
3368
  ParameterFieldControl,
3225
3369
  {
3226
3370
  field: field2,
3227
3371
  value,
3228
3372
  id: inputId,
3229
3373
  disabled: disabled || keyed,
3374
+ components,
3230
3375
  onChange: (v) => onChange(field2.id, v, gesture.current),
3231
3376
  onGestureStart: () => gesture.current = `${idBase}:${field2.id}:${++count.current}`,
3232
3377
  onGestureEnd: () => gesture.current = null
@@ -3234,14 +3379,14 @@ function EffectParameters({
3234
3379
  )
3235
3380
  ] }, field2.id);
3236
3381
  }),
3237
- !fields.length && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No controls." })
3382
+ !fields.length && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No controls." })
3238
3383
  ] });
3239
3384
  }
3240
3385
 
3241
3386
  // src/effects/useEffectAuthoring.ts
3242
- var import_react22 = require("react");
3387
+ var import_react23 = require("react");
3243
3388
  function useEffectAuthoring(session) {
3244
- return (0, import_react22.useSyncExternalStore)(
3389
+ return (0, import_react23.useSyncExternalStore)(
3245
3390
  (callback) => {
3246
3391
  if (!session) return () => {
3247
3392
  };
@@ -3253,9 +3398,9 @@ function useEffectAuthoring(session) {
3253
3398
  }
3254
3399
 
3255
3400
  // src/effects/EffectAuthoringEditor.tsx
3256
- var import_react23 = require("react");
3401
+ var import_react24 = require("react");
3257
3402
  var import_effects4 = require("@pixerate/editor/effects");
3258
- var import_jsx_runtime18 = require("react/jsx-runtime");
3403
+ var import_jsx_runtime19 = require("react/jsx-runtime");
3259
3404
  function EffectAuthoringEditor({
3260
3405
  session,
3261
3406
  showSource = true,
@@ -3264,21 +3409,21 @@ function EffectAuthoringEditor({
3264
3409
  className = ""
3265
3410
  }) {
3266
3411
  const state = useEffectAuthoring(session);
3267
- const canvasRef = (0, import_react23.useRef)(null);
3268
- const rendererRef = (0, import_react23.useRef)(null);
3269
- const [rendererReady, setRendererReady] = (0, import_react23.useState)(0);
3270
- const renderingRef = (0, import_react23.useRef)(false);
3271
- const pendingRef = (0, import_react23.useRef)(false);
3272
- const timeRef = (0, import_react23.useRef)(0);
3273
- const inputsRef = (0, import_react23.useRef)({});
3274
- const [previewError, setPreviewError] = (0, import_react23.useState)(null);
3275
- const [savingPreset, setSavingPreset] = (0, import_react23.useState)(false);
3276
- const [presetName, setPresetName] = (0, import_react23.useState)("");
3277
- const textareaRef = (0, import_react23.useRef)(null);
3278
- const gutterRef = (0, import_react23.useRef)(null);
3279
- const [sourceCode, setSourceCode] = (0, import_react23.useState)("");
3280
- const sourceDebounceRef = (0, import_react23.useRef)(null);
3281
- (0, import_react23.useEffect)(() => {
3412
+ const canvasRef = (0, import_react24.useRef)(null);
3413
+ const rendererRef = (0, import_react24.useRef)(null);
3414
+ const [rendererReady, setRendererReady] = (0, import_react24.useState)(0);
3415
+ const renderingRef = (0, import_react24.useRef)(false);
3416
+ const pendingRef = (0, import_react24.useRef)(false);
3417
+ const timeRef = (0, import_react24.useRef)(0);
3418
+ const inputsRef = (0, import_react24.useRef)({});
3419
+ const [previewError, setPreviewError] = (0, import_react24.useState)(null);
3420
+ const [savingPreset, setSavingPreset] = (0, import_react24.useState)(false);
3421
+ const [presetName, setPresetName] = (0, import_react24.useState)("");
3422
+ const textareaRef = (0, import_react24.useRef)(null);
3423
+ const gutterRef = (0, import_react24.useRef)(null);
3424
+ const [sourceCode, setSourceCode] = (0, import_react24.useState)("");
3425
+ const sourceDebounceRef = (0, import_react24.useRef)(null);
3426
+ (0, import_react24.useEffect)(() => {
3282
3427
  const canvas = canvasRef.current;
3283
3428
  canvas?.getContext("2d")?.clearRect(0, 0, canvas.width, canvas.height);
3284
3429
  setPreviewError(null);
@@ -3312,7 +3457,7 @@ function EffectAuthoringEditor({
3312
3457
  }
3313
3458
  };
3314
3459
  }, [session, previewSize.width, previewSize.height]);
3315
- const pump = (0, import_react23.useCallback)(async () => {
3460
+ const pump = (0, import_react24.useCallback)(async () => {
3316
3461
  if (renderingRef.current) {
3317
3462
  pendingRef.current = true;
3318
3463
  return;
@@ -3343,26 +3488,26 @@ function EffectAuthoringEditor({
3343
3488
  }
3344
3489
  }, []);
3345
3490
  const inputSpecs = state?.description.inputs;
3346
- (0, import_react23.useEffect)(() => {
3491
+ (0, import_react24.useEffect)(() => {
3347
3492
  inputsRef.current = inputSpecs ? (0, import_effects4.effectSampleInputs)({ inputs: inputSpecs }, previewSize) : {};
3348
3493
  }, [inputSpecs, previewSize.width, previewSize.height]);
3349
- (0, import_react23.useEffect)(() => {
3494
+ (0, import_react24.useEffect)(() => {
3350
3495
  if (!state) return;
3351
3496
  timeRef.current = state.time;
3352
3497
  void pump();
3353
3498
  }, [state, rendererReady, pump]);
3354
- (0, import_react23.useEffect)(() => {
3499
+ (0, import_react24.useEffect)(() => {
3355
3500
  if (state?.source !== null && state?.source !== void 0) {
3356
3501
  setSourceCode(state.source);
3357
3502
  }
3358
3503
  }, [state?.source]);
3359
- (0, import_react23.useEffect)(() => {
3504
+ (0, import_react24.useEffect)(() => {
3360
3505
  return () => {
3361
3506
  if (sourceDebounceRef.current) clearTimeout(sourceDebounceRef.current);
3362
3507
  };
3363
3508
  }, []);
3364
3509
  if (!session || !state) {
3365
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: `p-4 text-center text-xs text-muted-foreground ${className}`, children: "No effect authoring session is open." });
3510
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: `p-4 text-center text-xs text-muted-foreground ${className}`, children: "No effect authoring session is open." });
3366
3511
  }
3367
3512
  const hasSource = showSource && state.sourceLanguage !== null && typeof session.setSource === "function";
3368
3513
  const handleSourceChange = (e) => {
@@ -3396,10 +3541,10 @@ function EffectAuthoringEditor({
3396
3541
  const issueLines = new Set(
3397
3542
  state.issues.map((i) => i.line).filter((l) => typeof l === "number")
3398
3543
  );
3399
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: `space-y-4 rounded border border-border bg-background p-4 text-foreground ${className}`, "data-effect-authoring-editor": state.name, children: [
3400
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-wrap items-center justify-between gap-2 border-b border-border pb-3", children: [
3401
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center gap-2", children: [
3402
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3544
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: `space-y-4 rounded border border-border bg-background p-4 text-foreground ${className}`, "data-effect-authoring-editor": state.name, children: [
3545
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex flex-wrap items-center justify-between gap-2 border-b border-border pb-3", children: [
3546
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center gap-2", children: [
3547
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
3403
3548
  "button",
3404
3549
  {
3405
3550
  type: "button",
@@ -3409,15 +3554,15 @@ function EffectAuthoringEditor({
3409
3554
  children: state.playing ? "Pause" : "Play"
3410
3555
  }
3411
3556
  ),
3412
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { className: "font-mono text-xs text-muted-foreground", "data-time-readout": true, children: [
3557
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { className: "font-mono text-xs text-muted-foreground", "data-time-readout": true, children: [
3413
3558
  state.time,
3414
3559
  "ms / ",
3415
3560
  state.duration,
3416
3561
  "ms"
3417
3562
  ] })
3418
3563
  ] }),
3419
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center gap-2", children: [
3420
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3564
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center gap-2", children: [
3565
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
3421
3566
  "button",
3422
3567
  {
3423
3568
  type: "button",
@@ -3428,7 +3573,7 @@ function EffectAuthoringEditor({
3428
3573
  children: "Undo"
3429
3574
  }
3430
3575
  ),
3431
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3576
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
3432
3577
  "button",
3433
3578
  {
3434
3579
  type: "button",
@@ -3439,8 +3584,8 @@ function EffectAuthoringEditor({
3439
3584
  children: "Redo"
3440
3585
  }
3441
3586
  ),
3442
- savingPreset ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("form", { onSubmit: handleSavePreset, className: "flex items-center gap-1", children: [
3443
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3587
+ savingPreset ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("form", { onSubmit: handleSavePreset, className: "flex items-center gap-1", children: [
3588
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
3444
3589
  "input",
3445
3590
  {
3446
3591
  type: "text",
@@ -3451,7 +3596,7 @@ function EffectAuthoringEditor({
3451
3596
  onChange: (e) => setPresetName(e.target.value)
3452
3597
  }
3453
3598
  ),
3454
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3599
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
3455
3600
  "button",
3456
3601
  {
3457
3602
  type: "submit",
@@ -3459,7 +3604,7 @@ function EffectAuthoringEditor({
3459
3604
  children: "Save"
3460
3605
  }
3461
3606
  ),
3462
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3607
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
3463
3608
  "button",
3464
3609
  {
3465
3610
  type: "button",
@@ -3468,7 +3613,7 @@ function EffectAuthoringEditor({
3468
3613
  children: "Cancel"
3469
3614
  }
3470
3615
  )
3471
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3616
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
3472
3617
  "button",
3473
3618
  {
3474
3619
  type: "button",
@@ -3479,11 +3624,11 @@ function EffectAuthoringEditor({
3479
3624
  )
3480
3625
  ] })
3481
3626
  ] }),
3482
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "grid grid-cols-1 gap-4 lg:grid-cols-2", children: [
3483
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "space-y-2", children: [
3484
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "text-xs font-semibold uppercase tracking-wider text-muted-foreground", children: "Preview" }),
3485
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "relative flex aspect-video w-full items-center justify-center overflow-hidden rounded border border-border bg-black", children: [
3486
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3627
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "grid grid-cols-1 gap-4 lg:grid-cols-2", children: [
3628
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "space-y-2", children: [
3629
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "text-xs font-semibold uppercase tracking-wider text-muted-foreground", children: "Preview" }),
3630
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "relative flex aspect-video w-full items-center justify-center overflow-hidden rounded border border-border bg-black", children: [
3631
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
3487
3632
  "canvas",
3488
3633
  {
3489
3634
  ref: canvasRef,
@@ -3493,9 +3638,9 @@ function EffectAuthoringEditor({
3493
3638
  "aria-label": "Effect preview canvas"
3494
3639
  }
3495
3640
  ),
3496
- previewError && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "absolute inset-0 flex items-center justify-center p-4 text-center text-xs text-white/80", role: "status", "data-effect-preview-error": true, children: previewError })
3641
+ previewError && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "absolute inset-0 flex items-center justify-center p-4 text-center text-xs text-white/80", role: "status", "data-effect-preview-error": true, children: previewError })
3497
3642
  ] }),
3498
- state.issues.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "space-y-1 rounded border border-destructive/20 bg-destructive/10 p-2 text-xs", "data-effect-issues": true, children: state.issues.map((issue, idx) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
3643
+ state.issues.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "space-y-1 rounded border border-destructive/20 bg-destructive/10 p-2 text-xs", "data-effect-issues": true, children: state.issues.map((issue, idx) => /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
3499
3644
  "div",
3500
3645
  {
3501
3646
  className: `cursor-pointer ${issue.severity === "error" ? "text-destructive" : "text-amber-500"}`,
@@ -3508,17 +3653,17 @@ function EffectAuthoringEditor({
3508
3653
  idx
3509
3654
  )) })
3510
3655
  ] }),
3511
- hasSource && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "space-y-2", "data-effect-source-pane": true, children: [
3512
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "flex items-center justify-between text-xs font-semibold uppercase tracking-wider text-muted-foreground", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { children: [
3656
+ hasSource && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "space-y-2", "data-effect-source-pane": true, children: [
3657
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "flex items-center justify-between text-xs font-semibold uppercase tracking-wider text-muted-foreground", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { children: [
3513
3658
  "Source (",
3514
3659
  state.sourceLanguage,
3515
3660
  ")"
3516
3661
  ] }) }),
3517
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex h-64 rounded border border-border bg-muted/20 font-mono text-xs", children: [
3518
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { ref: gutterRef, className: "select-none overflow-hidden border-r border-border bg-muted/40 px-2 py-2 text-right text-muted-foreground", "aria-hidden": "true", children: sourceLines.map((_, i) => {
3662
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex h-64 rounded border border-border bg-muted/20 font-mono text-xs", children: [
3663
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { ref: gutterRef, className: "select-none overflow-hidden border-r border-border bg-muted/40 px-2 py-2 text-right text-muted-foreground", "aria-hidden": "true", children: sourceLines.map((_, i) => {
3519
3664
  const lineNum = i + 1;
3520
3665
  const hasIssue = issueLines.has(lineNum);
3521
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3666
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
3522
3667
  "div",
3523
3668
  {
3524
3669
  "data-gutter-line": lineNum,
@@ -3528,7 +3673,7 @@ function EffectAuthoringEditor({
3528
3673
  i
3529
3674
  );
3530
3675
  }) }),
3531
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3676
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
3532
3677
  "textarea",
3533
3678
  {
3534
3679
  ref: textareaRef,
@@ -3546,9 +3691,9 @@ function EffectAuthoringEditor({
3546
3691
  ] })
3547
3692
  ] })
3548
3693
  ] }),
3549
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "space-y-2 border-t border-border pt-4", children: [
3550
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "text-xs font-semibold uppercase tracking-wider text-muted-foreground", children: "Parameters" }),
3551
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3694
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "space-y-2 border-t border-border pt-4", children: [
3695
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "text-xs font-semibold uppercase tracking-wider text-muted-foreground", children: "Parameters" }),
3696
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
3552
3697
  EffectParameters,
3553
3698
  {
3554
3699
  description: state.description,
@@ -3560,7 +3705,7 @@ function EffectAuthoringEditor({
3560
3705
  const track = state.tracks[control];
3561
3706
  const isAnimated = Boolean(track && track.length > 0);
3562
3707
  const hasKeyframeAtPlayhead = isAnimated && track.some((kf) => kf.time === state.time);
3563
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3708
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
3564
3709
  "button",
3565
3710
  {
3566
3711
  type: "button",
@@ -3582,17 +3727,17 @@ function EffectAuthoringEditor({
3582
3727
  }
3583
3728
  )
3584
3729
  ] }),
3585
- showTimeline && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "space-y-3 border-t border-border pt-4", "data-effect-timeline": true, children: [
3586
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-wrap items-center justify-between gap-4", children: [
3587
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "text-xs font-semibold uppercase tracking-wider text-muted-foreground", children: "Timeline" }),
3588
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center gap-3 text-xs", children: [
3589
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { className: "flex items-center gap-1.5", children: [
3590
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { children: "Duration:" }),
3591
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(DurationField, { duration: state.duration, onCommit: (duration) => session.setTiming({ duration }) }),
3592
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "text-muted-foreground", children: "ms" })
3730
+ showTimeline && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "space-y-3 border-t border-border pt-4", "data-effect-timeline": true, children: [
3731
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex flex-wrap items-center justify-between gap-4", children: [
3732
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "text-xs font-semibold uppercase tracking-wider text-muted-foreground", children: "Timeline" }),
3733
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center gap-3 text-xs", children: [
3734
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("label", { className: "flex items-center gap-1.5", children: [
3735
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { children: "Duration:" }),
3736
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(DurationField, { duration: state.duration, onCommit: (duration) => session.setTiming({ duration }) }),
3737
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "text-muted-foreground", children: "ms" })
3593
3738
  ] }),
3594
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { className: "flex items-center gap-1.5 cursor-pointer", children: [
3595
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3739
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("label", { className: "flex items-center gap-1.5 cursor-pointer", children: [
3740
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
3596
3741
  "input",
3597
3742
  {
3598
3743
  type: "checkbox",
@@ -3601,11 +3746,11 @@ function EffectAuthoringEditor({
3601
3746
  onChange: (e) => session.setTiming({ loop: e.target.checked })
3602
3747
  }
3603
3748
  ),
3604
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { children: "Loop" })
3749
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { children: "Loop" })
3605
3750
  ] })
3606
3751
  ] })
3607
3752
  ] }),
3608
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "space-y-1", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3753
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "space-y-1", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
3609
3754
  "input",
3610
3755
  {
3611
3756
  type: "range",
@@ -3617,12 +3762,12 @@ function EffectAuthoringEditor({
3617
3762
  className: "w-full cursor-pointer accent-primary"
3618
3763
  }
3619
3764
  ) }),
3620
- Object.entries(state.tracks).length > 0 && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "space-y-2 pt-1", children: Object.entries(state.tracks).map(([control, keyframes]) => {
3765
+ Object.entries(state.tracks).length > 0 && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "space-y-2 pt-1", children: Object.entries(state.tracks).map(([control, keyframes]) => {
3621
3766
  if (!keyframes || keyframes.length === 0) return null;
3622
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "space-y-1", "data-track": control, children: [
3623
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center justify-between text-xs text-muted-foreground", children: [
3624
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "font-medium", children: control }),
3625
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3767
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "space-y-1", "data-track": control, children: [
3768
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center justify-between text-xs text-muted-foreground", children: [
3769
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "font-medium", children: control }),
3770
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
3626
3771
  "button",
3627
3772
  {
3628
3773
  type: "button",
@@ -3633,12 +3778,12 @@ function EffectAuthoringEditor({
3633
3778
  }
3634
3779
  )
3635
3780
  ] }),
3636
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "relative h-4 w-full rounded bg-muted/40", children: keyframes.map((kf, i) => {
3781
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "relative h-4 w-full rounded bg-muted/40", children: keyframes.map((kf, i) => {
3637
3782
  const leftPct = Math.max(
3638
3783
  0,
3639
3784
  Math.min(100, kf.time / (state.duration || 1) * 100)
3640
3785
  );
3641
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3786
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
3642
3787
  "button",
3643
3788
  {
3644
3789
  type: "button",
@@ -3658,14 +3803,14 @@ function EffectAuthoringEditor({
3658
3803
  ] });
3659
3804
  }
3660
3805
  function DurationField({ duration, onCommit }) {
3661
- const [draft, setDraft] = (0, import_react23.useState)(String(duration));
3662
- (0, import_react23.useEffect)(() => setDraft(String(duration)), [duration]);
3806
+ const [draft, setDraft] = (0, import_react24.useState)(String(duration));
3807
+ (0, import_react24.useEffect)(() => setDraft(String(duration)), [duration]);
3663
3808
  const commit = () => {
3664
3809
  const next = Number(draft);
3665
3810
  if (Number.isFinite(next) && next >= 1 && next !== duration) onCommit(next);
3666
3811
  else setDraft(String(duration));
3667
3812
  };
3668
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3813
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
3669
3814
  "input",
3670
3815
  {
3671
3816
  type: "number",
@@ -3684,9 +3829,9 @@ function DurationField({ duration, onCommit }) {
3684
3829
  }
3685
3830
 
3686
3831
  // src/video-editor/VideoEffectsPanel.tsx
3687
- var import_react24 = require("react");
3832
+ var import_react25 = require("react");
3688
3833
  var import_video_editor11 = require("@pixerate/editor/video-editor");
3689
- var import_jsx_runtime19 = require("react/jsx-runtime");
3834
+ var import_jsx_runtime20 = require("react/jsx-runtime");
3690
3835
  var btn7 = "rounded border border-border px-1.5 py-0.5 text-[11px] disabled:opacity-40";
3691
3836
  var keyedOf = (values) => new Set(Object.entries(values ?? {}).filter(([, v]) => (0, import_video_editor11.isVideoKeyframes)(v)).map(([k]) => k));
3692
3837
  function EffectControls({
@@ -3699,23 +3844,23 @@ function EffectControls({
3699
3844
  onPreset
3700
3845
  }) {
3701
3846
  const { description, error } = useEffectDescription(provider, effect);
3702
- if (!provider) return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("p", { className: "text-[11px] text-muted-foreground", children: [
3847
+ if (!provider) return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("p", { className: "text-[11px] text-muted-foreground", children: [
3703
3848
  'No effects provider: "',
3704
3849
  name ?? effect,
3705
3850
  '" is kept and shown as a placeholder.'
3706
3851
  ] });
3707
- if (error) return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "text-[11px] text-amber-500", children: error });
3708
- if (!description) return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "Loading\u2026" });
3709
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(EffectParameters, { description, values: values ?? {}, keyframed: keyedOf(values), disabled, onChange, onReset: (k) => onChange(k, description.defaults[k], null), onPreset });
3852
+ if (error) return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "text-[11px] text-amber-500", children: error });
3853
+ if (!description) return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "Loading\u2026" });
3854
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(EffectParameters, { description, values: values ?? {}, keyframed: keyedOf(values), disabled, onChange, onReset: (k) => onChange(k, description.defaults[k], null), onPreset });
3710
3855
  }
3711
3856
  function VideoEffectsPanel({ controller, className = "" }) {
3712
3857
  const state = useVideoEditorState(controller);
3713
3858
  const provider = state.effectsProvider;
3714
- const [browse, setBrowse] = (0, import_react24.useState)(null);
3715
- const [message, setMessage] = (0, import_react24.useState)(null);
3716
- const [open, setOpen] = (0, import_react24.useState)(null);
3717
- const [authoring, setAuthoring] = (0, import_react24.useState)(null);
3718
- (0, import_react24.useEffect)(() => () => authoring?.dispose(), [authoring]);
3859
+ const [browse, setBrowse] = (0, import_react25.useState)(null);
3860
+ const [message, setMessage] = (0, import_react25.useState)(null);
3861
+ const [open, setOpen] = (0, import_react25.useState)(null);
3862
+ const [authoring, setAuthoring] = (0, import_react25.useState)(null);
3863
+ (0, import_react25.useEffect)(() => () => authoring?.dispose(), [authoring]);
3719
3864
  const selected = state.selection[0];
3720
3865
  const at = selected ? (0, import_video_editor11.findVideoClip)(state.project, selected) : null;
3721
3866
  const clip = at?.clip ?? null;
@@ -3726,18 +3871,18 @@ function VideoEffectsPanel({ controller, className = "" }) {
3726
3871
  if (!track) return setMessage("Add a video track first.");
3727
3872
  report(controller.addEffectClip(track, effect, { start: Math.round(state.time), mode: "overwrite" }).then((r) => (r.ok && r.clip && controller.select([r.clip]), r)));
3728
3873
  };
3729
- return /* @__PURE__ */ (0, import_jsx_runtime19.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: [
3730
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center gap-1", children: [
3731
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("h3", { className: "flex-1 font-semibold", children: "Effects" }),
3732
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", className: btn7, disabled: disabled || !provider, onClick: () => setBrowse(browse === "generator" ? null : "generator"), "aria-pressed": browse === "generator", children: "Add effect clip" })
3874
+ return /* @__PURE__ */ (0, import_jsx_runtime20.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: [
3875
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center gap-1", children: [
3876
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("h3", { className: "flex-1 font-semibold", children: "Effects" }),
3877
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", className: btn7, disabled: disabled || !provider, onClick: () => setBrowse(browse === "generator" ? null : "generator"), "aria-pressed": browse === "generator", children: "Add effect clip" })
3733
3878
  ] }),
3734
- !provider && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No effects provider is registered. Effects in the project are kept and drawn as placeholders." }),
3735
- browse === "generator" && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(EffectsBrowser, { provider, uses: ["generator", "title", "overlay"], title: "Generators and titles", onPick: (e) => (setBrowse(null), addEffectClip(e.id)) }),
3736
- !clip && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "Select a clip to see its effects." }),
3737
- clip && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
3738
- clip.type === "effect" && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "space-y-1", "data-effect-part": "generator", children: [
3739
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "font-medium", children: clip.name ?? clip.effect }),
3740
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
3879
+ !provider && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No effects provider is registered. Effects in the project are kept and drawn as placeholders." }),
3880
+ browse === "generator" && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(EffectsBrowser, { provider, uses: ["generator", "title", "overlay"], title: "Generators and titles", onPick: (e) => (setBrowse(null), addEffectClip(e.id)) }),
3881
+ !clip && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "Select a clip to see its effects." }),
3882
+ clip && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
3883
+ clip.type === "effect" && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "space-y-1", "data-effect-part": "generator", children: [
3884
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "font-medium", children: clip.name ?? clip.effect }),
3885
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3741
3886
  EffectControls,
3742
3887
  {
3743
3888
  provider,
@@ -3750,13 +3895,13 @@ function VideoEffectsPanel({ controller, className = "" }) {
3750
3895
  }
3751
3896
  )
3752
3897
  ] }),
3753
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "space-y-1", "data-effect-part": "transition", children: [
3754
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center gap-1", children: [
3755
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "flex-1 font-medium", children: "Transition in" }),
3756
- clip.transition?.type === "effect" ? /* @__PURE__ */ (0, import_jsx_runtime19.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_runtime19.jsx)("button", { type: "button", className: btn7, disabled: disabled || !provider, "aria-pressed": browse === "transition", onClick: () => setBrowse(browse === "transition" ? null : "transition"), children: "Effect transition\u2026" })
3898
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "space-y-1", "data-effect-part": "transition", children: [
3899
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center gap-1", children: [
3900
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "flex-1 font-medium", children: "Transition in" }),
3901
+ clip.transition?.type === "effect" ? /* @__PURE__ */ (0, import_jsx_runtime20.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_runtime20.jsx)("button", { type: "button", className: btn7, disabled: disabled || !provider, "aria-pressed": browse === "transition", onClick: () => setBrowse(browse === "transition" ? null : "transition"), children: "Effect transition\u2026" })
3757
3902
  ] }),
3758
- browse === "transition" && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(EffectsBrowser, { provider, uses: ["transition"], title: "Transitions", onPick: (e) => (setBrowse(null), report(controller.setEffectTransition(clip.id, e.id))) }),
3759
- clip.transition?.type === "effect" && clip.transition.effect && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
3903
+ browse === "transition" && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(EffectsBrowser, { provider, uses: ["transition"], title: "Transitions", onPick: (e) => (setBrowse(null), report(controller.setEffectTransition(clip.id, e.id))) }),
3904
+ clip.transition?.type === "effect" && clip.transition.effect && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3760
3905
  EffectControls,
3761
3906
  {
3762
3907
  provider,
@@ -3769,19 +3914,19 @@ function VideoEffectsPanel({ controller, className = "" }) {
3769
3914
  }
3770
3915
  )
3771
3916
  ] }),
3772
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "space-y-1", "data-effect-part": "stack", children: [
3773
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center gap-1", children: [
3774
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "flex-1 font-medium", children: "On this clip" }),
3775
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", className: btn7, disabled: disabled || !provider, "aria-pressed": browse === "clip", onClick: () => setBrowse(browse === "clip" ? null : "clip"), children: "Add effect\u2026" })
3917
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "space-y-1", "data-effect-part": "stack", children: [
3918
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center gap-1", children: [
3919
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "flex-1 font-medium", children: "On this clip" }),
3920
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", className: btn7, disabled: disabled || !provider, "aria-pressed": browse === "clip", onClick: () => setBrowse(browse === "clip" ? null : "clip"), children: "Add effect\u2026" })
3776
3921
  ] }),
3777
- browse === "clip" && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(EffectsBrowser, { provider, uses: ["filter", "overlay"], title: "Filters and overlays", onPick: (e) => (setBrowse(null), report(controller.applyClipEffect(clip.id, e.id))) }),
3778
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("ol", { className: "space-y-1", children: (clip.effects ?? []).map((e, i, all) => /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("li", { className: "rounded border border-border p-1", "data-clip-effect": e.id, children: [
3779
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center gap-1", children: [
3780
- /* @__PURE__ */ (0, import_jsx_runtime19.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 })) }),
3781
- /* @__PURE__ */ (0, import_jsx_runtime19.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 }),
3782
- /* @__PURE__ */ (0, import_jsx_runtime19.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" }),
3783
- /* @__PURE__ */ (0, import_jsx_runtime19.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" }),
3784
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
3922
+ browse === "clip" && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(EffectsBrowser, { provider, uses: ["filter", "overlay"], title: "Filters and overlays", onPick: (e) => (setBrowse(null), report(controller.applyClipEffect(clip.id, e.id))) }),
3923
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("ol", { className: "space-y-1", children: (clip.effects ?? []).map((e, i, all) => /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("li", { className: "rounded border border-border p-1", "data-clip-effect": e.id, children: [
3924
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center gap-1", children: [
3925
+ /* @__PURE__ */ (0, import_jsx_runtime20.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 })) }),
3926
+ /* @__PURE__ */ (0, import_jsx_runtime20.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 }),
3927
+ /* @__PURE__ */ (0, import_jsx_runtime20.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" }),
3928
+ /* @__PURE__ */ (0, import_jsx_runtime20.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" }),
3929
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3785
3930
  "button",
3786
3931
  {
3787
3932
  type: "button",
@@ -3797,12 +3942,12 @@ function VideoEffectsPanel({ controller, className = "" }) {
3797
3942
  children: "\u270E"
3798
3943
  }
3799
3944
  ),
3800
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", className: btn7, disabled, "aria-label": `Remove ${e.name ?? e.effect}`, onClick: () => report(controller.removeClipEffect(clip.id, e.id)), children: "\u2715" })
3945
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", className: btn7, disabled, "aria-label": `Remove ${e.name ?? e.effect}`, onClick: () => report(controller.removeClipEffect(clip.id, e.id)), children: "\u2715" })
3801
3946
  ] }),
3802
- open === e.id && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "mt-1 space-y-2", children: [
3803
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("label", { className: "flex items-center gap-1", children: [
3804
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "w-14 text-[11px]", children: "Opacity" }),
3805
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
3947
+ open === e.id && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "mt-1 space-y-2", children: [
3948
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { className: "flex items-center gap-1", children: [
3949
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "w-14 text-[11px]", children: "Opacity" }),
3950
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3806
3951
  "input",
3807
3952
  {
3808
3953
  type: "range",
@@ -3817,7 +3962,7 @@ function VideoEffectsPanel({ controller, className = "" }) {
3817
3962
  }
3818
3963
  )
3819
3964
  ] }),
3820
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
3965
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3821
3966
  EffectControls,
3822
3967
  {
3823
3968
  provider,
@@ -3831,13 +3976,13 @@ function VideoEffectsPanel({ controller, className = "" }) {
3831
3976
  )
3832
3977
  ] })
3833
3978
  ] }, e.id)) }),
3834
- !clip.effects?.length && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No effects on this clip." })
3979
+ !clip.effects?.length && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No effects on this clip." })
3835
3980
  ] })
3836
3981
  ] }),
3837
- authoring && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "space-y-1 rounded border border-border p-1", "data-effect-authoring": authoring.instance, children: [
3838
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(EffectAuthoringEditor, { session: authoring.session, showSource: false, previewSize: { width: 240, height: 135 } }),
3839
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex gap-1", children: [
3840
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
3982
+ authoring && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "space-y-1 rounded border border-border p-1", "data-effect-authoring": authoring.instance, children: [
3983
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(EffectAuthoringEditor, { session: authoring.session, showSource: false, previewSize: { width: 240, height: 135 } }),
3984
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex gap-1", children: [
3985
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3841
3986
  "button",
3842
3987
  {
3843
3988
  type: "button",
@@ -3851,43 +3996,43 @@ function VideoEffectsPanel({ controller, className = "" }) {
3851
3996
  children: "Apply to clip"
3852
3997
  }
3853
3998
  ),
3854
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", className: btn7, onClick: () => setAuthoring(null), children: "Close" })
3999
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", className: btn7, onClick: () => setAuthoring(null), children: "Close" })
3855
4000
  ] })
3856
4001
  ] }),
3857
- message && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { role: "alert", className: "text-[11px] text-destructive", children: message })
4002
+ message && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { role: "alert", className: "text-[11px] text-destructive", children: message })
3858
4003
  ] });
3859
4004
  }
3860
4005
 
3861
4006
  // src/video-editor/VideoEditor.tsx
3862
- var import_jsx_runtime20 = require("react/jsx-runtime");
4007
+ var import_jsx_runtime21 = require("react/jsx-runtime");
3863
4008
  function VideoEditor({ controller: given, options, editable = true, pxPerSecond, onPxPerSecondChange, resolution, showIssues = true, showTranscript = true, transcriptMode = "panel", showScopes = false, effects, showEffects, className = "", playback, onPlaybackReveal }) {
3864
4009
  const { controller, state } = useVideoEditor(given ?? options ?? {});
3865
4010
  useEffects(controller, effects);
3866
4011
  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")));
3867
- (0, import_react25.useEffect)(() => {
4012
+ (0, import_react26.useEffect)(() => {
3868
4013
  if (editable) return;
3869
4014
  const was = controller.getState().readOnly;
3870
4015
  controller.setReadOnly(true);
3871
4016
  return () => controller.setReadOnly(was);
3872
4017
  }, [controller, editable]);
3873
4018
  const { issues } = state;
3874
- const issueList = showIssues && issues.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime20.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_runtime20.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)) });
3875
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: `flex flex-col gap-3 ${className}`, "data-video-editor": "", children: [
3876
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: `grid gap-3 ${editable ? "lg:grid-cols-[16rem_minmax(0,1fr)_18rem]" : ""}`, children: [
3877
- editable && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(MediaBin, { controller, className: "min-w-0" }),
3878
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex min-w-0 flex-col gap-2", children: [
3879
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(VideoPreview, { controller, resolution, className: "rounded-md border border-border" }),
3880
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(VideoTransport, { controller, editable }),
3881
- showScopes && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(VideoScopes, { controller })
4019
+ const issueList = showIssues && issues.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime21.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_runtime21.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)) });
4020
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: `flex flex-col gap-3 ${className}`, "data-video-editor": "", children: [
4021
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: `grid gap-3 ${editable ? "lg:grid-cols-[16rem_minmax(0,1fr)_18rem]" : ""}`, children: [
4022
+ editable && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(MediaBin, { controller, className: "min-w-0" }),
4023
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex min-w-0 flex-col gap-2", children: [
4024
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(VideoPreview, { controller, resolution, className: "rounded-md border border-border" }),
4025
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(VideoTransport, { controller, editable }),
4026
+ showScopes && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(VideoScopes, { controller })
3882
4027
  ] }),
3883
- editable && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex min-w-0 flex-col gap-3", children: [
3884
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ClipInspector, { controller, className: "min-w-0" }),
3885
- effectsShown && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(VideoEffectsPanel, { controller, className: "min-w-0" })
4028
+ editable && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex min-w-0 flex-col gap-3", children: [
4029
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ClipInspector, { controller, className: "min-w-0" }),
4030
+ effectsShown && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(VideoEffectsPanel, { controller, className: "min-w-0" })
3886
4031
  ] })
3887
4032
  ] }),
3888
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(VideoTimeline, { controller, editable, pxPerSecond, onPxPerSecondChange, playback, onPlaybackReveal }),
3889
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(EditPlanPreview, { controller, editable }),
3890
- showTranscript && (transcriptMode === "editor" ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(TranscriptEditor, { controller, editable }) : /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(TranscriptPanel, { controller, editable })),
4033
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(VideoTimeline, { controller, editable, pxPerSecond, onPxPerSecondChange, playback, onPlaybackReveal }),
4034
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(EditPlanPreview, { controller, editable }),
4035
+ showTranscript && (transcriptMode === "editor" ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TranscriptEditor, { controller, editable }) : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TranscriptPanel, { controller, editable })),
3891
4036
  issueList
3892
4037
  ] });
3893
4038
  }