@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
@@ -39,6 +39,7 @@ __export(image_editor_exports, {
39
39
  FreeTransformOptionsBar: () => FreeTransformOptionsBar,
40
40
  Histogram: () => Histogram,
41
41
  ImageCheckbox: () => ImageCheckbox,
42
+ ImageColor: () => ImageColor,
42
43
  ImageEditor: () => ImageEditor,
43
44
  ImageEditorCanvas: () => ImageEditorCanvas,
44
45
  ImageEditorControlsProvider: () => ImageEditorControlsProvider,
@@ -229,7 +230,7 @@ function useImageEffectsTools(registry, controller, options = {}) {
229
230
  }
230
231
 
231
232
  // src/image-editor/ImageEditor.tsx
232
- var import_react29 = __toESM(require("react"), 1);
233
+ var import_react30 = __toESM(require("react"), 1);
233
234
  var import_image_editor19 = require("@pixerate/editor/image-editor");
234
235
 
235
236
  // src/image-editor/ImageEditorCanvas.tsx
@@ -1140,6 +1141,22 @@ function ImageSelect(props) {
1140
1141
  options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: o.value, children: o.label }, o.value))
1141
1142
  ] });
1142
1143
  }
1144
+ function ImageColor(props) {
1145
+ const Host = useImageEditorControls().Color;
1146
+ if (Host) return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Host, { ...props });
1147
+ const { value, label, alpha, disabled, onChange, className = "" } = props;
1148
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1149
+ "input",
1150
+ {
1151
+ type: "color",
1152
+ "aria-label": label,
1153
+ value: value.slice(0, 7),
1154
+ disabled,
1155
+ onChange: (e) => onChange(e.target.value + (alpha ? value.slice(7, 9) : "")),
1156
+ className: `${imageColorInputClass} ${className}`
1157
+ }
1158
+ );
1159
+ }
1143
1160
 
1144
1161
  // src/image-editor/ControlSlider.tsx
1145
1162
  var import_jsx_runtime5 = require("react/jsx-runtime");
@@ -1380,32 +1397,14 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram, classN
1380
1397
  /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
1381
1398
  /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ImageCheckbox, { label: "Tint", checked: layer.params.tint !== null, onChange: (on) => setParam(layer, "tint", on ? "#e1d3b3" : null) }),
1382
1399
  "Tint",
1383
- layer.params.tint && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1384
- "input",
1385
- {
1386
- type: "color",
1387
- "aria-label": "Tint colour",
1388
- value: layer.params.tint,
1389
- onChange: (e) => setParam(layer, "tint", e.target.value),
1390
- className: "h-5 w-8 bg-transparent"
1391
- }
1392
- )
1400
+ layer.params.tint && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ImageColor, { label: "Tint colour", value: layer.params.tint, onChange: (v) => setParam(layer, "tint", v) })
1393
1401
  ] })
1394
1402
  ] });
1395
1403
  case "photoFilter":
1396
1404
  return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex flex-col gap-2", children: [
1397
1405
  /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
1398
1406
  "Filter colour",
1399
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1400
- "input",
1401
- {
1402
- type: "color",
1403
- "aria-label": "Filter colour",
1404
- value: layer.params.color,
1405
- onChange: (e) => setParam(layer, "color", e.target.value),
1406
- className: "h-5 w-8 bg-transparent"
1407
- }
1408
- )
1407
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ImageColor, { label: "Filter colour", value: layer.params.color, onChange: (v) => setParam(layer, "color", v) })
1409
1408
  ] }),
1410
1409
  controlsOf(layer).map((s) => slider(layer, s)),
1411
1410
  checkbox(layer, "preserveLuminosity", "Preserve luminosity")
@@ -1595,7 +1594,7 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
1595
1594
  }
1596
1595
  case "color":
1597
1596
  return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("label", { className: "flex items-center gap-1.5 text-foreground", children: [
1598
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("input", { type: "color", "aria-label": label, value: c.value, disabled: model.readOnly, onChange: (e) => change(effectId, c, e.target.value) }),
1597
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ImageColor, { label, value: c.value, disabled: model.readOnly, onChange: (v) => change(effectId, c, v) }),
1599
1598
  label
1600
1599
  ] }, c.key);
1601
1600
  case "checkbox":
@@ -2117,7 +2116,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
2117
2116
  };
2118
2117
 
2119
2118
  // src/image-editor/ImageProviderEffectsPanel.tsx
2120
- var import_react20 = __toESM(require("react"), 1);
2119
+ var import_react21 = __toESM(require("react"), 1);
2121
2120
  var import_image_editor9 = require("@pixerate/editor/image-editor");
2122
2121
 
2123
2122
  // src/effects/useEffects.ts
@@ -2257,12 +2256,12 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
2257
2256
  }
2258
2257
 
2259
2258
  // src/effects/EffectParameters.tsx
2260
- var import_react19 = __toESM(require("react"), 1);
2259
+ var import_react20 = __toESM(require("react"), 1);
2261
2260
  var import_effects3 = require("@pixerate/editor/effects");
2262
2261
  var import_parameters2 = require("@pixerate/editor/parameters");
2263
2262
 
2264
2263
  // src/parameters/fields.tsx
2265
- var import_react18 = require("react");
2264
+ var import_react19 = require("react");
2266
2265
  var import_parameters = require("@pixerate/editor/parameters");
2267
2266
 
2268
2267
  // src/color/index.ts
@@ -3304,18 +3303,58 @@ function useResolvedColor(value, scheme) {
3304
3303
  // src/color/index.ts
3305
3304
  __reExport(color_exports, require("@pixerate/editor/color"));
3306
3305
 
3307
- // src/parameters/fields.tsx
3306
+ // src/parameters/controls.tsx
3307
+ var import_react18 = require("react");
3308
3308
  var import_jsx_runtime15 = require("react/jsx-runtime");
3309
+ var ParameterComponentsContext = (0, import_react18.createContext)({});
3310
+ function useParameterComponents() {
3311
+ return (0, import_react18.useContext)(ParameterComponentsContext);
3312
+ }
3313
+ function resolveParameterComponents(explicit, context) {
3314
+ return {
3315
+ input: explicit?.input ?? context?.input,
3316
+ slider: explicit?.slider ?? context?.slider,
3317
+ select: explicit?.select ?? context?.select,
3318
+ color: explicit?.color ?? context?.color
3319
+ };
3320
+ }
3321
+
3322
+ // src/parameters/fields.tsx
3323
+ var import_jsx_runtime16 = require("react/jsx-runtime");
3324
+ var parameterInputStyle = import_parameters.parameterThemeStyles.input;
3325
+ var parameterSelectStyle = import_parameters.parameterThemeStyles.select;
3326
+ var parameterButtonStyle = import_parameters.parameterThemeStyles.button;
3327
+ var parameterRangeStyle = import_parameters.parameterThemeStyles.range;
3309
3328
  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";
3310
3329
  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";
3311
3330
  var rangeClass = "h-4 w-full min-w-0 flex-1 cursor-pointer accent-primary disabled:cursor-not-allowed disabled:opacity-50";
3312
- function ParameterCommitInput({ value, onCommit, multiline, className, onKeyDown, ...rest }) {
3331
+ function ParameterCommitInput({ value, onCommit, multiline, className, onKeyDown, style, ...rest }) {
3332
+ const inputRef = (0, import_react19.useRef)(null);
3333
+ const lastCommitted = (0, import_react19.useRef)(null);
3334
+ (0, import_react19.useLayoutEffect)(() => {
3335
+ lastCommitted.current = null;
3336
+ const el = inputRef.current;
3337
+ if (el && el.value !== value) el.value = value;
3338
+ }, [value]);
3313
3339
  const commit = (el) => {
3314
- if (el.value !== value) onCommit(el.value, el);
3340
+ const text = el.value;
3341
+ if (text === value || text === lastCommitted.current) return;
3342
+ onCommit(text, el);
3343
+ lastCommitted.current = el.value === text ? text : null;
3315
3344
  };
3345
+ const commitRef = (0, import_react19.useRef)(commit);
3346
+ commitRef.current = commit;
3347
+ (0, import_react19.useEffect)(() => {
3348
+ const el = inputRef.current;
3349
+ if (!el) return;
3350
+ const change = () => commitRef.current(el);
3351
+ el.addEventListener("change", change);
3352
+ return () => el.removeEventListener("change", change);
3353
+ }, [multiline]);
3316
3354
  const keyDown = (e) => {
3317
3355
  onKeyDown?.(e);
3318
3356
  if (e.defaultPrevented) return;
3357
+ if (e.key === "Tab") commit(e.currentTarget);
3319
3358
  if (e.key === "Enter" && (!multiline || e.metaKey || e.ctrlKey)) {
3320
3359
  e.preventDefault();
3321
3360
  commit(e.currentTarget);
@@ -3325,86 +3364,114 @@ function ParameterCommitInput({ value, onCommit, multiline, className, onKeyDown
3325
3364
  const props = {
3326
3365
  defaultValue: value,
3327
3366
  className: className ?? parameterInputClass,
3367
+ style: { ...parameterInputStyle, ...style },
3328
3368
  onBlur: (e) => commit(e.currentTarget),
3329
3369
  onKeyDown: keyDown,
3330
3370
  ...rest
3331
3371
  };
3332
- return multiline ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("textarea", { ...props, className: `${props.className} h-auto min-h-[3.5rem] py-1` }, value) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("input", { type: "text", ...props }, value);
3372
+ const forwarded = rest.ref;
3373
+ const setRef = (el) => {
3374
+ inputRef.current = el;
3375
+ if (typeof forwarded === "function") forwarded(el);
3376
+ else if (forwarded) forwarded.current = el;
3377
+ };
3378
+ return multiline ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("textarea", { ...props, ref: setRef, className: `${props.className} h-auto min-h-[3.5rem] py-1` }) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("input", { type: "text", ...props, ref: setRef });
3333
3379
  }
3334
3380
  var plainNumber = (field, value) => (0, import_parameters.formatParameterNumber)({ ...field, unit: void 0 }, value);
3335
- function ParameterNumberInput({
3336
- field,
3337
- value,
3338
- onChange,
3339
- disabled,
3340
- id,
3341
- "aria-label": ariaLabel
3342
- }) {
3343
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "relative min-w-0 flex-1", children: [
3344
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
3345
- ParameterCommitInput,
3346
- {
3347
- id,
3348
- inputMode: "decimal",
3349
- "aria-label": ariaLabel ?? (0, import_parameters.parameterLabel)(field),
3350
- value: plainNumber(field, value),
3351
- disabled: disabled || field.readOnly,
3352
- className: `${parameterInputClass} ${field.unit ? "pr-6" : ""}`,
3353
- onCommit: (text, input) => {
3354
- const n = (0, import_parameters.parseParameterNumberInput)(field, text);
3355
- if (n === null || n === value) input.value = plainNumber(field, value);
3356
- else onChange(n);
3357
- },
3358
- onKeyDown: (e) => {
3359
- if (e.key !== "ArrowUp" && e.key !== "ArrowDown") return;
3360
- e.preventDefault();
3361
- const step = (0, import_parameters.parameterStep)(field) * (e.shiftKey ? 10 : 1);
3362
- onChange((0, import_parameters.clampParameterNumber)(field, value + (e.key === "ArrowUp" ? step : -step)));
3363
- }
3364
- }
3365
- ),
3366
- field.unit && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "pointer-events-none absolute right-2 top-1/2 -translate-y-1/2 text-[10px] text-muted-foreground", children: field.unit })
3381
+ function ParameterNumberInput(props) {
3382
+ const { field, value, onChange, disabled, id, components, "aria-label": ariaLabel } = props;
3383
+ const ctx = useParameterComponents();
3384
+ const resolved = resolveParameterComponents(components, ctx);
3385
+ const CustomInput = resolved.input;
3386
+ const plain = plainNumber(field, value);
3387
+ const handleCommit = (text, input) => {
3388
+ const n = (0, import_parameters.parseParameterNumberInput)(field, text);
3389
+ if (n === null || n === value) {
3390
+ if (input) input.value = plain;
3391
+ } else {
3392
+ onChange(n);
3393
+ }
3394
+ };
3395
+ const handleKeyDown = (e) => {
3396
+ if (e.key !== "ArrowUp" && e.key !== "ArrowDown") return;
3397
+ e.preventDefault();
3398
+ const step = (0, import_parameters.parameterStep)(field) * (e.shiftKey ? 10 : 1);
3399
+ onChange((0, import_parameters.clampParameterNumber)(field, value + (e.key === "ArrowUp" ? step : -step)));
3400
+ };
3401
+ const inputProps = {
3402
+ id,
3403
+ inputMode: "decimal",
3404
+ "aria-label": ariaLabel ?? (0, import_parameters.parameterLabel)(field),
3405
+ value: plain,
3406
+ disabled: disabled || field.readOnly,
3407
+ className: `${parameterInputClass} ${field.unit ? "pr-6" : ""}`,
3408
+ style: parameterInputStyle,
3409
+ onCommit: handleCommit,
3410
+ onKeyDown: handleKeyDown
3411
+ };
3412
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "relative min-w-0 flex-1", children: [
3413
+ CustomInput ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(CustomInput, { ...inputProps, label: (0, import_parameters.parameterLabel)(field) }) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ParameterCommitInput, { ...inputProps }),
3414
+ field.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: field.unit })
3367
3415
  ] });
3368
3416
  }
3369
3417
  function ParameterSlider(props) {
3370
- const { field, value, onChange, onGestureStart, onGestureEnd, disabled } = props;
3371
- const dragging = (0, import_react18.useRef)(false);
3418
+ const { field, value, onChange, onGestureStart, onGestureEnd, disabled, components } = props;
3419
+ const ctx = useParameterComponents();
3420
+ const resolved = resolveParameterComponents(components, ctx);
3421
+ const CustomSlider = resolved.slider;
3422
+ const dragging = (0, import_react19.useRef)(false);
3423
+ const start = () => {
3424
+ if (dragging.current) return;
3425
+ dragging.current = true;
3426
+ onGestureStart?.();
3427
+ };
3372
3428
  const end = () => {
3373
3429
  if (!dragging.current) return;
3374
3430
  dragging.current = false;
3375
3431
  onGestureEnd?.();
3376
3432
  };
3377
- if (!(0, import_parameters.isSliderField)(field)) return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ParameterNumberInput, { ...props });
3433
+ if (!(0, import_parameters.isSliderField)(field)) return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ParameterNumberInput, { ...props });
3378
3434
  const step = (0, import_parameters.parameterStep)(field);
3379
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex items-center gap-2", children: [
3380
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
3435
+ const sliderProps = {
3436
+ "aria-label": (0, import_parameters.parameterLabel)(field),
3437
+ "aria-valuetext": (0, import_parameters.formatParameterNumber)(field, value),
3438
+ // A `control: 'slider'` field may leave out a bound: the range input's own defaults.
3439
+ min: field.min ?? 0,
3440
+ max: field.max ?? 100,
3441
+ step,
3442
+ value,
3443
+ disabled: disabled || field.readOnly,
3444
+ className: rangeClass,
3445
+ style: parameterRangeStyle
3446
+ };
3447
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex items-center gap-2", children: [
3448
+ CustomSlider ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3449
+ CustomSlider,
3450
+ {
3451
+ ...sliderProps,
3452
+ id: props.id ? `${props.id}-slider` : void 0,
3453
+ label: (0, import_parameters.parameterLabel)(field),
3454
+ onChange: (v) => onChange((0, import_parameters.clampParameterNumber)(field, v)),
3455
+ onGestureStart: start,
3456
+ onGestureEnd: end
3457
+ }
3458
+ ) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3381
3459
  "input",
3382
3460
  {
3383
3461
  type: "range",
3384
- "aria-label": (0, import_parameters.parameterLabel)(field),
3385
- "aria-valuetext": (0, import_parameters.formatParameterNumber)(field, value),
3386
- min: field.min,
3387
- max: field.max,
3388
- step,
3389
- value,
3390
- disabled: disabled || field.readOnly,
3391
- className: rangeClass,
3392
- onPointerDown: () => {
3393
- if (dragging.current) return;
3394
- dragging.current = true;
3395
- onGestureStart?.();
3396
- },
3462
+ ...sliderProps,
3463
+ onPointerDown: start,
3397
3464
  onPointerUp: end,
3398
3465
  onPointerCancel: end,
3399
3466
  onBlur: end,
3400
3467
  onChange: (e) => onChange((0, import_parameters.clampParameterNumber)(field, Number(e.target.value)))
3401
3468
  }
3402
3469
  ),
