@pixerate/editor-react 0.145.0 → 0.147.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.
@@ -190,7 +190,7 @@ function useImageEffectsTools(registry, controller, options = {}) {
190
190
  }
191
191
 
192
192
  // src/image-editor/ImageEditor.tsx
193
- import React21, { useRef as useRef12, useEffect as useEffect17, useState as useState22 } from "react";
193
+ import React22, { useRef as useRef12, useEffect as useEffect17, useState as useState23 } from "react";
194
194
  import {
195
195
  normalizeProcessVersion,
196
196
  LATEST_PROCESS_VERSION,
@@ -3818,7 +3818,7 @@ var SelectionOptionsBar = ({
3818
3818
  };
3819
3819
 
3820
3820
  // src/image-editor/RefineEdgePanel.tsx
3821
- import { useState as useState16 } from "react";
3821
+ import { useState as useState17 } from "react";
3822
3822
  import {
3823
3823
  ADJUSTMENT_KINDS as ADJUSTMENT_KINDS2,
3824
3824
  REFINE_EDGE_CONTROLS as REFINE_EDGE_CONTROLS2,
@@ -3874,19 +3874,60 @@ var MaskEdgeCheck = ({ controller, selection, target = "selection", layerId, cla
3874
3874
  ] });
3875
3875
  };
3876
3876
 
3877
- // src/image-editor/RefineEdgePanel.tsx
3877
+ // src/image-editor/SelectionChangeCheck.tsx
3878
+ import { useState as useState16 } from "react";
3878
3879
  import { Fragment as Fragment5, jsx as jsx20, jsxs as jsxs18 } from "react/jsx-runtime";
3879
- var DEFAULT_PARAMS = { radius: 8, smartRadius: false, smooth: 0, feather: 0, contrast: 0, shiftEdge: 0 };
3880
3880
  var button4 = "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";
3881
- var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
3882
- const [params, setParams] = useState16(DEFAULT_PARAMS);
3883
- const [busy, setBusy] = useState16(false);
3881
+ var SelectionChangeCheck = ({ controller, selection, className = "" }) => {
3882
+ const sel = selection === void 0 ? controller.getSelection() : selection;
3883
+ const [result, setResult] = useState16(null);
3884
3884
  const [error, setError] = useState16(null);
3885
- const [layerId, setLayerId] = useState16("");
3886
- const [newKind, setNewKind] = useState16("hueSaturation");
3887
- const [output, setOutput] = useState16("selection");
3888
- const [decontaminate, setDecontaminate] = useState16(0);
3889
- const [objectAware, setObjectAware] = useState16(false);
3885
+ const diff = result && result.for === sel ? result.diff : null;
3886
+ const show = () => {
3887
+ setError(null);
3888
+ try {
3889
+ setResult({ diff: controller.compareSelections(), for: sel });
3890
+ } catch (err) {
3891
+ setResult(null);
3892
+ setError(err instanceof Error ? err.message : String(err));
3893
+ }
3894
+ };
3895
+ return /* @__PURE__ */ jsxs18("div", { "data-testid": "selection-change-check", className: `flex flex-col gap-1 text-xs ${className}`, children: [
3896
+ /* @__PURE__ */ jsx20("button", { type: "button", className: `${button4} self-start`, onClick: show, children: "Show Last Change" }),
3897
+ diff && /* @__PURE__ */ jsx20("p", { "data-testid": "selection-change-summary", className: "text-foreground", children: diff.identical ? "The last step did not change the selection." : /* @__PURE__ */ jsxs18(Fragment5, { children: [
3898
+ /* @__PURE__ */ jsxs18("span", { className: "text-green-600", children: [
3899
+ "+",
3900
+ diff.added.area,
3901
+ " px"
3902
+ ] }),
3903
+ " ",
3904
+ /* @__PURE__ */ jsxs18("span", { className: "text-destructive", children: [
3905
+ "\u2212",
3906
+ diff.removed.area,
3907
+ " px"
3908
+ ] }),
3909
+ ", overlap ",
3910
+ Math.round(diff.iou * 100),
3911
+ "%"
3912
+ ] }) }),
3913
+ error && /* @__PURE__ */ jsx20("p", { role: "alert", className: "text-destructive", children: error })
3914
+ ] });
3915
+ };
3916
+
3917
+ // src/image-editor/RefineEdgePanel.tsx
3918
+ import { Fragment as Fragment6, jsx as jsx21, jsxs as jsxs19 } from "react/jsx-runtime";
3919
+ var DEFAULT_PARAMS = { radius: 8, smartRadius: false, smooth: 0, feather: 0, contrast: 0, shiftEdge: 0 };
3920
+ var button5 = "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";
3921
+ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
3922
+ const [params, setParams] = useState17(DEFAULT_PARAMS);
3923
+ const [busy, setBusy] = useState17(false);
3924
+ const [error, setError] = useState17(null);
3925
+ const [layerId, setLayerId] = useState17("");
3926
+ const [newKind, setNewKind] = useState17("hueSaturation");
3927
+ const [output, setOutput] = useState17("selection");
3928
+ const [decontaminate, setDecontaminate] = useState17(0);
3929
+ const [objectAware, setObjectAware] = useState17(false);
3930
+ const [onlyUncertain, setOnlyUncertain] = useState17(false);
3890
3931
  const canObject = Boolean(controller.segmentationProvider);
3891
3932
  const toLayer = output !== "selection" && output !== "layer-mask";
3892
3933
  const sel = selection === void 0 ? controller.getSelection() : selection;
@@ -3896,9 +3937,12 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
3896
3937
  setBusy(true);
3897
3938
  setError(null);
3898
3939
  try {
3940
+ const regions = onlyUncertain ? controller.selectionUncertainty().regions.map((r) => r.bounds) : void 0;
3941
+ if (regions && !regions.length) throw new Error("No uncertain areas: the selection's edge already follows edges in the image. Untick Only uncertain areas to refine everywhere.");
3899
3942
  await controller.refineSelectionTo(params, output, {
3900
3943
  decontaminate: toLayer ? decontaminate : 0,
3901
- refineMode: canObject && objectAware ? "object" : "color"
3944
+ refineMode: canObject && objectAware ? "object" : "color",
3945
+ ...regions ? { regions } : {}
3902
3946
  });
3903
3947
  } catch (err) {
3904
3948
  setError(err instanceof Error ? err.message : String(err));
@@ -3906,17 +3950,17 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
3906
3950
  setBusy(false);
3907
3951
  }
3908
3952
  };
