@pixerate/editor-react 0.138.0 → 0.140.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.
@@ -35,6 +35,7 @@ __export(image_editor_exports, {
35
35
  BrushOptionsBar: () => BrushOptionsBar,
36
36
  ChannelsPanel: () => ChannelsPanel,
37
37
  ColorProfilePanel: () => ColorProfilePanel,
38
+ ContentAwareFillWorkspace: () => ContentAwareFillWorkspace,
38
39
  ControlSlider: () => ControlSlider,
39
40
  CurvesEditor: () => CurvesEditor,
40
41
  FreeTransformOptionsBar: () => FreeTransformOptionsBar,
@@ -232,8 +233,8 @@ function useImageEffectsTools(registry, controller, options = {}) {
232
233
  }
233
234
 
234
235
  // src/image-editor/ImageEditor.tsx
235
- var import_react32 = __toESM(require("react"), 1);
236
- var import_image_editor21 = require("@pixerate/editor/image-editor");
236
+ var import_react33 = __toESM(require("react"), 1);
237
+ var import_image_editor22 = require("@pixerate/editor/image-editor");
237
238
 
238
239
  // src/image-editor/ImageEditorCanvas.tsx
239
240
  var import_react5 = require("react");
@@ -4602,8 +4603,8 @@ var ColorProfilePanel = ({ controller, className }) => {
4602
4603
  };
4603
4604
 
4604
4605
  // src/image-editor/SelectionOptionsBar.tsx
4605
- var import_react26 = require("react");
4606
- var import_image_editor15 = require("@pixerate/editor/image-editor");
4606
+ var import_react27 = require("react");
4607
+ var import_image_editor16 = require("@pixerate/editor/image-editor");
4607
4608
 
4608
4609
  // src/image-editor/SelectAndMaskWorkspace.tsx
4609
4610
  var import_react25 = require("react");
@@ -4691,7 +4692,7 @@ var SelectAndMaskWorkspace = ({ controller, onClose, className = "" }) => {
4691
4692
  panFrom.current = null;
4692
4693
  session.end();
4693
4694
  };
4694
- const toLayer = settings.output === "new-layer" || settings.output === "new-layer-with-mask";
4695
+ const toLayer = settings.output !== "selection" && settings.output !== "layer-mask";
4695
4696
  const brushTool = settings.tool === "quick-select" || settings.tool === "brush" || settings.tool === "refine-brush";
4696
4697
  return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
4697
4698
  "div",
@@ -4828,7 +4829,7 @@ var SelectAndMaskWorkspace = ({ controller, onClose, className = "" }) => {
4828
4829
  /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
4829
4830
  /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("span", { children: [
4830
4831
  "Decontaminate Colors",
4831
- toLayer ? "" : " (new layer outputs)"
4832
+ toLayer ? "" : " (new layer or document outputs)"
4832
4833
  ] }),
4833
4834
  /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("span", { className: "font-mono", children: [
4834
4835
  settings.decontaminate,
@@ -4844,7 +4845,7 @@ var SelectAndMaskWorkspace = ({ controller, onClose, className = "" }) => {
4844
4845
  {
4845
4846
  label: "Output to",
4846
4847
  value: settings.output,
4847
- options: import_image_editor14.REFINE_OUTPUTS.map((o) => ({ value: o.id, label: o.label })),
4848
+ options: import_image_editor14.REFINE_OUTPUTS.filter((o) => !o.needsDocuments || controller.canOpenDocuments).map((o) => ({ value: o.id, label: o.label })),
4848
4849
  onChange: (v) => set({ output: v })
4849
4850
  }
4850
4851
  )
@@ -4866,8 +4867,215 @@ var SelectAndMaskWorkspace = ({ controller, onClose, className = "" }) => {
4866
4867
  );
4867
4868
  };
4868
4869
 
4869
- // src/image-editor/SelectionOptionsBar.tsx
4870
+ // src/image-editor/ContentAwareFillWorkspace.tsx
4871
+ var import_react26 = require("react");
4872
+ var import_image_editor15 = require("@pixerate/editor/image-editor");
4870
4873
  var import_jsx_runtime26 = require("react/jsx-runtime");
4874
+ var button3 = "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";
4875
+ var toggle2 = (on) => `${button3} ${on ? "bg-primary text-primary-foreground border-primary" : ""}`;
4876
+ var ContentAwareFillWorkspace = ({ controller, onClose, className = "" }) => {
4877
+ const session = (0, import_react26.useMemo)(() => new import_image_editor15.ContentAwareFillSession(controller), [controller]);
4878
+ const [, setRevision] = (0, import_react26.useState)(0);
4879
+ const [zoom, setZoom] = (0, import_react26.useState)(1);
4880
+ const [pan, setPan] = (0, import_react26.useState)({ x: 0, y: 0 });
4881
+ const [busy, setBusy] = (0, import_react26.useState)(false);
4882
+ const [error, setError] = (0, import_react26.useState)(null);
4883
+ const sourceRef = (0, import_react26.useRef)(null);
4884
+ const previewRef = (0, import_react26.useRef)(null);
4885
+ const panFrom = (0, import_react26.useRef)(null);
4886
+ const settings = session.settings;
4887
+ const win = session.window;
4888
+ (0, import_react26.useEffect)(() => {
4889
+ const off = session.subscribe(() => setRevision(session.revision));
4890
+ void session.open();
4891
+ return () => {
4892
+ off();
4893
+ };
4894
+ }, [session]);
4895
+ (0, import_react26.useEffect)(() => {
4896
+ if (!win || typeof ImageData === "undefined") return;
4897
+ for (const [canvas, rgba] of [
4898
+ [sourceRef.current, session.renderSource()],
4899
+ [previewRef.current, session.renderPreview()]
4900
+ ]) {
4901
+ const ctx = canvas?.getContext?.("2d");
4902
+ if (!canvas || !ctx || !rgba.length) continue;
4903
+ canvas.width = win.width;
4904
+ canvas.height = win.height;
4905
+ ctx.putImageData(new ImageData(rgba, win.width, win.height), 0, 0);
4906
+ }
4907
+ });
4908
+ const set = (changes) => session.update(changes);
4909
+ const ok = async () => {
4910
+ setBusy(true);
4911
+ setError(null);
4912
+ try {
4913
+ onClose(await session.commit());
4914
+ } catch (err) {
4915
+ setError(err instanceof Error ? err.message : String(err));
4916
+ setBusy(false);
4917
+ }
4918
+ };
4919
+ (0, import_react26.useEffect)(() => {
4920
+ const onKey = (e) => {
4921
+ const t = e.target;
4922
+ if (t && (t.tagName === "INPUT" || t.tagName === "SELECT" || t.tagName === "TEXTAREA")) return;
4923
+ if (e.key === "Escape") onClose(null);
4924
+ else if (e.key === "Enter") void ok();
4925
+ else if (e.ctrlKey || e.metaKey || e.altKey || !session.handleKey(e.key)) return;
4926
+ e.preventDefault();
4927
+ };
4928
+ window.addEventListener("keydown", onKey);
4929
+ return () => window.removeEventListener("keydown", onKey);
4930
+ });
4931
+ const toImage = (e) => {
4932
+ const rect = e.currentTarget.getBoundingClientRect();
4933
+ const w = win ?? { x: 0, y: 0, width: 1, height: 1 };
4934
+ return { x: w.x + (e.clientX - rect.left) / Math.max(1, rect.width) * w.width, y: w.y + (e.clientY - rect.top) / Math.max(1, rect.height) * w.height };
4935
+ };
4936
+ const onDown = (e) => {
4937
+ if (settings.tool === "hand") {
4938
+ panFrom.current = { x: e.clientX, y: e.clientY, pan };
4939
+ return;
4940
+ }
4941
+ if (settings.tool === "zoom") {
4942
+ setZoom((z) => Math.min(16, Math.max(0.25, e.altKey ? z / 1.25 : z * 1.25)));
4943
+ return;
4944
+ }
4945
+ e.currentTarget.setPointerCapture?.(e.pointerId);
4946
+ session.begin(toImage(e), { altKey: e.altKey });
4947
+ };
4948
+ const onMove = (e) => {
4949
+ if (panFrom.current) {
4950
+ const p = panFrom.current;
4951
+ setPan({ x: p.pan.x + e.clientX - p.x, y: p.pan.y + e.clientY - p.y });
4952
+ return;
4953
+ }
4954
+ if (e.buttons) session.move(toImage(e));
4955
+ };
4956
+ const onUp = () => {
4957
+ panFrom.current = null;
4958
+ session.end();
4959
+ };
4960
+ const view = { maxWidth: "100%", maxHeight: "100%", transform: `translate(${pan.x}px, ${pan.y}px) scale(${zoom})`, imageRendering: zoom > 2 ? "pixelated" : void 0 };
4961
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { "data-testid": "content-aware-fill-workspace", role: "dialog", "aria-label": "Content-Aware Fill", className: `fixed inset-0 z-50 flex bg-background text-xs text-foreground ${className}`, children: [
4962
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { role: "group", "aria-label": "Content-Aware Fill tool", className: "flex flex-col gap-1 p-2 border-r border-border", children: import_image_editor15.CONTENT_AWARE_FILL_TOOLS.map((t) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", title: `${t.label} (${t.key.toUpperCase()})`, "aria-pressed": settings.tool === t.id, className: toggle2(settings.tool === t.id), onClick: () => set({ tool: t.id }), children: t.label }, t.id)) }),
4963
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex-1 flex flex-col min-w-0", children: [
4964
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex flex-wrap items-center gap-2 p-2 border-b border-border", children: [
4965
+ settings.tool === "sampling-brush" && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [
4966
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
4967
+ "Size",
4968
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
4969
+ "input",
4970
+ {
4971
+ type: "number",
4972
+ min: 1,
4973
+ "aria-label": "Sampling brush size",
4974
+ value: settings.brushSize,
4975
+ onChange: (e) => set({ brushSize: Math.max(1, Number(e.target.value) || 1) }),
4976
+ className: "w-16 bg-background border border-border rounded px-1 py-0.5 text-foreground"
4977
+ }
4978
+ ),
4979
+ "px"
4980
+ ] }),
4981
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { role: "group", "aria-label": "Sampling brush mode", className: "flex gap-1", children: [
4982
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", "aria-pressed": settings.brushMode === "add", className: toggle2(settings.brushMode === "add"), onClick: () => set({ brushMode: "add" }), children: "Add" }),
4983
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", "aria-pressed": settings.brushMode === "subtract", className: toggle2(settings.brushMode === "subtract"), onClick: () => set({ brushMode: "subtract" }), children: "Subtract" })
4984
+ ] })
4985
+ ] }),
4986
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { className: "font-mono text-muted-foreground", children: [
4987
+ Math.round(zoom * 100),
4988
+ "%"
4989
+ ] }),
4990
+ session.computing && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { role: "status", className: "text-muted-foreground", children: "Updating preview\u2026" })
4991
+ ] }),
4992
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex-1 grid grid-cols-2 gap-2 p-2 min-h-0", children: [
4993
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex flex-col min-h-0", children: [
4994
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "text-muted-foreground", children: "Source (green: sampling area)" }),
4995
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "flex-1 overflow-hidden flex items-center justify-center bg-muted/30", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
4996
+ "canvas",
4997
+ {
4998
+ ref: sourceRef,
4999
+ "data-testid": "content-aware-fill-source",
5000
+ onPointerDown: onDown,
5001
+ onPointerMove: onMove,
5002
+ onPointerUp: onUp,
5003
+ style: { ...view, cursor: settings.tool === "hand" ? "grab" : settings.tool === "zoom" ? "zoom-in" : "crosshair" }
5004
+ }
5005
+ ) })
5006
+ ] }),
5007
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex flex-col min-h-0", children: [
5008
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "text-muted-foreground", children: "Preview" }),
5009
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "flex-1 overflow-hidden flex items-center justify-center bg-muted/30", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("canvas", { ref: previewRef, "data-testid": "content-aware-fill-preview", style: view }) })
5010
+ ] })
5011
+ ] })
5012
+ ] }),
5013
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "w-64 flex flex-col gap-3 p-3 border-l border-border overflow-y-auto", children: [
5014
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: imageSectionTitleClass, children: "Sampling Area Options" }),
5015
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { role: "group", "aria-label": "Sampling area", className: "flex gap-1", children: import_image_editor15.CONTENT_AWARE_FILL_SAMPLING.map((m) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", "aria-pressed": settings.sampling === m.id, className: toggle2(settings.sampling === m.id), onClick: () => set({ sampling: m.id }), children: m.label }, m.id)) }),
5016
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-2", children: [
5017
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ImageCheckbox, { label: "Show Sampling Area", checked: settings.showSampling, onChange: (on) => set({ showSampling: on }) }),
5018
+ "Show Sampling Area"
5019
+ ] }),
5020
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex flex-col gap-1", children: [
5021
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
5022
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { children: "Opacity" }),
5023
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { className: "font-mono", children: [
5024
+ Math.round(settings.opacity * 100),
5025
+ "%"
5026
+ ] })
5027
+ ] }),
5028
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ImageRange, { label: "Sampling overlay opacity", min: 0, max: 100, step: 1, value: Math.round(settings.opacity * 100), onChange: (v) => set({ opacity: v / 100 }) })
5029
+ ] }),
5030
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: imageSectionTitleClass, children: "Fill Settings" }),
5031
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-2 text-muted-foreground", children: [
5032
+ "Seed",
5033
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
5034
+ "input",
5035
+ {
5036
+ type: "number",
5037
+ min: 0,
5038
+ "aria-label": "Fill seed",
5039
+ value: settings.seed,
5040
+ onChange: (e) => set({ seed: Math.max(0, Math.round(Number(e.target.value) || 0)) }),
5041
+ className: "w-16 bg-background border border-border rounded px-1 py-0.5 text-foreground"
5042
+ }
5043
+ ),
5044
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: button3, onClick: () => set({ seed: settings.seed + 1 }), children: "Try Another" })
5045
+ ] }),
5046
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-2", children: [
5047
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ImageCheckbox, { label: "Live Preview", checked: settings.livePreview, onChange: (on) => set({ livePreview: on }) }),
5048
+ "Live Preview"
5049
+ ] }),
5050
+ !settings.livePreview && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: button3, disabled: session.computing, onClick: () => void session.refresh(), children: "Preview" }),
5051
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: imageSectionTitleClass, children: "Output Settings" }),
5052
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-2", children: [
5053
+ "Output To",
5054
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
5055
+ ImageSelect,
5056
+ {
5057
+ label: "Fill output",
5058
+ value: settings.output,
5059
+ options: [
5060
+ { value: "new-layer", label: "New Layer" },
5061
+ { value: "current", label: "Current Layer" }
5062
+ ],
5063
+ onChange: (v) => set({ output: v })
5064
+ }
5065
+ )
5066
+ ] }),
5067
+ (error ?? session.error) && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { role: "alert", className: "text-destructive", children: error ?? session.error }),
5068
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex gap-1 mt-auto", children: [
5069
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: button3, onClick: () => session.reset(), children: "Reset" }),
5070
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: button3, onClick: () => onClose(null), children: "Cancel" }),
5071
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: toggle2(true), disabled: busy || !win, "aria-busy": busy, onClick: () => void ok(), children: "OK" })
5072
+ ] })
5073
+ ] })
5074
+ ] });
5075
+ };
5076
+
5077
+ // src/image-editor/SelectionOptionsBar.tsx
5078
+ var import_jsx_runtime27 = require("react/jsx-runtime");
4871
5079
  var MODIFY_OPS = [
4872
5080
  { op: "expand", label: "Expand" },
4873
5081
  { op: "contract", label: "Contract" },
@@ -4891,15 +5099,15 @@ var SelectionOptionsBar = ({
4891
5099
  selectionDisplay,
4892
5100
  className = ""
4893
5101
  }) => {
4894
- const [radius, setRadius] = (0, import_react26.useState)(2);
5102
+ const [radius, setRadius] = (0, import_react27.useState)(2);
4895
5103
  const set = (patch) => onOptionsChange({ ...options, ...patch });
4896
5104
  const sel = selection === void 0 ? controller.getSelection() : selection;
4897
5105
  const display = selectionDisplay ?? (quickMask === void 0 ? controller.getSelectionDisplay() : quickMask ? "quickMask" : "ants");
4898
- const [preset, setPreset] = (0, import_react26.useState)("reds");
4899
- const [rangeStatus, setRangeStatus] = (0, import_react26.useState)(null);
4900
- const [colorStatus, setColorStatus] = (0, import_react26.useState)(null);
4901
- const [strokeWidth, setStrokeWidth] = (0, import_react26.useState)(4);
4902
- const [strokeLocation, setStrokeLocation] = (0, import_react26.useState)("outside");
5106
+ const [preset, setPreset] = (0, import_react27.useState)("reds");
5107
+ const [rangeStatus, setRangeStatus] = (0, import_react27.useState)(null);
5108
+ const [colorStatus, setColorStatus] = (0, import_react27.useState)(null);
5109
+ const [strokeWidth, setStrokeWidth] = (0, import_react27.useState)(4);
5110
+ const [strokeLocation, setStrokeLocation] = (0, import_react27.useState)("outside");
4903
5111
  const edit = (fn) => {
4904
5112
  setColorStatus(null);
4905
5113
  try {
@@ -4932,8 +5140,8 @@ var SelectionOptionsBar = ({
4932
5140
  setRangeStatus(err instanceof Error ? err.message : String(err));
4933
5141
  }
4934
5142
  };
4935
- const [task, setTask] = (0, import_react26.useState)(null);
4936
- const taskAbort = (0, import_react26.useRef)(null);
5143
+ const [task, setTask] = (0, import_react27.useState)(null);
5144
+ const taskAbort = (0, import_react27.useRef)(null);
4937
5145
  const tracked = () => {
4938
5146
  const abort = new AbortController();
4939
5147
  taskAbort.current = abort;
@@ -4945,9 +5153,9 @@ var SelectionOptionsBar = ({
4945
5153
  setTask(null);
4946
5154
  };
4947
5155
  const failure = (err) => err?.name === "AbortError" ? "Cancelled." : err instanceof Error ? err.message : String(err);
4948
- const [subject, setSubject] = (0, import_react26.useState)("");
4949
- const [segmenting, setSegmenting] = (0, import_react26.useState)(false);
4950
- const [subjectStatus, setSubjectStatus] = (0, import_react26.useState)(null);
5156
+ const [subject, setSubject] = (0, import_react27.useState)("");
5157
+ const [segmenting, setSegmenting] = (0, import_react27.useState)(false);
5158
+ const [subjectStatus, setSubjectStatus] = (0, import_react27.useState)(null);
4951
5159
  const selectSubject = async () => {
4952
5160
  const target = subject.trim();
4953
5161
  const canSegment = Boolean(controller.segmentationProvider);
@@ -4964,9 +5172,10 @@ var SelectionOptionsBar = ({
4964
5172
  setSegmenting(false);
4965
5173
  }
4966
5174
  };
4967
- const [workspace, setWorkspace] = (0, import_react26.useState)(false);
4968
- const [skying, setSkying] = (0, import_react26.useState)(false);
4969
- const [skyStatus, setSkyStatus] = (0, import_react26.useState)(null);
5175
+ const [workspace, setWorkspace] = (0, import_react27.useState)(false);
5176
+ const [fillWorkspace, setFillWorkspace] = (0, import_react27.useState)(false);
5177
+ const [skying, setSkying] = (0, import_react27.useState)(false);
5178
+ const [skyStatus, setSkyStatus] = (0, import_react27.useState)(null);
4970
5179
  const selectSky = async () => {
4971
5180
  if (skying) return;
4972
5181
  setSkying(true);
@@ -4981,8 +5190,8 @@ var SelectionOptionsBar = ({
4981
5190
  setSkying(false);
4982
5191
  }
4983
5192
  };
4984
- const [focusing, setFocusing] = (0, import_react26.useState)(false);
4985
- const [focusStatus, setFocusStatus] = (0, import_react26.useState)(null);
5193
+ const [focusing, setFocusing] = (0, import_react27.useState)(false);
5194
+ const [focusStatus, setFocusStatus] = (0, import_react27.useState)(null);
4986
5195
  const selectFocusArea = async () => {
4987
5196
  if (focusing) return;
4988
5197
  setFocusing(true);
@@ -5003,24 +5212,24 @@ var SelectionOptionsBar = ({
5003
5212
  setFocusing(false);
5004
5213
  }
5005
5214
  };
5006
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { "data-testid": "selection-options-bar", className: `flex flex-col gap-3 text-xs ${className}`, children: [
5007
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { role: "group", "aria-label": "Selection tool", className: "flex flex-wrap gap-1", children: import_image_editor15.SELECTION_TOOLS.map((t) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", "aria-pressed": options.tool === t.id, className: btn(options.tool === t.id), onClick: () => set({ tool: t.id }), children: t.label }, t.id)) }),
5008
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { role: "group", "aria-label": "Selection mode", className: "flex flex-wrap gap-1", children: import_image_editor15.SELECTION_MODES.map((m) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", "aria-pressed": options.mode === m, className: btn(options.mode === m), onClick: () => set({ mode: m }), children: import_image_editor15.SELECTION_MODE_LABELS[m] }, m)) }),
5009
- options.tool === "wand" && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex flex-col gap-2", children: [
5010
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex flex-col gap-1", children: [
5011
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
5012
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { children: "Tolerance" }),
5013
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "font-mono", children: options.tolerance })
5215
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { "data-testid": "selection-options-bar", className: `flex flex-col gap-3 text-xs ${className}`, children: [
5216
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { role: "group", "aria-label": "Selection tool", className: "flex flex-wrap gap-1", children: import_image_editor16.SELECTION_TOOLS.map((t) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { type: "button", "aria-pressed": options.tool === t.id, className: btn(options.tool === t.id), onClick: () => set({ tool: t.id }), children: t.label }, t.id)) }),
5217
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { role: "group", "aria-label": "Selection mode", className: "flex flex-wrap gap-1", children: import_image_editor16.SELECTION_MODES.map((m) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { type: "button", "aria-pressed": options.mode === m, className: btn(options.mode === m), onClick: () => set({ mode: m }), children: import_image_editor16.SELECTION_MODE_LABELS[m] }, m)) }),
5218
+ options.tool === "wand" && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex flex-col gap-2", children: [
5219
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex flex-col gap-1", children: [
5220
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
5221
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { children: "Tolerance" }),
5222
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "font-mono", children: options.tolerance })
5014
5223
  ] }),
5015
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ImageRange, { label: "Tolerance", min: 0, max: 255, step: 1, value: options.tolerance, onChange: (v) => set({ tolerance: v }) })
5224
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ImageRange, { label: "Tolerance", min: 0, max: 255, step: 1, value: options.tolerance, onChange: (v) => set({ tolerance: v }) })
5016
5225
  ] }),