3403
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "w-20 shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ParameterNumberInput, { ...props, id: props.id, "aria-label": `${(0, import_parameters.parameterLabel)(field)} value` }) })
3470
+ /* @__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)(field)} value` }) })
3404
3471
  ] });
3405
3472
  }
3406
3473
  function ParameterToggle({ field, value, onChange, disabled, id }) {
3407
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
3474
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3408
3475
  "button",
3409
3476
  {
3410
3477
  type: "button",
@@ -3415,7 +3482,7 @@ function ParameterToggle({ field, value, onChange, disabled, id }) {
3415
3482
  disabled: disabled || field.readOnly,
3416
3483
  onClick: () => onChange(!value),
3417
3484
  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"}`,
3418
- children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
3485
+ children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3419
3486
  "span",
3420
3487
  {
3421
3488
  className: `pointer-events-none block h-4 w-4 rounded-full bg-background shadow transition-transform ${value ? "translate-x-4" : "translate-x-0.5"}`
@@ -3424,11 +3491,15 @@ function ParameterToggle({ field, value, onChange, disabled, id }) {
3424
3491
  }
3425
3492
  );
3426
3493
  }
3427
- function ParameterSelect({ field, value, onChange, disabled, id }) {
3494
+ function ParameterSelect(props) {
3495
+ const { field, value, onChange, disabled, id, components } = props;
3496
+ const ctx = useParameterComponents();
3497
+ const resolved = resolveParameterComponents(components, ctx);
3498
+ const CustomSelect = resolved.select;
3428
3499
  const options = (0, import_parameters.getChoiceOptions)(field);
3429
3500
  const off = disabled || field.readOnly;
3430
3501
  if (field.control === "segmented") {
3431
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { role: "radiogroup", "aria-label": (0, import_parameters.parameterLabel)(field), className: "inline-flex flex-wrap rounded-md border border-input bg-muted p-0.5", children: options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
3502
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { role: "radiogroup", "aria-label": (0, import_parameters.parameterLabel)(field), className: "inline-flex flex-wrap rounded-md border border-input bg-muted p-0.5", children: options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3432
3503
  "button",
3433
3504
  {
3434
3505
  type: "button",
@@ -3443,8 +3514,25 @@ function ParameterSelect({ field, value, onChange, disabled, id }) {
3443
3514
  String(o.value)
3444
3515
  )) });
3445
3516
  }
3517
+ if (CustomSelect) {
3518
+ const customOptions = options.map((o) => ({ value: o.value, label: (0, import_parameters.choiceOptionLabel)(o), description: o.description }));
3519
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3520
+ CustomSelect,
3521
+ {
3522
+ id,
3523
+ label: (0, import_parameters.parameterLabel)(field),
3524
+ "aria-label": (0, import_parameters.parameterLabel)(field),
3525
+ value,
3526
+ options: customOptions,
3527
+ disabled: off,
3528
+ className: parameterInputClass,
3529
+ style: parameterSelectStyle,
3530
+ onChange: (v) => onChange((0, import_parameters.matchParameterOptionValue)(options, v))
3531
+ }
3532
+ );
3533
+ }
3446
3534
  const index = options.findIndex((o) => o.value === value);
3447
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
3535
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3448
3536
  "select",
3449
3537
  {
3450
3538
  id,
@@ -3456,22 +3544,24 @@ function ParameterSelect({ field, value, onChange, disabled, id }) {
3456
3544
  if (option) onChange(option.value);
3457
3545
  },
3458
3546
  className: parameterInputClass,
3459
- children: options.map((o, i) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("option", { value: String(i), title: o.description, children: (0, import_parameters.choiceOptionLabel)(o) }, String(o.value)))
3547
+ style: parameterSelectStyle,
3548
+ children: options.map((o, i) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: String(i), title: o.description, style: parameterSelectStyle, children: (0, import_parameters.choiceOptionLabel)(o) }, String(o.value)))
3460
3549
  }
3461
3550
  );
3462
3551
  }
3463
- function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd, disabled, id }) {
3464
- const [open, setOpen] = (0, import_react18.useState)(false);
3465
- const containerRef = (0, import_react18.useRef)(null);
3466
- const buttonRef = (0, import_react18.useRef)(null);
3467
- const popoverRef = (0, import_react18.useRef)(null);
3552
+ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd, disabled, id, components }) {
3553
+ const CustomColor = resolveParameterComponents(components, useParameterComponents()).color;
3554
+ const [open, setOpen] = (0, import_react19.useState)(false);
3555
+ const containerRef = (0, import_react19.useRef)(null);
3556
+ const buttonRef = (0, import_react19.useRef)(null);
3557
+ const popoverRef = (0, import_react19.useRef)(null);
3468
3558
  const alpha = !!field.alpha;
3469
3559
  const hex = (0, import_parameters.normalizeHexColor)(value, true) ?? "#000000ff";
3470
3560
  const rgb = hex.slice(0, 7);
3471
3561
  const shown = alpha ? hex : rgb;
3472
3562
  const off = disabled || field.readOnly;
3473
3563
  const name = (0, import_parameters.parameterLabel)(field);
3474
- (0, import_react18.useEffect)(() => {
3564
+ (0, import_react19.useEffect)(() => {
3475
3565
  if (!open) return;
3476
3566
  const onPointerDown = (e) => {
3477
3567
  if (containerRef.current && !containerRef.current.contains(e.target)) {
@@ -3492,9 +3582,25 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
3492
3582
  window.removeEventListener("keydown", onKeyDown, true);
3493
3583
  };
3494
3584
  }, [open]);
3495
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { ref: containerRef, className: "relative space-y-1.5", children: [
3496
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex items-center gap-2", children: [
3497
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
3585
+ if (CustomColor) {
3586
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3587
+ CustomColor,
3588
+ {
3589
+ id,
3590
+ value: shown,
3591
+ alpha,
3592
+ swatches: field.swatches,
3593
+ disabled: off,
3594
+ label: name,
3595
+ onChange,
3596
+ onGestureStart,
3597
+ onGestureEnd
3598
+ }
3599
+ );
3600
+ }
3601
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { ref: containerRef, className: "relative space-y-1.5", children: [
3602
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex items-center gap-2", children: [
3603
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3498
3604
  "button",
3499
3605
  {
3500
3606
  ref: buttonRef,
@@ -3505,10 +3611,10 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
3505
3611
  disabled: off,
3506
3612
  onClick: () => setOpen((prev) => !prev),
3507
3613
  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",
3508
- children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "absolute inset-0", style: { background: shown } })
3614
+ children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "absolute inset-0", style: { background: shown } })
3509
3615
  }
3510
3616
  ),
3511
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
3617
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3512
3618
  ParameterCommitInput,
3513
3619
  {
3514
3620
  id,
@@ -3524,7 +3630,7 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
3524
3630
  }
3525
3631
  )
3526
3632
  ] }),
3527
- open && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
3633
+ open && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3528
3634
  "div",
3529
3635
  {
3530
3636
  ref: popoverRef,
@@ -3538,7 +3644,7 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
3538
3644
  },
3539
3645
  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",
3540
3646
  style: { background: "var(--popover, var(--background, #fff))" },
3541
- children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
3647
+ children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3542
3648
  ColorPicker,
3543
3649
  {
3544
3650
  value: shown,
@@ -3554,13 +3660,13 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
3554
3660
  )
3555
3661
  ] });
3556
3662
  }
3557
- function ParameterVector({ field, value, onChange, disabled, id }) {
3663
+ function ParameterVector({ field, value, onChange, disabled, id, components }) {
3558
3664
  const size = (0, import_parameters.vectorSize)(field);
3559
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "grid gap-1.5", style: { gridTemplateColumns: `repeat(${size}, minmax(0, 1fr))` }, children: Array.from({ length: size }, (_, i) => {
3665
+ 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) => {
3560
3666
  const component = (0, import_parameters.vectorComponentField)(field, i);
3561
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("label", { className: "flex min-w-0 items-center gap-1", children: [
3562
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "w-3 shrink-0 text-[10px] uppercase text-muted-foreground", children: component.label }),
3563
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
3667
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: "flex min-w-0 items-center gap-1", children: [
3668
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "w-3 shrink-0 text-[10px] uppercase text-muted-foreground", children: component.label }),
3669
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3564
3670
  ParameterNumberInput,
3565
3671
  {
3566
3672
  field: component,
@@ -3568,6 +3674,7 @@ function ParameterVector({ field, value, onChange, disabled, id }) {
3568
3674
  id: i === 0 ? id : void 0,
3569
3675
  "aria-label": `${(0, import_parameters.parameterLabel)(field)} ${component.label}`,
3570
3676
  disabled: disabled || field.readOnly,
3677
+ components,
3571
3678
  onChange: (n) => onChange(Array.from({ length: size }, (_2, j) => j === i ? n : value[j] ?? 0))
3572
3679
  }
3573
3680
  )
@@ -3577,11 +3684,11 @@ function ParameterVector({ field, value, onChange, disabled, id }) {
3577
3684
  function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
3578
3685
  const off = disabled || field.readOnly;
3579
3686
  const name = (0, import_parameters.parameterLabel)(field);
3580
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "space-y-1.5", children: [
3581
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex items-center gap-2", children: [
3582
- /* @__PURE__ */ (0, import_jsx_runtime15.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_runtime15.jsx)("img", { src: value, alt: name, className: "h-full w-full object-cover" }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "None" }) }),
3583
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
3584
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
3687
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "space-y-1.5", children: [
3688
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex items-center gap-2", children: [
3689
+ /* @__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" }) }),
3690
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
3691
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3585
3692
  ParameterCommitInput,
3586
3693
  {
3587
3694
  id,
@@ -3592,30 +3699,48 @@ function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
3592
3699
  onCommit: (text) => onChange(text.trim())
3593
3700
  }
3594
3701
  ),
3595
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex gap-1", children: [
3596
- resolveFile && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("label", { className: `${parameterButtonClass} cursor-pointer ${off ? "pointer-events-none opacity-50" : ""}`, children: [
3597
- "Choose file\u2026",
3598
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
3599
- "input",
3600
- {
3601
- type: "file",
3602
- className: "sr-only",
3603
- accept: field.accept ?? "image/*",
3604
- disabled: off,
3605
- "aria-label": `${name} file`,
3606
- onChange: async (e) => {
3607
- const file = e.target.files?.[0];
3608
- e.target.value = "";
3609
- if (file) onChange(await resolveFile(file));
3610
- }
3611
- }
3612
- )
3613
- ] }),
3614
- value && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: parameterButtonClass, disabled: off, onClick: () => onChange(""), "aria-label": `Clear ${name}`, children: "Clear" })
3702
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex gap-1", children: [
3703
+ resolveFile && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
3704
+ "label",
3705
+ {
3706
+ style: parameterButtonStyle,
3707
+ className: `${parameterButtonClass} cursor-pointer ${off ? "pointer-events-none opacity-50" : ""}`,
3708
+ children: [
3709
+ "Choose file\u2026",
3710
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3711
+ "input",
3712
+ {
3713
+ type: "file",
3714
+ className: "sr-only",
3715
+ accept: field.accept ?? "image/*",
3716
+ disabled: off,
3717
+ "aria-label": `${name} file`,
3718
+ onChange: async (e) => {
3719
+ const file = e.target.files?.[0];
3720
+ e.target.value = "";
3721
+ if (file) onChange(await resolveFile(file));
3722
+ }
3723
+ }
3724
+ )
3725
+ ]
3726
+ }
3727
+ ),
3728
+ value && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3729
+ "button",
3730
+ {
3731
+ type: "button",
3732
+ style: parameterButtonStyle,
3733
+ className: parameterButtonClass,
3734
+ disabled: off,
3735
+ onClick: () => onChange(""),
3736
+ "aria-label": `Clear ${name}`,
3737
+ children: "Clear"
3738
+ }
3739
+ )
3615
3740
  ] })
3616
3741
  ] })
3617
3742
  ] }),
3618
- field.options && field.options.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "flex flex-wrap gap-1", children: field.options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
3743
+ field.options && field.options.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "flex flex-wrap gap-1", children: field.options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3619
3744
  "button",
3620
3745
  {
3621
3746
  type: "button",
@@ -3625,14 +3750,14 @@ function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
3625
3750
  disabled: off,
3626
3751
  onClick: () => onChange(o.url),
3627
3752
  className: "h-9 w-12 overflow-hidden rounded border border-input aria-pressed:ring-2 aria-pressed:ring-primary",
3628
- children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("img", { src: o.url, alt: "", className: "h-full w-full object-cover" })
3753
+ children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("img", { src: o.url, alt: "", className: "h-full w-full object-cover" })
3629
3754
  },
3630
3755
  o.url
3631
3756
  )) })
3632
3757
  ] });
3633
3758
  }
3634
3759
  function ParameterText({ field, value, onChange, disabled, id }) {
3635
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
3760
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3636
3761
  ParameterCommitInput,
3637
3762
  {
3638
3763
  id,
@@ -3651,24 +3776,24 @@ function ParameterFieldControl({ field, value, onChange, resolveFile, ...rest })
3651
3776
  switch (field.type) {
3652
3777
  case "number":
3653
3778
  case "int":
3654
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ParameterSlider, { field, value, onChange: set, ...rest });
3779
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ParameterSlider, { field, value, onChange: set, ...rest });
3655
3780
  case "boolean":
3656
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ParameterToggle, { field, value, onChange: set, ...rest });
3781
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ParameterToggle, { field, value, onChange: set, ...rest });
3657
3782
  case "choice":
3658
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ParameterSelect, { field, value, onChange: set, ...rest });
3783
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ParameterSelect, { field, value, onChange: set, ...rest });
3659
3784
  case "color":
3660
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ParameterColor, { field, value, onChange: set, ...rest });
3785
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ParameterColor, { field, value, onChange: set, ...rest });
3661
3786
  case "vector":
3662
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ParameterVector, { field, value, onChange: set, ...rest });
3787
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ParameterVector, { field, value, onChange: set, ...rest });
3663
3788
  case "image":
3664
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ParameterImage, { field, value, onChange: set, resolveFile, ...rest });
3789
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ParameterImage, { field, value, onChange: set, resolveFile, ...rest });
3665
3790
  case "text":
3666
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ParameterText, { field, value, onChange: set, ...rest });
3791
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ParameterText, { field, value, onChange: set, ...rest });
3667
3792
  }
3668
3793
  }
3669
3794
 
3670
3795
  // src/effects/EffectParameters.tsx
3671
- var import_jsx_runtime16 = require("react/jsx-runtime");
3796
+ var import_jsx_runtime17 = require("react/jsx-runtime");
3672
3797
  function EffectParameters({
3673
3798
  description,
3674
3799
  values,
@@ -3680,56 +3805,75 @@ function EffectParameters({
3680
3805
  renderControlAddon,
3681
3806
  fonts,
3682
3807
  disabled = false,
3683
- className = ""
3808
+ className = "",
3809
+ components
3684
3810
  }) {
3685
- const fields = (0, import_react19.useMemo)(() => (0, import_effects3.effectParameterFields)(description, { fonts }), [description, fonts]);
3686
- const idBase = (0, import_react19.useId)();
3687
- const gesture = import_react19.default.useRef(null);
3688
- const count = import_react19.default.useRef(0);
3689
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: `space-y-2 ${className}`, "data-effect-parameters": description.id, children: [
3690
- (onPreset || onPresetName) && description.presets.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
3811
+ const fields = (0, import_react20.useMemo)(() => (0, import_effects3.effectParameterFields)(description, { fonts }), [description, fonts]);
3812
+ const idBase = (0, import_react20.useId)();
3813
+ const gesture = import_react20.default.useRef(null);
3814
+ const count = import_react20.default.useRef(0);
3815
+ const CustomPresetSelect = resolveParameterComponents(components, useParameterComponents()).select;
3816
+ const handlePresetSelect = (name) => {
3817
+ if (!name) return;
3818
+ if (onPresetName) {
3819
+ onPresetName(name);
3820
+ } else if (onPreset) {
3821
+ const preset = description.presets.find((p) => p.name === name);
3822
+ if (preset) onPreset({ ...description.defaults, ...preset.values });
3823
+ }
3824
+ };
3825
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: `space-y-2 ${className}`, "data-effect-parameters": description.id, children: [
3826
+ (onPreset || onPresetName) && description.presets.length > 0 && (CustomPresetSelect ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3827
+ CustomPresetSelect,
3828
+ {
3829
+ "aria-label": `${description.name} presets`,
3830
+ label: `${description.name} presets`,
3831
+ value: "",
3832
+ disabled,
3833
+ className: "w-full rounded border border-border px-1 py-0.5 text-xs",
3834
+ style: parameterSelectStyle,
3835
+ options: [
3836
+ { value: "", label: "Presets\u2026" },
3837
+ ...description.presets.map((p) => ({ value: p.name, label: p.name }))
3838
+ ],
3839
+ onChange: (name) => handlePresetSelect(String(name))
3840
+ }
3841
+ ) : /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
3691
3842
  "select",
3692
3843
  {
3693
- className: "w-full rounded border border-border bg-transparent px-1 py-0.5 text-xs",
3844
+ className: "w-full rounded border border-border px-1 py-0.5 text-xs",
3845
+ style: parameterSelectStyle,
3694
3846
  "aria-label": `${description.name} presets`,
3695
3847
  value: "",
3696
3848
  disabled,
3697
- onChange: (e) => {
3698
- const name = e.currentTarget.value;
3699
- if (!name) return;
3700
- if (onPresetName) {
3701
- onPresetName(name);
3702
- } else if (onPreset) {
3703
- const preset = description.presets.find((p) => p.name === name);
3704
- if (preset) onPreset({ ...description.defaults, ...preset.values });
3705
- }
3706
- },
3849
+ onChange: (e) => handlePresetSelect(e.currentTarget.value),
3707
3850
  children: [
3708
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: "", children: "Presets\u2026" }),
3709
- description.presets.map((p) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: p.name, children: p.name }, p.name))
3851
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("option", { value: "", style: parameterSelectStyle, children: "Presets\u2026" }),
3852
+ description.presets.map((p) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("option", { value: p.name, style: parameterSelectStyle, children: p.name }, p.name))
3710
3853
  ]
3711
3854
  }
3712
- ),
3855
+ )),
3713
3856
  fields.map((field) => {
3714
3857
  const label = (0, import_parameters2.parameterLabel)(field);
3715
3858
  const inputId = `${idBase}-${field.id}`;
3716
3859
  const keyed = keyframed?.has(field.id) ?? false;
3717
3860
  const value = (0, import_effects3.effectFieldValue)(field, values[field.id]);
3718
3861
  const changed = !keyed && !(0, import_parameters2.parameterValuesEqual)(value, field.default);
3719
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "space-y-1", "data-effect-control": field.id, children: [
3720
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex items-center gap-1.5", children: [
3721
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("label", { htmlFor: inputId, className: "min-w-0 flex-1 truncate text-xs font-medium", title: field.description, children: label }),
3722
- keyed && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "keyframed" }),
3862
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "space-y-1", "data-effect-control": field.id, children: [
3863
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex items-center gap-1.5", children: [
3864
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("label", { htmlFor: inputId, className: "min-w-0 flex-1 truncate text-xs font-medium", title: field.description, children: label }),
3865
+ keyed && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "keyframed" }),
3723
3866
  renderControlAddon?.(field.id),
3724
- onReset && changed && !disabled && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", className: "rounded px-1 text-[11px] text-muted-foreground hover:text-foreground", "aria-label": `Reset ${label}`, onClick: () => onReset(field.id), children: "\u21BA" })
3867
+ 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(field.id), children: "\u21BA" })
3725
3868
  ] }),
3726
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3869
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3727
3870
  ParameterFieldControl,
3728
3871
  {
3729
3872
  field,
3730
3873
  value,
3731
3874
  id: inputId,
3732
3875
  disabled: disabled || keyed,
3876
+ components,
3733
3877
  onChange: (v) => onChange(field.id, v, gesture.current),
3734
3878
  onGestureStart: () => gesture.current = `${idBase}:${field.id}:${++count.current}`,
3735
3879
  onGestureEnd: () => gesture.current = null
@@ -3737,34 +3881,92 @@ function EffectParameters({
3737
3881
  )
3738
3882
  ] }, field.id);
3739
3883
  }),
3740
- !fields.length && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No controls." })
3884
+ !fields.length && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No controls." })
3741
3885
  ] });
3742
3886
  }
3743
3887
 
3888
+ // src/image-editor/controls/parameterControls.tsx
3889
+ var import_parameters3 = require("@pixerate/editor/parameters");
3890
+ var import_jsx_runtime18 = require("react/jsx-runtime");
3891
+ function ImageParameterSlider({ value, min, max, step, label, disabled, className, onChange, onGestureStart, onGestureEnd }) {
3892
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3893
+ ImageRange,
3894
+ {
3895
+ value,
3896
+ min,
3897
+ max,
3898
+ step,
3899
+ label,
3900
+ disabled,
3901
+ className,
3902
+ onChange,
3903
+ onStart: onGestureStart,
3904
+ onEnd: onGestureEnd
3905
+ }
3906
+ );
3907
+ }
3908
+ function ImageParameterSelect({ value, options, label, disabled, className, onChange }) {
3909
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3910
+ ImageSelect,
3911
+ {
3912
+ value: String(value),
3913
+ options: options.map((o) => ({ value: String(o.value), label: o.label })),
3914
+ label,
3915
+ disabled,
3916
+ className,
3917
+ onChange: (v) => onChange((0, import_parameters3.matchParameterOptionValue)(options, v))
3918
+ }
3919
+ );
3920
+ }
3921
+ function ImageParameterColor({ value, alpha, label, disabled, className, onChange, onGestureStart, onGestureEnd }) {
3922
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3923
+ ImageColor,
3924
+ {
3925
+ value,
3926
+ alpha,
3927
+ label,
3928
+ disabled,
3929
+ className,
3930
+ onChange,
3931
+ onStart: onGestureStart,
3932
+ onEnd: onGestureEnd
3933
+ }
3934
+ );
3935
+ }
3936
+ function imageEditorParameterComponents(controls) {
3937
+ return {
3938
+ slider: controls.Range ? ImageParameterSlider : void 0,
3939
+ select: controls.Select ? ImageParameterSelect : void 0,
3940
+ color: controls.Color ? ImageParameterColor : void 0
3941
+ };
3942
+ }
3943
+
3744
3944
  // src/image-editor/ImageEffectControls.tsx
3745
- var import_jsx_runtime17 = require("react/jsx-runtime");
3746
- function ImageEffectControls({ provider, effect, name, values, onChange, onPreset, className }) {
3945
+ var import_jsx_runtime19 = require("react/jsx-runtime");
3946
+ function ImageEffectControls({ provider, effect, name, values, onChange, onPreset, className, components }) {
3747
3947
  const { description, error } = useEffectDescription(provider, effect);
3948
+ const fallback = resolveParameterComponents(useParameterComponents(), imageEditorParameterComponents(useImageEditorControls()));
3949
+ const effectiveComponents = resolveParameterComponents(components, fallback);
3748
3950
  let body;
3749
- if (!provider) body = /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("p", { className: "text-[11px] text-muted-foreground", children: [
3951
+ if (!provider) body = /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("p", { className: "text-[11px] text-muted-foreground", children: [
3750
3952
  'No effects provider: "',
3751
3953
  name ?? effect,
3752
3954
  '" is kept but not drawn.'
3753
3955
  ] });
3754
- else if (error) body = /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "text-[11px] text-amber-600", children: error });
3755
- else if (!description) body = /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "Loading\u2026" });
3756
- else body = /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(EffectParameters, { description, values, onChange, onReset: (k) => onChange(k, description.defaults[k], null), onPreset });
3757
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className, "data-testid": "image-effect-controls", children: body });
3956
+ else if (error) body = /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "text-[11px] text-amber-600", children: error });
3957
+ else if (!description) body = /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "Loading\u2026" });
3958
+ else body = /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(EffectParameters, { description, values, onChange, onReset: (k) => onChange(k, description.defaults[k], null), onPreset, components: effectiveComponents });
3959
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className, "data-testid": "image-effect-controls", children: body });
3758
3960
  }
3759
3961
 
3760
3962
  // src/image-editor/ImageProviderEffectsPanel.tsx
3761
- var import_jsx_runtime18 = require("react/jsx-runtime");
3762
- function ImageProviderEffectsPanel({ controller, className = "" }) {
3763
- const [, setTick] = (0, import_react20.useState)(0);
3764
- (0, import_react20.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
3765
- const [browse, setBrowse] = (0, import_react20.useState)(null);
3766
- const [message, setMessage] = (0, import_react20.useState)(null);
3767
- const [open, setOpen] = (0, import_react20.useState)(null);
3963
+ var import_jsx_runtime20 = require("react/jsx-runtime");
3964
+ function ImageProviderEffectsPanel({ controller, className = "", components }) {
3965
+ const [, setTick] = (0, import_react21.useState)(0);
3966
+ (0, import_react21.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
3967
+ const [browse, setBrowse] = (0, import_react21.useState)(null);
3968
+ const [message, setMessage] = (0, import_react21.useState)(null);
3969
+ const [open, setOpen] = (0, import_react21.useState)(null);
3768
3970
  const provider = controller.effectsProvider;
3769
3971
  const state = controller.getState();
3770
3972
  const layer = state.activeLayerId ? (0, import_image_editor9.findLayer)(state.layers, state.activeLayerId)?.layer ?? null : null;
@@ -3772,7 +3974,7 @@ function ImageProviderEffectsPanel({ controller, className = "" }) {
3772
3974
  setMessage(null);
3773
3975
  Promise.resolve().then(work).catch((e) => setMessage(e instanceof Error ? e.message : String(e)));
3774
3976
  };
3775
- const drags = import_react20.default.useRef(/* @__PURE__ */ new Set());
3977
+ const drags = import_react21.default.useRef(/* @__PURE__ */ new Set());
3776
3978
  const commit = (gesture) => {
3777
3979
  if (gesture) {
3778
3980
  if (!drags.current.has(gesture)) {
@@ -3786,75 +3988,77 @@ function ImageProviderEffectsPanel({ controller, className = "" }) {
3786
3988
  const filters = layer?.type === "smart" ? (layer.smartFilters?.filters ?? []).filter((f) => f.kind === "effect") : [];
3787
3989
  const generator = layer?.type === "pixel" ? layer.generator : void 0;
3788
3990
  const canFilter = !!layer && layer.type !== "adjustment" && layer.type !== "annotation";
3789
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("section", { className: `flex flex-col gap-2 text-xs ${className}`, "aria-label": "Provider effects", "data-image-provider-effects": "", children: [
3790
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center gap-1", children: [
3791
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "flex-1 font-semibold uppercase tracking-wider text-[11px] text-foreground", children: "Effects" }),
3792
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: imageOutlineButtonClass, disabled: !provider || !canFilter, "aria-pressed": browse === "filter", onClick: () => setBrowse(browse === "filter" ? null : "filter"), children: "Apply effect\u2026" }),
3793
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: imageOutlineButtonClass, disabled: !provider, "aria-pressed": browse === "layer", onClick: () => setBrowse(browse === "layer" ? null : "layer"), children: "Effect layer\u2026" })
3991
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("section", { className: `flex flex-col gap-2 text-xs ${className}`, "aria-label": "Provider effects", "data-image-provider-effects": "", children: [
3992
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center gap-1", children: [
3993
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "flex-1 font-semibold uppercase tracking-wider text-[11px] text-foreground", children: "Effects" }),
3994
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", className: imageOutlineButtonClass, disabled: !provider || !canFilter, "aria-pressed": browse === "filter", onClick: () => setBrowse(browse === "filter" ? null : "filter"), children: "Apply effect\u2026" }),
3995
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", className: imageOutlineButtonClass, disabled: !provider, "aria-pressed": browse === "layer", onClick: () => setBrowse(browse === "layer" ? null : "layer"), children: "Effect layer\u2026" })
3794
3996
  ] }),
