@pixerate/editor-react 0.146.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,20 +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);
3890
- const [onlyUncertain, setOnlyUncertain] = 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);
3891
3931
  const canObject = Boolean(controller.segmentationProvider);
3892
3932
  const toLayer = output !== "selection" && output !== "layer-mask";
3893
3933
  const sel = selection === void 0 ? controller.getSelection() : selection;
@@ -3910,17 +3950,17 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
3910
3950
  setBusy(false);
3911
3951
  }
3912
3952
  };
3913
- return /* @__PURE__ */ jsxs18("div", { "data-testid": "refine-edge-panel", className: `flex flex-col gap-3 text-xs ${className}`, children: [
3914
- /* @__PURE__ */ jsx20("span", { className: imageSectionTitleClass, children: "Refine Edge" }),
3915
- REFINE_EDGE_CONTROLS2.map((c) => /* @__PURE__ */ jsxs18("label", { className: "flex flex-col gap-1", children: [
3916
- /* @__PURE__ */ jsxs18("span", { className: "flex justify-between text-muted-foreground", children: [
3917
- /* @__PURE__ */ jsx20("span", { children: c.label }),
3918
- /* @__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: [
3919
3959
  params[c.id],
3920
3960
  c.unit
3921
3961
  ] })
3922
3962
  ] }),
3923
- /* @__PURE__ */ jsx20(
3963
+ /* @__PURE__ */ jsx21(
3924
3964
  "input",
3925
3965
  {
3926
3966
  type: "range",
@@ -3934,43 +3974,43 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
3934
3974
  }
3935
3975
  )
3936
3976
  ] }, c.id)),
3937
- /* @__PURE__ */ jsxs18("label", { className: "flex items-center gap-2 text-foreground", children: [
3938
- /* @__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 }) }),
3939
3979
  "Smart Radius"
3940
3980
  ] }),
3941
- /* @__PURE__ */ jsxs18("label", { className: "flex items-center gap-2 text-foreground", title: "Refine only where the edge has no image edge under it", children: [
3942
- /* @__PURE__ */ jsx20("input", { type: "checkbox", "aria-label": "Only uncertain areas", checked: onlyUncertain, onChange: (e) => setOnlyUncertain(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) }),
3943
3983
  "Only uncertain areas"
3944
3984
  ] }),
3945
- canObject && /* @__PURE__ */ jsxs18("label", { className: "flex items-center gap-2 text-foreground", children: [
3946
- /* @__PURE__ */ jsx20("input", { type: "checkbox", "aria-label": "Object aware", checked: objectAware, onChange: (e) => setObjectAware(e.target.checked) }),
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) }),
3947
3987
  "Object aware (segmentation model)"
3948
3988
  ] }),
3949
- /* @__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: [
3950
3990
  "Output to",
3951
- /* @__PURE__ */ jsx20(
3991
+ /* @__PURE__ */ jsx21(
3952
3992
  "select",
3953
3993
  {
3954
3994
  "aria-label": "Refine output",
3955
3995
  value: output,
3956
3996
  onChange: (e) => setOutput(e.target.value),
3957
3997
  className: "flex-1 bg-background border border-border rounded px-1 py-1 text-foreground",
3958
- 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))
3959
3999
  }
3960
4000
  )
3961
4001
  ] }),
3962
- /* @__PURE__ */ jsxs18("label", { className: "flex flex-col gap-1", children: [
3963
- /* @__PURE__ */ jsxs18("span", { className: "flex justify-between text-muted-foreground", children: [
3964
- /* @__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: [
3965
4005
  "Decontaminate colors",
3966
4006
  toLayer ? "" : " (new layer or document outputs)"
3967
4007
  ] }),
3968
- /* @__PURE__ */ jsxs18("span", { className: "font-mono", children: [
4008
+ /* @__PURE__ */ jsxs19("span", { className: "font-mono", children: [
3969
4009
  decontaminate,
3970
4010
  "%"
3971
4011
  ] })
3972
4012
  ] }),
3973
- /* @__PURE__ */ jsx20(
4013
+ /* @__PURE__ */ jsx21(
3974
4014
  "input",
3975
4015
  {
3976
4016
  type: "range",
@@ -3985,64 +4025,65 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
3985
4025
  }
3986
4026
  )
3987
4027
  ] }),
3988
- /* @__PURE__ */ jsxs18("div", { className: "flex gap-1", children: [
3989
- /* @__PURE__ */ jsx20("button", { type: "button", className: button4, disabled: !sel || busy, onClick: refine, children: "Refine Edge" }),
3990
- /* @__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" })
3991
4031
  ] }),
3992
- error && /* @__PURE__ */ jsx20("p", { role: "alert", className: "text-destructive", children: error }),
3993
- /* @__PURE__ */ jsx20(MaskEdgeCheck, { controller, selection: sel }),
3994
- /* @__PURE__ */ jsx20("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] mt-2", children: "Layer Mask" }),
3995
- /* @__PURE__ */ jsxs18("div", { className: "flex gap-1 items-center", children: [
3996
- /* @__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(
3997
4038
  "select",
3998
4039
  {
3999
4040
  "aria-label": "New masked layer kind",
4000
4041
  value: newKind,
4001
4042
  onChange: (e) => setNewKind(e.target.value),
4002
4043
  className: "flex-1 bg-background border border-border rounded px-1 py-1 text-foreground",
4003
- 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))
4004
4045
  }
4005
4046
  ),
4006
- /* @__PURE__ */ jsx20(
4047
+ /* @__PURE__ */ jsx21(
4007
4048
  "button",
4008
4049
  {
4009
4050
  type: "button",
4010
- className: button4,
4051
+ className: button5,
4011
4052
  disabled: !sel,
4012
4053
  onClick: () => sel && setLayerId(controller.addAdjustmentLayer({ kind: newKind, mask: layerMaskFromSelection(sel) })),
4013
4054
  children: "New Masked Layer"
4014
4055
  }
4015
4056
  )
4016
4057
  ] }),
4017
- list.length > 0 && target && /* @__PURE__ */ jsxs18("div", { className: "flex flex-col gap-2", children: [
4018
- /* @__PURE__ */ jsx20(
4058
+ list.length > 0 && target && /* @__PURE__ */ jsxs19("div", { className: "flex flex-col gap-2", children: [
4059
+ /* @__PURE__ */ jsx21(
4019
4060
  "select",
4020
4061
  {
4021
4062
  "aria-label": "Mask layer",
4022
4063
  value: target.id,
4023
4064
  onChange: (e) => setLayerId(e.target.value),
4024
4065
  className: "bg-background border border-border rounded px-1 py-1 text-foreground",
4025
- children: list.map((l) => /* @__PURE__ */ jsxs18("option", { value: l.id, children: [
4066
+ children: list.map((l) => /* @__PURE__ */ jsxs19("option", { value: l.id, children: [
4026
4067
  l.name || adjustmentKindLabel2(l.kind),
4027
4068
  l.mask ? " (masked)" : ""
4028
4069
  ] }, l.id))
4029
4070
  }
4030
4071
  ),
4031
- /* @__PURE__ */ jsxs18("div", { className: "flex flex-wrap gap-1", children: [
4032
- /* @__PURE__ */ jsx20("button", { type: "button", className: button4, disabled: !sel, onClick: () => controller.applySelectionAsLayerMask(target.id), children: "Mask with Selection" }),
4033
- /* @__PURE__ */ jsx20("button", { type: "button", className: button4, disabled: !target.mask, onClick: () => controller.selectionFromLayerMask(target.id), children: "Load as Selection" }),
4034
- /* @__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" })
4035
4076
  ] }),
4036
- target.mask && /* @__PURE__ */ jsxs18(Fragment5, { children: [
4037
- /* @__PURE__ */ jsxs18("label", { className: "flex flex-col gap-1", children: [
4038
- /* @__PURE__ */ jsxs18("span", { className: "flex justify-between text-muted-foreground", children: [
4039
- /* @__PURE__ */ jsx20("span", { children: "Density" }),
4040
- /* @__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: [
4041
4082
  Math.round((target.mask.density ?? 1) * 100),
4042
4083
  "%"
4043
4084
  ] })
4044
4085
  ] }),
4045
- /* @__PURE__ */ jsx20(
4086
+ /* @__PURE__ */ jsx21(
4046
4087
  "input",
4047
4088
  {
4048
4089
  type: "range",
@@ -4056,15 +4097,15 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
4056
4097
  }
4057
4098
  )
4058
4099
  ] }),
4059
- /* @__PURE__ */ jsxs18("label", { className: "flex flex-col gap-1", children: [
4060
- /* @__PURE__ */ jsxs18("span", { className: "flex justify-between text-muted-foreground", children: [
4061
- /* @__PURE__ */ jsx20("span", { children: "Mask Feather" }),
4062
- /* @__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: [
4063
4104
  target.mask.feather ?? 0,
4064
4105
  "px"
4065
4106
  ] })
4066
4107
  ] }),
4067
- /* @__PURE__ */ jsx20(
4108
+ /* @__PURE__ */ jsx21(
4068
4109
  "input",
4069
4110
  {
4070
4111
  type: "range",
@@ -4084,9 +4125,9 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
4084
4125
  };
4085
4126
 
4086
4127
  // src/image-editor/ChannelsPanel.tsx
4087
- 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";
4088
4129
  import { MASK_FILE_ACCEPT, channelThumbnail, downloadMaskImage, openMaskFile, selectionModeFromModifiers } from "@pixerate/editor/image-editor";
4089
- import { jsx as jsx21, jsxs as jsxs19 } from "react/jsx-runtime";
4130
+ import { jsx as jsx22, jsxs as jsxs20 } from "react/jsx-runtime";
4090
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"}`;
4091
4132
  var ChannelThumb = ({ channel, size }) => {
4092
4133
  const ref = useRef11(null);
@@ -4101,14 +4142,14 @@ var ChannelThumb = ({ channel, size }) => {
4101
4142
  img.data.set(px.data);
4102
4143
  ctx.putImageData(img, 0, 0);
4103
4144
  }, [channel.mask]);
4104
- 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" });
4105
4146
  };
4106
4147
  var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
4107
- const [, setTick] = useState17(0);
4148
+ const [, setTick] = useState18(0);
4108
4149
  useEffect12(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
4109
- const [activeId, setActiveId] = useState17(null);
4110
- const [renaming, setRenaming] = useState17(null);
4111
- const [error, setError] = useState17(null);
4150
+ const [activeId, setActiveId] = useState18(null);
4151
+ const [renaming, setRenaming] = useState18(null);
4152
+ const [error, setError] = useState18(null);
4112
4153
  const fileInput = useRef11(null);
4113
4154
  const channels = controller.getChannels();
4114
4155
  const active = channels.find((c) => c.id === activeId) ?? null;
@@ -4131,13 +4172,13 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
4131
4172
  setError(err instanceof Error ? err.message : String(err));
4132
4173
  }
4133
4174
  };
4134
- return /* @__PURE__ */ jsxs19("div", { "data-testid": "channels-panel", className: `flex flex-col gap-2 text-xs ${className}`, children: [
4135
- /* @__PURE__ */ jsxs19("div", { className: "flex items-center justify-between", children: [
4136
- /* @__PURE__ */ jsx21("span", { className: imageSectionTitleClass, children: "Channels" }),
4137
- /* @__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" })
4138
4179
  ] }),
4139
- channels.length === 0 && /* @__PURE__ */ jsx21("p", { className: "text-muted-foreground", children: "No channels. Save a selection to keep it." }),
4140
- /* @__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(
4141
4182
  "li",
4142
4183
  {
4143
4184
  "data-testid": "channel-row",
@@ -4149,7 +4190,7 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
4149
4190
  },
4150
4191
  onDoubleClick: () => setRenaming(c.id),
4151
4192
  children: [
4152
- /* @__PURE__ */ jsx21(
4193
+ /* @__PURE__ */ jsx22(
4153
4194
  "button",
4154
4195
  {
4155
4196
  type: "button",
@@ -4163,8 +4204,8 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
4163
4204
  children: c.visible ? "\u25CF" : "\u25CB"
4164
4205
  }
4165
4206
  ),
4166
- /* @__PURE__ */ jsx21(ChannelThumb, { channel: c, size: thumbnailSize }),
4167
- renaming === c.id ? /* @__PURE__ */ jsx21(
4207
+ /* @__PURE__ */ jsx22(ChannelThumb, { channel: c, size: thumbnailSize }),
4208
+ renaming === c.id ? /* @__PURE__ */ jsx22(
4168
4209
  "input",
4169
4210
  {
4170
4211
  autoFocus: true,
@@ -4181,16 +4222,16 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
4181
4222
  if (e.key === "Escape") setRenaming(null);
4182
4223
  }
4183
4224
  }
4184
- ) : /* @__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 })
4185
4226
  ]
4186
4227
  },
4187
4228
  c.id
4188
4229
  )) }),
4189
- /* @__PURE__ */ jsxs19("div", { className: "flex flex-wrap gap-1", children: [
4190
- /* @__PURE__ */ jsx21("button", { type: "button", className: btn2(), disabled: !hasSelection, onClick: () => attempt(() => setActiveId(controller.saveSelection().id)), children: "Save Selection" }),
4191
- /* @__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" }),
4192
- /* @__PURE__ */ jsx21("button", { type: "button", className: btn2(), disabled: !active, onClick: () => attempt(() => setActiveId(controller.duplicateChannel(active.id).id)), children: "Duplicate" }),
4193
- /* @__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(
4194
4235
  "button",
4195
4236
  {
4196
4237
  type: "button",
@@ -4203,8 +4244,8 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
4203
4244
  children: "Delete"
4204
4245
  }
4205
4246
  ),
4206
- /* @__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" }),
4207
- /* @__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(
4208
4249
  "button",
4209
4250
  {
4210
4251
  type: "button",
@@ -4215,7 +4256,7 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
4215
4256
  children: "Export PNG"
4216
4257
  }
4217
4258
  ),
4218
- /* @__PURE__ */ jsx21(
4259
+ /* @__PURE__ */ jsx22(
4219
4260
  "input",
4220
4261
  {
4221
4262
  ref: fileInput,
@@ -4230,22 +4271,22 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
4230
4271
  }
4231
4272
  )
4232
4273
  ] }),
4233
- error && /* @__PURE__ */ jsx21("p", { role: "alert", className: "text-destructive", children: error })
4274
+ error && /* @__PURE__ */ jsx22("p", { role: "alert", className: "text-destructive", children: error })
4234
4275
  ] });
4235
4276
  };
4236
4277
 
4237
4278
  // src/image-editor/PathsPanel.tsx
4238
- import { useEffect as useEffect13, useState as useState18 } from "react";
4279
+ import { useEffect as useEffect13, useState as useState19 } from "react";
4239
4280
  import { pathSvgData, selectionModeFromModifiers as selectionModeFromModifiers2 } from "@pixerate/editor/image-editor";
4240
- import { jsx as jsx22, jsxs as jsxs20 } from "react/jsx-runtime";
4281
+ import { jsx as jsx23, jsxs as jsxs21 } from "react/jsx-runtime";
4241
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"}`;
4242
4283
  var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
4243
- const [, setTick] = useState18(0);
4284
+ const [, setTick] = useState19(0);
4244
4285
  useEffect13(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
4245
- const [renaming, setRenaming] = useState18(null);
4246
- const [color, setColor] = useState18("#000000");
4247
- const [width, setWidth] = useState18(2);
4248
- 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);
4249
4290
  const paths = controller.getPaths();
4250
4291
  const activeId = controller.getState().activePathId ?? null;
4251
4292
  const active = paths.find((p) => p.id === activeId) ?? null;
@@ -4261,10 +4302,10 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
4261
4302
  };
4262
4303
  return (
4263
4304
  // Clicking the panel's empty space deselects the path (the path tools then edit the active layer).
4264
- /* @__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: [
4265
- /* @__PURE__ */ jsx22("span", { className: imageSectionTitleClass, children: "Paths" }),
4266
- paths.length === 0 && /* @__PURE__ */ jsx22("p", { className: "text-muted-foreground", children: "No paths. Make a work path from a selection." }),
4267
- /* @__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(
4268
4309
  "li",
4269
4310
  {
4270
4311
  "data-testid": "path-row",
@@ -4273,8 +4314,8 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
4273
4314
  onClick: () => attempt(() => controller.setActivePath(p.id)),
4274
4315
  onDoubleClick: () => setRenaming(p.id),
4275
4316
  children: [
4276
- /* @__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" }) }),
4277
- 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(
4278
4319
  "input",
4279
4320
  {
4280
4321
  autoFocus: true,
@@ -4293,13 +4334,13 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
4293
4334
  if (e.key === "Escape") setRenaming(null);
4294
4335
  }
4295
4336
  }
4296
- ) : /* @__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 })
4297
4338
  ]
4298
4339
  },
4299
4340
  p.id
4300
4341
  )) }),
4301
- /* @__PURE__ */ jsxs20("div", { className: "flex flex-wrap gap-1", children: [
4302
- /* @__PURE__ */ jsx22(
4342
+ /* @__PURE__ */ jsxs21("div", { className: "flex flex-wrap gap-1", children: [
4343
+ /* @__PURE__ */ jsx23(
4303
4344
  "button",
4304
4345
  {
4305
4346
  type: "button",
@@ -4310,15 +4351,15 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
4310
4351
  children: "Load as Selection"
4311
4352
  }
4312
4353
  ),
4313
- /* @__PURE__ */ jsx22("button", { type: "button", className: btn3(), disabled: !hasSelection, onClick: () => attempt(() => controller.makeWorkPath()), children: "Make Work Path" }),
4314
- active?.work && /* @__PURE__ */ jsx22("button", { type: "button", className: btn3(), onClick: () => setRenaming(active.id), children: "Save Path" }),
4315
- /* @__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" })
4316
4357
  ] }),
4317
- /* @__PURE__ */ jsxs20("div", { className: "flex flex-wrap items-center gap-1", children: [
4318
- /* @__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" }),
4319
- /* @__PURE__ */ jsx22("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.fillPath(active.id, { color })), children: "Fill Path" }),
4320
- /* @__PURE__ */ jsxs20("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
4321
- /* @__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(
4322
4363
  "input",
4323
4364
  {
4324
4365
  type: "number",
@@ -4333,24 +4374,24 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
4333
4374
  ),
4334
4375
  "px"
4335
4376
  ] }),
4336
- /* @__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" })
4337
4378
  ] }),
4338
- /* @__PURE__ */ jsxs20("div", { className: "flex flex-wrap gap-1", children: [
4339
- /* @__PURE__ */ jsx22("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.duplicatePath(active.id)), children: "Duplicate" }),
4340
- /* @__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" })
4341
4382
  ] }),
4342
- error && /* @__PURE__ */ jsx22("p", { role: "alert", className: "text-destructive", children: error })
4383
+ error && /* @__PURE__ */ jsx23("p", { role: "alert", className: "text-destructive", children: error })
4343
4384
  ] })
4344
4385
  );
4345
4386
  };
4346
4387
 
4347
4388
  // src/image-editor/FreeTransformOptionsBar.tsx
4348
- import { useEffect as useEffect14, useState as useState19 } from "react";
4389
+ import { useEffect as useEffect14, useState as useState20 } from "react";
4349
4390
  import { FREE_TRANSFORM_FIELDS, FREE_TRANSFORM_MODE_OPTIONS, INTERPOLATIONS, TRANSFORM_ANCHORS, WARP_GRID_OPTIONS, WARP_STYLE_OPTIONS } from "@pixerate/editor/image-editor";
4350
- import { jsx as jsx23, jsxs as jsxs21 } from "react/jsx-runtime";
4391
+ import { jsx as jsx24, jsxs as jsxs22 } from "react/jsx-runtime";
4351
4392
  var round = (v, unit) => unit === "px" ? Math.round(v * 10) / 10 : Math.round(v * 100) / 100;
4352
4393
  var FreeTransformOptionsBar = ({ tool, className }) => {
4353
- const [, setTick] = useState19(0);
4394
+ const [, setTick] = useState20(0);
4354
4395
  useEffect14(() => tool.subscribe(() => setTick((n) => n + 1)), [tool]);
4355
4396
  const bar = tool.bar();
4356
4397
  if (!tool.active || !bar) return null;
@@ -4363,17 +4404,17 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
4363
4404
  const v = Number(raw);
4364
4405
  if (raw.trim() !== "" && Number.isFinite(v) && Math.abs(v - bar[field]) > 1e-9) tool.setField(field, v);
4365
4406
  };
4366
- 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: [
4367
- /* @__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)) }),
4368
- /* @__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)) }),
4369
- tool.mode === "warp" && /* @__PURE__ */ jsxs21("div", { className: "flex flex-wrap items-center gap-2", role: "group", "aria-label": "Warp options", children: [
4370
- /* @__PURE__ */ jsxs21("label", { className: "flex items-center gap-1", children: [
4371
- /* @__PURE__ */ jsx23("span", { className: "text-muted-foreground", children: "Warp" }),
4372
- /* @__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)) })
4373
4414
  ] }),
4374
- ["bend", "horizontal", "vertical"].map((k) => /* @__PURE__ */ jsxs21("label", { className: "flex items-center gap-1", children: [
4375
- /* @__PURE__ */ jsx23("span", { className: "text-muted-foreground", children: k === "bend" ? "Bend" : k === "horizontal" ? "H" : "V" }),
4376
- /* @__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(
4377
4418
  "input",
4378
4419
  {
4379
4420
  type: "number",
@@ -4394,9 +4435,9 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
4394
4435
  },
4395
4436
  `${k}:${warp[k]}`
4396
4437
  ),
4397
- /* @__PURE__ */ jsx23("span", { className: "text-muted-foreground", children: "%" })
4438
+ /* @__PURE__ */ jsx24("span", { className: "text-muted-foreground", children: "%" })
4398
4439
  ] }, k)),
4399
- /* @__PURE__ */ jsx23(
4440
+ /* @__PURE__ */ jsx24(
4400
4441
  "button",
4401
4442
  {
4402
4443
  type: "button",
@@ -4408,9 +4449,9 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
4408
4449
  children: "Vertical"
4409
4450
  }
4410
4451
  ),
4411
- /* @__PURE__ */ jsxs21("label", { className: "flex items-center gap-1", children: [
4412
- /* @__PURE__ */ jsx23("span", { className: "text-muted-foreground", children: "Grid" }),
4413
- /* @__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(
4414
4455
  "select",
4415
4456
  {
4416
4457
  "aria-label": "Warp grid",
@@ -4420,14 +4461,14 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
4420
4461
  tool.setWarp({ columns: g.columns, rows: g.rows });
4421
4462
  },
4422
4463
  className: imageFieldClass,
4423
- 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))
4424
4465
  }
4425
4466
  )
4426
4467
  ] })
4427
4468
  ] }),
4428
- tool.mode !== "warp" && FREE_TRANSFORM_FIELDS.map((f) => /* @__PURE__ */ jsxs21("label", { className: "flex items-center gap-1", title: f.title, children: [
4429
- /* @__PURE__ */ jsx23("span", { className: "text-muted-foreground", children: f.label }),
4430
- /* @__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(
4431
4472
  "input",
4432
4473
  {
4433
4474
  type: "number",
@@ -4447,8 +4488,8 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
4447
4488
  },
4448
4489
  `${f.id}:${round(bar[f.id], f.unit)}`
4449
4490
  ),
4450
- /* @__PURE__ */ jsx23("span", { className: "text-muted-foreground", children: f.unit }),
4451
- f.id === "scaleX" && /* @__PURE__ */ jsx23(
4491
+ /* @__PURE__ */ jsx24("span", { className: "text-muted-foreground", children: f.unit }),
4492
+ f.id === "scaleX" && /* @__PURE__ */ jsx24(
4452
4493
  "button",
4453
4494
  {
4454
4495
  type: "button",
@@ -4463,33 +4504,33 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
4463
4504
  }
4464
4505
  )
4465
4506
  ] }, f.id)),
4466
- /* @__PURE__ */ jsxs21("label", { className: "flex items-center gap-1", children: [
4467
- /* @__PURE__ */ jsx23("span", { className: "text-muted-foreground", children: "Interpolation" }),
4468
- /* @__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(
4469
4510
  "select",
4470
4511
  {
4471
4512
  "aria-label": "Interpolation",
4472
4513
  value: tool.interpolation,
4473
4514
  onChange: (e) => tool.setInterpolation(e.target.value),
4474
4515
  className: imageFieldClass,
4475
- 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))
4476
4517
  }
4477
4518
  )
4478
4519
  ] }),
4479
- /* @__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" }),
4480
- /* @__PURE__ */ jsx23("button", { type: "button", title: "Cancel (Esc)", className: imageChipClass(false), onClick: () => tool.cancel(), children: "Cancel" }),
4481
- 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 })
4482
4523
  ] });
4483
4524
  };
4484
4525
 
4485
4526
  // src/image-editor/ShapeOptionsBar.tsx
4486
- import { useEffect as useEffect15, useState as useState20 } from "react";
4527
+ import { useEffect as useEffect15, useState as useState21 } from "react";
4487
4528
  import { LIVE_SHAPE_KINDS, SHAPE_KIND_LABELS, applyShapeOptions } from "@pixerate/editor/image-editor";
4488
- 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";
4489
4530
  var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
4490
- const [, setTick] = useState20(0);
4531
+ const [, setTick] = useState21(0);
4491
4532
  useEffect15(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
4492
- const [error, setError] = useState20(null);
4533
+ const [error, setError] = useState21(null);
4493
4534
  const active = controller.getActiveLayer();
4494
4535
  const shapeId = active?.type === "shape" ? active.id : null;
4495
4536
  const set = (change) => {
@@ -4503,22 +4544,22 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
4503
4544
  }
4504
4545
  };
4505
4546
  const num = (v, min, max) => Math.max(min, Math.min(max, Number(v) || min));
4506
- return /* @__PURE__ */ jsxs22("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "shape-options", children: [
4507
- /* @__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)) }),
4508
- /* @__PURE__ */ jsxs22("div", { className: "flex flex-wrap items-center gap-3", children: [
4509
- /* @__PURE__ */ jsxs22("label", { className: "flex items-center gap-1", children: [
4510
- /* @__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 }) }),
4511
4552
  "Fill",
4512
- /* @__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 }) })
4513
4554
  ] }),
4514
- /* @__PURE__ */ jsxs22("label", { className: "flex items-center gap-1", children: [
4515
- /* @__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 }) }),
4516
4557
  "Stroke",
4517
- /* @__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 }) })
4518
4559
  ] }),
4519
- /* @__PURE__ */ jsxs22("label", { className: "flex items-center gap-1", children: [
4560
+ /* @__PURE__ */ jsxs23("label", { className: "flex items-center gap-1", children: [
4520
4561
  "Width",
4521
- /* @__PURE__ */ jsx24(
4562
+ /* @__PURE__ */ jsx25(
4522
4563
  "input",
4523
4564
  {
4524
4565
  type: "number",
@@ -4532,52 +4573,52 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
4532
4573
  )
4533
4574
  ] })
4534
4575
  ] }),
4535
- /* @__PURE__ */ jsxs22("div", { className: "flex flex-wrap items-center gap-3", children: [
4536
- 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: [
4537
4578
  "Radius",
4538
- /* @__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}` })
4539
4580
  ] }),
4540
- 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: [
4541
4582
  "Sides",
4542
- /* @__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}` })
4543
4584
  ] }),
4544
- options.kind === "star" && /* @__PURE__ */ jsxs22(Fragment6, { children: [
4545
- /* @__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: [
4546
4587
  "Points",
4547
- /* @__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}` })
4548
4589
  ] }),
4549
- /* @__PURE__ */ jsxs22("label", { className: "flex items-center gap-1", children: [
4590
+ /* @__PURE__ */ jsxs23("label", { className: "flex items-center gap-1", children: [
4550
4591
  "Inner",
4551
- /* @__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 }) })
4552
4593
  ] })
4553
4594
  ] }),
4554
- options.kind === "line" && /* @__PURE__ */ jsxs22(Fragment6, { children: [
4555
- /* @__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: [
4556
4597
  "Weight",
4557
- /* @__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}` })
4558
4599
  ] }),
4559
- /* @__PURE__ */ jsxs22("label", { className: "flex items-center gap-1", children: [
4560
- /* @__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 }) }),
4561
4602
  "Arrowhead"
4562
4603
  ] })
4563
4604
  ] })
4564
4605
  ] }),
4565
- /* @__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." }),
4566
- 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 })
4567
4608
  ] });
4568
4609
  };
4569
4610
 
4570
4611
  // src/image-editor/TypeOptionsBar.tsx
4571
- import { useEffect as useEffect16, useState as useState21 } from "react";
4612
+ import { useEffect as useEffect16, useState as useState22 } from "react";
4572
4613
  import { TEXT_ALIGNS, TEXT_ORIENTATIONS } from "@pixerate/editor/image-editor";
4573
- import { jsx as jsx25, jsxs as jsxs23 } from "react/jsx-runtime";
4614
+ import { jsx as jsx26, jsxs as jsxs24 } from "react/jsx-runtime";
4574
4615
  var ALIGN_LABELS = { left: "Left", center: "Centre", right: "Right", justify: "Justify" };
4575
4616
  var ORIENTATION_LABELS = { horizontal: "Horizontal", vertical: "Vertical" };
4576
4617
  var TypeOptionsBar = ({ controller, options, onChange, session, className }) => {
4577
- const [, setTick] = useState21(0);
4618
+ const [, setTick] = useState22(0);
4578
4619
  useEffect16(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
4579
4620
  useEffect16(() => session?.subscribe(() => setTick((n) => n + 1)), [session]);
4580
- const [error, setError] = useState21(null);
4621
+ const [error, setError] = useState22(null);
4581
4622
  const active = controller.getActiveLayer();
4582
4623
  const typeId = !session && active?.type === "type" ? active.id : null;
4583
4624
  const here = session?.alive ? session.styleHere() : {};
@@ -4630,11 +4671,11 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
4630
4671
  setError(e instanceof Error ? e.message : String(e));
4631
4672
  }
4632
4673
  };
4633
- return /* @__PURE__ */ jsxs23("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "type-options", children: [
4634
- /* @__PURE__ */ jsxs23("div", { className: "flex flex-wrap items-center gap-2", children: [
4635
- /* @__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: [
4636
4677
  "Font",
4637
- /* @__PURE__ */ jsx25(
4678
+ /* @__PURE__ */ jsx26(
4638
4679
  "input",
4639
4680
  {
4640
4681
  list: "pixerate-type-fonts",
@@ -4644,11 +4685,11 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
4644
4685
  className: "w-32 rounded border border-border bg-background px-1 py-0.5"
4645
4686
  }
4646
4687
  ),
4647
- /* @__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)) })
4648
4689
  ] }),
4649
- /* @__PURE__ */ jsxs23("label", { className: "flex items-center gap-1", children: [
4690
+ /* @__PURE__ */ jsxs24("label", { className: "flex items-center gap-1", children: [
4650
4691
  "Size",
4651
- /* @__PURE__ */ jsx25(
4692
+ /* @__PURE__ */ jsx26(
4652
4693
  "input",
4653
4694
  {
4654
4695
  type: "number",
@@ -4661,14 +4702,14 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
4661
4702
  }
4662
4703
  )
4663
4704
  ] }),
4664
- /* @__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" }),
4665
- /* @__PURE__ */ jsx25("button", { type: "button", "aria-pressed": shown.italic, className: `${imageChipClass(shown.italic)} italic`, onClick: () => style({ italic: !shown.italic }), children: "I" }),
4666
- /* @__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 }) })
4667
4708
  ] }),
4668
- /* @__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)) }),
4669
- /* @__PURE__ */ jsxs23("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Orientation", children: [
4670
- 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)),
4671
- 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(
4672
4713
  "button",
4673
4714
  {
4674
4715
  type: "button",
@@ -4680,19 +4721,19 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
4680
4721
  }
4681
4722
  )
4682
4723
  ] }),
4683
- /* @__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." }),
4684
- 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: [
4685
4726
  "Missing ",
4686
4727
  missing.length === 1 ? "font" : "fonts",
4687
4728
  ": ",
4688
4729
  missing.join(", ")
4689
4730
  ] }),
4690
- error && /* @__PURE__ */ jsx25("p", { role: "alert", className: "text-destructive", children: error })
4731
+ error && /* @__PURE__ */ jsx26("p", { role: "alert", className: "text-destructive", children: error })
4691
4732
  ] });
4692
4733
  };
4693
4734
 
4694
4735
  // src/image-editor/ImageEditor.tsx
4695
- 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";
4696
4737
  var ImageEditor = ({
4697
4738
  editor: externalEditor,
4698
4739
  src,
@@ -4717,7 +4758,7 @@ var ImageEditor = ({
4717
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);
4718
4759
  });
4719
4760
  const legacyProcess = normalizeProcessVersion(state.adjustments.process) < LATEST_PROCESS_VERSION;
4720
- const [activeTab, setActiveTab] = useState22("crop");
4761
+ const [activeTab, setActiveTab] = useState23("crop");
4721
4762
  const rootRef = useRef12(null);
4722
4763
  const canvasMode = activeTab === "crop" || activeTab === "select" || activeTab === "paint" || activeTab === "annotate" ? activeTab : "none";
4723
4764
  const activeTabRef = useRef12(activeTab);
@@ -4727,14 +4768,14 @@ var ImageEditor = ({
4727
4768
  rootRef.current?.querySelector(`[data-image-tab="${CSS.escape(ref.id)}"]`)?.click();
4728
4769
  await new Promise((resolve) => setTimeout(resolve, 60));
4729
4770
  };
4730
- const [activeCropRatio, setActiveCropRatio] = useState22(null);
4731
- const [selectionOptions, setSelectionOptions] = useState22(DEFAULT_SELECTION_TOOL_OPTIONS2);
4732
- const [shapeOptions, setShapeOptions] = useState22(DEFAULT_SHAPE_TOOL_OPTIONS2);
4733
- const [typeOptions, setTypeOptions] = useState22(DEFAULT_TYPE_TOOL_OPTIONS2);
4734
- const [typeSession, setTypeSession] = useState22(null);
4735
- const [selectionError, setSelectionError] = useState22(null);
4736
- const [paintError, setPaintError] = useState22(null);
4737
- 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);
4738
4779
  const handleCanvasError = (source, message) => {
4739
4780
  if (source === "paint") setPaintError(message);
4740
4781
  else if (source === "select") setSelectionError(message);
@@ -4751,16 +4792,16 @@ var ImageEditor = ({
4751
4792
  transformControllerRef.current = controller;
4752
4793
  }
4753
4794
  const transformTool = transformToolRef.current;
4754
- const [, setTransformTick] = useState22(0);
4795
+ const [, setTransformTick] = useState23(0);
4755
4796
  useEffect17(() => transformTool.subscribe(() => setTransformTick((n) => n + 1)), [transformTool]);
4756
4797
  useEffect17(() => () => transformToolRef.current?.cancel(), []);
4757
- const [inpaintPrompt, setInpaintPrompt] = useState22("");
4758
- const [inpaintMaskMode, setInpaintMaskMode] = useState22("annotations");
4759
- const [isRemovingBg, setIsRemovingBg] = useState22(false);
4760
- const [isInpainting, setIsInpainting] = useState22(false);
4761
- const [aiError, setAiError] = useState22(null);
4762
- const [aiSuccess, setAiSuccess] = useState22(null);
4763
- 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");
4764
4805
  const aiOptions = aiTarget === "auto" ? {} : { target: aiTarget };
4765
4806
  const effectiveOnInpaint = onInpaint || aiHooks?.onInpaint;
4766
4807
  const effectiveOnRemoveBg = onRemoveBackground || aiHooks?.onRemoveBackground;
@@ -4823,10 +4864,10 @@ var ImageEditor = ({
4823
4864
  setIsInpainting(false);
4824
4865
  }
4825
4866
  };
4826
- const [activeColor, setActiveColor] = useState22("#ef4444");
4827
- const [strokeWidth, setStrokeWidth] = useState22(3);
4828
- const [fontSize, setFontSize] = useState22(24);
4829
- 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("");
4830
4871
  useEffect17(() => {
4831
4872
  if (activeTab === "crop" && editor.state.activeTool !== "crop") {
4832
4873
  editor.setTool("crop");
@@ -4855,16 +4896,16 @@ var ImageEditor = ({
4855
4896
  link.click();
4856
4897
  }
4857
4898
  };
4858
- return /* @__PURE__ */ jsxs24(
4899
+ return /* @__PURE__ */ jsxs25(
4859
4900
  "div",
4860
4901
  {
4861
4902
  ref: rootRef,
4862
4903
  className: `${imageEditorFrameClass} ${className}`,
4863
4904
  style,
4864
4905
  children: [
4865
- /* @__PURE__ */ jsxs24("div", { className: imageEditorHeaderClass, children: [
4866
- /* @__PURE__ */ jsxs24("div", { role: "tablist", className: imageTabListClass, children: [
4867
- /* @__PURE__ */ jsx26(
4906
+ /* @__PURE__ */ jsxs25("div", { className: imageEditorHeaderClass, children: [
4907
+ /* @__PURE__ */ jsxs25("div", { role: "tablist", className: imageTabListClass, children: [
4908
+ /* @__PURE__ */ jsx27(
4868
4909
  "button",
4869
4910
  {
4870
4911
  type: "button",
@@ -4879,7 +4920,7 @@ var ImageEditor = ({
4879
4920
  children: "Transform & Crop"
4880
4921
  }
4881
4922
  ),
4882
- /* @__PURE__ */ jsx26(
4923
+ /* @__PURE__ */ jsx27(
4883
4924
  "button",
4884
4925
  {
4885
4926
  type: "button",
@@ -4894,7 +4935,7 @@ var ImageEditor = ({
4894
4935
  children: "Adjustments"
4895
4936
  }
4896
4937
  ),
4897
- /* @__PURE__ */ jsx26(
4938
+ /* @__PURE__ */ jsx27(
4898
4939
  "button",
4899
4940
  {
4900
4941
  type: "button",
@@ -4909,7 +4950,7 @@ var ImageEditor = ({
4909
4950
  children: "Layers"
4910
4951
  }
4911
4952
  ),
4912
- /* @__PURE__ */ jsx26(
4953
+ /* @__PURE__ */ jsx27(
4913
4954
  "button",
4914
4955
  {
4915
4956
  type: "button",
@@ -4924,7 +4965,7 @@ var ImageEditor = ({
4924
4965
  children: "Paint"
4925
4966
  }
4926
4967
  ),
4927
- /* @__PURE__ */ jsx26(
4968
+ /* @__PURE__ */ jsx27(
4928
4969
  "button",
4929
4970
  {
4930
4971
  type: "button",
@@ -4939,7 +4980,7 @@ var ImageEditor = ({
4939
4980
  children: "Select & Mask"
4940
4981
  }
4941
4982
  ),
4942
- /* @__PURE__ */ jsx26(
4983
+ /* @__PURE__ */ jsx27(
4943
4984
  "button",
4944
4985
  {
4945
4986
  type: "button",
@@ -4954,7 +4995,7 @@ var ImageEditor = ({
4954
4995
  children: "Annotations"
4955
4996
  }
4956
4997
  ),
4957
- /* @__PURE__ */ jsx26(
4998
+ /* @__PURE__ */ jsx27(
4958
4999
  "button",
4959
5000
  {
4960
5001
  type: "button",
@@ -4969,7 +5010,7 @@ var ImageEditor = ({
4969
5010
  children: "Depth Mask"
4970
5011
  }
4971
5012
  ),
4972
- /* @__PURE__ */ jsxs24(
5013
+ /* @__PURE__ */ jsxs25(
4973
5014
  "button",
4974
5015
  {
4975
5016
  type: "button",
@@ -4982,14 +5023,14 @@ var ImageEditor = ({
4982
5023
  "aria-selected": activeTab === "ai",
4983
5024
  className: `${imageTabClass(activeTab === "ai")} flex items-center gap-1.5`,
4984
5025
  children: [
4985
- /* @__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" }) }),
4986
5027
  "AI Tools"
4987
5028
  ]
4988
5029
  }
4989
5030
  )
4990
5031
  ] }),
4991
- /* @__PURE__ */ jsxs24("div", { className: "flex items-center gap-2 text-xs", children: [
4992
- /* @__PURE__ */ jsx26(
5032
+ /* @__PURE__ */ jsxs25("div", { className: "flex items-center gap-2 text-xs", children: [
5033
+ /* @__PURE__ */ jsx27(
4993
5034
  "button",
4994
5035
  {
4995
5036
  type: "button",
@@ -5000,7 +5041,7 @@ var ImageEditor = ({
5000
5041
  children: "\u21A9"
5001
5042
  }
5002
5043
  ),
5003
- /* @__PURE__ */ jsx26(
5044
+ /* @__PURE__ */ jsx27(
5004
5045
  "button",
5005
5046
  {
5006
5047
  type: "button",
@@ -5011,7 +5052,7 @@ var ImageEditor = ({
5011
5052
  children: "\u21AA"
5012
5053
  }
5013
5054
  ),
5014
- /* @__PURE__ */ jsx26(
5055
+ /* @__PURE__ */ jsx27(
5015
5056
  "button",
5016
5057
  {
5017
5058
  type: "button",
@@ -5020,8 +5061,8 @@ var ImageEditor = ({
5020
5061
  children: "Reset"
5021
5062
  }
5022
5063
  ),
5023
- /* @__PURE__ */ jsx26("div", { className: "h-4 w-px bg-muted mx-1" }),
5024
- /* @__PURE__ */ jsx26(
5064
+ /* @__PURE__ */ jsx27("div", { className: "h-4 w-px bg-muted mx-1" }),
5065
+ /* @__PURE__ */ jsx27(
5025
5066
  "button",
5026
5067
  {
5027
5068
  type: "button",
@@ -5031,11 +5072,11 @@ var ImageEditor = ({
5031
5072
  children: "-"
5032
5073
  }
5033
5074
  ),
5034
- /* @__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: [
5035
5076
  Math.round(state.zoom * 100),
5036
5077
  "%"
5037
5078
  ] }),
5038
- /* @__PURE__ */ jsx26(
5079
+ /* @__PURE__ */ jsx27(
5039
5080
  "button",
5040
5081
  {
5041
5082
  type: "button",
@@ -5045,8 +5086,8 @@ var ImageEditor = ({
5045
5086
  children: "+"
5046
5087
  }
5047
5088
  ),
5048
- /* @__PURE__ */ jsx26("div", { className: "h-4 w-px bg-muted mx-1" }),
5049
- /* @__PURE__ */ jsx26(
5089
+ /* @__PURE__ */ jsx27("div", { className: "h-4 w-px bg-muted mx-1" }),
5090
+ /* @__PURE__ */ jsx27(
5050
5091
  "button",
5051
5092
  {
5052
5093
  type: "button",
@@ -5057,7 +5098,7 @@ var ImageEditor = ({
5057
5098
  children: "Hold Compare"
5058
5099
  }
5059
5100
  ),
5060
- /* @__PURE__ */ jsx26(
5101
+ /* @__PURE__ */ jsx27(
5061
5102
  "button",
5062
5103
  {
5063
5104
  type: "button",
@@ -5068,10 +5109,10 @@ var ImageEditor = ({
5068
5109
  )
5069
5110
  ] })
5070
5111
  ] }),
5071
- transformTool.active && /* @__PURE__ */ jsx26(FreeTransformOptionsBar, { tool: transformTool, className: "border-b border-border bg-background/95 px-4 py-2" }),
5072
- !transformTool.active && transformTool.error && /* @__PURE__ */ jsx26("div", { role: "alert", className: imageErrorBannerClass, children: transformTool.error }),
5073
- /* @__PURE__ */ jsxs24("div", { className: "flex flex-col md:flex-row flex-1 min-h-[520px] md:h-[560px]", children: [
5074
- /* @__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(
5075
5116
  ImageEditorCanvas,
5076
5117
  {
5077
5118
  editor,
@@ -5095,11 +5136,11 @@ var ImageEditor = ({
5095
5136
  className: "flex-1 h-[360px] md:h-full min-h-[320px] bg-muted"
5096
5137
  }
5097
5138
  ),
5098
- /* @__PURE__ */ jsxs24("div", { className: imageSidebarClass, children: [
5099
- activeTab === "crop" && /* @__PURE__ */ jsxs24("div", { className: "flex flex-col gap-4 text-xs", children: [
5100
- /* @__PURE__ */ jsx26("span", { className: imageSectionTitleClass, children: "Aspect Ratio Presets" }),
5101
- /* @__PURE__ */ jsxs24("div", { className: "grid grid-cols-3 gap-2", children: [
5102
- /* @__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(
5103
5144
  "button",
5104
5145
  {
5105
5146
  type: "button",
@@ -5111,7 +5152,7 @@ var ImageEditor = ({
5111
5152
  children: "Freeform"
5112
5153
  }
5113
5154
  ),
5114
- /* @__PURE__ */ jsx26(
5155
+ /* @__PURE__ */ jsx27(
5115
5156
  "button",
5116
5157
  {
5117
5158
  type: "button",
@@ -5123,7 +5164,7 @@ var ImageEditor = ({
5123
5164
  children: "1:1 Square"
5124
5165
  }
5125
5166
  ),
5126
- /* @__PURE__ */ jsx26(
5167
+ /* @__PURE__ */ jsx27(
5127
5168
  "button",
5128
5169
  {
5129
5170
  type: "button",
@@ -5135,7 +5176,7 @@ var ImageEditor = ({
5135
5176
  children: "4:3 Standard"
5136
5177
  }
5137
5178
  ),
5138
- /* @__PURE__ */ jsx26(
5179
+ /* @__PURE__ */ jsx27(
5139
5180
  "button",
5140
5181
  {
5141
5182
  type: "button",
@@ -5147,7 +5188,7 @@ var ImageEditor = ({
5147
5188
  children: "16:9 Wide"
5148
5189
  }
5149
5190
  ),
5150
- /* @__PURE__ */ jsx26(
5191
+ /* @__PURE__ */ jsx27(
5151
5192
  "button",
5152
5193
  {
5153
5194
  type: "button",
@@ -5159,7 +5200,7 @@ var ImageEditor = ({
5159
5200
  children: "3:2 Photo"
5160
5201
  }
5161
5202
  ),
5162
- /* @__PURE__ */ jsx26(
5203
+ /* @__PURE__ */ jsx27(
5163
5204
  "button",
5164
5205
  {
5165
5206
  type: "button",
@@ -5172,10 +5213,10 @@ var ImageEditor = ({
5172
5213
  }
5173
5214
  )
5174
5215
  ] }),
5175
- /* @__PURE__ */ jsx26("div", { className: imageDividerClass }),
5176
- /* @__PURE__ */ jsx26("span", { className: imageSectionTitleClass, children: "Orientation & Flips" }),
5177
- /* @__PURE__ */ jsxs24("div", { className: "grid grid-cols-2 gap-2", children: [
5178
- /* @__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(
5179
5220
  "button",
5180
5221
  {
5181
5222
  type: "button",
@@ -5184,7 +5225,7 @@ var ImageEditor = ({
5184
5225
  children: "Rotate -90\xB0"
5185
5226
  }
5186
5227
  ),
5187
- /* @__PURE__ */ jsx26(
5228
+ /* @__PURE__ */ jsx27(
5188
5229
  "button",
5189
5230
  {
5190
5231
  type: "button",
@@ -5193,7 +5234,7 @@ var ImageEditor = ({
5193
5234
  children: "Rotate +90\xB0"
5194
5235
  }
5195
5236
  ),
5196
- /* @__PURE__ */ jsx26(
5237
+ /* @__PURE__ */ jsx27(
5197
5238
  "button",
5198
5239
  {
5199
5240
  type: "button",
@@ -5202,7 +5243,7 @@ var ImageEditor = ({
5202
5243
  children: "Flip Horizontal"
5203
5244
  }
5204
5245
  ),
5205
- /* @__PURE__ */ jsx26(
5246
+ /* @__PURE__ */ jsx27(
5206
5247
  "button",
5207
5248
  {
5208
5249
  type: "button",
@@ -5213,10 +5254,10 @@ var ImageEditor = ({
5213
5254
  )
5214
5255
  ] })
5215
5256
  ] }),
5216
- activeTab === "adjust" && /* @__PURE__ */ jsxs24("div", { className: "flex flex-col gap-3 text-xs", children: [
5217
- /* @__PURE__ */ jsxs24("div", { className: "flex items-center justify-between", children: [
5218
- /* @__PURE__ */ jsx26("span", { className: imageSectionTitleClass, children: "Color Adjustments" }),
5219
- /* @__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(
5220
5261
  "button",
5221
5262
  {
5222
5263
  type: "button",
@@ -5226,9 +5267,9 @@ var ImageEditor = ({
5226
5267
  }
5227
5268
  )
5228
5269
  ] }),
5229
- /* @__PURE__ */ jsx26(Histogram, { histogram: editor.histogram }),
5230
- IMAGE_ADJUSTMENT_CONTROLS.map((spec) => /* @__PURE__ */ jsxs24(React21.Fragment, { children: [
5231
- /* @__PURE__ */ jsx26(
5270
+ /* @__PURE__ */ jsx27(Histogram, { histogram: editor.histogram }),
5271
+ IMAGE_ADJUSTMENT_CONTROLS.map((spec) => /* @__PURE__ */ jsxs25(React22.Fragment, { children: [
5272
+ /* @__PURE__ */ jsx27(
5232
5273
  ControlSlider,
5233
5274
  {
5234
5275
  spec,
@@ -5237,14 +5278,14 @@ var ImageEditor = ({
5237
5278
  onChange: (v) => editor.setAdjustments({ [spec.id]: v })
5238
5279
  }
5239
5280
  ),
5240
- spec.id === "tint" && legacyProcess && /* @__PURE__ */ jsxs24(
5281
+ spec.id === "tint" && legacyProcess && /* @__PURE__ */ jsxs25(
5241
5282
  "div",
5242
5283
  {
5243
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",
5244
5285
  "data-testid": "image-editor-process-notice",
5245
5286
  children: [
5246
- /* @__PURE__ */ jsx26("span", { children: "Legacy rendering (process 1). Tint needs the current process." }),
5247
- /* @__PURE__ */ jsx26(
5287
+ /* @__PURE__ */ jsx27("span", { children: "Legacy rendering (process 1). Tint needs the current process." }),
5288
+ /* @__PURE__ */ jsx27(
5248
5289
  "button",
5249
5290
  {
5250
5291
  type: "button",
@@ -5257,7 +5298,7 @@ var ImageEditor = ({
5257
5298
  }
5258
5299
  )
5259
5300
  ] }, spec.id)),
5260
- /* @__PURE__ */ jsx26("div", { className: imageSectionClass, children: /* @__PURE__ */ jsx26(
5301
+ /* @__PURE__ */ jsx27("div", { className: imageSectionClass, children: /* @__PURE__ */ jsx27(
5261
5302
  AdjustmentLayersPanel,
5262
5303
  {
5263
5304
  controller,
@@ -5266,9 +5307,9 @@ var ImageEditor = ({
5266
5307
  }
5267
5308
  ) })
5268
5309
  ] }),
5269
- activeTab === "layers" && /* @__PURE__ */ jsxs24("div", { className: "flex flex-col gap-3 text-xs", children: [
5270
- /* @__PURE__ */ jsx26("span", { className: imageSectionTitleClass, children: "Layers" }),
5271
- /* @__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(
5272
5313
  "button",
5273
5314
  {
5274
5315
  type: "button",
@@ -5279,15 +5320,15 @@ var ImageEditor = ({
5279
5320
  children: "Free Transform"
5280
5321
  }
5281
5322
  ),
5282
- /* @__PURE__ */ jsx26(LayersPanel, { controller }),
5283
- effectsShown && /* @__PURE__ */ jsx26(ImageProviderEffectsPanel, { controller, className: imageSectionClass }),
5284
- /* @__PURE__ */ jsx26("span", { className: imageSectionTitleClass, children: "Colour" }),
5285
- /* @__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 })
5286
5327
  ] }),
5287
- activeTab === "paint" && /* @__PURE__ */ jsxs24("div", { className: "flex flex-col gap-3 text-xs", children: [
5288
- /* @__PURE__ */ jsx26("span", { className: imageSectionTitleClass, children: "Paint" }),
5289
- /* @__PURE__ */ jsx26(BrushOptionsBar, { controller }),
5290
- /* @__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(
5291
5332
  "button",
5292
5333
  {
5293
5334
  type: "button",
@@ -5298,12 +5339,12 @@ var ImageEditor = ({
5298
5339
  children: "Free Transform"
5299
5340
  }
5300
5341
  ),
5301
- paintError && /* @__PURE__ */ jsx26("p", { role: "alert", className: "text-destructive", "data-testid": "paint-error", children: paintError }),
5302
- /* @__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 }) })
5303
5344
  ] }),
5304
- activeTab === "annotate" && /* @__PURE__ */ jsxs24("div", { className: "flex flex-col gap-3 text-xs", children: [
5305
- /* @__PURE__ */ jsx26("span", { className: imageSectionTitleClass, children: "Shape & Type Layers, Paths" }),
5306
- /* @__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(
5307
5348
  "button",
5308
5349
  {
5309
5350
  type: "button",
@@ -5314,13 +5355,13 @@ var ImageEditor = ({
5314
5355
  },
5315
5356
  t
5316
5357
  )) }),
5317
- state.activeTool === "shape" && /* @__PURE__ */ jsx26(ShapeOptionsBar, { controller, options: shapeOptions, onChange: setShapeOptions }),
5318
- state.activeTool === "type" && /* @__PURE__ */ jsx26(TypeOptionsBar, { controller, options: typeOptions, onChange: setTypeOptions, session: typeSession }),
5319
- 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" }),
5320
- shapeTypeError && /* @__PURE__ */ jsx26("p", { role: "alert", className: "text-destructive", "data-testid": "shape-type-error", children: shapeTypeError }),
5321
- /* @__PURE__ */ jsx26("div", { className: imageDividerClass }),
5322
- /* @__PURE__ */ jsx26("span", { className: imageSectionTitleClass, children: "Draw & Annotate" }),
5323
- /* @__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(
5324
5365
  "button",
5325
5366
  {
5326
5367
  type: "button",
@@ -5330,18 +5371,18 @@ var ImageEditor = ({
5330
5371
  },
5331
5372
  t
5332
5373
  )) }),
5333
- /* @__PURE__ */ jsxs24("div", { className: "flex items-center gap-2 mt-2", children: [
5334
- /* @__PURE__ */ jsx26("label", { className: "text-muted-foreground", children: "Color:" }),
5335
- /* @__PURE__ */ jsx26(ImageColor, { label: "Annotation colour", value: activeColor, onChange: setActiveColor }),
5336
- /* @__PURE__ */ jsxs24("div", { className: "flex-1 ml-2", children: [
5337
- /* @__PURE__ */ jsxs24("div", { className: "flex justify-between text-muted-foreground mb-0.5", children: [
5338
- /* @__PURE__ */ jsx26("span", { children: "Width:" }),
5339
- /* @__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: [
5340
5381
  strokeWidth,
5341
5382
  "px"
5342
5383
  ] })
5343
5384
  ] }),
5344
- /* @__PURE__ */ jsx26(
5385
+ /* @__PURE__ */ jsx27(
5345
5386
  "input",
5346
5387
  {
5347
5388
  type: "range",
@@ -5354,10 +5395,10 @@ var ImageEditor = ({
5354
5395
  )
5355
5396
  ] })
5356
5397
  ] }),
5357
- /* @__PURE__ */ jsx26("div", { className: imageDividerClass }),
5358
- /* @__PURE__ */ jsx26("span", { className: imageSectionTitleClass, children: "Add Text" }),
5359
- /* @__PURE__ */ jsxs24("div", { className: "flex gap-2", children: [
5360
- /* @__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(
5361
5402
  "input",
5362
5403
  {
5363
5404
  type: "text",
@@ -5368,7 +5409,7 @@ var ImageEditor = ({
5368
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"
5369
5410
  }
5370
5411
  ),
5371
- /* @__PURE__ */ jsx26(
5412
+ /* @__PURE__ */ jsx27(
5372
5413
  "button",
5373
5414
  {
5374
5415
  type: "button",
@@ -5378,14 +5419,14 @@ var ImageEditor = ({
5378
5419
  }
5379
5420
  )
5380
5421
  ] }),
5381
- /* @__PURE__ */ jsxs24("div", { className: "flex items-center justify-between text-muted-foreground", children: [
5382
- /* @__PURE__ */ jsx26("span", { children: "Font Size:" }),
5383
- /* @__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: [
5384
5425
  fontSize,
5385
5426
  "px"
5386
5427
  ] })
5387
5428
  ] }),
5388
- /* @__PURE__ */ jsx26(
5429
+ /* @__PURE__ */ jsx27(
5389
5430
  "input",
5390
5431
  {
5391
5432
  type: "range",
@@ -5396,14 +5437,14 @@ var ImageEditor = ({
5396
5437
  className: imageRangeClass
5397
5438
  }
5398
5439
  ),
5399
- /* @__PURE__ */ jsx26("div", { className: imageDividerClass }),
5400
- /* @__PURE__ */ jsxs24("div", { className: "flex items-center justify-between", children: [
5401
- /* @__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: [
5402
5443
  "Layers (",
5403
5444
  state.annotations.length,
5404
5445
  ")"
5405
5446
  ] }),
5406
- state.selectedAnnotationId && /* @__PURE__ */ jsx26(
5447
+ state.selectedAnnotationId && /* @__PURE__ */ jsx27(
5407
5448
  "button",
5408
5449
  {
5409
5450
  type: "button",
@@ -5412,7 +5453,7 @@ var ImageEditor = ({
5412
5453
  children: "Delete Selected"
5413
5454
  }
5414
5455
  ),
5415
- state.annotations.length > 0 && /* @__PURE__ */ jsx26(
5456
+ state.annotations.length > 0 && /* @__PURE__ */ jsx27(
5416
5457
  "button",
5417
5458
  {
5418
5459
  type: "button",
@@ -5423,10 +5464,10 @@ var ImageEditor = ({
5423
5464
  )
5424
5465
  ] })
5425
5466
  ] }),
5426
- activeTab === "depth" && /* @__PURE__ */ jsxs24("div", { className: "flex flex-col gap-3 text-xs", children: [
5427
- /* @__PURE__ */ jsxs24("div", { className: "flex items-center justify-between", children: [
5428
- /* @__PURE__ */ jsx26("span", { className: imageSectionTitleClass, children: "Depth Masking" }),
5429
- /* @__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(
5430
5471
  "button",
5431
5472
  {
5432
5473
  type: "button",
@@ -5436,8 +5477,8 @@ var ImageEditor = ({
5436
5477
  }
5437
5478
  )
5438
5479
  ] }),
5439
- /* @__PURE__ */ jsxs24("label", { className: "flex items-center gap-2 cursor-pointer text-foreground", children: [
5440
- /* @__PURE__ */ jsx26(
5480
+ /* @__PURE__ */ jsxs25("label", { className: "flex items-center gap-2 cursor-pointer text-foreground", children: [
5481
+ /* @__PURE__ */ jsx27(
5441
5482
  "input",
5442
5483
  {
5443
5484
  type: "checkbox",
@@ -5446,12 +5487,12 @@ var ImageEditor = ({
5446
5487
  className: "rounded accent-primary"
5447
5488
  }
5448
5489
  ),
5449
- /* @__PURE__ */ jsx26("span", { children: "Enable Depth / Alpha Mask" })
5490
+ /* @__PURE__ */ jsx27("span", { children: "Enable Depth / Alpha Mask" })
5450
5491
  ] }),
5451
- state.depthMask.enabled && /* @__PURE__ */ jsxs24(Fragment7, { children: [
5452
- /* @__PURE__ */ jsxs24("div", { children: [
5453
- /* @__PURE__ */ jsx26("label", { className: "text-muted-foreground block mb-1", children: "Mask Image URL:" }),
5454
- /* @__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(
5455
5496
  "input",
5456
5497
  {
5457
5498
  type: "text",
@@ -5462,8 +5503,8 @@ var ImageEditor = ({
5462
5503
  }
5463
5504
  )
5464
5505
  ] }),
5465
- /* @__PURE__ */ jsxs24("div", { className: "flex gap-2", children: [
5466
- /* @__PURE__ */ jsx26(
5506
+ /* @__PURE__ */ jsxs25("div", { className: "flex gap-2", children: [
5507
+ /* @__PURE__ */ jsx27(
5467
5508
  "button",
5468
5509
  {
5469
5510
  type: "button",
@@ -5472,7 +5513,7 @@ var ImageEditor = ({
5472
5513
  children: "Threshold Mode"
5473
5514
  }
5474
5515
  ),
5475
- /* @__PURE__ */ jsx26(
5516
+ /* @__PURE__ */ jsx27(
5476
5517
  "button",
5477
5518
  {
5478
5519
  type: "button",
@@ -5482,12 +5523,12 @@ var ImageEditor = ({
5482
5523
  }
5483
5524
  )
5484
5525
  ] }),
5485
- /* @__PURE__ */ jsxs24("div", { children: [
5486
- /* @__PURE__ */ jsxs24("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
5487
- /* @__PURE__ */ jsx26("span", { children: "Depth Start (Lower):" }),
5488
- /* @__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] })
5489
5530
  ] }),
5490
- /* @__PURE__ */ jsx26(
5531
+ /* @__PURE__ */ jsx27(
5491
5532
  "input",
5492
5533
  {
5493
5534
  type: "range",
@@ -5501,12 +5542,12 @@ var ImageEditor = ({
5501
5542
  }
5502
5543
  )
5503
5544
  ] }),
5504
- /* @__PURE__ */ jsxs24("div", { children: [
5505
- /* @__PURE__ */ jsxs24("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
5506
- /* @__PURE__ */ jsx26("span", { children: "Depth Stop (Upper):" }),
5507
- /* @__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] })
5508
5549
  ] }),
5509
- /* @__PURE__ */ jsx26(
5550
+ /* @__PURE__ */ jsx27(
5510
5551
  "input",
5511
5552
  {
5512
5553
  type: "range",
@@ -5520,12 +5561,12 @@ var ImageEditor = ({
5520
5561
  }
5521
5562
  )
5522
5563
  ] }),
5523
- /* @__PURE__ */ jsxs24("div", { children: [
5524
- /* @__PURE__ */ jsxs24("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
5525
- /* @__PURE__ */ jsx26("span", { children: "Softness:" }),
5526
- /* @__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 })
5527
5568
  ] }),
5528
- /* @__PURE__ */ jsx26(
5569
+ /* @__PURE__ */ jsx27(
5529
5570
  "input",
5530
5571
  {
5531
5572
  type: "range",
@@ -5537,8 +5578,8 @@ var ImageEditor = ({
5537
5578
  }
5538
5579
  )
5539
5580
  ] }),
5540
- /* @__PURE__ */ jsxs24("label", { className: "flex items-center gap-2 cursor-pointer text-foreground mt-1", children: [
5541
- /* @__PURE__ */ jsx26(
5581
+ /* @__PURE__ */ jsxs25("label", { className: "flex items-center gap-2 cursor-pointer text-foreground mt-1", children: [
5582
+ /* @__PURE__ */ jsx27(
5542
5583
  "input",
5543
5584
  {
5544
5585
  type: "checkbox",
@@ -5547,12 +5588,12 @@ var ImageEditor = ({
5547
5588
  className: "rounded accent-primary"
5548
5589
  }
5549
5590
  ),
5550
- /* @__PURE__ */ jsx26("span", { children: "Invert Mask" })
5591
+ /* @__PURE__ */ jsx27("span", { children: "Invert Mask" })
5551
5592
  ] })
5552
5593
  ] })
5553
5594
  ] }),
5554
- activeTab === "select" && /* @__PURE__ */ jsxs24("div", { className: "flex flex-col gap-4 text-xs", children: [
5555
- /* @__PURE__ */ jsx26(
5595
+ activeTab === "select" && /* @__PURE__ */ jsxs25("div", { className: "flex flex-col gap-4 text-xs", children: [
5596
+ /* @__PURE__ */ jsx27(
5556
5597
  SelectionOptionsBar,
5557
5598
  {
5558
5599
  controller,
@@ -5563,9 +5604,9 @@ var ImageEditor = ({
5563
5604
  selectionDisplay: state.selectionDisplay
5564
5605
  }
5565
5606
  ),
5566
- selectionError && /* @__PURE__ */ jsx26("p", { role: "alert", className: "text-destructive", children: selectionError }),
5567
- /* @__PURE__ */ jsxs24("div", { className: "flex gap-1", children: [
5568
- /* @__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(
5569
5610
  "button",
5570
5611
  {
5571
5612
  type: "button",
@@ -5576,7 +5617,7 @@ var ImageEditor = ({
5576
5617
  children: "Transform Selection"
5577
5618
  }
5578
5619
  ),
5579
- /* @__PURE__ */ jsx26(
5620
+ /* @__PURE__ */ jsx27(
5580
5621
  "button",
5581
5622
  {
5582
5623
  type: "button",
@@ -5588,14 +5629,14 @@ var ImageEditor = ({
5588
5629
  }
5589
5630
  )
5590
5631
  ] }),
5591
- /* @__PURE__ */ jsx26(RefineEdgePanel, { controller, selection: state.selection ?? null, layers: state.adjustments.layers }),
5592
- /* @__PURE__ */ jsx26(ChannelsPanel, { controller }),
5593
- /* @__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 })
5594
5635
  ] }),
5595
- activeTab === "ai" && /* @__PURE__ */ jsxs24("div", { className: "flex flex-col gap-4 text-xs", children: [
5596
- /* @__PURE__ */ jsxs24("label", { className: "flex items-center justify-between gap-2 text-foreground", children: [
5597
- /* @__PURE__ */ jsx26("span", { children: "Results go to" }),
5598
- /* @__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(
5599
5640
  "select",
5600
5641
  {
5601
5642
  "aria-label": "AI result target",
@@ -5603,54 +5644,54 @@ var ImageEditor = ({
5603
5644
  onChange: (e) => setAiTarget(e.target.value),
5604
5645
  className: imageSelectClass,
5605
5646
  children: [
5606
- /* @__PURE__ */ jsx26("option", { value: "auto", children: controller.isMultiLayer ? "Auto (new layer)" : "Auto (replace image)" }),
5607
- /* @__PURE__ */ jsx26("option", { value: "new-layer", children: "New layer / mask" }),
5608
- /* @__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" })
5609
5650
  ]
5610
5651
  }
5611
5652
  )
5612
5653
  ] }),
5613
- /* @__PURE__ */ jsxs24("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
5614
- /* @__PURE__ */ jsxs24("div", { className: "flex items-center justify-between", children: [
5615
- /* @__PURE__ */ jsxs24("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
5616
- /* @__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" }) }),
5617
5658
  "Background Removal"
5618
5659
  ] }),
5619
- 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..." })
5620
5661
  ] }),
5621
- /* @__PURE__ */ jsx26("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Isolate foreground subject with AI alpha transparency segmentation." }),
5622
- /* @__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(
5623
5664
  "button",
5624
5665
  {
5625
5666
  type: "button",
5626
5667
  onClick: handleRemoveBackground,
5627
5668
  disabled: isRemovingBg || isInpainting,
5628
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",
5629
- children: isRemovingBg ? /* @__PURE__ */ jsxs24(Fragment7, { children: [
5630
- /* @__PURE__ */ jsx26("div", { className: imageSpinnerClass }),
5670
+ children: isRemovingBg ? /* @__PURE__ */ jsxs25(Fragment8, { children: [
5671
+ /* @__PURE__ */ jsx27("div", { className: imageSpinnerClass }),
5631
5672
  "Removing Background..."
5632
- ] }) : /* @__PURE__ */ jsxs24(Fragment7, { children: [
5633
- /* @__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" }) }),
5634
5675
  "Remove Background"
5635
5676
  ] })
5636
5677
  }
5637
5678
  )
5638
5679
  ] }),
5639
- /* @__PURE__ */ jsxs24("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
5640
- /* @__PURE__ */ jsxs24("div", { className: "flex items-center justify-between", children: [
5641
- /* @__PURE__ */ jsxs24("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
5642
- /* @__PURE__ */ jsxs24("svg", { className: "w-3.5 h-3.5 text-primary", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
5643
- /* @__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" }),
5644
- /* @__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" })
5645
5686
  ] }),
5646
5687
  "Generative Inpainting"
5647
5688
  ] }),
5648
- 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..." })
5649
5690
  ] }),
5650
- /* @__PURE__ */ jsx26("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Replace, modify, or fill selected regions using prompt-guided generative inpainting." }),
5651
- /* @__PURE__ */ jsxs24("div", { className: "flex flex-col gap-1", children: [
5652
- /* @__PURE__ */ jsx26("label", { htmlFor: "ai-inpaint-prompt-react", className: "text-foreground text-[11px] font-medium", children: "Prompt" }),
5653
- /* @__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(
5654
5695
  "textarea",
5655
5696
  {
5656
5697
  id: "ai-inpaint-prompt-react",
@@ -5662,10 +5703,10 @@ var ImageEditor = ({
5662
5703
  }
5663
5704
  )
5664
5705
  ] }),
5665
- /* @__PURE__ */ jsxs24("div", { className: "flex flex-col gap-1", children: [
5666
- /* @__PURE__ */ jsx26("span", { className: "text-foreground text-[11px] font-medium", children: "Target Mask Region" }),
5667
- /* @__PURE__ */ jsxs24("div", { className: "grid grid-cols-2 gap-1.5", children: [
5668
- /* @__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(
5669
5710
  "button",
5670
5711
  {
5671
5712
  type: "button",
@@ -5678,7 +5719,7 @@ var ImageEditor = ({
5678
5719
  ]
5679
5720
  }
5680
5721
  ),
5681
- /* @__PURE__ */ jsxs24(
5722
+ /* @__PURE__ */ jsxs25(
5682
5723
  "button",
5683
5724
  {
5684
5725
  type: "button",
@@ -5693,25 +5734,25 @@ var ImageEditor = ({
5693
5734
  )
5694
5735
  ] })
5695
5736
  ] }),
5696
- /* @__PURE__ */ jsx26(
5737
+ /* @__PURE__ */ jsx27(
5697
5738
  "button",
5698
5739
  {
5699
5740
  type: "button",
5700
5741
  onClick: handleInpaint,
5701
5742
  disabled: isInpainting || isRemovingBg || !inpaintPrompt.trim(),
5702
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",
5703
- children: isInpainting ? /* @__PURE__ */ jsxs24(Fragment7, { children: [
5704
- /* @__PURE__ */ jsx26("div", { className: imageSpinnerClass }),
5744
+ children: isInpainting ? /* @__PURE__ */ jsxs25(Fragment8, { children: [
5745
+ /* @__PURE__ */ jsx27("div", { className: imageSpinnerClass }),
5705
5746
  "Generating Inpaint..."
5706
- ] }) : /* @__PURE__ */ jsxs24(Fragment7, { children: [
5707
- /* @__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" }) }),
5708
5749
  "Apply Inpainting"
5709
5750
  ] })
5710
5751
  }
5711
5752
  )
5712
5753
  ] }),
5713
- aiError && /* @__PURE__ */ jsx26("div", { className: "p-2.5 rounded-lg bg-destructive/10 border border-destructive/40 text-destructive text-[11px]", children: aiError }),
5714
- 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 })
5715
5756
  ] })
5716
5757
  ] })
5717
5758
  ] })
@@ -5747,6 +5788,7 @@ export {
5747
5788
  ContentAwareFillWorkspace,
5748
5789
  SelectionOptionsBar,
5749
5790
  MaskEdgeCheck,
5791
+ SelectionChangeCheck,
5750
5792
  RefineEdgePanel,
5751
5793
  ChannelsPanel,
5752
5794
  PathsPanel,