5017
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
5018
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ImageCheckbox, { label: "Contiguous", checked: options.contiguous, onChange: (on) => set({ contiguous: on }) }),
5226
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
5227
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ImageCheckbox, { label: "Contiguous", checked: options.contiguous, onChange: (on) => set({ contiguous: on }) }),
5019
5228
  "Contiguous"
5020
5229
  ] }),
5021
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
5230
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
5022
5231
  "Distance",
5023
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
5232
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5024
5233
  ImageSelect,
5025
5234
  {
5026
5235
  label: "Colour distance",
@@ -5033,13 +5242,13 @@ var SelectionOptionsBar = ({
5033
5242
  }
5034
5243
  )
5035
5244
  ] }),
5036
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
5037
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ImageCheckbox, { label: "Sample adjusted image", checked: options.sampleMerged, onChange: (on) => set({ sampleMerged: on }) }),
5245
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
5246
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ImageCheckbox, { label: "Sample adjusted image", checked: options.sampleMerged, onChange: (on) => set({ sampleMerged: on }) }),
5038
5247
  "Sample adjusted image"
5039
5248
  ] }),
5040
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
5249
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
5041
5250
  "Sample",
5042
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
5251
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5043
5252
  ImageSelect,
5044
5253
  {
5045
5254
  label: "Sample from",
@@ -5053,77 +5262,77 @@ var SelectionOptionsBar = ({
5053
5262
  )
5054
5263
  ] })
5055
5264
  ] }),
5056
- options.tool === "polygon" && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "text-muted-foreground", children: "Click to add corners (Shift for 45\xB0), drag for a free-hand stretch; double-click, Enter or a click on the first corner closes it, Backspace removes a corner, Escape cancels." }),
5057
- options.tool === "magnetic" && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { "data-testid": "magnetic-lasso-options", className: "flex flex-col gap-2", children: [
5058
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "text-muted-foreground", children: "Click on an edge, then move along it: the outline snaps to the edge and adds points as it goes. Click to add a point; double-click, Enter or a click on the start closes it, Backspace removes the last point, Escape cancels." }),
5059
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex flex-col gap-1", children: [
5060
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
5061
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { children: "Width" }),
5062
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { className: "font-mono", children: [
5265
+ options.tool === "polygon" && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { className: "text-muted-foreground", children: "Click to add corners (Shift for 45\xB0), drag for a free-hand stretch; double-click, Enter or a click on the first corner closes it, Backspace removes a corner, Escape cancels." }),
5266
+ options.tool === "magnetic" && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { "data-testid": "magnetic-lasso-options", className: "flex flex-col gap-2", children: [
5267
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { className: "text-muted-foreground", children: "Click on an edge, then move along it: the outline snaps to the edge and adds points as it goes. Click to add a point; double-click, Enter or a click on the start closes it, Backspace removes the last point, Escape cancels." }),
5268
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex flex-col gap-1", children: [
5269
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
5270
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { children: "Width" }),
5271
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { className: "font-mono", children: [
5063
5272
  options.magneticWidth ?? 10,
5064
5273
  " px"
5065
5274
  ] })
5066
5275
  ] }),
5067
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ImageRange, { label: "Magnetic lasso width", min: 1, max: 256, step: 1, value: options.magneticWidth ?? 10, onChange: (v) => set({ magneticWidth: v }) })
5276
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ImageRange, { label: "Magnetic lasso width", min: 1, max: 256, step: 1, value: options.magneticWidth ?? 10, onChange: (v) => set({ magneticWidth: v }) })
5068
5277
  ] }),
5069
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex flex-col gap-1", children: [
5070
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
5071
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { children: "Contrast" }),
5072
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { className: "font-mono", children: [
5278
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex flex-col gap-1", children: [
5279
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
5280
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { children: "Contrast" }),
5281
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { className: "font-mono", children: [
5073
5282
  options.magneticContrast ?? 10,
5074
5283
  "%"
5075
5284
  ] })
5076
5285
  ] }),
5077
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ImageRange, { label: "Magnetic lasso contrast", min: 1, max: 100, step: 1, value: options.magneticContrast ?? 10, onChange: (v) => set({ magneticContrast: v }) })
5286
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ImageRange, { label: "Magnetic lasso contrast", min: 1, max: 100, step: 1, value: options.magneticContrast ?? 10, onChange: (v) => set({ magneticContrast: v }) })
5078
5287
  ] }),
5079
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex flex-col gap-1", children: [
5080
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
5081
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { children: "Frequency" }),
5082
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "font-mono", children: options.magneticFrequency ?? 57 })
5288
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex flex-col gap-1", children: [
5289
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
5290
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { children: "Frequency" }),
5291
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "font-mono", children: options.magneticFrequency ?? 57 })
5083
5292
  ] }),
5084
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ImageRange, { label: "Magnetic lasso frequency", min: 0, max: 100, step: 1, value: options.magneticFrequency ?? 57, onChange: (v) => set({ magneticFrequency: v }) })
5293
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ImageRange, { label: "Magnetic lasso frequency", min: 0, max: 100, step: 1, value: options.magneticFrequency ?? 57, onChange: (v) => set({ magneticFrequency: v }) })
5085
5294
  ] })
5086
5295
  ] }),
5087
- options.tool === "quick" && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { "data-testid": "quick-selection-options", className: "flex flex-col gap-2", children: [
5088
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "text-muted-foreground", children: "Paint inside the area: the selection grows out to its edges. Each stroke adds (Alt-drag subtracts)." }),
5089
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex flex-col gap-1", children: [
5090
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
5091
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { children: "Size" }),
5092
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { className: "font-mono", children: [
5296
+ options.tool === "quick" && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { "data-testid": "quick-selection-options", className: "flex flex-col gap-2", children: [
5297
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { className: "text-muted-foreground", children: "Paint inside the area: the selection grows out to its edges. Each stroke adds (Alt-drag subtracts)." }),
5298
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex flex-col gap-1", children: [
5299
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
5300
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { children: "Size" }),
5301
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { className: "font-mono", children: [
5093
5302
  options.quickSize ?? 30,
5094
5303
  " px"
5095
5304
  ] })
5096
5305
  ] }),
5097
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ImageRange, { label: "Quick selection size", min: 1, max: 500, step: 1, value: options.quickSize ?? 30, onChange: (v) => set({ quickSize: v }) })
5306
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ImageRange, { label: "Quick selection size", min: 1, max: 500, step: 1, value: options.quickSize ?? 30, onChange: (v) => set({ quickSize: v }) })
5098
5307
  ] }),
5099
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
5100
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ImageCheckbox, { label: "Sample all layers", checked: options.quickSampleAll ?? true, onChange: (on) => set({ quickSampleAll: on }) }),
5308
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
5309
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ImageCheckbox, { label: "Sample all layers", checked: options.quickSampleAll ?? true, onChange: (on) => set({ quickSampleAll: on }) }),
5101
5310
  "Sample all layers"
5102
5311
  ] }),
5103
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
5104
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ImageCheckbox, { label: "Auto-enhance edges", checked: options.quickEnhance ?? false, onChange: (on) => set({ quickEnhance: on }) }),
5312
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
5313
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ImageCheckbox, { label: "Auto-enhance edges", checked: options.quickEnhance ?? false, onChange: (on) => set({ quickEnhance: on }) }),
5105
5314
  "Auto-enhance edges"
5106
5315
  ] })
5107
5316
  ] }),
5108
- options.tool === "object" && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { "data-testid": "object-selection-options", className: "flex flex-col gap-2", children: [
5109
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "text-muted-foreground", children: "Drag a box loosely around an object, or click on it. Shift adds, Alt subtracts." }),
5110
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
5111
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ImageCheckbox, { label: "Object sample all layers", checked: options.objectSampleAll ?? true, onChange: (on) => set({ objectSampleAll: on }) }),
5317
+ options.tool === "object" && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { "data-testid": "object-selection-options", className: "flex flex-col gap-2", children: [
5318
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { className: "text-muted-foreground", children: "Drag a box loosely around an object, or click on it. Shift adds, Alt subtracts." }),
5319
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
5320
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ImageCheckbox, { label: "Object sample all layers", checked: options.objectSampleAll ?? true, onChange: (on) => set({ objectSampleAll: on }) }),
5112
5321
  "Sample all layers"
5113
5322
  ] }),
5114
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
5115
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ImageCheckbox, { label: "Object auto-enhance edges", checked: options.objectEnhance ?? false, onChange: (on) => set({ objectEnhance: on }) }),
5323
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
5324
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ImageCheckbox, { label: "Object auto-enhance edges", checked: options.objectEnhance ?? false, onChange: (on) => set({ objectEnhance: on }) }),
5116
5325
  "Auto-enhance edges"
5117
5326
  ] })
5118
5327
  ] }),
5119
- (options.tool === "type" || options.tool === "type-vertical") && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { "data-testid": "type-mask-options", className: "flex flex-col gap-2", children: [
5120
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("p", { className: "text-muted-foreground", children: [
5328
+ (options.tool === "type" || options.tool === "type-vertical") && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { "data-testid": "type-mask-options", className: "flex flex-col gap-2", children: [
5329
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("p", { className: "text-muted-foreground", children: [
5121
5330
  options.tool === "type-vertical" ? "Click where the column starts: the letters are stacked down from there, centred on the click." : "Click where the text starts (its baseline).",
5122
5331
  " Shift-click adds, Alt-click subtracts."
5123
5332
  ] }),
5124
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
5333
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
5125
5334
  "Text",
5126
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
5335
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5127
5336
  "input",
5128
5337
  {
5129
5338
  type: "text",
@@ -5134,9 +5343,9 @@ var SelectionOptionsBar = ({
5134
5343
  }
5135
5344
  )
5136
5345
  ] }),
5137
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
5346
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
5138
5347
  "Size",
5139
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
5348
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5140
5349
  "input",
5141
5350
  {
5142
5351
  type: "number",
@@ -5150,9 +5359,9 @@ var SelectionOptionsBar = ({
5150
5359
  ),
5151
5360
  "px"
5152
5361
  ] }),
5153
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
5362
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
5154
5363
  "Font",
5155
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
5364
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5156
5365
  "input",
5157
5366
  {
5158
5367
  type: "text",
@@ -5164,18 +5373,18 @@ var SelectionOptionsBar = ({
5164
5373
  )
5165
5374
  ] })
5166
5375
  ] }),
5167
- options.tool === "range" && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { "data-testid": "color-range-options", className: "flex flex-col gap-2", children: [
5168
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "text-muted-foreground", children: "Click a colour to select it; Shift-click adds a colour, Alt-click removes one." }),
5169
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex flex-col gap-1", children: [
5170
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
5171
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { children: "Fuzziness" }),
5172
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "font-mono", children: options.fuzziness ?? 40 })
5376
+ options.tool === "range" && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { "data-testid": "color-range-options", className: "flex flex-col gap-2", children: [
5377
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { className: "text-muted-foreground", children: "Click a colour to select it; Shift-click adds a colour, Alt-click removes one." }),
5378
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex flex-col gap-1", children: [
5379
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
5380
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { children: "Fuzziness" }),
5381
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "font-mono", children: options.fuzziness ?? 40 })
5173
5382
  ] }),
5174
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ImageRange, { label: "Fuzziness", min: 0, max: 200, step: 1, value: options.fuzziness ?? 40, onChange: (v) => set({ fuzziness: v }) })
5383
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ImageRange, { label: "Fuzziness", min: 0, max: 200, step: 1, value: options.fuzziness ?? 40, onChange: (v) => set({ fuzziness: v }) })
5175
5384
  ] }),
5176
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
5385
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
5177
5386
  "Localized radius",
5178
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
5387
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5179
5388
  "input",
5180
5389
  {
5181
5390
  type: "number",
@@ -5189,27 +5398,27 @@ var SelectionOptionsBar = ({
5189
5398
  ),
5190
5399
  "px"
5191
5400
  ] }),