3795
- !provider && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No effects provider is registered. Effects in the document are kept." }),
3796
- browse === "filter" && layer && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(EffectsBrowser, { provider, uses: ["filter"], title: "Filters", onPick: (e) => (setBrowse(null), run(() => controller.applyEffectFilter(layer.id, e.id))) }),
3797
- browse === "layer" && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(EffectsBrowser, { provider, uses: import_image_editor9.EFFECT_LAYER_USES, title: "Generators and overlays", onPick: (e) => (setBrowse(null), run(() => controller.addEffectLayer(e.id))) }),
3798
- generator && layer && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "space-y-1", "data-effect-part": "generator", children: [
3799
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center gap-1", children: [
3800
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "flex-1 font-medium text-foreground", children: generator.name ?? generator.effect }),
3801
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: imageOutlineButtonClass, title: "Keep the pixels as a plain layer", onClick: () => run(() => controller.rasterizeEffectLayer(layer.id)), children: "Rasterize" })
3997
+ !provider && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No effects provider is registered. Effects in the document are kept." }),
3998
+ browse === "filter" && layer && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(EffectsBrowser, { provider, uses: ["filter"], title: "Filters", onPick: (e) => (setBrowse(null), run(() => controller.applyEffectFilter(layer.id, e.id))) }),
3999
+ browse === "layer" && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(EffectsBrowser, { provider, uses: import_image_editor9.EFFECT_LAYER_USES, title: "Generators and overlays", onPick: (e) => (setBrowse(null), run(() => controller.addEffectLayer(e.id))) }),
4000
+ generator && layer && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "space-y-1", "data-effect-part": "generator", children: [
4001
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center gap-1", children: [
4002
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "flex-1 font-medium text-foreground", children: generator.name ?? generator.effect }),
4003
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", className: imageOutlineButtonClass, title: "Keep the pixels as a plain layer", onClick: () => run(() => controller.rasterizeEffectLayer(layer.id)), children: "Rasterize" })
3802
4004
  ] }),
3803
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
4005
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3804
4006
  ImageEffectControls,
3805
4007
  {
3806
4008
  provider,
3807
4009
  effect: generator.effect,
3808
4010
  name: generator.name,
3809
4011
  values: generator.values,
4012
+ components,
3810
4013
  onChange: (k, v, gesture) => run(() => controller.updateEffectLayer(layer.id, { values: { [k]: v } }, commit(gesture))),
3811
4014
  onPreset: (values) => run(() => controller.updateEffectLayer(layer.id, { values }))
3812
4015
  }
3813
4016
  )
3814
4017
  ] }),
3815
- filters.length > 0 && layer && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("ol", { className: "space-y-1", "data-effect-part": "filters", children: filters.map((f) => {
4018
+ filters.length > 0 && layer && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("ol", { className: "space-y-1", "data-effect-part": "filters", children: filters.map((f) => {
3816
4019
  const label = f.kind === "effect" ? f.name ?? f.effect : f.kind;
3817
4020
  const all = layer.smartFilters.filters;
3818
4021
  const index = all.indexOf(f);
3819
4022
  if (f.kind !== "effect") return null;
3820
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("li", { className: "rounded border border-border p-1", "data-smart-effect": f.id, children: [
3821
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center gap-1", children: [
3822
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("input", { type: "checkbox", checked: f.enabled, "aria-label": `${label} on`, onChange: (e) => {
3823
- const enabled = e.currentTarget.checked;
3824
- run(() => controller.updateEffectFilter(layer.id, f.id, { enabled }));
3825
- } }),
3826
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: "min-w-0 flex-1 truncate text-left text-foreground", "aria-expanded": open === f.id, onClick: () => setOpen(open === f.id ? null : f.id), children: label }),
3827
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: imageOutlineButtonClass, disabled: index === all.length - 1, "aria-label": "Move up", onClick: () => run(() => controller.updateEffectFilter(layer.id, f.id, { index: index + 1 })), children: "\u2191" }),
3828
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: imageOutlineButtonClass, disabled: index === 0, "aria-label": "Move down", onClick: () => run(() => controller.updateEffectFilter(layer.id, f.id, { index: index - 1 })), children: "\u2193" }),
3829
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: imageOutlineButtonClass, "aria-label": `Remove ${label}`, onClick: () => run(() => controller.removeSmartFilter(layer.id, f.id)), children: "\u2715" })
4023
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("li", { className: "rounded border border-border p-1", "data-smart-effect": f.id, children: [
4024
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center gap-1", children: [
4025
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
4026
+ ImageCheckbox,
4027
+ {
4028
+ checked: f.enabled,
4029
+ label: `${label} on`,
4030
+ onChange: (enabled) => run(() => controller.updateEffectFilter(layer.id, f.id, { enabled }))
4031
+ }
4032
+ ),
4033
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", className: "min-w-0 flex-1 truncate text-left text-foreground", "aria-expanded": open === f.id, onClick: () => setOpen(open === f.id ? null : f.id), children: label }),
4034
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", className: imageOutlineButtonClass, disabled: index === all.length - 1, "aria-label": "Move up", onClick: () => run(() => controller.updateEffectFilter(layer.id, f.id, { index: index + 1 })), children: "\u2191" }),
4035
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", className: imageOutlineButtonClass, disabled: index === 0, "aria-label": "Move down", onClick: () => run(() => controller.updateEffectFilter(layer.id, f.id, { index: index - 1 })), children: "\u2193" }),
4036
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", className: imageOutlineButtonClass, "aria-label": `Remove ${label}`, onClick: () => run(() => controller.removeSmartFilter(layer.id, f.id)), children: "\u2715" })
3830
4037
  ] }),
3831
- open === f.id && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "mt-1 space-y-2", children: [
3832
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { className: "flex items-center gap-1", children: [
3833
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "w-14 text-[11px] text-foreground", children: "Opacity" }),
3834
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3835
- "input",
4038
+ open === f.id && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "mt-1 space-y-2", children: [
4039
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { className: "flex items-center gap-1", children: [
4040
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "w-14 text-[11px] text-foreground", children: "Opacity" }),
4041
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
4042
+ ImageRange,
3836
4043
  {
3837
- type: "range",
3838
4044
  min: 0,
3839
4045
  max: 1,
3840
4046
  step: 0.01,
3841
4047
  className: "flex-1",
3842
4048
  value: f.opacity,
3843
- "aria-label": `${label} opacity`,
3844
- onChange: (e) => {
3845
- const opacity = Number(e.currentTarget.value);
3846
- run(() => controller.updateEffectFilter(layer.id, f.id, { opacity }));
3847
- }
4049
+ label: `${label} opacity`,
4050
+ onChange: (opacity) => run(() => controller.updateEffectFilter(layer.id, f.id, { opacity }))
3848
4051
  }
3849
4052
  )
3850
4053
  ] }),
3851
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
4054
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3852
4055
  ImageEffectControls,
3853
4056
  {
3854
4057
  provider,
3855
4058
  effect: f.effect,
3856
4059
  name: f.name,
3857
4060
  values: f.values,
4061
+ components,
3858
4062
  onChange: (k, v, gesture) => run(() => controller.updateEffectFilter(layer.id, f.id, { values: { [k]: v } }, commit(gesture))),
3859
4063
  onPreset: (values) => run(() => controller.updateEffectFilter(layer.id, f.id, { values }))
3860
4064
  }
@@ -3862,13 +4066,13 @@ function ImageProviderEffectsPanel({ controller, className = "" }) {
3862
4066
  ] })
3863
4067
  ] }, f.id);
3864
4068
  }) }),
3865
- !layer && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "Select a layer to apply effects to it." }),
3866
- message && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { role: "alert", className: "text-[11px] text-destructive", children: message })
4069
+ !layer && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "Select a layer to apply effects to it." }),
4070
+ message && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { role: "alert", className: "text-[11px] text-destructive", children: message })
3867
4071
  ] });
3868
4072
  }
3869
4073
 
3870
4074
  // src/image-editor/BrushOptionsBar.tsx
3871
- var import_react22 = require("react");
4075
+ var import_react23 = require("react");
3872
4076
  var import_image_editor11 = require("@pixerate/editor/image-editor");
3873
4077
  var import_image_editor12 = require("@pixerate/editor/image-editor");
3874
4078
 
@@ -3876,8 +4080,8 @@ var import_image_editor12 = require("@pixerate/editor/image-editor");
3876
4080
  var import_image_editor10 = require("@pixerate/editor/image-editor");
3877
4081
 
3878
4082
  // src/paint-editor/PaintGradientEditorView.tsx
3879
- var import_react21 = require("react");
3880
- var import_jsx_runtime19 = require("react/jsx-runtime");
4083
+ var import_react22 = require("react");
4084
+ var import_jsx_runtime21 = require("react/jsx-runtime");
3881
4085
  var button = "px-2 py-1 rounded text-[11px] bg-slate-800 text-slate-200 hover:bg-slate-700 disabled:opacity-40";
3882
4086
  var select = "rounded bg-slate-800 px-1 py-0.5 text-[11px]";
3883
4087
  var number = "w-16 rounded bg-slate-800 px-1 py-0.5 text-[11px]";
@@ -3898,7 +4102,7 @@ var PaintGradientEditorView = ({ value, onChange, colors, className, kit }) => {
3898
4102
  reversePaintGradient,
3899
4103
  updatePaintGradientStop
3900
4104
  } = kit;
3901
- const [selected, setSelected] = (0, import_react21.useState)(0);
4105
+ const [selected, setSelected] = (0, import_react22.useState)(0);
3902
4106
  const sel = Math.min(selected, value.stops.length - 1);
3903
4107
  const stop = value.stops[sel];
3904
4108
  const map = value.map;
@@ -3908,15 +4112,15 @@ var PaintGradientEditorView = ({ value, onChange, colors, className, kit }) => {
3908
4112
  setSelected(r.index);
3909
4113
  onChange(r.paint);
3910
4114
  };
3911
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: `flex flex-col gap-1.5 text-xs text-slate-200 ${className ?? ""}`, "data-testid": "paint-gradient-editor", "aria-label": "Gradient paint", children: [
3912
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center gap-1", children: [
3913
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("select", { "aria-label": "Gradient preset", className: select, value: "", onChange: (e) => e.target.value && (setSelected(0), onChange(PAINT_GRADIENT_PRESETS[Number(e.target.value)].paint)), children: [
3914
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: "", children: "Presets\u2026" }),
3915
- PAINT_GRADIENT_PRESETS.map((p, i) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: i, children: p.name }, p.name))
4115
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: `flex flex-col gap-1.5 text-xs text-slate-200 ${className ?? ""}`, "data-testid": "paint-gradient-editor", "aria-label": "Gradient paint", children: [
4116
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-1", children: [
4117
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("select", { "aria-label": "Gradient preset", className: select, value: "", onChange: (e) => e.target.value && (setSelected(0), onChange(PAINT_GRADIENT_PRESETS[Number(e.target.value)].paint)), children: [
4118
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("option", { value: "", children: "Presets\u2026" }),
4119
+ PAINT_GRADIENT_PRESETS.map((p, i) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("option", { value: i, children: p.name }, p.name))
3916
4120
  ] }),
3917
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", className: button, onClick: () => onChange(reversePaintGradient(value)), children: "Reverse" })
4121
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", className: button, onClick: () => onChange(reversePaintGradient(value)), children: "Reverse" })
3918
4122
  ] }),
3919
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
4123
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3920
4124
  "div",
3921
4125
  {
3922
4126
  role: "slider",
@@ -3938,7 +4142,7 @@ var PaintGradientEditorView = ({ value, onChange, colors, className, kit }) => {
3938
4142
  }
3939
4143
  }
3940
4144
  ),
3941
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "relative h-4", "aria-label": "Stops", children: value.stops.map((s, i) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
4145
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "relative h-4", "aria-label": "Stops", children: value.stops.map((s, i) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3942
4146
  "button",
3943
4147
  {
3944
4148
  type: "button",
@@ -3950,63 +4154,63 @@ var PaintGradientEditorView = ({ value, onChange, colors, className, kit }) => {
3950
4154
  },
3951
4155
  i
3952
4156
  )) }),
3953
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex flex-wrap items-center gap-1", "data-testid": "paint-gradient-stop", children: [
3954
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("select", { "aria-label": "Stop colour source", className: select, value: stop.color === "paint" || stop.color === "secondary" ? stop.color : "color", onChange: (e) => patchStop({ color: e.target.value === "color" ? stopHex(stop.color) : e.target.value }), children: [
3955
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: "color", children: "Colour" }),
3956
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: "paint", children: "Paint colour" }),
3957
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: "secondary", children: "Second colour" })
4157
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-wrap items-center gap-1", "data-testid": "paint-gradient-stop", children: [
4158
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("select", { "aria-label": "Stop colour source", className: select, value: stop.color === "paint" || stop.color === "secondary" ? stop.color : "color", onChange: (e) => patchStop({ color: e.target.value === "color" ? stopHex(stop.color) : e.target.value }), children: [
4159
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("option", { value: "color", children: "Colour" }),
4160
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("option", { value: "paint", children: "Paint colour" }),
4161
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("option", { value: "secondary", children: "Second colour" })
3958
4162
  ] }),
3959
- stop.color !== "paint" && stop.color !== "secondary" && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("input", { type: "color", "aria-label": "Stop colour", value: stop.color, onChange: (e) => patchStop({ color: e.target.value }), className: "h-6 w-8 rounded bg-transparent" }),
3960
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("label", { className: "flex items-center gap-1", children: [
4163
+ stop.color !== "paint" && stop.color !== "secondary" && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("input", { type: "color", "aria-label": "Stop colour", value: stop.color, onChange: (e) => patchStop({ color: e.target.value }), className: "h-6 w-8 rounded bg-transparent" }),
4164
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center gap-1", children: [
3961
4165
  "At",
3962
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("input", { type: "number", "aria-label": "Stop position", min: 0, max: 100, step: 1, value: pct(stop.offset), onChange: (e) => patchStop({ offset: Number(e.target.value) / 100 }), className: number }),
4166
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("input", { type: "number", "aria-label": "Stop position", min: 0, max: 100, step: 1, value: pct(stop.offset), onChange: (e) => patchStop({ offset: Number(e.target.value) / 100 }), className: number }),
3963
4167
  "%"
3964
4168
  ] }),
3965
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("label", { className: "flex items-center gap-1", children: [
4169
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center gap-1", children: [
3966
4170
  "Opacity",
3967
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("input", { type: "number", "aria-label": "Stop opacity", min: 0, max: 100, step: 5, value: pct(stop.opacity ?? 1), onChange: (e) => patchStop({ opacity: Number(e.target.value) / 100 }), className: number }),
4171
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("input", { type: "number", "aria-label": "Stop opacity", min: 0, max: 100, step: 5, value: pct(stop.opacity ?? 1), onChange: (e) => patchStop({ opacity: Number(e.target.value) / 100 }), className: number }),
3968
4172
  "%"
3969
4173
  ] }),
3970
- sel < value.stops.length - 1 && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("label", { className: "flex items-center gap-1", children: [
4174
+ sel < value.stops.length - 1 && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center gap-1", children: [
3971
4175
  "Midpoint",
3972
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("input", { type: "number", "aria-label": "Stop midpoint", min: 5, max: 95, step: 1, value: pct(stop.midpoint ?? 0.5), onChange: (e) => patchStop({ midpoint: Number(e.target.value) / 100 }), className: number }),
4176
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("input", { type: "number", "aria-label": "Stop midpoint", min: 5, max: 95, step: 1, value: pct(stop.midpoint ?? 0.5), onChange: (e) => patchStop({ midpoint: Number(e.target.value) / 100 }), className: number }),
3973
4177
  "%"
3974
4178
  ] }),
3975
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", className: button, disabled: value.stops.length <= 2, onClick: () => (setSelected(Math.max(0, sel - 1)), onChange(removePaintGradientStop(value, sel))), children: "Remove stop" })
4179
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", className: button, disabled: value.stops.length <= 2, onClick: () => (setSelected(Math.max(0, sel - 1)), onChange(removePaintGradientStop(value, sel))), children: "Remove stop" })
3976
4180
  ] }),
3977
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex flex-wrap items-center gap-1", "data-testid": "paint-gradient-mapping", children: [
3978
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("select", { "aria-label": "Gradient follows", className: select, value: map.by, onChange: (e) => onChange({ ...value, map: paintGradientMappingFor(e.target.value, map) }), children: PAINT_GRADIENT_MAPPINGS.map((m) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: m, children: PAINT_GRADIENT_MAPPING_LABELS[m] }, m)) }),
3979
- map.by === "distance" && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
3980
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("input", { type: "number", "aria-label": "Gradient length", min: 1, max: 1e5, value: map.length, onChange: (e) => onChange({ ...value, map: { ...map, length: Math.max(1, Number(e.target.value) || 1) } }), className: number }),
3981
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("select", { "aria-label": "Gradient length unit", className: select, value: map.unit ?? "px", onChange: (e) => onChange({ ...value, map: { ...map, unit: e.target.value } }), children: [
3982
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: "px", children: "px" }),
3983
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: "dabs", children: "dabs" })
4181
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-wrap items-center gap-1", "data-testid": "paint-gradient-mapping", children: [
4182
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("select", { "aria-label": "Gradient follows", className: select, value: map.by, onChange: (e) => onChange({ ...value, map: paintGradientMappingFor(e.target.value, map) }), children: PAINT_GRADIENT_MAPPINGS.map((m) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("option", { value: m, children: PAINT_GRADIENT_MAPPING_LABELS[m] }, m)) }),
4183
+ map.by === "distance" && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
4184
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("input", { type: "number", "aria-label": "Gradient length", min: 1, max: 1e5, value: map.length, onChange: (e) => onChange({ ...value, map: { ...map, length: Math.max(1, Number(e.target.value) || 1) } }), className: number }),
4185
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("select", { "aria-label": "Gradient length unit", className: select, value: map.unit ?? "px", onChange: (e) => onChange({ ...value, map: { ...map, unit: e.target.value } }), children: [
4186
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("option", { value: "px", children: "px" }),
4187
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("option", { value: "dabs", children: "dabs" })
3984
4188
  ] })
3985
4189
  ] }),
3986
- map.by === "time" && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("input", { type: "number", "aria-label": "Gradient duration", min: 1, max: 6e5, value: map.duration, onChange: (e) => onChange({ ...value, map: { ...map, duration: Math.max(1, Number(e.target.value) || 1) } }), className: number }),
3987
- map.by === "random" && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("input", { type: "number", "aria-label": "Dabs per pick", min: 1, max: 500, value: map.every ?? 1, onChange: (e) => onChange({ ...value, map: { ...map, every: Math.max(1, Math.round(Number(e.target.value) || 1)) } }), className: number }),
3988
- (map.by === "distance" || map.by === "time") && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("select", { "aria-label": "Gradient repeat", className: select, value: map.repeat ?? "clamp", onChange: (e) => onChange({ ...value, map: { ...map, repeat: e.target.value } }), children: PAINT_GRADIENT_REPEATS.map((r) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: r, children: PAINT_GRADIENT_REPEAT_LABELS[r] }, r)) })
4190
+ map.by === "time" && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("input", { type: "number", "aria-label": "Gradient duration", min: 1, max: 6e5, value: map.duration, onChange: (e) => onChange({ ...value, map: { ...map, duration: Math.max(1, Number(e.target.value) || 1) } }), className: number }),
4191
+ map.by === "random" && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("input", { type: "number", "aria-label": "Dabs per pick", min: 1, max: 500, value: map.every ?? 1, onChange: (e) => onChange({ ...value, map: { ...map, every: Math.max(1, Math.round(Number(e.target.value) || 1)) } }), className: number }),
4192
+ (map.by === "distance" || map.by === "time") && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("select", { "aria-label": "Gradient repeat", className: select, value: map.repeat ?? "clamp", onChange: (e) => onChange({ ...value, map: { ...map, repeat: e.target.value } }), children: PAINT_GRADIENT_REPEATS.map((r) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("option", { value: r, children: PAINT_GRADIENT_REPEAT_LABELS[r] }, r)) })
3989
4193
  ] }),