3909
- return /* @__PURE__ */ jsxs18("div", { "data-testid": "refine-edge-panel", className: `flex flex-col gap-3 text-xs ${className}`, children: [
3910
- /* @__PURE__ */ jsx20("span", { className: imageSectionTitleClass, children: "Refine Edge" }),
3911
- REFINE_EDGE_CONTROLS2.map((c) => /* @__PURE__ */ jsxs18("label", { className: "flex flex-col gap-1", children: [
3912
- /* @__PURE__ */ jsxs18("span", { className: "flex justify-between text-muted-foreground", children: [
3913
- /* @__PURE__ */ jsx20("span", { children: c.label }),
3914
- /* @__PURE__ */ jsxs18("span", { className: "font-mono", children: [
3953
+ return /* @__PURE__ */ jsxs19("div", { "data-testid": "refine-edge-panel", className: `flex flex-col gap-3 text-xs ${className}`, children: [
3954
+ /* @__PURE__ */ jsx21("span", { className: imageSectionTitleClass, children: "Refine Edge" }),
3955
+ REFINE_EDGE_CONTROLS2.map((c) => /* @__PURE__ */ jsxs19("label", { className: "flex flex-col gap-1", children: [
3956
+ /* @__PURE__ */ jsxs19("span", { className: "flex justify-between text-muted-foreground", children: [
3957
+ /* @__PURE__ */ jsx21("span", { children: c.label }),
3958
+ /* @__PURE__ */ jsxs19("span", { className: "font-mono", children: [
3915
3959
  params[c.id],
3916
3960
  c.unit
3917
3961
  ] })
3918
3962
  ] }),
3919
- /* @__PURE__ */ jsx20(
3963
+ /* @__PURE__ */ jsx21(
3920
3964
  "input",
3921
3965
  {
3922
3966
  type: "range",
@@ -3930,39 +3974,43 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
3930
3974
  }
3931
3975
  )
3932
3976
  ] }, c.id)),
3933
- /* @__PURE__ */ jsxs18("label", { className: "flex items-center gap-2 text-foreground", children: [
3934
- /* @__PURE__ */ jsx20("input", { type: "checkbox", checked: params.smartRadius, onChange: (e) => setParams({ ...params, smartRadius: e.target.checked }) }),
3977
+ /* @__PURE__ */ jsxs19("label", { className: "flex items-center gap-2 text-foreground", children: [
3978
+ /* @__PURE__ */ jsx21("input", { type: "checkbox", checked: params.smartRadius, onChange: (e) => setParams({ ...params, smartRadius: e.target.checked }) }),
3935
3979
  "Smart Radius"
3936
3980
  ] }),
3937
- canObject && /* @__PURE__ */ jsxs18("label", { className: "flex items-center gap-2 text-foreground", children: [
3938
- /* @__PURE__ */ jsx20("input", { type: "checkbox", "aria-label": "Object aware", checked: objectAware, onChange: (e) => setObjectAware(e.target.checked) }),
3981
+ /* @__PURE__ */ jsxs19("label", { className: "flex items-center gap-2 text-foreground", title: "Refine only where the edge has no image edge under it", children: [
3982
+ /* @__PURE__ */ jsx21("input", { type: "checkbox", "aria-label": "Only uncertain areas", checked: onlyUncertain, onChange: (e) => setOnlyUncertain(e.target.checked) }),
3983
+ "Only uncertain areas"
3984
+ ] }),
3985
+ canObject && /* @__PURE__ */ jsxs19("label", { className: "flex items-center gap-2 text-foreground", children: [
3986
+ /* @__PURE__ */ jsx21("input", { type: "checkbox", "aria-label": "Object aware", checked: objectAware, onChange: (e) => setObjectAware(e.target.checked) }),
3939
3987
  "Object aware (segmentation model)"
3940
3988
  ] }),
3941
- /* @__PURE__ */ jsxs18("label", { className: "flex items-center gap-2 text-muted-foreground", children: [
3989
+ /* @__PURE__ */ jsxs19("label", { className: "flex items-center gap-2 text-muted-foreground", children: [
3942
3990
  "Output to",
3943
- /* @__PURE__ */ jsx20(
3991
+ /* @__PURE__ */ jsx21(
3944
3992
  "select",
3945
3993
  {
3946
3994
  "aria-label": "Refine output",
3947
3995
  value: output,
3948
3996
  onChange: (e) => setOutput(e.target.value),
3949
3997
  className: "flex-1 bg-background border border-border rounded px-1 py-1 text-foreground",
3950
- children: REFINE_OUTPUTS2.filter((o) => !o.needsDocuments || controller.canOpenDocuments).map((o) => /* @__PURE__ */ jsx20("option", { value: o.id, children: o.label }, o.id))
3998
+ children: REFINE_OUTPUTS2.filter((o) => !o.needsDocuments || controller.canOpenDocuments).map((o) => /* @__PURE__ */ jsx21("option", { value: o.id, children: o.label }, o.id))
3951
3999
  }
3952
4000
  )
3953
4001
  ] }),
3954
- /* @__PURE__ */ jsxs18("label", { className: "flex flex-col gap-1", children: [
3955
- /* @__PURE__ */ jsxs18("span", { className: "flex justify-between text-muted-foreground", children: [
3956
- /* @__PURE__ */ jsxs18("span", { children: [
4002
+ /* @__PURE__ */ jsxs19("label", { className: "flex flex-col gap-1", children: [
4003
+ /* @__PURE__ */ jsxs19("span", { className: "flex justify-between text-muted-foreground", children: [
4004
+ /* @__PURE__ */ jsxs19("span", { children: [
3957
4005
  "Decontaminate colors",
3958
4006
  toLayer ? "" : " (new layer or document outputs)"
3959
4007
  ] }),
3960
- /* @__PURE__ */ jsxs18("span", { className: "font-mono", children: [
4008
+ /* @__PURE__ */ jsxs19("span", { className: "font-mono", children: [
3961
4009
  decontaminate,
3962
4010
  "%"
3963
4011
  ] })
3964
4012
  ] }),
3965
- /* @__PURE__ */ jsx20(
4013
+ /* @__PURE__ */ jsx21(
3966
4014
  "input",
3967
4015
  {
3968
4016
  type: "range",
@@ -3977,64 +4025,65 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
3977
4025
  }
3978
4026
  )
3979
4027
  ] }),
3980
- /* @__PURE__ */ jsxs18("div", { className: "flex gap-1", children: [
3981
- /* @__PURE__ */ jsx20("button", { type: "button", className: button4, disabled: !sel || busy, onClick: refine, children: "Refine Edge" }),
3982
- /* @__PURE__ */ jsx20("button", { type: "button", className: button4, onClick: () => setParams(DEFAULT_PARAMS), children: "Reset" })
4028
+ /* @__PURE__ */ jsxs19("div", { className: "flex gap-1", children: [
4029
+ /* @__PURE__ */ jsx21("button", { type: "button", className: button5, disabled: !sel || busy, onClick: refine, children: "Refine Edge" }),
4030
+ /* @__PURE__ */ jsx21("button", { type: "button", className: button5, onClick: () => setParams(DEFAULT_PARAMS), children: "Reset" })
3983
4031
  ] }),
3984
- error && /* @__PURE__ */ jsx20("p", { role: "alert", className: "text-destructive", children: error }),
3985
- /* @__PURE__ */ jsx20(MaskEdgeCheck, { controller, selection: sel }),
3986
- /* @__PURE__ */ jsx20("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] mt-2", children: "Layer Mask" }),
3987
- /* @__PURE__ */ jsxs18("div", { className: "flex gap-1 items-center", children: [
3988
- /* @__PURE__ */ jsx20(
4032
+ error && /* @__PURE__ */ jsx21("p", { role: "alert", className: "text-destructive", children: error }),
4033
+ /* @__PURE__ */ jsx21(MaskEdgeCheck, { controller, selection: sel }),
4034
+ /* @__PURE__ */ jsx21(SelectionChangeCheck, { controller, selection: sel }),
4035
+ /* @__PURE__ */ jsx21("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] mt-2", children: "Layer Mask" }),
4036
+ /* @__PURE__ */ jsxs19("div", { className: "flex gap-1 items-center", children: [
4037
+ /* @__PURE__ */ jsx21(
3989
4038
  "select",
3990
4039
  {
3991
4040
  "aria-label": "New masked layer kind",
3992
4041
  value: newKind,
3993
4042
  onChange: (e) => setNewKind(e.target.value),
3994
4043
  className: "flex-1 bg-background border border-border rounded px-1 py-1 text-foreground",
3995
- children: ADJUSTMENT_KINDS2.map((k) => /* @__PURE__ */ jsx20("option", { value: k.kind, children: k.label }, k.kind))
4044
+ children: ADJUSTMENT_KINDS2.map((k) => /* @__PURE__ */ jsx21("option", { value: k.kind, children: k.label }, k.kind))
3996
4045
  }
3997
4046
  ),
3998
- /* @__PURE__ */ jsx20(
4047
+ /* @__PURE__ */ jsx21(
3999
4048
  "button",
4000
4049
  {
4001
4050
  type: "button",
4002
- className: button4,
4051
+ className: button5,
4003
4052
  disabled: !sel,
4004
4053
  onClick: () => sel && setLayerId(controller.addAdjustmentLayer({ kind: newKind, mask: layerMaskFromSelection(sel) })),
4005
4054
  children: "New Masked Layer"
4006
4055
  }
4007
4056
  )
4008
4057
  ] }),
4009
- list.length > 0 && target && /* @__PURE__ */ jsxs18("div", { className: "flex flex-col gap-2", children: [
4010
- /* @__PURE__ */ jsx20(
4058
+ list.length > 0 && target && /* @__PURE__ */ jsxs19("div", { className: "flex flex-col gap-2", children: [
4059
+ /* @__PURE__ */ jsx21(
4011
4060
  "select",
4012
4061
  {
4013
4062
  "aria-label": "Mask layer",
4014
4063
  value: target.id,
4015
4064
  onChange: (e) => setLayerId(e.target.value),
4016
4065
  className: "bg-background border border-border rounded px-1 py-1 text-foreground",
4017
- children: list.map((l) => /* @__PURE__ */ jsxs18("option", { value: l.id, children: [
4066
+ children: list.map((l) => /* @__PURE__ */ jsxs19("option", { value: l.id, children: [
4018
4067
  l.name || adjustmentKindLabel2(l.kind),
4019
4068
  l.mask ? " (masked)" : ""
4020
4069
  ] }, l.id))
4021
4070
  }
4022
4071
  ),
4023
- /* @__PURE__ */ jsxs18("div", { className: "flex flex-wrap gap-1", children: [
4024
- /* @__PURE__ */ jsx20("button", { type: "button", className: button4, disabled: !sel, onClick: () => controller.applySelectionAsLayerMask(target.id), children: "Mask with Selection" }),
4025
- /* @__PURE__ */ jsx20("button", { type: "button", className: button4, disabled: !target.mask, onClick: () => controller.selectionFromLayerMask(target.id), children: "Load as Selection" }),
4026
- /* @__PURE__ */ jsx20("button", { type: "button", className: button4, disabled: !target.mask, onClick: () => controller.setAdjustmentLayerMask(target.id, null), children: "Remove Mask" })
4072
+ /* @__PURE__ */ jsxs19("div", { className: "flex flex-wrap gap-1", children: [
4073
+ /* @__PURE__ */ jsx21("button", { type: "button", className: button5, disabled: !sel, onClick: () => controller.applySelectionAsLayerMask(target.id), children: "Mask with Selection" }),
4074
+ /* @__PURE__ */ jsx21("button", { type: "button", className: button5, disabled: !target.mask, onClick: () => controller.selectionFromLayerMask(target.id), children: "Load as Selection" }),
4075
+ /* @__PURE__ */ jsx21("button", { type: "button", className: button5, disabled: !target.mask, onClick: () => controller.setAdjustmentLayerMask(target.id, null), children: "Remove Mask" })
4027
4076
  ] }),
4028
- target.mask && /* @__PURE__ */ jsxs18(Fragment5, { children: [
4029
- /* @__PURE__ */ jsxs18("label", { className: "flex flex-col gap-1", children: [
4030
- /* @__PURE__ */ jsxs18("span", { className: "flex justify-between text-muted-foreground", children: [
4031
- /* @__PURE__ */ jsx20("span", { children: "Density" }),
4032
- /* @__PURE__ */ jsxs18("span", { className: "font-mono", children: [
4077
+ target.mask && /* @__PURE__ */ jsxs19(Fragment6, { children: [
4078
+ /* @__PURE__ */ jsxs19("label", { className: "flex flex-col gap-1", children: [
4079
+ /* @__PURE__ */ jsxs19("span", { className: "flex justify-between text-muted-foreground", children: [
4080
+ /* @__PURE__ */ jsx21("span", { children: "Density" }),
4081
+ /* @__PURE__ */ jsxs19("span", { className: "font-mono", children: [
4033
4082
  Math.round((target.mask.density ?? 1) * 100),
4034
4083
  "%"
4035
4084
  ] })
4036
4085
  ] }),
4037
- /* @__PURE__ */ jsx20(
4086
+ /* @__PURE__ */ jsx21(
4038
4087
  "input",
4039
4088
  {
4040
4089
  type: "range",
@@ -4048,15 +4097,15 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
4048
4097
  }
4049
4098
  )
4050
4099
  ] }),
4051
- /* @__PURE__ */ jsxs18("label", { className: "flex flex-col gap-1", children: [
4052
- /* @__PURE__ */ jsxs18("span", { className: "flex justify-between text-muted-foreground", children: [
4053
- /* @__PURE__ */ jsx20("span", { children: "Mask Feather" }),
4054
- /* @__PURE__ */ jsxs18("span", { className: "font-mono", children: [
4100
+ /* @__PURE__ */ jsxs19("label", { className: "flex flex-col gap-1", children: [
4101
+ /* @__PURE__ */ jsxs19("span", { className: "flex justify-between text-muted-foreground", children: [
4102
+ /* @__PURE__ */ jsx21("span", { children: "Mask Feather" }),
4103
+ /* @__PURE__ */ jsxs19("span", { className: "font-mono", children: [
4055
4104
  target.mask.feather ?? 0,
4056
4105
  "px"
4057
4106
  ] })
4058
4107
  ] }),
4059
- /* @__PURE__ */ jsx20(
4108
+ /* @__PURE__ */ jsx21(
4060
4109
  "input",
4061
4110
  {
4062
4111
  type: "range",
@@ -4076,9 +4125,9 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
4076
4125
  };
4077
4126
 
4078
4127
  // src/image-editor/ChannelsPanel.tsx
4079
- import { useEffect as useEffect12, useRef as useRef11, useState as useState17 } from "react";
4128
+ import { useEffect as useEffect12, useRef as useRef11, useState as useState18 } from "react";
4080
4129
  import { MASK_FILE_ACCEPT, channelThumbnail, downloadMaskImage, openMaskFile, selectionModeFromModifiers } from "@pixerate/editor/image-editor";
4081
- import { jsx as jsx21, jsxs as jsxs19 } from "react/jsx-runtime";
4130
+ import { jsx as jsx22, jsxs as jsxs20 } from "react/jsx-runtime";
4082
4131
  var btn2 = (on = false) => `px-2 py-1 rounded-md border text-[11px] transition-colors disabled:opacity-40 ${on ? "bg-primary border-primary text-primary-foreground" : "bg-background border-border text-foreground hover:bg-accent hover:text-accent-foreground"}`;
4083
4132
  var ChannelThumb = ({ channel, size }) => {
4084
4133
  const ref = useRef11(null);
@@ -4093,14 +4142,14 @@ var ChannelThumb = ({ channel, size }) => {
4093
4142
  img.data.set(px.data);
4094
4143
  ctx.putImageData(img, 0, 0);
4095
4144
  }, [channel.mask]);
4096
- return /* @__PURE__ */ jsx21("canvas", { ref, "aria-hidden": "true", style: { width: size, height: size }, className: "shrink-0 rounded object-contain ring-1 ring-border bg-black" });
4145
+ return /* @__PURE__ */ jsx22("canvas", { ref, "aria-hidden": "true", style: { width: size, height: size }, className: "shrink-0 rounded object-contain ring-1 ring-border bg-black" });
4097
4146
  };
4098
4147
  var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
4099
- const [, setTick] = useState17(0);
4148
+ const [, setTick] = useState18(0);
4100
4149
  useEffect12(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
4101
- const [activeId, setActiveId] = useState17(null);
4102
- const [renaming, setRenaming] = useState17(null);
4103
- const [error, setError] = useState17(null);
4150
+ const [activeId, setActiveId] = useState18(null);
4151
+ const [renaming, setRenaming] = useState18(null);
4152
+ const [error, setError] = useState18(null);
4104
4153
  const fileInput = useRef11(null);
4105
4154
  const channels = controller.getChannels();
4106
4155
  const active = channels.find((c) => c.id === activeId) ?? null;
@@ -4123,13 +4172,13 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
4123
4172
  setError(err instanceof Error ? err.message : String(err));
4124
4173
  }
4125
4174
  };
4126
- return /* @__PURE__ */ jsxs19("div", { "data-testid": "channels-panel", className: `flex flex-col gap-2 text-xs ${className}`, children: [
4127
- /* @__PURE__ */ jsxs19("div", { className: "flex items-center justify-between", children: [
4128
- /* @__PURE__ */ jsx21("span", { className: imageSectionTitleClass, children: "Channels" }),
4129
- /* @__PURE__ */ jsx21("button", { type: "button", "aria-pressed": quickMask, className: btn2(quickMask), title: "Paint the selection: white selects, black deselects (Q)", onClick: () => controller.setQuickMaskMode(!quickMask), children: "Quick Mask" })
4175
+ return /* @__PURE__ */ jsxs20("div", { "data-testid": "channels-panel", className: `flex flex-col gap-2 text-xs ${className}`, children: [
4176
+ /* @__PURE__ */ jsxs20("div", { className: "flex items-center justify-between", children: [
4177
+ /* @__PURE__ */ jsx22("span", { className: imageSectionTitleClass, children: "Channels" }),
4178
+ /* @__PURE__ */ jsx22("button", { type: "button", "aria-pressed": quickMask, className: btn2(quickMask), title: "Paint the selection: white selects, black deselects (Q)", onClick: () => controller.setQuickMaskMode(!quickMask), children: "Quick Mask" })
4130
4179
  ] }),
4131
- channels.length === 0 && /* @__PURE__ */ jsx21("p", { className: "text-muted-foreground", children: "No channels. Save a selection to keep it." }),
4132
- /* @__PURE__ */ jsx21("ul", { role: "list", className: "flex flex-col gap-0.5", children: channels.map((c) => /* @__PURE__ */ jsxs19(
4180
+ channels.length === 0 && /* @__PURE__ */ jsx22("p", { className: "text-muted-foreground", children: "No channels. Save a selection to keep it." }),
4181
+ /* @__PURE__ */ jsx22("ul", { role: "list", className: "flex flex-col gap-0.5", children: channels.map((c) => /* @__PURE__ */ jsxs20(
4133
4182
  "li",
4134
4183
  {
4135
4184
  "data-testid": "channel-row",
@@ -4141,7 +4190,7 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
4141
4190
  },
4142
4191
  onDoubleClick: () => setRenaming(c.id),
4143
4192
  children: [
4144
- /* @__PURE__ */ jsx21(
4193
+ /* @__PURE__ */ jsx22(
4145
4194
  "button",
4146
4195
  {
4147
4196
  type: "button",
@@ -4155,8 +4204,8 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
4155
4204
  children: c.visible ? "\u25CF" : "\u25CB"
4156
4205
  }
4157
4206
  ),
4158
- /* @__PURE__ */ jsx21(ChannelThumb, { channel: c, size: thumbnailSize }),
4159
- renaming === c.id ? /* @__PURE__ */ jsx21(
4207
+ /* @__PURE__ */ jsx22(ChannelThumb, { channel: c, size: thumbnailSize }),
4208
+ renaming === c.id ? /* @__PURE__ */ jsx22(
4160
4209
  "input",
4161
4210
  {
4162
4211
  autoFocus: true,
@@ -4173,16 +4222,16 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
4173
4222
  if (e.key === "Escape") setRenaming(null);
4174
4223
  }
4175
4224
  }
4176
- ) : /* @__PURE__ */ jsx21("span", { className: "min-w-0 flex-1 truncate", children: c.name })
4225
+ ) : /* @__PURE__ */ jsx22("span", { className: "min-w-0 flex-1 truncate", children: c.name })
4177
4226
  ]
4178
4227
  },
4179
4228
  c.id
4180
4229
  )) }),
4181
- /* @__PURE__ */ jsxs19("div", { className: "flex flex-wrap gap-1", children: [
4182
- /* @__PURE__ */ jsx21("button", { type: "button", className: btn2(), disabled: !hasSelection, onClick: () => attempt(() => setActiveId(controller.saveSelection().id)), children: "Save Selection" }),
4183
- /* @__PURE__ */ jsx21("button", { type: "button", className: btn2(), disabled: !active || !hasSelection, title: "Add the selection to the channel", onClick: () => attempt(() => controller.saveSelection({ channelId: active.id, mode: "add" })), children: "Add to Channel" }),
4184
- /* @__PURE__ */ jsx21("button", { type: "button", className: btn2(), disabled: !active, onClick: () => attempt(() => setActiveId(controller.duplicateChannel(active.id).id)), children: "Duplicate" }),
4185
- /* @__PURE__ */ jsx21(
4230
+ /* @__PURE__ */ jsxs20("div", { className: "flex flex-wrap gap-1", children: [
4231
+ /* @__PURE__ */ jsx22("button", { type: "button", className: btn2(), disabled: !hasSelection, onClick: () => attempt(() => setActiveId(controller.saveSelection().id)), children: "Save Selection" }),
4232
+ /* @__PURE__ */ jsx22("button", { type: "button", className: btn2(), disabled: !active || !hasSelection, title: "Add the selection to the channel", onClick: () => attempt(() => controller.saveSelection({ channelId: active.id, mode: "add" })), children: "Add to Channel" }),
4233
+ /* @__PURE__ */ jsx22("button", { type: "button", className: btn2(), disabled: !active, onClick: () => attempt(() => setActiveId(controller.duplicateChannel(active.id).id)), children: "Duplicate" }),
4234
+ /* @__PURE__ */ jsx22(
4186
4235
  "button",
4187
4236
  {
4188
4237
  type: "button",
@@ -4195,8 +4244,8 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
4195
4244
  children: "Delete"
4196
4245
  }
4197
4246
  ),
4198
- /* @__PURE__ */ jsx21("button", { type: "button", className: btn2(), title: "Load a mask image (white = selected) into a new channel", onClick: () => fileInput.current?.click(), children: "Import\u2026" }),
4199
- /* @__PURE__ */ jsx21(
4247
+ /* @__PURE__ */ jsx22("button", { type: "button", className: btn2(), title: "Load a mask image (white = selected) into a new channel", onClick: () => fileInput.current?.click(), children: "Import\u2026" }),
4248
+ /* @__PURE__ */ jsx22(
4200
4249
  "button",
4201
4250
  {
4202
4251
  type: "button",
@@ -4207,7 +4256,7 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
4207
4256
  children: "Export PNG"
4208
4257
  }
4209
4258
  ),
4210
- /* @__PURE__ */ jsx21(
4259
+ /* @__PURE__ */ jsx22(
4211
4260
  "input",
4212
4261
  {
4213
4262
  ref: fileInput,
@@ -4222,22 +4271,22 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
4222
4271
  }
4223
4272
  )
4224
4273
  ] }),
4225
- error && /* @__PURE__ */ jsx21("p", { role: "alert", className: "text-destructive", children: error })
4274
+ error && /* @__PURE__ */ jsx22("p", { role: "alert", className: "text-destructive", children: error })
4226
4275
  ] });
4227
4276
  };
4228
4277
 
4229
4278
  // src/image-editor/PathsPanel.tsx
4230
- import { useEffect as useEffect13, useState as useState18 } from "react";
4279
+ import { useEffect as useEffect13, useState as useState19 } from "react";
4231
4280
  import { pathSvgData, selectionModeFromModifiers as selectionModeFromModifiers2 } from "@pixerate/editor/image-editor";
4232
- import { jsx as jsx22, jsxs as jsxs20 } from "react/jsx-runtime";
4281
+ import { jsx as jsx23, jsxs as jsxs21 } from "react/jsx-runtime";
4233
4282
  var btn3 = (on = false) => `px-2 py-1 rounded-md border text-[11px] transition-colors disabled:opacity-40 ${on ? "bg-primary border-primary text-primary-foreground" : "bg-background border-border text-foreground hover:bg-accent hover:text-accent-foreground"}`;
4234
4283
  var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
4235
- const [, setTick] = useState18(0);
4284
+ const [, setTick] = useState19(0);
4236
4285
  useEffect13(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
4237
- const [renaming, setRenaming] = useState18(null);
4238
- const [color, setColor] = useState18("#000000");
4239
- const [width, setWidth] = useState18(2);
4240
- const [error, setError] = useState18(null);
4286
+ const [renaming, setRenaming] = useState19(null);
4287
+ const [color, setColor] = useState19("#000000");
4288
+ const [width, setWidth] = useState19(2);
4289
+ const [error, setError] = useState19(null);
4241
4290
  const paths = controller.getPaths();
4242
4291
  const activeId = controller.getState().activePathId ?? null;
4243
4292
  const active = paths.find((p) => p.id === activeId) ?? null;
@@ -4253,10 +4302,10 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
4253
4302
  };
4254
4303
  return (
4255
4304
  // Clicking the panel's empty space deselects the path (the path tools then edit the active layer).
4256
- /* @__PURE__ */ jsxs20("div", { "data-testid": "paths-panel", className: `flex flex-col gap-2 text-xs ${className}`, onClick: (e) => e.target === e.currentTarget && attempt(() => controller.setActivePath(null)), children: [
4257
- /* @__PURE__ */ jsx22("span", { className: imageSectionTitleClass, children: "Paths" }),
4258
- paths.length === 0 && /* @__PURE__ */ jsx22("p", { className: "text-muted-foreground", children: "No paths. Make a work path from a selection." }),
4259
- /* @__PURE__ */ jsx22("ul", { role: "list", className: "flex flex-col gap-0.5 min-h-4", onClick: (e) => e.target === e.currentTarget && attempt(() => controller.setActivePath(null)), children: paths.map((p) => /* @__PURE__ */ jsxs20(
4305
+ /* @__PURE__ */ jsxs21("div", { "data-testid": "paths-panel", className: `flex flex-col gap-2 text-xs ${className}`, onClick: (e) => e.target === e.currentTarget && attempt(() => controller.setActivePath(null)), children: [
4306
+ /* @__PURE__ */ jsx23("span", { className: imageSectionTitleClass, children: "Paths" }),
4307
+ paths.length === 0 && /* @__PURE__ */ jsx23("p", { className: "text-muted-foreground", children: "No paths. Make a work path from a selection." }),
4308
+ /* @__PURE__ */ jsx23("ul", { role: "list", className: "flex flex-col gap-0.5 min-h-4", onClick: (e) => e.target === e.currentTarget && attempt(() => controller.setActivePath(null)), children: paths.map((p) => /* @__PURE__ */ jsxs21(
4260
4309
  "li",
4261
4310
  {
4262
4311
  "data-testid": "path-row",
@@ -4265,8 +4314,8 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
4265
4314
  onClick: () => attempt(() => controller.setActivePath(p.id)),
4266
4315
  onDoubleClick: () => setRenaming(p.id),
4267
4316
  children: [
4268
- /* @__PURE__ */ jsx22("svg", { "aria-hidden": "true", viewBox: `0 0 ${w || 1} ${h || 1}`, style: { width: thumbnailSize, height: thumbnailSize }, className: "shrink-0 rounded ring-1 ring-border bg-background", children: /* @__PURE__ */ jsx22("path", { d: pathSvgData(p), fill: "currentColor", fillOpacity: 0.25, stroke: "currentColor", strokeWidth: Math.max(w, h) / 64, fillRule: p.fillRule ?? "nonzero" }) }),
4269
- renaming === p.id ? /* @__PURE__ */ jsx22(
4317
+ /* @__PURE__ */ jsx23("svg", { "aria-hidden": "true", viewBox: `0 0 ${w || 1} ${h || 1}`, style: { width: thumbnailSize, height: thumbnailSize }, className: "shrink-0 rounded ring-1 ring-border bg-background", children: /* @__PURE__ */ jsx23("path", { d: pathSvgData(p), fill: "currentColor", fillOpacity: 0.25, stroke: "currentColor", strokeWidth: Math.max(w, h) / 64, fillRule: p.fillRule ?? "nonzero" }) }),
4318
+ renaming === p.id ? /* @__PURE__ */ jsx23(
4270
4319
  "input",
4271
4320
  {
4272
4321
  autoFocus: true,
@@ -4285,13 +4334,13 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
4285
4334
  if (e.key === "Escape") setRenaming(null);
4286
4335
  }
4287
4336
  }
4288
- ) : /* @__PURE__ */ jsx22("span", { className: `min-w-0 flex-1 truncate ${p.work ? "italic" : ""}`, children: p.name })
4337
+ ) : /* @__PURE__ */ jsx23("span", { className: `min-w-0 flex-1 truncate ${p.work ? "italic" : ""}`, children: p.name })
4289
4338
  ]
4290
4339
  },
4291
4340
  p.id
4292
4341
  )) }),
4293
- /* @__PURE__ */ jsxs20("div", { className: "flex flex-wrap gap-1", children: [
4294
- /* @__PURE__ */ jsx22(
4342
+ /* @__PURE__ */ jsxs21("div", { className: "flex flex-wrap gap-1", children: [
4343
+ /* @__PURE__ */ jsx23(
4295
4344
  "button",
4296
4345
  {
4297
4346
  type: "button",
@@ -4302,15 +4351,15 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
4302
4351
  children: "Load as Selection"
4303
4352
  }
4304
4353
  ),
4305
- /* @__PURE__ */ jsx22("button", { type: "button", className: btn3(), disabled: !hasSelection, onClick: () => attempt(() => controller.makeWorkPath()), children: "Make Work Path" }),
4306
- active?.work && /* @__PURE__ */ jsx22("button", { type: "button", className: btn3(), onClick: () => setRenaming(active.id), children: "Save Path" }),
4307
- /* @__PURE__ */ jsx22("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.addVectorMaskFromPath(active.id)), children: "Add Vector Mask" })
4354
+ /* @__PURE__ */ jsx23("button", { type: "button", className: btn3(), disabled: !hasSelection, onClick: () => attempt(() => controller.makeWorkPath()), children: "Make Work Path" }),
4355
+ active?.work && /* @__PURE__ */ jsx23("button", { type: "button", className: btn3(), onClick: () => setRenaming(active.id), children: "Save Path" }),
4356
+ /* @__PURE__ */ jsx23("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.addVectorMaskFromPath(active.id)), children: "Add Vector Mask" })
4308
4357
  ] }),
4309
- /* @__PURE__ */ jsxs20("div", { className: "flex flex-wrap items-center gap-1", children: [
4310
- /* @__PURE__ */ jsx22("input", { type: "color", "aria-label": "Path paint colour", value: color, onChange: (e) => setColor(e.target.value), className: "h-6 w-8 bg-background border border-border rounded" }),
4311
- /* @__PURE__ */ jsx22("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.fillPath(active.id, { color })), children: "Fill Path" }),
4312
- /* @__PURE__ */ jsxs20("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
4313
- /* @__PURE__ */ jsx22(
4358
+ /* @__PURE__ */ jsxs21("div", { className: "flex flex-wrap items-center gap-1", children: [
4359
+ /* @__PURE__ */ jsx23("input", { type: "color", "aria-label": "Path paint colour", value: color, onChange: (e) => setColor(e.target.value), className: "h-6 w-8 bg-background border border-border rounded" }),
4360
+ /* @__PURE__ */ jsx23("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.fillPath(active.id, { color })), children: "Fill Path" }),
4361
+ /* @__PURE__ */ jsxs21("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
4362
+ /* @__PURE__ */ jsx23(
4314
4363
  "input",
4315
4364
  {
4316
4365
  type: "number",
@@ -4325,24 +4374,24 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
4325
4374
  ),
4326
4375
  "px"
4327
4376
  ] }),
4328
- /* @__PURE__ */ jsx22("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.strokePath(active.id, { width, color })), children: "Stroke Path" })
4377
+ /* @__PURE__ */ jsx23("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.strokePath(active.id, { width, color })), children: "Stroke Path" })
4329
4378
  ] }),
4330
- /* @__PURE__ */ jsxs20("div", { className: "flex flex-wrap gap-1", children: [
4331
- /* @__PURE__ */ jsx22("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.duplicatePath(active.id)), children: "Duplicate" }),
4332
- /* @__PURE__ */ jsx22("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.deletePath(active.id)), children: "Delete" })
4379
+ /* @__PURE__ */ jsxs21("div", { className: "flex flex-wrap gap-1", children: [
4380
+ /* @__PURE__ */ jsx23("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.duplicatePath(active.id)), children: "Duplicate" }),
4381
+ /* @__PURE__ */ jsx23("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.deletePath(active.id)), children: "Delete" })
4333
4382
  ] }),
4334
- error && /* @__PURE__ */ jsx22("p", { role: "alert", className: "text-destructive", children: error })
4383
+ error && /* @__PURE__ */ jsx23("p", { role: "alert", className: "text-destructive", children: error })
4335
4384
  ] })
4336
4385
  );
4337
4386
  };
4338
4387
 
4339
4388
  // src/image-editor/FreeTransformOptionsBar.tsx
4340
- import { useEffect as useEffect14, useState as useState19 } from "react";
4389
+ import { useEffect as useEffect14, useState as useState20 } from "react";
4341
4390
  import { FREE_TRANSFORM_FIELDS, FREE_TRANSFORM_MODE_OPTIONS, INTERPOLATIONS, TRANSFORM_ANCHORS, WARP_GRID_OPTIONS, WARP_STYLE_OPTIONS } from "@pixerate/editor/image-editor";
4342
- import { jsx as jsx23, jsxs as jsxs21 } from "react/jsx-runtime";
4391
+ import { jsx as jsx24, jsxs as jsxs22 } from "react/jsx-runtime";
4343
4392
  var round = (v, unit) => unit === "px" ? Math.round(v * 10) / 10 : Math.round(v * 100) / 100;
4344
4393
  var FreeTransformOptionsBar = ({ tool, className }) => {
4345
- const [, setTick] = useState19(0);
4394
+ const [, setTick] = useState20(0);
4346
4395
  useEffect14(() => tool.subscribe(() => setTick((n) => n + 1)), [tool]);
4347
4396
  const bar = tool.bar();
4348
4397
  if (!tool.active || !bar) return null;
@@ -4355,17 +4404,17 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
4355
4404
  const v = Number(raw);
4356
4405
  if (raw.trim() !== "" && Number.isFinite(v) && Math.abs(v - bar[field]) > 1e-9) tool.setField(field, v);
4357
4406
  };
4358
- return /* @__PURE__ */ jsxs21("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: [
4359
- /* @__PURE__ */ jsx23("div", { className: "flex gap-1", role: "group", "aria-label": "Transform mode", children: FREE_TRANSFORM_MODE_OPTIONS.map((m) => /* @__PURE__ */ jsx23("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)) }),
4360
- /* @__PURE__ */ jsx23("div", { className: "grid grid-cols-3 gap-px", role: "group", "aria-label": "Reference point", children: TRANSFORM_ANCHORS.map((a) => /* @__PURE__ */ jsx23("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)) }),
4361
- tool.mode === "warp" && /* @__PURE__ */ jsxs21("div", { className: "flex flex-wrap items-center gap-2", role: "group", "aria-label": "Warp options", children: [
4362
- /* @__PURE__ */ jsxs21("label", { className: "flex items-center gap-1", children: [
4363
- /* @__PURE__ */ jsx23("span", { className: "text-muted-foreground", children: "Warp" }),
4364
- /* @__PURE__ */ jsx23("select", { "aria-label": "Warp style", value: warp.style, onChange: (e) => tool.setWarp({ style: e.target.value }), className: imageFieldClass, children: WARP_STYLE_OPTIONS.map((o) => /* @__PURE__ */ jsx23("option", { value: o.id, children: o.label }, o.id)) })
4407
+ return /* @__PURE__ */ jsxs22("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: [
4408
+ /* @__PURE__ */ jsx24("div", { className: "flex gap-1", role: "group", "aria-label": "Transform mode", children: FREE_TRANSFORM_MODE_OPTIONS.map((m) => /* @__PURE__ */ jsx24("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)) }),
4409
+ /* @__PURE__ */ jsx24("div", { className: "grid grid-cols-3 gap-px", role: "group", "aria-label": "Reference point", children: TRANSFORM_ANCHORS.map((a) => /* @__PURE__ */ jsx24("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)) }),
4410
+ tool.mode === "warp" && /* @__PURE__ */ jsxs22("div", { className: "flex flex-wrap items-center gap-2", role: "group", "aria-label": "Warp options", children: [
4411
+ /* @__PURE__ */ jsxs22("label", { className: "flex items-center gap-1", children: [
4412
+ /* @__PURE__ */ jsx24("span", { className: "text-muted-foreground", children: "Warp" }),
4413
+ /* @__PURE__ */ jsx24("select", { "aria-label": "Warp style", value: warp.style, onChange: (e) => tool.setWarp({ style: e.target.value }), className: imageFieldClass, children: WARP_STYLE_OPTIONS.map((o) => /* @__PURE__ */ jsx24("option", { value: o.id, children: o.label }, o.id)) })
4365
4414
  ] }),
4366
- ["bend", "horizontal", "vertical"].map((k) => /* @__PURE__ */ jsxs21("label", { className: "flex items-center gap-1", children: [
4367
- /* @__PURE__ */ jsx23("span", { className: "text-muted-foreground", children: k === "bend" ? "Bend" : k === "horizontal" ? "H" : "V" }),
4368
- /* @__PURE__ */ jsx23(
4415
+ ["bend", "horizontal", "vertical"].map((k) => /* @__PURE__ */ jsxs22("label", { className: "flex items-center gap-1", children: [
4416
+ /* @__PURE__ */ jsx24("span", { className: "text-muted-foreground", children: k === "bend" ? "Bend" : k === "horizontal" ? "H" : "V" }),
4417
+ /* @__PURE__ */ jsx24(
4369
4418
  "input",
4370
4419
  {
4371
4420
  type: "number",
@@ -4386,9 +4435,9 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
4386
4435
  },
4387
4436
  `${k}:${warp[k]}`
4388
4437
  ),
4389
- /* @__PURE__ */ jsx23("span", { className: "text-muted-foreground", children: "%" })
4438
+ /* @__PURE__ */ jsx24("span", { className: "text-muted-foreground", children: "%" })
4390
4439
  ] }, k)),
4391
- /* @__PURE__ */ jsx23(
4440
+ /* @__PURE__ */ jsx24(
4392
4441
  "button",
4393
4442
  {
4394
4443
  type: "button",
@@ -4400,9 +4449,9 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
4400
4449
  children: "Vertical"
4401
4450
  }
4402
4451
  ),
4403
- /* @__PURE__ */ jsxs21("label", { className: "flex items-center gap-1", children: [
4404
- /* @__PURE__ */ jsx23("span", { className: "text-muted-foreground", children: "Grid" }),
4405
- /* @__PURE__ */ jsx23(
4452
+ /* @__PURE__ */ jsxs22("label", { className: "flex items-center gap-1", children: [
4453
+ /* @__PURE__ */ jsx24("span", { className: "text-muted-foreground", children: "Grid" }),
4454
+ /* @__PURE__ */ jsx24(
4406
4455
  "select",
4407
4456
  {
4408
4457
  "aria-label": "Warp grid",
@@ -4412,14 +4461,14 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
4412
4461
  tool.setWarp({ columns: g.columns, rows: g.rows });
4413
4462
  },
4414
4463
  className: imageFieldClass,
4415
- children: WARP_GRID_OPTIONS.map((g) => /* @__PURE__ */ jsx23("option", { value: g.id, children: g.label }, g.id))
4464
+ children: WARP_GRID_OPTIONS.map((g) => /* @__PURE__ */ jsx24("option", { value: g.id, children: g.label }, g.id))
4416
4465
  }
4417
4466
  )
4418
4467
  ] })
4419
4468
  ] }),
4420
- tool.mode !== "warp" && FREE_TRANSFORM_FIELDS.map((f) => /* @__PURE__ */ jsxs21("label", { className: "flex items-center gap-1", title: f.title, children: [
4421
- /* @__PURE__ */ jsx23("span", { className: "text-muted-foreground", children: f.label }),
4422
- /* @__PURE__ */ jsx23(
4469
+ tool.mode !== "warp" && FREE_TRANSFORM_FIELDS.map((f) => /* @__PURE__ */ jsxs22("label", { className: "flex items-center gap-1", title: f.title, children: [
4470
+ /* @__PURE__ */ jsx24("span", { className: "text-muted-foreground", children: f.label }),
4471
+ /* @__PURE__ */ jsx24(
4423
4472
  "input",
4424
4473
  {
4425
4474
  type: "number",
@@ -4439,8 +4488,8 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
4439
4488
  },
4440
4489
  `${f.id}:${round(bar[f.id], f.unit)}`
4441
4490
  ),
4442
- /* @__PURE__ */ jsx23("span", { className: "text-muted-foreground", children: f.unit }),
4443
- f.id === "scaleX" && /* @__PURE__ */ jsx23(
4491
+ /* @__PURE__ */ jsx24("span", { className: "text-muted-foreground", children: f.unit }),
4492
+ f.id === "scaleX" && /* @__PURE__ */ jsx24(
4444
4493
  "button",
4445
4494
  {
4446
4495
  type: "button",
@@ -4455,33 +4504,33 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
4455
4504
  }
4456
4505
  )
4457
4506
  ] }, f.id)),
4458
- /* @__PURE__ */ jsxs21("label", { className: "flex items-center gap-1", children: [
4459
- /* @__PURE__ */ jsx23("span", { className: "text-muted-foreground", children: "Interpolation" }),
4460
- /* @__PURE__ */ jsx23(
4507
+ /* @__PURE__ */ jsxs22("label", { className: "flex items-center gap-1", children: [
4508
+ /* @__PURE__ */ jsx24("span", { className: "text-muted-foreground", children: "Interpolation" }),
4509
+ /* @__PURE__ */ jsx24(
4461
4510
  "select",
4462
4511
  {
4463
4512
  "aria-label": "Interpolation",
4464
4513
  value: tool.interpolation,
4465
4514
  onChange: (e) => tool.setInterpolation(e.target.value),
4466
4515
  className: imageFieldClass,
4467
- children: INTERPOLATIONS.map((i) => /* @__PURE__ */ jsx23("option", { value: i, children: i[0].toUpperCase() + i.slice(1) }, i))
4516
+ children: INTERPOLATIONS.map((i) => /* @__PURE__ */ jsx24("option", { value: i, children: i[0].toUpperCase() + i.slice(1) }, i))
4468
4517
  }
4469
4518
  )
4470
4519
  ] }),
4471
- /* @__PURE__ */ jsx23("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" }),
4472
- /* @__PURE__ */ jsx23("button", { type: "button", title: "Cancel (Esc)", className: imageChipClass(false), onClick: () => tool.cancel(), children: "Cancel" }),
4473
- tool.error && /* @__PURE__ */ jsx23("span", { role: "alert", className: "text-destructive", children: tool.error })
4520
+ /* @__PURE__ */ jsx24("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" }),
4521
+ /* @__PURE__ */ jsx24("button", { type: "button", title: "Cancel (Esc)", className: imageChipClass(false), onClick: () => tool.cancel(), children: "Cancel" }),
4522
+ tool.error && /* @__PURE__ */ jsx24("span", { role: "alert", className: "text-destructive", children: tool.error })
4474
4523
  ] });
4475
4524
  };
4476
4525
 
4477
4526
  // src/image-editor/ShapeOptionsBar.tsx
4478
- import { useEffect as useEffect15, useState as useState20 } from "react";
4527
+ import { useEffect as useEffect15, useState as useState21 } from "react";
4479
4528
  import { LIVE_SHAPE_KINDS, SHAPE_KIND_LABELS, applyShapeOptions } from "@pixerate/editor/image-editor";
4480
- import { Fragment as Fragment6, jsx as jsx24, jsxs as jsxs22 } from "react/jsx-runtime";
4529
+ import { Fragment as Fragment7, jsx as jsx25, jsxs as jsxs23 } from "react/jsx-runtime";
4481
4530
  var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
4482
- const [, setTick] = useState20(0);
4531
+ const [, setTick] = useState21(0);
4483
4532
  useEffect15(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
4484
- const [error, setError] = useState20(null);
4533
+ const [error, setError] = useState21(null);
4485
4534
  const active = controller.getActiveLayer();
4486
4535
  const shapeId = active?.type === "shape" ? active.id : null;
4487
4536
  const set = (change) => {
@@ -4495,22 +4544,22 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
4495
4544
  }
4496
4545
  };
4497
4546
  const num = (v, min, max) => Math.max(min, Math.min(max, Number(v) || min));
4498
- return /* @__PURE__ */ jsxs22("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "shape-options", children: [
4499
- /* @__PURE__ */ jsx24("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Shape kind", children: LIVE_SHAPE_KINDS.map((k) => /* @__PURE__ */ jsx24("button", { type: "button", "aria-pressed": options.kind === k, className: imageChipClass(options.kind === k), onClick: () => onChange({ ...options, kind: k }), children: SHAPE_KIND_LABELS[k] }, k)) }),
4500
- /* @__PURE__ */ jsxs22("div", { className: "flex flex-wrap items-center gap-3", children: [
4501
- /* @__PURE__ */ jsxs22("label", { className: "flex items-center gap-1", children: [
4502
- /* @__PURE__ */ jsx24(ImageCheckbox, { label: "Fill", checked: options.fill !== null, onChange: (on) => set({ fill: on ? "#4f46e5" : null }) }),
4547
+ return /* @__PURE__ */ jsxs23("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "shape-options", children: [
4548
+ /* @__PURE__ */ jsx25("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Shape kind", children: LIVE_SHAPE_KINDS.map((k) => /* @__PURE__ */ jsx25("button", { type: "button", "aria-pressed": options.kind === k, className: imageChipClass(options.kind === k), onClick: () => onChange({ ...options, kind: k }), children: SHAPE_KIND_LABELS[k] }, k)) }),
4549
+ /* @__PURE__ */ jsxs23("div", { className: "flex flex-wrap items-center gap-3", children: [
4550
+ /* @__PURE__ */ jsxs23("label", { className: "flex items-center gap-1", children: [
4551
+ /* @__PURE__ */ jsx25(ImageCheckbox, { label: "Fill", checked: options.fill !== null, onChange: (on) => set({ fill: on ? "#4f46e5" : null }) }),
4503
4552
  "Fill",
4504
- /* @__PURE__ */ jsx24(ImageColor, { label: "Fill colour", disabled: options.fill === null, value: options.fill ?? "#4f46e5", onChange: (fill) => set({ fill }) })
4553
+ /* @__PURE__ */ jsx25(ImageColor, { label: "Fill colour", disabled: options.fill === null, value: options.fill ?? "#4f46e5", onChange: (fill) => set({ fill }) })
4505
4554
  ] }),
4506
- /* @__PURE__ */ jsxs22("label", { className: "flex items-center gap-1", children: [
4507
- /* @__PURE__ */ jsx24(ImageCheckbox, { label: "Stroke", checked: options.stroke !== null, onChange: (on) => set({ stroke: on ? "#000000" : null }) }),
4555
+ /* @__PURE__ */ jsxs23("label", { className: "flex items-center gap-1", children: [
4556
+ /* @__PURE__ */ jsx25(ImageCheckbox, { label: "Stroke", checked: options.stroke !== null, onChange: (on) => set({ stroke: on ? "#000000" : null }) }),
4508
4557
  "Stroke",
4509
- /* @__PURE__ */ jsx24(ImageColor, { label: "Stroke colour", disabled: options.stroke === null, value: options.stroke ?? "#000000", onChange: (stroke) => set({ stroke }) })
4558
+ /* @__PURE__ */ jsx25(ImageColor, { label: "Stroke colour", disabled: options.stroke === null, value: options.stroke ?? "#000000", onChange: (stroke) => set({ stroke }) })
4510
4559
  ] }),
4511
- /* @__PURE__ */ jsxs22("label", { className: "flex items-center gap-1", children: [
4560
+ /* @__PURE__ */ jsxs23("label", { className: "flex items-center gap-1", children: [
4512
4561
  "Width",
4513
- /* @__PURE__ */ jsx24(
4562
+ /* @__PURE__ */ jsx25(
4514
4563
  "input",
4515
4564
  {
4516
4565
  type: "number",
@@ -4524,52 +4573,52 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
4524
4573
  )
4525
4574
  ] })
4526
4575
  ] }),
4527
- /* @__PURE__ */ jsxs22("div", { className: "flex flex-wrap items-center gap-3", children: [
4528
- options.kind === "rect" && /* @__PURE__ */ jsxs22("label", { className: "flex items-center gap-1", children: [
4576
+ /* @__PURE__ */ jsxs23("div", { className: "flex flex-wrap items-center gap-3", children: [
4577
+ options.kind === "rect" && /* @__PURE__ */ jsxs23("label", { className: "flex items-center gap-1", children: [
4529
4578
  "Radius",
4530
- /* @__PURE__ */ jsx24("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}` })
4579
+ /* @__PURE__ */ jsx25("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}` })
4531
4580
  ] }),
4532
- options.kind === "polygon" && /* @__PURE__ */ jsxs22("label", { className: "flex items-center gap-1", children: [
4581
+ options.kind === "polygon" && /* @__PURE__ */ jsxs23("label", { className: "flex items-center gap-1", children: [
4533
4582
  "Sides",
4534
- /* @__PURE__ */ jsx24("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}` })
4583
+ /* @__PURE__ */ jsx25("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}` })
4535
4584
  ] }),
4536
- options.kind === "star" && /* @__PURE__ */ jsxs22(Fragment6, { children: [
4537
- /* @__PURE__ */ jsxs22("label", { className: "flex items-center gap-1", children: [
4585
+ options.kind === "star" && /* @__PURE__ */ jsxs23(Fragment7, { children: [
4586
+ /* @__PURE__ */ jsxs23("label", { className: "flex items-center gap-1", children: [
4538
4587
  "Points",
4539
- /* @__PURE__ */ jsx24("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}` })
4588
+ /* @__PURE__ */ jsx25("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}` })
4540
4589
  ] }),
4541
- /* @__PURE__ */ jsxs22("label", { className: "flex items-center gap-1", children: [
4590
+ /* @__PURE__ */ jsxs23("label", { className: "flex items-center gap-1", children: [
4542
4591
  "Inner",
4543
- /* @__PURE__ */ jsx24(ImageRange, { label: "Inner radius", min: 0.05, max: 1, step: 0.05, value: options.innerRatio, onChange: (v) => set({ innerRatio: v }) })
4592
+ /* @__PURE__ */ jsx25(ImageRange, { label: "Inner radius", min: 0.05, max: 1, step: 0.05, value: options.innerRatio, onChange: (v) => set({ innerRatio: v }) })
4544
4593
  ] })
4545
4594
  ] }),
4546
- options.kind === "line" && /* @__PURE__ */ jsxs22(Fragment6, { children: [
4547
- /* @__PURE__ */ jsxs22("label", { className: "flex items-center gap-1", children: [
4595
+ options.kind === "line" && /* @__PURE__ */ jsxs23(Fragment7, { children: [
4596
+ /* @__PURE__ */ jsxs23("label", { className: "flex items-center gap-1", children: [
4548
4597
  "Weight",
4549
- /* @__PURE__ */ jsx24("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}` })
4598
+ /* @__PURE__ */ jsx25("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}` })
4550
4599
  ] }),
4551
- /* @__PURE__ */ jsxs22("label", { className: "flex items-center gap-1", children: [
4552
- /* @__PURE__ */ jsx24(ImageCheckbox, { label: "Arrowhead", checked: options.arrow, onChange: (on) => set({ arrow: on }) }),
4600
+ /* @__PURE__ */ jsxs23("label", { className: "flex items-center gap-1", children: [
4601
+ /* @__PURE__ */ jsx25(ImageCheckbox, { label: "Arrowhead", checked: options.arrow, onChange: (on) => set({ arrow: on }) }),
4553
4602
  "Arrowhead"
4554
4603
  ] })
4555
4604
  ] })
4556
4605
  ] }),
4557
- /* @__PURE__ */ jsx24("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." }),
4558
- error && /* @__PURE__ */ jsx24("p", { role: "alert", className: "text-destructive", children: error })
4606
+ /* @__PURE__ */ jsx25("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." }),
4607
+ error && /* @__PURE__ */ jsx25("p", { role: "alert", className: "text-destructive", children: error })
4559
4608
  ] });
4560
4609
  };
4561
4610
 
4562
4611
  // src/image-editor/TypeOptionsBar.tsx
4563
- import { useEffect as useEffect16, useState as useState21 } from "react";
4612
+ import { useEffect as useEffect16, useState as useState22 } from "react";
4564
4613
  import { TEXT_ALIGNS, TEXT_ORIENTATIONS } from "@pixerate/editor/image-editor";
4565
- import { jsx as jsx25, jsxs as jsxs23 } from "react/jsx-runtime";
4614
+ import { jsx as jsx26, jsxs as jsxs24 } from "react/jsx-runtime";
4566
4615
  var ALIGN_LABELS = { left: "Left", center: "Centre", right: "Right", justify: "Justify" };
4567
4616
  var ORIENTATION_LABELS = { horizontal: "Horizontal", vertical: "Vertical" };
4568
4617
  var TypeOptionsBar = ({ controller, options, onChange, session, className }) => {
4569
- const [, setTick] = useState21(0);
4618
+ const [, setTick] = useState22(0);
4570
4619
  useEffect16(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
4571
4620
  useEffect16(() => session?.subscribe(() => setTick((n) => n + 1)), [session]);
4572
- const [error, setError] = useState21(null);
4621
+ const [error, setError] = useState22(null);
4573
4622
  const active = controller.getActiveLayer();
4574
4623
  const typeId = !session && active?.type === "type" ? active.id : null;
4575
4624
  const here = session?.alive ? session.styleHere() : {};
@@ -4622,11 +4671,11 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
4622
4671
  setError(e instanceof Error ? e.message : String(e));
4623
4672
  }
4624
4673
  };
4625
- return /* @__PURE__ */ jsxs23("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "type-options", children: [
4626
- /* @__PURE__ */ jsxs23("div", { className: "flex flex-wrap items-center gap-2", children: [
4627
- /* @__PURE__ */ jsxs23("label", { className: "flex items-center gap-1", children: [
4674
+ return /* @__PURE__ */ jsxs24("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "type-options", children: [
4675
+ /* @__PURE__ */ jsxs24("div", { className: "flex flex-wrap items-center gap-2", children: [
4676
+ /* @__PURE__ */ jsxs24("label", { className: "flex items-center gap-1", children: [
4628
4677
  "Font",
4629
- /* @__PURE__ */ jsx25(
4678
+ /* @__PURE__ */ jsx26(
4630
4679
  "input",
4631
4680
  {
4632
4681
  list: "pixerate-type-fonts",
@@ -4636,11 +4685,11 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
4636
4685
  className: "w-32 rounded border border-border bg-background px-1 py-0.5"
4637
4686
  }
4638
4687
  ),
4639
- /* @__PURE__ */ jsx25("datalist", { id: "pixerate-type-fonts", children: fonts.map((f) => /* @__PURE__ */ jsx25("option", { value: f }, f)) })
4688
+ /* @__PURE__ */ jsx26("datalist", { id: "pixerate-type-fonts", children: fonts.map((f) => /* @__PURE__ */ jsx26("option", { value: f }, f)) })
4640
4689
  ] }),
4641
- /* @__PURE__ */ jsxs23("label", { className: "flex items-center gap-1", children: [
4690
+ /* @__PURE__ */ jsxs24("label", { className: "flex items-center gap-1", children: [
4642
4691
  "Size",
4643
- /* @__PURE__ */ jsx25(
4692
+ /* @__PURE__ */ jsx26(
4644
4693
  "input",
4645
4694
  {
4646
4695
  type: "number",
@@ -4653,14 +4702,14 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
4653
4702
  }
4654
4703
  )
4655
4704
  ] }),
4656
- /* @__PURE__ */ jsx25("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" }),
4657
- /* @__PURE__ */ jsx25("button", { type: "button", "aria-pressed": shown.italic, className: `${imageChipClass(shown.italic)} italic`, onClick: () => style({ italic: !shown.italic }), children: "I" }),
4658
- /* @__PURE__ */ jsx25(ImageColor, { label: "Text colour", value: shown.color, onChange: (color) => style({ color }) })
4705
+ /* @__PURE__ */ jsx26("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" }),
4706
+ /* @__PURE__ */ jsx26("button", { type: "button", "aria-pressed": shown.italic, className: `${imageChipClass(shown.italic)} italic`, onClick: () => style({ italic: !shown.italic }), children: "I" }),
4707
+ /* @__PURE__ */ jsx26(ImageColor, { label: "Text colour", value: shown.color, onChange: (color) => style({ color }) })
4659
4708
  ] }),
4660
- /* @__PURE__ */ jsx25("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Alignment", children: TEXT_ALIGNS.map((a) => /* @__PURE__ */ jsx25("button", { type: "button", "aria-pressed": options.align === a, className: imageChipClass(options.align === a), onClick: () => style({ align: a }), children: ALIGN_LABELS[a] }, a)) }),
4661
- /* @__PURE__ */ jsxs23("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Orientation", children: [
4662
- TEXT_ORIENTATIONS.map((o) => /* @__PURE__ */ jsx25("button", { type: "button", "aria-pressed": orientation === o, className: imageChipClass(orientation === o), onClick: () => orient(o), children: ORIENTATION_LABELS[o] }, o)),
4663
- orientation === "vertical" && editedId && /* @__PURE__ */ jsx25(
4709
+ /* @__PURE__ */ jsx26("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Alignment", children: TEXT_ALIGNS.map((a) => /* @__PURE__ */ jsx26("button", { type: "button", "aria-pressed": options.align === a, className: imageChipClass(options.align === a), onClick: () => style({ align: a }), children: ALIGN_LABELS[a] }, a)) }),
4710
+ /* @__PURE__ */ jsxs24("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Orientation", children: [
4711
+ TEXT_ORIENTATIONS.map((o) => /* @__PURE__ */ jsx26("button", { type: "button", "aria-pressed": orientation === o, className: imageChipClass(orientation === o), onClick: () => orient(o), children: ORIENTATION_LABELS[o] }, o)),
4712
+ orientation === "vertical" && editedId && /* @__PURE__ */ jsx26(
4664
4713
  "button",
4665
4714
  {
4666
4715
  type: "button",
@@ -4672,19 +4721,19 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
4672
4721
  }
4673
4722
  )
4674
4723
  ] }),
4675
- /* @__PURE__ */ jsx25("p", { className: "text-[10px] text-muted-foreground", children: "Click to type point text (vertical: a column down from the click), drag for a paragraph box, click text to edit it. Esc finishes." }),
4676
- missing.length > 0 && /* @__PURE__ */ jsxs23("p", { role: "status", className: "text-amber-600", "data-testid": "type-missing-fonts", children: [
4724
+ /* @__PURE__ */ jsx26("p", { className: "text-[10px] text-muted-foreground", children: "Click to type point text (vertical: a column down from the click), drag for a paragraph box, click text to edit it. Esc finishes." }),
4725
+ missing.length > 0 && /* @__PURE__ */ jsxs24("p", { role: "status", className: "text-amber-600", "data-testid": "type-missing-fonts", children: [
4677
4726
  "Missing ",
4678
4727
  missing.length === 1 ? "font" : "fonts",
4679
4728
  ": ",
4680
4729
  missing.join(", ")
4681
4730
  ] }),
4682
- error && /* @__PURE__ */ jsx25("p", { role: "alert", className: "text-destructive", children: error })
4731
+ error && /* @__PURE__ */ jsx26("p", { role: "alert", className: "text-destructive", children: error })
4683
4732
  ] });
4684
4733
  };
4685
4734
 
4686
4735
  // src/image-editor/ImageEditor.tsx
4687
- import { Fragment as Fragment7, jsx as jsx26, jsxs as jsxs24 } from "react/jsx-runtime";
4736
+ import { Fragment as Fragment8, jsx as jsx27, jsxs as jsxs25 } from "react/jsx-runtime";
4688
4737
  var ImageEditor = ({
4689
4738
  editor: externalEditor,
4690
4739
  src,
@@ -4709,7 +4758,7 @@ var ImageEditor = ({
4709
4758
  return l.type === "pixel" && !!l.generator || l.type === "smart" && !!l.smartFilters?.filters.some((f) => f.kind === "effect") || l.type === "group" && l.children.some(has);
4710
4759
  });
4711
4760
  const legacyProcess = normalizeProcessVersion(state.adjustments.process) < LATEST_PROCESS_VERSION;
4712
- const [activeTab, setActiveTab] = useState22("crop");
4761
+ const [activeTab, setActiveTab] = useState23("crop");
4713
4762
  const rootRef = useRef12(null);
4714
4763
  const canvasMode = activeTab === "crop" || activeTab === "select" || activeTab === "paint" || activeTab === "annotate" ? activeTab : "none";
4715
4764
  const activeTabRef = useRef12(activeTab);
@@ -4719,14 +4768,14 @@ var ImageEditor = ({
4719
4768
  rootRef.current?.querySelector(`[data-image-tab="${CSS.escape(ref.id)}"]`)?.click();
4720
4769
  await new Promise((resolve) => setTimeout(resolve, 60));
4721
4770
  };
4722
- const [activeCropRatio, setActiveCropRatio] = useState22(null);
4723
- const [selectionOptions, setSelectionOptions] = useState22(DEFAULT_SELECTION_TOOL_OPTIONS2);
4724
- const [shapeOptions, setShapeOptions] = useState22(DEFAULT_SHAPE_TOOL_OPTIONS2);
4725
- const [typeOptions, setTypeOptions] = useState22(DEFAULT_TYPE_TOOL_OPTIONS2);
4726
- const [typeSession, setTypeSession] = useState22(null);
4727
- const [selectionError, setSelectionError] = useState22(null);
4728
- const [paintError, setPaintError] = useState22(null);
4729
- const [shapeTypeError, setShapeTypeError] = useState22(null);
4771
+ const [activeCropRatio, setActiveCropRatio] = useState23(null);
4772
+ const [selectionOptions, setSelectionOptions] = useState23(DEFAULT_SELECTION_TOOL_OPTIONS2);
4773
+ const [shapeOptions, setShapeOptions] = useState23(DEFAULT_SHAPE_TOOL_OPTIONS2);
4774
+ const [typeOptions, setTypeOptions] = useState23(DEFAULT_TYPE_TOOL_OPTIONS2);
4775
+ const [typeSession, setTypeSession] = useState23(null);
4776
+ const [selectionError, setSelectionError] = useState23(null);
4777
+ const [paintError, setPaintError] = useState23(null);
4778
+ const [shapeTypeError, setShapeTypeError] = useState23(null);
4730
4779
  const handleCanvasError = (source, message) => {
4731
4780
  if (source === "paint") setPaintError(message);
4732
4781
  else if (source === "select") setSelectionError(message);
@@ -4743,16 +4792,16 @@ var ImageEditor = ({
4743
4792
  transformControllerRef.current = controller;
4744
4793
  }
4745
4794
  const transformTool = transformToolRef.current;
4746
- const [, setTransformTick] = useState22(0);
4795
+ const [, setTransformTick] = useState23(0);
4747
4796
  useEffect17(() => transformTool.subscribe(() => setTransformTick((n) => n + 1)), [transformTool]);
4748
4797
  useEffect17(() => () => transformToolRef.current?.cancel(), []);
4749
- const [inpaintPrompt, setInpaintPrompt] = useState22("");
4750
- const [inpaintMaskMode, setInpaintMaskMode] = useState22("annotations");
4751
- const [isRemovingBg, setIsRemovingBg] = useState22(false);
4752
- const [isInpainting, setIsInpainting] = useState22(false);
4753
- const [aiError, setAiError] = useState22(null);
4754
- const [aiSuccess, setAiSuccess] = useState22(null);
4755
- const [aiTarget, setAiTarget] = useState22("auto");
4798
+ const [inpaintPrompt, setInpaintPrompt] = useState23("");
4799
+ const [inpaintMaskMode, setInpaintMaskMode] = useState23("annotations");
4800
+ const [isRemovingBg, setIsRemovingBg] = useState23(false);
4801
+ const [isInpainting, setIsInpainting] = useState23(false);
4802
+ const [aiError, setAiError] = useState23(null);
4803
+ const [aiSuccess, setAiSuccess] = useState23(null);
4804
+ const [aiTarget, setAiTarget] = useState23("auto");
4756
4805
  const aiOptions = aiTarget === "auto" ? {} : { target: aiTarget };
4757
4806
  const effectiveOnInpaint = onInpaint || aiHooks?.onInpaint;
4758
4807
  const effectiveOnRemoveBg = onRemoveBackground || aiHooks?.onRemoveBackground;
@@ -4815,10 +4864,10 @@ var ImageEditor = ({
4815
4864
  setIsInpainting(false);
4816
4865
  }
4817
4866
  };
4818
- const [activeColor, setActiveColor] = useState22("#ef4444");
4819
- const [strokeWidth, setStrokeWidth] = useState22(3);
4820
- const [fontSize, setFontSize] = useState22(24);
4821
- const [textInput, setTextInput] = useState22("");
4867
+ const [activeColor, setActiveColor] = useState23("#ef4444");
4868
+ const [strokeWidth, setStrokeWidth] = useState23(3);
4869
+ const [fontSize, setFontSize] = useState23(24);
4870
+ const [textInput, setTextInput] = useState23("");
4822
4871
  useEffect17(() => {
4823
4872
  if (activeTab === "crop" && editor.state.activeTool !== "crop") {
4824
4873
  editor.setTool("crop");
@@ -4847,16 +4896,16 @@ var ImageEditor = ({
4847
4896
  link.click();
4848
4897
  }
4849
4898
  };
4850
- return /* @__PURE__ */ jsxs24(
4899
+ return /* @__PURE__ */ jsxs25(
4851
4900
  "div",
4852
4901
  {
4853
4902
  ref: rootRef,
4854
4903
  className: `${imageEditorFrameClass} ${className}`,
4855
4904
  style,
4856
4905
  children: [
4857
- /* @__PURE__ */ jsxs24("div", { className: imageEditorHeaderClass, children: [
4858
- /* @__PURE__ */ jsxs24("div", { role: "tablist", className: imageTabListClass, children: [
4859
- /* @__PURE__ */ jsx26(
4906
+ /* @__PURE__ */ jsxs25("div", { className: imageEditorHeaderClass, children: [
4907
+ /* @__PURE__ */ jsxs25("div", { role: "tablist", className: imageTabListClass, children: [
4908
+ /* @__PURE__ */ jsx27(
4860
4909
  "button",
4861
4910
  {
4862
4911
  type: "button",
@@ -4871,7 +4920,7 @@ var ImageEditor = ({
4871
4920
  children: "Transform & Crop"
4872
4921
  }
4873
4922
  ),
4874
- /* @__PURE__ */ jsx26(
4923
+ /* @__PURE__ */ jsx27(
4875
4924
  "button",
4876
4925
  {
4877
4926
  type: "button",
@@ -4886,7 +4935,7 @@ var ImageEditor = ({
4886
4935
  children: "Adjustments"
4887
4936
  }
4888
4937
  ),
4889
- /* @__PURE__ */ jsx26(
4938
+ /* @__PURE__ */ jsx27(
4890
4939
  "button",
4891
4940
  {
4892
4941
  type: "button",
@@ -4901,7 +4950,7 @@ var ImageEditor = ({
4901
4950
  children: "Layers"
4902
4951
  }
4903
4952
  ),
4904
- /* @__PURE__ */ jsx26(
4953
+ /* @__PURE__ */ jsx27(
4905
4954
  "button",
4906
4955
  {
4907
4956
  type: "button",
@@ -4916,7 +4965,7 @@ var ImageEditor = ({
4916
4965
  children: "Paint"
4917
4966
  }
4918
4967
  ),
4919
- /* @__PURE__ */ jsx26(
4968
+ /* @__PURE__ */ jsx27(
4920
4969
  "button",
4921
4970
  {
4922
4971
  type: "button",
@@ -4931,7 +4980,7 @@ var ImageEditor = ({
4931
4980
  children: "Select & Mask"
4932
4981
  }
4933
4982
  ),
4934
- /* @__PURE__ */ jsx26(
4983
+ /* @__PURE__ */ jsx27(
4935
4984
  "button",
4936
4985
  {
4937
4986
  type: "button",
@@ -4946,7 +4995,7 @@ var ImageEditor = ({
4946
4995
  children: "Annotations"
4947
4996
  }
4948
4997
  ),
4949
- /* @__PURE__ */ jsx26(
4998
+ /* @__PURE__ */ jsx27(
4950
4999
  "button",
4951
5000
  {
4952
5001
  type: "button",
@@ -4961,7 +5010,7 @@ var ImageEditor = ({
4961
5010
  children: "Depth Mask"
4962
5011
  }
4963
5012
  ),
4964
- /* @__PURE__ */ jsxs24(
5013
+ /* @__PURE__ */ jsxs25(
4965
5014
  "button",
4966
5015
  {
4967
5016
  type: "button",
@@ -4974,14 +5023,14 @@ var ImageEditor = ({
4974
5023
  "aria-selected": activeTab === "ai",
4975
5024
  className: `${imageTabClass(activeTab === "ai")} flex items-center gap-1.5`,
4976
5025
  children: [
4977
- /* @__PURE__ */ jsx26("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx26("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" }) }),
5026
+ /* @__PURE__ */ jsx27("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx27("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" }) }),
4978
5027
  "AI Tools"
4979
5028
  ]
4980
5029
  }
4981
5030
  )
4982
5031
  ] }),
4983
- /* @__PURE__ */ jsxs24("div", { className: "flex items-center gap-2 text-xs", children: [
4984
- /* @__PURE__ */ jsx26(
5032
+ /* @__PURE__ */ jsxs25("div", { className: "flex items-center gap-2 text-xs", children: [
5033
+ /* @__PURE__ */ jsx27(
4985
5034
  "button",
4986
5035
  {
4987
5036
  type: "button",
@@ -4992,7 +5041,7 @@ var ImageEditor = ({
4992
5041
  children: "\u21A9"
4993
5042
  }
4994
5043
  ),
4995
- /* @__PURE__ */ jsx26(
5044
+ /* @__PURE__ */ jsx27(
4996
5045
  "button",
4997
5046
  {
4998
5047
  type: "button",
@@ -5003,7 +5052,7 @@ var ImageEditor = ({
5003
5052
  children: "\u21AA"
5004
5053
  }
5005
5054
  ),
5006
- /* @__PURE__ */ jsx26(
5055
+ /* @__PURE__ */ jsx27(
5007
5056
  "button",
5008
5057
  {
5009
5058
  type: "button",
@@ -5012,8 +5061,8 @@ var ImageEditor = ({
5012
5061
  children: "Reset"
5013
5062
  }
5014
5063
  ),
5015
- /* @__PURE__ */ jsx26("div", { className: "h-4 w-px bg-muted mx-1" }),
5016
- /* @__PURE__ */ jsx26(
5064
+ /* @__PURE__ */ jsx27("div", { className: "h-4 w-px bg-muted mx-1" }),
5065
+ /* @__PURE__ */ jsx27(
5017
5066
  "button",
5018
5067
  {
5019
5068
  type: "button",
@@ -5023,11 +5072,11 @@ var ImageEditor = ({
5023
5072
  children: "-"
5024
5073
  }
5025
5074
  ),
5026
- /* @__PURE__ */ jsxs24("span", { className: "font-mono text-muted-foreground w-10 text-center", children: [
5075
+ /* @__PURE__ */ jsxs25("span", { className: "font-mono text-muted-foreground w-10 text-center", children: [
5027
5076
  Math.round(state.zoom * 100),
5028
5077
  "%"
5029
5078
  ] }),
5030
- /* @__PURE__ */ jsx26(
5079
+ /* @__PURE__ */ jsx27(
5031
5080
  "button",
5032
5081
  {
5033
5082
  type: "button",
@@ -5037,8 +5086,8 @@ var ImageEditor = ({
5037
5086
  children: "+"
5038
5087
  }
5039
5088
  ),
5040
- /* @__PURE__ */ jsx26("div", { className: "h-4 w-px bg-muted mx-1" }),
5041
- /* @__PURE__ */ jsx26(
5089
+ /* @__PURE__ */ jsx27("div", { className: "h-4 w-px bg-muted mx-1" }),
5090
+ /* @__PURE__ */ jsx27(
5042
5091
  "button",
5043
5092
  {
5044
5093
  type: "button",
@@ -5049,7 +5098,7 @@ var ImageEditor = ({
5049
5098
  children: "Hold Compare"
5050
5099
  }
5051
5100
  ),
5052
- /* @__PURE__ */ jsx26(
5101
+ /* @__PURE__ */ jsx27(
5053
5102
  "button",
5054
5103
  {
5055
5104
  type: "button",
@@ -5060,10 +5109,10 @@ var ImageEditor = ({
5060
5109
  )
5061
5110
  ] })
5062
5111
  ] }),
5063
- transformTool.active && /* @__PURE__ */ jsx26(FreeTransformOptionsBar, { tool: transformTool, className: "border-b border-border bg-background/95 px-4 py-2" }),
5064
- !transformTool.active && transformTool.error && /* @__PURE__ */ jsx26("div", { role: "alert", className: imageErrorBannerClass, children: transformTool.error }),
5065
- /* @__PURE__ */ jsxs24("div", { className: "flex flex-col md:flex-row flex-1 min-h-[520px] md:h-[560px]", children: [
5066
- /* @__PURE__ */ jsx26(
5112
+ transformTool.active && /* @__PURE__ */ jsx27(FreeTransformOptionsBar, { tool: transformTool, className: "border-b border-border bg-background/95 px-4 py-2" }),
5113
+ !transformTool.active && transformTool.error && /* @__PURE__ */ jsx27("div", { role: "alert", className: imageErrorBannerClass, children: transformTool.error }),
5114
+ /* @__PURE__ */ jsxs25("div", { className: "flex flex-col md:flex-row flex-1 min-h-[520px] md:h-[560px]", children: [
5115
+ /* @__PURE__ */ jsx27(
5067
5116
  ImageEditorCanvas,
5068
5117
  {
5069
5118
  editor,
@@ -5087,11 +5136,11 @@ var ImageEditor = ({
5087
5136
  className: "flex-1 h-[360px] md:h-full min-h-[320px] bg-muted"
5088
5137
  }
5089
5138
  ),
5090
- /* @__PURE__ */ jsxs24("div", { className: imageSidebarClass, children: [
5091
- activeTab === "crop" && /* @__PURE__ */ jsxs24("div", { className: "flex flex-col gap-4 text-xs", children: [
5092
- /* @__PURE__ */ jsx26("span", { className: imageSectionTitleClass, children: "Aspect Ratio Presets" }),
5093
- /* @__PURE__ */ jsxs24("div", { className: "grid grid-cols-3 gap-2", children: [
5094
- /* @__PURE__ */ jsx26(
5139
+ /* @__PURE__ */ jsxs25("div", { className: imageSidebarClass, children: [
5140
+ activeTab === "crop" && /* @__PURE__ */ jsxs25("div", { className: "flex flex-col gap-4 text-xs", children: [
5141
+ /* @__PURE__ */ jsx27("span", { className: imageSectionTitleClass, children: "Aspect Ratio Presets" }),
5142
+ /* @__PURE__ */ jsxs25("div", { className: "grid grid-cols-3 gap-2", children: [
5143
+ /* @__PURE__ */ jsx27(
5095
5144
  "button",
5096
5145
  {
5097
5146
  type: "button",
@@ -5103,7 +5152,7 @@ var ImageEditor = ({
5103
5152
  children: "Freeform"
5104
5153
  }
5105
5154
  ),
5106
- /* @__PURE__ */ jsx26(
5155
+ /* @__PURE__ */ jsx27(
5107
5156
  "button",
5108
5157
  {
5109
5158
  type: "button",
@@ -5115,7 +5164,7 @@ var ImageEditor = ({
5115
5164
  children: "1:1 Square"
5116
5165
  }
5117
5166
  ),
5118
- /* @__PURE__ */ jsx26(
5167
+ /* @__PURE__ */ jsx27(
5119
5168
  "button",
5120
5169
  {
5121
5170
  type: "button",
@@ -5127,7 +5176,7 @@ var ImageEditor = ({
5127
5176
  children: "4:3 Standard"
5128
5177
  }
5129
5178
  ),
5130
- /* @__PURE__ */ jsx26(
5179
+ /* @__PURE__ */ jsx27(
5131
5180
  "button",
5132
5181
  {
5133
5182
  type: "button",
@@ -5139,7 +5188,7 @@ var ImageEditor = ({
5139
5188
  children: "16:9 Wide"
5140
5189
  }
5141
5190
  ),
5142
- /* @__PURE__ */ jsx26(
5191
+ /* @__PURE__ */ jsx27(
5143
5192
  "button",
5144
5193
  {
5145
5194
  type: "button",
@@ -5151,7 +5200,7 @@ var ImageEditor = ({
5151
5200
  children: "3:2 Photo"
5152
5201
  }
5153
5202
  ),
5154
- /* @__PURE__ */ jsx26(
5203
+ /* @__PURE__ */ jsx27(
5155
5204
  "button",
5156
5205
  {
5157
5206
  type: "button",
@@ -5164,10 +5213,10 @@ var ImageEditor = ({
5164
5213
  }
5165
5214
  )
5166
5215
  ] }),
5167
- /* @__PURE__ */ jsx26("div", { className: imageDividerClass }),
5168
- /* @__PURE__ */ jsx26("span", { className: imageSectionTitleClass, children: "Orientation & Flips" }),
5169
- /* @__PURE__ */ jsxs24("div", { className: "grid grid-cols-2 gap-2", children: [
5170
- /* @__PURE__ */ jsx26(
5216
+ /* @__PURE__ */ jsx27("div", { className: imageDividerClass }),
5217
+ /* @__PURE__ */ jsx27("span", { className: imageSectionTitleClass, children: "Orientation & Flips" }),
5218
+ /* @__PURE__ */ jsxs25("div", { className: "grid grid-cols-2 gap-2", children: [
5219
+ /* @__PURE__ */ jsx27(
5171
5220
  "button",
5172
5221
  {
5173
5222
  type: "button",
@@ -5176,7 +5225,7 @@ var ImageEditor = ({
5176
5225
  children: "Rotate -90\xB0"
5177
5226
  }
5178
5227
  ),
5179
- /* @__PURE__ */ jsx26(
5228
+ /* @__PURE__ */ jsx27(
5180
5229
  "button",
5181
5230
  {
5182
5231
  type: "button",
@@ -5185,7 +5234,7 @@ var ImageEditor = ({
5185
5234
  children: "Rotate +90\xB0"
5186
5235
  }
5187
5236
  ),
5188
- /* @__PURE__ */ jsx26(
5237
+ /* @__PURE__ */ jsx27(
5189
5238
  "button",
5190
5239
  {
5191
5240
  type: "button",
@@ -5194,7 +5243,7 @@ var ImageEditor = ({
5194
5243
  children: "Flip Horizontal"
5195
5244
  }
5196
5245
  ),
5197
- /* @__PURE__ */ jsx26(
5246
+ /* @__PURE__ */ jsx27(
5198
5247
  "button",
5199
5248
  {
5200
5249
  type: "button",
@@ -5205,10 +5254,10 @@ var ImageEditor = ({
5205
5254
  )
5206
5255
  ] })
5207
5256
  ] }),
5208
- activeTab === "adjust" && /* @__PURE__ */ jsxs24("div", { className: "flex flex-col gap-3 text-xs", children: [
5209
- /* @__PURE__ */ jsxs24("div", { className: "flex items-center justify-between", children: [
5210
- /* @__PURE__ */ jsx26("span", { className: imageSectionTitleClass, children: "Color Adjustments" }),
5211
- /* @__PURE__ */ jsx26(
5257
+ activeTab === "adjust" && /* @__PURE__ */ jsxs25("div", { className: "flex flex-col gap-3 text-xs", children: [
5258
+ /* @__PURE__ */ jsxs25("div", { className: "flex items-center justify-between", children: [
5259
+ /* @__PURE__ */ jsx27("span", { className: imageSectionTitleClass, children: "Color Adjustments" }),
5260
+ /* @__PURE__ */ jsx27(
5212
5261
  "button",
5213
5262
  {
5214
5263
  type: "button",
@@ -5218,9 +5267,9 @@ var ImageEditor = ({
5218
5267
  }
5219
5268
  )
5220
5269
  ] }),
5221
- /* @__PURE__ */ jsx26(Histogram, { histogram: editor.histogram }),
5222
- IMAGE_ADJUSTMENT_CONTROLS.map((spec) => /* @__PURE__ */ jsxs24(React21.Fragment, { children: [
5223
- /* @__PURE__ */ jsx26(
5270
+ /* @__PURE__ */ jsx27(Histogram, { histogram: editor.histogram }),
5271
+ IMAGE_ADJUSTMENT_CONTROLS.map((spec) => /* @__PURE__ */ jsxs25(React22.Fragment, { children: [
5272
+ /* @__PURE__ */ jsx27(
5224
5273
  ControlSlider,
5225
5274
  {
5226
5275
  spec,
@@ -5229,14 +5278,14 @@ var ImageEditor = ({
5229
5278
  onChange: (v) => editor.setAdjustments({ [spec.id]: v })
5230
5279
  }
5231
5280
  ),
5232
- spec.id === "tint" && legacyProcess && /* @__PURE__ */ jsxs24(
5281
+ spec.id === "tint" && legacyProcess && /* @__PURE__ */ jsxs25(
5233
5282
  "div",
5234
5283
  {
5235
5284
  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",
5236
5285
  "data-testid": "image-editor-process-notice",
5237
5286
  children: [
5238
- /* @__PURE__ */ jsx26("span", { children: "Legacy rendering (process 1). Tint needs the current process." }),
5239
- /* @__PURE__ */ jsx26(
5287
+ /* @__PURE__ */ jsx27("span", { children: "Legacy rendering (process 1). Tint needs the current process." }),
5288
+ /* @__PURE__ */ jsx27(
5240
5289
  "button",
5241
5290
  {
5242
5291
  type: "button",
@@ -5249,7 +5298,7 @@ var ImageEditor = ({
5249
5298
  }
5250
5299
  )
5251
5300
  ] }, spec.id)),
5252
- /* @__PURE__ */ jsx26("div", { className: imageSectionClass, children: /* @__PURE__ */ jsx26(
5301
+ /* @__PURE__ */ jsx27("div", { className: imageSectionClass, children: /* @__PURE__ */ jsx27(
5253
5302
  AdjustmentLayersPanel,
5254
5303
  {
5255
5304
  controller,
@@ -5258,9 +5307,9 @@ var ImageEditor = ({
5258
5307
  }
5259
5308
  ) })
5260
5309
  ] }),
5261
- activeTab === "layers" && /* @__PURE__ */ jsxs24("div", { className: "flex flex-col gap-3 text-xs", children: [
5262
- /* @__PURE__ */ jsx26("span", { className: imageSectionTitleClass, children: "Layers" }),
5263
- /* @__PURE__ */ jsx26(
5310
+ activeTab === "layers" && /* @__PURE__ */ jsxs25("div", { className: "flex flex-col gap-3 text-xs", children: [
5311
+ /* @__PURE__ */ jsx27("span", { className: imageSectionTitleClass, children: "Layers" }),
5312
+ /* @__PURE__ */ jsx27(
5264
5313
  "button",
5265
5314
  {
5266
5315
  type: "button",
@@ -5271,15 +5320,15 @@ var ImageEditor = ({
5271
5320
  children: "Free Transform"
5272
5321
  }
5273
5322
  ),
5274
- /* @__PURE__ */ jsx26(LayersPanel, { controller }),
5275
- effectsShown && /* @__PURE__ */ jsx26(ImageProviderEffectsPanel, { controller, className: imageSectionClass }),
5276
- /* @__PURE__ */ jsx26("span", { className: imageSectionTitleClass, children: "Colour" }),
5277
- /* @__PURE__ */ jsx26(ColorProfilePanel, { controller })
5323
+ /* @__PURE__ */ jsx27(LayersPanel, { controller }),
5324
+ effectsShown && /* @__PURE__ */ jsx27(ImageProviderEffectsPanel, { controller, className: imageSectionClass }),
5325
+ /* @__PURE__ */ jsx27("span", { className: imageSectionTitleClass, children: "Colour" }),
5326
+ /* @__PURE__ */ jsx27(ColorProfilePanel, { controller })
5278
5327
  ] }),
5279
- activeTab === "paint" && /* @__PURE__ */ jsxs24("div", { className: "flex flex-col gap-3 text-xs", children: [
5280
- /* @__PURE__ */ jsx26("span", { className: imageSectionTitleClass, children: "Paint" }),
5281
- /* @__PURE__ */ jsx26(BrushOptionsBar, { controller }),
5282
- /* @__PURE__ */ jsx26(
5328
+ activeTab === "paint" && /* @__PURE__ */ jsxs25("div", { className: "flex flex-col gap-3 text-xs", children: [
5329
+ /* @__PURE__ */ jsx27("span", { className: imageSectionTitleClass, children: "Paint" }),
5330
+ /* @__PURE__ */ jsx27(BrushOptionsBar, { controller }),
5331
+ /* @__PURE__ */ jsx27(
5283
5332
  "button",
5284
5333
  {
5285
5334
  type: "button",
@@ -5290,12 +5339,12 @@ var ImageEditor = ({
5290
5339
  children: "Free Transform"
5291
5340
  }
5292
5341
  ),
5293
- paintError && /* @__PURE__ */ jsx26("p", { role: "alert", className: "text-destructive", "data-testid": "paint-error", children: paintError }),
5294
- /* @__PURE__ */ jsx26("div", { className: imageSectionClass, children: /* @__PURE__ */ jsx26(LayersPanel, { controller }) })
5342
+ paintError && /* @__PURE__ */ jsx27("p", { role: "alert", className: "text-destructive", "data-testid": "paint-error", children: paintError }),
5343
+ /* @__PURE__ */ jsx27("div", { className: imageSectionClass, children: /* @__PURE__ */ jsx27(LayersPanel, { controller }) })
5295
5344
  ] }),
5296
- activeTab === "annotate" && /* @__PURE__ */ jsxs24("div", { className: "flex flex-col gap-3 text-xs", children: [
5297
- /* @__PURE__ */ jsx26("span", { className: imageSectionTitleClass, children: "Shape & Type Layers, Paths" }),
5298
- /* @__PURE__ */ jsx26("div", { className: "grid grid-cols-2 gap-1.5", children: ["shape", "type", "path-pen", "path-select", "direct-select"].map((t) => /* @__PURE__ */ jsx26(
5345
+ activeTab === "annotate" && /* @__PURE__ */ jsxs25("div", { className: "flex flex-col gap-3 text-xs", children: [
5346
+ /* @__PURE__ */ jsx27("span", { className: imageSectionTitleClass, children: "Shape & Type Layers, Paths" }),
5347
+ /* @__PURE__ */ jsx27("div", { className: "grid grid-cols-2 gap-1.5", children: ["shape", "type", "path-pen", "path-select", "direct-select"].map((t) => /* @__PURE__ */ jsx27(
5299
5348
  "button",
5300
5349
  {
5301
5350
  type: "button",
@@ -5306,13 +5355,13 @@ var ImageEditor = ({
5306
5355
  },
5307
5356
  t
5308
5357
  )) }),
5309
- state.activeTool === "shape" && /* @__PURE__ */ jsx26(ShapeOptionsBar, { controller, options: shapeOptions, onChange: setShapeOptions }),
5310
- state.activeTool === "type" && /* @__PURE__ */ jsx26(TypeOptionsBar, { controller, options: typeOptions, onChange: setTypeOptions, session: typeSession }),
5311
- state.activeTool === "type" && typeSession && /* @__PURE__ */ jsx26("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" }),
5312
- shapeTypeError && /* @__PURE__ */ jsx26("p", { role: "alert", className: "text-destructive", "data-testid": "shape-type-error", children: shapeTypeError }),
5313
- /* @__PURE__ */ jsx26("div", { className: imageDividerClass }),
5314
- /* @__PURE__ */ jsx26("span", { className: imageSectionTitleClass, children: "Draw & Annotate" }),
5315
- /* @__PURE__ */ jsx26("div", { className: "grid grid-cols-3 gap-1.5", children: ["pen", "rect", "circle", "arrow", "line"].map((t) => /* @__PURE__ */ jsx26(
5358
+ state.activeTool === "shape" && /* @__PURE__ */ jsx27(ShapeOptionsBar, { controller, options: shapeOptions, onChange: setShapeOptions }),
5359
+ state.activeTool === "type" && /* @__PURE__ */ jsx27(TypeOptionsBar, { controller, options: typeOptions, onChange: setTypeOptions, session: typeSession }),
5360
+ state.activeTool === "type" && typeSession && /* @__PURE__ */ jsx27("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" }),
5361
+ shapeTypeError && /* @__PURE__ */ jsx27("p", { role: "alert", className: "text-destructive", "data-testid": "shape-type-error", children: shapeTypeError }),
5362
+ /* @__PURE__ */ jsx27("div", { className: imageDividerClass }),
5363
+ /* @__PURE__ */ jsx27("span", { className: imageSectionTitleClass, children: "Draw & Annotate" }),
5364
+ /* @__PURE__ */ jsx27("div", { className: "grid grid-cols-3 gap-1.5", children: ["pen", "rect", "circle", "arrow", "line"].map((t) => /* @__PURE__ */ jsx27(
5316
5365
  "button",
5317
5366
  {
5318
5367
  type: "button",
@@ -5322,18 +5371,18 @@ var ImageEditor = ({
5322
5371
  },
5323
5372
  t
5324
5373
  )) }),
5325
- /* @__PURE__ */ jsxs24("div", { className: "flex items-center gap-2 mt-2", children: [
5326
- /* @__PURE__ */ jsx26("label", { className: "text-muted-foreground", children: "Color:" }),
5327
- /* @__PURE__ */ jsx26(ImageColor, { label: "Annotation colour", value: activeColor, onChange: setActiveColor }),
5328
- /* @__PURE__ */ jsxs24("div", { className: "flex-1 ml-2", children: [
5329
- /* @__PURE__ */ jsxs24("div", { className: "flex justify-between text-muted-foreground mb-0.5", children: [
5330
- /* @__PURE__ */ jsx26("span", { children: "Width:" }),
5331
- /* @__PURE__ */ jsxs24("span", { className: "font-mono", children: [
5374
+ /* @__PURE__ */ jsxs25("div", { className: "flex items-center gap-2 mt-2", children: [
5375
+ /* @__PURE__ */ jsx27("label", { className: "text-muted-foreground", children: "Color:" }),
5376
+ /* @__PURE__ */ jsx27(ImageColor, { label: "Annotation colour", value: activeColor, onChange: setActiveColor }),
5377
+ /* @__PURE__ */ jsxs25("div", { className: "flex-1 ml-2", children: [
5378
+ /* @__PURE__ */ jsxs25("div", { className: "flex justify-between text-muted-foreground mb-0.5", children: [
5379
+ /* @__PURE__ */ jsx27("span", { children: "Width:" }),
5380
+ /* @__PURE__ */ jsxs25("span", { className: "font-mono", children: [
5332
5381
  strokeWidth,
5333
5382
  "px"
5334
5383
  ] })
5335
5384
  ] }),
5336
- /* @__PURE__ */ jsx26(
5385
+ /* @__PURE__ */ jsx27(
5337
5386
  "input",
5338
5387
  {
5339
5388
  type: "range",
@@ -5346,10 +5395,10 @@ var ImageEditor = ({
5346
5395
  )
5347
5396
  ] })
5348
5397
  ] }),
5349
- /* @__PURE__ */ jsx26("div", { className: imageDividerClass }),
5350
- /* @__PURE__ */ jsx26("span", { className: imageSectionTitleClass, children: "Add Text" }),
5351
- /* @__PURE__ */ jsxs24("div", { className: "flex gap-2", children: [
5352
- /* @__PURE__ */ jsx26(
5398
+ /* @__PURE__ */ jsx27("div", { className: imageDividerClass }),
5399
+ /* @__PURE__ */ jsx27("span", { className: imageSectionTitleClass, children: "Add Text" }),
5400
+ /* @__PURE__ */ jsxs25("div", { className: "flex gap-2", children: [
5401
+ /* @__PURE__ */ jsx27(
5353
5402
  "input",
5354
5403
  {
5355
5404
  type: "text",
@@ -5360,7 +5409,7 @@ var ImageEditor = ({
5360
5409
  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"
5361
5410
  }
5362
5411
  ),
5363
- /* @__PURE__ */ jsx26(
5412
+ /* @__PURE__ */ jsx27(
5364
5413
  "button",
5365
5414
  {
5366
5415
  type: "button",
@@ -5370,14 +5419,14 @@ var ImageEditor = ({
5370
5419
  }
5371
5420
  )
5372
5421
  ] }),
5373
- /* @__PURE__ */ jsxs24("div", { className: "flex items-center justify-between text-muted-foreground", children: [
5374
- /* @__PURE__ */ jsx26("span", { children: "Font Size:" }),
5375
- /* @__PURE__ */ jsxs24("span", { className: "font-mono", children: [
5422
+ /* @__PURE__ */ jsxs25("div", { className: "flex items-center justify-between text-muted-foreground", children: [
5423
+ /* @__PURE__ */ jsx27("span", { children: "Font Size:" }),
5424
+ /* @__PURE__ */ jsxs25("span", { className: "font-mono", children: [
5376
5425
  fontSize,
5377
5426
  "px"
5378
5427
  ] })
5379
5428
  ] }),
5380
- /* @__PURE__ */ jsx26(
5429
+ /* @__PURE__ */ jsx27(
5381
5430
  "input",
5382
5431
  {
5383
5432
  type: "range",
@@ -5388,14 +5437,14 @@ var ImageEditor = ({
5388
5437
  className: imageRangeClass
5389
5438
  }
5390
5439
  ),
5391
- /* @__PURE__ */ jsx26("div", { className: imageDividerClass }),
5392
- /* @__PURE__ */ jsxs24("div", { className: "flex items-center justify-between", children: [
5393
- /* @__PURE__ */ jsxs24("span", { className: "text-muted-foreground", children: [
5440
+ /* @__PURE__ */ jsx27("div", { className: imageDividerClass }),
5441
+ /* @__PURE__ */ jsxs25("div", { className: "flex items-center justify-between", children: [
5442
+ /* @__PURE__ */ jsxs25("span", { className: "text-muted-foreground", children: [
5394
5443
  "Layers (",
5395
5444
  state.annotations.length,
5396
5445
  ")"
5397
5446
  ] }),
5398
- state.selectedAnnotationId && /* @__PURE__ */ jsx26(
5447
+ state.selectedAnnotationId && /* @__PURE__ */ jsx27(
5399
5448
  "button",
5400
5449
  {
5401
5450
  type: "button",
@@ -5404,7 +5453,7 @@ var ImageEditor = ({
5404
5453
  children: "Delete Selected"
5405
5454
  }
5406
5455
  ),
5407
- state.annotations.length > 0 && /* @__PURE__ */ jsx26(
5456
+ state.annotations.length > 0 && /* @__PURE__ */ jsx27(
5408
5457
  "button",
5409
5458
  {
5410
5459
  type: "button",
@@ -5415,10 +5464,10 @@ var ImageEditor = ({
5415
5464
  )
5416
5465
  ] })
5417
5466
  ] }),
5418
- activeTab === "depth" && /* @__PURE__ */ jsxs24("div", { className: "flex flex-col gap-3 text-xs", children: [
5419
- /* @__PURE__ */ jsxs24("div", { className: "flex items-center justify-between", children: [
5420
- /* @__PURE__ */ jsx26("span", { className: imageSectionTitleClass, children: "Depth Masking" }),
5421
- /* @__PURE__ */ jsx26(
5467
+ activeTab === "depth" && /* @__PURE__ */ jsxs25("div", { className: "flex flex-col gap-3 text-xs", children: [
5468
+ /* @__PURE__ */ jsxs25("div", { className: "flex items-center justify-between", children: [
5469
+ /* @__PURE__ */ jsx27("span", { className: imageSectionTitleClass, children: "Depth Masking" }),
5470
+ /* @__PURE__ */ jsx27(
5422
5471
  "button",
5423
5472
  {
5424
5473
  type: "button",
@@ -5428,8 +5477,8 @@ var ImageEditor = ({
5428
5477
  }
5429
5478
  )
5430
5479
  ] }),
5431
- /* @__PURE__ */ jsxs24("label", { className: "flex items-center gap-2 cursor-pointer text-foreground", children: [
5432
- /* @__PURE__ */ jsx26(
5480
+ /* @__PURE__ */ jsxs25("label", { className: "flex items-center gap-2 cursor-pointer text-foreground", children: [
5481
+ /* @__PURE__ */ jsx27(
5433
5482
  "input",
5434
5483
  {
5435
5484
  type: "checkbox",
@@ -5438,12 +5487,12 @@ var ImageEditor = ({
5438
5487
  className: "rounded accent-primary"
5439
5488
  }
5440
5489
  ),
5441
- /* @__PURE__ */ jsx26("span", { children: "Enable Depth / Alpha Mask" })
5490
+ /* @__PURE__ */ jsx27("span", { children: "Enable Depth / Alpha Mask" })
5442
5491
  ] }),
5443
- state.depthMask.enabled && /* @__PURE__ */ jsxs24(Fragment7, { children: [
5444
- /* @__PURE__ */ jsxs24("div", { children: [
5445
- /* @__PURE__ */ jsx26("label", { className: "text-muted-foreground block mb-1", children: "Mask Image URL:" }),
5446
- /* @__PURE__ */ jsx26(
5492
+ state.depthMask.enabled && /* @__PURE__ */ jsxs25(Fragment8, { children: [
5493
+ /* @__PURE__ */ jsxs25("div", { children: [
5494
+ /* @__PURE__ */ jsx27("label", { className: "text-muted-foreground block mb-1", children: "Mask Image URL:" }),
5495
+ /* @__PURE__ */ jsx27(
5447
5496
  "input",
5448
5497
  {
5449
5498
  type: "text",
@@ -5454,8 +5503,8 @@ var ImageEditor = ({
5454
5503
  }
5455
5504
  )
5456
5505
  ] }),
5457
- /* @__PURE__ */ jsxs24("div", { className: "flex gap-2", children: [
5458
- /* @__PURE__ */ jsx26(
5506
+ /* @__PURE__ */ jsxs25("div", { className: "flex gap-2", children: [
5507
+ /* @__PURE__ */ jsx27(
5459
5508
  "button",
5460
5509
  {
5461
5510
  type: "button",
@@ -5464,7 +5513,7 @@ var ImageEditor = ({
5464
5513
  children: "Threshold Mode"
5465
5514
  }
5466
5515
  ),
5467
- /* @__PURE__ */ jsx26(
5516
+ /* @__PURE__ */ jsx27(
5468
5517
  "button",
5469
5518
  {
5470
5519
  type: "button",
@@ -5474,12 +5523,12 @@ var ImageEditor = ({
5474
5523
  }
5475
5524
  )
5476
5525
  ] }),
5477
- /* @__PURE__ */ jsxs24("div", { children: [
5478
- /* @__PURE__ */ jsxs24("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
5479
- /* @__PURE__ */ jsx26("span", { children: "Depth Start (Lower):" }),
5480
- /* @__PURE__ */ jsx26("span", { className: "font-mono", children: state.depthMask.depthRange[0] })
5526
+ /* @__PURE__ */ jsxs25("div", { children: [
5527
+ /* @__PURE__ */ jsxs25("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
5528
+ /* @__PURE__ */ jsx27("span", { children: "Depth Start (Lower):" }),
5529
+ /* @__PURE__ */ jsx27("span", { className: "font-mono", children: state.depthMask.depthRange[0] })
5481
5530
  ] }),
5482
- /* @__PURE__ */ jsx26(
5531
+ /* @__PURE__ */ jsx27(
5483
5532
  "input",
5484
5533
  {
5485
5534
  type: "range",
@@ -5493,12 +5542,12 @@ var ImageEditor = ({
5493
5542
  }
5494
5543
  )
5495
5544
  ] }),
5496
- /* @__PURE__ */ jsxs24("div", { children: [
5497
- /* @__PURE__ */ jsxs24("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
5498
- /* @__PURE__ */ jsx26("span", { children: "Depth Stop (Upper):" }),
5499
- /* @__PURE__ */ jsx26("span", { className: "font-mono", children: state.depthMask.depthRange[1] })
5545
+ /* @__PURE__ */ jsxs25("div", { children: [
5546
+ /* @__PURE__ */ jsxs25("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
5547
+ /* @__PURE__ */ jsx27("span", { children: "Depth Stop (Upper):" }),
5548
+ /* @__PURE__ */ jsx27("span", { className: "font-mono", children: state.depthMask.depthRange[1] })
5500
5549
  ] }),
5501
- /* @__PURE__ */ jsx26(
5550
+ /* @__PURE__ */ jsx27(
5502
5551
  "input",
5503
5552
  {
5504
5553
  type: "range",
@@ -5512,12 +5561,12 @@ var ImageEditor = ({
5512
5561
  }
5513
5562
  )
5514
5563
  ] }),
5515
- /* @__PURE__ */ jsxs24("div", { children: [
5516
- /* @__PURE__ */ jsxs24("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
5517
- /* @__PURE__ */ jsx26("span", { children: "Softness:" }),
5518
- /* @__PURE__ */ jsx26("span", { className: "font-mono", children: state.depthMask.softness })
5564
+ /* @__PURE__ */ jsxs25("div", { children: [
5565
+ /* @__PURE__ */ jsxs25("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
5566
+ /* @__PURE__ */ jsx27("span", { children: "Softness:" }),
5567
+ /* @__PURE__ */ jsx27("span", { className: "font-mono", children: state.depthMask.softness })
5519
5568
  ] }),
5520
- /* @__PURE__ */ jsx26(
5569
+ /* @__PURE__ */ jsx27(
5521
5570
  "input",
5522
5571
  {
5523
5572
  type: "range",
@@ -5529,8 +5578,8 @@ var ImageEditor = ({
5529
5578
  }
5530
5579
  )
5531
5580
  ] }),
5532
- /* @__PURE__ */ jsxs24("label", { className: "flex items-center gap-2 cursor-pointer text-foreground mt-1", children: [
5533
- /* @__PURE__ */ jsx26(
5581
+ /* @__PURE__ */ jsxs25("label", { className: "flex items-center gap-2 cursor-pointer text-foreground mt-1", children: [
5582
+ /* @__PURE__ */ jsx27(
5534
5583
  "input",
5535
5584
  {
5536
5585
  type: "checkbox",
@@ -5539,12 +5588,12 @@ var ImageEditor = ({
5539
5588
  className: "rounded accent-primary"
5540
5589
  }
5541
5590
  ),
5542
- /* @__PURE__ */ jsx26("span", { children: "Invert Mask" })
5591
+ /* @__PURE__ */ jsx27("span", { children: "Invert Mask" })
5543
5592
  ] })
5544
5593
  ] })
5545
5594
  ] }),
5546
- activeTab === "select" && /* @__PURE__ */ jsxs24("div", { className: "flex flex-col gap-4 text-xs", children: [
5547
- /* @__PURE__ */ jsx26(
5595
+ activeTab === "select" && /* @__PURE__ */ jsxs25("div", { className: "flex flex-col gap-4 text-xs", children: [
5596
+ /* @__PURE__ */ jsx27(
5548
5597
  SelectionOptionsBar,
5549
5598
  {
5550
5599
  controller,
@@ -5555,9 +5604,9 @@ var ImageEditor = ({
5555
5604
  selectionDisplay: state.selectionDisplay
5556
5605
  }
5557
5606
  ),
5558
- selectionError && /* @__PURE__ */ jsx26("p", { role: "alert", className: "text-destructive", children: selectionError }),
5559
- /* @__PURE__ */ jsxs24("div", { className: "flex gap-1", children: [
5560
- /* @__PURE__ */ jsx26(
5607
+ selectionError && /* @__PURE__ */ jsx27("p", { role: "alert", className: "text-destructive", children: selectionError }),
5608
+ /* @__PURE__ */ jsxs25("div", { className: "flex gap-1", children: [
5609
+ /* @__PURE__ */ jsx27(
5561
5610
  "button",
5562
5611
  {
5563
5612
  type: "button",
@@ -5568,7 +5617,7 @@ var ImageEditor = ({
5568
5617
  children: "Transform Selection"
5569
5618
  }
5570
5619
  ),
5571
- /* @__PURE__ */ jsx26(
5620
+ /* @__PURE__ */ jsx27(
5572
5621
  "button",
5573
5622
  {
5574
5623
  type: "button",
@@ -5580,14 +5629,14 @@ var ImageEditor = ({
5580
5629
  }
5581
5630
  )
5582
5631
  ] }),
5583
- /* @__PURE__ */ jsx26(RefineEdgePanel, { controller, selection: state.selection ?? null, layers: state.adjustments.layers }),
5584
- /* @__PURE__ */ jsx26(ChannelsPanel, { controller }),
5585
- /* @__PURE__ */ jsx26(PathsPanel, { controller })
5632
+ /* @__PURE__ */ jsx27(RefineEdgePanel, { controller, selection: state.selection ?? null, layers: state.adjustments.layers }),
5633
+ /* @__PURE__ */ jsx27(ChannelsPanel, { controller }),
5634
+ /* @__PURE__ */ jsx27(PathsPanel, { controller })
5586
5635
  ] }),
5587
- activeTab === "ai" && /* @__PURE__ */ jsxs24("div", { className: "flex flex-col gap-4 text-xs", children: [
5588
- /* @__PURE__ */ jsxs24("label", { className: "flex items-center justify-between gap-2 text-foreground", children: [
5589
- /* @__PURE__ */ jsx26("span", { children: "Results go to" }),
5590
- /* @__PURE__ */ jsxs24(
5636
+ activeTab === "ai" && /* @__PURE__ */ jsxs25("div", { className: "flex flex-col gap-4 text-xs", children: [
5637
+ /* @__PURE__ */ jsxs25("label", { className: "flex items-center justify-between gap-2 text-foreground", children: [
5638
+ /* @__PURE__ */ jsx27("span", { children: "Results go to" }),
5639
+ /* @__PURE__ */ jsxs25(
5591
5640
  "select",
5592
5641
  {
5593
5642
  "aria-label": "AI result target",
@@ -5595,54 +5644,54 @@ var ImageEditor = ({
5595
5644
  onChange: (e) => setAiTarget(e.target.value),
5596
5645
  className: imageSelectClass,
5597
5646
  children: [
5598
- /* @__PURE__ */ jsx26("option", { value: "auto", children: controller.isMultiLayer ? "Auto (new layer)" : "Auto (replace image)" }),
5599
- /* @__PURE__ */ jsx26("option", { value: "new-layer", children: "New layer / mask" }),
5600
- /* @__PURE__ */ jsx26("option", { value: "replace", children: "Replace image" })
5647
+ /* @__PURE__ */ jsx27("option", { value: "auto", children: controller.isMultiLayer ? "Auto (new layer)" : "Auto (replace image)" }),
5648
+ /* @__PURE__ */ jsx27("option", { value: "new-layer", children: "New layer / mask" }),
5649
+ /* @__PURE__ */ jsx27("option", { value: "replace", children: "Replace image" })
5601
5650
  ]
5602
5651
  }
5603
5652
  )
5604
5653
  ] }),
5605
- /* @__PURE__ */ jsxs24("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
5606
- /* @__PURE__ */ jsxs24("div", { className: "flex items-center justify-between", children: [
5607
- /* @__PURE__ */ jsxs24("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
5608
- /* @__PURE__ */ jsx26("svg", { className: "w-3.5 h-3.5 text-primary", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx26("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" }) }),
5654
+ /* @__PURE__ */ jsxs25("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
5655
+ /* @__PURE__ */ jsxs25("div", { className: "flex items-center justify-between", children: [
5656
+ /* @__PURE__ */ jsxs25("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
5657
+ /* @__PURE__ */ jsx27("svg", { className: "w-3.5 h-3.5 text-primary", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx27("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" }) }),
5609
5658
  "Background Removal"
5610
5659
  ] }),
5611
- isRemovingBg && /* @__PURE__ */ jsx26("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..." })
5660
+ isRemovingBg && /* @__PURE__ */ jsx27("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..." })
5612
5661
  ] }),
5613
- /* @__PURE__ */ jsx26("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Isolate foreground subject with AI alpha transparency segmentation." }),
5614
- /* @__PURE__ */ jsx26(
5662
+ /* @__PURE__ */ jsx27("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Isolate foreground subject with AI alpha transparency segmentation." }),
5663
+ /* @__PURE__ */ jsx27(
5615
5664
  "button",
5616
5665
  {
5617
5666
  type: "button",
5618
5667
  onClick: handleRemoveBackground,
5619
5668
  disabled: isRemovingBg || isInpainting,
5620
5669
  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",
5621
- children: isRemovingBg ? /* @__PURE__ */ jsxs24(Fragment7, { children: [
5622
- /* @__PURE__ */ jsx26("div", { className: imageSpinnerClass }),
5670
+ children: isRemovingBg ? /* @__PURE__ */ jsxs25(Fragment8, { children: [
5671
+ /* @__PURE__ */ jsx27("div", { className: imageSpinnerClass }),
5623
5672
  "Removing Background..."
5624
- ] }) : /* @__PURE__ */ jsxs24(Fragment7, { children: [
5625
- /* @__PURE__ */ jsx26("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx26("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" }) }),
5673
+ ] }) : /* @__PURE__ */ jsxs25(Fragment8, { children: [
5674
+ /* @__PURE__ */ jsx27("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx27("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" }) }),
5626
5675
  "Remove Background"
5627
5676
  ] })
5628
5677
  }
5629
5678
  )
5630
5679
  ] }),
5631
- /* @__PURE__ */ jsxs24("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
5632
- /* @__PURE__ */ jsxs24("div", { className: "flex items-center justify-between", children: [
5633
- /* @__PURE__ */ jsxs24("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
5634
- /* @__PURE__ */ jsxs24("svg", { className: "w-3.5 h-3.5 text-primary", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
5635
- /* @__PURE__ */ jsx26("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" }),
5636
- /* @__PURE__ */ jsx26("path", { d: "m14 7 3 3" })
5680
+ /* @__PURE__ */ jsxs25("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
5681
+ /* @__PURE__ */ jsxs25("div", { className: "flex items-center justify-between", children: [
5682
+ /* @__PURE__ */ jsxs25("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
5683
+ /* @__PURE__ */ jsxs25("svg", { className: "w-3.5 h-3.5 text-primary", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
5684
+ /* @__PURE__ */ jsx27("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" }),
5685
+ /* @__PURE__ */ jsx27("path", { d: "m14 7 3 3" })
5637
5686
  ] }),
5638
5687
  "Generative Inpainting"
5639
5688
  ] }),
5640
- isInpainting && /* @__PURE__ */ jsx26("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..." })
5689
+ isInpainting && /* @__PURE__ */ jsx27("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..." })
5641
5690
  ] }),
5642
- /* @__PURE__ */ jsx26("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Replace, modify, or fill selected regions using prompt-guided generative inpainting." }),
5643
- /* @__PURE__ */ jsxs24("div", { className: "flex flex-col gap-1", children: [
5644
- /* @__PURE__ */ jsx26("label", { htmlFor: "ai-inpaint-prompt-react", className: "text-foreground text-[11px] font-medium", children: "Prompt" }),
5645
- /* @__PURE__ */ jsx26(
5691
+ /* @__PURE__ */ jsx27("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Replace, modify, or fill selected regions using prompt-guided generative inpainting." }),
5692
+ /* @__PURE__ */ jsxs25("div", { className: "flex flex-col gap-1", children: [
5693
+ /* @__PURE__ */ jsx27("label", { htmlFor: "ai-inpaint-prompt-react", className: "text-foreground text-[11px] font-medium", children: "Prompt" }),
5694
+ /* @__PURE__ */ jsx27(
5646
5695
  "textarea",
5647
5696
  {
5648
5697
  id: "ai-inpaint-prompt-react",
@@ -5654,10 +5703,10 @@ var ImageEditor = ({
5654
5703
  }
5655
5704
  )
5656
5705
  ] }),
5657
- /* @__PURE__ */ jsxs24("div", { className: "flex flex-col gap-1", children: [
5658
- /* @__PURE__ */ jsx26("span", { className: "text-foreground text-[11px] font-medium", children: "Target Mask Region" }),
5659
- /* @__PURE__ */ jsxs24("div", { className: "grid grid-cols-2 gap-1.5", children: [
5660
- /* @__PURE__ */ jsxs24(
5706
+ /* @__PURE__ */ jsxs25("div", { className: "flex flex-col gap-1", children: [
5707
+ /* @__PURE__ */ jsx27("span", { className: "text-foreground text-[11px] font-medium", children: "Target Mask Region" }),
5708
+ /* @__PURE__ */ jsxs25("div", { className: "grid grid-cols-2 gap-1.5", children: [
5709
+ /* @__PURE__ */ jsxs25(
5661
5710
  "button",
5662
5711
  {
5663
5712
  type: "button",
@@ -5670,7 +5719,7 @@ var ImageEditor = ({
5670
5719
  ]
5671
5720
  }
5672
5721
  ),
5673
- /* @__PURE__ */ jsxs24(
5722
+ /* @__PURE__ */ jsxs25(
5674
5723
  "button",
5675
5724
  {
5676
5725
  type: "button",
@@ -5685,25 +5734,25 @@ var ImageEditor = ({
5685
5734
  )
5686
5735
  ] })
5687
5736
  ] }),
5688
- /* @__PURE__ */ jsx26(
5737
+ /* @__PURE__ */ jsx27(
5689
5738
  "button",
5690
5739
  {
5691
5740
  type: "button",
5692
5741
  onClick: handleInpaint,
5693
5742
  disabled: isInpainting || isRemovingBg || !inpaintPrompt.trim(),
5694
5743
  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",
5695
- children: isInpainting ? /* @__PURE__ */ jsxs24(Fragment7, { children: [
5696
- /* @__PURE__ */ jsx26("div", { className: imageSpinnerClass }),
5744
+ children: isInpainting ? /* @__PURE__ */ jsxs25(Fragment8, { children: [
5745
+ /* @__PURE__ */ jsx27("div", { className: imageSpinnerClass }),
5697
5746
  "Generating Inpaint..."
5698
- ] }) : /* @__PURE__ */ jsxs24(Fragment7, { children: [
5699
- /* @__PURE__ */ jsx26("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx26("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" }) }),
5747
+ ] }) : /* @__PURE__ */ jsxs25(Fragment8, { children: [
5748
+ /* @__PURE__ */ jsx27("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx27("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" }) }),
5700
5749
  "Apply Inpainting"
5701
5750
  ] })
5702
5751
  }
5703
5752
  )
5704
5753
  ] }),
5705
- aiError && /* @__PURE__ */ jsx26("div", { className: "p-2.5 rounded-lg bg-destructive/10 border border-destructive/40 text-destructive text-[11px]", children: aiError }),
5706
- aiSuccess && /* @__PURE__ */ jsx26("div", { className: "p-2.5 rounded-lg bg-emerald-500/10 border border-emerald-500/30 text-emerald-600 text-[11px]", children: aiSuccess })
5754
+ aiError && /* @__PURE__ */ jsx27("div", { className: "p-2.5 rounded-lg bg-destructive/10 border border-destructive/40 text-destructive text-[11px]", children: aiError }),
5755
+ aiSuccess && /* @__PURE__ */ jsx27("div", { className: "p-2.5 rounded-lg bg-emerald-500/10 border border-emerald-500/30 text-emerald-600 text-[11px]", children: aiSuccess })
5707
5756
  ] })
5708
5757
  ] })
5709
5758
  ] })
@@ -5739,6 +5788,7 @@ export {
5739
5788
  ContentAwareFillWorkspace,
5740
5789
  SelectionOptionsBar,
5741
5790
  MaskEdgeCheck,
5791
+ SelectionChangeCheck,
5742
5792
  RefineEdgePanel,
5743
5793
  ChannelsPanel,
5744
5794
  PathsPanel,