5192
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
5193
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ImageCheckbox, { label: "Invert", checked: options.rangeInvert ?? false, onChange: (on) => set({ rangeInvert: on }) }),
5401
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
5402
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ImageCheckbox, { label: "Invert", checked: options.rangeInvert ?? false, onChange: (on) => set({ rangeInvert: on }) }),
5194
5403
  "Invert"
5195
5404
  ] }),
5196
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex items-center gap-1", children: [
5197
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
5405
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex items-center gap-1", children: [
5406
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5198
5407
  ImageSelect,
5199
5408
  {
5200
5409
  label: "Color Range preset",
5201
5410
  value: preset,
5202
- options: import_image_editor15.COLOR_RANGE_PRESETS.map((p) => ({ value: p, label: import_image_editor15.COLOR_RANGE_PRESET_LABELS[p] })),
5411
+ options: import_image_editor16.COLOR_RANGE_PRESETS.map((p) => ({ value: p, label: import_image_editor16.COLOR_RANGE_PRESET_LABELS[p] })),
5203
5412
  onChange: (v) => setPreset(v)
5204
5413
  }
5205
5414
  ),
5206
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: btn(false), onClick: () => void applyPreset(), children: "Select" })
5415
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { type: "button", className: btn(false), onClick: () => void applyPreset(), children: "Select" })
5207
5416
  ] }),
5208
- rangeStatus && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { role: "status", className: "text-muted-foreground", children: rangeStatus })
5417
+ rangeStatus && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { role: "status", className: "text-muted-foreground", children: rangeStatus })
5209
5418
  ] }),
5210
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
5419
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
5211
5420
  "Feather",
5212
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
5421
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5213
5422
  "input",
5214
5423
  {
5215
5424
  type: "number",
@@ -5224,7 +5433,7 @@ var SelectionOptionsBar = ({
5224
5433
  ),
5225
5434
  "px"
5226
5435
  ] }),
5227
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
5436
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
5228
5437
  "form",
5229
5438
  {
5230
5439
  "data-testid": "select-subject",
@@ -5234,8 +5443,8 @@ var SelectionOptionsBar = ({
5234
5443
  void selectSubject();
5235
5444
  },
5236
5445
  children: [
5237
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex gap-1", children: [
5238
- controller.segmentationProvider && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
5446
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex gap-1", children: [
5447
+ controller.segmentationProvider && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5239
5448
  "input",
5240
5449
  {
5241
5450
  type: "text",
@@ -5247,7 +5456,7 @@ var SelectionOptionsBar = ({
5247
5456
  className: "min-w-0 flex-1 bg-background border border-border rounded px-2 py-1 text-foreground"
5248
5457
  }
5249
5458
  ),
5250
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
5459
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5251
5460
  "button",
5252
5461
  {
5253
5462
  type: "submit",
@@ -5259,12 +5468,12 @@ var SelectionOptionsBar = ({
5259
5468
  }
5260
5469
  )
5261
5470
  ] }),
5262
- subjectStatus && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { role: "status", className: "text-muted-foreground", children: subjectStatus })
5471
+ subjectStatus && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { role: "status", className: "text-muted-foreground", children: subjectStatus })
5263
5472
  ]
5264
5473
  }
5265
5474
  ),
5266
- task && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { "data-testid": "selection-progress", className: "flex items-center gap-2", children: [
5267
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
5475
+ task && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { "data-testid": "selection-progress", className: "flex items-center gap-2", children: [
5476
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5268
5477
  "div",
5269
5478
  {
5270
5479
  role: "progressbar",
@@ -5273,69 +5482,69 @@ var SelectionOptionsBar = ({
5273
5482
  "aria-valuemax": 100,
5274
5483
  "aria-valuenow": Math.round(task.fraction * 100),
5275
5484
  className: "flex-1 h-1.5 rounded bg-muted overflow-hidden",
5276
- children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "h-full bg-primary", style: { width: `${Math.round(task.fraction * 100)}%` } })
5485
+ children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "h-full bg-primary", style: { width: `${Math.round(task.fraction * 100)}%` } })
5277
5486
  }
5278
5487
  ),
5279
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "text-muted-foreground", children: task.stage }),
5280
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: btn(false), onClick: () => taskAbort.current?.abort(), children: "Cancel" })
5488
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "text-muted-foreground", children: task.stage }),
5489
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { type: "button", className: btn(false), onClick: () => taskAbort.current?.abort(), children: "Cancel" })
5281
5490
  ] }),
5282
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: btn(false), onClick: () => setWorkspace(true), children: "Select and Mask\u2026" }),
5283
- workspace && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(SelectAndMaskWorkspace, { controller, onClose: () => setWorkspace(false) }),
5284
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { "data-testid": "select-sky", className: "flex flex-col gap-1", children: [
5285
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: btn(false), disabled: skying, "aria-busy": skying, onClick: () => void selectSky(), children: skying ? "Selecting\u2026" : "Select Sky" }),
5286
- skyStatus && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { role: "status", className: "text-muted-foreground", children: skyStatus })
5491
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { type: "button", className: btn(false), onClick: () => setWorkspace(true), children: "Select and Mask\u2026" }),
5492
+ workspace && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(SelectAndMaskWorkspace, { controller, onClose: () => setWorkspace(false) }),
5493
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { "data-testid": "select-sky", className: "flex flex-col gap-1", children: [
5494
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { type: "button", className: btn(false), disabled: skying, "aria-busy": skying, onClick: () => void selectSky(), children: skying ? "Selecting\u2026" : "Select Sky" }),
5495
+ skyStatus && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { role: "status", className: "text-muted-foreground", children: skyStatus })
5287
5496
  ] }),
5288
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("details", { "data-testid": "focus-area", className: "flex flex-col gap-2", children: [
5289
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("summary", { className: "cursor-pointer text-foreground", children: "Focus Area" }),
5290
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex flex-col gap-2 pt-2", children: [
5291
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex flex-col gap-1", children: [
5292
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
5293
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { children: "In-focus range" }),
5294
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "font-mono", children: options.focusRange ?? 50 })
5497
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("details", { "data-testid": "focus-area", className: "flex flex-col gap-2", children: [
5498
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("summary", { className: "cursor-pointer text-foreground", children: "Focus Area" }),
5499
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex flex-col gap-2 pt-2", children: [
5500
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex flex-col gap-1", children: [
5501
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
5502
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { children: "In-focus range" }),
5503
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "font-mono", children: options.focusRange ?? 50 })
5295
5504
  ] }),
5296
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ImageRange, { label: "In-focus range", min: 0, max: 100, step: 1, value: options.focusRange ?? 50, onChange: (v) => set({ focusRange: v }) })
5505
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ImageRange, { label: "In-focus range", min: 0, max: 100, step: 1, value: options.focusRange ?? 50, onChange: (v) => set({ focusRange: v }) })
5297
5506
  ] }),
5298
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex flex-col gap-1", children: [
5299
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
5300
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { children: "Image noise level" }),
5301
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "font-mono", children: options.focusNoise ?? 0 })
5507
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex flex-col gap-1", children: [
5508
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
5509
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { children: "Image noise level" }),
5510
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "font-mono", children: options.focusNoise ?? 0 })
5302
5511
  ] }),
5303
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ImageRange, { label: "Image noise level", min: 0, max: 100, step: 1, value: options.focusNoise ?? 0, onChange: (v) => set({ focusNoise: v }) })
5512
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ImageRange, { label: "Image noise level", min: 0, max: 100, step: 1, value: options.focusNoise ?? 0, onChange: (v) => set({ focusNoise: v }) })
5304
5513
  ] }),
5305
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex flex-col gap-1", children: [
5306
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
5307
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { children: "Soften edge" }),
5308
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { className: "font-mono", children: [
5514
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex flex-col gap-1", children: [
5515
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
5516
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { children: "Soften edge" }),
5517
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { className: "font-mono", children: [
5309
5518
  options.focusSoftness ?? 4,
5310
5519
  " px"
5311
5520
  ] })
5312
5521
  ] }),
5313
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ImageRange, { label: "Focus soften edge", min: 0, max: 50, step: 1, value: options.focusSoftness ?? 4, onChange: (v) => set({ focusSoftness: v }) })
5522
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ImageRange, { label: "Focus soften edge", min: 0, max: 50, step: 1, value: options.focusSoftness ?? 4, onChange: (v) => set({ focusSoftness: v }) })
5314
5523
  ] }),
5315
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: btn(false), disabled: focusing, "aria-busy": focusing, onClick: () => void selectFocusArea(), children: focusing ? "Selecting\u2026" : "Select Focus Area" }),
5316
- focusStatus && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { role: "status", className: "text-muted-foreground", children: focusStatus })
5524
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { type: "button", className: btn(false), disabled: focusing, "aria-busy": focusing, onClick: () => void selectFocusArea(), children: focusing ? "Selecting\u2026" : "Select Focus Area" }),
5525
+ focusStatus && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { role: "status", className: "text-muted-foreground", children: focusStatus })
5317
5526
  ] })
5318
5527
  ] }),
5319
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
5320
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ImageCheckbox, { label: "Anti-alias", checked: options.antiAlias, onChange: (on) => set({ antiAlias: on }) }),
5528
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
5529
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ImageCheckbox, { label: "Anti-alias", checked: options.antiAlias, onChange: (on) => set({ antiAlias: on }) }),
5321
5530
  "Anti-alias"
5322
5531
  ] }),
5323
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
5324
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: btn(false), onClick: () => controller.selectAll(), children: "Select All" }),
5325
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => controller.deselect(), children: "Deselect" }),
5326
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: btn(false), onClick: () => controller.invertSelection(), children: "Inverse" }),
5327
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: btn(false), disabled: !controller.canReselect(), onClick: () => controller.reselect(), children: "Reselect" }),
5328
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: btn(false), disabled: !sel, title: "Add connected pixels of a selected colour (wand tolerance)", onClick: () => void runColor("grow"), children: "Grow" }),
5329
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: btn(false), disabled: !sel, title: "Add every pixel of a selected colour (wand tolerance)", onClick: () => void runColor("similar"), children: "Similar" })
5532
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
5533
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { type: "button", className: btn(false), onClick: () => controller.selectAll(), children: "Select All" }),
5534
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => controller.deselect(), children: "Deselect" }),
5535
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { type: "button", className: btn(false), onClick: () => controller.invertSelection(), children: "Inverse" }),
5536
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { type: "button", className: btn(false), disabled: !controller.canReselect(), onClick: () => controller.reselect(), children: "Reselect" }),
5537
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { type: "button", className: btn(false), disabled: !sel, title: "Add connected pixels of a selected colour (wand tolerance)", onClick: () => void runColor("grow"), children: "Grow" }),
5538
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { type: "button", className: btn(false), disabled: !sel, title: "Add every pixel of a selected colour (wand tolerance)", onClick: () => void runColor("similar"), children: "Similar" })
5330
5539
  ] }),
5331
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { role: "group", "aria-label": "Show selection", className: "flex flex-wrap items-center gap-1", children: [
5332
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "text-muted-foreground", children: "Show" }),
5333
- DISPLAYS.map((d) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", "aria-pressed": display === d.id, className: btn(display === d.id), onClick: () => controller.setSelectionDisplay(d.id), children: d.label }, d.id))
5540
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { role: "group", "aria-label": "Show selection", className: "flex flex-wrap items-center gap-1", children: [
5541
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "text-muted-foreground", children: "Show" }),
5542
+ DISPLAYS.map((d) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { type: "button", "aria-pressed": display === d.id, className: btn(display === d.id), onClick: () => controller.setSelectionDisplay(d.id), children: d.label }, d.id))
5334
5543
  ] }),
5335
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
5336
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
5544
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
5545
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
5337
5546
  "Radius",
5338
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
5547
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5339
5548
  "input",
5340
5549
  {
5341
5550
  type: "number",
@@ -5349,12 +5558,12 @@ var SelectionOptionsBar = ({
5349
5558
  }
5350
5559
  )
5351
5560
  ] }),
5352
- MODIFY_OPS.map(({ op, label }) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => controller.modifySelection(op, radius), children: label }, op))
5561
+ MODIFY_OPS.map(({ op, label }) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => controller.modifySelection(op, radius), children: label }, op))
5353
5562
  ] }),
5354
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { role: "group", "aria-label": "Edit selection", className: "flex flex-wrap items-center gap-1", children: [
5355
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
5563
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { role: "group", "aria-label": "Edit selection", className: "flex flex-wrap items-center gap-1", children: [
5564
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
5356
5565
  "Stroke",
5357
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
5566
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5358
5567
  "input",
5359
5568
  {
5360
5569
  type: "number",
@@ -5369,7 +5578,7 @@ var SelectionOptionsBar = ({
5369
5578
  ),
5370
5579
  "px"
5371
5580
  ] }),
5372
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
5581
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5373
5582
  ImageSelect,
5374
5583
  {
5375
5584
  label: "Stroke location",
@@ -5382,41 +5591,43 @@ var SelectionOptionsBar = ({
5382
5591
  onChange: (v) => setStrokeLocation(v)
5383
5592
  }
5384
5593
  ),
5385
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.strokeSelection({ width: strokeWidth, location: strokeLocation })), children: "Stroke" }),
5386
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.cropToSelection()), children: "Crop to Selection" }),
5387
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.contentAwareFill({ output: "new-layer" })), children: "Content-Aware Fill" })
5594
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.strokeSelection({ width: strokeWidth, location: strokeLocation })), children: "Stroke" }),
5595
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.cropToSelection()), children: "Crop to Selection" }),
5596
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.contentAwareFill({ output: "new-layer" })), children: "Content-Aware Fill" }),
5597
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => setFillWorkspace(true), children: "Content-Aware Fill\u2026" }),
5598
+ fillWorkspace && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ContentAwareFillWorkspace, { controller, onClose: () => setFillWorkspace(false) })
5388
5599
  ] }),
5389
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { role: "group", "aria-label": "Clipboard", className: "flex flex-wrap gap-1", children: [
5390
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: btn(false), onClick: () => edit(() => controller.copyPixels()), children: "Copy" }),
5391
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: btn(false), onClick: () => edit(() => controller.copyPixels({ merged: true })), children: "Copy Merged" }),
5392
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.cutPixels()), children: "Cut" }),
5393
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: btn(false), onClick: () => edit(() => controller.pastePixels("new-layer")), children: "Paste" }),
5394
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: btn(false), onClick: () => edit(() => controller.pastePixels("in-place")), children: "Paste in Place" }),
5395
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.pastePixels("into")), children: "Paste Into" }),
5396
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.pastePixels("outside")), children: "Paste Outside" })
5600
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { role: "group", "aria-label": "Clipboard", className: "flex flex-wrap gap-1", children: [
5601
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { type: "button", className: btn(false), onClick: () => edit(() => controller.copyPixels()), children: "Copy" }),
5602
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { type: "button", className: btn(false), onClick: () => edit(() => controller.copyPixels({ merged: true })), children: "Copy Merged" }),
5603
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.cutPixels()), children: "Cut" }),
5604
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { type: "button", className: btn(false), onClick: () => edit(() => controller.pastePixels("new-layer")), children: "Paste" }),
5605
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { type: "button", className: btn(false), onClick: () => edit(() => controller.pastePixels("in-place")), children: "Paste in Place" }),
5606
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.pastePixels("into")), children: "Paste Into" }),
5607
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.pastePixels("outside")), children: "Paste Outside" })
5397
5608
  ] }),
5398
- colorStatus && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { role: "status", className: "text-muted-foreground", children: colorStatus }),
5399
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { "data-testid": "selection-status", className: "text-muted-foreground", children: (0, import_image_editor15.describeSelection)(sel) })
5609
+ colorStatus && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { role: "status", className: "text-muted-foreground", children: colorStatus }),
5610
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { "data-testid": "selection-status", className: "text-muted-foreground", children: (0, import_image_editor16.describeSelection)(sel) })
5400
5611
  ] });
5401
5612
  };
5402
5613
 
5403
5614
  // src/image-editor/RefineEdgePanel.tsx
5404
- var import_react27 = require("react");
5405
- var import_image_editor16 = require("@pixerate/editor/image-editor");
5406
- var import_jsx_runtime27 = require("react/jsx-runtime");
5615
+ var import_react28 = require("react");
5616
+ var import_image_editor17 = require("@pixerate/editor/image-editor");
5617
+ var import_jsx_runtime28 = require("react/jsx-runtime");
5407
5618
  var DEFAULT_PARAMS = { radius: 8, smartRadius: false, smooth: 0, feather: 0, contrast: 0, shiftEdge: 0 };
5408
- var button3 = "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";
5619
+ var button4 = "px-2 py-1 rounded-md border border-border bg-background text-[11px] text-foreground hover:bg-accent hover:text-accent-foreground disabled:opacity-40";
5409
5620
  var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