3990
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center gap-1", children: [
3991
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("select", { "aria-label": "Gradient mixing", className: select, value: value.space, onChange: (e) => onChange({ ...value, space: e.target.value }), children: PAINT_GRADIENT_SPACES.map((s) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: s, children: PAINT_GRADIENT_SPACE_LABELS[s] }, s)) }),
3992
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("label", { className: "flex flex-1 items-center gap-1", children: [
4194
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-1", children: [
4195
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("select", { "aria-label": "Gradient mixing", className: select, value: value.space, onChange: (e) => onChange({ ...value, space: e.target.value }), children: PAINT_GRADIENT_SPACES.map((s) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("option", { value: s, children: PAINT_GRADIENT_SPACE_LABELS[s] }, s)) }),
4196
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex flex-1 items-center gap-1", children: [
3993
4197
  "Softness",
3994
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("input", { type: "range", "aria-label": "Gradient softness", min: 0, max: 1, step: 0.05, value: value.softness ?? 1, onChange: (e) => onChange({ ...value, softness: Number(e.target.value) }), className: "flex-1 accent-indigo-500" })
4198
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("input", { type: "range", "aria-label": "Gradient softness", min: 0, max: 1, step: 0.05, value: value.softness ?? 1, onChange: (e) => onChange({ ...value, softness: Number(e.target.value) }), className: "flex-1 accent-indigo-500" })
3995
4199
  ] })
3996
4200
  ] })
3997
4201
  ] });
3998
4202
  };
3999
4203
 
4000
4204
  // src/image-editor/PaintGradientEditor.tsx
4001
- var import_jsx_runtime20 = require("react/jsx-runtime");
4002
- var PaintGradientEditor = (props) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(PaintGradientEditorView, { ...props, kit: import_image_editor10.PAINT_GRADIENT_KIT });
4205
+ var import_jsx_runtime22 = require("react/jsx-runtime");
4206
+ var PaintGradientEditor = (props) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(PaintGradientEditorView, { ...props, kit: import_image_editor10.PAINT_GRADIENT_KIT });
4003
4207
 
4004
4208
  // src/image-editor/BrushOptionsBar.tsx
4005
- var import_jsx_runtime21 = require("react/jsx-runtime");
4209
+ var import_jsx_runtime23 = require("react/jsx-runtime");
4006
4210
  var BrushOptionsBar = ({ controller, className }) => {
4007
- const [, setTick] = (0, import_react22.useState)(0);
4008
- (0, import_react22.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
4009
- const [error, setError] = (0, import_react22.useState)(null);
4211
+ const [, setTick] = (0, import_react23.useState)(0);
4212
+ (0, import_react23.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
4213
+ const [error, setError] = (0, import_react23.useState)(null);
4010
4214
  const state = controller.getState();
4011
4215
  const { brush, foreground, background, mixer, mixerLoad, retouch, cloneSource, paint } = state.paint;
4012
4216
  const tool = state.activeTool;
@@ -4018,8 +4222,8 @@ var BrushOptionsBar = ({ controller, className }) => {
4018
4222
  setError((0, import_image_editor12.userErrorMessage)(err));
4019
4223
  }
4020
4224
  };
4021
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "brush-options", children: [
4022
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Paint tools", children: import_image_editor11.PAINT_TOOLS.map((t) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4225
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "brush-options", children: [
4226
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Paint tools", children: import_image_editor11.PAINT_TOOLS.map((t) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
4023
4227
  "button",
4024
4228
  {
4025
4229
  type: "button",
@@ -4031,36 +4235,18 @@ var BrushOptionsBar = ({ controller, className }) => {
4031
4235
  },
4032
4236
  t.id
4033
4237
  )) }),
4034
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-2", role: "group", "aria-label": "Colours", children: [
4035
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center gap-1", children: [
4036
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4037
- "input",
4038
- {
4039
- type: "color",
4040
- "aria-label": "Foreground colour",
4041
- value: foreground,
4042
- onChange: (e) => controller.setPaintOptions({ foreground: e.target.value }),
4043
- className: imageColorInputClass
4044
- }
4045
- ),
4046
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-muted-foreground", children: "FG" })
4238
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex items-center gap-2", role: "group", "aria-label": "Colours", children: [
4239
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { className: "flex items-center gap-1", children: [
4240
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ImageColor, { label: "Foreground colour", value: foreground, onChange: (fg) => controller.setPaintOptions({ foreground: fg }) }),
4241
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "text-muted-foreground", children: "FG" })
4047
4242
  ] }),
4048
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center gap-1", children: [
4049
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4050
- "input",
4051
- {
4052
- type: "color",
4053
- "aria-label": "Background colour",
4054
- value: background,
4055
- onChange: (e) => controller.setPaintOptions({ background: e.target.value }),
4056
- className: imageColorInputClass
4057
- }
4058
- ),
4059
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-muted-foreground", children: "BG" })
4243
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { className: "flex items-center gap-1", children: [
4244
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ImageColor, { label: "Background colour", value: background, onChange: (bg) => controller.setPaintOptions({ background: bg }) }),
4245
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "text-muted-foreground", children: "BG" })
4060
4246
  ] }),
4061
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", title: "Swap colours (X)", className: imageChipClass(false), onClick: () => controller.swapPaintColors(), children: "Swap" }),
4062
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", title: "Default colours (D)", className: imageChipClass(false), onClick: () => controller.resetPaintColors(), children: "Default" }),
4063
- state.activeTool === "brush" && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4247
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { type: "button", title: "Swap colours (X)", className: imageChipClass(false), onClick: () => controller.swapPaintColors(), children: "Swap" }),
4248
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { type: "button", title: "Default colours (D)", className: imageChipClass(false), onClick: () => controller.resetPaintColors(), children: "Default" }),
4249
+ state.activeTool === "brush" && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
4064
4250
  "button",
4065
4251
  {
4066
4252
  type: "button",
@@ -4072,8 +4258,8 @@ var BrushOptionsBar = ({ controller, className }) => {
4072
4258
  }
4073
4259
  )
4074
4260
  ] }),
4075
- state.activeTool === "brush" && paint.type === "gradient" && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(PaintGradientEditor, { value: paint, colors: { paint: foreground, secondary: background }, onChange: (g) => attempt(() => controller.setPaintOptions({ paint: g })) }),
4076
- import_image_editor11.BRUSH_OPTION_CONTROLS.map((spec) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4261
+ state.activeTool === "brush" && paint.type === "gradient" && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(PaintGradientEditor, { value: paint, colors: { paint: foreground, secondary: background }, onChange: (g) => attempt(() => controller.setPaintOptions({ paint: g })) }),
4262
+ import_image_editor11.BRUSH_OPTION_CONTROLS.map((spec) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
4077
4263
  ControlSlider,
4078
4264
  {
4079
4265
  spec,
@@ -4082,9 +4268,9 @@ var BrushOptionsBar = ({ controller, className }) => {
4082
4268
  },
4083
4269
  spec.id
4084
4270
  )),
4085
- state.activeTool === "mixer" && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-col gap-2 border-t border-border pt-2", role: "group", "aria-label": "Mixer Brush", "data-testid": "mixer-options", children: [
4086
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-2", children: [
4087
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4271
+ state.activeTool === "mixer" && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-col gap-2 border-t border-border pt-2", role: "group", "aria-label": "Mixer Brush", "data-testid": "mixer-options", children: [
4272
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex items-center gap-2", children: [
4273
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
4088
4274
  "span",
4089
4275
  {
4090
4276
  "aria-label": "Brush load",
@@ -4093,10 +4279,10 @@ var BrushOptionsBar = ({ controller, className }) => {
4093
4279
  style: { background: mixerLoad.reservoir ? (0, import_image_editor11.rgbUnitToHex)(mixerLoad.reservoir) : "transparent" }
4094
4280
  }
4095
4281
  ),
4096
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", title: "Fill the reservoir with the foreground colour", className: imageChipClass(false), onClick: () => controller.loadMixerBrush(), children: "Load brush" }),
4097
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", title: "Empty the picked-up colour", className: imageChipClass(false), onClick: () => controller.cleanMixerBrush(), children: "Clean brush" })
4282
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { type: "button", title: "Fill the reservoir with the foreground colour", className: imageChipClass(false), onClick: () => controller.loadMixerBrush(), children: "Load brush" }),
4283
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { type: "button", title: "Empty the picked-up colour", className: imageChipClass(false), onClick: () => controller.cleanMixerBrush(), children: "Clean brush" })
4098
4284
  ] }),
4099
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "flex gap-1", role: "group", "aria-label": "Mixing", children: import_image_editor11.MIXER_MIXING_OPTIONS.map((m) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4285
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "flex gap-1", role: "group", "aria-label": "Mixing", children: import_image_editor11.MIXER_MIXING_OPTIONS.map((m) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
4100
4286
  "button",
4101
4287
  {
4102
4288
  type: "button",
@@ -4108,34 +4294,34 @@ var BrushOptionsBar = ({ controller, className }) => {
4108
4294
  },
4109
4295
  m.id
4110
4296
  )) }),
4111
- import_image_editor11.MIXER_OPTION_CONTROLS.map((spec) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ControlSlider, { spec, value: mixer[spec.id], onChange: (v) => controller.setPaintOptions({ mixer: { [spec.id]: v } }) }, spec.id)),
4112
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-wrap gap-3 text-foreground", children: [
4113
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center gap-1.5", children: [
4114
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ImageCheckbox, { label: "Load the brush after each stroke", checked: mixer.loadEachStroke, onChange: (on) => controller.setPaintOptions({ mixer: { loadEachStroke: on } }) }),
4297
+ import_image_editor11.MIXER_OPTION_CONTROLS.map((spec) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ControlSlider, { spec, value: mixer[spec.id], onChange: (v) => controller.setPaintOptions({ mixer: { [spec.id]: v } }) }, spec.id)),
4298
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-wrap gap-3 text-foreground", children: [
4299
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { className: "flex items-center gap-1.5", children: [
4300
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ImageCheckbox, { label: "Load the brush after each stroke", checked: mixer.loadEachStroke, onChange: (on) => controller.setPaintOptions({ mixer: { loadEachStroke: on } }) }),
4115
4301
  "Load each stroke"
4116
4302
  ] }),
4117
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center gap-1.5", children: [
4118
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ImageCheckbox, { label: "Clean the brush after each stroke", checked: mixer.cleanEachStroke, onChange: (on) => controller.setPaintOptions({ mixer: { cleanEachStroke: on } }) }),
4303
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { className: "flex items-center gap-1.5", children: [
4304
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ImageCheckbox, { label: "Clean the brush after each stroke", checked: mixer.cleanEachStroke, onChange: (on) => controller.setPaintOptions({ mixer: { cleanEachStroke: on } }) }),
4119
4305
  "Clean each stroke"
4120
4306
  ] })
4121
4307
  ] })
4122
4308
  ] }),
4123
- (0, import_image_editor11.isRetouchPaintTool)(tool) && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-col gap-2 border-t border-border pt-2", role: "group", "aria-label": "Retouch options", "data-testid": "retouch-options", children: [
4124
- (tool === "clone" || tool === "heal") && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-2", children: [
4125
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-muted-foreground", "data-testid": "clone-source", children: (0, import_image_editor11.cloneSourceLabel)(controller) }),
4126
- cloneSource && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", title: "Forget the source point", className: imageChipClass(false), onClick: () => controller.setCloneSource(null), children: "Clear source" })
4309
+ (0, import_image_editor11.isRetouchPaintTool)(tool) && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-col gap-2 border-t border-border pt-2", role: "group", "aria-label": "Retouch options", "data-testid": "retouch-options", children: [
4310
+ (tool === "clone" || tool === "heal") && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex items-center gap-2", children: [
4311
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "text-muted-foreground", "data-testid": "clone-source", children: (0, import_image_editor11.cloneSourceLabel)(controller) }),
4312
+ cloneSource && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { type: "button", title: "Forget the source point", className: imageChipClass(false), onClick: () => controller.setCloneSource(null), children: "Clear source" })
4127
4313
  ] }),
4128
- (tool === "clone" || tool === "heal") && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-col gap-1", role: "group", "aria-label": "Clone source transform", "data-testid": "clone-transform", children: [
4129
- import_image_editor11.CLONE_TRANSFORM_CONTROLS.map((spec) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ControlSlider, { spec, value: (0, import_image_editor11.cloneTransformView)(controller)[spec.id], onChange: (v) => (0, import_image_editor11.setCloneTransformValue)(controller, spec.id, v) }, spec.id)),
4130
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-1", children: [
4131
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", "aria-pressed": (0, import_image_editor11.cloneTransformView)(controller).flipH, title: "Mirror the source left to right", className: imageChipClass((0, import_image_editor11.cloneTransformView)(controller).flipH), onClick: () => (0, import_image_editor11.setCloneTransformValue)(controller, "flipH"), children: "Flip H" }),
4132
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", "aria-pressed": (0, import_image_editor11.cloneTransformView)(controller).flipV, title: "Mirror the source top to bottom", className: imageChipClass((0, import_image_editor11.cloneTransformView)(controller).flipV), onClick: () => (0, import_image_editor11.setCloneTransformValue)(controller, "flipV"), children: "Flip V" }),
4133
- !(0, import_image_editor11.cloneTransformView)(controller).identity && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", title: "Back to 100 %, no flip, 0\xB0", className: imageChipClass(false), onClick: () => controller.setCloneTransform(null), children: "Reset transform" })
4314
+ (tool === "clone" || tool === "heal") && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-col gap-1", role: "group", "aria-label": "Clone source transform", "data-testid": "clone-transform", children: [
4315
+ import_image_editor11.CLONE_TRANSFORM_CONTROLS.map((spec) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ControlSlider, { spec, value: (0, import_image_editor11.cloneTransformView)(controller)[spec.id], onChange: (v) => (0, import_image_editor11.setCloneTransformValue)(controller, spec.id, v) }, spec.id)),
4316
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex items-center gap-1", children: [
4317
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { type: "button", "aria-pressed": (0, import_image_editor11.cloneTransformView)(controller).flipH, title: "Mirror the source left to right", className: imageChipClass((0, import_image_editor11.cloneTransformView)(controller).flipH), onClick: () => (0, import_image_editor11.setCloneTransformValue)(controller, "flipH"), children: "Flip H" }),
4318
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { type: "button", "aria-pressed": (0, import_image_editor11.cloneTransformView)(controller).flipV, title: "Mirror the source top to bottom", className: imageChipClass((0, import_image_editor11.cloneTransformView)(controller).flipV), onClick: () => (0, import_image_editor11.setCloneTransformValue)(controller, "flipV"), children: "Flip V" }),
4319
+ !(0, import_image_editor11.cloneTransformView)(controller).identity && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { type: "button", title: "Back to 100 %, no flip, 0\xB0", className: imageChipClass(false), onClick: () => controller.setCloneTransform(null), children: "Reset transform" })
4134
4320
  ] })
4135
4321
  ] }),
4136
- import_image_editor11.RETOUCH_CHOICES.filter((c) => c.tools.includes(tool)).map((choice) => /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": choice.label, children: [
4137
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-muted-foreground", children: choice.label }),
4138
- choice.options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4322
+ import_image_editor11.RETOUCH_CHOICES.filter((c) => c.tools.includes(tool)).map((choice) => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": choice.label, children: [
4323
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "text-muted-foreground", children: choice.label }),
4324
+ choice.options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
4139
4325
  "button",
4140
4326
  {
4141
4327
  type: "button",
@@ -4148,43 +4334,43 @@ var BrushOptionsBar = ({ controller, className }) => {
4148
4334
  o.id
4149
4335
  ))
4150
4336
  ] }, choice.id)),
4151
- import_image_editor11.RETOUCH_OPTION_CONTROLS.filter((c) => c.tools.includes(tool)).map((spec) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ControlSlider, { spec, value: retouch[spec.id], onChange: (v) => controller.setPaintOptions({ retouch: { [spec.id]: v } }) }, spec.id)),
4152
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "flex flex-wrap gap-3 text-foreground", children: import_image_editor11.RETOUCH_TOGGLES.filter((t) => t.tools.includes(tool)).map((t) => /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center gap-1.5", children: [
4153
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ImageCheckbox, { label: t.label, checked: retouch[t.id], onChange: (on) => controller.setPaintOptions({ retouch: { [t.id]: on } }) }),
4337
+ import_image_editor11.RETOUCH_OPTION_CONTROLS.filter((c) => c.tools.includes(tool)).map((spec) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ControlSlider, { spec, value: retouch[spec.id], onChange: (v) => controller.setPaintOptions({ retouch: { [spec.id]: v } }) }, spec.id)),
4338
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "flex flex-wrap gap-3 text-foreground", children: import_image_editor11.RETOUCH_TOGGLES.filter((t) => t.tools.includes(tool)).map((t) => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { className: "flex items-center gap-1.5", children: [
4339
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ImageCheckbox, { label: t.label, checked: retouch[t.id], onChange: (on) => controller.setPaintOptions({ retouch: { [t.id]: on } }) }),
4154
4340
  t.label
4155
4341
  ] }, t.id)) })
4156
4342
  ] }),
4157
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-wrap gap-3 text-foreground", role: "group", "aria-label": "Pressure", children: [
4158
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center gap-1.5", children: [
4159
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ImageCheckbox, { label: "Pressure controls size", checked: brush.pressureSize, onChange: (on) => controller.setPaintOptions({ brush: { pressureSize: on } }) }),
4343
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-wrap gap-3 text-foreground", role: "group", "aria-label": "Pressure", children: [
4344
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { className: "flex items-center gap-1.5", children: [
4345
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ImageCheckbox, { label: "Pressure controls size", checked: brush.pressureSize, onChange: (on) => controller.setPaintOptions({ brush: { pressureSize: on } }) }),
4160
4346
  "Pressure size"
4161
4347
  ] }),
4162
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center gap-1.5", children: [
4163
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ImageCheckbox, { label: "Pressure controls opacity", checked: brush.pressureOpacity, onChange: (on) => controller.setPaintOptions({ brush: { pressureOpacity: on } }) }),
4348
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { className: "flex items-center gap-1.5", children: [
4349
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ImageCheckbox, { label: "Pressure controls opacity", checked: brush.pressureOpacity, onChange: (on) => controller.setPaintOptions({ brush: { pressureOpacity: on } }) }),
4164
4350
  "Pressure opacity"
4165
4351
  ] })
4166
4352
  ] }),
4167
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex gap-1", children: [
4168
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", className: imageChipClass(false), onClick: () => attempt(() => controller.fillPixels()), children: "Fill" }),
4169
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", className: imageChipClass(false), onClick: () => attempt(() => controller.clearPixels()), children: "Clear" })
4353
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex gap-1", children: [
4354
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { type: "button", className: imageChipClass(false), onClick: () => attempt(() => controller.fillPixels()), children: "Fill" }),
4355
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { type: "button", className: imageChipClass(false), onClick: () => attempt(() => controller.clearPixels()), children: "Clear" })
4170
4356
  ] }),
4171
- error && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { role: "alert", className: "text-destructive", children: error })
4357
+ error && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { role: "alert", className: "text-destructive", children: error })
4172
4358
  ] });
4173
4359
  };
4174
4360
 
4175
4361
  // src/image-editor/ColorProfilePanel.tsx
4176
- var import_react23 = require("react");
4362
+ var import_react24 = require("react");
4177
4363
  var import_image_editor13 = require("@pixerate/editor/image-editor");
4178
- var import_jsx_runtime22 = require("react/jsx-runtime");
4364
+ var import_jsx_runtime24 = require("react/jsx-runtime");
4179
4365
  var chip = imageChipClass(false);
4180
4366
  var select2 = "rounded bg-muted px-1 py-0.5 text-[11px] text-foreground";
4181
4367
  var ColorProfilePanel = ({ controller, className }) => {
4182
- const [, setTick] = (0, import_react23.useState)(0);
4183
- (0, import_react23.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
4184
- const [target, setTarget] = (0, import_react23.useState)("display-p3");
4185
- const [intent, setIntent] = (0, import_react23.useState)("relative");
4186
- const [bpc, setBpc] = (0, import_react23.useState)(true);
4187
- const [error, setError] = (0, import_react23.useState)(null);
4368
+ const [, setTick] = (0, import_react24.useState)(0);
4369
+ (0, import_react24.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
4370
+ const [target, setTarget] = (0, import_react24.useState)("display-p3");
4371
+ const [intent, setIntent] = (0, import_react24.useState)("relative");
4372
+ const [bpc, setBpc] = (0, import_react24.useState)(true);
4373
+ const [error, setError] = (0, import_react24.useState)(null);
4188
4374
  const view = (0, import_image_editor13.colorPanelView)(controller);
4189
4375
  const attempt = (fn) => {
4190
4376
  try {
@@ -4206,29 +4392,29 @@ var ColorProfilePanel = ({ controller, className }) => {
4206
4392
  })
4207
4393
  );
4208
4394
  };
4209
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "color-profile-panel", children: [
4210
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center gap-2", children: [
4211
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-muted-foreground", children: "Profile" }),
4212
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { "data-testid": "color-profile-name", children: view.profileName })
4395
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "color-profile-panel", children: [
4396
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex items-center gap-2", children: [
4397
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "text-muted-foreground", children: "Profile" }),
4398
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { "data-testid": "color-profile-name", children: view.profileName })
4213
4399
  ] }),
4214
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": "Colour mode", children: [
4215
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-muted-foreground", children: "Mode" }),
4216
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("select", { "aria-label": "Colour mode", className: select2, value: view.mode, onChange: (e) => attempt(() => controller.setColorMode(e.target.value)), children: import_image_editor13.COLOR_MODE_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("option", { value: o.id, title: o.title, children: o.label }, o.id)) }),
4217
- view.cmykProfileName && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-muted-foreground", children: view.cmykProfileName })
4400
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": "Colour mode", children: [
4401
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "text-muted-foreground", children: "Mode" }),
4402
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("select", { "aria-label": "Colour mode", className: select2, value: view.mode, onChange: (e) => attempt(() => controller.setColorMode(e.target.value)), children: import_image_editor13.COLOR_MODE_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("option", { value: o.id, title: o.title, children: o.label }, o.id)) }),
4403
+ view.cmykProfileName && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "text-muted-foreground", children: view.cmykProfileName })
4218
4404
  ] }),
