@pixerate/editor-react 0.147.0 → 0.148.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 React22, { useRef as useRef12, useEffect as useEffect17, useState as useState23 } from "react";
193
+ import React23, { useRef as useRef13, useEffect as useEffect17, useState as useState24 } 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 useState17 } from "react";
3821
+ import { useState as useState18 } from "react";
3822
3822
  import {
3823
3823
  ADJUSTMENT_KINDS as ADJUSTMENT_KINDS2,
3824
3824
  REFINE_EDGE_CONTROLS as REFINE_EDGE_CONTROLS2,
@@ -3914,20 +3914,83 @@ var SelectionChangeCheck = ({ controller, selection, className = "" }) => {
3914
3914
  ] });
3915
3915
  };
3916
3916
 
3917
+ // src/image-editor/SeparateSubjectPanel.tsx
3918
+ import { useRef as useRef11, useState as useState17 } from "react";
3919
+ import { jsx as jsx21, jsxs as jsxs19 } from "react/jsx-runtime";
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 SeparateSubjectPanel = ({ controller, selection, className = "" }) => {
3922
+ const sel = selection === void 0 ? controller.getSelection() : selection;
3923
+ const [dilate, setDilate] = useState17(8);
3924
+ const [fill, setFill] = useState17(true);
3925
+ const [progress, setProgress] = useState17(null);
3926
+ const [error, setError] = useState17(null);
3927
+ const abort = useRef11(null);
3928
+ const run = async () => {
3929
+ setError(null);
3930
+ abort.current = new AbortController();
3931
+ setProgress("Starting");
3932
+ try {
3933
+ await controller.separateSubject({
3934
+ dilate,
3935
+ fill: fill ? "content-aware" : "none",
3936
+ signal: abort.current.signal,
3937
+ onProgress: (fraction, stage) => setProgress(`${stage ?? "Filling"} ${Math.round(fraction * 100)}%`)
3938
+ });
3939
+ } catch (err) {
3940
+ if (!abort.current.signal.aborted) setError(err instanceof Error ? err.message : String(err));
3941
+ } finally {
3942
+ abort.current = null;
3943
+ setProgress(null);
3944
+ }
3945
+ };
3946
+ return /* @__PURE__ */ jsxs19("div", { "data-testid": "separate-subject", className: `flex flex-col gap-1.5 text-xs ${className}`, children: [
3947
+ /* @__PURE__ */ jsx21("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px]", children: "Separate Subject" }),
3948
+ /* @__PURE__ */ jsx21("p", { className: "text-muted-foreground", children: "The selection onto its own masked layer, over the background with the subject filled out." }),
3949
+ /* @__PURE__ */ jsxs19("div", { className: "flex flex-wrap items-center gap-2", children: [
3950
+ /* @__PURE__ */ jsxs19("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
3951
+ "Grow",
3952
+ /* @__PURE__ */ jsx21(
3953
+ "input",
3954
+ {
3955
+ type: "number",
3956
+ min: 0,
3957
+ max: 200,
3958
+ "aria-label": "Separate grow",
3959
+ value: dilate,
3960
+ onChange: (e) => setDilate(Math.min(200, Math.max(0, Number(e.target.value) || 0))),
3961
+ className: "w-12 bg-background border border-border rounded px-1 py-0.5 text-foreground"
3962
+ }
3963
+ ),
3964
+ "px"
3965
+ ] }),
3966
+ /* @__PURE__ */ jsxs19("label", { className: "flex items-center gap-1 text-foreground", children: [
3967
+ /* @__PURE__ */ jsx21("input", { type: "checkbox", "aria-label": "Fill the background", checked: fill, onChange: (e) => setFill(e.target.checked) }),
3968
+ "Fill the background"
3969
+ ] })
3970
+ ] }),
3971
+ /* @__PURE__ */ jsxs19("div", { className: "flex gap-1", children: [
3972
+ /* @__PURE__ */ jsx21("button", { type: "button", className: button5, disabled: !sel || progress !== null, onClick: run, children: "Separate Subject" }),
3973
+ progress !== null && /* @__PURE__ */ jsx21("button", { type: "button", className: button5, onClick: () => abort.current?.abort(), children: "Cancel" })
3974
+ ] }),
3975
+ progress !== null && /* @__PURE__ */ jsx21("p", { role: "status", className: "text-muted-foreground", children: progress }),
3976
+ error && /* @__PURE__ */ jsx21("p", { role: "alert", className: "text-destructive", children: error })
3977
+ ] });
3978
+ };
3979
+
3917
3980
  // src/image-editor/RefineEdgePanel.tsx
3918
- import { Fragment as Fragment6, jsx as jsx21, jsxs as jsxs19 } from "react/jsx-runtime";
3981
+ import { Fragment as Fragment6, jsx as jsx22, jsxs as jsxs20 } from "react/jsx-runtime";
3919
3982
  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";
3983
+ var button6 = "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
3984
  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);
3985
+ const [params, setParams] = useState18(DEFAULT_PARAMS);
3986
+ const [busy, setBusy] = useState18(false);
3987
+ const [error, setError] = useState18(null);
3988
+ const [layerId, setLayerId] = useState18("");
3989
+ const [newKind, setNewKind] = useState18("hueSaturation");
3990
+ const [output, setOutput] = useState18("selection");
3991
+ const [decontaminate, setDecontaminate] = useState18(0);
3992
+ const [objectAware, setObjectAware] = useState18(false);
3993
+ const [onlyUncertain, setOnlyUncertain] = useState18(false);
3931
3994
  const canObject = Boolean(controller.segmentationProvider);
3932
3995
  const toLayer = output !== "selection" && output !== "layer-mask";
3933
3996
  const sel = selection === void 0 ? controller.getSelection() : selection;
@@ -3950,17 +4013,17 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
3950
4013
  setBusy(false);
3951
4014
  }
3952
4015
  };
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: [
4016
+ return /* @__PURE__ */ jsxs20("div", { "data-testid": "refine-edge-panel", className: `flex flex-col gap-3 text-xs ${className}`, children: [
4017
+ /* @__PURE__ */ jsx22("span", { className: imageSectionTitleClass, children: "Refine Edge" }),
4018
+ REFINE_EDGE_CONTROLS2.map((c) => /* @__PURE__ */ jsxs20("label", { className: "flex flex-col gap-1", children: [
4019
+ /* @__PURE__ */ jsxs20("span", { className: "flex justify-between text-muted-foreground", children: [
4020
+ /* @__PURE__ */ jsx22("span", { children: c.label }),
4021
+ /* @__PURE__ */ jsxs20("span", { className: "font-mono", children: [
3959
4022
  params[c.id],
3960
4023
  c.unit
3961
4024
  ] })
3962
4025
  ] }),
3963
- /* @__PURE__ */ jsx21(
4026
+ /* @__PURE__ */ jsx22(
3964
4027
  "input",
3965
4028
  {
3966
4029
  type: "range",
@@ -3974,43 +4037,43 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
3974
4037
  }
3975
4038
  )
3976
4039
  ] }, c.id)),
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 }) }),
4040
+ /* @__PURE__ */ jsxs20("label", { className: "flex items-center gap-2 text-foreground", children: [
4041
+ /* @__PURE__ */ jsx22("input", { type: "checkbox", checked: params.smartRadius, onChange: (e) => setParams({ ...params, smartRadius: e.target.checked }) }),
3979
4042
  "Smart Radius"
3980
4043
  ] }),
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) }),
4044
+ /* @__PURE__ */ jsxs20("label", { className: "flex items-center gap-2 text-foreground", title: "Refine only where the edge has no image edge under it", children: [
4045
+ /* @__PURE__ */ jsx22("input", { type: "checkbox", "aria-label": "Only uncertain areas", checked: onlyUncertain, onChange: (e) => setOnlyUncertain(e.target.checked) }),
3983
4046
  "Only uncertain areas"
3984
4047
  ] }),
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) }),
4048
+ canObject && /* @__PURE__ */ jsxs20("label", { className: "flex items-center gap-2 text-foreground", children: [
4049
+ /* @__PURE__ */ jsx22("input", { type: "checkbox", "aria-label": "Object aware", checked: objectAware, onChange: (e) => setObjectAware(e.target.checked) }),
3987
4050
  "Object aware (segmentation model)"
3988
4051
  ] }),