5410
- const [params, setParams] = (0, import_react27.useState)(DEFAULT_PARAMS);
5411
- const [busy, setBusy] = (0, import_react27.useState)(false);
5412
- const [error, setError] = (0, import_react27.useState)(null);
5413
- const [layerId, setLayerId] = (0, import_react27.useState)("");
5414
- const [newKind, setNewKind] = (0, import_react27.useState)("hueSaturation");
5415
- const [output, setOutput] = (0, import_react27.useState)("selection");
5416
- const [decontaminate, setDecontaminate] = (0, import_react27.useState)(0);
5417
- const [objectAware, setObjectAware] = (0, import_react27.useState)(false);
5621
+ const [params, setParams] = (0, import_react28.useState)(DEFAULT_PARAMS);
5622
+ const [busy, setBusy] = (0, import_react28.useState)(false);
5623
+ const [error, setError] = (0, import_react28.useState)(null);
5624
+ const [layerId, setLayerId] = (0, import_react28.useState)("");
5625
+ const [newKind, setNewKind] = (0, import_react28.useState)("hueSaturation");
5626
+ const [output, setOutput] = (0, import_react28.useState)("selection");
5627
+ const [decontaminate, setDecontaminate] = (0, import_react28.useState)(0);
5628
+ const [objectAware, setObjectAware] = (0, import_react28.useState)(false);
5418
5629
  const canObject = Boolean(controller.segmentationProvider);
5419
- const toLayer = output === "new-layer" || output === "new-layer-with-mask";
5630
+ const toLayer = output !== "selection" && output !== "layer-mask";
5420
5631
  const sel = selection === void 0 ? controller.getSelection() : selection;
5421
5632
  const list = layers ?? controller.getAdjustmentLayers();
5422
5633
  const target = list.find((l) => l.id === layerId) ?? list[list.length - 1];
@@ -5434,17 +5645,17 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
5434
5645
  setBusy(false);
5435
5646
  }
5436
5647
  };
5437
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { "data-testid": "refine-edge-panel", className: `flex flex-col gap-3 text-xs ${className}`, children: [
5438
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: imageSectionTitleClass, children: "Refine Edge" }),
5439
- import_image_editor16.REFINE_EDGE_CONTROLS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex flex-col gap-1", children: [
5440
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
5441
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { children: c.label }),
5442
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { className: "font-mono", children: [
5648
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { "data-testid": "refine-edge-panel", className: `flex flex-col gap-3 text-xs ${className}`, children: [
5649
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: imageSectionTitleClass, children: "Refine Edge" }),
5650
+ import_image_editor17.REFINE_EDGE_CONTROLS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { className: "flex flex-col gap-1", children: [
5651
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
5652
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { children: c.label }),
5653
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { className: "font-mono", children: [
5443
5654
  params[c.id],
5444
5655
  c.unit
5445
5656
  ] })
5446
5657
  ] }),
5447
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5658
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5448
5659
  "input",
5449
5660
  {
5450
5661
  type: "range",
@@ -5458,39 +5669,39 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
5458
5669
  }
5459
5670
  )
5460
5671
  ] }, c.id)),
5461
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
5462
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("input", { type: "checkbox", checked: params.smartRadius, onChange: (e) => setParams({ ...params, smartRadius: e.target.checked }) }),
5672
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
5673
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("input", { type: "checkbox", checked: params.smartRadius, onChange: (e) => setParams({ ...params, smartRadius: e.target.checked }) }),
5463
5674
  "Smart Radius"
5464
5675
  ] }),
5465
- canObject && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
5466
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("input", { type: "checkbox", "aria-label": "Object aware", checked: objectAware, onChange: (e) => setObjectAware(e.target.checked) }),
5676
+ canObject && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
5677
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("input", { type: "checkbox", "aria-label": "Object aware", checked: objectAware, onChange: (e) => setObjectAware(e.target.checked) }),
5467
5678
  "Object aware (segmentation model)"
5468
5679
  ] }),
5469
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex items-center gap-2 text-muted-foreground", children: [
5680
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { className: "flex items-center gap-2 text-muted-foreground", children: [
5470
5681
  "Output to",
5471
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5682
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5472
5683
  "select",
5473
5684
  {
5474
5685
  "aria-label": "Refine output",
5475
5686
  value: output,
5476
5687
  onChange: (e) => setOutput(e.target.value),
5477
5688
  className: "flex-1 bg-background border border-border rounded px-1 py-1 text-foreground",
5478
- children: import_image_editor16.REFINE_OUTPUTS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("option", { value: o.id, children: o.label }, o.id))
5689
+ children: import_image_editor17.REFINE_OUTPUTS.filter((o) => !o.needsDocuments || controller.canOpenDocuments).map((o) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("option", { value: o.id, children: o.label }, o.id))
5479
5690
  }
5480
5691
  )
5481
5692
  ] }),
5482
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex flex-col gap-1", children: [
5483
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
5484
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { children: [
5693
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { className: "flex flex-col gap-1", children: [
5694
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
5695
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { children: [
5485
5696
  "Decontaminate colors",
5486
- toLayer ? "" : " (new layer outputs)"
5697
+ toLayer ? "" : " (new layer or document outputs)"
5487
5698
  ] }),
5488
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { className: "font-mono", children: [
5699
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { className: "font-mono", children: [
5489
5700
  decontaminate,
5490
5701
  "%"
5491
5702
  ] })
5492
5703
  ] }),
5493
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5704
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5494
5705
  "input",
5495
5706
  {
5496
5707
  type: "range",
@@ -5505,63 +5716,63 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
5505
5716
  }
5506
5717
  )
5507
5718
  ] }),
5508
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex gap-1", children: [
5509
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { type: "button", className: button3, disabled: !sel || busy, onClick: refine, children: "Refine Edge" }),
5510
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { type: "button", className: button3, onClick: () => setParams(DEFAULT_PARAMS), children: "Reset" })
5719
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex gap-1", children: [
5720
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("button", { type: "button", className: button4, disabled: !sel || busy, onClick: refine, children: "Refine Edge" }),
5721
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("button", { type: "button", className: button4, onClick: () => setParams(DEFAULT_PARAMS), children: "Reset" })
5511
5722
  ] }),
5512
- error && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { role: "alert", className: "text-destructive", children: error }),
5513
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] mt-2", children: "Layer Mask" }),
5514
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex gap-1 items-center", children: [
5515
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5723
+ error && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { role: "alert", className: "text-destructive", children: error }),
5724
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] mt-2", children: "Layer Mask" }),
5725
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex gap-1 items-center", children: [
5726
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5516
5727
  "select",
5517
5728
  {
5518
5729
  "aria-label": "New masked layer kind",
5519
5730
  value: newKind,
5520
5731
  onChange: (e) => setNewKind(e.target.value),
5521
5732
  className: "flex-1 bg-background border border-border rounded px-1 py-1 text-foreground",
5522
- children: import_image_editor16.ADJUSTMENT_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("option", { value: k.kind, children: k.label }, k.kind))
5733
+ children: import_image_editor17.ADJUSTMENT_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("option", { value: k.kind, children: k.label }, k.kind))
5523
5734
  }
5524
5735
  ),
5525
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5736
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5526
5737
  "button",
5527
5738
  {
5528
5739
  type: "button",
5529
- className: button3,
5740
+ className: button4,
5530
5741
  disabled: !sel,
5531
- onClick: () => sel && setLayerId(controller.addAdjustmentLayer({ kind: newKind, mask: (0, import_image_editor16.layerMaskFromSelection)(sel) })),
5742
+ onClick: () => sel && setLayerId(controller.addAdjustmentLayer({ kind: newKind, mask: (0, import_image_editor17.layerMaskFromSelection)(sel) })),
5532
5743
  children: "New Masked Layer"
5533
5744
  }
5534
5745
  )
5535
5746
  ] }),
5536
- list.length > 0 && target && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex flex-col gap-2", children: [
5537
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5747
+ list.length > 0 && target && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex flex-col gap-2", children: [
5748
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5538
5749
  "select",
5539
5750
  {
5540
5751
  "aria-label": "Mask layer",
5541
5752
  value: target.id,
5542
5753
  onChange: (e) => setLayerId(e.target.value),
5543
5754
  className: "bg-background border border-border rounded px-1 py-1 text-foreground",
5544
- children: list.map((l) => /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("option", { value: l.id, children: [
5545
- l.name || (0, import_image_editor16.adjustmentKindLabel)(l.kind),
5755
+ children: list.map((l) => /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("option", { value: l.id, children: [
5756
+ l.name || (0, import_image_editor17.adjustmentKindLabel)(l.kind),
5546
5757
  l.mask ? " (masked)" : ""
5547
5758
  ] }, l.id))
5548
5759
  }
5549
5760
  ),
5550
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
5551
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { type: "button", className: button3, disabled: !sel, onClick: () => controller.applySelectionAsLayerMask(target.id), children: "Mask with Selection" }),
5552
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { type: "button", className: button3, disabled: !target.mask, onClick: () => controller.selectionFromLayerMask(target.id), children: "Load as Selection" }),
5553
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { type: "button", className: button3, disabled: !target.mask, onClick: () => controller.setAdjustmentLayerMask(target.id, null), children: "Remove Mask" })
5761
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
5762
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("button", { type: "button", className: button4, disabled: !sel, onClick: () => controller.applySelectionAsLayerMask(target.id), children: "Mask with Selection" }),
5763
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("button", { type: "button", className: button4, disabled: !target.mask, onClick: () => controller.selectionFromLayerMask(target.id), children: "Load as Selection" }),
5764
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("button", { type: "button", className: button4, disabled: !target.mask, onClick: () => controller.setAdjustmentLayerMask(target.id, null), children: "Remove Mask" })
5554
5765
  ] }),
5555
- target.mask && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
5556
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex flex-col gap-1", children: [
5557
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
5558
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { children: "Density" }),
5559
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { className: "font-mono", children: [
5766
+ target.mask && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
5767
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { className: "flex flex-col gap-1", children: [
5768
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
5769
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { children: "Density" }),
5770
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { className: "font-mono", children: [
5560
5771
  Math.round((target.mask.density ?? 1) * 100),
5561
5772
  "%"
5562
5773
  ] })
5563
5774
  ] }),
5564
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5775
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5565
5776
  "input",
5566
5777
  {
5567
5778
  type: "range",
@@ -5575,15 +5786,15 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
5575
5786
  }
5576
5787
  )
5577
5788
  ] }),
5578
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex flex-col gap-1", children: [
5579
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
5580
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { children: "Mask Feather" }),
5581
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { className: "font-mono", children: [
5789
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { className: "flex flex-col gap-1", children: [
5790
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
5791
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { children: "Mask Feather" }),
5792
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { className: "font-mono", children: [
5582
5793
  target.mask.feather ?? 0,
5583
5794
  "px"
5584
5795
  ] })
5585
5796
  ] }),
5586
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5797
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5587
5798
  "input",
5588
5799
  {
5589
5800
  type: "range",
@@ -5603,32 +5814,32 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
5603
5814
  };
5604
5815
 
5605
5816
  // src/image-editor/ChannelsPanel.tsx
5606
- var import_react28 = require("react");
5607
- var import_image_editor17 = require("@pixerate/editor/image-editor");
5608
- var import_jsx_runtime28 = require("react/jsx-runtime");
5817
+ var import_react29 = require("react");
5818
+ var import_image_editor18 = require("@pixerate/editor/image-editor");
5819
+ var import_jsx_runtime29 = require("react/jsx-runtime");
5609
5820
  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"}`;
5610
5821
  var ChannelThumb = ({ channel, size }) => {
5611
- const ref = (0, import_react28.useRef)(null);
5612
- (0, import_react28.useEffect)(() => {
5822
+ const ref = (0, import_react29.useRef)(null);
5823
+ (0, import_react29.useEffect)(() => {
5613
5824
  const canvas = ref.current;
5614
5825
  const ctx = canvas?.getContext("2d");
5615
5826
  if (!canvas || !ctx || typeof ctx.createImageData !== "function") return;
5616
- const px = (0, import_image_editor17.channelThumbnail)(channel, 64);
5827
+ const px = (0, import_image_editor18.channelThumbnail)(channel, 64);
5617
5828
  canvas.width = px.width;
5618
5829
  canvas.height = px.height;
5619
5830
  const img = ctx.createImageData(px.width, px.height);
5620
5831
  img.data.set(px.data);
5621
5832
  ctx.putImageData(img, 0, 0);
5622
5833
  }, [channel.mask]);
5623
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("canvas", { ref, "aria-hidden": "true", style: { width: size, height: size }, className: "shrink-0 rounded object-contain ring-1 ring-border bg-black" });
5834
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("canvas", { ref, "aria-hidden": "true", style: { width: size, height: size }, className: "shrink-0 rounded object-contain ring-1 ring-border bg-black" });
5624
5835
  };
5625
5836
  var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
5626
- const [, setTick] = (0, import_react28.useState)(0);
5627
- (0, import_react28.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
5628
- const [activeId, setActiveId] = (0, import_react28.useState)(null);
5629
- const [renaming, setRenaming] = (0, import_react28.useState)(null);
5630
- const [error, setError] = (0, import_react28.useState)(null);
5631
- const fileInput = (0, import_react28.useRef)(null);
5837
+ const [, setTick] = (0, import_react29.useState)(0);
5838
+ (0, import_react29.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
5839
+ const [activeId, setActiveId] = (0, import_react29.useState)(null);
5840
+ const [renaming, setRenaming] = (0, import_react29.useState)(null);
5841
+ const [error, setError] = (0, import_react29.useState)(null);
5842
+ const fileInput = (0, import_react29.useRef)(null);
5632
5843
  const channels = controller.getChannels();
5633
5844
  const active = channels.find((c) => c.id === activeId) ?? null;
5634
5845
  const hasSelection = Boolean(controller.getSelection());
@@ -5645,18 +5856,18 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
5645
5856
  if (!file) return;
5646
5857
  setError(null);
5647
5858
  try {
5648
- setActiveId((await (0, import_image_editor17.openMaskFile)(controller, file)).id);
5859
+ setActiveId((await (0, import_image_editor18.openMaskFile)(controller, file)).id);
5649
5860
  } catch (err) {
5650
5861
  setError(err instanceof Error ? err.message : String(err));
5651
5862
  }
5652
5863
  };
5653
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { "data-testid": "channels-panel", className: `flex flex-col gap-2 text-xs ${className}`, children: [
5654
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex items-center justify-between", children: [
5655
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: imageSectionTitleClass, children: "Channels" }),
5656
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("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" })
5864
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { "data-testid": "channels-panel", className: `flex flex-col gap-2 text-xs ${className}`, children: [
5865
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex items-center justify-between", children: [
5866
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: imageSectionTitleClass, children: "Channels" }),
5867
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("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" })
5657
5868
  ] }),
5658
- channels.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { className: "text-muted-foreground", children: "No channels. Save a selection to keep it." }),
5659
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("ul", { role: "list", className: "flex flex-col gap-0.5", children: channels.map((c) => /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
5869
+ channels.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("p", { className: "text-muted-foreground", children: "No channels. Save a selection to keep it." }),
5870
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("ul", { role: "list", className: "flex flex-col gap-0.5", children: channels.map((c) => /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
5660
5871
  "li",
5661
5872
  {
5662
5873
  "data-testid": "channel-row",
@@ -5664,11 +5875,11 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
5664
5875
  className: `flex items-center gap-1.5 px-1.5 py-1 rounded cursor-pointer select-none ${c.id === activeId ? "bg-primary/30 ring-1 ring-primary" : "hover:bg-muted"}`,
5665
5876
  onClick: (e) => {
5666
5877
  setActiveId(c.id);
5667
- attempt(() => controller.loadSelectionFromChannel(c.id, { mode: (0, import_image_editor17.selectionModeFromModifiers)(e, "replace") }));
5878
+ attempt(() => controller.loadSelectionFromChannel(c.id, { mode: (0, import_image_editor18.selectionModeFromModifiers)(e, "replace") }));
5668
5879
  },
5669
5880
  onDoubleClick: () => setRenaming(c.id),
5670
5881
  children: [
5671
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5882
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
5672
5883
  "button",
5673
5884
  {
5674
5885
  type: "button",
@@ -5682,8 +5893,8 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
5682
5893
  children: c.visible ? "\u25CF" : "\u25CB"
5683
5894
  }
5684
5895
  ),
5685
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ChannelThumb, { channel: c, size: thumbnailSize }),
5686
- renaming === c.id ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5896
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ChannelThumb, { channel: c, size: thumbnailSize }),
5897
+ renaming === c.id ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
5687
5898
  "input",
5688
5899
  {
5689
5900
  autoFocus: true,
@@ -5700,16 +5911,16 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
5700
5911
  if (e.key === "Escape") setRenaming(null);
5701
5912
  }
5702
5913
  }
5703
- ) : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "min-w-0 flex-1 truncate", children: c.name })
5914
+ ) : /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "min-w-0 flex-1 truncate", children: c.name })
5704
5915
  ]
5705
5916
  },
5706
5917
  c.id
5707
5918
  )) }),
5708
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
5709
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("button", { type: "button", className: btn2(), disabled: !hasSelection, onClick: () => attempt(() => setActiveId(controller.saveSelection().id)), children: "Save Selection" }),
5710
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("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" }),
5711
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("button", { type: "button", className: btn2(), disabled: !active, onClick: () => attempt(() => setActiveId(controller.duplicateChannel(active.id).id)), children: "Duplicate" }),
5712
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5919
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
5920
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("button", { type: "button", className: btn2(), disabled: !hasSelection, onClick: () => attempt(() => setActiveId(controller.saveSelection().id)), children: "Save Selection" }),
5921
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("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" }),
5922
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("button", { type: "button", className: btn2(), disabled: !active, onClick: () => attempt(() => setActiveId(controller.duplicateChannel(active.id).id)), children: "Duplicate" }),
5923
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
5713
5924
  "button",