4219
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": "Assign or convert", children: [
4220
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("select", { "aria-label": "Target profile", className: select2, value: target, onChange: (e) => setTarget(e.target.value), children: import_image_editor13.WORKING_SPACE_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("option", { value: o.id, children: o.label }, o.id)) }),
4221
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("select", { "aria-label": "Rendering intent", className: select2, value: intent, onChange: (e) => setIntent(e.target.value), children: import_image_editor13.INTENT_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("option", { value: o.id, title: o.title, children: o.label }, o.id)) }),
4222
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("label", { className: "flex items-center gap-1", children: [
4223
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("input", { type: "checkbox", "aria-label": "Black point compensation", checked: bpc, onChange: (e) => setBpc(e.target.checked), className: "accent-primary" }),
4405
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": "Assign or convert", children: [
4406
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("select", { "aria-label": "Target profile", className: select2, value: target, onChange: (e) => setTarget(e.target.value), children: import_image_editor13.WORKING_SPACE_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("option", { value: o.id, children: o.label }, o.id)) }),
4407
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("select", { "aria-label": "Rendering intent", className: select2, value: intent, onChange: (e) => setIntent(e.target.value), children: import_image_editor13.INTENT_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("option", { value: o.id, title: o.title, children: o.label }, o.id)) }),
4408
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("label", { className: "flex items-center gap-1", children: [
4409
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("input", { type: "checkbox", "aria-label": "Black point compensation", checked: bpc, onChange: (e) => setBpc(e.target.checked), className: "accent-primary" }),
4224
4410
  "BPC"
4225
4411
  ] }),
4226
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", className: chip, title: "Edit \u203A Assign Profile: keep the numbers", onClick: () => attempt(() => controller.assignProfile(target)), children: "Assign" }),
4227
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", className: chip, title: "Edit \u203A Convert to Profile: keep the look", onClick: () => attempt(() => controller.convertToProfile(target, { intent, bpc })), children: "Convert" })
4412
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("button", { type: "button", className: chip, title: "Edit \u203A Assign Profile: keep the numbers", onClick: () => attempt(() => controller.assignProfile(target)), children: "Assign" }),
4413
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("button", { type: "button", className: chip, title: "Edit \u203A Convert to Profile: keep the look", onClick: () => attempt(() => controller.convertToProfile(target, { intent, bpc })), children: "Convert" })
4228
4414
  ] }),
4229
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": "Proof setup", children: [
4230
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-muted-foreground", children: "Proof" }),
4231
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
4415
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": "Proof setup", children: [
4416
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "text-muted-foreground", children: "Proof" }),
4417
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
4232
4418
  "select",
4233
4419
  {
4234
4420
  "aria-label": "Proof profile",
@@ -4236,31 +4422,31 @@ var ColorProfilePanel = ({ controller, className }) => {
4236
4422
  value: view.proof?.id ?? "",
4237
4423
  onChange: (e) => e.target.value ? proofWith({ id: e.target.value }) : attempt(() => controller.setProofSetup(null)),
4238
4424
  children: [
4239
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("option", { value: "", children: "Off" }),
4240
- import_image_editor13.PROOF_PROFILE_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("option", { value: o.id, children: o.label }, o.id))
4425
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("option", { value: "", children: "Off" }),
4426
+ import_image_editor13.PROOF_PROFILE_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("option", { value: o.id, children: o.label }, o.id))
4241
4427
  ]
4242
4428
  }
4243
4429
  ),
4244
- view.proof && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
4245
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("select", { "aria-label": "Proof intent", className: select2, value: view.proof.intent, onChange: (e) => proofWith({ intent: e.target.value }), children: import_image_editor13.INTENT_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("option", { value: o.id, children: o.label }, o.id)) }),
4246
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("label", { className: "flex items-center gap-1", children: [
4247
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("input", { type: "checkbox", "aria-label": "Simulate paper colour", checked: view.proof.simulatePaper, onChange: (e) => proofWith({ simulatePaper: e.target.checked }), className: "accent-primary" }),
4430
+ view.proof && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
4431
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("select", { "aria-label": "Proof intent", className: select2, value: view.proof.intent, onChange: (e) => proofWith({ intent: e.target.value }), children: import_image_editor13.INTENT_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("option", { value: o.id, children: o.label }, o.id)) }),
4432
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("label", { className: "flex items-center gap-1", children: [
4433
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("input", { type: "checkbox", "aria-label": "Simulate paper colour", checked: view.proof.simulatePaper, onChange: (e) => proofWith({ simulatePaper: e.target.checked }), className: "accent-primary" }),
4248
4434
  "Paper"
4249
4435
  ] }),
4250
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("label", { className: "flex items-center gap-1", children: [
4251
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("input", { type: "checkbox", "aria-label": "Gamut warning", checked: view.proof.gamutWarning, onChange: (e) => proofWith({ gamutWarning: e.target.checked }), className: "accent-primary" }),
4436
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("label", { className: "flex items-center gap-1", children: [
4437
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("input", { type: "checkbox", "aria-label": "Gamut warning", checked: view.proof.gamutWarning, onChange: (e) => proofWith({ gamutWarning: e.target.checked }), className: "accent-primary" }),
4252
4438
  "Gamut warning"
4253
4439
  ] })
4254
4440
  ] })
4255
4441
  ] }),
4256
- error && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { role: "alert", className: "text-destructive", children: error })
4442
+ error && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { role: "alert", className: "text-destructive", children: error })
4257
4443
  ] });
4258
4444
  };
4259
4445
 
4260
4446
  // src/image-editor/SelectionOptionsBar.tsx
4261
- var import_react24 = require("react");
4447
+ var import_react25 = require("react");
4262
4448
  var import_image_editor14 = require("@pixerate/editor/image-editor");
4263
- var import_jsx_runtime23 = require("react/jsx-runtime");
4449
+ var import_jsx_runtime25 = require("react/jsx-runtime");
4264
4450
  var MODIFY_OPS = [
4265
4451
  { op: "grow", label: "Grow" },
4266
4452
  { op: "shrink", label: "Shrink" },
@@ -4277,32 +4463,32 @@ var SelectionOptionsBar = ({
4277
4463
  quickMask,
4278
4464
  className = ""
4279
4465
  }) => {
4280
- const [radius, setRadius] = (0, import_react24.useState)(2);
4466
+ const [radius, setRadius] = (0, import_react25.useState)(2);
4281
4467
  const set = (patch) => onOptionsChange({ ...options, ...patch });
4282
4468
  const sel = selection === void 0 ? controller.getSelection() : selection;
4283
4469
  const qm = quickMask ?? Boolean(controller.getState().quickMask);
4284
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { "data-testid": "selection-options-bar", className: `flex flex-col gap-3 text-xs ${className}`, children: [
4285
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { role: "group", "aria-label": "Selection tool", className: "flex flex-wrap gap-1", children: import_image_editor14.SELECTION_TOOLS.map((t) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { type: "button", "aria-pressed": options.tool === t.id, className: btn(options.tool === t.id), onClick: () => set({ tool: t.id }), children: t.label }, t.id)) }),
4286
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { role: "group", "aria-label": "Selection mode", className: "flex flex-wrap gap-1", children: import_image_editor14.SELECTION_MODES.map((m) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { type: "button", "aria-pressed": options.mode === m, className: btn(options.mode === m), onClick: () => set({ mode: m }), children: import_image_editor14.SELECTION_MODE_LABELS[m] }, m)) }),
4287
- options.tool === "wand" && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-col gap-2", children: [
4288
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { className: "flex flex-col gap-1", children: [
4289
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
4290
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { children: "Tolerance" }),
4291
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "font-mono", children: options.tolerance })
4470
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { "data-testid": "selection-options-bar", className: `flex flex-col gap-3 text-xs ${className}`, children: [
4471
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { role: "group", "aria-label": "Selection tool", className: "flex flex-wrap gap-1", children: import_image_editor14.SELECTION_TOOLS.map((t) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", "aria-pressed": options.tool === t.id, className: btn(options.tool === t.id), onClick: () => set({ tool: t.id }), children: t.label }, t.id)) }),
4472
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { role: "group", "aria-label": "Selection mode", className: "flex flex-wrap gap-1", children: import_image_editor14.SELECTION_MODES.map((m) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", "aria-pressed": options.mode === m, className: btn(options.mode === m), onClick: () => set({ mode: m }), children: import_image_editor14.SELECTION_MODE_LABELS[m] }, m)) }),
4473
+ options.tool === "wand" && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex flex-col gap-2", children: [
4474
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex flex-col gap-1", children: [
4475
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
4476
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { children: "Tolerance" }),
4477
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "font-mono", children: options.tolerance })
4292
4478
  ] }),
4293
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ImageRange, { label: "Tolerance", min: 0, max: 255, step: 1, value: options.tolerance, onChange: (v) => set({ tolerance: v }) })
4479
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ImageRange, { label: "Tolerance", min: 0, max: 255, step: 1, value: options.tolerance, onChange: (v) => set({ tolerance: v }) })
4294
4480
  ] }),
4295
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
4296
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ImageCheckbox, { label: "Contiguous", checked: options.contiguous, onChange: (on) => set({ contiguous: on }) }),
4481
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
4482
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ImageCheckbox, { label: "Contiguous", checked: options.contiguous, onChange: (on) => set({ contiguous: on }) }),
4297
4483
  "Contiguous"
4298
4484
  ] }),
4299
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
4300
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ImageCheckbox, { label: "Sample adjusted image", checked: options.sampleMerged, onChange: (on) => set({ sampleMerged: on }) }),
4485
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
4486
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ImageCheckbox, { label: "Sample adjusted image", checked: options.sampleMerged, onChange: (on) => set({ sampleMerged: on }) }),
4301
4487
  "Sample adjusted image"
4302
4488
  ] }),
4303
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
4489
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
4304
4490
  "Sample",
4305
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
4491
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4306
4492
  ImageSelect,
4307
4493
  {
4308
4494
  label: "Sample from",
@@ -4316,20 +4502,20 @@ var SelectionOptionsBar = ({
4316
4502
  )
4317
4503
  ] })
4318
4504
  ] }),
4319
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
4320
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ImageCheckbox, { label: "Anti-alias", checked: options.antiAlias, onChange: (on) => set({ antiAlias: on }) }),
4505
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
4506
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ImageCheckbox, { label: "Anti-alias", checked: options.antiAlias, onChange: (on) => set({ antiAlias: on }) }),
4321
4507
  "Anti-alias"
4322
4508
  ] }),
4323
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
4324
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { type: "button", className: btn(false), onClick: () => controller.selectAll(), children: "Select All" }),
4325
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => controller.deselect(), children: "Deselect" }),
4326
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { type: "button", className: btn(false), onClick: () => controller.invertSelection(), children: "Inverse" }),
4327
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { type: "button", "aria-pressed": qm, className: btn(qm), onClick: () => controller.setQuickMask(!qm), children: "Quick Mask" })
4509
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
4510
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", className: btn(false), onClick: () => controller.selectAll(), children: "Select All" }),
4511
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => controller.deselect(), children: "Deselect" }),
4512
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", className: btn(false), onClick: () => controller.invertSelection(), children: "Inverse" }),
4513
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", "aria-pressed": qm, className: btn(qm), onClick: () => controller.setQuickMask(!qm), children: "Quick Mask" })
4328
4514
  ] }),
4329
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
4330
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
4515
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
4516
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
4331
4517
  "Radius",
4332
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
4518
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4333
4519
  "input",
4334
4520
  {
4335
4521
  type: "number",
@@ -4343,24 +4529,24 @@ var SelectionOptionsBar = ({
4343
4529
  }
4344
4530
  )
4345
4531
  ] }),
4346
- MODIFY_OPS.map(({ op, label }) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => controller.modifySelection(op, radius), children: label }, op))
4532
+ MODIFY_OPS.map(({ op, label }) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => controller.modifySelection(op, radius), children: label }, op))
4347
4533
  ] }),
4348
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { "data-testid": "selection-status", className: "text-muted-foreground", children: (0, import_image_editor14.describeSelection)(sel) })
4534
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { "data-testid": "selection-status", className: "text-muted-foreground", children: (0, import_image_editor14.describeSelection)(sel) })
4349
4535
  ] });
4350
4536
  };
4351
4537
 
4352
4538
  // src/image-editor/RefineEdgePanel.tsx
4353
- var import_react25 = require("react");
4539
+ var import_react26 = require("react");
4354
4540
  var import_image_editor15 = require("@pixerate/editor/image-editor");
4355
- var import_jsx_runtime24 = require("react/jsx-runtime");
4541
+ var import_jsx_runtime26 = require("react/jsx-runtime");
4356
4542
  var DEFAULT_PARAMS = { radius: 8, smartRadius: false, smooth: 0, feather: 0, contrast: 0, shiftEdge: 0 };
4357
4543
  var button2 = "px-2 py-1 rounded-md border border-border bg-background text-[11px] text-foreground hover:bg-accent hover:text-accent-foreground disabled:opacity-40";
4358
4544
  var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
4359
- const [params, setParams] = (0, import_react25.useState)(DEFAULT_PARAMS);
4360
- const [busy, setBusy] = (0, import_react25.useState)(false);
4361
- const [error, setError] = (0, import_react25.useState)(null);
4362
- const [layerId, setLayerId] = (0, import_react25.useState)("");
4363
- const [newKind, setNewKind] = (0, import_react25.useState)("hueSaturation");
4545
+ const [params, setParams] = (0, import_react26.useState)(DEFAULT_PARAMS);
4546
+ const [busy, setBusy] = (0, import_react26.useState)(false);
4547
+ const [error, setError] = (0, import_react26.useState)(null);
4548
+ const [layerId, setLayerId] = (0, import_react26.useState)("");
4549
+ const [newKind, setNewKind] = (0, import_react26.useState)("hueSaturation");
4364
4550
  const sel = selection === void 0 ? controller.getSelection() : selection;
4365
4551
  const list = layers ?? controller.getAdjustmentLayers();
4366
4552
  const target = list.find((l) => l.id === layerId) ?? list[list.length - 1];
@@ -4375,17 +4561,17 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
4375
4561
  setBusy(false);
4376
4562
  }
4377
4563
  };
4378
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { "data-testid": "refine-edge-panel", className: `flex flex-col gap-3 text-xs ${className}`, children: [
4379
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: imageSectionTitleClass, children: "Refine Edge" }),
4380
- import_image_editor15.REFINE_EDGE_CONTROLS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("label", { className: "flex flex-col gap-1", children: [
4381
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
4382
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { children: c.label }),
4383
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("span", { className: "font-mono", children: [
4564
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { "data-testid": "refine-edge-panel", className: `flex flex-col gap-3 text-xs ${className}`, children: [
4565
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: imageSectionTitleClass, children: "Refine Edge" }),
4566
+ import_image_editor15.REFINE_EDGE_CONTROLS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex flex-col gap-1", children: [
4567
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
4568
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { children: c.label }),
4569
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { className: "font-mono", children: [
4384
4570
  params[c.id],
4385
4571
  c.unit
4386
4572
  ] })
4387
4573
  ] }),
4388
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
4574
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
4389
4575
  "input",
4390
4576
  {
4391
4577
  type: "range",
@@ -4399,28 +4585,28 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
4399
4585
  }
4400
4586
  )
4401
4587
  ] }, c.id)),
4402
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
4403
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("input", { type: "checkbox", checked: params.smartRadius, onChange: (e) => setParams({ ...params, smartRadius: e.target.checked }) }),
4588
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
4589
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("input", { type: "checkbox", checked: params.smartRadius, onChange: (e) => setParams({ ...params, smartRadius: e.target.checked }) }),
4404
4590
  "Smart Radius"
4405
4591
  ] }),
4406
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex gap-1", children: [
4407
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("button", { type: "button", className: button2, disabled: !sel || busy, onClick: refine, children: "Refine Edge" }),
4408
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("button", { type: "button", className: button2, onClick: () => setParams(DEFAULT_PARAMS), children: "Reset" })
4592
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex gap-1", children: [
4593
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: button2, disabled: !sel || busy, onClick: refine, children: "Refine Edge" }),
4594
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: button2, onClick: () => setParams(DEFAULT_PARAMS), children: "Reset" })
4409
4595
  ] }),
4410
- error && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { role: "alert", className: "text-destructive", children: error }),
4411
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] mt-2", children: "Layer Mask" }),
4412
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex gap-1 items-center", children: [
4413
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
4596
+ error && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { role: "alert", className: "text-destructive", children: error }),
4597
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] mt-2", children: "Layer Mask" }),
4598
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex gap-1 items-center", children: [
4599
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
4414
4600
  "select",
4415
4601
  {
4416
4602
  "aria-label": "New masked layer kind",
4417
4603
  value: newKind,
4418
4604
  onChange: (e) => setNewKind(e.target.value),
4419
4605
  className: "flex-1 bg-background border border-border rounded px-1 py-1 text-foreground",
4420
- children: import_image_editor15.ADJUSTMENT_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("option", { value: k.kind, children: k.label }, k.kind))
4606
+ children: import_image_editor15.ADJUSTMENT_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("option", { value: k.kind, children: k.label }, k.kind))
4421
4607
  }
4422
4608
  ),
4423
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
4609
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
4424
4610
  "button",
4425
4611
  {
4426
4612
  type: "button",
@@ -4431,35 +4617,35 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
4431
4617
  }
4432
4618
  )
4433
4619
  ] }),
4434
- list.length > 0 && target && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex flex-col gap-2", children: [
4435
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
4620
+ list.length > 0 && target && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex flex-col gap-2", children: [
4621
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
4436
4622
  "select",
4437
4623
  {
4438
4624
  "aria-label": "Mask layer",
4439
4625
  value: target.id,
4440
4626
  onChange: (e) => setLayerId(e.target.value),
4441
4627
  className: "bg-background border border-border rounded px-1 py-1 text-foreground",
4442
- children: list.map((l) => /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("option", { value: l.id, children: [
4628
+ children: list.map((l) => /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("option", { value: l.id, children: [
4443
4629
  l.name || (0, import_image_editor15.adjustmentKindLabel)(l.kind),
4444
4630
  l.mask ? " (masked)" : ""
4445
4631
  ] }, l.id))
4446
4632
  }
4447
4633
  ),
4448
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
4449
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("button", { type: "button", className: button2, disabled: !sel, onClick: () => controller.applySelectionAsLayerMask(target.id), children: "Mask with Selection" }),
4450
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("button", { type: "button", className: button2, disabled: !target.mask, onClick: () => controller.selectionFromLayerMask(target.id), children: "Load as Selection" }),
4451
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("button", { type: "button", className: button2, disabled: !target.mask, onClick: () => controller.setAdjustmentLayerMask(target.id, null), children: "Remove Mask" })
4634
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
4635
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: button2, disabled: !sel, onClick: () => controller.applySelectionAsLayerMask(target.id), children: "Mask with Selection" }),
4636
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: button2, disabled: !target.mask, onClick: () => controller.selectionFromLayerMask(target.id), children: "Load as Selection" }),
4637
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: button2, disabled: !target.mask, onClick: () => controller.setAdjustmentLayerMask(target.id, null), children: "Remove Mask" })
4452
4638
  ] }),
4453
- target.mask && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
4454
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("label", { className: "flex flex-col gap-1", children: [
4455
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
4456
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { children: "Density" }),
4457
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("span", { className: "font-mono", children: [
4639
+ target.mask && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [
4640
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex flex-col gap-1", children: [
4641
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
4642
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { children: "Density" }),
4643
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { className: "font-mono", children: [
4458
4644
  Math.round((target.mask.density ?? 1) * 100),
4459
4645
  "%"
4460
4646
  ] })
4461
4647
  ] }),
4462
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
4648
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
4463
4649
  "input",
4464
4650
  {
4465
4651
  type: "range",
@@ -4473,15 +4659,15 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
4473
4659
  }
4474
4660
  )
4475
4661
  ] }),
4476
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("label", { className: "flex flex-col gap-1", children: [
4477
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
4478
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { children: "Mask Feather" }),
4479
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("span", { className: "font-mono", children: [
4662
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex flex-col gap-1", children: [
4663
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
4664
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { children: "Mask Feather" }),
4665
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { className: "font-mono", children: [
4480
4666
  target.mask.feather ?? 0,
4481
4667
  "px"
4482
4668
  ] })
4483
4669
  ] }),
4484
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
4670
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
4485
4671
  "input",
4486
4672
  {
4487
4673
  type: "range",
@@ -4501,13 +4687,13 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
4501
4687
  };
4502
4688
 
4503
4689
  // src/image-editor/FreeTransformOptionsBar.tsx
4504
- var import_react26 = require("react");
4690
+ var import_react27 = require("react");
4505
4691
  var import_image_editor16 = require("@pixerate/editor/image-editor");
4506
- var import_jsx_runtime25 = require("react/jsx-runtime");
4692
+ var import_jsx_runtime27 = require("react/jsx-runtime");
4507
4693
  var round = (v, unit) => unit === "px" ? Math.round(v * 10) / 10 : Math.round(v * 100) / 100;