3989
- /* @__PURE__ */ jsxs19("label", { className: "flex items-center gap-2 text-muted-foreground", children: [
4052
+ /* @__PURE__ */ jsxs20("label", { className: "flex items-center gap-2 text-muted-foreground", children: [
3990
4053
  "Output to",
3991
- /* @__PURE__ */ jsx21(
4054
+ /* @__PURE__ */ jsx22(
3992
4055
  "select",
3993
4056
  {
3994
4057
  "aria-label": "Refine output",
3995
4058
  value: output,
3996
4059
  onChange: (e) => setOutput(e.target.value),
3997
4060
  className: "flex-1 bg-background border border-border rounded px-1 py-1 text-foreground",
3998
- children: REFINE_OUTPUTS2.filter((o) => !o.needsDocuments || controller.canOpenDocuments).map((o) => /* @__PURE__ */ jsx21("option", { value: o.id, children: o.label }, o.id))
4061
+ children: REFINE_OUTPUTS2.filter((o) => !o.needsDocuments || controller.canOpenDocuments).map((o) => /* @__PURE__ */ jsx22("option", { value: o.id, children: o.label }, o.id))
3999
4062
  }
4000
4063
  )
4001
4064
  ] }),
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: [
4065
+ /* @__PURE__ */ jsxs20("label", { className: "flex flex-col gap-1", children: [
4066
+ /* @__PURE__ */ jsxs20("span", { className: "flex justify-between text-muted-foreground", children: [
4067
+ /* @__PURE__ */ jsxs20("span", { children: [
4005
4068
  "Decontaminate colors",
4006
4069
  toLayer ? "" : " (new layer or document outputs)"
4007
4070
  ] }),
4008
- /* @__PURE__ */ jsxs19("span", { className: "font-mono", children: [
4071
+ /* @__PURE__ */ jsxs20("span", { className: "font-mono", children: [
4009
4072
  decontaminate,
4010
4073
  "%"
4011
4074
  ] })
4012
4075
  ] }),
4013
- /* @__PURE__ */ jsx21(
4076
+ /* @__PURE__ */ jsx22(
4014
4077
  "input",
4015
4078
  {
4016
4079
  type: "range",
@@ -4025,65 +4088,66 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
4025
4088
  }
4026
4089
  )
4027
4090
  ] }),
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" })
4091
+ /* @__PURE__ */ jsxs20("div", { className: "flex gap-1", children: [
4092
+ /* @__PURE__ */ jsx22("button", { type: "button", className: button6, disabled: !sel || busy, onClick: refine, children: "Refine Edge" }),
4093
+ /* @__PURE__ */ jsx22("button", { type: "button", className: button6, onClick: () => setParams(DEFAULT_PARAMS), children: "Reset" })
4031
4094
  ] }),
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(
4095
+ error && /* @__PURE__ */ jsx22("p", { role: "alert", className: "text-destructive", children: error }),
4096
+ /* @__PURE__ */ jsx22(MaskEdgeCheck, { controller, selection: sel }),
4097
+ /* @__PURE__ */ jsx22(SelectionChangeCheck, { controller, selection: sel }),
4098
+ /* @__PURE__ */ jsx22(SeparateSubjectPanel, { controller, selection: sel, className: "mt-2" }),
4099
+ /* @__PURE__ */ jsx22("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] mt-2", children: "Layer Mask" }),
4100
+ /* @__PURE__ */ jsxs20("div", { className: "flex gap-1 items-center", children: [
4101
+ /* @__PURE__ */ jsx22(
4038
4102
  "select",
4039
4103
  {
4040
4104
  "aria-label": "New masked layer kind",
4041
4105
  value: newKind,
4042
4106
  onChange: (e) => setNewKind(e.target.value),
4043
4107
  className: "flex-1 bg-background border border-border rounded px-1 py-1 text-foreground",
4044
- children: ADJUSTMENT_KINDS2.map((k) => /* @__PURE__ */ jsx21("option", { value: k.kind, children: k.label }, k.kind))
4108
+ children: ADJUSTMENT_KINDS2.map((k) => /* @__PURE__ */ jsx22("option", { value: k.kind, children: k.label }, k.kind))
4045
4109
  }
4046
4110
  ),
4047
- /* @__PURE__ */ jsx21(
4111
+ /* @__PURE__ */ jsx22(
4048
4112
  "button",
4049
4113
  {
4050
4114
  type: "button",
4051
- className: button5,
4115
+ className: button6,
4052
4116
  disabled: !sel,
4053
4117
  onClick: () => sel && setLayerId(controller.addAdjustmentLayer({ kind: newKind, mask: layerMaskFromSelection(sel) })),
4054
4118
  children: "New Masked Layer"
4055
4119
  }
4056
4120
  )
4057
4121
  ] }),
4058
- list.length > 0 && target && /* @__PURE__ */ jsxs19("div", { className: "flex flex-col gap-2", children: [
4059
- /* @__PURE__ */ jsx21(
4122
+ list.length > 0 && target && /* @__PURE__ */ jsxs20("div", { className: "flex flex-col gap-2", children: [
4123
+ /* @__PURE__ */ jsx22(
4060
4124
  "select",
4061
4125
  {
4062
4126
  "aria-label": "Mask layer",
4063
4127
  value: target.id,
4064
4128
  onChange: (e) => setLayerId(e.target.value),
4065
4129
  className: "bg-background border border-border rounded px-1 py-1 text-foreground",
4066
- children: list.map((l) => /* @__PURE__ */ jsxs19("option", { value: l.id, children: [
4130
+ children: list.map((l) => /* @__PURE__ */ jsxs20("option", { value: l.id, children: [
4067
4131
  l.name || adjustmentKindLabel2(l.kind),
4068
4132
  l.mask ? " (masked)" : ""
4069
4133
  ] }, l.id))
4070
4134
  }
4071
4135
  ),
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" })
4136
+ /* @__PURE__ */ jsxs20("div", { className: "flex flex-wrap gap-1", children: [
4137
+ /* @__PURE__ */ jsx22("button", { type: "button", className: button6, disabled: !sel, onClick: () => controller.applySelectionAsLayerMask(target.id), children: "Mask with Selection" }),
4138
+ /* @__PURE__ */ jsx22("button", { type: "button", className: button6, disabled: !target.mask, onClick: () => controller.selectionFromLayerMask(target.id), children: "Load as Selection" }),
4139
+ /* @__PURE__ */ jsx22("button", { type: "button", className: button6, disabled: !target.mask, onClick: () => controller.setAdjustmentLayerMask(target.id, null), children: "Remove Mask" })
4076
4140
  ] }),
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: [
4141
+ target.mask && /* @__PURE__ */ jsxs20(Fragment6, { children: [
4142
+ /* @__PURE__ */ jsxs20("label", { className: "flex flex-col gap-1", children: [
4143
+ /* @__PURE__ */ jsxs20("span", { className: "flex justify-between text-muted-foreground", children: [
4144
+ /* @__PURE__ */ jsx22("span", { children: "Density" }),
4145
+ /* @__PURE__ */ jsxs20("span", { className: "font-mono", children: [
4082
4146
  Math.round((target.mask.density ?? 1) * 100),
4083
4147
  "%"
4084
4148
  ] })
4085
4149
  ] }),
4086
- /* @__PURE__ */ jsx21(
4150
+ /* @__PURE__ */ jsx22(
4087
4151
  "input",
4088
4152
  {
4089
4153
  type: "range",
@@ -4097,15 +4161,15 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
4097
4161
  }
4098
4162
  )
4099
4163
  ] }),
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: [
4164
+ /* @__PURE__ */ jsxs20("label", { className: "flex flex-col gap-1", children: [
4165
+ /* @__PURE__ */ jsxs20("span", { className: "flex justify-between text-muted-foreground", children: [
4166
+ /* @__PURE__ */ jsx22("span", { children: "Mask Feather" }),
4167
+ /* @__PURE__ */ jsxs20("span", { className: "font-mono", children: [
4104
4168
  target.mask.feather ?? 0,
4105
4169
  "px"
4106
4170
  ] })
4107
4171
  ] }),
4108
- /* @__PURE__ */ jsx21(
4172
+ /* @__PURE__ */ jsx22(
4109
4173
  "input",
4110
4174
  {
4111
4175
  type: "range",
@@ -4125,12 +4189,12 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
4125
4189
  };
4126
4190
 
4127
4191
  // src/image-editor/ChannelsPanel.tsx
4128
- import { useEffect as useEffect12, useRef as useRef11, useState as useState18 } from "react";
4192
+ import { useEffect as useEffect12, useRef as useRef12, useState as useState19 } from "react";
4129
4193
  import { MASK_FILE_ACCEPT, channelThumbnail, downloadMaskImage, openMaskFile, selectionModeFromModifiers } from "@pixerate/editor/image-editor";
4130
- import { jsx as jsx22, jsxs as jsxs20 } from "react/jsx-runtime";
4194
+ import { jsx as jsx23, jsxs as jsxs21 } from "react/jsx-runtime";
4131
4195
  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"}`;
4132
4196
  var ChannelThumb = ({ channel, size }) => {
4133
- const ref = useRef11(null);
4197
+ const ref = useRef12(null);
4134
4198
  useEffect12(() => {
4135
4199
  const canvas = ref.current;
4136
4200
  const ctx = canvas?.getContext("2d");
@@ -4142,15 +4206,15 @@ var ChannelThumb = ({ channel, size }) => {
4142
4206
  img.data.set(px.data);
4143
4207
  ctx.putImageData(img, 0, 0);
4144
4208
  }, [channel.mask]);
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" });
4209
+ return /* @__PURE__ */ jsx23("canvas", { ref, "aria-hidden": "true", style: { width: size, height: size }, className: "shrink-0 rounded object-contain ring-1 ring-border bg-black" });
4146
4210
  };
4147
4211
  var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
4148
- const [, setTick] = useState18(0);
4212
+ const [, setTick] = useState19(0);
4149
4213
  useEffect12(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
4150
- const [activeId, setActiveId] = useState18(null);
4151
- const [renaming, setRenaming] = useState18(null);
4152
- const [error, setError] = useState18(null);
4153
- const fileInput = useRef11(null);
4214
+ const [activeId, setActiveId] = useState19(null);
4215
+ const [renaming, setRenaming] = useState19(null);
4216
+ const [error, setError] = useState19(null);
4217
+ const fileInput = useRef12(null);
4154
4218
  const channels = controller.getChannels();
4155
4219
  const active = channels.find((c) => c.id === activeId) ?? null;
4156
4220
  const hasSelection = Boolean(controller.getSelection());
@@ -4172,13 +4236,13 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
4172
4236
  setError(err instanceof Error ? err.message : String(err));
4173
4237
  }
4174
4238
  };
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" })
4239
+ return /* @__PURE__ */ jsxs21("div", { "data-testid": "channels-panel", className: `flex flex-col gap-2 text-xs ${className}`, children: [
4240
+ /* @__PURE__ */ jsxs21("div", { className: "flex items-center justify-between", children: [
4241
+ /* @__PURE__ */ jsx23("span", { className: imageSectionTitleClass, children: "Channels" }),
4242
+ /* @__PURE__ */ jsx23("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" })
4179
4243
  ] }),
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(
4244
+ channels.length === 0 && /* @__PURE__ */ jsx23("p", { className: "text-muted-foreground", children: "No channels. Save a selection to keep it." }),
4245
+ /* @__PURE__ */ jsx23("ul", { role: "list", className: "flex flex-col gap-0.5", children: channels.map((c) => /* @__PURE__ */ jsxs21(
4182
4246
  "li",
4183
4247
  {
4184
4248
  "data-testid": "channel-row",
@@ -4190,7 +4254,7 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
4190
4254
  },
4191
4255
  onDoubleClick: () => setRenaming(c.id),
4192
4256
  children: [
4193
- /* @__PURE__ */ jsx22(
4257
+ /* @__PURE__ */ jsx23(
4194
4258
  "button",
4195
4259
  {
4196
4260
  type: "button",
@@ -4204,8 +4268,8 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
4204
4268
  children: c.visible ? "\u25CF" : "\u25CB"
4205
4269
  }
4206
4270
  ),
4207
- /* @__PURE__ */ jsx22(ChannelThumb, { channel: c, size: thumbnailSize }),
4208
- renaming === c.id ? /* @__PURE__ */ jsx22(
4271
+ /* @__PURE__ */ jsx23(ChannelThumb, { channel: c, size: thumbnailSize }),
4272
+ renaming === c.id ? /* @__PURE__ */ jsx23(
4209
4273
  "input",
4210
4274
  {
4211
4275
  autoFocus: true,
@@ -4222,16 +4286,16 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
4222
4286
  if (e.key === "Escape") setRenaming(null);
4223
4287
  }
4224
4288
  }
4225
- ) : /* @__PURE__ */ jsx22("span", { className: "min-w-0 flex-1 truncate", children: c.name })
4289
+ ) : /* @__PURE__ */ jsx23("span", { className: "min-w-0 flex-1 truncate", children: c.name })
4226
4290
  ]
4227
4291
  },
4228
4292
  c.id
4229
4293
  )) }),
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(
4294
+ /* @__PURE__ */ jsxs21("div", { className: "flex flex-wrap gap-1", children: [
4295
+ /* @__PURE__ */ jsx23("button", { type: "button", className: btn2(), disabled: !hasSelection, onClick: () => attempt(() => setActiveId(controller.saveSelection().id)), children: "Save Selection" }),
4296
+ /* @__PURE__ */ jsx23("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" }),
4297
+ /* @__PURE__ */ jsx23("button", { type: "button", className: btn2(), disabled: !active, onClick: () => attempt(() => setActiveId(controller.duplicateChannel(active.id).id)), children: "Duplicate" }),
4298
+ /* @__PURE__ */ jsx23(
4235
4299
  "button",
4236
4300
  {
4237
4301
  type: "button",
@@ -4244,8 +4308,8 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
4244
4308
  children: "Delete"
4245
4309
  }
4246
4310
  ),
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(
4311
+ /* @__PURE__ */ jsx23("button", { type: "button", className: btn2(), title: "Load a mask image (white = selected) into a new channel", onClick: () => fileInput.current?.click(), children: "Import\u2026" }),
4312
+ /* @__PURE__ */ jsx23(
4249
4313
  "button",
4250
4314
  {
4251
4315
  type: "button",
@@ -4256,7 +4320,7 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
4256
4320
  children: "Export PNG"
4257
4321
  }
4258
4322
  ),
4259
- /* @__PURE__ */ jsx22(
4323
+ /* @__PURE__ */ jsx23(
4260
4324
  "input",
4261
4325
  {
4262
4326
  ref: fileInput,
@@ -4271,22 +4335,22 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
4271
4335
  }
4272
4336
  )
4273
4337
  ] }),
4274
- error && /* @__PURE__ */ jsx22("p", { role: "alert", className: "text-destructive", children: error })
4338
+ error && /* @__PURE__ */ jsx23("p", { role: "alert", className: "text-destructive", children: error })
4275
4339
  ] });
4276
4340
  };
4277
4341
 
4278
4342
  // src/image-editor/PathsPanel.tsx
4279
- import { useEffect as useEffect13, useState as useState19 } from "react";
4343
+ import { useEffect as useEffect13, useState as useState20 } from "react";
4280
4344
  import { pathSvgData, selectionModeFromModifiers as selectionModeFromModifiers2 } from "@pixerate/editor/image-editor";
4281
- import { jsx as jsx23, jsxs as jsxs21 } from "react/jsx-runtime";
4345
+ import { jsx as jsx24, jsxs as jsxs22 } from "react/jsx-runtime";
4282
4346
  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"}`;
4283
4347
  var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
4284
- const [, setTick] = useState19(0);
4348
+ const [, setTick] = useState20(0);
4285
4349
  useEffect13(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
4286
- const [renaming, setRenaming] = useState19(null);
4287
- const [color, setColor] = useState19("#000000");
4288
- const [width, setWidth] = useState19(2);
4289
- const [error, setError] = useState19(null);
4350
+ const [renaming, setRenaming] = useState20(null);
4351
+ const [color, setColor] = useState20("#000000");
4352
+ const [width, setWidth] = useState20(2);
4353
+ const [error, setError] = useState20(null);
4290
4354
  const paths = controller.getPaths();
4291
4355
  const activeId = controller.getState().activePathId ?? null;
4292
4356
  const active = paths.find((p) => p.id === activeId) ?? null;
@@ -4302,10 +4366,10 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
4302
4366
  };
4303
4367
  return (
4304
4368
  // Clicking the panel's empty space deselects the path (the path tools then edit the active layer).
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(
4369
+ /* @__PURE__ */ jsxs22("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: [
4370
+ /* @__PURE__ */ jsx24("span", { className: imageSectionTitleClass, children: "Paths" }),
4371
+ paths.length === 0 && /* @__PURE__ */ jsx24("p", { className: "text-muted-foreground", children: "No paths. Make a work path from a selection." }),
4372
+ /* @__PURE__ */ jsx24("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__ */ jsxs22(
4309
4373
  "li",
4310
4374
  {
4311
4375
  "data-testid": "path-row",
@@ -4314,8 +4378,8 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
4314
4378
  onClick: () => attempt(() => controller.setActivePath(p.id)),
4315
4379
  onDoubleClick: () => setRenaming(p.id),
4316
4380
  children: [
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(
4381
+ /* @__PURE__ */ jsx24("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__ */ jsx24("path", { d: pathSvgData(p), fill: "currentColor", fillOpacity: 0.25, stroke: "currentColor", strokeWidth: Math.max(w, h) / 64, fillRule: p.fillRule ?? "nonzero" }) }),
4382
+ renaming === p.id ? /* @__PURE__ */ jsx24(
4319
4383
  "input",
4320
4384
  {
4321
4385
  autoFocus: true,
@@ -4334,13 +4398,13 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
4334
4398
  if (e.key === "Escape") setRenaming(null);
4335
4399
  }
4336
4400
  }
4337
- ) : /* @__PURE__ */ jsx23("span", { className: `min-w-0 flex-1 truncate ${p.work ? "italic" : ""}`, children: p.name })
4401
+ ) : /* @__PURE__ */ jsx24("span", { className: `min-w-0 flex-1 truncate ${p.work ? "italic" : ""}`, children: p.name })
4338
4402
  ]
4339
4403
  },
4340
4404
  p.id
4341
4405
  )) }),
4342
- /* @__PURE__ */ jsxs21("div", { className: "flex flex-wrap gap-1", children: [
4343
- /* @__PURE__ */ jsx23(
4406
+ /* @__PURE__ */ jsxs22("div", { className: "flex flex-wrap gap-1", children: [
4407
+ /* @__PURE__ */ jsx24(
4344
4408
  "button",
4345
4409
  {
4346
4410
  type: "button",
@@ -4351,15 +4415,15 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
4351
4415
  children: "Load as Selection"
4352
4416
  }
4353
4417
  ),
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" })
4418
+ /* @__PURE__ */ jsx24("button", { type: "button", className: btn3(), disabled: !hasSelection, onClick: () => attempt(() => controller.makeWorkPath()), children: "Make Work Path" }),
4419
+ active?.work && /* @__PURE__ */ jsx24("button", { type: "button", className: btn3(), onClick: () => setRenaming(active.id), children: "Save Path" }),
4420
+ /* @__PURE__ */ jsx24("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.addVectorMaskFromPath(active.id)), children: "Add Vector Mask" })
4357
4421
  ] }),
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(
4422
+ /* @__PURE__ */ jsxs22("div", { className: "flex flex-wrap items-center gap-1", children: [
4423
+ /* @__PURE__ */ jsx24("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" }),
4424
+ /* @__PURE__ */ jsx24("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.fillPath(active.id, { color })), children: "Fill Path" }),
4425
+ /* @__PURE__ */ jsxs22("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
4426
+ /* @__PURE__ */ jsx24(
4363
4427
  "input",
4364
4428
  {
4365
4429
  type: "number",
@@ -4374,24 +4438,24 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
4374
4438
  ),
4375
4439
  "px"
4376
4440
  ] }),
4377
- /* @__PURE__ */ jsx23("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.strokePath(active.id, { width, color })), children: "Stroke Path" })
4441
+ /* @__PURE__ */ jsx24("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.strokePath(active.id, { width, color })), children: "Stroke Path" })
4378
4442
  ] }),
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" })
4443
+ /* @__PURE__ */ jsxs22("div", { className: "flex flex-wrap gap-1", children: [
4444
+ /* @__PURE__ */ jsx24("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.duplicatePath(active.id)), children: "Duplicate" }),
4445
+ /* @__PURE__ */ jsx24("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.deletePath(active.id)), children: "Delete" })
4382
4446
  ] }),
4383
- error && /* @__PURE__ */ jsx23("p", { role: "alert", className: "text-destructive", children: error })
4447
+ error && /* @__PURE__ */ jsx24("p", { role: "alert", className: "text-destructive", children: error })
4384
4448
  ] })
4385
4449
  );
4386
4450
  };
4387
4451
 
4388
4452
  // src/image-editor/FreeTransformOptionsBar.tsx
4389
- import { useEffect as useEffect14, useState as useState20 } from "react";
4453
+ import { useEffect as useEffect14, useState as useState21 } from "react";
4390
4454
  import { FREE_TRANSFORM_FIELDS, FREE_TRANSFORM_MODE_OPTIONS, INTERPOLATIONS, TRANSFORM_ANCHORS, WARP_GRID_OPTIONS, WARP_STYLE_OPTIONS } from "@pixerate/editor/image-editor";
4391
- import { jsx as jsx24, jsxs as jsxs22 } from "react/jsx-runtime";
4455
+ import { jsx as jsx25, jsxs as jsxs23 } from "react/jsx-runtime";
4392
4456
  var round = (v, unit) => unit === "px" ? Math.round(v * 10) / 10 : Math.round(v * 100) / 100;
4393
4457
  var FreeTransformOptionsBar = ({ tool, className }) => {
4394
- const [, setTick] = useState20(0);
4458
+ const [, setTick] = useState21(0);
4395
4459
  useEffect14(() => tool.subscribe(() => setTick((n) => n + 1)), [tool]);
4396
4460
  const bar = tool.bar();
4397
4461
  if (!tool.active || !bar) return null;
@@ -4404,17 +4468,17 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
4404
4468
  const v = Number(raw);
4405
4469
  if (raw.trim() !== "" && Number.isFinite(v) && Math.abs(v - bar[field]) > 1e-9) tool.setField(field, v);
4406
4470
  };
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)) })
4471
+ return /* @__PURE__ */ jsxs23("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: [
4472
+ /* @__PURE__ */ jsx25("div", { className: "flex gap-1", role: "group", "aria-label": "Transform mode", children: FREE_TRANSFORM_MODE_OPTIONS.map((m) => /* @__PURE__ */ jsx25("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)) }),
4473
+ /* @__PURE__ */ jsx25("div", { className: "grid grid-cols-3 gap-px", role: "group", "aria-label": "Reference point", children: TRANSFORM_ANCHORS.map((a) => /* @__PURE__ */ jsx25("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)) }),
4474
+ tool.mode === "warp" && /* @__PURE__ */ jsxs23("div", { className: "flex flex-wrap items-center gap-2", role: "group", "aria-label": "Warp options", children: [
4475
+ /* @__PURE__ */ jsxs23("label", { className: "flex items-center gap-1", children: [
4476
+ /* @__PURE__ */ jsx25("span", { className: "text-muted-foreground", children: "Warp" }),
4477
+ /* @__PURE__ */ jsx25("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__ */ jsx25("option", { value: o.id, children: o.label }, o.id)) })
4414
4478
  ] }),
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(
4479
+ ["bend", "horizontal", "vertical"].map((k) => /* @__PURE__ */ jsxs23("label", { className: "flex items-center gap-1", children: [
4480
+ /* @__PURE__ */ jsx25("span", { className: "text-muted-foreground", children: k === "bend" ? "Bend" : k === "horizontal" ? "H" : "V" }),
4481
+ /* @__PURE__ */ jsx25(
4418
4482
  "input",
4419
4483
  {
4420
4484
  type: "number",
@@ -4435,9 +4499,9 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
4435
4499
  },
4436
4500
  `${k}:${warp[k]}`
4437
4501
  ),
4438
- /* @__PURE__ */ jsx24("span", { className: "text-muted-foreground", children: "%" })
4502
+ /* @__PURE__ */ jsx25("span", { className: "text-muted-foreground", children: "%" })
4439
4503
  ] }, k)),
4440
- /* @__PURE__ */ jsx24(
4504
+ /* @__PURE__ */ jsx25(
4441
4505
  "button",
4442
4506
  {
4443
4507
  type: "button",
@@ -4449,9 +4513,9 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
4449
4513
  children: "Vertical"
4450
4514
  }
4451
4515
  ),
4452
- /* @__PURE__ */ jsxs22("label", { className: "flex items-center gap-1", children: [
4453
- /* @__PURE__ */ jsx24("span", { className: "text-muted-foreground", children: "Grid" }),
4454
- /* @__PURE__ */ jsx24(
4516
+ /* @__PURE__ */ jsxs23("label", { className: "flex items-center gap-1", children: [
4517
+ /* @__PURE__ */ jsx25("span", { className: "text-muted-foreground", children: "Grid" }),
4518
+ /* @__PURE__ */ jsx25(
4455
4519
  "select",
4456
4520
  {
4457
4521
  "aria-label": "Warp grid",
@@ -4461,14 +4525,14 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
4461
4525
  tool.setWarp({ columns: g.columns, rows: g.rows });
4462
4526
  },
4463
4527
  className: imageFieldClass,
4464
- children: WARP_GRID_OPTIONS.map((g) => /* @__PURE__ */ jsx24("option", { value: g.id, children: g.label }, g.id))
4528
+ children: WARP_GRID_OPTIONS.map((g) => /* @__PURE__ */ jsx25("option", { value: g.id, children: g.label }, g.id))
4465
4529
  }
4466
4530
  )
4467
4531
  ] })
4468
4532
  ] }),
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(
4533
+ tool.mode !== "warp" && FREE_TRANSFORM_FIELDS.map((f) => /* @__PURE__ */ jsxs23("label", { className: "flex items-center gap-1", title: f.title, children: [
4534
+ /* @__PURE__ */ jsx25("span", { className: "text-muted-foreground", children: f.label }),
4535
+ /* @__PURE__ */ jsx25(
4472
4536
  "input",
4473
4537
  {
4474
4538
  type: "number",
@@ -4488,8 +4552,8 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
4488
4552
  },
4489
4553
  `${f.id}:${round(bar[f.id], f.unit)}`
4490
4554
  ),
4491
- /* @__PURE__ */ jsx24("span", { className: "text-muted-foreground", children: f.unit }),
4492
- f.id === "scaleX" && /* @__PURE__ */ jsx24(
4555
+ /* @__PURE__ */ jsx25("span", { className: "text-muted-foreground", children: f.unit }),
4556
+ f.id === "scaleX" && /* @__PURE__ */ jsx25(
4493
4557
  "button",
4494
4558
  {
4495
4559
  type: "button",
@@ -4504,33 +4568,33 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
4504
4568
  }
4505
4569
  )
4506
4570
  ] }, f.id)),
4507
- /* @__PURE__ */ jsxs22("label", { className: "flex items-center gap-1", children: [
4508
- /* @__PURE__ */ jsx24("span", { className: "text-muted-foreground", children: "Interpolation" }),
4509
- /* @__PURE__ */ jsx24(
4571
+ /* @__PURE__ */ jsxs23("label", { className: "flex items-center gap-1", children: [
4572
+ /* @__PURE__ */ jsx25("span", { className: "text-muted-foreground", children: "Interpolation" }),
4573
+ /* @__PURE__ */ jsx25(
4510
4574
  "select",
4511
4575
  {
4512
4576
  "aria-label": "Interpolation",
4513
4577
  value: tool.interpolation,
4514
4578
  onChange: (e) => tool.setInterpolation(e.target.value),
4515
4579
  className: imageFieldClass,
4516
- children: INTERPOLATIONS.map((i) => /* @__PURE__ */ jsx24("option", { value: i, children: i[0].toUpperCase() + i.slice(1) }, i))
4580
+ children: INTERPOLATIONS.map((i) => /* @__PURE__ */ jsx25("option", { value: i, children: i[0].toUpperCase() + i.slice(1) }, i))
4517
4581
  }
4518
4582
  )
4519
4583
  ] }),
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 })
4584
+ /* @__PURE__ */ jsx25("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" }),
4585
+ /* @__PURE__ */ jsx25("button", { type: "button", title: "Cancel (Esc)", className: imageChipClass(false), onClick: () => tool.cancel(), children: "Cancel" }),
4586
+ tool.error && /* @__PURE__ */ jsx25("span", { role: "alert", className: "text-destructive", children: tool.error })
4523
4587
  ] });
4524
4588
  };
4525
4589
 
4526
4590
  // src/image-editor/ShapeOptionsBar.tsx
4527
- import { useEffect as useEffect15, useState as useState21 } from "react";
4591
+ import { useEffect as useEffect15, useState as useState22 } from "react";
4528
4592
  import { LIVE_SHAPE_KINDS, SHAPE_KIND_LABELS, applyShapeOptions } from "@pixerate/editor/image-editor";
4529
- import { Fragment as Fragment7, jsx as jsx25, jsxs as jsxs23 } from "react/jsx-runtime";
4593
+ import { Fragment as Fragment7, jsx as jsx26, jsxs as jsxs24 } from "react/jsx-runtime";
4530
4594
  var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
4531
- const [, setTick] = useState21(0);
4595
+ const [, setTick] = useState22(0);
4532
4596
  useEffect15(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
4533
- const [error, setError] = useState21(null);
4597
+ const [error, setError] = useState22(null);
4534
4598
  const active = controller.getActiveLayer();
4535
4599
  const shapeId = active?.type === "shape" ? active.id : null;
4536
4600
  const set = (change) => {
@@ -4544,22 +4608,22 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
4544
4608
  }
4545
4609
  };
4546
4610
  const num = (v, min, max) => Math.max(min, Math.min(max, Number(v) || min));
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 }) }),
4611
+ return /* @__PURE__ */ jsxs24("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "shape-options", children: [
4612
+ /* @__PURE__ */ jsx26("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Shape kind", children: LIVE_SHAPE_KINDS.map((k) => /* @__PURE__ */ jsx26("button", { type: "button", "aria-pressed": options.kind === k, className: imageChipClass(options.kind === k), onClick: () => onChange({ ...options, kind: k }), children: SHAPE_KIND_LABELS[k] }, k)) }),
4613
+ /* @__PURE__ */ jsxs24("div", { className: "flex flex-wrap items-center gap-3", children: [
4614
+ /* @__PURE__ */ jsxs24("label", { className: "flex items-center gap-1", children: [
4615
+ /* @__PURE__ */ jsx26(ImageCheckbox, { label: "Fill", checked: options.fill !== null, onChange: (on) => set({ fill: on ? "#4f46e5" : null }) }),
4552
4616
  "Fill",
4553
- /* @__PURE__ */ jsx25(ImageColor, { label: "Fill colour", disabled: options.fill === null, value: options.fill ?? "#4f46e5", onChange: (fill) => set({ fill }) })
4617
+ /* @__PURE__ */ jsx26(ImageColor, { label: "Fill colour", disabled: options.fill === null, value: options.fill ?? "#4f46e5", onChange: (fill) => set({ fill }) })
4554
4618
  ] }),
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 }) }),
4619
+ /* @__PURE__ */ jsxs24("label", { className: "flex items-center gap-1", children: [
4620
+ /* @__PURE__ */ jsx26(ImageCheckbox, { label: "Stroke", checked: options.stroke !== null, onChange: (on) => set({ stroke: on ? "#000000" : null }) }),
4557
4621
  "Stroke",
4558
- /* @__PURE__ */ jsx25(ImageColor, { label: "Stroke colour", disabled: options.stroke === null, value: options.stroke ?? "#000000", onChange: (stroke) => set({ stroke }) })
4622
+ /* @__PURE__ */ jsx26(ImageColor, { label: "Stroke colour", disabled: options.stroke === null, value: options.stroke ?? "#000000", onChange: (stroke) => set({ stroke }) })
4559
4623
  ] }),
4560
- /* @__PURE__ */ jsxs23("label", { className: "flex items-center gap-1", children: [
4624
+ /* @__PURE__ */ jsxs24("label", { className: "flex items-center gap-1", children: [
4561
4625
  "Width",
4562
- /* @__PURE__ */ jsx25(
4626
+ /* @__PURE__ */ jsx26(
4563
4627
  "input",
4564
4628
  {
4565
4629
  type: "number",
@@ -4573,52 +4637,52 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
4573
4637
  )
4574
4638
  ] })
4575
4639
  ] }),
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: [
4640
+ /* @__PURE__ */ jsxs24("div", { className: "flex flex-wrap items-center gap-3", children: [
4641
+ options.kind === "rect" && /* @__PURE__ */ jsxs24("label", { className: "flex items-center gap-1", children: [
4578
4642
  "Radius",
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}` })
4643
+ /* @__PURE__ */ jsx26("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}` })
4580
4644
  ] }),
4581
- options.kind === "polygon" && /* @__PURE__ */ jsxs23("label", { className: "flex items-center gap-1", children: [
4645
+ options.kind === "polygon" && /* @__PURE__ */ jsxs24("label", { className: "flex items-center gap-1", children: [
4582
4646
  "Sides",
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}` })
4647
+ /* @__PURE__ */ jsx26("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}` })
4584
4648
  ] }),
4585
- options.kind === "star" && /* @__PURE__ */ jsxs23(Fragment7, { children: [
4586
- /* @__PURE__ */ jsxs23("label", { className: "flex items-center gap-1", children: [
4649
+ options.kind === "star" && /* @__PURE__ */ jsxs24(Fragment7, { children: [
4650
+ /* @__PURE__ */ jsxs24("label", { className: "flex items-center gap-1", children: [
4587
4651
  "Points",
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}` })
4652
+ /* @__PURE__ */ jsx26("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}` })
4589
4653
  ] }),
4590
- /* @__PURE__ */ jsxs23("label", { className: "flex items-center gap-1", children: [
4654
+ /* @__PURE__ */ jsxs24("label", { className: "flex items-center gap-1", children: [
4591
4655
  "Inner",
4592
- /* @__PURE__ */ jsx25(ImageRange, { label: "Inner radius", min: 0.05, max: 1, step: 0.05, value: options.innerRatio, onChange: (v) => set({ innerRatio: v }) })
4656
+ /* @__PURE__ */ jsx26(ImageRange, { label: "Inner radius", min: 0.05, max: 1, step: 0.05, value: options.innerRatio, onChange: (v) => set({ innerRatio: v }) })
4593
4657
  ] })
4594
4658
  ] }),
4595
- options.kind === "line" && /* @__PURE__ */ jsxs23(Fragment7, { children: [
4596
- /* @__PURE__ */ jsxs23("label", { className: "flex items-center gap-1", children: [
4659
+ options.kind === "line" && /* @__PURE__ */ jsxs24(Fragment7, { children: [
4660
+ /* @__PURE__ */ jsxs24("label", { className: "flex items-center gap-1", children: [
4597
4661
  "Weight",
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}` })
4662
+ /* @__PURE__ */ jsx26("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}` })
4599
4663
  ] }),
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 }) }),
4664
+ /* @__PURE__ */ jsxs24("label", { className: "flex items-center gap-1", children: [
4665
+ /* @__PURE__ */ jsx26(ImageCheckbox, { label: "Arrowhead", checked: options.arrow, onChange: (on) => set({ arrow: on }) }),
4602
4666
  "Arrowhead"
4603
4667
  ] })
4604
4668
  ] })
4605
4669
  ] }),
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 })
4670
+ /* @__PURE__ */ jsx26("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." }),
4671
+ error && /* @__PURE__ */ jsx26("p", { role: "alert", className: "text-destructive", children: error })
4608
4672
  ] });
4609
4673
  };
4610
4674
 
4611
4675
  // src/image-editor/TypeOptionsBar.tsx
4612
- import { useEffect as useEffect16, useState as useState22 } from "react";
4676
+ import { useEffect as useEffect16, useState as useState23 } from "react";
4613
4677
  import { TEXT_ALIGNS, TEXT_ORIENTATIONS } from "@pixerate/editor/image-editor";
4614
- import { jsx as jsx26, jsxs as jsxs24 } from "react/jsx-runtime";
4678
+ import { jsx as jsx27, jsxs as jsxs25 } from "react/jsx-runtime";
4615
4679
  var ALIGN_LABELS = { left: "Left", center: "Centre", right: "Right", justify: "Justify" };
4616
4680
  var ORIENTATION_LABELS = { horizontal: "Horizontal", vertical: "Vertical" };
4617
4681
  var TypeOptionsBar = ({ controller, options, onChange, session, className }) => {
4618
- const [, setTick] = useState22(0);
4682
+ const [, setTick] = useState23(0);
4619
4683
  useEffect16(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
4620
4684
  useEffect16(() => session?.subscribe(() => setTick((n) => n + 1)), [session]);
4621
- const [error, setError] = useState22(null);
4685
+ const [error, setError] = useState23(null);
4622
4686
  const active = controller.getActiveLayer();
4623
4687
  const typeId = !session && active?.type === "type" ? active.id : null;
4624
4688
  const here = session?.alive ? session.styleHere() : {};
@@ -4671,11 +4735,11 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
4671
4735
  setError(e instanceof Error ? e.message : String(e));
4672
4736
  }
4673
4737
  };
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: [
4738
+ return /* @__PURE__ */ jsxs25("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "type-options", children: [
4739
+ /* @__PURE__ */ jsxs25("div", { className: "flex flex-wrap items-center gap-2", children: [
4740
+ /* @__PURE__ */ jsxs25("label", { className: "flex items-center gap-1", children: [
4677
4741
  "Font",
4678
- /* @__PURE__ */ jsx26(
4742
+ /* @__PURE__ */ jsx27(
4679
4743
  "input",
4680
4744
  {
4681
4745
  list: "pixerate-type-fonts",
@@ -4685,11 +4749,11 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
4685
4749
  className: "w-32 rounded border border-border bg-background px-1 py-0.5"
4686
4750
  }
4687
4751
  ),
4688
- /* @__PURE__ */ jsx26("datalist", { id: "pixerate-type-fonts", children: fonts.map((f) => /* @__PURE__ */ jsx26("option", { value: f }, f)) })
4752
+ /* @__PURE__ */ jsx27("datalist", { id: "pixerate-type-fonts", children: fonts.map((f) => /* @__PURE__ */ jsx27("option", { value: f }, f)) })
4689
4753
  ] }),
4690
- /* @__PURE__ */ jsxs24("label", { className: "flex items-center gap-1", children: [
4754
+ /* @__PURE__ */ jsxs25("label", { className: "flex items-center gap-1", children: [
4691
4755
  "Size",
4692
- /* @__PURE__ */ jsx26(
4756
+ /* @__PURE__ */ jsx27(
4693
4757
  "input",
4694
4758
  {
4695
4759
  type: "number",
@@ -4702,14 +4766,14 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
4702
4766
  }
4703
4767
  )
4704
4768
  ] }),
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 }) })
4769
+ /* @__PURE__ */ jsx27("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" }),
4770
+ /* @__PURE__ */ jsx27("button", { type: "button", "aria-pressed": shown.italic, className: `${imageChipClass(shown.italic)} italic`, onClick: () => style({ italic: !shown.italic }), children: "I" }),
4771
+ /* @__PURE__ */ jsx27(ImageColor, { label: "Text colour", value: shown.color, onChange: (color) => style({ color }) })
4708
4772
  ] }),
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(
4773
+ /* @__PURE__ */ jsx27("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Alignment", children: TEXT_ALIGNS.map((a) => /* @__PURE__ */ jsx27("button", { type: "button", "aria-pressed": options.align === a, className: imageChipClass(options.align === a), onClick: () => style({ align: a }), children: ALIGN_LABELS[a] }, a)) }),
4774
+ /* @__PURE__ */ jsxs25("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Orientation", children: [
4775
+ TEXT_ORIENTATIONS.map((o) => /* @__PURE__ */ jsx27("button", { type: "button", "aria-pressed": orientation === o, className: imageChipClass(orientation === o), onClick: () => orient(o), children: ORIENTATION_LABELS[o] }, o)),
4776
+ orientation === "vertical" && editedId && /* @__PURE__ */ jsx27(
4713
4777
  "button",
4714
4778
  {
4715
4779
  type: "button",
@@ -4721,19 +4785,19 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
4721
4785
  }
4722
4786
  )
4723
4787
  ] }),
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: [
4788
+ /* @__PURE__ */ jsx27("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." }),
4789
+ missing.length > 0 && /* @__PURE__ */ jsxs25("p", { role: "status", className: "text-amber-600", "data-testid": "type-missing-fonts", children: [
4726
4790
  "Missing ",
4727
4791
  missing.length === 1 ? "font" : "fonts",
4728
4792
  ": ",
4729
4793
  missing.join(", ")
4730
4794
  ] }),
4731
- error && /* @__PURE__ */ jsx26("p", { role: "alert", className: "text-destructive", children: error })
4795
+ error && /* @__PURE__ */ jsx27("p", { role: "alert", className: "text-destructive", children: error })
4732
4796
  ] });
4733
4797
  };
4734
4798
 
4735
4799
  // src/image-editor/ImageEditor.tsx
4736
- import { Fragment as Fragment8, jsx as jsx27, jsxs as jsxs25 } from "react/jsx-runtime";
4800
+ import { Fragment as Fragment8, jsx as jsx28, jsxs as jsxs26 } from "react/jsx-runtime";
4737
4801
  var ImageEditor = ({
4738
4802
  editor: externalEditor,
4739
4803
  src,
@@ -4758,32 +4822,32 @@ var ImageEditor = ({
4758
4822
  return l.type === "pixel" && !!l.generator || l.type === "smart" && !!l.smartFilters?.filters.some((f) => f.kind === "effect") || l.type === "group" && l.children.some(has);
4759
4823
  });
4760
4824
  const legacyProcess = normalizeProcessVersion(state.adjustments.process) < LATEST_PROCESS_VERSION;
4761
- const [activeTab, setActiveTab] = useState23("crop");
4762
- const rootRef = useRef12(null);
4825
+ const [activeTab, setActiveTab] = useState24("crop");
4826
+ const rootRef = useRef13(null);
4763
4827
  const canvasMode = activeTab === "crop" || activeTab === "select" || activeTab === "paint" || activeTab === "annotate" ? activeTab : "none";
4764
- const activeTabRef = useRef12(activeTab);
4828
+ const activeTabRef = useRef13(activeTab);
4765
4829
  activeTabRef.current = activeTab;
4766
4830
  const openPanel = async (ref) => {
4767
4831
  if (ref.kind !== "panel" || activeTabRef.current === ref.id) return;
4768
4832
  rootRef.current?.querySelector(`[data-image-tab="${CSS.escape(ref.id)}"]`)?.click();
4769
4833
  await new Promise((resolve) => setTimeout(resolve, 60));
4770
4834
  };
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);
4835
+ const [activeCropRatio, setActiveCropRatio] = useState24(null);
4836
+ const [selectionOptions, setSelectionOptions] = useState24(DEFAULT_SELECTION_TOOL_OPTIONS2);
4837
+ const [shapeOptions, setShapeOptions] = useState24(DEFAULT_SHAPE_TOOL_OPTIONS2);
4838
+ const [typeOptions, setTypeOptions] = useState24(DEFAULT_TYPE_TOOL_OPTIONS2);
4839
+ const [typeSession, setTypeSession] = useState24(null);
4840
+ const [selectionError, setSelectionError] = useState24(null);
4841
+ const [paintError, setPaintError] = useState24(null);
4842
+ const [shapeTypeError, setShapeTypeError] = useState24(null);
4779
4843
  const handleCanvasError = (source, message) => {
4780
4844
  if (source === "paint") setPaintError(message);
4781
4845
  else if (source === "select") setSelectionError(message);
4782
4846
  else setShapeTypeError(message);
4783
4847
  };
4784
4848
  const finishTyping = () => setTypeSession(null);
4785
- const transformToolRef = useRef12(null);
4786
- const transformControllerRef = useRef12(controller);
4849
+ const transformToolRef = useRef13(null);
4850
+ const transformControllerRef = useRef13(controller);
4787
4851
  if (!transformToolRef.current || transformControllerRef.current !== controller) {
4788
4852
  transformToolRef.current?.cancel();
4789
4853
  transformToolRef.current = new FreeTransformTool2(controller, {
@@ -4792,16 +4856,16 @@ var ImageEditor = ({
4792
4856
  transformControllerRef.current = controller;
4793
4857
  }
4794
4858
  const transformTool = transformToolRef.current;
4795
- const [, setTransformTick] = useState23(0);
4859
+ const [, setTransformTick] = useState24(0);
4796
4860
  useEffect17(() => transformTool.subscribe(() => setTransformTick((n) => n + 1)), [transformTool]);
4797
4861
  useEffect17(() => () => transformToolRef.current?.cancel(), []);
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");
4862
+ const [inpaintPrompt, setInpaintPrompt] = useState24("");
4863
+ const [inpaintMaskMode, setInpaintMaskMode] = useState24("annotations");
4864
+ const [isRemovingBg, setIsRemovingBg] = useState24(false);
4865
+ const [isInpainting, setIsInpainting] = useState24(false);
4866
+ const [aiError, setAiError] = useState24(null);
4867
+ const [aiSuccess, setAiSuccess] = useState24(null);
4868
+ const [aiTarget, setAiTarget] = useState24("auto");
4805
4869
  const aiOptions = aiTarget === "auto" ? {} : { target: aiTarget };
4806
4870
  const effectiveOnInpaint = onInpaint || aiHooks?.onInpaint;
4807
4871
  const effectiveOnRemoveBg = onRemoveBackground || aiHooks?.onRemoveBackground;
@@ -4864,10 +4928,10 @@ var ImageEditor = ({
4864
4928
  setIsInpainting(false);
4865
4929
  }
4866
4930
  };
4867
- const [activeColor, setActiveColor] = useState23("#ef4444");
4868
- const [strokeWidth, setStrokeWidth] = useState23(3);
4869
- const [fontSize, setFontSize] = useState23(24);
4870
- const [textInput, setTextInput] = useState23("");
4931
+ const [activeColor, setActiveColor] = useState24("#ef4444");
4932
+ const [strokeWidth, setStrokeWidth] = useState24(3);
4933
+ const [fontSize, setFontSize] = useState24(24);
4934
+ const [textInput, setTextInput] = useState24("");
4871
4935
  useEffect17(() => {
4872
4936
  if (activeTab === "crop" && editor.state.activeTool !== "crop") {
4873
4937
  editor.setTool("crop");
@@ -4896,16 +4960,16 @@ var ImageEditor = ({
4896
4960
  link.click();
4897
4961
  }
4898
4962
  };
4899
- return /* @__PURE__ */ jsxs25(
4963
+ return /* @__PURE__ */ jsxs26(
4900
4964
  "div",
4901
4965
  {
4902
4966
  ref: rootRef,
4903
4967
  className: `${imageEditorFrameClass} ${className}`,
4904
4968
  style,
4905
4969
  children: [
4906
- /* @__PURE__ */ jsxs25("div", { className: imageEditorHeaderClass, children: [
4907
- /* @__PURE__ */ jsxs25("div", { role: "tablist", className: imageTabListClass, children: [
4908
- /* @__PURE__ */ jsx27(
4970
+ /* @__PURE__ */ jsxs26("div", { className: imageEditorHeaderClass, children: [
4971
+ /* @__PURE__ */ jsxs26("div", { role: "tablist", className: imageTabListClass, children: [
4972
+ /* @__PURE__ */ jsx28(
4909
4973
  "button",
4910
4974
  {
4911
4975
  type: "button",
@@ -4920,7 +4984,7 @@ var ImageEditor = ({
4920
4984
  children: "Transform & Crop"
4921
4985
  }
4922
4986
  ),
4923
- /* @__PURE__ */ jsx27(
4987
+ /* @__PURE__ */ jsx28(
4924
4988
  "button",
4925
4989
  {
4926
4990
  type: "button",
@@ -4935,7 +4999,7 @@ var ImageEditor = ({
4935
4999
  children: "Adjustments"
4936
5000
  }
4937
5001
  ),
4938
- /* @__PURE__ */ jsx27(
5002
+ /* @__PURE__ */ jsx28(
4939
5003
  "button",
4940
5004
  {
4941
5005
  type: "button",
@@ -4950,7 +5014,7 @@ var ImageEditor = ({
4950
5014
  children: "Layers"
4951
5015
  }
4952
5016
  ),
4953
- /* @__PURE__ */ jsx27(
5017
+ /* @__PURE__ */ jsx28(
4954
5018
  "button",
4955
5019
  {
4956
5020
  type: "button",
@@ -4965,7 +5029,7 @@ var ImageEditor = ({
4965
5029
  children: "Paint"
4966
5030
  }
4967
5031
  ),
4968
- /* @__PURE__ */ jsx27(
5032
+ /* @__PURE__ */ jsx28(
4969
5033
  "button",
4970
5034
  {
4971
5035
  type: "button",
@@ -4980,7 +5044,7 @@ var ImageEditor = ({
4980
5044
  children: "Select & Mask"
4981
5045
  }
4982
5046
  ),
4983
- /* @__PURE__ */ jsx27(
5047
+ /* @__PURE__ */ jsx28(
4984
5048
  "button",
4985
5049
  {
4986
5050
  type: "button",
@@ -4995,7 +5059,7 @@ var ImageEditor = ({
4995
5059
  children: "Annotations"
4996
5060
  }
4997
5061
  ),
4998
- /* @__PURE__ */ jsx27(
5062
+ /* @__PURE__ */ jsx28(
4999
5063
  "button",
5000
5064
  {
5001
5065
  type: "button",
@@ -5010,7 +5074,7 @@ var ImageEditor = ({
5010
5074
  children: "Depth Mask"
5011
5075
  }
5012
5076
  ),
5013
- /* @__PURE__ */ jsxs25(
5077
+ /* @__PURE__ */ jsxs26(
5014
5078
  "button",
5015
5079
  {
5016
5080
  type: "button",
@@ -5023,14 +5087,14 @@ var ImageEditor = ({
5023
5087
  "aria-selected": activeTab === "ai",
5024
5088
  className: `${imageTabClass(activeTab === "ai")} flex items-center gap-1.5`,
5025
5089
  children: [
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" }) }),
5090
+ /* @__PURE__ */ jsx28("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx28("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" }) }),
5027
5091
  "AI Tools"
5028
5092
  ]
5029
5093
  }
5030
5094
  )
5031
5095
  ] }),
5032
- /* @__PURE__ */ jsxs25("div", { className: "flex items-center gap-2 text-xs", children: [
5033
- /* @__PURE__ */ jsx27(
5096
+ /* @__PURE__ */ jsxs26("div", { className: "flex items-center gap-2 text-xs", children: [
5097
+ /* @__PURE__ */ jsx28(
5034
5098
  "button",
5035
5099
  {
5036
5100
  type: "button",
@@ -5041,7 +5105,7 @@ var ImageEditor = ({
5041
5105
  children: "\u21A9"
5042
5106
  }
5043
5107
  ),
5044
- /* @__PURE__ */ jsx27(
5108
+ /* @__PURE__ */ jsx28(
5045
5109
  "button",
5046
5110
  {
5047
5111
  type: "button",
@@ -5052,7 +5116,7 @@ var ImageEditor = ({
5052
5116
  children: "\u21AA"
5053
5117
  }
5054
5118
  ),
5055
- /* @__PURE__ */ jsx27(
5119
+ /* @__PURE__ */ jsx28(
5056
5120
  "button",
5057
5121
  {
5058
5122
  type: "button",
@@ -5061,8 +5125,8 @@ var ImageEditor = ({
5061
5125
  children: "Reset"
5062
5126
  }
5063
5127
  ),
5064
- /* @__PURE__ */ jsx27("div", { className: "h-4 w-px bg-muted mx-1" }),
5065
- /* @__PURE__ */ jsx27(
5128
+ /* @__PURE__ */ jsx28("div", { className: "h-4 w-px bg-muted mx-1" }),
5129
+ /* @__PURE__ */ jsx28(
5066
5130
  "button",
5067
5131
  {
5068
5132
  type: "button",
@@ -5072,11 +5136,11 @@ var ImageEditor = ({
5072
5136
  children: "-"
5073
5137
  }
5074
5138
  ),
5075
- /* @__PURE__ */ jsxs25("span", { className: "font-mono text-muted-foreground w-10 text-center", children: [
5139
+ /* @__PURE__ */ jsxs26("span", { className: "font-mono text-muted-foreground w-10 text-center", children: [
5076
5140
  Math.round(state.zoom * 100),
5077
5141
  "%"
5078
5142
  ] }),
5079
- /* @__PURE__ */ jsx27(
5143
+ /* @__PURE__ */ jsx28(
5080
5144
  "button",
5081
5145
  {
5082
5146
  type: "button",
@@ -5086,8 +5150,8 @@ var ImageEditor = ({
5086
5150
  children: "+"
5087
5151
  }
5088
5152
  ),
5089
- /* @__PURE__ */ jsx27("div", { className: "h-4 w-px bg-muted mx-1" }),
5090
- /* @__PURE__ */ jsx27(
5153
+ /* @__PURE__ */ jsx28("div", { className: "h-4 w-px bg-muted mx-1" }),
5154
+ /* @__PURE__ */ jsx28(
5091
5155
  "button",
5092
5156
  {
5093
5157
  type: "button",
@@ -5098,7 +5162,7 @@ var ImageEditor = ({
5098
5162
  children: "Hold Compare"
5099
5163
  }
5100
5164
  ),
5101
- /* @__PURE__ */ jsx27(
5165
+ /* @__PURE__ */ jsx28(
5102
5166
  "button",
5103
5167
  {
5104
5168
  type: "button",
@@ -5109,10 +5173,10 @@ var ImageEditor = ({
5109
5173
  )
5110
5174
  ] })
5111
5175
  ] }),
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(
5176
+ transformTool.active && /* @__PURE__ */ jsx28(FreeTransformOptionsBar, { tool: transformTool, className: "border-b border-border bg-background/95 px-4 py-2" }),
5177
+ !transformTool.active && transformTool.error && /* @__PURE__ */ jsx28("div", { role: "alert", className: imageErrorBannerClass, children: transformTool.error }),
5178
+ /* @__PURE__ */ jsxs26("div", { className: "flex flex-col md:flex-row flex-1 min-h-[520px] md:h-[560px]", children: [
5179
+ /* @__PURE__ */ jsx28(
5116
5180
  ImageEditorCanvas,
5117
5181
  {
5118
5182
  editor,
@@ -5136,11 +5200,11 @@ var ImageEditor = ({
5136
5200
  className: "flex-1 h-[360px] md:h-full min-h-[320px] bg-muted"
5137
5201
  }
5138
5202
  ),
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(
5203
+ /* @__PURE__ */ jsxs26("div", { className: imageSidebarClass, children: [
5204
+ activeTab === "crop" && /* @__PURE__ */ jsxs26("div", { className: "flex flex-col gap-4 text-xs", children: [
5205
+ /* @__PURE__ */ jsx28("span", { className: imageSectionTitleClass, children: "Aspect Ratio Presets" }),
5206
+ /* @__PURE__ */ jsxs26("div", { className: "grid grid-cols-3 gap-2", children: [
5207
+ /* @__PURE__ */ jsx28(
5144
5208
  "button",
5145
5209
  {
5146
5210
  type: "button",
@@ -5152,7 +5216,7 @@ var ImageEditor = ({
5152
5216
  children: "Freeform"
5153
5217
  }
5154
5218
  ),
5155
- /* @__PURE__ */ jsx27(
5219
+ /* @__PURE__ */ jsx28(
5156
5220
  "button",
5157
5221
  {
5158
5222
  type: "button",
@@ -5164,7 +5228,7 @@ var ImageEditor = ({
5164
5228
  children: "1:1 Square"
5165
5229
  }
5166
5230
  ),
5167
- /* @__PURE__ */ jsx27(
5231
+ /* @__PURE__ */ jsx28(
5168
5232
  "button",
5169
5233
  {
5170
5234
  type: "button",
@@ -5176,7 +5240,7 @@ var ImageEditor = ({
5176
5240
  children: "4:3 Standard"
5177
5241
  }
5178
5242
  ),
5179
- /* @__PURE__ */ jsx27(
5243
+ /* @__PURE__ */ jsx28(
5180
5244
  "button",
5181
5245
  {
5182
5246
  type: "button",
@@ -5188,7 +5252,7 @@ var ImageEditor = ({
5188
5252
  children: "16:9 Wide"
5189
5253
  }
5190
5254
  ),
5191
- /* @__PURE__ */ jsx27(
5255
+ /* @__PURE__ */ jsx28(
5192
5256
  "button",
5193
5257
  {
5194
5258
  type: "button",
@@ -5200,7 +5264,7 @@ var ImageEditor = ({
5200
5264
  children: "3:2 Photo"
5201
5265
  }
5202
5266
  ),
5203
- /* @__PURE__ */ jsx27(
5267
+ /* @__PURE__ */ jsx28(
5204
5268
  "button",
5205
5269
  {
5206
5270
  type: "button",
@@ -5213,10 +5277,10 @@ var ImageEditor = ({
5213
5277
  }
5214
5278
  )
5215
5279
  ] }),
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(
5280
+ /* @__PURE__ */ jsx28("div", { className: imageDividerClass }),
5281
+ /* @__PURE__ */ jsx28("span", { className: imageSectionTitleClass, children: "Orientation & Flips" }),
5282
+ /* @__PURE__ */ jsxs26("div", { className: "grid grid-cols-2 gap-2", children: [
5283
+ /* @__PURE__ */ jsx28(
5220
5284
  "button",
5221
5285
  {
5222
5286
  type: "button",
@@ -5225,7 +5289,7 @@ var ImageEditor = ({
5225
5289
  children: "Rotate -90\xB0"
5226
5290
  }
5227
5291
  ),
5228
- /* @__PURE__ */ jsx27(
5292
+ /* @__PURE__ */ jsx28(
5229
5293
  "button",
5230
5294
  {
5231
5295
  type: "button",
@@ -5234,7 +5298,7 @@ var ImageEditor = ({
5234
5298
  children: "Rotate +90\xB0"
5235
5299
  }
5236
5300
  ),
5237
- /* @__PURE__ */ jsx27(
5301
+ /* @__PURE__ */ jsx28(
5238
5302
  "button",
5239
5303
  {
5240
5304
  type: "button",
@@ -5243,7 +5307,7 @@ var ImageEditor = ({
5243
5307
  children: "Flip Horizontal"
5244
5308
  }
5245
5309
  ),
5246
- /* @__PURE__ */ jsx27(
5310
+ /* @__PURE__ */ jsx28(
5247
5311
  "button",
5248
5312
  {
5249
5313
  type: "button",
@@ -5254,10 +5318,10 @@ var ImageEditor = ({
5254
5318
  )
5255
5319
  ] })
5256
5320
  ] }),
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(
5321
+ activeTab === "adjust" && /* @__PURE__ */ jsxs26("div", { className: "flex flex-col gap-3 text-xs", children: [
5322
+ /* @__PURE__ */ jsxs26("div", { className: "flex items-center justify-between", children: [
5323
+ /* @__PURE__ */ jsx28("span", { className: imageSectionTitleClass, children: "Color Adjustments" }),
5324
+ /* @__PURE__ */ jsx28(
5261
5325
  "button",
5262
5326
  {
5263
5327
  type: "button",
@@ -5267,9 +5331,9 @@ var ImageEditor = ({
5267
5331
  }
5268
5332
  )
5269
5333
  ] }),
5270
- /* @__PURE__ */ jsx27(Histogram, { histogram: editor.histogram }),
5271
- IMAGE_ADJUSTMENT_CONTROLS.map((spec) => /* @__PURE__ */ jsxs25(React22.Fragment, { children: [
5272
- /* @__PURE__ */ jsx27(
5334
+ /* @__PURE__ */ jsx28(Histogram, { histogram: editor.histogram }),
5335
+ IMAGE_ADJUSTMENT_CONTROLS.map((spec) => /* @__PURE__ */ jsxs26(React23.Fragment, { children: [
5336
+ /* @__PURE__ */ jsx28(
5273
5337
  ControlSlider,
5274
5338
  {
5275
5339
  spec,
@@ -5278,14 +5342,14 @@ var ImageEditor = ({
5278
5342
  onChange: (v) => editor.setAdjustments({ [spec.id]: v })
5279
5343
  }
5280
5344
  ),
5281
- spec.id === "tint" && legacyProcess && /* @__PURE__ */ jsxs25(
5345
+ spec.id === "tint" && legacyProcess && /* @__PURE__ */ jsxs26(
5282
5346
  "div",
5283
5347
  {
5284
5348
  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",
5285
5349
  "data-testid": "image-editor-process-notice",
5286
5350
  children: [
5287
- /* @__PURE__ */ jsx27("span", { children: "Legacy rendering (process 1). Tint needs the current process." }),
5288
- /* @__PURE__ */ jsx27(
5351
+ /* @__PURE__ */ jsx28("span", { children: "Legacy rendering (process 1). Tint needs the current process." }),
5352
+ /* @__PURE__ */ jsx28(
5289
5353
  "button",
5290
5354
  {
5291
5355
  type: "button",
@@ -5298,7 +5362,7 @@ var ImageEditor = ({
5298
5362
  }
5299
5363
  )
5300
5364
  ] }, spec.id)),
5301
- /* @__PURE__ */ jsx27("div", { className: imageSectionClass, children: /* @__PURE__ */ jsx27(
5365
+ /* @__PURE__ */ jsx28("div", { className: imageSectionClass, children: /* @__PURE__ */ jsx28(
5302
5366
  AdjustmentLayersPanel,
5303
5367
  {
5304
5368
  controller,
@@ -5307,9 +5371,9 @@ var ImageEditor = ({
5307
5371
  }
5308
5372
  ) })
5309
5373
  ] }),
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(
5374
+ activeTab === "layers" && /* @__PURE__ */ jsxs26("div", { className: "flex flex-col gap-3 text-xs", children: [
5375
+ /* @__PURE__ */ jsx28("span", { className: imageSectionTitleClass, children: "Layers" }),
5376
+ /* @__PURE__ */ jsx28(
5313
5377
  "button",
5314
5378
  {
5315
5379
  type: "button",
@@ -5320,15 +5384,15 @@ var ImageEditor = ({
5320
5384
  children: "Free Transform"
5321
5385
  }
5322
5386
  ),
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 })
5387
+ /* @__PURE__ */ jsx28(LayersPanel, { controller }),
5388
+ effectsShown && /* @__PURE__ */ jsx28(ImageProviderEffectsPanel, { controller, className: imageSectionClass }),
5389
+ /* @__PURE__ */ jsx28("span", { className: imageSectionTitleClass, children: "Colour" }),
5390
+ /* @__PURE__ */ jsx28(ColorProfilePanel, { controller })
5327
5391
  ] }),
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(
5392
+ activeTab === "paint" && /* @__PURE__ */ jsxs26("div", { className: "flex flex-col gap-3 text-xs", children: [
5393
+ /* @__PURE__ */ jsx28("span", { className: imageSectionTitleClass, children: "Paint" }),
5394
+ /* @__PURE__ */ jsx28(BrushOptionsBar, { controller }),
5395
+ /* @__PURE__ */ jsx28(
5332
5396
  "button",
5333
5397
  {
5334
5398
  type: "button",
@@ -5339,12 +5403,12 @@ var ImageEditor = ({
5339
5403
  children: "Free Transform"
5340
5404
  }
5341
5405
  ),
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 }) })
5406
+ paintError && /* @__PURE__ */ jsx28("p", { role: "alert", className: "text-destructive", "data-testid": "paint-error", children: paintError }),
5407
+ /* @__PURE__ */ jsx28("div", { className: imageSectionClass, children: /* @__PURE__ */ jsx28(LayersPanel, { controller }) })
5344
5408
  ] }),
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(
5409
+ activeTab === "annotate" && /* @__PURE__ */ jsxs26("div", { className: "flex flex-col gap-3 text-xs", children: [
5410
+ /* @__PURE__ */ jsx28("span", { className: imageSectionTitleClass, children: "Shape & Type Layers, Paths" }),
5411
+ /* @__PURE__ */ jsx28("div", { className: "grid grid-cols-2 gap-1.5", children: ["shape", "type", "path-pen", "path-select", "direct-select"].map((t) => /* @__PURE__ */ jsx28(
5348
5412
  "button",
5349
5413
  {
5350
5414
  type: "button",
@@ -5355,13 +5419,13 @@ var ImageEditor = ({
5355
5419
  },
5356
5420
  t
5357
5421
  )) }),
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(
5422
+ state.activeTool === "shape" && /* @__PURE__ */ jsx28(ShapeOptionsBar, { controller, options: shapeOptions, onChange: setShapeOptions }),
5423
+ state.activeTool === "type" && /* @__PURE__ */ jsx28(TypeOptionsBar, { controller, options: typeOptions, onChange: setTypeOptions, session: typeSession }),
5424
+ state.activeTool === "type" && typeSession && /* @__PURE__ */ jsx28("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" }),
5425
+ shapeTypeError && /* @__PURE__ */ jsx28("p", { role: "alert", className: "text-destructive", "data-testid": "shape-type-error", children: shapeTypeError }),
5426
+ /* @__PURE__ */ jsx28("div", { className: imageDividerClass }),
5427
+ /* @__PURE__ */ jsx28("span", { className: imageSectionTitleClass, children: "Draw & Annotate" }),
5428
+ /* @__PURE__ */ jsx28("div", { className: "grid grid-cols-3 gap-1.5", children: ["pen", "rect", "circle", "arrow", "line"].map((t) => /* @__PURE__ */ jsx28(
5365
5429
  "button",
5366
5430
  {
5367
5431
  type: "button",
@@ -5371,18 +5435,18 @@ var ImageEditor = ({
5371
5435
  },
5372
5436
  t
5373
5437
  )) }),
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: [
5438
+ /* @__PURE__ */ jsxs26("div", { className: "flex items-center gap-2 mt-2", children: [
5439
+ /* @__PURE__ */ jsx28("label", { className: "text-muted-foreground", children: "Color:" }),
5440
+ /* @__PURE__ */ jsx28(ImageColor, { label: "Annotation colour", value: activeColor, onChange: setActiveColor }),
5441
+ /* @__PURE__ */ jsxs26("div", { className: "flex-1 ml-2", children: [
5442
+ /* @__PURE__ */ jsxs26("div", { className: "flex justify-between text-muted-foreground mb-0.5", children: [
5443
+ /* @__PURE__ */ jsx28("span", { children: "Width:" }),
5444
+ /* @__PURE__ */ jsxs26("span", { className: "font-mono", children: [
5381
5445
  strokeWidth,
5382
5446
  "px"
5383
5447
  ] })
5384
5448
  ] }),
5385
- /* @__PURE__ */ jsx27(
5449
+ /* @__PURE__ */ jsx28(
5386
5450
  "input",
5387
5451
  {
5388
5452
  type: "range",
@@ -5395,10 +5459,10 @@ var ImageEditor = ({
5395
5459
  )
5396
5460
  ] })
5397
5461
  ] }),
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(
5462
+ /* @__PURE__ */ jsx28("div", { className: imageDividerClass }),
5463
+ /* @__PURE__ */ jsx28("span", { className: imageSectionTitleClass, children: "Add Text" }),
5464
+ /* @__PURE__ */ jsxs26("div", { className: "flex gap-2", children: [
5465
+ /* @__PURE__ */ jsx28(
5402
5466
  "input",
5403
5467
  {
5404
5468
  type: "text",
@@ -5409,7 +5473,7 @@ var ImageEditor = ({
5409
5473
  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"
5410
5474
  }
5411
5475
  ),
5412
- /* @__PURE__ */ jsx27(
5476
+ /* @__PURE__ */ jsx28(
5413
5477
  "button",
5414
5478
  {
5415
5479
  type: "button",
@@ -5419,14 +5483,14 @@ var ImageEditor = ({
5419
5483
  }
5420
5484
  )
5421
5485
  ] }),
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: [
5486
+ /* @__PURE__ */ jsxs26("div", { className: "flex items-center justify-between text-muted-foreground", children: [
5487
+ /* @__PURE__ */ jsx28("span", { children: "Font Size:" }),
5488
+ /* @__PURE__ */ jsxs26("span", { className: "font-mono", children: [
5425
5489
  fontSize,
5426
5490
  "px"
5427
5491
  ] })
5428
5492
  ] }),
5429
- /* @__PURE__ */ jsx27(
5493
+ /* @__PURE__ */ jsx28(
5430
5494
  "input",
5431
5495
  {
5432
5496
  type: "range",
@@ -5437,14 +5501,14 @@ var ImageEditor = ({
5437
5501
  className: imageRangeClass
5438
5502
  }
5439
5503
  ),
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: [
5504
+ /* @__PURE__ */ jsx28("div", { className: imageDividerClass }),
5505
+ /* @__PURE__ */ jsxs26("div", { className: "flex items-center justify-between", children: [
5506
+ /* @__PURE__ */ jsxs26("span", { className: "text-muted-foreground", children: [
5443
5507
  "Layers (",
5444
5508
  state.annotations.length,
5445
5509
  ")"
5446
5510
  ] }),
5447
- state.selectedAnnotationId && /* @__PURE__ */ jsx27(
5511
+ state.selectedAnnotationId && /* @__PURE__ */ jsx28(
5448
5512
  "button",
5449
5513
  {
5450
5514
  type: "button",
@@ -5453,7 +5517,7 @@ var ImageEditor = ({
5453
5517
  children: "Delete Selected"
5454
5518
  }
5455
5519
  ),
5456
- state.annotations.length > 0 && /* @__PURE__ */ jsx27(
5520
+ state.annotations.length > 0 && /* @__PURE__ */ jsx28(
5457
5521
  "button",
5458
5522
  {
5459
5523
  type: "button",
@@ -5464,10 +5528,10 @@ var ImageEditor = ({
5464
5528
  )
5465
5529
  ] })
5466
5530
  ] }),
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(
5531
+ activeTab === "depth" && /* @__PURE__ */ jsxs26("div", { className: "flex flex-col gap-3 text-xs", children: [
5532
+ /* @__PURE__ */ jsxs26("div", { className: "flex items-center justify-between", children: [
5533
+ /* @__PURE__ */ jsx28("span", { className: imageSectionTitleClass, children: "Depth Masking" }),
5534
+ /* @__PURE__ */ jsx28(
5471
5535
  "button",
5472
5536
  {
5473
5537
  type: "button",
@@ -5477,8 +5541,8 @@ var ImageEditor = ({
5477
5541
  }
5478
5542
  )
5479
5543
  ] }),
5480
- /* @__PURE__ */ jsxs25("label", { className: "flex items-center gap-2 cursor-pointer text-foreground", children: [
5481
- /* @__PURE__ */ jsx27(
5544
+ /* @__PURE__ */ jsxs26("label", { className: "flex items-center gap-2 cursor-pointer text-foreground", children: [
5545
+ /* @__PURE__ */ jsx28(
5482
5546
  "input",
5483
5547
  {
5484
5548
  type: "checkbox",
@@ -5487,12 +5551,12 @@ var ImageEditor = ({
5487
5551
  className: "rounded accent-primary"
5488
5552
  }
5489
5553
  ),
5490
- /* @__PURE__ */ jsx27("span", { children: "Enable Depth / Alpha Mask" })
5554
+ /* @__PURE__ */ jsx28("span", { children: "Enable Depth / Alpha Mask" })
5491
5555
  ] }),
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(
5556
+ state.depthMask.enabled && /* @__PURE__ */ jsxs26(Fragment8, { children: [
5557
+ /* @__PURE__ */ jsxs26("div", { children: [
5558
+ /* @__PURE__ */ jsx28("label", { className: "text-muted-foreground block mb-1", children: "Mask Image URL:" }),
5559
+ /* @__PURE__ */ jsx28(
5496
5560
  "input",
5497
5561
  {
5498
5562
  type: "text",
@@ -5503,8 +5567,8 @@ var ImageEditor = ({
5503
5567
  }
5504
5568
  )
5505
5569
  ] }),
5506
- /* @__PURE__ */ jsxs25("div", { className: "flex gap-2", children: [
5507
- /* @__PURE__ */ jsx27(
5570
+ /* @__PURE__ */ jsxs26("div", { className: "flex gap-2", children: [
5571
+ /* @__PURE__ */ jsx28(
5508
5572
  "button",
5509
5573
  {
5510
5574
  type: "button",
@@ -5513,7 +5577,7 @@ var ImageEditor = ({
5513
5577
  children: "Threshold Mode"
5514
5578
  }
5515
5579
  ),
5516
- /* @__PURE__ */ jsx27(
5580
+ /* @__PURE__ */ jsx28(
5517
5581
  "button",
5518
5582
  {
5519
5583
  type: "button",
@@ -5523,12 +5587,12 @@ var ImageEditor = ({
5523
5587
  }
5524
5588
  )
5525
5589
  ] }),
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] })
5590
+ /* @__PURE__ */ jsxs26("div", { children: [
5591
+ /* @__PURE__ */ jsxs26("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
5592
+ /* @__PURE__ */ jsx28("span", { children: "Depth Start (Lower):" }),
5593
+ /* @__PURE__ */ jsx28("span", { className: "font-mono", children: state.depthMask.depthRange[0] })
5530
5594
  ] }),
5531
- /* @__PURE__ */ jsx27(
5595
+ /* @__PURE__ */ jsx28(
5532
5596
  "input",
5533
5597
  {
5534
5598
  type: "range",
@@ -5542,12 +5606,12 @@ var ImageEditor = ({
5542
5606
  }
5543
5607
  )
5544
5608
  ] }),
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] })
5609
+ /* @__PURE__ */ jsxs26("div", { children: [
5610
+ /* @__PURE__ */ jsxs26("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
5611
+ /* @__PURE__ */ jsx28("span", { children: "Depth Stop (Upper):" }),
5612
+ /* @__PURE__ */ jsx28("span", { className: "font-mono", children: state.depthMask.depthRange[1] })
5549
5613
  ] }),
5550
- /* @__PURE__ */ jsx27(
5614
+ /* @__PURE__ */ jsx28(
5551
5615
  "input",
5552
5616
  {
5553
5617
  type: "range",
@@ -5561,12 +5625,12 @@ var ImageEditor = ({
5561
5625
  }
5562
5626
  )
5563
5627
  ] }),
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 })
5628
+ /* @__PURE__ */ jsxs26("div", { children: [
5629
+ /* @__PURE__ */ jsxs26("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
5630
+ /* @__PURE__ */ jsx28("span", { children: "Softness:" }),
5631
+ /* @__PURE__ */ jsx28("span", { className: "font-mono", children: state.depthMask.softness })
5568
5632
  ] }),
5569
- /* @__PURE__ */ jsx27(
5633
+ /* @__PURE__ */ jsx28(
5570
5634
  "input",
5571
5635
  {
5572
5636
  type: "range",
@@ -5578,8 +5642,8 @@ var ImageEditor = ({
5578
5642
  }
5579
5643
  )
5580
5644
  ] }),
5581
- /* @__PURE__ */ jsxs25("label", { className: "flex items-center gap-2 cursor-pointer text-foreground mt-1", children: [
5582
- /* @__PURE__ */ jsx27(
5645
+ /* @__PURE__ */ jsxs26("label", { className: "flex items-center gap-2 cursor-pointer text-foreground mt-1", children: [
5646
+ /* @__PURE__ */ jsx28(
5583
5647
  "input",
5584
5648
  {
5585
5649
  type: "checkbox",
@@ -5588,12 +5652,12 @@ var ImageEditor = ({
5588
5652
  className: "rounded accent-primary"
5589
5653
  }
5590
5654
  ),
5591
- /* @__PURE__ */ jsx27("span", { children: "Invert Mask" })
5655
+ /* @__PURE__ */ jsx28("span", { children: "Invert Mask" })
5592
5656
  ] })
5593
5657
  ] })
5594
5658
  ] }),
5595
- activeTab === "select" && /* @__PURE__ */ jsxs25("div", { className: "flex flex-col gap-4 text-xs", children: [
5596
- /* @__PURE__ */ jsx27(
5659
+ activeTab === "select" && /* @__PURE__ */ jsxs26("div", { className: "flex flex-col gap-4 text-xs", children: [
5660
+ /* @__PURE__ */ jsx28(
5597
5661
  SelectionOptionsBar,
5598
5662
  {
5599
5663
  controller,
@@ -5604,9 +5668,9 @@ var ImageEditor = ({
5604
5668
  selectionDisplay: state.selectionDisplay
5605
5669
  }
5606
5670
  ),
5607
- selectionError && /* @__PURE__ */ jsx27("p", { role: "alert", className: "text-destructive", children: selectionError }),
5608
- /* @__PURE__ */ jsxs25("div", { className: "flex gap-1", children: [
5609
- /* @__PURE__ */ jsx27(
5671
+ selectionError && /* @__PURE__ */ jsx28("p", { role: "alert", className: "text-destructive", children: selectionError }),
5672
+ /* @__PURE__ */ jsxs26("div", { className: "flex gap-1", children: [
5673
+ /* @__PURE__ */ jsx28(
5610
5674
  "button",
5611
5675
  {
5612
5676
  type: "button",
@@ -5617,7 +5681,7 @@ var ImageEditor = ({
5617
5681
  children: "Transform Selection"
5618
5682
  }
5619
5683
  ),
5620
- /* @__PURE__ */ jsx27(
5684
+ /* @__PURE__ */ jsx28(
5621
5685
  "button",
5622
5686
  {
5623
5687
  type: "button",
@@ -5629,14 +5693,14 @@ var ImageEditor = ({
5629
5693
  }
5630
5694
  )
5631
5695
  ] }),
5632
- /* @__PURE__ */ jsx27(RefineEdgePanel, { controller, selection: state.selection ?? null, layers: state.adjustments.layers }),
5633
- /* @__PURE__ */ jsx27(ChannelsPanel, { controller }),
5634
- /* @__PURE__ */ jsx27(PathsPanel, { controller })
5696
+ /* @__PURE__ */ jsx28(RefineEdgePanel, { controller, selection: state.selection ?? null, layers: state.adjustments.layers }),
5697
+ /* @__PURE__ */ jsx28(ChannelsPanel, { controller }),
5698
+ /* @__PURE__ */ jsx28(PathsPanel, { controller })
5635
5699
  ] }),
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(
5700
+ activeTab === "ai" && /* @__PURE__ */ jsxs26("div", { className: "flex flex-col gap-4 text-xs", children: [
5701
+ /* @__PURE__ */ jsxs26("label", { className: "flex items-center justify-between gap-2 text-foreground", children: [
5702
+ /* @__PURE__ */ jsx28("span", { children: "Results go to" }),
5703
+ /* @__PURE__ */ jsxs26(
5640
5704
  "select",
5641
5705
  {
5642
5706
  "aria-label": "AI result target",
@@ -5644,54 +5708,54 @@ var ImageEditor = ({
5644
5708
  onChange: (e) => setAiTarget(e.target.value),
5645
5709
  className: imageSelectClass,
5646
5710
  children: [
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" })
5711
+ /* @__PURE__ */ jsx28("option", { value: "auto", children: controller.isMultiLayer ? "Auto (new layer)" : "Auto (replace image)" }),
5712
+ /* @__PURE__ */ jsx28("option", { value: "new-layer", children: "New layer / mask" }),
5713
+ /* @__PURE__ */ jsx28("option", { value: "replace", children: "Replace image" })
5650
5714
  ]
5651
5715
  }
5652
5716
  )
5653
5717
  ] }),
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" }) }),
5718
+ /* @__PURE__ */ jsxs26("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
5719
+ /* @__PURE__ */ jsxs26("div", { className: "flex items-center justify-between", children: [
5720
+ /* @__PURE__ */ jsxs26("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
5721
+ /* @__PURE__ */ jsx28("svg", { className: "w-3.5 h-3.5 text-primary", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx28("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" }) }),
5658
5722
  "Background Removal"
5659
5723
  ] }),
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..." })
5724
+ isRemovingBg && /* @__PURE__ */ jsx28("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..." })
5661
5725
  ] }),
5662
- /* @__PURE__ */ jsx27("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Isolate foreground subject with AI alpha transparency segmentation." }),
5663
- /* @__PURE__ */ jsx27(
5726
+ /* @__PURE__ */ jsx28("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Isolate foreground subject with AI alpha transparency segmentation." }),
5727
+ /* @__PURE__ */ jsx28(
5664
5728
  "button",
5665
5729
  {
5666
5730
  type: "button",
5667
5731
  onClick: handleRemoveBackground,
5668
5732
  disabled: isRemovingBg || isInpainting,
5669
5733
  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",
5670
- children: isRemovingBg ? /* @__PURE__ */ jsxs25(Fragment8, { children: [
5671
- /* @__PURE__ */ jsx27("div", { className: imageSpinnerClass }),
5734
+ children: isRemovingBg ? /* @__PURE__ */ jsxs26(Fragment8, { children: [
5735
+ /* @__PURE__ */ jsx28("div", { className: imageSpinnerClass }),
5672
5736
  "Removing Background..."
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" }) }),
5737
+ ] }) : /* @__PURE__ */ jsxs26(Fragment8, { children: [
5738
+ /* @__PURE__ */ jsx28("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx28("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" }) }),
5675
5739
  "Remove Background"
5676
5740
  ] })
5677
5741
  }
5678
5742
  )
5679
5743
  ] }),
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" })
5744
+ /* @__PURE__ */ jsxs26("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
5745
+ /* @__PURE__ */ jsxs26("div", { className: "flex items-center justify-between", children: [
5746
+ /* @__PURE__ */ jsxs26("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
5747
+ /* @__PURE__ */ jsxs26("svg", { className: "w-3.5 h-3.5 text-primary", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
5748
+ /* @__PURE__ */ jsx28("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" }),
5749
+ /* @__PURE__ */ jsx28("path", { d: "m14 7 3 3" })
5686
5750
  ] }),
5687
5751
  "Generative Inpainting"
5688
5752
  ] }),
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..." })
5753
+ isInpainting && /* @__PURE__ */ jsx28("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..." })
5690
5754
  ] }),
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(
5755
+ /* @__PURE__ */ jsx28("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Replace, modify, or fill selected regions using prompt-guided generative inpainting." }),
5756
+ /* @__PURE__ */ jsxs26("div", { className: "flex flex-col gap-1", children: [
5757
+ /* @__PURE__ */ jsx28("label", { htmlFor: "ai-inpaint-prompt-react", className: "text-foreground text-[11px] font-medium", children: "Prompt" }),
5758
+ /* @__PURE__ */ jsx28(
5695
5759
  "textarea",
5696
5760
  {
5697
5761
  id: "ai-inpaint-prompt-react",
@@ -5703,10 +5767,10 @@ var ImageEditor = ({
5703
5767
  }
5704
5768
  )
5705
5769
  ] }),
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(
5770
+ /* @__PURE__ */ jsxs26("div", { className: "flex flex-col gap-1", children: [
5771
+ /* @__PURE__ */ jsx28("span", { className: "text-foreground text-[11px] font-medium", children: "Target Mask Region" }),
5772
+ /* @__PURE__ */ jsxs26("div", { className: "grid grid-cols-2 gap-1.5", children: [
5773
+ /* @__PURE__ */ jsxs26(
5710
5774
  "button",
5711
5775
  {
5712
5776
  type: "button",
@@ -5719,7 +5783,7 @@ var ImageEditor = ({
5719
5783
  ]
5720
5784
  }
5721
5785
  ),
5722
- /* @__PURE__ */ jsxs25(
5786
+ /* @__PURE__ */ jsxs26(
5723
5787
  "button",
5724
5788
  {
5725
5789
  type: "button",
@@ -5734,25 +5798,25 @@ var ImageEditor = ({
5734
5798
  )
5735
5799
  ] })
5736
5800
  ] }),
5737
- /* @__PURE__ */ jsx27(
5801
+ /* @__PURE__ */ jsx28(
5738
5802
  "button",
5739
5803
  {
5740
5804
  type: "button",
5741
5805
  onClick: handleInpaint,
5742
5806
  disabled: isInpainting || isRemovingBg || !inpaintPrompt.trim(),
5743
5807
  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",
5744
- children: isInpainting ? /* @__PURE__ */ jsxs25(Fragment8, { children: [
5745
- /* @__PURE__ */ jsx27("div", { className: imageSpinnerClass }),
5808
+ children: isInpainting ? /* @__PURE__ */ jsxs26(Fragment8, { children: [
5809
+ /* @__PURE__ */ jsx28("div", { className: imageSpinnerClass }),
5746
5810
  "Generating Inpaint..."
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" }) }),
5811
+ ] }) : /* @__PURE__ */ jsxs26(Fragment8, { children: [
5812
+ /* @__PURE__ */ jsx28("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx28("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" }) }),
5749
5813
  "Apply Inpainting"
5750
5814
  ] })
5751
5815
  }
5752
5816
  )
5753
5817
  ] }),
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 })
5818
+ aiError && /* @__PURE__ */ jsx28("div", { className: "p-2.5 rounded-lg bg-destructive/10 border border-destructive/40 text-destructive text-[11px]", children: aiError }),
5819
+ aiSuccess && /* @__PURE__ */ jsx28("div", { className: "p-2.5 rounded-lg bg-emerald-500/10 border border-emerald-500/30 text-emerald-600 text-[11px]", children: aiSuccess })
5756
5820
  ] })
5757
5821
  ] })
5758
5822
  ] })
@@ -5789,6 +5853,7 @@ export {
5789
5853
  SelectionOptionsBar,
5790
5854
  MaskEdgeCheck,
5791
5855
  SelectionChangeCheck,
5856
+ SeparateSubjectPanel,
5792
5857
  RefineEdgePanel,
5793
5858
  ChannelsPanel,
5794
5859
  PathsPanel,