5714
5925
  {
5715
5926
  type: "button",
@@ -5722,24 +5933,24 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
5722
5933
  children: "Delete"
5723
5934
  }
5724
5935
  ),
5725
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("button", { type: "button", className: btn2(), title: "Load a mask image (white = selected) into a new channel", onClick: () => fileInput.current?.click(), children: "Import\u2026" }),
5726
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5936
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("button", { type: "button", className: btn2(), title: "Load a mask image (white = selected) into a new channel", onClick: () => fileInput.current?.click(), children: "Import\u2026" }),
5937
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
5727
5938
  "button",
5728
5939
  {
5729
5940
  type: "button",
5730
5941
  className: btn2(),
5731
5942
  disabled: !active && !hasSelection,
5732
5943
  title: active ? "Save the channel as a greyscale PNG" : "Save the selection as a greyscale PNG",
5733
- onClick: () => attempt(() => (0, import_image_editor17.downloadMaskImage)(controller, active ? { channelId: active.id } : "selection", active?.name ?? "selection")),
5944
+ onClick: () => attempt(() => (0, import_image_editor18.downloadMaskImage)(controller, active ? { channelId: active.id } : "selection", active?.name ?? "selection")),
5734
5945
  children: "Export PNG"
5735
5946
  }
5736
5947
  ),
5737
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5948
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
5738
5949
  "input",
5739
5950
  {
5740
5951
  ref: fileInput,
5741
5952
  type: "file",
5742
- accept: import_image_editor17.MASK_FILE_ACCEPT,
5953
+ accept: import_image_editor18.MASK_FILE_ACCEPT,
5743
5954
  hidden: true,
5744
5955
  "data-testid": "channel-import-input",
5745
5956
  onChange: (e) => {
@@ -5749,18 +5960,18 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
5749
5960
  }
5750
5961
  )
5751
5962
  ] }),
5752
- error && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { role: "alert", className: "text-destructive", children: error })
5963
+ error && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("p", { role: "alert", className: "text-destructive", children: error })
5753
5964
  ] });
5754
5965
  };
5755
5966
 
5756
5967
  // src/image-editor/FreeTransformOptionsBar.tsx
5757
- var import_react29 = require("react");
5758
- var import_image_editor18 = require("@pixerate/editor/image-editor");
5759
- var import_jsx_runtime29 = require("react/jsx-runtime");
5968
+ var import_react30 = require("react");
5969
+ var import_image_editor19 = require("@pixerate/editor/image-editor");
5970
+ var import_jsx_runtime30 = require("react/jsx-runtime");
5760
5971
  var round = (v, unit) => unit === "px" ? Math.round(v * 10) / 10 : Math.round(v * 100) / 100;
5761
5972
  var FreeTransformOptionsBar = ({ tool, className }) => {
5762
- const [, setTick] = (0, import_react29.useState)(0);
5763
- (0, import_react29.useEffect)(() => tool.subscribe(() => setTick((n) => n + 1)), [tool]);
5973
+ const [, setTick] = (0, import_react30.useState)(0);
5974
+ (0, import_react30.useEffect)(() => tool.subscribe(() => setTick((n) => n + 1)), [tool]);
5764
5975
  const bar = tool.bar();
5765
5976
  if (!tool.active || !bar) return null;
5766
5977
  const warp = tool.warpBar();
@@ -5772,17 +5983,17 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
5772
5983
  const v = Number(raw);
5773
5984
  if (raw.trim() !== "" && Number.isFinite(v) && Math.abs(v - bar[field]) > 1e-9) tool.setField(field, v);
5774
5985
  };
5775
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: `flex flex-wrap items-center gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "free-transform-options", role: "toolbar", "aria-label": "Free Transform options", children: [
5776
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "flex gap-1", role: "group", "aria-label": "Transform mode", children: import_image_editor18.FREE_TRANSFORM_MODE_OPTIONS.map((m) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("button", { type: "button", title: m.title, "aria-pressed": tool.mode === m.id, className: imageChipClass(tool.mode === m.id), onClick: () => tool.setMode(m.id), children: m.label }, m.id)) }),
5777
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "grid grid-cols-3 gap-px", role: "group", "aria-label": "Reference point", children: import_image_editor18.TRANSFORM_ANCHORS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("button", { type: "button", "aria-label": `Reference point ${a}`, title: `Reference point: ${a}`, className: "h-2.5 w-2.5 rounded-sm bg-accent hover:bg-primary/90", onClick: () => tool.setReference(a) }, a)) }),
5778
- tool.mode === "warp" && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex flex-wrap items-center gap-2", role: "group", "aria-label": "Warp options", children: [
5779
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex items-center gap-1", children: [
5780
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "text-muted-foreground", children: "Warp" }),
5781
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("select", { "aria-label": "Warp style", value: warp.style, onChange: (e) => tool.setWarp({ style: e.target.value }), className: imageFieldClass, children: import_image_editor18.WARP_STYLE_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("option", { value: o.id, children: o.label }, o.id)) })
5986
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: `flex flex-wrap items-center gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "free-transform-options", role: "toolbar", "aria-label": "Free Transform options", children: [
5987
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "flex gap-1", role: "group", "aria-label": "Transform mode", children: import_image_editor19.FREE_TRANSFORM_MODE_OPTIONS.map((m) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", title: m.title, "aria-pressed": tool.mode === m.id, className: imageChipClass(tool.mode === m.id), onClick: () => tool.setMode(m.id), children: m.label }, m.id)) }),
5988
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "grid grid-cols-3 gap-px", role: "group", "aria-label": "Reference point", children: import_image_editor19.TRANSFORM_ANCHORS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", "aria-label": `Reference point ${a}`, title: `Reference point: ${a}`, className: "h-2.5 w-2.5 rounded-sm bg-accent hover:bg-primary/90", onClick: () => tool.setReference(a) }, a)) }),
5989
+ tool.mode === "warp" && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex flex-wrap items-center gap-2", role: "group", "aria-label": "Warp options", children: [
5990
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-1", children: [
5991
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "text-muted-foreground", children: "Warp" }),
5992
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("select", { "aria-label": "Warp style", value: warp.style, onChange: (e) => tool.setWarp({ style: e.target.value }), className: imageFieldClass, children: import_image_editor19.WARP_STYLE_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("option", { value: o.id, children: o.label }, o.id)) })
5782
5993
  ] }),
5783
- ["bend", "horizontal", "vertical"].map((k) => /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex items-center gap-1", children: [
5784
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "text-muted-foreground", children: k === "bend" ? "Bend" : k === "horizontal" ? "H" : "V" }),
5785
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
5994
+ ["bend", "horizontal", "vertical"].map((k) => /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-1", children: [
5995
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "text-muted-foreground", children: k === "bend" ? "Bend" : k === "horizontal" ? "H" : "V" }),
5996
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5786
5997
  "input",
5787
5998
  {
5788
5999
  type: "number",
@@ -5803,9 +6014,9 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
5803
6014
  },
5804
6015
  `${k}:${warp[k]}`
5805
6016
  ),
5806
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "text-muted-foreground", children: "%" })
6017
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "text-muted-foreground", children: "%" })
5807
6018
  ] }, k)),
5808
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
6019
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5809
6020
  "button",
5810
6021
  {
5811
6022
  type: "button",
@@ -5817,26 +6028,26 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
5817
6028
  children: "Vertical"
5818
6029
  }
5819
6030
  ),
5820
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex items-center gap-1", children: [
5821
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "text-muted-foreground", children: "Grid" }),
5822
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
6031
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-1", children: [
6032
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "text-muted-foreground", children: "Grid" }),
6033
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5823
6034
  "select",
5824
6035
  {
5825
6036
  "aria-label": "Warp grid",
5826
- value: import_image_editor18.WARP_GRID_OPTIONS.find((g) => g.columns === warp.columns && g.rows === warp.rows)?.id ?? "1x1",
6037
+ value: import_image_editor19.WARP_GRID_OPTIONS.find((g) => g.columns === warp.columns && g.rows === warp.rows)?.id ?? "1x1",
5827
6038
  onChange: (e) => {
5828
- const g = import_image_editor18.WARP_GRID_OPTIONS.find((o) => o.id === e.target.value);
6039
+ const g = import_image_editor19.WARP_GRID_OPTIONS.find((o) => o.id === e.target.value);
5829
6040
  tool.setWarp({ columns: g.columns, rows: g.rows });
5830
6041
  },
5831
6042
  className: imageFieldClass,
5832
- children: import_image_editor18.WARP_GRID_OPTIONS.map((g) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("option", { value: g.id, children: g.label }, g.id))
6043
+ children: import_image_editor19.WARP_GRID_OPTIONS.map((g) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("option", { value: g.id, children: g.label }, g.id))
5833
6044
  }
5834
6045
  )
5835
6046
  ] })
5836
6047
  ] }),
5837
- tool.mode !== "warp" && import_image_editor18.FREE_TRANSFORM_FIELDS.map((f) => /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex items-center gap-1", title: f.title, children: [
5838
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "text-muted-foreground", children: f.label }),
5839
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
6048
+ tool.mode !== "warp" && import_image_editor19.FREE_TRANSFORM_FIELDS.map((f) => /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-1", title: f.title, children: [
6049
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "text-muted-foreground", children: f.label }),
6050
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5840
6051
  "input",
5841
6052
  {
5842
6053
  type: "number",
@@ -5856,8 +6067,8 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
5856
6067
  },
5857
6068
  `${f.id}:${round(bar[f.id], f.unit)}`
5858
6069
  ),
5859
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "text-muted-foreground", children: f.unit }),
5860
- f.id === "scaleX" && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
6070
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "text-muted-foreground", children: f.unit }),
6071
+ f.id === "scaleX" && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5861
6072
  "button",
5862
6073
  {
5863
6074
  type: "button",
@@ -5872,33 +6083,33 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
5872
6083
  }
5873
6084
  )
5874
6085
  ] }, f.id)),
5875
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex items-center gap-1", children: [
5876
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "text-muted-foreground", children: "Interpolation" }),
5877
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
6086
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-1", children: [
6087
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "text-muted-foreground", children: "Interpolation" }),
6088
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5878
6089
  "select",
5879
6090
  {
5880
6091
  "aria-label": "Interpolation",
5881
6092
  value: tool.interpolation,
5882
6093
  onChange: (e) => tool.setInterpolation(e.target.value),
5883
6094
  className: imageFieldClass,
5884
- children: import_image_editor18.INTERPOLATIONS.map((i) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("option", { value: i, children: i[0].toUpperCase() + i.slice(1) }, i))
6095
+ children: import_image_editor19.INTERPOLATIONS.map((i) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("option", { value: i, children: i[0].toUpperCase() + i.slice(1) }, i))
5885
6096
  }
5886
6097
  )
5887
6098
  ] }),
5888
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("button", { type: "button", title: "Commit (Enter)", className: "px-2 py-1 rounded bg-primary text-primary-foreground hover:bg-primary/90", onClick: () => tool.commit(), children: "Commit" }),
5889
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("button", { type: "button", title: "Cancel (Esc)", className: imageChipClass(false), onClick: () => tool.cancel(), children: "Cancel" }),
5890
- tool.error && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { role: "alert", className: "text-destructive", children: tool.error })
6099
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", title: "Commit (Enter)", className: "px-2 py-1 rounded bg-primary text-primary-foreground hover:bg-primary/90", onClick: () => tool.commit(), children: "Commit" }),
6100
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", title: "Cancel (Esc)", className: imageChipClass(false), onClick: () => tool.cancel(), children: "Cancel" }),
6101
+ tool.error && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { role: "alert", className: "text-destructive", children: tool.error })
5891
6102
  ] });
5892
6103
  };
5893
6104
 
5894
6105
  // src/image-editor/ShapeOptionsBar.tsx
5895
- var import_react30 = require("react");
5896
- var import_image_editor19 = require("@pixerate/editor/image-editor");
5897
- var import_jsx_runtime30 = require("react/jsx-runtime");
6106
+ var import_react31 = require("react");
6107
+ var import_image_editor20 = require("@pixerate/editor/image-editor");
6108
+ var import_jsx_runtime31 = require("react/jsx-runtime");
5898
6109
  var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
5899
- const [, setTick] = (0, import_react30.useState)(0);
5900
- (0, import_react30.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
5901
- const [error, setError] = (0, import_react30.useState)(null);
6110
+ const [, setTick] = (0, import_react31.useState)(0);
6111
+ (0, import_react31.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
6112
+ const [error, setError] = (0, import_react31.useState)(null);
5902
6113
  const active = controller.getActiveLayer();
5903
6114
  const shapeId = active?.type === "shape" ? active.id : null;
5904
6115
  const set = (change) => {
@@ -5906,28 +6117,28 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
5906
6117
  if (!shapeId) return;
5907
6118
  try {
5908
6119
  setError(null);
5909
- (0, import_image_editor19.applyShapeOptions)(controller, shapeId, change);
6120
+ (0, import_image_editor20.applyShapeOptions)(controller, shapeId, change);
5910
6121
  } catch (e) {
5911
6122
  setError(e instanceof Error ? e.message : String(e));
5912
6123
  }
5913
6124
  };
5914
6125
  const num = (v, min, max) => Math.max(min, Math.min(max, Number(v) || min));
5915
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "shape-options", children: [
5916
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Shape kind", children: import_image_editor19.LIVE_SHAPE_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", "aria-pressed": options.kind === k, className: imageChipClass(options.kind === k), onClick: () => onChange({ ...options, kind: k }), children: import_image_editor19.SHAPE_KIND_LABELS[k] }, k)) }),
5917
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
5918
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-1", children: [
5919
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ImageCheckbox, { label: "Fill", checked: options.fill !== null, onChange: (on) => set({ fill: on ? "#4f46e5" : null }) }),
6126
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "shape-options", children: [
6127
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Shape kind", children: import_image_editor20.LIVE_SHAPE_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("button", { type: "button", "aria-pressed": options.kind === k, className: imageChipClass(options.kind === k), onClick: () => onChange({ ...options, kind: k }), children: import_image_editor20.SHAPE_KIND_LABELS[k] }, k)) }),
6128
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
6129
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "flex items-center gap-1", children: [
6130
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ImageCheckbox, { label: "Fill", checked: options.fill !== null, onChange: (on) => set({ fill: on ? "#4f46e5" : null }) }),
5920
6131
  "Fill",
5921
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ImageColor, { label: "Fill colour", disabled: options.fill === null, value: options.fill ?? "#4f46e5", onChange: (fill) => set({ fill }) })
6132
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ImageColor, { label: "Fill colour", disabled: options.fill === null, value: options.fill ?? "#4f46e5", onChange: (fill) => set({ fill }) })
5922
6133
  ] }),
5923
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-1", children: [
5924
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ImageCheckbox, { label: "Stroke", checked: options.stroke !== null, onChange: (on) => set({ stroke: on ? "#000000" : null }) }),
6134
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "flex items-center gap-1", children: [
6135
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ImageCheckbox, { label: "Stroke", checked: options.stroke !== null, onChange: (on) => set({ stroke: on ? "#000000" : null }) }),
5925
6136
  "Stroke",
5926
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ImageColor, { label: "Stroke colour", disabled: options.stroke === null, value: options.stroke ?? "#000000", onChange: (stroke) => set({ stroke }) })
6137
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ImageColor, { label: "Stroke colour", disabled: options.stroke === null, value: options.stroke ?? "#000000", onChange: (stroke) => set({ stroke }) })
5927
6138
  ] }),
5928
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-1", children: [
6139
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "flex items-center gap-1", children: [
5929
6140
  "Width",
5930
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
6141
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
5931
6142
  "input",
5932
6143
  {
5933
6144
  type: "number",
@@ -5941,52 +6152,52 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
5941
6152
  )
5942
6153
  ] })
5943
6154
  ] }),
5944
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
5945
- options.kind === "rect" && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-1", children: [
6155
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
6156
+ options.kind === "rect" && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "flex items-center gap-1", children: [
5946
6157
  "Radius",
5947
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("input", { type: "number", "aria-label": "Corner radius", min: 0, max: 1e3, value: options.radius, onChange: (e) => set({ radius: num(e.target.value, 0, 1e3) }), className: `w-14 ${imageFieldClass}` })
6158
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("input", { type: "number", "aria-label": "Corner radius", min: 0, max: 1e3, value: options.radius, onChange: (e) => set({ radius: num(e.target.value, 0, 1e3) }), className: `w-14 ${imageFieldClass}` })
5948
6159
  ] }),
5949
- options.kind === "polygon" && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-1", children: [
6160
+ options.kind === "polygon" && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "flex items-center gap-1", children: [
5950
6161
  "Sides",
5951
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("input", { type: "number", "aria-label": "Sides", min: 3, max: 100, value: options.sides, onChange: (e) => set({ sides: num(e.target.value, 3, 100) }), className: `w-14 ${imageFieldClass}` })
6162
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("input", { type: "number", "aria-label": "Sides", min: 3, max: 100, value: options.sides, onChange: (e) => set({ sides: num(e.target.value, 3, 100) }), className: `w-14 ${imageFieldClass}` })
5952
6163
  ] }),