4508
4694
  var FreeTransformOptionsBar = ({ tool, className }) => {
4509
- const [, setTick] = (0, import_react26.useState)(0);
4510
- (0, import_react26.useEffect)(() => tool.subscribe(() => setTick((n) => n + 1)), [tool]);
4695
+ const [, setTick] = (0, import_react27.useState)(0);
4696
+ (0, import_react27.useEffect)(() => tool.subscribe(() => setTick((n) => n + 1)), [tool]);
4511
4697
  const bar = tool.bar();
4512
4698
  if (!tool.active || !bar) return null;
4513
4699
  const warp = tool.warpBar();
@@ -4519,17 +4705,17 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
4519
4705
  const v = Number(raw);
4520
4706
  if (raw.trim() !== "" && Number.isFinite(v) && Math.abs(v - bar[field]) > 1e-9) tool.setField(field, v);
4521
4707
  };
4522
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: `flex flex-wrap items-center gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "free-transform-options", role: "toolbar", "aria-label": "Free Transform options", children: [
4523
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "flex gap-1", role: "group", "aria-label": "Transform mode", children: import_image_editor16.FREE_TRANSFORM_MODE_OPTIONS.map((m) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", title: m.title, "aria-pressed": tool.mode === m.id, className: imageChipClass(tool.mode === m.id), onClick: () => tool.setMode(m.id), children: m.label }, m.id)) }),
4524
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "grid grid-cols-3 gap-px", role: "group", "aria-label": "Reference point", children: import_image_editor16.TRANSFORM_ANCHORS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", "aria-label": `Reference point ${a}`, title: `Reference point: ${a}`, className: "h-2.5 w-2.5 rounded-sm bg-accent hover:bg-primary/90", onClick: () => tool.setReference(a) }, a)) }),
4525
- tool.mode === "warp" && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex flex-wrap items-center gap-2", role: "group", "aria-label": "Warp options", children: [
4526
- /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-1", children: [
4527
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "text-muted-foreground", children: "Warp" }),
4528
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("select", { "aria-label": "Warp style", value: warp.style, onChange: (e) => tool.setWarp({ style: e.target.value }), className: imageFieldClass, children: import_image_editor16.WARP_STYLE_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("option", { value: o.id, children: o.label }, o.id)) })
4708
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: `flex flex-wrap items-center gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "free-transform-options", role: "toolbar", "aria-label": "Free Transform options", children: [
4709
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "flex gap-1", role: "group", "aria-label": "Transform mode", children: import_image_editor16.FREE_TRANSFORM_MODE_OPTIONS.map((m) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { type: "button", title: m.title, "aria-pressed": tool.mode === m.id, className: imageChipClass(tool.mode === m.id), onClick: () => tool.setMode(m.id), children: m.label }, m.id)) }),
4710
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "grid grid-cols-3 gap-px", role: "group", "aria-label": "Reference point", children: import_image_editor16.TRANSFORM_ANCHORS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { type: "button", "aria-label": `Reference point ${a}`, title: `Reference point: ${a}`, className: "h-2.5 w-2.5 rounded-sm bg-accent hover:bg-primary/90", onClick: () => tool.setReference(a) }, a)) }),
4711
+ tool.mode === "warp" && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex flex-wrap items-center gap-2", role: "group", "aria-label": "Warp options", children: [
4712
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex items-center gap-1", children: [
4713
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "text-muted-foreground", children: "Warp" }),
4714
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("select", { "aria-label": "Warp style", value: warp.style, onChange: (e) => tool.setWarp({ style: e.target.value }), className: imageFieldClass, children: import_image_editor16.WARP_STYLE_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("option", { value: o.id, children: o.label }, o.id)) })
4529
4715
  ] }),
4530
- ["bend", "horizontal", "vertical"].map((k) => /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-1", children: [
4531
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "text-muted-foreground", children: k === "bend" ? "Bend" : k === "horizontal" ? "H" : "V" }),
4532
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4716
+ ["bend", "horizontal", "vertical"].map((k) => /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex items-center gap-1", children: [
4717
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "text-muted-foreground", children: k === "bend" ? "Bend" : k === "horizontal" ? "H" : "V" }),
4718
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
4533
4719
  "input",
4534
4720
  {
4535
4721
  type: "number",
@@ -4550,9 +4736,9 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
4550
4736
  },
4551
4737
  `${k}:${warp[k]}`
4552
4738
  ),
4553
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "text-muted-foreground", children: "%" })
4739
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "text-muted-foreground", children: "%" })
4554
4740
  ] }, k)),
4555
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4741
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
4556
4742
  "button",
4557
4743
  {
4558
4744
  type: "button",
@@ -4564,9 +4750,9 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
4564
4750
  children: "Vertical"
4565
4751
  }
4566
4752
  ),
4567
- /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-1", children: [
4568
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "text-muted-foreground", children: "Grid" }),
4569
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4753
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex items-center gap-1", children: [
4754
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "text-muted-foreground", children: "Grid" }),
4755
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
4570
4756
  "select",
4571
4757
  {
4572
4758
  "aria-label": "Warp grid",
@@ -4576,14 +4762,14 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
4576
4762
  tool.setWarp({ columns: g.columns, rows: g.rows });
4577
4763
  },
4578
4764
  className: imageFieldClass,
4579
- children: import_image_editor16.WARP_GRID_OPTIONS.map((g) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("option", { value: g.id, children: g.label }, g.id))
4765
+ children: import_image_editor16.WARP_GRID_OPTIONS.map((g) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("option", { value: g.id, children: g.label }, g.id))
4580
4766
  }
4581
4767
  )
4582
4768
  ] })
4583
4769
  ] }),
4584
- tool.mode !== "warp" && import_image_editor16.FREE_TRANSFORM_FIELDS.map((f) => /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-1", title: f.title, children: [
4585
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "text-muted-foreground", children: f.label }),
4586
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4770
+ tool.mode !== "warp" && import_image_editor16.FREE_TRANSFORM_FIELDS.map((f) => /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex items-center gap-1", title: f.title, children: [
4771
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "text-muted-foreground", children: f.label }),
4772
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
4587
4773
  "input",
4588
4774
  {
4589
4775
  type: "number",
@@ -4603,8 +4789,8 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
4603
4789
  },
4604
4790
  `${f.id}:${round(bar[f.id], f.unit)}`
4605
4791
  ),
4606
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "text-muted-foreground", children: f.unit }),
4607
- f.id === "scaleX" && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4792
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "text-muted-foreground", children: f.unit }),
4793
+ f.id === "scaleX" && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
4608
4794
  "button",
4609
4795
  {
4610
4796
  type: "button",
@@ -4619,33 +4805,33 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
4619
4805
  }
4620
4806
  )
4621
4807
  ] }, f.id)),
4622
- /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-1", children: [
4623
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "text-muted-foreground", children: "Interpolation" }),
4624
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4808
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex items-center gap-1", children: [
4809
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "text-muted-foreground", children: "Interpolation" }),
4810
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
4625
4811
  "select",
4626
4812
  {
4627
4813
  "aria-label": "Interpolation",
4628
4814
  value: tool.interpolation,
4629
4815
  onChange: (e) => tool.setInterpolation(e.target.value),
4630
4816
  className: imageFieldClass,
4631
- children: import_image_editor16.INTERPOLATIONS.map((i) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("option", { value: i, children: i[0].toUpperCase() + i.slice(1) }, i))
4817
+ children: import_image_editor16.INTERPOLATIONS.map((i) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("option", { value: i, children: i[0].toUpperCase() + i.slice(1) }, i))
4632
4818
  }
4633
4819
  )
4634
4820
  ] }),
4635
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", title: "Commit (Enter)", className: "px-2 py-1 rounded bg-primary text-primary-foreground hover:bg-primary/90", onClick: () => tool.commit(), children: "Commit" }),
4636
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", title: "Cancel (Esc)", className: imageChipClass(false), onClick: () => tool.cancel(), children: "Cancel" }),
4637
- tool.error && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { role: "alert", className: "text-destructive", children: tool.error })
4821
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { type: "button", title: "Commit (Enter)", className: "px-2 py-1 rounded bg-primary text-primary-foreground hover:bg-primary/90", onClick: () => tool.commit(), children: "Commit" }),
4822
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { type: "button", title: "Cancel (Esc)", className: imageChipClass(false), onClick: () => tool.cancel(), children: "Cancel" }),
4823
+ tool.error && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { role: "alert", className: "text-destructive", children: tool.error })
4638
4824
  ] });
4639
4825
  };
4640
4826
 
4641
4827
  // src/image-editor/ShapeOptionsBar.tsx
4642
- var import_react27 = require("react");
4828
+ var import_react28 = require("react");
4643
4829
  var import_image_editor17 = require("@pixerate/editor/image-editor");
4644
- var import_jsx_runtime26 = require("react/jsx-runtime");
4830
+ var import_jsx_runtime28 = require("react/jsx-runtime");
4645
4831
  var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
4646
- const [, setTick] = (0, import_react27.useState)(0);
4647
- (0, import_react27.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
4648
- const [error, setError] = (0, import_react27.useState)(null);
4832
+ const [, setTick] = (0, import_react28.useState)(0);
4833
+ (0, import_react28.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
4834
+ const [error, setError] = (0, import_react28.useState)(null);
4649
4835
  const active = controller.getActiveLayer();
4650
4836
  const shapeId = active?.type === "shape" ? active.id : null;
4651
4837
  const set = (change) => {
@@ -4659,42 +4845,22 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
4659
4845
  }
4660
4846
  };
4661
4847
  const num = (v, min, max) => Math.max(min, Math.min(max, Number(v) || min));
4662
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "shape-options", children: [
4663
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Shape kind", children: import_image_editor17.LIVE_SHAPE_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", "aria-pressed": options.kind === k, className: imageChipClass(options.kind === k), onClick: () => onChange({ ...options, kind: k }), children: import_image_editor17.SHAPE_KIND_LABELS[k] }, k)) }),
4664
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
4665
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-1", children: [
4666
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ImageCheckbox, { label: "Fill", checked: options.fill !== null, onChange: (on) => set({ fill: on ? "#4f46e5" : null }) }),
4848
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "shape-options", children: [
4849
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Shape kind", children: import_image_editor17.LIVE_SHAPE_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("button", { type: "button", "aria-pressed": options.kind === k, className: imageChipClass(options.kind === k), onClick: () => onChange({ ...options, kind: k }), children: import_image_editor17.SHAPE_KIND_LABELS[k] }, k)) }),
4850
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
4851
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { className: "flex items-center gap-1", children: [
4852
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ImageCheckbox, { label: "Fill", checked: options.fill !== null, onChange: (on) => set({ fill: on ? "#4f46e5" : null }) }),
4667
4853
  "Fill",
4668
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
4669
- "input",
4670
- {
4671
- type: "color",
4672
- "aria-label": "Fill colour",
4673
- disabled: options.fill === null,
4674
- value: options.fill ?? "#4f46e5",
4675
- onChange: (e) => set({ fill: e.target.value }),
4676
- className: imageColorInputClass
4677
- }
4678
- )
4854
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ImageColor, { label: "Fill colour", disabled: options.fill === null, value: options.fill ?? "#4f46e5", onChange: (fill) => set({ fill }) })
4679
4855
  ] }),
4680
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-1", children: [
4681
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ImageCheckbox, { label: "Stroke", checked: options.stroke !== null, onChange: (on) => set({ stroke: on ? "#000000" : null }) }),
4856
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { className: "flex items-center gap-1", children: [
4857
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ImageCheckbox, { label: "Stroke", checked: options.stroke !== null, onChange: (on) => set({ stroke: on ? "#000000" : null }) }),
4682
4858
  "Stroke",
4683
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
4684
- "input",
4685
- {
4686
- type: "color",
4687
- "aria-label": "Stroke colour",
4688
- disabled: options.stroke === null,
4689
- value: options.stroke ?? "#000000",
4690
- onChange: (e) => set({ stroke: e.target.value }),
4691
- className: imageColorInputClass
4692
- }
4693
- )
4859
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ImageColor, { label: "Stroke colour", disabled: options.stroke === null, value: options.stroke ?? "#000000", onChange: (stroke) => set({ stroke }) })
4694
4860
  ] }),
4695
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-1", children: [
4861
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { className: "flex items-center gap-1", children: [
4696
4862
  "Width",
4697
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
4863
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4698
4864
  "input",
4699
4865
  {
4700
4866
  type: "number",
@@ -4708,51 +4874,51 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
4708
4874
  )
4709
4875
  ] })
4710
4876
  ] }),
4711
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
4712
- options.kind === "rect" && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-1", children: [
4877
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
4878
+ options.kind === "rect" && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { className: "flex items-center gap-1", children: [
4713
4879
  "Radius",
4714
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("input", { type: "number", "aria-label": "Corner radius", min: 0, max: 1e3, value: options.radius, onChange: (e) => set({ radius: num(e.target.value, 0, 1e3) }), className: `w-14 ${imageFieldClass}` })
4880
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("input", { type: "number", "aria-label": "Corner radius", min: 0, max: 1e3, value: options.radius, onChange: (e) => set({ radius: num(e.target.value, 0, 1e3) }), className: `w-14 ${imageFieldClass}` })
4715
4881
  ] }),
4716
- options.kind === "polygon" && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-1", children: [
4882
+ options.kind === "polygon" && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { className: "flex items-center gap-1", children: [
4717
4883
  "Sides",
4718
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("input", { type: "number", "aria-label": "Sides", min: 3, max: 100, value: options.sides, onChange: (e) => set({ sides: num(e.target.value, 3, 100) }), className: `w-14 ${imageFieldClass}` })
4884
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("input", { type: "number", "aria-label": "Sides", min: 3, max: 100, value: options.sides, onChange: (e) => set({ sides: num(e.target.value, 3, 100) }), className: `w-14 ${imageFieldClass}` })
4719
4885
  ] }),
4720
- options.kind === "star" && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [
4721
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-1", children: [
4886
+ options.kind === "star" && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
4887
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { className: "flex items-center gap-1", children: [
4722
4888
  "Points",
4723
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("input", { type: "number", "aria-label": "Points", min: 3, max: 100, value: options.points, onChange: (e) => set({ points: num(e.target.value, 3, 100) }), className: `w-14 ${imageFieldClass}` })
4889
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("input", { type: "number", "aria-label": "Points", min: 3, max: 100, value: options.points, onChange: (e) => set({ points: num(e.target.value, 3, 100) }), className: `w-14 ${imageFieldClass}` })
4724
4890
  ] }),
4725
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-1", children: [
4891
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { className: "flex items-center gap-1", children: [
4726
4892
  "Inner",
4727
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ImageRange, { label: "Inner radius", min: 0.05, max: 1, step: 0.05, value: options.innerRatio, onChange: (v) => set({ innerRatio: v }) })
4893
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ImageRange, { label: "Inner radius", min: 0.05, max: 1, step: 0.05, value: options.innerRatio, onChange: (v) => set({ innerRatio: v }) })
4728
4894
  ] })
4729
4895
  ] }),
4730
- options.kind === "line" && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [
4731
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-1", children: [
4896
+ options.kind === "line" && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
4897
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { className: "flex items-center gap-1", children: [
4732
4898
  "Weight",
4733
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("input", { type: "number", "aria-label": "Line weight", min: 1, max: 200, value: options.weight, onChange: (e) => set({ weight: num(e.target.value, 1, 200) }), className: `w-14 ${imageFieldClass}` })
4899
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("input", { type: "number", "aria-label": "Line weight", min: 1, max: 200, value: options.weight, onChange: (e) => set({ weight: num(e.target.value, 1, 200) }), className: `w-14 ${imageFieldClass}` })
4734
4900
  ] }),
4735
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-1", children: [
4736
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ImageCheckbox, { label: "Arrowhead", checked: options.arrow, onChange: (on) => set({ arrow: on }) }),
4901
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { className: "flex items-center gap-1", children: [
4902
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ImageCheckbox, { label: "Arrowhead", checked: options.arrow, onChange: (on) => set({ arrow: on }) }),
4737
4903
  "Arrowhead"
4738
4904
  ] })
4739
4905
  ] })
4740
4906
  ] }),
4741
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "text-[10px] text-muted-foreground", children: "Drag on the image to draw. Shift: square, circle or 45\xB0 line. Alt: from the centre." }),
4742
- error && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { role: "alert", className: "text-destructive", children: error })
4907
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { className: "text-[10px] text-muted-foreground", children: "Drag on the image to draw. Shift: square, circle or 45\xB0 line. Alt: from the centre." }),
4908
+ error && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { role: "alert", className: "text-destructive", children: error })
4743
4909
  ] });
4744
4910
  };
4745
4911
 
4746
4912
  // src/image-editor/TypeOptionsBar.tsx
4747
- var import_react28 = require("react");
4913
+ var import_react29 = require("react");
4748
4914
  var import_image_editor18 = require("@pixerate/editor/image-editor");
4749
- var import_jsx_runtime27 = require("react/jsx-runtime");
4915
+ var import_jsx_runtime29 = require("react/jsx-runtime");
4750
4916
  var ALIGN_LABELS = { left: "Left", center: "Centre", right: "Right", justify: "Justify" };
4751
4917
  var TypeOptionsBar = ({ controller, options, onChange, session, className }) => {
4752
- const [, setTick] = (0, import_react28.useState)(0);
4753
- (0, import_react28.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
4754
- (0, import_react28.useEffect)(() => session?.subscribe(() => setTick((n) => n + 1)), [session]);
4755
- const [error, setError] = (0, import_react28.useState)(null);
4918
+ const [, setTick] = (0, import_react29.useState)(0);
4919
+ (0, import_react29.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
4920
+ (0, import_react29.useEffect)(() => session?.subscribe(() => setTick((n) => n + 1)), [session]);
4921
+ const [error, setError] = (0, import_react29.useState)(null);
4756
4922
  const active = controller.getActiveLayer();
4757
4923
  const typeId = !session && active?.type === "type" ? active.id : null;
4758
4924
  const here = session?.alive ? session.styleHere() : {};
@@ -4784,11 +4950,11 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
4784
4950
  setError(e instanceof Error ? e.message : String(e));
4785
4951
  }
4786
4952
  };
4787
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "type-options", children: [
4788
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
4789
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex items-center gap-1", children: [
4953
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "type-options", children: [
4954
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
4955
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex items-center gap-1", children: [
4790
4956
  "Font",
4791
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
4957
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4792
4958
  "input",
4793
4959
  {
4794
4960
  list: "pixerate-type-fonts",
@@ -4798,11 +4964,11 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
4798
4964
  className: "w-32 rounded border border-border bg-background px-1 py-0.5"
4799
4965
  }
4800
4966
  ),
4801
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("datalist", { id: "pixerate-type-fonts", children: fonts.map((f) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("option", { value: f }, f)) })
4967
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("datalist", { id: "pixerate-type-fonts", children: fonts.map((f) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("option", { value: f }, f)) })
4802
4968
  ] }),
4803
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex items-center gap-1", children: [
4969
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex items-center gap-1", children: [
4804
4970
  "Size",
4805
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
4971
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4806
4972
  "input",
4807
4973
  {
4808
4974
  type: "number",
@@ -4815,24 +4981,24 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
4815
4981
  }
4816
4982
  )
4817
4983
  ] }),
4818
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { type: "button", "aria-pressed": shown.fontWeight >= 600, className: `${imageChipClass(shown.fontWeight >= 600)} font-bold`, onClick: () => style({ fontWeight: shown.fontWeight >= 600 ? 400 : 700 }), children: "B" }),
4819
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { type: "button", "aria-pressed": shown.italic, className: `${imageChipClass(shown.italic)} italic`, onClick: () => style({ italic: !shown.italic }), children: "I" }),
4820
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("input", { type: "color", "aria-label": "Text colour", value: shown.color, onChange: (e) => style({ color: e.target.value }), className: imageColorInputClass })
4984
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("button", { type: "button", "aria-pressed": shown.fontWeight >= 600, className: `${imageChipClass(shown.fontWeight >= 600)} font-bold`, onClick: () => style({ fontWeight: shown.fontWeight >= 600 ? 400 : 700 }), children: "B" }),
4985
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("button", { type: "button", "aria-pressed": shown.italic, className: `${imageChipClass(shown.italic)} italic`, onClick: () => style({ italic: !shown.italic }), children: "I" }),
4986
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ImageColor, { label: "Text colour", value: shown.color, onChange: (color) => style({ color }) })
4821
4987
  ] }),
4822
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Alignment", children: import_image_editor18.TEXT_ALIGNS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { type: "button", "aria-pressed": options.align === a, className: imageChipClass(options.align === a), onClick: () => style({ align: a }), children: ALIGN_LABELS[a] }, a)) }),
4823
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { className: "text-[10px] text-muted-foreground", children: "Click to type point text, drag for a paragraph box, click text to edit it. Esc finishes." }),
4824
- missing.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("p", { role: "status", className: "text-amber-600", "data-testid": "type-missing-fonts", children: [
4988
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Alignment", children: import_image_editor18.TEXT_ALIGNS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("button", { type: "button", "aria-pressed": options.align === a, className: imageChipClass(options.align === a), onClick: () => style({ align: a }), children: ALIGN_LABELS[a] }, a)) }),
4989
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("p", { className: "text-[10px] text-muted-foreground", children: "Click to type point text, drag for a paragraph box, click text to edit it. Esc finishes." }),
4990
+ missing.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("p", { role: "status", className: "text-amber-600", "data-testid": "type-missing-fonts", children: [
4825
4991
  "Missing ",
4826
4992
  missing.length === 1 ? "font" : "fonts",
4827
4993
  ": ",
4828
4994
  missing.join(", ")
4829
4995
  ] }),
4830
- error && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { role: "alert", className: "text-destructive", children: error })
4996
+ error && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("p", { role: "alert", className: "text-destructive", children: error })
4831
4997
  ] });
4832
4998
  };
4833
4999
 