5953
- options.kind === "star" && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
5954
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-1", children: [
6164
+ options.kind === "star" && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
6165
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "flex items-center gap-1", children: [
5955
6166
  "Points",
5956
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("input", { type: "number", "aria-label": "Points", min: 3, max: 100, value: options.points, onChange: (e) => set({ points: num(e.target.value, 3, 100) }), className: `w-14 ${imageFieldClass}` })
6167
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("input", { type: "number", "aria-label": "Points", min: 3, max: 100, value: options.points, onChange: (e) => set({ points: num(e.target.value, 3, 100) }), className: `w-14 ${imageFieldClass}` })
5957
6168
  ] }),
5958
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-1", children: [
6169
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "flex items-center gap-1", children: [
5959
6170
  "Inner",
5960
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ImageRange, { label: "Inner radius", min: 0.05, max: 1, step: 0.05, value: options.innerRatio, onChange: (v) => set({ innerRatio: v }) })
6171
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ImageRange, { label: "Inner radius", min: 0.05, max: 1, step: 0.05, value: options.innerRatio, onChange: (v) => set({ innerRatio: v }) })
5961
6172
  ] })
5962
6173
  ] }),
5963
- options.kind === "line" && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
5964
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-1", children: [
6174
+ options.kind === "line" && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
6175
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "flex items-center gap-1", children: [
5965
6176
  "Weight",
5966
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("input", { type: "number", "aria-label": "Line weight", min: 1, max: 200, value: options.weight, onChange: (e) => set({ weight: num(e.target.value, 1, 200) }), className: `w-14 ${imageFieldClass}` })
6177
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("input", { type: "number", "aria-label": "Line weight", min: 1, max: 200, value: options.weight, onChange: (e) => set({ weight: num(e.target.value, 1, 200) }), className: `w-14 ${imageFieldClass}` })
5967
6178
  ] }),
5968
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-1", children: [
5969
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ImageCheckbox, { label: "Arrowhead", checked: options.arrow, onChange: (on) => set({ arrow: on }) }),
6179
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "flex items-center gap-1", children: [
6180
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ImageCheckbox, { label: "Arrowhead", checked: options.arrow, onChange: (on) => set({ arrow: on }) }),
5970
6181
  "Arrowhead"
5971
6182
  ] })
5972
6183
  ] })
5973
6184
  ] }),
5974
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { className: "text-[10px] text-muted-foreground", children: "Drag on the image to draw. Shift: square, circle or 45\xB0 line. Alt: from the centre." }),
5975
- error && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { role: "alert", className: "text-destructive", children: error })
6185
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("p", { className: "text-[10px] text-muted-foreground", children: "Drag on the image to draw. Shift: square, circle or 45\xB0 line. Alt: from the centre." }),
6186
+ error && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("p", { role: "alert", className: "text-destructive", children: error })
5976
6187
  ] });
5977
6188
  };
5978
6189
 
5979
6190
  // src/image-editor/TypeOptionsBar.tsx
5980
- var import_react31 = require("react");
5981
- var import_image_editor20 = require("@pixerate/editor/image-editor");
5982
- var import_jsx_runtime31 = require("react/jsx-runtime");
6191
+ var import_react32 = require("react");
6192
+ var import_image_editor21 = require("@pixerate/editor/image-editor");
6193
+ var import_jsx_runtime32 = require("react/jsx-runtime");
5983
6194
  var ALIGN_LABELS = { left: "Left", center: "Centre", right: "Right", justify: "Justify" };
5984
6195
  var ORIENTATION_LABELS = { horizontal: "Horizontal", vertical: "Vertical" };
5985
6196
  var TypeOptionsBar = ({ controller, options, onChange, session, className }) => {
5986
- const [, setTick] = (0, import_react31.useState)(0);
5987
- (0, import_react31.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
5988
- (0, import_react31.useEffect)(() => session?.subscribe(() => setTick((n) => n + 1)), [session]);
5989
- const [error, setError] = (0, import_react31.useState)(null);
6197
+ const [, setTick] = (0, import_react32.useState)(0);
6198
+ (0, import_react32.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
6199
+ (0, import_react32.useEffect)(() => session?.subscribe(() => setTick((n) => n + 1)), [session]);
6200
+ const [error, setError] = (0, import_react32.useState)(null);
5990
6201
  const active = controller.getActiveLayer();
5991
6202
  const typeId = !session && active?.type === "type" ? active.id : null;
5992
6203
  const here = session?.alive ? session.styleHere() : {};
@@ -6039,11 +6250,11 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
6039
6250
  setError(e instanceof Error ? e.message : String(e));
6040
6251
  }
6041
6252
  };
6042
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "type-options", children: [
6043
- /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
6044
- /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "flex items-center gap-1", children: [
6253
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "type-options", children: [
6254
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
6255
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { className: "flex items-center gap-1", children: [
6045
6256
  "Font",
6046
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
6257
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6047
6258
  "input",
6048
6259
  {
6049
6260
  list: "pixerate-type-fonts",
@@ -6053,11 +6264,11 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
6053
6264
  className: "w-32 rounded border border-border bg-background px-1 py-0.5"
6054
6265
  }
6055
6266
  ),
6056
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("datalist", { id: "pixerate-type-fonts", children: fonts.map((f) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("option", { value: f }, f)) })
6267
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("datalist", { id: "pixerate-type-fonts", children: fonts.map((f) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("option", { value: f }, f)) })
6057
6268
  ] }),
6058
- /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "flex items-center gap-1", children: [
6269
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { className: "flex items-center gap-1", children: [
6059
6270
  "Size",
6060
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
6271
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6061
6272
  "input",
6062
6273
  {
6063
6274
  type: "number",
@@ -6070,14 +6281,14 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
6070
6281
  }
6071
6282
  )
6072
6283
  ] }),
6073
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("button", { type: "button", "aria-pressed": shown.fontWeight >= 600, className: `${imageChipClass(shown.fontWeight >= 600)} font-bold`, onClick: () => style({ fontWeight: shown.fontWeight >= 600 ? 400 : 700 }), children: "B" }),
6074
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("button", { type: "button", "aria-pressed": shown.italic, className: `${imageChipClass(shown.italic)} italic`, onClick: () => style({ italic: !shown.italic }), children: "I" }),
6075
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ImageColor, { label: "Text colour", value: shown.color, onChange: (color) => style({ color }) })
6284
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("button", { type: "button", "aria-pressed": shown.fontWeight >= 600, className: `${imageChipClass(shown.fontWeight >= 600)} font-bold`, onClick: () => style({ fontWeight: shown.fontWeight >= 600 ? 400 : 700 }), children: "B" }),
6285
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("button", { type: "button", "aria-pressed": shown.italic, className: `${imageChipClass(shown.italic)} italic`, onClick: () => style({ italic: !shown.italic }), children: "I" }),
6286
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ImageColor, { label: "Text colour", value: shown.color, onChange: (color) => style({ color }) })
6076
6287
  ] }),
6077
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Alignment", children: import_image_editor20.TEXT_ALIGNS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("button", { type: "button", "aria-pressed": options.align === a, className: imageChipClass(options.align === a), onClick: () => style({ align: a }), children: ALIGN_LABELS[a] }, a)) }),
6078
- /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Orientation", children: [
6079
- import_image_editor20.TEXT_ORIENTATIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("button", { type: "button", "aria-pressed": orientation === o, className: imageChipClass(orientation === o), onClick: () => orient(o), children: ORIENTATION_LABELS[o] }, o)),
6080
- orientation === "vertical" && editedId && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
6288
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Alignment", children: import_image_editor21.TEXT_ALIGNS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("button", { type: "button", "aria-pressed": options.align === a, className: imageChipClass(options.align === a), onClick: () => style({ align: a }), children: ALIGN_LABELS[a] }, a)) }),
6289
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Orientation", children: [
6290
+ import_image_editor21.TEXT_ORIENTATIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("button", { type: "button", "aria-pressed": orientation === o, className: imageChipClass(orientation === o), onClick: () => orient(o), children: ORIENTATION_LABELS[o] }, o)),
6291
+ orientation === "vertical" && editedId && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6081
6292
  "button",
6082
6293
  {
6083
6294
  type: "button",
@@ -6089,19 +6300,19 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
6089
6300
  }
6090
6301
  )
6091
6302
  ] }),
6092
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("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." }),
6093
- missing.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("p", { role: "status", className: "text-amber-600", "data-testid": "type-missing-fonts", children: [
6303
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("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." }),
6304
+ missing.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("p", { role: "status", className: "text-amber-600", "data-testid": "type-missing-fonts", children: [
6094
6305
  "Missing ",
6095
6306
  missing.length === 1 ? "font" : "fonts",
6096
6307
  ": ",
6097
6308
  missing.join(", ")
6098
6309
  ] }),
6099
- error && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("p", { role: "alert", className: "text-destructive", children: error })
6310
+ error && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { role: "alert", className: "text-destructive", children: error })
6100
6311
  ] });
6101
6312
  };
6102
6313
 
6103
6314
  // src/image-editor/ImageEditor.tsx