4834
5000
  // src/image-editor/ImageEditor.tsx
4835
- var import_jsx_runtime28 = require("react/jsx-runtime");
5001
+ var import_jsx_runtime30 = require("react/jsx-runtime");
4836
5002
  var ImageEditor = ({
4837
5003
  editor: externalEditor,
4838
5004
  src,
@@ -4857,32 +5023,32 @@ var ImageEditor = ({
4857
5023
  return l.type === "pixel" && !!l.generator || l.type === "smart" && !!l.smartFilters?.filters.some((f) => f.kind === "effect") || l.type === "group" && l.children.some(has);
4858
5024
  });
4859
5025
  const legacyProcess = (0, import_image_editor19.normalizeProcessVersion)(state.adjustments.process) < import_image_editor19.LATEST_PROCESS_VERSION;
4860
- const [activeTab, setActiveTab] = (0, import_react29.useState)("crop");
4861
- const rootRef = (0, import_react29.useRef)(null);
5026
+ const [activeTab, setActiveTab] = (0, import_react30.useState)("crop");
5027
+ const rootRef = (0, import_react30.useRef)(null);
4862
5028
  const canvasMode = activeTab === "crop" || activeTab === "select" || activeTab === "paint" || activeTab === "annotate" ? activeTab : "none";
4863
- const activeTabRef = (0, import_react29.useRef)(activeTab);
5029
+ const activeTabRef = (0, import_react30.useRef)(activeTab);
4864
5030
  activeTabRef.current = activeTab;
4865
5031
  const openPanel = async (ref) => {
4866
5032
  if (ref.kind !== "panel" || activeTabRef.current === ref.id) return;
4867
5033
  rootRef.current?.querySelector(`[data-image-tab="${CSS.escape(ref.id)}"]`)?.click();
4868
5034
  await new Promise((resolve) => setTimeout(resolve, 60));
4869
5035
  };
4870
- const [activeCropRatio, setActiveCropRatio] = (0, import_react29.useState)(null);
4871
- const [selectionOptions, setSelectionOptions] = (0, import_react29.useState)(import_image_editor19.DEFAULT_SELECTION_TOOL_OPTIONS);
4872
- const [shapeOptions, setShapeOptions] = (0, import_react29.useState)(import_image_editor19.DEFAULT_SHAPE_TOOL_OPTIONS);
4873
- const [typeOptions, setTypeOptions] = (0, import_react29.useState)(import_image_editor19.DEFAULT_TYPE_TOOL_OPTIONS);
4874
- const [typeSession, setTypeSession] = (0, import_react29.useState)(null);
4875
- const [selectionError, setSelectionError] = (0, import_react29.useState)(null);
4876
- const [paintError, setPaintError] = (0, import_react29.useState)(null);
4877
- const [shapeTypeError, setShapeTypeError] = (0, import_react29.useState)(null);
5036
+ const [activeCropRatio, setActiveCropRatio] = (0, import_react30.useState)(null);
5037
+ const [selectionOptions, setSelectionOptions] = (0, import_react30.useState)(import_image_editor19.DEFAULT_SELECTION_TOOL_OPTIONS);
5038
+ const [shapeOptions, setShapeOptions] = (0, import_react30.useState)(import_image_editor19.DEFAULT_SHAPE_TOOL_OPTIONS);
5039
+ const [typeOptions, setTypeOptions] = (0, import_react30.useState)(import_image_editor19.DEFAULT_TYPE_TOOL_OPTIONS);
5040
+ const [typeSession, setTypeSession] = (0, import_react30.useState)(null);
5041
+ const [selectionError, setSelectionError] = (0, import_react30.useState)(null);
5042
+ const [paintError, setPaintError] = (0, import_react30.useState)(null);
5043
+ const [shapeTypeError, setShapeTypeError] = (0, import_react30.useState)(null);
4878
5044
  const handleCanvasError = (source, message) => {
4879
5045
  if (source === "paint") setPaintError(message);
4880
5046
  else if (source === "select") setSelectionError(message);
4881
5047
  else setShapeTypeError(message);
4882
5048
  };
4883
5049
  const finishTyping = () => setTypeSession(null);
4884
- const transformToolRef = (0, import_react29.useRef)(null);
4885
- const transformControllerRef = (0, import_react29.useRef)(controller);
5050
+ const transformToolRef = (0, import_react30.useRef)(null);
5051
+ const transformControllerRef = (0, import_react30.useRef)(controller);
4886
5052
  if (!transformToolRef.current || transformControllerRef.current !== controller) {
4887
5053
  transformToolRef.current?.cancel();
4888
5054
  transformToolRef.current = new import_image_editor19.FreeTransformTool(controller, {
@@ -4891,16 +5057,16 @@ var ImageEditor = ({
4891
5057
  transformControllerRef.current = controller;
4892
5058
  }
4893
5059
  const transformTool = transformToolRef.current;
4894
- const [, setTransformTick] = (0, import_react29.useState)(0);
4895
- (0, import_react29.useEffect)(() => transformTool.subscribe(() => setTransformTick((n) => n + 1)), [transformTool]);
4896
- (0, import_react29.useEffect)(() => () => transformToolRef.current?.cancel(), []);
4897
- const [inpaintPrompt, setInpaintPrompt] = (0, import_react29.useState)("");
4898
- const [inpaintMaskMode, setInpaintMaskMode] = (0, import_react29.useState)("annotations");
4899
- const [isRemovingBg, setIsRemovingBg] = (0, import_react29.useState)(false);
4900
- const [isInpainting, setIsInpainting] = (0, import_react29.useState)(false);
4901
- const [aiError, setAiError] = (0, import_react29.useState)(null);
4902
- const [aiSuccess, setAiSuccess] = (0, import_react29.useState)(null);
4903
- const [aiTarget, setAiTarget] = (0, import_react29.useState)("auto");
5060
+ const [, setTransformTick] = (0, import_react30.useState)(0);
5061
+ (0, import_react30.useEffect)(() => transformTool.subscribe(() => setTransformTick((n) => n + 1)), [transformTool]);
5062
+ (0, import_react30.useEffect)(() => () => transformToolRef.current?.cancel(), []);
5063
+ const [inpaintPrompt, setInpaintPrompt] = (0, import_react30.useState)("");
5064
+ const [inpaintMaskMode, setInpaintMaskMode] = (0, import_react30.useState)("annotations");
5065
+ const [isRemovingBg, setIsRemovingBg] = (0, import_react30.useState)(false);
5066
+ const [isInpainting, setIsInpainting] = (0, import_react30.useState)(false);
5067
+ const [aiError, setAiError] = (0, import_react30.useState)(null);
5068
+ const [aiSuccess, setAiSuccess] = (0, import_react30.useState)(null);
5069
+ const [aiTarget, setAiTarget] = (0, import_react30.useState)("auto");
4904
5070
  const aiOptions = aiTarget === "auto" ? {} : { target: aiTarget };
4905
5071
  const effectiveOnInpaint = onInpaint || aiHooks?.onInpaint;
4906
5072
  const effectiveOnRemoveBg = onRemoveBackground || aiHooks?.onRemoveBackground;
@@ -4963,11 +5129,11 @@ var ImageEditor = ({
4963
5129
  setIsInpainting(false);
4964
5130
  }
4965
5131
  };
4966
- const [activeColor, setActiveColor] = (0, import_react29.useState)("#ef4444");
4967
- const [strokeWidth, setStrokeWidth] = (0, import_react29.useState)(3);
4968
- const [fontSize, setFontSize] = (0, import_react29.useState)(24);
4969
- const [textInput, setTextInput] = (0, import_react29.useState)("");
4970
- (0, import_react29.useEffect)(() => {
5132
+ const [activeColor, setActiveColor] = (0, import_react30.useState)("#ef4444");
5133
+ const [strokeWidth, setStrokeWidth] = (0, import_react30.useState)(3);
5134
+ const [fontSize, setFontSize] = (0, import_react30.useState)(24);
5135
+ const [textInput, setTextInput] = (0, import_react30.useState)("");
5136
+ (0, import_react30.useEffect)(() => {
4971
5137
  if (activeTab === "crop" && editor.state.activeTool !== "crop") {
4972
5138
  editor.setTool("crop");
4973
5139
  }
@@ -4995,16 +5161,16 @@ var ImageEditor = ({
4995
5161
  link.click();
4996
5162
  }
4997
5163
  };
4998
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
5164
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
4999
5165
  "div",
5000
5166
  {
5001
5167
  ref: rootRef,
5002
5168
  className: `${imageEditorFrameClass} ${className}`,
5003
5169
  style,
5004
5170
  children: [
5005
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: imageEditorHeaderClass, children: [
5006
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { role: "tablist", className: imageTabListClass, children: [
5007
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5171
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: imageEditorHeaderClass, children: [
5172
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { role: "tablist", className: imageTabListClass, children: [
5173
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5008
5174
  "button",
5009
5175
  {
5010
5176
  type: "button",
@@ -5019,7 +5185,7 @@ var ImageEditor = ({
5019
5185
  children: "Transform & Crop"
5020
5186
  }
5021
5187
  ),
5022
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5188
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5023
5189
  "button",
5024
5190
  {
5025
5191
  type: "button",
@@ -5034,7 +5200,7 @@ var ImageEditor = ({
5034
5200
  children: "Adjustments"
5035
5201
  }
5036
5202
  ),
5037
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5203
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5038
5204
  "button",
5039
5205
  {
5040
5206
  type: "button",
@@ -5049,7 +5215,7 @@ var ImageEditor = ({
5049
5215
  children: "Layers"
5050
5216
  }
5051
5217
  ),
5052
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5218
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5053
5219
  "button",
5054
5220
  {
5055
5221
  type: "button",
@@ -5064,7 +5230,7 @@ var ImageEditor = ({
5064
5230
  children: "Paint"
5065
5231
  }
5066
5232
  ),
5067
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5233
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5068
5234
  "button",
5069
5235
  {
5070
5236
  type: "button",
@@ -5079,7 +5245,7 @@ var ImageEditor = ({
5079
5245
  children: "Select & Mask"
5080
5246
  }
5081
5247
  ),
5082
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5248
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5083
5249
  "button",
5084
5250
  {
5085
5251
  type: "button",
@@ -5094,7 +5260,7 @@ var ImageEditor = ({
5094
5260
  children: "Annotations"
5095
5261
  }
5096
5262
  ),
5097
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5263
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5098
5264
  "button",
5099
5265
  {
5100
5266
  type: "button",
@@ -5109,7 +5275,7 @@ var ImageEditor = ({
5109
5275
  children: "Depth Mask"
5110
5276
  }
5111
5277
  ),
5112
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
5278
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
5113
5279
  "button",
5114
5280
  {
5115
5281
  type: "button",
@@ -5122,14 +5288,14 @@ var ImageEditor = ({
5122
5288
  "aria-selected": activeTab === "ai",
5123
5289
  className: `${imageTabClass(activeTab === "ai")} flex items-center gap-1.5`,
5124
5290
  children: [
5125
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("path", { d: "M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83" }) }),
5291
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("path", { d: "M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83" }) }),
5126
5292
  "AI Tools"
5127
5293
  ]
5128
5294
  }
5129
5295
  )
5130
5296
  ] }),
5131
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex items-center gap-2 text-xs", children: [
5132
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5297
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex items-center gap-2 text-xs", children: [
5298
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5133
5299
  "button",
5134
5300
  {
5135
5301
  type: "button",
@@ -5140,7 +5306,7 @@ var ImageEditor = ({
5140
5306
  children: "\u21A9"
5141
5307
  }
5142
5308
  ),
5143
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5309
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5144
5310
  "button",
5145
5311
  {
5146
5312
  type: "button",
@@ -5151,7 +5317,7 @@ var ImageEditor = ({
5151
5317
  children: "\u21AA"
5152
5318
  }
5153
5319
  ),
5154
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5320
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5155
5321
  "button",
5156
5322
  {
5157
5323
  type: "button",
@@ -5160,8 +5326,8 @@ var ImageEditor = ({
5160
5326
  children: "Reset"
5161
5327
  }
5162
5328
  ),
5163
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "h-4 w-px bg-muted mx-1" }),
5164
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5329
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "h-4 w-px bg-muted mx-1" }),
5330
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5165
5331
  "button",
5166
5332
  {
5167
5333
  type: "button",
@@ -5171,11 +5337,11 @@ var ImageEditor = ({
5171
5337
  children: "-"
5172
5338
  }
5173
5339
  ),
5174
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { className: "font-mono text-muted-foreground w-10 text-center", children: [
5340
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { className: "font-mono text-muted-foreground w-10 text-center", children: [
5175
5341
  Math.round(state.zoom * 100),
5176
5342
  "%"
5177
5343
  ] }),
5178
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5344
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5179
5345
  "button",
5180
5346
  {
5181
5347
  type: "button",
@@ -5185,8 +5351,8 @@ var ImageEditor = ({
5185
5351
  children: "+"
5186
5352
  }
5187
5353
  ),
5188
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "h-4 w-px bg-muted mx-1" }),
5189
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5354
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "h-4 w-px bg-muted mx-1" }),
5355
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5190
5356
  "button",
5191
5357
  {
5192
5358
  type: "button",
@@ -5197,7 +5363,7 @@ var ImageEditor = ({
5197
5363
  children: "Hold Compare"
5198
5364
  }
5199
5365
  ),
5200
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5366
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5201
5367
  "button",
5202
5368
  {
5203
5369
  type: "button",
@@ -5208,10 +5374,10 @@ var ImageEditor = ({
5208
5374
  )
5209
5375
  ] })
5210
5376
  ] }),
5211
- transformTool.active && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(FreeTransformOptionsBar, { tool: transformTool, className: "border-b border-border bg-background/95 px-4 py-2" }),
5212
- !transformTool.active && transformTool.error && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { role: "alert", className: imageErrorBannerClass, children: transformTool.error }),
5213
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex flex-col md:flex-row flex-1 min-h-[520px] md:h-[560px]", children: [
5214
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5377
+ transformTool.active && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(FreeTransformOptionsBar, { tool: transformTool, className: "border-b border-border bg-background/95 px-4 py-2" }),
5378
+ !transformTool.active && transformTool.error && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { role: "alert", className: imageErrorBannerClass, children: transformTool.error }),
5379
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex flex-col md:flex-row flex-1 min-h-[520px] md:h-[560px]", children: [
5380
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5215
5381
  ImageEditorCanvas,
5216
5382
  {
5217
5383
  editor,
@@ -5235,11 +5401,11 @@ var ImageEditor = ({
5235
5401
  className: "flex-1 h-[360px] md:h-full min-h-[320px] bg-muted"
5236
5402
  }
5237
5403
  ),
5238
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: imageSidebarClass, children: [
5239
- activeTab === "crop" && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
5240
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: imageSectionTitleClass, children: "Aspect Ratio Presets" }),
5241
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "grid grid-cols-3 gap-2", children: [
5242
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5404
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: imageSidebarClass, children: [
5405
+ activeTab === "crop" && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
5406
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: imageSectionTitleClass, children: "Aspect Ratio Presets" }),
5407
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "grid grid-cols-3 gap-2", children: [
5408
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5243
5409
  "button",
5244
5410
  {
5245
5411
  type: "button",
@@ -5251,7 +5417,7 @@ var ImageEditor = ({
5251
5417
  children: "Freeform"
5252
5418
  }
5253
5419
  ),
5254
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5420
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5255
5421
  "button",
5256
5422
  {
5257
5423
  type: "button",
@@ -5263,7 +5429,7 @@ var ImageEditor = ({
5263
5429
  children: "1:1 Square"
5264
5430
  }
5265
5431
  ),
5266
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5432
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5267
5433
  "button",
5268
5434
  {
5269
5435
  type: "button",
@@ -5275,7 +5441,7 @@ var ImageEditor = ({
5275
5441
  children: "4:3 Standard"
5276
5442
  }
5277
5443
  ),
5278
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5444
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5279
5445
  "button",
5280
5446
  {
5281
5447
  type: "button",
@@ -5287,7 +5453,7 @@ var ImageEditor = ({
5287
5453
  children: "16:9 Wide"
5288
5454
  }
5289
5455
  ),
5290
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5456
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5291
5457
  "button",
5292
5458
  {
5293
5459
  type: "button",
@@ -5299,7 +5465,7 @@ var ImageEditor = ({
5299
5465
  children: "3:2 Photo"
5300
5466
  }
5301
5467
  ),
5302
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5468
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5303
5469
  "button",
5304
5470
  {
5305
5471
  type: "button",
@@ -5312,10 +5478,10 @@ var ImageEditor = ({
5312
5478
  }
5313
5479
  )
5314
5480
  ] }),
5315
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: imageDividerClass }),
5316
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: imageSectionTitleClass, children: "Orientation & Flips" }),
5317
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "grid grid-cols-2 gap-2", children: [
5318
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5481
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: imageDividerClass }),
5482
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: imageSectionTitleClass, children: "Orientation & Flips" }),
5483
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "grid grid-cols-2 gap-2", children: [
5484
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5319
5485
  "button",
5320
5486
  {
5321
5487
  type: "button",
@@ -5324,7 +5490,7 @@ var ImageEditor = ({
5324
5490
  children: "Rotate -90\xB0"
5325
5491
  }
5326
5492
  ),
5327
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5493
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5328
5494
  "button",
5329
5495
  {
5330
5496
  type: "button",
@@ -5333,7 +5499,7 @@ var ImageEditor = ({
5333
5499
  children: "Rotate +90\xB0"
5334
5500
  }
5335
5501
  ),
5336
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5502
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5337
5503
  "button",
5338
5504
  {
5339
5505
  type: "button",
@@ -5342,7 +5508,7 @@ var ImageEditor = ({
5342
5508
  children: "Flip Horizontal"
5343
5509
  }
5344
5510
  ),
5345
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5511
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5346
5512
  "button",
5347
5513
  {
5348
5514
  type: "button",
@@ -5353,10 +5519,10 @@ var ImageEditor = ({
5353
5519
  )
5354
5520
  ] })
5355
5521
  ] }),
5356
- activeTab === "adjust" && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
5357
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex items-center justify-between", children: [
5358
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: imageSectionTitleClass, children: "Color Adjustments" }),
5359
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5522
+ activeTab === "adjust" && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
5523
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex items-center justify-between", children: [
5524
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: imageSectionTitleClass, children: "Color Adjustments" }),
5525
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5360
5526
  "button",
5361
5527
  {
5362
5528
  type: "button",
@@ -5366,9 +5532,9 @@ var ImageEditor = ({
5366
5532
  }
5367
5533
  )
5368
5534
  ] }),
5369
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Histogram, { histogram: editor.histogram }),
5370
- import_image_editor19.IMAGE_ADJUSTMENT_CONTROLS.map((spec) => /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_react29.default.Fragment, { children: [
5371
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5535
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Histogram, { histogram: editor.histogram }),
5536
+ import_image_editor19.IMAGE_ADJUSTMENT_CONTROLS.map((spec) => /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_react30.default.Fragment, { children: [
5537
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5372
5538
  ControlSlider,
5373
5539
  {
5374
5540
  spec,
@@ -5377,14 +5543,14 @@ var ImageEditor = ({
5377
5543
  onChange: (v) => editor.setAdjustments({ [spec.id]: v })
5378
5544
  }
5379
5545
  ),
5380
- spec.id === "tint" && legacyProcess && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
5546
+ spec.id === "tint" && legacyProcess && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
5381
5547
  "div",
5382
5548
  {
5383
5549
  className: "flex items-center justify-between gap-2 rounded border border-amber-500/30 bg-amber-500/10 px-2 py-1.5 text-[10px] text-amber-600",
5384
5550
  "data-testid": "image-editor-process-notice",
5385
5551
  children: [
5386
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { children: "Legacy rendering (process 1). Tint needs the current process." }),
5387
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5552
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { children: "Legacy rendering (process 1). Tint needs the current process." }),
5553
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5388
5554
  "button",
5389
5555
  {
5390
5556
  type: "button",
@@ -5397,7 +5563,7 @@ var ImageEditor = ({
5397
5563
  }
5398
5564
  )
5399
5565
  ] }, spec.id)),
5400
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: imageSectionClass, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5566
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: imageSectionClass, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5401
5567
  AdjustmentLayersPanel,
5402
5568
  {
5403
5569
  controller,
@@ -5406,9 +5572,9 @@ var ImageEditor = ({
5406
5572
  }
5407
5573
  ) })
5408
5574
  ] }),
5409
- activeTab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
5410
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: imageSectionTitleClass, children: "Layers" }),
5411
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5575
+ activeTab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
5576
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: imageSectionTitleClass, children: "Layers" }),
5577
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5412
5578
  "button",
5413
5579
  {
5414
5580
  type: "button",
@@ -5419,15 +5585,15 @@ var ImageEditor = ({
5419
5585
  children: "Free Transform"
5420
5586
  }
5421
5587
  ),
5422
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(LayersPanel, { controller }),
5423
- effectsShown && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ImageProviderEffectsPanel, { controller, className: imageSectionClass }),
5424
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: imageSectionTitleClass, children: "Colour" }),
5425
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ColorProfilePanel, { controller })
5588
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(LayersPanel, { controller }),
5589
+ effectsShown && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ImageProviderEffectsPanel, { controller, className: imageSectionClass }),
5590
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: imageSectionTitleClass, children: "Colour" }),
5591
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ColorProfilePanel, { controller })
5426
5592
  ] }),
5427
- activeTab === "paint" && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
5428
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: imageSectionTitleClass, children: "Paint" }),
5429
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(BrushOptionsBar, { controller }),
5430
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5593
+ activeTab === "paint" && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
5594
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: imageSectionTitleClass, children: "Paint" }),
5595
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(BrushOptionsBar, { controller }),
5596
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5431
5597
  "button",