6104
- var import_jsx_runtime32 = require("react/jsx-runtime");
6315
+ var import_jsx_runtime33 = require("react/jsx-runtime");
6105
6316
  var ImageEditor = ({
6106
6317
  editor: externalEditor,
6107
6318
  src,
@@ -6125,51 +6336,51 @@ var ImageEditor = ({
6125
6336
  const effectsShown = !!controller.effectsProvider || state.layers.some(function has(l) {
6126
6337
  return l.type === "pixel" && !!l.generator || l.type === "smart" && !!l.smartFilters?.filters.some((f) => f.kind === "effect") || l.type === "group" && l.children.some(has);
6127
6338
  });
6128
- const legacyProcess = (0, import_image_editor21.normalizeProcessVersion)(state.adjustments.process) < import_image_editor21.LATEST_PROCESS_VERSION;
6129
- const [activeTab, setActiveTab] = (0, import_react32.useState)("crop");
6130
- const rootRef = (0, import_react32.useRef)(null);
6339
+ const legacyProcess = (0, import_image_editor22.normalizeProcessVersion)(state.adjustments.process) < import_image_editor22.LATEST_PROCESS_VERSION;
6340
+ const [activeTab, setActiveTab] = (0, import_react33.useState)("crop");
6341
+ const rootRef = (0, import_react33.useRef)(null);
6131
6342
  const canvasMode = activeTab === "crop" || activeTab === "select" || activeTab === "paint" || activeTab === "annotate" ? activeTab : "none";
6132
- const activeTabRef = (0, import_react32.useRef)(activeTab);
6343
+ const activeTabRef = (0, import_react33.useRef)(activeTab);
6133
6344
  activeTabRef.current = activeTab;
6134
6345
  const openPanel = async (ref) => {
6135
6346
  if (ref.kind !== "panel" || activeTabRef.current === ref.id) return;
6136
6347
  rootRef.current?.querySelector(`[data-image-tab="${CSS.escape(ref.id)}"]`)?.click();
6137
6348
  await new Promise((resolve) => setTimeout(resolve, 60));
6138
6349
  };
6139
- const [activeCropRatio, setActiveCropRatio] = (0, import_react32.useState)(null);
6140
- const [selectionOptions, setSelectionOptions] = (0, import_react32.useState)(import_image_editor21.DEFAULT_SELECTION_TOOL_OPTIONS);
6141
- const [shapeOptions, setShapeOptions] = (0, import_react32.useState)(import_image_editor21.DEFAULT_SHAPE_TOOL_OPTIONS);
6142
- const [typeOptions, setTypeOptions] = (0, import_react32.useState)(import_image_editor21.DEFAULT_TYPE_TOOL_OPTIONS);
6143
- const [typeSession, setTypeSession] = (0, import_react32.useState)(null);
6144
- const [selectionError, setSelectionError] = (0, import_react32.useState)(null);
6145
- const [paintError, setPaintError] = (0, import_react32.useState)(null);
6146
- const [shapeTypeError, setShapeTypeError] = (0, import_react32.useState)(null);
6350
+ const [activeCropRatio, setActiveCropRatio] = (0, import_react33.useState)(null);
6351
+ const [selectionOptions, setSelectionOptions] = (0, import_react33.useState)(import_image_editor22.DEFAULT_SELECTION_TOOL_OPTIONS);
6352
+ const [shapeOptions, setShapeOptions] = (0, import_react33.useState)(import_image_editor22.DEFAULT_SHAPE_TOOL_OPTIONS);
6353
+ const [typeOptions, setTypeOptions] = (0, import_react33.useState)(import_image_editor22.DEFAULT_TYPE_TOOL_OPTIONS);
6354
+ const [typeSession, setTypeSession] = (0, import_react33.useState)(null);
6355
+ const [selectionError, setSelectionError] = (0, import_react33.useState)(null);
6356
+ const [paintError, setPaintError] = (0, import_react33.useState)(null);
6357
+ const [shapeTypeError, setShapeTypeError] = (0, import_react33.useState)(null);
6147
6358
  const handleCanvasError = (source, message) => {
6148
6359
  if (source === "paint") setPaintError(message);
6149
6360
  else if (source === "select") setSelectionError(message);
6150
6361
  else setShapeTypeError(message);
6151
6362
  };
6152
6363
  const finishTyping = () => setTypeSession(null);
6153
- const transformToolRef = (0, import_react32.useRef)(null);
6154
- const transformControllerRef = (0, import_react32.useRef)(controller);
6364
+ const transformToolRef = (0, import_react33.useRef)(null);
6365
+ const transformControllerRef = (0, import_react33.useRef)(controller);
6155
6366
  if (!transformToolRef.current || transformControllerRef.current !== controller) {
6156
6367
  transformToolRef.current?.cancel();
6157
- transformToolRef.current = new import_image_editor21.FreeTransformTool(controller, {
6368
+ transformToolRef.current = new import_image_editor22.FreeTransformTool(controller, {
6158
6369
  schedule: (run) => typeof requestAnimationFrame !== "undefined" ? requestAnimationFrame(run) : run()
6159
6370
  });
6160
6371
  transformControllerRef.current = controller;
6161
6372
  }
6162
6373
  const transformTool = transformToolRef.current;
6163
- const [, setTransformTick] = (0, import_react32.useState)(0);
6164
- (0, import_react32.useEffect)(() => transformTool.subscribe(() => setTransformTick((n) => n + 1)), [transformTool]);
6165
- (0, import_react32.useEffect)(() => () => transformToolRef.current?.cancel(), []);
6166
- const [inpaintPrompt, setInpaintPrompt] = (0, import_react32.useState)("");
6167
- const [inpaintMaskMode, setInpaintMaskMode] = (0, import_react32.useState)("annotations");
6168
- const [isRemovingBg, setIsRemovingBg] = (0, import_react32.useState)(false);
6169
- const [isInpainting, setIsInpainting] = (0, import_react32.useState)(false);
6170
- const [aiError, setAiError] = (0, import_react32.useState)(null);
6171
- const [aiSuccess, setAiSuccess] = (0, import_react32.useState)(null);
6172
- const [aiTarget, setAiTarget] = (0, import_react32.useState)("auto");
6374
+ const [, setTransformTick] = (0, import_react33.useState)(0);
6375
+ (0, import_react33.useEffect)(() => transformTool.subscribe(() => setTransformTick((n) => n + 1)), [transformTool]);
6376
+ (0, import_react33.useEffect)(() => () => transformToolRef.current?.cancel(), []);
6377
+ const [inpaintPrompt, setInpaintPrompt] = (0, import_react33.useState)("");
6378
+ const [inpaintMaskMode, setInpaintMaskMode] = (0, import_react33.useState)("annotations");
6379
+ const [isRemovingBg, setIsRemovingBg] = (0, import_react33.useState)(false);
6380
+ const [isInpainting, setIsInpainting] = (0, import_react33.useState)(false);
6381
+ const [aiError, setAiError] = (0, import_react33.useState)(null);
6382
+ const [aiSuccess, setAiSuccess] = (0, import_react33.useState)(null);
6383
+ const [aiTarget, setAiTarget] = (0, import_react33.useState)("auto");
6173
6384
  const aiOptions = aiTarget === "auto" ? {} : { target: aiTarget };
6174
6385
  const effectiveOnInpaint = onInpaint || aiHooks?.onInpaint;
6175
6386
  const effectiveOnRemoveBg = onRemoveBackground || aiHooks?.onRemoveBackground;
@@ -6232,11 +6443,11 @@ var ImageEditor = ({
6232
6443
  setIsInpainting(false);
6233
6444
  }
6234
6445
  };
6235
- const [activeColor, setActiveColor] = (0, import_react32.useState)("#ef4444");
6236
- const [strokeWidth, setStrokeWidth] = (0, import_react32.useState)(3);
6237
- const [fontSize, setFontSize] = (0, import_react32.useState)(24);
6238
- const [textInput, setTextInput] = (0, import_react32.useState)("");
6239
- (0, import_react32.useEffect)(() => {
6446
+ const [activeColor, setActiveColor] = (0, import_react33.useState)("#ef4444");
6447
+ const [strokeWidth, setStrokeWidth] = (0, import_react33.useState)(3);
6448
+ const [fontSize, setFontSize] = (0, import_react33.useState)(24);
6449
+ const [textInput, setTextInput] = (0, import_react33.useState)("");
6450
+ (0, import_react33.useEffect)(() => {
6240
6451
  if (activeTab === "crop" && editor.state.activeTool !== "crop") {
6241
6452
  editor.setTool("crop");
6242
6453
  }
@@ -6264,16 +6475,16 @@ var ImageEditor = ({
6264
6475
  link.click();
6265
6476
  }
6266
6477
  };
6267
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
6478
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
6268
6479
  "div",
6269
6480
  {
6270
6481
  ref: rootRef,
6271
6482
  className: `${imageEditorFrameClass} ${className}`,
6272
6483
  style,
6273
6484
  children: [
6274
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: imageEditorHeaderClass, children: [
6275
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { role: "tablist", className: imageTabListClass, children: [
6276
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6485
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: imageEditorHeaderClass, children: [
6486
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { role: "tablist", className: imageTabListClass, children: [
6487
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6277
6488
  "button",
6278
6489
  {
6279
6490
  type: "button",
@@ -6288,7 +6499,7 @@ var ImageEditor = ({
6288
6499
  children: "Transform & Crop"
6289
6500
  }
6290
6501
  ),
6291
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6502
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6292
6503
  "button",
6293
6504
  {
6294
6505
  type: "button",
@@ -6303,7 +6514,7 @@ var ImageEditor = ({
6303
6514
  children: "Adjustments"
6304
6515
  }
6305
6516
  ),
6306
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6517
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6307
6518
  "button",
6308
6519
  {
6309
6520
  type: "button",
@@ -6318,7 +6529,7 @@ var ImageEditor = ({
6318
6529
  children: "Layers"
6319
6530
  }
6320
6531
  ),
6321
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6532
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6322
6533
  "button",
6323
6534
  {
6324
6535
  type: "button",
@@ -6333,7 +6544,7 @@ var ImageEditor = ({
6333
6544
  children: "Paint"
6334
6545
  }
6335
6546
  ),
6336
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6547
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6337
6548
  "button",
6338
6549
  {
6339
6550
  type: "button",
@@ -6348,7 +6559,7 @@ var ImageEditor = ({
6348
6559
  children: "Select & Mask"
6349
6560
  }
6350
6561
  ),
6351
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6562
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6352
6563
  "button",
6353
6564
  {
6354
6565
  type: "button",
@@ -6363,7 +6574,7 @@ var ImageEditor = ({
6363
6574
  children: "Annotations"
6364
6575
  }
6365
6576
  ),
6366
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6577
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6367
6578
  "button",
6368
6579
  {
6369
6580
  type: "button",
@@ -6378,7 +6589,7 @@ var ImageEditor = ({
6378
6589
  children: "Depth Mask"
6379
6590
  }
6380
6591
  ),
6381
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
6592
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
6382
6593
  "button",
6383
6594
  {
6384
6595
  type: "button",
@@ -6391,14 +6602,14 @@ var ImageEditor = ({
6391
6602
  "aria-selected": activeTab === "ai",
6392
6603
  className: `${imageTabClass(activeTab === "ai")} flex items-center gap-1.5`,
6393
6604
  children: [
6394
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("path", { d: "M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83" }) }),
6605
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("path", { d: "M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83" }) }),
6395
6606
  "AI Tools"
6396
6607
  ]
6397
6608
  }
6398
6609
  )
6399
6610
  ] }),
6400
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex items-center gap-2 text-xs", children: [
6401
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6611
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex items-center gap-2 text-xs", children: [
6612
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6402
6613
  "button",
6403
6614
  {
6404
6615
  type: "button",
@@ -6409,7 +6620,7 @@ var ImageEditor = ({
6409
6620
  children: "\u21A9"
6410
6621
  }
6411
6622
  ),
6412
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6623
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6413
6624
  "button",
6414
6625
  {
6415
6626
  type: "button",
@@ -6420,7 +6631,7 @@ var ImageEditor = ({
6420
6631
  children: "\u21AA"
6421
6632
  }
6422
6633
  ),
6423
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6634
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6424
6635
  "button",
6425
6636
  {
6426
6637
  type: "button",
@@ -6429,8 +6640,8 @@ var ImageEditor = ({
6429
6640
  children: "Reset"
6430
6641
  }
6431
6642
  ),
6432
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "h-4 w-px bg-muted mx-1" }),
6433
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6643
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "h-4 w-px bg-muted mx-1" }),
6644
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6434
6645
  "button",
6435
6646
  {
6436
6647
  type: "button",
@@ -6440,11 +6651,11 @@ var ImageEditor = ({
6440
6651
  children: "-"
6441
6652
  }
6442
6653
  ),
6443
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("span", { className: "font-mono text-muted-foreground w-10 text-center", children: [
6654
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("span", { className: "font-mono text-muted-foreground w-10 text-center", children: [
6444
6655
  Math.round(state.zoom * 100),
6445
6656
  "%"
6446
6657
  ] }),
6447
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6658
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6448
6659
  "button",
6449
6660
  {
6450
6661
  type: "button",
@@ -6454,8 +6665,8 @@ var ImageEditor = ({
6454
6665
  children: "+"
6455
6666
  }
6456
6667
  ),
6457
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "h-4 w-px bg-muted mx-1" }),
6458
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6668
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "h-4 w-px bg-muted mx-1" }),
6669
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6459
6670
  "button",
6460
6671
  {
6461
6672
  type: "button",
@@ -6466,7 +6677,7 @@ var ImageEditor = ({
6466
6677
  children: "Hold Compare"
6467
6678
  }
6468
6679
  ),
6469
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6680
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6470
6681
  "button",
6471
6682
  {
6472
6683
  type: "button",
@@ -6477,10 +6688,10 @@ var ImageEditor = ({
6477
6688
  )
6478
6689
  ] })
6479
6690
  ] }),
6480
- transformTool.active && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(FreeTransformOptionsBar, { tool: transformTool, className: "border-b border-border bg-background/95 px-4 py-2" }),
6481
- !transformTool.active && transformTool.error && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { role: "alert", className: imageErrorBannerClass, children: transformTool.error }),
6482
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex flex-col md:flex-row flex-1 min-h-[520px] md:h-[560px]", children: [
6483
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6691
+ transformTool.active && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(FreeTransformOptionsBar, { tool: transformTool, className: "border-b border-border bg-background/95 px-4 py-2" }),
6692
+ !transformTool.active && transformTool.error && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { role: "alert", className: imageErrorBannerClass, children: transformTool.error }),
6693
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex flex-col md:flex-row flex-1 min-h-[520px] md:h-[560px]", children: [
6694
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6484
6695
  ImageEditorCanvas,
6485
6696
  {
6486
6697
  editor,
@@ -6504,11 +6715,11 @@ var ImageEditor = ({
6504
6715
  className: "flex-1 h-[360px] md:h-full min-h-[320px] bg-muted"
6505
6716
  }
6506
6717
  ),
6507
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: imageSidebarClass, children: [
6508
- activeTab === "crop" && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
6509
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: imageSectionTitleClass, children: "Aspect Ratio Presets" }),
6510
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "grid grid-cols-3 gap-2", children: [
6511
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6718
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: imageSidebarClass, children: [
6719
+ activeTab === "crop" && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
6720
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: imageSectionTitleClass, children: "Aspect Ratio Presets" }),
6721
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "grid grid-cols-3 gap-2", children: [
6722
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6512
6723
  "button",
6513
6724
  {
6514
6725
  type: "button",
@@ -6520,7 +6731,7 @@ var ImageEditor = ({
6520
6731
  children: "Freeform"
6521
6732
  }
6522
6733
  ),
6523
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6734
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6524
6735
  "button",
6525
6736
  {
6526
6737
  type: "button",
@@ -6532,7 +6743,7 @@ var ImageEditor = ({
6532
6743
  children: "1:1 Square"
6533
6744
  }
6534
6745
  ),
6535
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6746
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6536
6747
  "button",
6537
6748
  {
6538
6749
  type: "button",
@@ -6544,7 +6755,7 @@ var ImageEditor = ({
6544
6755
  children: "4:3 Standard"
6545
6756
  }
6546
6757
  ),
6547
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6758
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6548
6759
  "button",
6549
6760
  {
6550
6761
  type: "button",
@@ -6556,7 +6767,7 @@ var ImageEditor = ({
6556
6767
  children: "16:9 Wide"
6557
6768
  }
6558
6769
  ),
6559
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6770
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6560
6771
  "button",
6561
6772
  {
6562
6773
  type: "button",
@@ -6568,7 +6779,7 @@ var ImageEditor = ({
6568
6779
  children: "3:2 Photo"
6569
6780
  }
6570
6781
  ),
6571
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6782
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6572
6783
  "button",
6573
6784
  {
6574
6785
  type: "button",
@@ -6581,10 +6792,10 @@ var ImageEditor = ({
6581
6792
  }
6582
6793
  )
6583
6794
  ] }),
6584
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: imageDividerClass }),
6585
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: imageSectionTitleClass, children: "Orientation & Flips" }),
6586
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "grid grid-cols-2 gap-2", children: [
6587
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6795
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: imageDividerClass }),
6796
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: imageSectionTitleClass, children: "Orientation & Flips" }),
6797
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "grid grid-cols-2 gap-2", children: [
6798
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6588
6799
  "button",
6589
6800
  {
6590
6801
  type: "button",
@@ -6593,7 +6804,7 @@ var ImageEditor = ({
6593
6804
  children: "Rotate -90\xB0"
6594
6805
  }
6595
6806
  ),
6596
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6807
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6597
6808
  "button",
6598
6809
  {
6599
6810
  type: "button",
@@ -6602,7 +6813,7 @@ var ImageEditor = ({
6602
6813
  children: "Rotate +90\xB0"
6603
6814
  }
6604
6815
  ),
6605
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6816
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6606
6817
  "button",
6607
6818
  {
6608
6819
  type: "button",
@@ -6611,7 +6822,7 @@ var ImageEditor = ({
6611
6822
  children: "Flip Horizontal"
6612
6823
  }
6613
6824
  ),
6614
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6825
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6615
6826
  "button",
6616
6827
  {
6617
6828
  type: "button",
@@ -6622,10 +6833,10 @@ var ImageEditor = ({
6622
6833
  )
6623
6834
  ] })
6624
6835
  ] }),
6625
- activeTab === "adjust" && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
6626
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex items-center justify-between", children: [
6627
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: imageSectionTitleClass, children: "Color Adjustments" }),
6628
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6836
+ activeTab === "adjust" && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
6837
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex items-center justify-between", children: [
6838
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: imageSectionTitleClass, children: "Color Adjustments" }),
6839
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6629
6840
  "button",
6630
6841
  {
6631
6842
  type: "button",
@@ -6635,25 +6846,25 @@ var ImageEditor = ({
6635
6846
  }
6636
6847
  )
6637
6848
  ] }),
6638
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Histogram, { histogram: editor.histogram }),
6639
- import_image_editor21.IMAGE_ADJUSTMENT_CONTROLS.map((spec) => /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_react32.default.Fragment, { children: [
6640
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6849
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Histogram, { histogram: editor.histogram }),
6850
+ import_image_editor22.IMAGE_ADJUSTMENT_CONTROLS.map((spec) => /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_react33.default.Fragment, { children: [
6851
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6641
6852
  ControlSlider,
6642
6853
  {
6643
6854
  spec,
6644
- value: (0, import_image_editor21.readAdjustmentControls)(state.adjustments)[spec.id],
6855
+ value: (0, import_image_editor22.readAdjustmentControls)(state.adjustments)[spec.id],
6645
6856
  disabled: spec.requiresProcess !== void 0 && legacyProcess,
6646
6857
  onChange: (v) => editor.setAdjustments({ [spec.id]: v })
6647
6858
  }
6648
6859
  ),
6649
- spec.id === "tint" && legacyProcess && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
6860
+ spec.id === "tint" && legacyProcess && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
6650
6861
  "div",
6651
6862
  {
6652
6863
  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",
6653
6864
  "data-testid": "image-editor-process-notice",
6654
6865
  children: [
6655
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { children: "Legacy rendering (process 1). Tint needs the current process." }),
6656
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6866
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { children: "Legacy rendering (process 1). Tint needs the current process." }),
6867
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6657
6868
  "button",
6658
6869
  {
6659
6870
  type: "button",
@@ -6666,7 +6877,7 @@ var ImageEditor = ({
6666
6877
  }
6667
6878
  )
6668
6879
  ] }, spec.id)),
6669
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: imageSectionClass, children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6880
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: imageSectionClass, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6670
6881
  AdjustmentLayersPanel,
6671
6882
  {
6672
6883
  controller,
@@ -6675,9 +6886,9 @@ var ImageEditor = ({
6675
6886
  }
6676
6887
  ) })
6677
6888
  ] }),
6678
- activeTab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
6679
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: imageSectionTitleClass, children: "Layers" }),
6680
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6889
+ activeTab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
6890
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: imageSectionTitleClass, children: "Layers" }),
6891
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6681
6892
  "button",
6682
6893
  {
6683
6894
  type: "button",
@@ -6688,15 +6899,15 @@ var ImageEditor = ({
6688
6899
  children: "Free Transform"
6689
6900
  }
6690
6901
  ),
6691
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(LayersPanel, { controller }),
6692
- effectsShown && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ImageProviderEffectsPanel, { controller, className: imageSectionClass }),
6693
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: imageSectionTitleClass, children: "Colour" }),
6694
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ColorProfilePanel, { controller })
6902
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(LayersPanel, { controller }),
6903
+ effectsShown && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ImageProviderEffectsPanel, { controller, className: imageSectionClass }),
6904
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: imageSectionTitleClass, children: "Colour" }),
6905
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ColorProfilePanel, { controller })
6695
6906
  ] }),
6696
- activeTab === "paint" && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
6697
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: imageSectionTitleClass, children: "Paint" }),
6698
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(BrushOptionsBar, { controller }),
6699
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6907
+ activeTab === "paint" && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
6908
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: imageSectionTitleClass, children: "Paint" }),
6909
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(BrushOptionsBar, { controller }),
6910
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6700
6911
  "button",
6701
6912
  {
6702
6913
  type: "button",
@@ -6707,12 +6918,12 @@ var ImageEditor = ({
6707
6918
  children: "Free Transform"
6708
6919
  }
6709
6920
  ),
6710
- paintError && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { role: "alert", className: "text-destructive", "data-testid": "paint-error", children: paintError }),
6711
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: imageSectionClass, children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(LayersPanel, { controller }) })
6921
+ paintError && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { role: "alert", className: "text-destructive", "data-testid": "paint-error", children: paintError }),
6922
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: imageSectionClass, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(LayersPanel, { controller }) })
6712
6923
  ] }),
6713
- activeTab === "annotate" && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
6714
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: imageSectionTitleClass, children: "Shape & Type Layers" }),
6715
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "grid grid-cols-2 gap-1.5", children: ["shape", "type"].map((t) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6924
+ activeTab === "annotate" && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
6925
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: imageSectionTitleClass, children: "Shape & Type Layers" }),
6926
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "grid grid-cols-2 gap-1.5", children: ["shape", "type"].map((t) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6716
6927
  "button",
6717
6928
  {
6718
6929
  type: "button",
@@ -6723,13 +6934,13 @@ var ImageEditor = ({
6723
6934
  },
6724
6935
  t
6725
6936
  )) }),
6726
- state.activeTool === "shape" && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ShapeOptionsBar, { controller, options: shapeOptions, onChange: setShapeOptions }),
6727
- state.activeTool === "type" && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TypeOptionsBar, { controller, options: typeOptions, onChange: setTypeOptions, session: typeSession }),
6728
- state.activeTool === "type" && typeSession && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("button", { type: "button", onClick: finishTyping, className: "self-start rounded bg-muted px-2 py-1 text-[11px] text-foreground hover:bg-accent", children: "Done editing text" }),
6729
- shapeTypeError && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { role: "alert", className: "text-destructive", "data-testid": "shape-type-error", children: shapeTypeError }),
6730
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: imageDividerClass }),
6731
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: imageSectionTitleClass, children: "Draw & Annotate" }),
6732
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "grid grid-cols-3 gap-1.5", children: ["pen", "rect", "circle", "arrow", "line"].map((t) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6937
+ state.activeTool === "shape" && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ShapeOptionsBar, { controller, options: shapeOptions, onChange: setShapeOptions }),
6938
+ state.activeTool === "type" && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(TypeOptionsBar, { controller, options: typeOptions, onChange: setTypeOptions, session: typeSession }),
6939
+ state.activeTool === "type" && typeSession && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("button", { type: "button", onClick: finishTyping, className: "self-start rounded bg-muted px-2 py-1 text-[11px] text-foreground hover:bg-accent", children: "Done editing text" }),
6940
+ shapeTypeError && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { role: "alert", className: "text-destructive", "data-testid": "shape-type-error", children: shapeTypeError }),
6941
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: imageDividerClass }),
6942
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: imageSectionTitleClass, children: "Draw & Annotate" }),
6943
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "grid grid-cols-3 gap-1.5", children: ["pen", "rect", "circle", "arrow", "line"].map((t) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6733
6944
  "button",
6734
6945
  {
6735
6946
  type: "button",
@@ -6739,18 +6950,18 @@ var ImageEditor = ({
6739
6950
  },
6740
6951
  t
6741
6952
  )) }),
6742
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex items-center gap-2 mt-2", children: [
6743
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("label", { className: "text-muted-foreground", children: "Color:" }),
6744
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ImageColor, { label: "Annotation colour", value: activeColor, onChange: setActiveColor }),
6745
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex-1 ml-2", children: [
6746
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-0.5", children: [
6747
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { children: "Width:" }),
6748
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("span", { className: "font-mono", children: [
6953
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex items-center gap-2 mt-2", children: [
6954
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("label", { className: "text-muted-foreground", children: "Color:" }),
6955
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ImageColor, { label: "Annotation colour", value: activeColor, onChange: setActiveColor }),
6956
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex-1 ml-2", children: [
6957
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-0.5", children: [
6958
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { children: "Width:" }),
6959
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("span", { className: "font-mono", children: [
6749
6960
  strokeWidth,
6750
6961
  "px"
6751
6962
  ] })
6752
6963
  ] }),