5432
5598
  {
5433
5599
  type: "button",
@@ -5438,12 +5604,12 @@ var ImageEditor = ({
5438
5604
  children: "Free Transform"
5439
5605
  }
5440
5606
  ),
5441
- paintError && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { role: "alert", className: "text-destructive", "data-testid": "paint-error", children: paintError }),
5442
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: imageSectionClass, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(LayersPanel, { controller }) })
5607
+ paintError && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { role: "alert", className: "text-destructive", "data-testid": "paint-error", children: paintError }),
5608
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: imageSectionClass, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(LayersPanel, { controller }) })
5443
5609
  ] }),
5444
- activeTab === "annotate" && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
5445
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: imageSectionTitleClass, children: "Shape & Type Layers" }),
5446
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "grid grid-cols-2 gap-1.5", children: ["shape", "type"].map((t) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5610
+ activeTab === "annotate" && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
5611
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: imageSectionTitleClass, children: "Shape & Type Layers" }),
5612
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "grid grid-cols-2 gap-1.5", children: ["shape", "type"].map((t) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5447
5613
  "button",
5448
5614
  {
5449
5615
  type: "button",
@@ -5454,13 +5620,13 @@ var ImageEditor = ({
5454
5620
  },
5455
5621
  t
5456
5622
  )) }),
5457
- state.activeTool === "shape" && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ShapeOptionsBar, { controller, options: shapeOptions, onChange: setShapeOptions }),
5458
- state.activeTool === "type" && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(TypeOptionsBar, { controller, options: typeOptions, onChange: setTypeOptions, session: typeSession }),
5459
- state.activeTool === "type" && typeSession && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("button", { type: "button", onClick: finishTyping, className: "self-start rounded bg-muted px-2 py-1 text-[11px] text-foreground hover:bg-accent", children: "Done editing text" }),
5460
- shapeTypeError && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { role: "alert", className: "text-destructive", "data-testid": "shape-type-error", children: shapeTypeError }),
5461
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: imageDividerClass }),
5462
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: imageSectionTitleClass, children: "Draw & Annotate" }),
5463
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "grid grid-cols-3 gap-1.5", children: ["pen", "rect", "circle", "arrow", "line"].map((t) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5623
+ state.activeTool === "shape" && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ShapeOptionsBar, { controller, options: shapeOptions, onChange: setShapeOptions }),
5624
+ state.activeTool === "type" && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(TypeOptionsBar, { controller, options: typeOptions, onChange: setTypeOptions, session: typeSession }),
5625
+ state.activeTool === "type" && typeSession && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", onClick: finishTyping, className: "self-start rounded bg-muted px-2 py-1 text-[11px] text-foreground hover:bg-accent", children: "Done editing text" }),
5626
+ shapeTypeError && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { role: "alert", className: "text-destructive", "data-testid": "shape-type-error", children: shapeTypeError }),
5627
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: imageDividerClass }),
5628
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: imageSectionTitleClass, children: "Draw & Annotate" }),
5629
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "grid grid-cols-3 gap-1.5", children: ["pen", "rect", "circle", "arrow", "line"].map((t) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5464
5630
  "button",
5465
5631
  {
5466
5632
  type: "button",
@@ -5470,26 +5636,18 @@ var ImageEditor = ({
5470
5636
  },
5471
5637
  t
5472
5638
  )) }),
5473
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex items-center gap-2 mt-2", children: [
5474
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("label", { className: "text-muted-foreground", children: "Color:" }),
5475
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5476
- "input",
5477
- {
5478
- type: "color",
5479
- value: activeColor,
5480
- onChange: (e) => setActiveColor(e.target.value),
5481
- className: "w-8 h-8 rounded border border-border cursor-pointer bg-transparent"
5482
- }
5483
- ),
5484
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex-1 ml-2", children: [
5485
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-0.5", children: [
5486
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { children: "Width:" }),
5487
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { className: "font-mono", children: [
5639
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex items-center gap-2 mt-2", children: [
5640
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("label", { className: "text-muted-foreground", children: "Color:" }),
5641
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ImageColor, { label: "Annotation colour", value: activeColor, onChange: setActiveColor }),
5642
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex-1 ml-2", children: [
5643
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-0.5", children: [
5644
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { children: "Width:" }),
5645
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { className: "font-mono", children: [
5488
5646
  strokeWidth,
5489
5647
  "px"
5490
5648
  ] })
5491
5649
  ] }),
5492
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5650
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5493
5651
  "input",
5494
5652
  {
5495
5653
  type: "range",
@@ -5502,10 +5660,10 @@ var ImageEditor = ({
5502
5660
  )
5503
5661
  ] })
5504
5662
  ] }),
5505
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: imageDividerClass }),
5506
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: imageSectionTitleClass, children: "Add Text" }),
5507
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex gap-2", children: [
5508
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5663
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: imageDividerClass }),
5664
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: imageSectionTitleClass, children: "Add Text" }),
5665
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex gap-2", children: [
5666
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5509
5667
  "input",
5510
5668
  {
5511
5669
  type: "text",
@@ -5516,7 +5674,7 @@ var ImageEditor = ({
5516
5674
  className: "flex-1 bg-background border border-border rounded-lg px-2.5 py-1.5 text-xs text-foreground placeholder:text-muted-foreground focus:outline-none focus:border-primary"
5517
5675
  }
5518
5676
  ),
5519
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5677
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5520
5678
  "button",
5521
5679
  {
5522
5680
  type: "button",
@@ -5526,14 +5684,14 @@ var ImageEditor = ({
5526
5684
  }
5527
5685
  )
5528
5686
  ] }),
5529
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex items-center justify-between text-muted-foreground", children: [
5530
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { children: "Font Size:" }),
5531
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { className: "font-mono", children: [
5687
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex items-center justify-between text-muted-foreground", children: [
5688
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { children: "Font Size:" }),
5689
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { className: "font-mono", children: [
5532
5690
  fontSize,
5533
5691
  "px"
5534
5692
  ] })
5535
5693
  ] }),
5536
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5694
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5537
5695
  "input",
5538
5696
  {
5539
5697
  type: "range",
@@ -5544,14 +5702,14 @@ var ImageEditor = ({
5544
5702
  className: imageRangeClass
5545
5703
  }
5546
5704
  ),
5547
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: imageDividerClass }),
5548
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex items-center justify-between", children: [
5549
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { className: "text-muted-foreground", children: [
5705
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: imageDividerClass }),
5706
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex items-center justify-between", children: [
5707
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { className: "text-muted-foreground", children: [
5550
5708
  "Layers (",
5551
5709
  state.annotations.length,
5552
5710
  ")"
5553
5711
  ] }),
5554
- state.selectedAnnotationId && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5712
+ state.selectedAnnotationId && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5555
5713
  "button",
5556
5714
  {
5557
5715
  type: "button",
@@ -5560,7 +5718,7 @@ var ImageEditor = ({
5560
5718
  children: "Delete Selected"
5561
5719
  }
5562
5720
  ),
5563
- state.annotations.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5721
+ state.annotations.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5564
5722
  "button",
5565
5723
  {
5566
5724
  type: "button",
@@ -5571,10 +5729,10 @@ var ImageEditor = ({
5571
5729
  )
5572
5730
  ] })
5573
5731
  ] }),
5574
- activeTab === "depth" && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
5575
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex items-center justify-between", children: [
5576
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: imageSectionTitleClass, children: "Depth Masking" }),
5577
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5732
+ activeTab === "depth" && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
5733
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex items-center justify-between", children: [
5734
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: imageSectionTitleClass, children: "Depth Masking" }),
5735
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5578
5736
  "button",
5579
5737
  {
5580
5738
  type: "button",
@@ -5584,8 +5742,8 @@ var ImageEditor = ({
5584
5742
  }
5585
5743
  )
5586
5744
  ] }),
5587
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { className: "flex items-center gap-2 cursor-pointer text-foreground", children: [
5588
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5745
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-2 cursor-pointer text-foreground", children: [
5746
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5589
5747
  "input",
5590
5748
  {
5591
5749
  type: "checkbox",
@@ -5594,12 +5752,12 @@ var ImageEditor = ({
5594
5752
  className: "rounded accent-primary"
5595
5753
  }
5596
5754
  ),
5597
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { children: "Enable Depth / Alpha Mask" })
5755
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { children: "Enable Depth / Alpha Mask" })
5598
5756
  ] }),
5599
- state.depthMask.enabled && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
5600
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { children: [
5601
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("label", { className: "text-muted-foreground block mb-1", children: "Mask Image URL:" }),
5602
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5757
+ state.depthMask.enabled && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
5758
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { children: [
5759
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("label", { className: "text-muted-foreground block mb-1", children: "Mask Image URL:" }),
5760
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5603
5761
  "input",
5604
5762
  {
5605
5763
  type: "text",
@@ -5610,8 +5768,8 @@ var ImageEditor = ({
5610
5768
  }
5611
5769
  )
5612
5770
  ] }),
5613
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex gap-2", children: [
5614
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5771
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex gap-2", children: [
5772
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5615
5773
  "button",
5616
5774
  {
5617
5775
  type: "button",
@@ -5620,7 +5778,7 @@ var ImageEditor = ({
5620
5778
  children: "Threshold Mode"
5621
5779
  }
5622
5780
  ),
5623
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5781
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5624
5782
  "button",
5625
5783
  {
5626
5784
  type: "button",
@@ -5630,12 +5788,12 @@ var ImageEditor = ({
5630
5788
  }
5631
5789
  )
5632
5790
  ] }),
5633
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { children: [
5634
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
5635
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { children: "Depth Start (Lower):" }),
5636
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "font-mono", children: state.depthMask.depthRange[0] })
5791
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { children: [
5792
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
5793
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { children: "Depth Start (Lower):" }),
5794
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "font-mono", children: state.depthMask.depthRange[0] })
5637
5795
  ] }),
5638
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5796
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5639
5797
  "input",
5640
5798
  {
5641
5799
  type: "range",
@@ -5649,12 +5807,12 @@ var ImageEditor = ({
5649
5807
  }
5650
5808
  )
5651
5809
  ] }),
5652
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { children: [
5653
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
5654
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { children: "Depth Stop (Upper):" }),
5655
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "font-mono", children: state.depthMask.depthRange[1] })
5810
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { children: [
5811
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
5812
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { children: "Depth Stop (Upper):" }),
5813
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "font-mono", children: state.depthMask.depthRange[1] })
5656
5814
  ] }),
5657
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5815
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5658
5816
  "input",
5659
5817
  {
5660
5818
  type: "range",
@@ -5668,12 +5826,12 @@ var ImageEditor = ({
5668
5826
  }
5669
5827
  )
5670
5828
  ] }),
5671
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { children: [
5672
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
5673
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { children: "Softness:" }),
5674
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "font-mono", children: state.depthMask.softness })
5829
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { children: [
5830
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
5831
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { children: "Softness:" }),
5832
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "font-mono", children: state.depthMask.softness })
5675
5833
  ] }),
5676
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5834
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5677
5835
  "input",
5678
5836
  {
5679
5837
  type: "range",
@@ -5685,8 +5843,8 @@ var ImageEditor = ({
5685
5843
  }
5686
5844
  )
5687
5845
  ] }),
5688
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { className: "flex items-center gap-2 cursor-pointer text-foreground mt-1", children: [
5689
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5846
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-2 cursor-pointer text-foreground mt-1", children: [
5847
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5690
5848
  "input",
5691
5849
  {
5692
5850
  type: "checkbox",
@@ -5695,12 +5853,12 @@ var ImageEditor = ({
5695
5853
  className: "rounded accent-primary"
5696
5854
  }
5697
5855
  ),
5698
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { children: "Invert Mask" })
5856
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { children: "Invert Mask" })
5699
5857
  ] })
5700
5858
  ] })
5701
5859
  ] }),
5702
- activeTab === "select" && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
5703
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5860
+ activeTab === "select" && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
5861
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5704
5862
  SelectionOptionsBar,
5705
5863
  {
5706
5864
  controller,
@@ -5710,9 +5868,9 @@ var ImageEditor = ({
5710
5868
  quickMask: Boolean(state.quickMask)
5711
5869
  }
5712
5870
  ),
5713
- selectionError && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { role: "alert", className: "text-destructive", children: selectionError }),
5714
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex gap-1", children: [
5715
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5871
+ selectionError && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { role: "alert", className: "text-destructive", children: selectionError }),
5872
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex gap-1", children: [
5873
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5716
5874
  "button",
5717
5875
  {
5718
5876
  type: "button",
@@ -5723,7 +5881,7 @@ var ImageEditor = ({
5723
5881
  children: "Transform Selection"
5724
5882
  }
5725
5883
  ),
5726
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5884
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5727
5885
  "button",
5728
5886
  {
5729
5887
  type: "button",
@@ -5735,12 +5893,12 @@ var ImageEditor = ({
5735
5893
  }
5736
5894
  )
5737
5895
  ] }),
5738
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(RefineEdgePanel, { controller, selection: state.selection ?? null, layers: state.adjustments.layers })
5896
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(RefineEdgePanel, { controller, selection: state.selection ?? null, layers: state.adjustments.layers })
5739
5897
  ] }),
5740
- activeTab === "ai" && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
5741
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { className: "flex items-center justify-between gap-2 text-foreground", children: [
5742
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { children: "Results go to" }),
5743
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
5898
+ activeTab === "ai" && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
5899
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center justify-between gap-2 text-foreground", children: [
5900
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { children: "Results go to" }),
5901
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
5744
5902
  "select",
5745
5903
  {
5746
5904
  "aria-label": "AI result target",
@@ -5748,54 +5906,54 @@ var ImageEditor = ({
5748
5906
  onChange: (e) => setAiTarget(e.target.value),
5749
5907
  className: imageSelectClass,
5750
5908
  children: [
5751
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("option", { value: "auto", children: controller.isMultiLayer ? "Auto (new layer)" : "Auto (replace image)" }),
5752
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("option", { value: "new-layer", children: "New layer / mask" }),
5753
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("option", { value: "replace", children: "Replace image" })
5909
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("option", { value: "auto", children: controller.isMultiLayer ? "Auto (new layer)" : "Auto (replace image)" }),
5910
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("option", { value: "new-layer", children: "New layer / mask" }),
5911
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("option", { value: "replace", children: "Replace image" })
5754
5912
  ]
5755
5913
  }
5756
5914
  )
5757
5915
  ] }),
5758
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
5759
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex items-center justify-between", children: [
5760
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
5761
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("svg", { className: "w-3.5 h-3.5 text-primary", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("path", { d: "M6 3v12M18 9a3 3 0 1 0 0-6 3 3 0 0 0 0 6zM6 21a3 3 0 1 0 0-6 3 3 0 0 0 0 6z" }) }),
5916
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
5917
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex items-center justify-between", children: [
5918
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
5919
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("svg", { className: "w-3.5 h-3.5 text-primary", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("path", { d: "M6 3v12M18 9a3 3 0 1 0 0-6 3 3 0 0 0 0 6zM6 21a3 3 0 1 0 0-6 3 3 0 0 0 0 6z" }) }),
5762
5920
  "Background Removal"
5763
5921
  ] }),
5764
- isRemovingBg && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium bg-primary/15 text-primary animate-pulse", children: "Removing..." })
5922
+ isRemovingBg && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium bg-primary/15 text-primary animate-pulse", children: "Removing..." })
5765
5923
  ] }),
5766
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Isolate foreground subject with AI alpha transparency segmentation." }),
5767
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5924
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Isolate foreground subject with AI alpha transparency segmentation." }),
5925
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5768
5926
  "button",
5769
5927
  {
5770
5928
  type: "button",
5771
5929
  onClick: handleRemoveBackground,
5772
5930
  disabled: isRemovingBg || isInpainting,
5773
5931
  className: "mt-1 px-3 py-2 rounded-lg bg-primary hover:bg-primary/90 disabled:opacity-50 text-primary-foreground font-medium shadow transition-colors flex items-center justify-center gap-2",
5774
- children: isRemovingBg ? /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
5775
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: imageSpinnerClass }),
5932
+ children: isRemovingBg ? /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
5933
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: imageSpinnerClass }),
5776
5934
  "Removing Background..."
5777
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
5778
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("path", { d: "M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83" }) }),
5935
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
5936
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("path", { d: "M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83" }) }),
5779
5937
  "Remove Background"
5780
5938
  ] })
5781
5939
  }
5782
5940
  )
5783
5941
  ] }),
5784
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
5785
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex items-center justify-between", children: [
5786
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
5787
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("svg", { className: "w-3.5 h-3.5 text-primary", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
5788
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("path", { d: "m21.64 3.64-1.28-1.28a1.2 1.2 0 0 0-1.7 0l-9.72 9.72-1.94 4.86 4.86-1.94 9.72-9.72a1.2 1.2 0 0 0 .06-1.64z" }),
5789
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("path", { d: "m14 7 3 3" })
5942
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
5943
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex items-center justify-between", children: [
5944
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
5945
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("svg", { className: "w-3.5 h-3.5 text-primary", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
5946
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("path", { d: "m21.64 3.64-1.28-1.28a1.2 1.2 0 0 0-1.7 0l-9.72 9.72-1.94 4.86 4.86-1.94 9.72-9.72a1.2 1.2 0 0 0 .06-1.64z" }),
5947
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("path", { d: "m14 7 3 3" })
5790
5948
  ] }),
5791
5949
  "Generative Inpainting"
5792
5950
  ] }),
5793
- isInpainting && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium bg-primary/15 text-primary animate-pulse", children: "Inpainting..." })
5951
+ isInpainting && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium bg-primary/15 text-primary animate-pulse", children: "Inpainting..." })
5794
5952
  ] }),
5795
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Replace, modify, or fill selected regions using prompt-guided generative inpainting." }),
5796
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex flex-col gap-1", children: [
5797
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("label", { htmlFor: "ai-inpaint-prompt-react", className: "text-foreground text-[11px] font-medium", children: "Prompt" }),
5798
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5953
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Replace, modify, or fill selected regions using prompt-guided generative inpainting." }),
5954
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex flex-col gap-1", children: [
5955
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("label", { htmlFor: "ai-inpaint-prompt-react", className: "text-foreground text-[11px] font-medium", children: "Prompt" }),
5956
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5799
5957
  "textarea",
5800
5958
  {
5801
5959
  id: "ai-inpaint-prompt-react",
@@ -5807,10 +5965,10 @@ var ImageEditor = ({
5807
5965
  }
5808
5966
  )
5809
5967
  ] }),
5810
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex flex-col gap-1", children: [
5811
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "text-foreground text-[11px] font-medium", children: "Target Mask Region" }),
5812
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "grid grid-cols-2 gap-1.5", children: [
5813
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
5968
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex flex-col gap-1", children: [
5969
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "text-foreground text-[11px] font-medium", children: "Target Mask Region" }),
5970
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "grid grid-cols-2 gap-1.5", children: [
5971
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
5814
5972
  "button",
5815
5973
  {
5816
5974
  type: "button",
@@ -5823,7 +5981,7 @@ var ImageEditor = ({
5823
5981
  ]
5824
5982
  }
5825
5983
  ),
5826
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
5984
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
5827
5985
  "button",
5828
5986
  {
5829
5987
  type: "button",
@@ -5838,25 +5996,25 @@ var ImageEditor = ({
5838
5996
  )
5839
5997
  ] })
5840
5998
  ] }),
5841
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5999
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5842
6000
  "button",
5843
6001
  {
5844
6002
  type: "button",
5845
6003
  onClick: handleInpaint,
5846
6004
  disabled: isInpainting || isRemovingBg || !inpaintPrompt.trim(),
5847
6005
  className: "mt-1 px-3 py-2 rounded-lg bg-primary hover:bg-primary/90 disabled:opacity-50 text-primary-foreground font-medium shadow transition-colors flex items-center justify-center gap-2",
5848
- children: isInpainting ? /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
5849
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: imageSpinnerClass }),
6006
+ children: isInpainting ? /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
6007
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: imageSpinnerClass }),
5850
6008
  "Generating Inpaint..."
5851
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
5852
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("path", { d: "M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83" }) }),
6009
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
6010
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("path", { d: "M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83" }) }),
5853
6011
  "Apply Inpainting"
5854
6012
  ] })
5855
6013
  }
5856
6014
  )
5857
6015
  ] }),
5858
- aiError && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "p-2.5 rounded-lg bg-destructive/10 border border-destructive/40 text-destructive text-[11px]", children: aiError }),
5859
- aiSuccess && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "p-2.5 rounded-lg bg-emerald-500/10 border border-emerald-500/30 text-emerald-600 text-[11px]", children: aiSuccess })
6016
+ aiError && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "p-2.5 rounded-lg bg-destructive/10 border border-destructive/40 text-destructive text-[11px]", children: aiError }),
6017
+ aiSuccess && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "p-2.5 rounded-lg bg-emerald-500/10 border border-emerald-500/30 text-emerald-600 text-[11px]", children: aiSuccess })
5860
6018
  ] })
5861
6019
  ] })
5862
6020
  ] })
@@ -5874,6 +6032,7 @@ var ImageEditor = ({
5874
6032
  FreeTransformOptionsBar,
5875
6033
  Histogram,
5876
6034
  ImageCheckbox,
6035
+ ImageColor,
5877
6036
  ImageEditor,
5878
6037
  ImageEditorCanvas,
5879
6038
  ImageEditorControlsProvider,