6753
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6964
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6754
6965
  "input",
6755
6966
  {
6756
6967
  type: "range",
@@ -6763,10 +6974,10 @@ var ImageEditor = ({
6763
6974
  )
6764
6975
  ] })
6765
6976
  ] }),
6766
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: imageDividerClass }),
6767
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: imageSectionTitleClass, children: "Add Text" }),
6768
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex gap-2", children: [
6769
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6977
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: imageDividerClass }),
6978
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: imageSectionTitleClass, children: "Add Text" }),
6979
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex gap-2", children: [
6980
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6770
6981
  "input",
6771
6982
  {
6772
6983
  type: "text",
@@ -6777,7 +6988,7 @@ var ImageEditor = ({
6777
6988
  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"
6778
6989
  }
6779
6990
  ),
6780
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6991
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6781
6992
  "button",
6782
6993
  {
6783
6994
  type: "button",
@@ -6787,14 +6998,14 @@ var ImageEditor = ({
6787
6998
  }
6788
6999
  )
6789
7000
  ] }),
6790
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex items-center justify-between text-muted-foreground", children: [
6791
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { children: "Font Size:" }),
6792
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("span", { className: "font-mono", children: [
7001
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex items-center justify-between text-muted-foreground", children: [
7002
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { children: "Font Size:" }),
7003
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("span", { className: "font-mono", children: [
6793
7004
  fontSize,
6794
7005
  "px"
6795
7006
  ] })
6796
7007
  ] }),
6797
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
7008
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6798
7009
  "input",
6799
7010
  {
6800
7011
  type: "range",
@@ -6805,14 +7016,14 @@ var ImageEditor = ({
6805
7016
  className: imageRangeClass
6806
7017
  }
6807
7018
  ),
6808
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: imageDividerClass }),
6809
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex items-center justify-between", children: [
6810
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("span", { className: "text-muted-foreground", children: [
7019
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: imageDividerClass }),
7020
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex items-center justify-between", children: [
7021
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("span", { className: "text-muted-foreground", children: [
6811
7022
  "Layers (",
6812
7023
  state.annotations.length,
6813
7024
  ")"
6814
7025
  ] }),
6815
- state.selectedAnnotationId && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
7026
+ state.selectedAnnotationId && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6816
7027
  "button",
6817
7028
  {
6818
7029
  type: "button",
@@ -6821,7 +7032,7 @@ var ImageEditor = ({
6821
7032
  children: "Delete Selected"
6822
7033
  }
6823
7034
  ),
6824
- state.annotations.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
7035
+ state.annotations.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6825
7036
  "button",
6826
7037
  {
6827
7038
  type: "button",
@@ -6832,10 +7043,10 @@ var ImageEditor = ({
6832
7043
  )
6833
7044
  ] })
6834
7045
  ] }),
6835
- activeTab === "depth" && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
6836
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex items-center justify-between", children: [
6837
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: imageSectionTitleClass, children: "Depth Masking" }),
6838
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
7046
+ activeTab === "depth" && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
7047
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex items-center justify-between", children: [
7048
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: imageSectionTitleClass, children: "Depth Masking" }),
7049
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6839
7050
  "button",
6840
7051
  {
6841
7052
  type: "button",
@@ -6845,8 +7056,8 @@ var ImageEditor = ({
6845
7056
  }
6846
7057
  )
6847
7058
  ] }),
6848
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { className: "flex items-center gap-2 cursor-pointer text-foreground", children: [
6849
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
7059
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("label", { className: "flex items-center gap-2 cursor-pointer text-foreground", children: [
7060
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6850
7061
  "input",
6851
7062
  {
6852
7063
  type: "checkbox",
@@ -6855,12 +7066,12 @@ var ImageEditor = ({
6855
7066
  className: "rounded accent-primary"
6856
7067
  }
6857
7068
  ),
6858
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { children: "Enable Depth / Alpha Mask" })
7069
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { children: "Enable Depth / Alpha Mask" })
6859
7070
  ] }),
6860
- state.depthMask.enabled && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
6861
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { children: [
6862
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("label", { className: "text-muted-foreground block mb-1", children: "Mask Image URL:" }),
6863
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
7071
+ state.depthMask.enabled && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
7072
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { children: [
7073
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("label", { className: "text-muted-foreground block mb-1", children: "Mask Image URL:" }),
7074
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6864
7075
  "input",
6865
7076
  {
6866
7077
  type: "text",
@@ -6871,8 +7082,8 @@ var ImageEditor = ({
6871
7082
  }
6872
7083
  )
6873
7084
  ] }),
6874
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex gap-2", children: [
6875
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
7085
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex gap-2", children: [
7086
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6876
7087
  "button",
6877
7088
  {
6878
7089
  type: "button",
@@ -6881,7 +7092,7 @@ var ImageEditor = ({
6881
7092
  children: "Threshold Mode"
6882
7093
  }
6883
7094
  ),
6884
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
7095
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6885
7096
  "button",
6886
7097
  {
6887
7098
  type: "button",
@@ -6891,12 +7102,12 @@ var ImageEditor = ({
6891
7102
  }
6892
7103
  )
6893
7104
  ] }),
6894
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { children: [
6895
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
6896
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { children: "Depth Start (Lower):" }),
6897
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "font-mono", children: state.depthMask.depthRange[0] })
7105
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { children: [
7106
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
7107
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { children: "Depth Start (Lower):" }),
7108
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "font-mono", children: state.depthMask.depthRange[0] })
6898
7109
  ] }),
6899
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
7110
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6900
7111
  "input",
6901
7112
  {
6902
7113
  type: "range",
@@ -6910,12 +7121,12 @@ var ImageEditor = ({
6910
7121
  }
6911
7122
  )
6912
7123
  ] }),
6913
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { children: [
6914
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
6915
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { children: "Depth Stop (Upper):" }),
6916
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "font-mono", children: state.depthMask.depthRange[1] })
7124
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { children: [
7125
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
7126
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { children: "Depth Stop (Upper):" }),
7127
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "font-mono", children: state.depthMask.depthRange[1] })
6917
7128
  ] }),
6918
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
7129
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6919
7130
  "input",
6920
7131
  {
6921
7132
  type: "range",
@@ -6929,12 +7140,12 @@ var ImageEditor = ({
6929
7140
  }
6930
7141
  )
6931
7142
  ] }),
6932
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { children: [
6933
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
6934
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { children: "Softness:" }),
6935
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "font-mono", children: state.depthMask.softness })
7143
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { children: [
7144
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
7145
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { children: "Softness:" }),
7146
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "font-mono", children: state.depthMask.softness })
6936
7147
  ] }),
6937
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
7148
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6938
7149
  "input",
6939
7150
  {
6940
7151
  type: "range",
@@ -6946,8 +7157,8 @@ var ImageEditor = ({
6946
7157
  }
6947
7158
  )
6948
7159
  ] }),
6949
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { className: "flex items-center gap-2 cursor-pointer text-foreground mt-1", children: [
6950
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
7160
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("label", { className: "flex items-center gap-2 cursor-pointer text-foreground mt-1", children: [
7161
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6951
7162
  "input",
6952
7163
  {
6953
7164
  type: "checkbox",
@@ -6956,12 +7167,12 @@ var ImageEditor = ({
6956
7167
  className: "rounded accent-primary"
6957
7168
  }
6958
7169
  ),
6959
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { children: "Invert Mask" })
7170
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { children: "Invert Mask" })
6960
7171
  ] })
6961
7172
  ] })
6962
7173
  ] }),
6963
- activeTab === "select" && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
6964
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
7174
+ activeTab === "select" && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
7175
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6965
7176
  SelectionOptionsBar,
6966
7177
  {
6967
7178
  controller,
@@ -6972,9 +7183,9 @@ var ImageEditor = ({
6972
7183
  selectionDisplay: state.selectionDisplay
6973
7184
  }
6974
7185
  ),
6975
- selectionError && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { role: "alert", className: "text-destructive", children: selectionError }),
6976
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex gap-1", children: [
6977
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
7186
+ selectionError && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { role: "alert", className: "text-destructive", children: selectionError }),
7187
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex gap-1", children: [
7188
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6978
7189
  "button",
6979
7190
  {
6980
7191
  type: "button",
@@ -6985,7 +7196,7 @@ var ImageEditor = ({
6985
7196
  children: "Transform Selection"
6986
7197
  }
6987
7198
  ),
6988
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
7199
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6989
7200
  "button",
6990
7201
  {
6991
7202
  type: "button",
@@ -6997,13 +7208,13 @@ var ImageEditor = ({
6997
7208
  }
6998
7209
  )
6999
7210
  ] }),
7000
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(RefineEdgePanel, { controller, selection: state.selection ?? null, layers: state.adjustments.layers }),
7001
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChannelsPanel, { controller })
7211
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(RefineEdgePanel, { controller, selection: state.selection ?? null, layers: state.adjustments.layers }),
7212
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ChannelsPanel, { controller })
7002
7213
  ] }),
7003
- activeTab === "ai" && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
7004
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { className: "flex items-center justify-between gap-2 text-foreground", children: [
7005
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { children: "Results go to" }),
7006
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
7214
+ activeTab === "ai" && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
7215
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("label", { className: "flex items-center justify-between gap-2 text-foreground", children: [
7216
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { children: "Results go to" }),
7217
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
7007
7218
  "select",
7008
7219
  {
7009
7220
  "aria-label": "AI result target",
@@ -7011,54 +7222,54 @@ var ImageEditor = ({
7011
7222
  onChange: (e) => setAiTarget(e.target.value),
7012
7223
  className: imageSelectClass,
7013
7224
  children: [
7014
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("option", { value: "auto", children: controller.isMultiLayer ? "Auto (new layer)" : "Auto (replace image)" }),
7015
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("option", { value: "new-layer", children: "New layer / mask" }),
7016
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("option", { value: "replace", children: "Replace image" })
7225
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("option", { value: "auto", children: controller.isMultiLayer ? "Auto (new layer)" : "Auto (replace image)" }),
7226
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("option", { value: "new-layer", children: "New layer / mask" }),
7227
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("option", { value: "replace", children: "Replace image" })
7017
7228
  ]
7018
7229
  }
7019
7230
  )
7020
7231
  ] }),
7021
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
7022
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex items-center justify-between", children: [
7023
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
7024
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("svg", { className: "w-3.5 h-3.5 text-primary", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("path", { d: "M6 3v12M18 9a3 3 0 1 0 0-6 3 3 0 0 0 0 6zM6 21a3 3 0 1 0 0-6 3 3 0 0 0 0 6z" }) }),
7232
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
7233
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex items-center justify-between", children: [
7234
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
7235
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("svg", { className: "w-3.5 h-3.5 text-primary", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("path", { d: "M6 3v12M18 9a3 3 0 1 0 0-6 3 3 0 0 0 0 6zM6 21a3 3 0 1 0 0-6 3 3 0 0 0 0 6z" }) }),
7025
7236
  "Background Removal"
7026
7237
  ] }),
7027
- isRemovingBg && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium bg-primary/15 text-primary animate-pulse", children: "Removing..." })
7238
+ isRemovingBg && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium bg-primary/15 text-primary animate-pulse", children: "Removing..." })
7028
7239
  ] }),
7029
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Isolate foreground subject with AI alpha transparency segmentation." }),
7030
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
7240
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Isolate foreground subject with AI alpha transparency segmentation." }),
7241
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
7031
7242
  "button",
7032
7243
  {
7033
7244
  type: "button",
7034
7245
  onClick: handleRemoveBackground,
7035
7246
  disabled: isRemovingBg || isInpainting,
7036
7247
  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",
7037
- children: isRemovingBg ? /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
7038
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: imageSpinnerClass }),
7248
+ children: isRemovingBg ? /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
7249
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: imageSpinnerClass }),
7039
7250
  "Removing Background..."
7040
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
7041
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("path", { d: "M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83" }) }),
7251
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
7252
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("path", { d: "M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83" }) }),
7042
7253
  "Remove Background"
7043
7254
  ] })
7044
7255
  }
7045
7256
  )
7046
7257
  ] }),
7047
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
7048
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex items-center justify-between", children: [
7049
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
7050
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("svg", { className: "w-3.5 h-3.5 text-primary", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
7051
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("path", { d: "m21.64 3.64-1.28-1.28a1.2 1.2 0 0 0-1.7 0l-9.72 9.72-1.94 4.86 4.86-1.94 9.72-9.72a1.2 1.2 0 0 0 .06-1.64z" }),
7052
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("path", { d: "m14 7 3 3" })
7258
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
7259
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex items-center justify-between", children: [
7260
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
7261
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("svg", { className: "w-3.5 h-3.5 text-primary", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
7262
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("path", { d: "m21.64 3.64-1.28-1.28a1.2 1.2 0 0 0-1.7 0l-9.72 9.72-1.94 4.86 4.86-1.94 9.72-9.72a1.2 1.2 0 0 0 .06-1.64z" }),
7263
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("path", { d: "m14 7 3 3" })
7053
7264
  ] }),
7054
7265
  "Generative Inpainting"
7055
7266
  ] }),
7056
- isInpainting && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium bg-primary/15 text-primary animate-pulse", children: "Inpainting..." })
7267
+ isInpainting && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium bg-primary/15 text-primary animate-pulse", children: "Inpainting..." })
7057
7268
  ] }),
7058
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Replace, modify, or fill selected regions using prompt-guided generative inpainting." }),
7059
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex flex-col gap-1", children: [
7060
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("label", { htmlFor: "ai-inpaint-prompt-react", className: "text-foreground text-[11px] font-medium", children: "Prompt" }),
7061
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
7269
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Replace, modify, or fill selected regions using prompt-guided generative inpainting." }),
7270
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex flex-col gap-1", children: [
7271
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("label", { htmlFor: "ai-inpaint-prompt-react", className: "text-foreground text-[11px] font-medium", children: "Prompt" }),
7272
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
7062
7273
  "textarea",
7063
7274
  {
7064
7275
  id: "ai-inpaint-prompt-react",
@@ -7070,10 +7281,10 @@ var ImageEditor = ({
7070
7281
  }
7071
7282
  )
7072
7283
  ] }),
7073
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex flex-col gap-1", children: [
7074
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "text-foreground text-[11px] font-medium", children: "Target Mask Region" }),
7075
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "grid grid-cols-2 gap-1.5", children: [
7076
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
7284
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex flex-col gap-1", children: [
7285
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "text-foreground text-[11px] font-medium", children: "Target Mask Region" }),
7286
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "grid grid-cols-2 gap-1.5", children: [
7287
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
7077
7288
  "button",
7078
7289
  {
7079
7290
  type: "button",
@@ -7086,7 +7297,7 @@ var ImageEditor = ({
7086
7297
  ]
7087
7298
  }
7088
7299
  ),
7089
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
7300
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
7090
7301
  "button",
7091
7302
  {
7092
7303
  type: "button",
@@ -7101,25 +7312,25 @@ var ImageEditor = ({
7101
7312
  )
7102
7313
  ] })
7103
7314
  ] }),
7104
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
7315
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
7105
7316
  "button",
7106
7317
  {
7107
7318
  type: "button",
7108
7319
  onClick: handleInpaint,
7109
7320
  disabled: isInpainting || isRemovingBg || !inpaintPrompt.trim(),
7110
7321
  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",
7111
- children: isInpainting ? /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
7112
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: imageSpinnerClass }),
7322
+ children: isInpainting ? /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
7323
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: imageSpinnerClass }),
7113
7324
  "Generating Inpaint..."
7114
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
7115
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("path", { d: "M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83" }) }),
7325
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
7326
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("path", { d: "M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83" }) }),
7116
7327
  "Apply Inpainting"
7117
7328
  ] })
7118
7329
  }
7119
7330
  )
7120
7331
  ] }),
7121
- aiError && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "p-2.5 rounded-lg bg-destructive/10 border border-destructive/40 text-destructive text-[11px]", children: aiError }),
7122
- aiSuccess && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "p-2.5 rounded-lg bg-emerald-500/10 border border-emerald-500/30 text-emerald-600 text-[11px]", children: aiSuccess })
7332
+ aiError && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "p-2.5 rounded-lg bg-destructive/10 border border-destructive/40 text-destructive text-[11px]", children: aiError }),
7333
+ aiSuccess && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "p-2.5 rounded-lg bg-emerald-500/10 border border-emerald-500/30 text-emerald-600 text-[11px]", children: aiSuccess })
7123
7334
  ] })
7124
7335
  ] })
7125
7336
  ] })
@@ -7133,6 +7344,7 @@ var ImageEditor = ({
7133
7344
  BrushOptionsBar,
7134
7345
  ChannelsPanel,
7135
7346
  ColorProfilePanel,
7347
+ ContentAwareFillWorkspace,
7136
7348
  ControlSlider,
7137
7349
  CurvesEditor,
7138
7350
  FreeTransformOptionsBar,