@pixerate/editor-react 0.139.0 → 0.141.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,
@@ -51,6 +52,7 @@ __export(image_editor_exports, {
51
52
  LayerEffectsPanel: () => LayerEffectsPanel,
52
53
  LayersPanel: () => LayersPanel,
53
54
  PaintGradientEditor: () => PaintGradientEditor,
55
+ PathsPanel: () => PathsPanel,
54
56
  RefineEdgePanel: () => RefineEdgePanel,
55
57
  SelectAndMaskWorkspace: () => SelectAndMaskWorkspace,
56
58
  SelectionOptionsBar: () => SelectionOptionsBar,
@@ -232,8 +234,8 @@ function useImageEffectsTools(registry, controller, options = {}) {
232
234
  }
233
235
 
234
236
  // src/image-editor/ImageEditor.tsx
235
- var import_react32 = __toESM(require("react"), 1);
236
- var import_image_editor21 = require("@pixerate/editor/image-editor");
237
+ var import_react34 = __toESM(require("react"), 1);
238
+ var import_image_editor23 = require("@pixerate/editor/image-editor");
237
239
 
238
240
  // src/image-editor/ImageEditorCanvas.tsx
239
241
  var import_react5 = require("react");
@@ -4602,8 +4604,8 @@ var ColorProfilePanel = ({ controller, className }) => {
4602
4604
  };
4603
4605
 
4604
4606
  // src/image-editor/SelectionOptionsBar.tsx
4605
- var import_react26 = require("react");
4606
- var import_image_editor15 = require("@pixerate/editor/image-editor");
4607
+ var import_react27 = require("react");
4608
+ var import_image_editor16 = require("@pixerate/editor/image-editor");
4607
4609
 
4608
4610
  // src/image-editor/SelectAndMaskWorkspace.tsx
4609
4611
  var import_react25 = require("react");
@@ -4866,8 +4868,215 @@ var SelectAndMaskWorkspace = ({ controller, onClose, className = "" }) => {
4866
4868
  );
4867
4869
  };
4868
4870
 
4869
- // src/image-editor/SelectionOptionsBar.tsx
4871
+ // src/image-editor/ContentAwareFillWorkspace.tsx
4872
+ var import_react26 = require("react");
4873
+ var import_image_editor15 = require("@pixerate/editor/image-editor");
4870
4874
  var import_jsx_runtime26 = require("react/jsx-runtime");
4875
+ 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";
4876
+ var toggle2 = (on) => `${button3} ${on ? "bg-primary text-primary-foreground border-primary" : ""}`;
4877
+ var ContentAwareFillWorkspace = ({ controller, onClose, className = "" }) => {
4878
+ const session = (0, import_react26.useMemo)(() => new import_image_editor15.ContentAwareFillSession(controller), [controller]);
4879
+ const [, setRevision] = (0, import_react26.useState)(0);
4880
+ const [zoom, setZoom] = (0, import_react26.useState)(1);
4881
+ const [pan, setPan] = (0, import_react26.useState)({ x: 0, y: 0 });
4882
+ const [busy, setBusy] = (0, import_react26.useState)(false);
4883
+ const [error, setError] = (0, import_react26.useState)(null);
4884
+ const sourceRef = (0, import_react26.useRef)(null);
4885
+ const previewRef = (0, import_react26.useRef)(null);
4886
+ const panFrom = (0, import_react26.useRef)(null);
4887
+ const settings = session.settings;
4888
+ const win = session.window;
4889
+ (0, import_react26.useEffect)(() => {
4890
+ const off = session.subscribe(() => setRevision(session.revision));
4891
+ void session.open();
4892
+ return () => {
4893
+ off();
4894
+ };
4895
+ }, [session]);
4896
+ (0, import_react26.useEffect)(() => {
4897
+ if (!win || typeof ImageData === "undefined") return;
4898
+ for (const [canvas, rgba] of [
4899
+ [sourceRef.current, session.renderSource()],
4900
+ [previewRef.current, session.renderPreview()]
4901
+ ]) {
4902
+ const ctx = canvas?.getContext?.("2d");
4903
+ if (!canvas || !ctx || !rgba.length) continue;
4904
+ canvas.width = win.width;
4905
+ canvas.height = win.height;
4906
+ ctx.putImageData(new ImageData(rgba, win.width, win.height), 0, 0);
4907
+ }
4908
+ });
4909
+ const set = (changes) => session.update(changes);
4910
+ const ok = async () => {
4911
+ setBusy(true);
4912
+ setError(null);
4913
+ try {
4914
+ onClose(await session.commit());
4915
+ } catch (err) {
4916
+ setError(err instanceof Error ? err.message : String(err));
4917
+ setBusy(false);
4918
+ }
4919
+ };
4920
+ (0, import_react26.useEffect)(() => {
4921
+ const onKey = (e) => {
4922
+ const t = e.target;
4923
+ if (t && (t.tagName === "INPUT" || t.tagName === "SELECT" || t.tagName === "TEXTAREA")) return;
4924
+ if (e.key === "Escape") onClose(null);
4925
+ else if (e.key === "Enter") void ok();
4926
+ else if (e.ctrlKey || e.metaKey || e.altKey || !session.handleKey(e.key)) return;
4927
+ e.preventDefault();
4928
+ };
4929
+ window.addEventListener("keydown", onKey);
4930
+ return () => window.removeEventListener("keydown", onKey);
4931
+ });
4932
+ const toImage = (e) => {
4933
+ const rect = e.currentTarget.getBoundingClientRect();
4934
+ const w = win ?? { x: 0, y: 0, width: 1, height: 1 };
4935
+ 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 };
4936
+ };
4937
+ const onDown = (e) => {
4938
+ if (settings.tool === "hand") {
4939
+ panFrom.current = { x: e.clientX, y: e.clientY, pan };
4940
+ return;
4941
+ }
4942
+ if (settings.tool === "zoom") {
4943
+ setZoom((z) => Math.min(16, Math.max(0.25, e.altKey ? z / 1.25 : z * 1.25)));
4944
+ return;
4945
+ }
4946
+ e.currentTarget.setPointerCapture?.(e.pointerId);
4947
+ session.begin(toImage(e), { altKey: e.altKey });
4948
+ };
4949
+ const onMove = (e) => {
4950
+ if (panFrom.current) {
4951
+ const p = panFrom.current;
4952
+ setPan({ x: p.pan.x + e.clientX - p.x, y: p.pan.y + e.clientY - p.y });
4953
+ return;
4954
+ }
4955
+ if (e.buttons) session.move(toImage(e));
4956
+ };
4957
+ const onUp = () => {
4958
+ panFrom.current = null;
4959
+ session.end();
4960
+ };
4961
+ const view = { maxWidth: "100%", maxHeight: "100%", transform: `translate(${pan.x}px, ${pan.y}px) scale(${zoom})`, imageRendering: zoom > 2 ? "pixelated" : void 0 };
4962
+ 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: [
4963
+ /* @__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)) }),
4964
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex-1 flex flex-col min-w-0", children: [
4965
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex flex-wrap items-center gap-2 p-2 border-b border-border", children: [
4966
+ settings.tool === "sampling-brush" && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [
4967
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
4968
+ "Size",
4969
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
4970
+ "input",
4971
+ {
4972
+ type: "number",
4973
+ min: 1,
4974
+ "aria-label": "Sampling brush size",
4975
+ value: settings.brushSize,
4976
+ onChange: (e) => set({ brushSize: Math.max(1, Number(e.target.value) || 1) }),
4977
+ className: "w-16 bg-background border border-border rounded px-1 py-0.5 text-foreground"
4978
+ }
4979
+ ),
4980
+ "px"
4981
+ ] }),
4982
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { role: "group", "aria-label": "Sampling brush mode", className: "flex gap-1", children: [
4983
+ /* @__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" }),
4984
+ /* @__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" })
4985
+ ] })
4986
+ ] }),
4987
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { className: "font-mono text-muted-foreground", children: [
4988
+ Math.round(zoom * 100),
4989
+ "%"
4990
+ ] }),
4991
+ session.computing && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { role: "status", className: "text-muted-foreground", children: "Updating preview\u2026" })
4992
+ ] }),
4993
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex-1 grid grid-cols-2 gap-2 p-2 min-h-0", children: [
4994
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex flex-col min-h-0", children: [
4995
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "text-muted-foreground", children: "Source (green: sampling area)" }),
4996
+ /* @__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)(
4997
+ "canvas",
4998
+ {
4999
+ ref: sourceRef,
5000
+ "data-testid": "content-aware-fill-source",
5001
+ onPointerDown: onDown,
5002
+ onPointerMove: onMove,
5003
+ onPointerUp: onUp,
5004
+ style: { ...view, cursor: settings.tool === "hand" ? "grab" : settings.tool === "zoom" ? "zoom-in" : "crosshair" }
5005
+ }
5006
+ ) })
5007
+ ] }),
5008
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex flex-col min-h-0", children: [
5009
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "text-muted-foreground", children: "Preview" }),
5010
+ /* @__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 }) })
5011
+ ] })
5012
+ ] })
5013
+ ] }),
5014
+ /* @__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: [
5015
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: imageSectionTitleClass, children: "Sampling Area Options" }),
5016
+ /* @__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)) }),
5017
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-2", children: [
5018
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ImageCheckbox, { label: "Show Sampling Area", checked: settings.showSampling, onChange: (on) => set({ showSampling: on }) }),
5019
+ "Show Sampling Area"
5020
+ ] }),
5021
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex flex-col gap-1", children: [
5022
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
5023
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { children: "Opacity" }),
5024
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { className: "font-mono", children: [
5025
+ Math.round(settings.opacity * 100),
5026
+ "%"
5027
+ ] })
5028
+ ] }),
5029
+ /* @__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 }) })
5030
+ ] }),
5031
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: imageSectionTitleClass, children: "Fill Settings" }),
5032
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-2 text-muted-foreground", children: [
5033
+ "Seed",
5034
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
5035
+ "input",
5036
+ {
5037
+ type: "number",
5038
+ min: 0,
5039
+ "aria-label": "Fill seed",
5040
+ value: settings.seed,
5041
+ onChange: (e) => set({ seed: Math.max(0, Math.round(Number(e.target.value) || 0)) }),
5042
+ className: "w-16 bg-background border border-border rounded px-1 py-0.5 text-foreground"
5043
+ }
5044
+ ),
5045
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: button3, onClick: () => set({ seed: settings.seed + 1 }), children: "Try Another" })
5046
+ ] }),
5047
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-2", children: [
5048
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ImageCheckbox, { label: "Live Preview", checked: settings.livePreview, onChange: (on) => set({ livePreview: on }) }),
5049
+ "Live Preview"
5050
+ ] }),
5051
+ !settings.livePreview && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: button3, disabled: session.computing, onClick: () => void session.refresh(), children: "Preview" }),
5052
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: imageSectionTitleClass, children: "Output Settings" }),
5053
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-2", children: [
5054
+ "Output To",
5055
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
5056
+ ImageSelect,
5057
+ {
5058
+ label: "Fill output",
5059
+ value: settings.output,
5060
+ options: [
5061
+ { value: "new-layer", label: "New Layer" },
5062
+ { value: "current", label: "Current Layer" }
5063
+ ],
5064
+ onChange: (v) => set({ output: v })
5065
+ }
5066
+ )
5067
+ ] }),
5068
+ (error ?? session.error) && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { role: "alert", className: "text-destructive", children: error ?? session.error }),
5069
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex gap-1 mt-auto", children: [
5070
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: button3, onClick: () => session.reset(), children: "Reset" }),
5071
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: button3, onClick: () => onClose(null), children: "Cancel" }),
5072
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: toggle2(true), disabled: busy || !win, "aria-busy": busy, onClick: () => void ok(), children: "OK" })
5073
+ ] })
5074
+ ] })
5075
+ ] });
5076
+ };
5077
+
5078
+ // src/image-editor/SelectionOptionsBar.tsx
5079
+ var import_jsx_runtime27 = require("react/jsx-runtime");
4871
5080
  var MODIFY_OPS = [
4872
5081
  { op: "expand", label: "Expand" },
4873
5082
  { op: "contract", label: "Contract" },
@@ -4891,15 +5100,15 @@ var SelectionOptionsBar = ({
4891
5100
  selectionDisplay,
4892
5101
  className = ""
4893
5102
  }) => {
4894
- const [radius, setRadius] = (0, import_react26.useState)(2);
5103
+ const [radius, setRadius] = (0, import_react27.useState)(2);
4895
5104
  const set = (patch) => onOptionsChange({ ...options, ...patch });
4896
5105
  const sel = selection === void 0 ? controller.getSelection() : selection;
4897
5106
  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");
5107
+ const [preset, setPreset] = (0, import_react27.useState)("reds");
5108
+ const [rangeStatus, setRangeStatus] = (0, import_react27.useState)(null);
5109
+ const [colorStatus, setColorStatus] = (0, import_react27.useState)(null);
5110
+ const [strokeWidth, setStrokeWidth] = (0, import_react27.useState)(4);
5111
+ const [strokeLocation, setStrokeLocation] = (0, import_react27.useState)("outside");
4903
5112
  const edit = (fn) => {
4904
5113
  setColorStatus(null);
4905
5114
  try {
@@ -4932,8 +5141,8 @@ var SelectionOptionsBar = ({
4932
5141
  setRangeStatus(err instanceof Error ? err.message : String(err));
4933
5142
  }
4934
5143
  };
4935
- const [task, setTask] = (0, import_react26.useState)(null);
4936
- const taskAbort = (0, import_react26.useRef)(null);
5144
+ const [task, setTask] = (0, import_react27.useState)(null);
5145
+ const taskAbort = (0, import_react27.useRef)(null);
4937
5146
  const tracked = () => {
4938
5147
  const abort = new AbortController();
4939
5148
  taskAbort.current = abort;
@@ -4945,9 +5154,9 @@ var SelectionOptionsBar = ({
4945
5154
  setTask(null);
4946
5155
  };
4947
5156
  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);
5157
+ const [subject, setSubject] = (0, import_react27.useState)("");
5158
+ const [segmenting, setSegmenting] = (0, import_react27.useState)(false);
5159
+ const [subjectStatus, setSubjectStatus] = (0, import_react27.useState)(null);
4951
5160
  const selectSubject = async () => {
4952
5161
  const target = subject.trim();
4953
5162
  const canSegment = Boolean(controller.segmentationProvider);
@@ -4964,9 +5173,10 @@ var SelectionOptionsBar = ({
4964
5173
  setSegmenting(false);
4965
5174
  }
4966
5175
  };
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);
5176
+ const [workspace, setWorkspace] = (0, import_react27.useState)(false);
5177
+ const [fillWorkspace, setFillWorkspace] = (0, import_react27.useState)(false);
5178
+ const [skying, setSkying] = (0, import_react27.useState)(false);
5179
+ const [skyStatus, setSkyStatus] = (0, import_react27.useState)(null);
4970
5180
  const selectSky = async () => {
4971
5181
  if (skying) return;
4972
5182
  setSkying(true);
@@ -4981,8 +5191,8 @@ var SelectionOptionsBar = ({
4981
5191
  setSkying(false);
4982
5192
  }
4983
5193
  };
4984
- const [focusing, setFocusing] = (0, import_react26.useState)(false);
4985
- const [focusStatus, setFocusStatus] = (0, import_react26.useState)(null);
5194
+ const [focusing, setFocusing] = (0, import_react27.useState)(false);
5195
+ const [focusStatus, setFocusStatus] = (0, import_react27.useState)(null);
4986
5196
  const selectFocusArea = async () => {
4987
5197
  if (focusing) return;
4988
5198
  setFocusing(true);
@@ -5003,24 +5213,24 @@ var SelectionOptionsBar = ({
5003
5213
  setFocusing(false);
5004
5214
  }
5005
5215
  };
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 })
5216
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { "data-testid": "selection-options-bar", className: `flex flex-col gap-3 text-xs ${className}`, children: [
5217
+ /* @__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)) }),
5218
+ /* @__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)) }),
5219
+ options.tool === "wand" && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex flex-col gap-2", children: [
5220
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex flex-col gap-1", children: [
5221
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
5222
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { children: "Tolerance" }),
5223
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "font-mono", children: options.tolerance })
5014
5224
  ] }),
5015
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ImageRange, { label: "Tolerance", min: 0, max: 255, step: 1, value: options.tolerance, onChange: (v) => set({ tolerance: v }) })
5225
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ImageRange, { label: "Tolerance", min: 0, max: 255, step: 1, value: options.tolerance, onChange: (v) => set({ tolerance: v }) })
5016
5226
  ] }),
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 }) }),
5227
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
5228
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ImageCheckbox, { label: "Contiguous", checked: options.contiguous, onChange: (on) => set({ contiguous: on }) }),
5019
5229
  "Contiguous"
5020
5230
  ] }),
5021
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
5231
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
5022
5232
  "Distance",
5023
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
5233
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5024
5234
  ImageSelect,
5025
5235
  {
5026
5236
  label: "Colour distance",
@@ -5033,13 +5243,13 @@ var SelectionOptionsBar = ({
5033
5243
  }
5034
5244
  )
5035
5245
  ] }),
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 }) }),
5246
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
5247
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ImageCheckbox, { label: "Sample adjusted image", checked: options.sampleMerged, onChange: (on) => set({ sampleMerged: on }) }),
5038
5248
  "Sample adjusted image"
5039
5249
  ] }),
5040
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
5250
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
5041
5251
  "Sample",
5042
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
5252
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5043
5253
  ImageSelect,
5044
5254
  {
5045
5255
  label: "Sample from",
@@ -5053,77 +5263,77 @@ var SelectionOptionsBar = ({
5053
5263
  )
5054
5264
  ] })
5055
5265
  ] }),
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: [
5266
+ 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." }),
5267
+ options.tool === "magnetic" && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { "data-testid": "magnetic-lasso-options", className: "flex flex-col gap-2", children: [
5268
+ /* @__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." }),
5269
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex flex-col gap-1", children: [
5270
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
5271
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { children: "Width" }),
5272
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { className: "font-mono", children: [
5063
5273
  options.magneticWidth ?? 10,
5064
5274
  " px"
5065
5275
  ] })
5066
5276
  ] }),
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 }) })
5277
+ /* @__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
5278
  ] }),
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: [
5279
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex flex-col gap-1", children: [
5280
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
5281
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { children: "Contrast" }),
5282
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { className: "font-mono", children: [
5073
5283
  options.magneticContrast ?? 10,
5074
5284
  "%"
5075
5285
  ] })
5076
5286
  ] }),
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 }) })
5287
+ /* @__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
5288
  ] }),
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 })
5289
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex flex-col gap-1", children: [
5290
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
5291
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { children: "Frequency" }),
5292
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "font-mono", children: options.magneticFrequency ?? 57 })
5083
5293
  ] }),
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 }) })
5294
+ /* @__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
5295
  ] })
5086
5296
  ] }),
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: [
5297
+ options.tool === "quick" && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { "data-testid": "quick-selection-options", className: "flex flex-col gap-2", children: [
5298
+ /* @__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)." }),
5299
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex flex-col gap-1", children: [
5300
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
5301
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { children: "Size" }),
5302
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { className: "font-mono", children: [
5093
5303
  options.quickSize ?? 30,
5094
5304
  " px"
5095
5305
  ] })
5096
5306
  ] }),
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 }) })
5307
+ /* @__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
5308
  ] }),
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 }) }),
5309
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
5310
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ImageCheckbox, { label: "Sample all layers", checked: options.quickSampleAll ?? true, onChange: (on) => set({ quickSampleAll: on }) }),
5101
5311
  "Sample all layers"
5102
5312
  ] }),
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 }) }),
5313
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
5314
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ImageCheckbox, { label: "Auto-enhance edges", checked: options.quickEnhance ?? false, onChange: (on) => set({ quickEnhance: on }) }),
5105
5315
  "Auto-enhance edges"
5106
5316
  ] })
5107
5317
  ] }),
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 }) }),
5318
+ options.tool === "object" && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { "data-testid": "object-selection-options", className: "flex flex-col gap-2", children: [
5319
+ /* @__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." }),
5320
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
5321
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ImageCheckbox, { label: "Object sample all layers", checked: options.objectSampleAll ?? true, onChange: (on) => set({ objectSampleAll: on }) }),
5112
5322
  "Sample all layers"
5113
5323
  ] }),
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 }) }),
5324
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
5325
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ImageCheckbox, { label: "Object auto-enhance edges", checked: options.objectEnhance ?? false, onChange: (on) => set({ objectEnhance: on }) }),
5116
5326
  "Auto-enhance edges"
5117
5327
  ] })
5118
5328
  ] }),
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: [
5329
+ (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: [
5330
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("p", { className: "text-muted-foreground", children: [
5121
5331
  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
5332
  " Shift-click adds, Alt-click subtracts."
5123
5333
  ] }),
5124
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
5334
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
5125
5335
  "Text",
5126
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
5336
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5127
5337
  "input",
5128
5338
  {
5129
5339
  type: "text",
@@ -5134,9 +5344,9 @@ var SelectionOptionsBar = ({
5134
5344
  }
5135
5345
  )
5136
5346
  ] }),
5137
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
5347
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
5138
5348
  "Size",
5139
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
5349
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5140
5350
  "input",
5141
5351
  {
5142
5352
  type: "number",
@@ -5150,9 +5360,9 @@ var SelectionOptionsBar = ({
5150
5360
  ),
5151
5361
  "px"
5152
5362
  ] }),
5153
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
5363
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
5154
5364
  "Font",
5155
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
5365
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5156
5366
  "input",
5157
5367
  {
5158
5368
  type: "text",
@@ -5164,18 +5374,18 @@ var SelectionOptionsBar = ({
5164
5374
  )
5165
5375
  ] })
5166
5376
  ] }),
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 })
5377
+ options.tool === "range" && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { "data-testid": "color-range-options", className: "flex flex-col gap-2", children: [
5378
+ /* @__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." }),
5379
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex flex-col gap-1", children: [
5380
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
5381
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { children: "Fuzziness" }),
5382
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "font-mono", children: options.fuzziness ?? 40 })
5173
5383
  ] }),
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 }) })
5384
+ /* @__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
5385
  ] }),
5176
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
5386
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
5177
5387
  "Localized radius",
5178
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
5388
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5179
5389
  "input",
5180
5390
  {
5181
5391
  type: "number",
@@ -5189,27 +5399,27 @@ var SelectionOptionsBar = ({
5189
5399
  ),
5190
5400
  "px"
5191
5401
  ] }),
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 }) }),
5402
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
5403
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ImageCheckbox, { label: "Invert", checked: options.rangeInvert ?? false, onChange: (on) => set({ rangeInvert: on }) }),
5194
5404
  "Invert"
5195
5405
  ] }),
5196
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex items-center gap-1", children: [
5197
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
5406
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex items-center gap-1", children: [
5407
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5198
5408
  ImageSelect,
5199
5409
  {
5200
5410
  label: "Color Range preset",
5201
5411
  value: preset,
5202
- options: import_image_editor15.COLOR_RANGE_PRESETS.map((p) => ({ value: p, label: import_image_editor15.COLOR_RANGE_PRESET_LABELS[p] })),
5412
+ options: import_image_editor16.COLOR_RANGE_PRESETS.map((p) => ({ value: p, label: import_image_editor16.COLOR_RANGE_PRESET_LABELS[p] })),
5203
5413
  onChange: (v) => setPreset(v)
5204
5414
  }
5205
5415
  ),
5206
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: btn(false), onClick: () => void applyPreset(), children: "Select" })
5416
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { type: "button", className: btn(false), onClick: () => void applyPreset(), children: "Select" })
5207
5417
  ] }),
5208
- rangeStatus && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { role: "status", className: "text-muted-foreground", children: rangeStatus })
5418
+ rangeStatus && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { role: "status", className: "text-muted-foreground", children: rangeStatus })
5209
5419
  ] }),
5210
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
5420
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
5211
5421
  "Feather",
5212
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
5422
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5213
5423
  "input",
5214
5424
  {
5215
5425
  type: "number",
@@ -5224,7 +5434,7 @@ var SelectionOptionsBar = ({
5224
5434
  ),
5225
5435
  "px"
5226
5436
  ] }),
5227
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
5437
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
5228
5438
  "form",
5229
5439
  {
5230
5440
  "data-testid": "select-subject",
@@ -5234,8 +5444,8 @@ var SelectionOptionsBar = ({
5234
5444
  void selectSubject();
5235
5445
  },
5236
5446
  children: [
5237
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex gap-1", children: [
5238
- controller.segmentationProvider && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
5447
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex gap-1", children: [
5448
+ controller.segmentationProvider && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5239
5449
  "input",
5240
5450
  {
5241
5451
  type: "text",
@@ -5247,7 +5457,7 @@ var SelectionOptionsBar = ({
5247
5457
  className: "min-w-0 flex-1 bg-background border border-border rounded px-2 py-1 text-foreground"
5248
5458
  }
5249
5459
  ),
5250
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
5460
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5251
5461
  "button",
5252
5462
  {
5253
5463
  type: "submit",
@@ -5259,12 +5469,12 @@ var SelectionOptionsBar = ({
5259
5469
  }
5260
5470
  )
5261
5471
  ] }),
5262
- subjectStatus && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { role: "status", className: "text-muted-foreground", children: subjectStatus })
5472
+ subjectStatus && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { role: "status", className: "text-muted-foreground", children: subjectStatus })
5263
5473
  ]
5264
5474
  }
5265
5475
  ),
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)(
5476
+ task && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { "data-testid": "selection-progress", className: "flex items-center gap-2", children: [
5477
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5268
5478
  "div",
5269
5479
  {
5270
5480
  role: "progressbar",
@@ -5273,69 +5483,69 @@ var SelectionOptionsBar = ({
5273
5483
  "aria-valuemax": 100,
5274
5484
  "aria-valuenow": Math.round(task.fraction * 100),
5275
5485
  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)}%` } })
5486
+ children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "h-full bg-primary", style: { width: `${Math.round(task.fraction * 100)}%` } })
5277
5487
  }
5278
5488
  ),
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" })
5489
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "text-muted-foreground", children: task.stage }),
5490
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { type: "button", className: btn(false), onClick: () => taskAbort.current?.abort(), children: "Cancel" })
5281
5491
  ] }),
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 })
5492
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { type: "button", className: btn(false), onClick: () => setWorkspace(true), children: "Select and Mask\u2026" }),
5493
+ workspace && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(SelectAndMaskWorkspace, { controller, onClose: () => setWorkspace(false) }),
5494
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { "data-testid": "select-sky", className: "flex flex-col gap-1", children: [
5495
+ /* @__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" }),
5496
+ skyStatus && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { role: "status", className: "text-muted-foreground", children: skyStatus })
5287
5497
  ] }),
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 })
5498
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("details", { "data-testid": "focus-area", className: "flex flex-col gap-2", children: [
5499
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("summary", { className: "cursor-pointer text-foreground", children: "Focus Area" }),
5500
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex flex-col gap-2 pt-2", children: [
5501
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex flex-col gap-1", children: [
5502
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
5503
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { children: "In-focus range" }),
5504
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "font-mono", children: options.focusRange ?? 50 })
5295
5505
  ] }),
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 }) })
5506
+ /* @__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
5507
  ] }),
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 })
5508
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex flex-col gap-1", children: [
5509
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
5510
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { children: "Image noise level" }),
5511
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "font-mono", children: options.focusNoise ?? 0 })
5302
5512
  ] }),
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 }) })
5513
+ /* @__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
5514
  ] }),
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: [
5515
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex flex-col gap-1", children: [
5516
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
5517
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { children: "Soften edge" }),
5518
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { className: "font-mono", children: [
5309
5519
  options.focusSoftness ?? 4,
5310
5520
  " px"
5311
5521
  ] })
5312
5522
  ] }),
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 }) })
5523
+ /* @__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
5524
  ] }),
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 })
5525
+ /* @__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" }),
5526
+ focusStatus && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { role: "status", className: "text-muted-foreground", children: focusStatus })
5317
5527
  ] })
5318
5528
  ] }),
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 }) }),
5529
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
5530
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ImageCheckbox, { label: "Anti-alias", checked: options.antiAlias, onChange: (on) => set({ antiAlias: on }) }),
5321
5531
  "Anti-alias"
5322
5532
  ] }),
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" })
5533
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
5534
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { type: "button", className: btn(false), onClick: () => controller.selectAll(), children: "Select All" }),
5535
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => controller.deselect(), children: "Deselect" }),
5536
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { type: "button", className: btn(false), onClick: () => controller.invertSelection(), children: "Inverse" }),
5537
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { type: "button", className: btn(false), disabled: !controller.canReselect(), onClick: () => controller.reselect(), children: "Reselect" }),
5538
+ /* @__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" }),
5539
+ /* @__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
5540
  ] }),
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))
5541
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { role: "group", "aria-label": "Show selection", className: "flex flex-wrap items-center gap-1", children: [
5542
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "text-muted-foreground", children: "Show" }),
5543
+ 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
5544
  ] }),
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: [
5545
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
5546
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
5337
5547
  "Radius",
5338
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
5548
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5339
5549
  "input",
5340
5550
  {
5341
5551
  type: "number",
@@ -5349,12 +5559,12 @@ var SelectionOptionsBar = ({
5349
5559
  }
5350
5560
  )
5351
5561
  ] }),
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))
5562
+ 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
5563
  ] }),
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: [
5564
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { role: "group", "aria-label": "Edit selection", className: "flex flex-wrap items-center gap-1", children: [
5565
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
5356
5566
  "Stroke",
5357
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
5567
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5358
5568
  "input",
5359
5569
  {
5360
5570
  type: "number",
@@ -5369,7 +5579,7 @@ var SelectionOptionsBar = ({
5369
5579
  ),
5370
5580
  "px"
5371
5581
  ] }),
5372
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
5582
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5373
5583
  ImageSelect,
5374
5584
  {
5375
5585
  label: "Stroke location",
@@ -5382,39 +5592,41 @@ var SelectionOptionsBar = ({
5382
5592
  onChange: (v) => setStrokeLocation(v)
5383
5593
  }
5384
5594
  ),
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" })
5595
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.strokeSelection({ width: strokeWidth, location: strokeLocation })), children: "Stroke" }),
5596
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.cropToSelection()), children: "Crop to Selection" }),
5597
+ /* @__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" }),
5598
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => setFillWorkspace(true), children: "Content-Aware Fill\u2026" }),
5599
+ fillWorkspace && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ContentAwareFillWorkspace, { controller, onClose: () => setFillWorkspace(false) })
5388
5600
  ] }),
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" })
5601
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { role: "group", "aria-label": "Clipboard", className: "flex flex-wrap gap-1", children: [
5602
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { type: "button", className: btn(false), onClick: () => edit(() => controller.copyPixels()), children: "Copy" }),
5603
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { type: "button", className: btn(false), onClick: () => edit(() => controller.copyPixels({ merged: true })), children: "Copy Merged" }),
5604
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.cutPixels()), children: "Cut" }),
5605
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { type: "button", className: btn(false), onClick: () => edit(() => controller.pastePixels("new-layer")), children: "Paste" }),
5606
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { type: "button", className: btn(false), onClick: () => edit(() => controller.pastePixels("in-place")), children: "Paste in Place" }),
5607
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.pastePixels("into")), children: "Paste Into" }),
5608
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.pastePixels("outside")), children: "Paste Outside" })
5397
5609
  ] }),
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) })
5610
+ colorStatus && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { role: "status", className: "text-muted-foreground", children: colorStatus }),
5611
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { "data-testid": "selection-status", className: "text-muted-foreground", children: (0, import_image_editor16.describeSelection)(sel) })
5400
5612
  ] });
5401
5613
  };
5402
5614
 
5403
5615
  // 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");
5616
+ var import_react28 = require("react");
5617
+ var import_image_editor17 = require("@pixerate/editor/image-editor");
5618
+ var import_jsx_runtime28 = require("react/jsx-runtime");
5407
5619
  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";
5620
+ 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
5621
  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);
5622
+ const [params, setParams] = (0, import_react28.useState)(DEFAULT_PARAMS);
5623
+ const [busy, setBusy] = (0, import_react28.useState)(false);
5624
+ const [error, setError] = (0, import_react28.useState)(null);
5625
+ const [layerId, setLayerId] = (0, import_react28.useState)("");
5626
+ const [newKind, setNewKind] = (0, import_react28.useState)("hueSaturation");
5627
+ const [output, setOutput] = (0, import_react28.useState)("selection");
5628
+ const [decontaminate, setDecontaminate] = (0, import_react28.useState)(0);
5629
+ const [objectAware, setObjectAware] = (0, import_react28.useState)(false);
5418
5630
  const canObject = Boolean(controller.segmentationProvider);
5419
5631
  const toLayer = output !== "selection" && output !== "layer-mask";
5420
5632
  const sel = selection === void 0 ? controller.getSelection() : selection;
@@ -5434,17 +5646,17 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
5434
5646
  setBusy(false);
5435
5647
  }
5436
5648
  };
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: [
5649
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { "data-testid": "refine-edge-panel", className: `flex flex-col gap-3 text-xs ${className}`, children: [
5650
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: imageSectionTitleClass, children: "Refine Edge" }),
5651
+ import_image_editor17.REFINE_EDGE_CONTROLS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { className: "flex flex-col gap-1", children: [
5652
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
5653
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { children: c.label }),
5654
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { className: "font-mono", children: [
5443
5655
  params[c.id],
5444
5656
  c.unit
5445
5657
  ] })
5446
5658
  ] }),
5447
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5659
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5448
5660
  "input",
5449
5661
  {
5450
5662
  type: "range",
@@ -5458,39 +5670,39 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
5458
5670
  }
5459
5671
  )
5460
5672
  ] }, 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 }) }),
5673
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
5674
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("input", { type: "checkbox", checked: params.smartRadius, onChange: (e) => setParams({ ...params, smartRadius: e.target.checked }) }),
5463
5675
  "Smart Radius"
5464
5676
  ] }),
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) }),
5677
+ canObject && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
5678
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("input", { type: "checkbox", "aria-label": "Object aware", checked: objectAware, onChange: (e) => setObjectAware(e.target.checked) }),
5467
5679
  "Object aware (segmentation model)"
5468
5680
  ] }),
5469
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex items-center gap-2 text-muted-foreground", children: [
5681
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { className: "flex items-center gap-2 text-muted-foreground", children: [
5470
5682
  "Output to",
5471
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5683
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5472
5684
  "select",
5473
5685
  {
5474
5686
  "aria-label": "Refine output",
5475
5687
  value: output,
5476
5688
  onChange: (e) => setOutput(e.target.value),
5477
5689
  className: "flex-1 bg-background border border-border rounded px-1 py-1 text-foreground",
5478
- children: import_image_editor16.REFINE_OUTPUTS.filter((o) => !o.needsDocuments || controller.canOpenDocuments).map((o) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("option", { value: o.id, children: o.label }, o.id))
5690
+ 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
5691
  }
5480
5692
  )
5481
5693
  ] }),
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: [
5694
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { className: "flex flex-col gap-1", children: [
5695
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
5696
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { children: [
5485
5697
  "Decontaminate colors",
5486
5698
  toLayer ? "" : " (new layer or document outputs)"
5487
5699
  ] }),
5488
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { className: "font-mono", children: [
5700
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { className: "font-mono", children: [
5489
5701
  decontaminate,
5490
5702
  "%"
5491
5703
  ] })
5492
5704
  ] }),
5493
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5705
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5494
5706
  "input",
5495
5707
  {
5496
5708
  type: "range",
@@ -5505,63 +5717,63 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
5505
5717
  }
5506
5718
  )
5507
5719
  ] }),
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" })
5720
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex gap-1", children: [
5721
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("button", { type: "button", className: button4, disabled: !sel || busy, onClick: refine, children: "Refine Edge" }),
5722
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("button", { type: "button", className: button4, onClick: () => setParams(DEFAULT_PARAMS), children: "Reset" })
5511
5723
  ] }),
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)(
5724
+ error && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { role: "alert", className: "text-destructive", children: error }),
5725
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] mt-2", children: "Layer Mask" }),
5726
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex gap-1 items-center", children: [
5727
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5516
5728
  "select",
5517
5729
  {
5518
5730
  "aria-label": "New masked layer kind",
5519
5731
  value: newKind,
5520
5732
  onChange: (e) => setNewKind(e.target.value),
5521
5733
  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))
5734
+ children: import_image_editor17.ADJUSTMENT_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("option", { value: k.kind, children: k.label }, k.kind))
5523
5735
  }
5524
5736
  ),
5525
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5737
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5526
5738
  "button",
5527
5739
  {
5528
5740
  type: "button",
5529
- className: button3,
5741
+ className: button4,
5530
5742
  disabled: !sel,
5531
- onClick: () => sel && setLayerId(controller.addAdjustmentLayer({ kind: newKind, mask: (0, import_image_editor16.layerMaskFromSelection)(sel) })),
5743
+ onClick: () => sel && setLayerId(controller.addAdjustmentLayer({ kind: newKind, mask: (0, import_image_editor17.layerMaskFromSelection)(sel) })),
5532
5744
  children: "New Masked Layer"
5533
5745
  }
5534
5746
  )
5535
5747
  ] }),
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)(
5748
+ list.length > 0 && target && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex flex-col gap-2", children: [
5749
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5538
5750
  "select",
5539
5751
  {
5540
5752
  "aria-label": "Mask layer",
5541
5753
  value: target.id,
5542
5754
  onChange: (e) => setLayerId(e.target.value),
5543
5755
  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),
5756
+ children: list.map((l) => /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("option", { value: l.id, children: [
5757
+ l.name || (0, import_image_editor17.adjustmentKindLabel)(l.kind),
5546
5758
  l.mask ? " (masked)" : ""
5547
5759
  ] }, l.id))
5548
5760
  }
5549
5761
  ),
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" })
5762
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
5763
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("button", { type: "button", className: button4, disabled: !sel, onClick: () => controller.applySelectionAsLayerMask(target.id), children: "Mask with Selection" }),
5764
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("button", { type: "button", className: button4, disabled: !target.mask, onClick: () => controller.selectionFromLayerMask(target.id), children: "Load as Selection" }),
5765
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("button", { type: "button", className: button4, disabled: !target.mask, onClick: () => controller.setAdjustmentLayerMask(target.id, null), children: "Remove Mask" })
5554
5766
  ] }),
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: [
5767
+ target.mask && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
5768
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { className: "flex flex-col gap-1", children: [
5769
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
5770
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { children: "Density" }),
5771
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { className: "font-mono", children: [
5560
5772
  Math.round((target.mask.density ?? 1) * 100),
5561
5773
  "%"
5562
5774
  ] })
5563
5775
  ] }),
5564
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5776
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5565
5777
  "input",
5566
5778
  {
5567
5779
  type: "range",
@@ -5575,15 +5787,15 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
5575
5787
  }
5576
5788
  )
5577
5789
  ] }),
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: [
5790
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { className: "flex flex-col gap-1", children: [
5791
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
5792
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { children: "Mask Feather" }),
5793
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { className: "font-mono", children: [
5582
5794
  target.mask.feather ?? 0,
5583
5795
  "px"
5584
5796
  ] })
5585
5797
  ] }),
5586
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5798
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5587
5799
  "input",
5588
5800
  {
5589
5801
  type: "range",
@@ -5603,32 +5815,32 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
5603
5815
  };
5604
5816
 
5605
5817
  // 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");
5818
+ var import_react29 = require("react");
5819
+ var import_image_editor18 = require("@pixerate/editor/image-editor");
5820
+ var import_jsx_runtime29 = require("react/jsx-runtime");
5609
5821
  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
5822
  var ChannelThumb = ({ channel, size }) => {
5611
- const ref = (0, import_react28.useRef)(null);
5612
- (0, import_react28.useEffect)(() => {
5823
+ const ref = (0, import_react29.useRef)(null);
5824
+ (0, import_react29.useEffect)(() => {
5613
5825
  const canvas = ref.current;
5614
5826
  const ctx = canvas?.getContext("2d");
5615
5827
  if (!canvas || !ctx || typeof ctx.createImageData !== "function") return;
5616
- const px = (0, import_image_editor17.channelThumbnail)(channel, 64);
5828
+ const px = (0, import_image_editor18.channelThumbnail)(channel, 64);
5617
5829
  canvas.width = px.width;
5618
5830
  canvas.height = px.height;
5619
5831
  const img = ctx.createImageData(px.width, px.height);
5620
5832
  img.data.set(px.data);
5621
5833
  ctx.putImageData(img, 0, 0);
5622
5834
  }, [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" });
5835
+ 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
5836
  };
5625
5837
  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);
5838
+ const [, setTick] = (0, import_react29.useState)(0);
5839
+ (0, import_react29.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
5840
+ const [activeId, setActiveId] = (0, import_react29.useState)(null);
5841
+ const [renaming, setRenaming] = (0, import_react29.useState)(null);
5842
+ const [error, setError] = (0, import_react29.useState)(null);
5843
+ const fileInput = (0, import_react29.useRef)(null);
5632
5844
  const channels = controller.getChannels();
5633
5845
  const active = channels.find((c) => c.id === activeId) ?? null;
5634
5846
  const hasSelection = Boolean(controller.getSelection());
@@ -5645,18 +5857,18 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
5645
5857
  if (!file) return;
5646
5858
  setError(null);
5647
5859
  try {
5648
- setActiveId((await (0, import_image_editor17.openMaskFile)(controller, file)).id);
5860
+ setActiveId((await (0, import_image_editor18.openMaskFile)(controller, file)).id);
5649
5861
  } catch (err) {
5650
5862
  setError(err instanceof Error ? err.message : String(err));
5651
5863
  }
5652
5864
  };
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" })
5865
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { "data-testid": "channels-panel", className: `flex flex-col gap-2 text-xs ${className}`, children: [
5866
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex items-center justify-between", children: [
5867
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: imageSectionTitleClass, children: "Channels" }),
5868
+ /* @__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
5869
  ] }),
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)(
5870
+ channels.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("p", { className: "text-muted-foreground", children: "No channels. Save a selection to keep it." }),
5871
+ /* @__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
5872
  "li",
5661
5873
  {
5662
5874
  "data-testid": "channel-row",
@@ -5664,11 +5876,11 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
5664
5876
  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
5877
  onClick: (e) => {
5666
5878
  setActiveId(c.id);
5667
- attempt(() => controller.loadSelectionFromChannel(c.id, { mode: (0, import_image_editor17.selectionModeFromModifiers)(e, "replace") }));
5879
+ attempt(() => controller.loadSelectionFromChannel(c.id, { mode: (0, import_image_editor18.selectionModeFromModifiers)(e, "replace") }));
5668
5880
  },
5669
5881
  onDoubleClick: () => setRenaming(c.id),
5670
5882
  children: [
5671
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5883
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
5672
5884
  "button",
5673
5885
  {
5674
5886
  type: "button",
@@ -5682,8 +5894,8 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
5682
5894
  children: c.visible ? "\u25CF" : "\u25CB"
5683
5895
  }
5684
5896
  ),
5685
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ChannelThumb, { channel: c, size: thumbnailSize }),
5686
- renaming === c.id ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5897
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ChannelThumb, { channel: c, size: thumbnailSize }),
5898
+ renaming === c.id ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
5687
5899
  "input",
5688
5900
  {
5689
5901
  autoFocus: true,
@@ -5700,16 +5912,16 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
5700
5912
  if (e.key === "Escape") setRenaming(null);
5701
5913
  }
5702
5914
  }
5703
- ) : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "min-w-0 flex-1 truncate", children: c.name })
5915
+ ) : /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "min-w-0 flex-1 truncate", children: c.name })
5704
5916
  ]
5705
5917
  },
5706
5918
  c.id
5707
5919
  )) }),
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)(
5920
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
5921
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("button", { type: "button", className: btn2(), disabled: !hasSelection, onClick: () => attempt(() => setActiveId(controller.saveSelection().id)), children: "Save Selection" }),
5922
+ /* @__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" }),
5923
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("button", { type: "button", className: btn2(), disabled: !active, onClick: () => attempt(() => setActiveId(controller.duplicateChannel(active.id).id)), children: "Duplicate" }),
5924
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
5713
5925
  "button",
5714
5926
  {
5715
5927
  type: "button",
@@ -5722,24 +5934,24 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
5722
5934
  children: "Delete"
5723
5935
  }
5724
5936
  ),
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)(
5937
+ /* @__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" }),
5938
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
5727
5939
  "button",
5728
5940
  {
5729
5941
  type: "button",
5730
5942
  className: btn2(),
5731
5943
  disabled: !active && !hasSelection,
5732
5944
  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")),
5945
+ onClick: () => attempt(() => (0, import_image_editor18.downloadMaskImage)(controller, active ? { channelId: active.id } : "selection", active?.name ?? "selection")),
5734
5946
  children: "Export PNG"
5735
5947
  }
5736
5948
  ),
5737
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5949
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
5738
5950
  "input",
5739
5951
  {
5740
5952
  ref: fileInput,
5741
5953
  type: "file",
5742
- accept: import_image_editor17.MASK_FILE_ACCEPT,
5954
+ accept: import_image_editor18.MASK_FILE_ACCEPT,
5743
5955
  hidden: true,
5744
5956
  "data-testid": "channel-import-input",
5745
5957
  onChange: (e) => {
@@ -5749,18 +5961,125 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
5749
5961
  }
5750
5962
  )
5751
5963
  ] }),
5752
- error && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { role: "alert", className: "text-destructive", children: error })
5964
+ error && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("p", { role: "alert", className: "text-destructive", children: error })
5965
+ ] });
5966
+ };
5967
+
5968
+ // src/image-editor/PathsPanel.tsx
5969
+ var import_react30 = require("react");
5970
+ var import_image_editor19 = require("@pixerate/editor/image-editor");
5971
+ var import_jsx_runtime30 = require("react/jsx-runtime");
5972
+ var btn3 = (on = false) => `px-2 py-1 rounded-md border text-[11px] transition-colors disabled:opacity-40 ${on ? "bg-primary border-primary text-primary-foreground" : "bg-background border-border text-foreground hover:bg-accent hover:text-accent-foreground"}`;
5973
+ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
5974
+ const [, setTick] = (0, import_react30.useState)(0);
5975
+ (0, import_react30.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
5976
+ const [renaming, setRenaming] = (0, import_react30.useState)(null);
5977
+ const [color, setColor] = (0, import_react30.useState)("#000000");
5978
+ const [width, setWidth] = (0, import_react30.useState)(2);
5979
+ const [error, setError] = (0, import_react30.useState)(null);
5980
+ const paths = controller.getPaths();
5981
+ const activeId = controller.getState().activePathId ?? null;
5982
+ const active = paths.find((p) => p.id === activeId) ?? null;
5983
+ const hasSelection = Boolean(controller.getSelection());
5984
+ const { width: w, height: h } = controller.getState().imageDimensions;
5985
+ const attempt = (fn) => {
5986
+ setError(null);
5987
+ try {
5988
+ fn();
5989
+ } catch (err) {
5990
+ setError(err instanceof Error ? err.message : String(err));
5991
+ }
5992
+ };
5993
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { "data-testid": "paths-panel", className: `flex flex-col gap-2 text-xs ${className}`, children: [
5994
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: imageSectionTitleClass, children: "Paths" }),
5995
+ paths.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { className: "text-muted-foreground", children: "No paths. Make a work path from a selection." }),
5996
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("ul", { role: "list", className: "flex flex-col gap-0.5", children: paths.map((p) => /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
5997
+ "li",
5998
+ {
5999
+ "data-testid": "path-row",
6000
+ "aria-current": p.id === activeId ? "true" : void 0,
6001
+ className: `flex items-center gap-1.5 px-1.5 py-1 rounded cursor-pointer select-none ${p.id === activeId ? "bg-primary/30 ring-1 ring-primary" : "hover:bg-muted"}`,
6002
+ onClick: () => attempt(() => controller.setActivePath(p.id)),
6003
+ onDoubleClick: () => setRenaming(p.id),
6004
+ children: [
6005
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("svg", { "aria-hidden": "true", viewBox: `0 0 ${w || 1} ${h || 1}`, style: { width: thumbnailSize, height: thumbnailSize }, className: "shrink-0 rounded ring-1 ring-border bg-background", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("path", { d: (0, import_image_editor19.pathSvgData)(p), fill: "currentColor", fillOpacity: 0.25, stroke: "currentColor", strokeWidth: Math.max(w, h) / 64, fillRule: p.fillRule ?? "nonzero" }) }),
6006
+ renaming === p.id ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
6007
+ "input",
6008
+ {
6009
+ autoFocus: true,
6010
+ "aria-label": "Path name",
6011
+ defaultValue: p.work ? "" : p.name,
6012
+ placeholder: "Path name",
6013
+ className: "min-w-0 flex-1 bg-background border border-border rounded px-1 py-0.5 text-foreground",
6014
+ onClick: (e) => e.stopPropagation(),
6015
+ onBlur: (e) => {
6016
+ setRenaming(null);
6017
+ const name = e.currentTarget.value.trim();
6018
+ if (name && name !== p.name) attempt(() => controller.renamePath(p.id, name));
6019
+ },
6020
+ onKeyDown: (e) => {
6021
+ if (e.key === "Enter") e.currentTarget.blur();
6022
+ if (e.key === "Escape") setRenaming(null);
6023
+ }
6024
+ }
6025
+ ) : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: `min-w-0 flex-1 truncate ${p.work ? "italic" : ""}`, children: p.name })
6026
+ ]
6027
+ },
6028
+ p.id
6029
+ )) }),
6030
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
6031
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
6032
+ "button",
6033
+ {
6034
+ type: "button",
6035
+ className: btn3(),
6036
+ disabled: !active,
6037
+ title: "Load the path as the selection (Shift adds, Alt subtracts)",
6038
+ onClick: (e) => attempt(() => controller.loadPathAsSelection(active.id, { mode: (0, import_image_editor19.selectionModeFromModifiers)(e, "replace") })),
6039
+ children: "Load as Selection"
6040
+ }
6041
+ ),
6042
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", className: btn3(), disabled: !hasSelection, onClick: () => attempt(() => controller.makeWorkPath()), children: "Make Work Path" }),
6043
+ active?.work && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", className: btn3(), onClick: () => setRenaming(active.id), children: "Save Path" }),
6044
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.addVectorMaskFromPath(active.id)), children: "Add Vector Mask" })
6045
+ ] }),
6046
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
6047
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("input", { type: "color", "aria-label": "Path paint colour", value: color, onChange: (e) => setColor(e.target.value), className: "h-6 w-8 bg-background border border-border rounded" }),
6048
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.fillPath(active.id, { color })), children: "Fill Path" }),
6049
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
6050
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
6051
+ "input",
6052
+ {
6053
+ type: "number",
6054
+ min: 0.5,
6055
+ max: 250,
6056
+ step: 0.5,
6057
+ "aria-label": "Stroke width",
6058
+ value: width,
6059
+ onChange: (e) => setWidth(Math.min(250, Math.max(0.5, Number(e.target.value) || 1))),
6060
+ className: "w-12 bg-background border border-border rounded px-1 py-0.5 text-foreground"
6061
+ }
6062
+ ),
6063
+ "px"
6064
+ ] }),
6065
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.strokePath(active.id, { width, color })), children: "Stroke Path" })
6066
+ ] }),
6067
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
6068
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.duplicatePath(active.id)), children: "Duplicate" }),
6069
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.deletePath(active.id)), children: "Delete" })
6070
+ ] }),
6071
+ error && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { role: "alert", className: "text-destructive", children: error })
5753
6072
  ] });
5754
6073
  };
5755
6074
 
5756
6075
  // 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");
6076
+ var import_react31 = require("react");
6077
+ var import_image_editor20 = require("@pixerate/editor/image-editor");
6078
+ var import_jsx_runtime31 = require("react/jsx-runtime");
5760
6079
  var round = (v, unit) => unit === "px" ? Math.round(v * 10) / 10 : Math.round(v * 100) / 100;
5761
6080
  var FreeTransformOptionsBar = ({ tool, className }) => {
5762
- const [, setTick] = (0, import_react29.useState)(0);
5763
- (0, import_react29.useEffect)(() => tool.subscribe(() => setTick((n) => n + 1)), [tool]);
6081
+ const [, setTick] = (0, import_react31.useState)(0);
6082
+ (0, import_react31.useEffect)(() => tool.subscribe(() => setTick((n) => n + 1)), [tool]);
5764
6083
  const bar = tool.bar();
5765
6084
  if (!tool.active || !bar) return null;
5766
6085
  const warp = tool.warpBar();
@@ -5772,17 +6091,17 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
5772
6091
  const v = Number(raw);
5773
6092
  if (raw.trim() !== "" && Number.isFinite(v) && Math.abs(v - bar[field]) > 1e-9) tool.setField(field, v);
5774
6093
  };
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)) })
6094
+ return /* @__PURE__ */ (0, import_jsx_runtime31.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: [
6095
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "flex gap-1", role: "group", "aria-label": "Transform mode", children: import_image_editor20.FREE_TRANSFORM_MODE_OPTIONS.map((m) => /* @__PURE__ */ (0, import_jsx_runtime31.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)) }),
6096
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "grid grid-cols-3 gap-px", role: "group", "aria-label": "Reference point", children: import_image_editor20.TRANSFORM_ANCHORS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime31.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)) }),
6097
+ tool.mode === "warp" && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex flex-wrap items-center gap-2", role: "group", "aria-label": "Warp options", children: [
6098
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "flex items-center gap-1", children: [
6099
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "text-muted-foreground", children: "Warp" }),
6100
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("select", { "aria-label": "Warp style", value: warp.style, onChange: (e) => tool.setWarp({ style: e.target.value }), className: imageFieldClass, children: import_image_editor20.WARP_STYLE_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("option", { value: o.id, children: o.label }, o.id)) })
5782
6101
  ] }),
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)(
6102
+ ["bend", "horizontal", "vertical"].map((k) => /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "flex items-center gap-1", children: [
6103
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "text-muted-foreground", children: k === "bend" ? "Bend" : k === "horizontal" ? "H" : "V" }),
6104
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
5786
6105
  "input",
5787
6106
  {
5788
6107
  type: "number",
@@ -5803,9 +6122,9 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
5803
6122
  },
5804
6123
  `${k}:${warp[k]}`
5805
6124
  ),
5806
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "text-muted-foreground", children: "%" })
6125
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "text-muted-foreground", children: "%" })
5807
6126
  ] }, k)),
5808
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
6127
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
5809
6128
  "button",
5810
6129
  {
5811
6130
  type: "button",
@@ -5817,26 +6136,26 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
5817
6136
  children: "Vertical"
5818
6137
  }
5819
6138
  ),
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)(
6139
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "flex items-center gap-1", children: [
6140
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "text-muted-foreground", children: "Grid" }),
6141
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
5823
6142
  "select",
5824
6143
  {
5825
6144
  "aria-label": "Warp grid",
5826
- value: import_image_editor18.WARP_GRID_OPTIONS.find((g) => g.columns === warp.columns && g.rows === warp.rows)?.id ?? "1x1",
6145
+ value: import_image_editor20.WARP_GRID_OPTIONS.find((g) => g.columns === warp.columns && g.rows === warp.rows)?.id ?? "1x1",
5827
6146
  onChange: (e) => {
5828
- const g = import_image_editor18.WARP_GRID_OPTIONS.find((o) => o.id === e.target.value);
6147
+ const g = import_image_editor20.WARP_GRID_OPTIONS.find((o) => o.id === e.target.value);
5829
6148
  tool.setWarp({ columns: g.columns, rows: g.rows });
5830
6149
  },
5831
6150
  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))
6151
+ children: import_image_editor20.WARP_GRID_OPTIONS.map((g) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("option", { value: g.id, children: g.label }, g.id))
5833
6152
  }
5834
6153
  )
5835
6154
  ] })
5836
6155
  ] }),
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)(
6156
+ tool.mode !== "warp" && import_image_editor20.FREE_TRANSFORM_FIELDS.map((f) => /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "flex items-center gap-1", title: f.title, children: [
6157
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "text-muted-foreground", children: f.label }),
6158
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
5840
6159
  "input",
5841
6160
  {
5842
6161
  type: "number",
@@ -5856,8 +6175,8 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
5856
6175
  },
5857
6176
  `${f.id}:${round(bar[f.id], f.unit)}`
5858
6177
  ),
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)(
6178
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "text-muted-foreground", children: f.unit }),
6179
+ f.id === "scaleX" && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
5861
6180
  "button",
5862
6181
  {
5863
6182
  type: "button",
@@ -5872,33 +6191,33 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
5872
6191
  }
5873
6192
  )
5874
6193
  ] }, 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)(
6194
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "flex items-center gap-1", children: [
6195
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "text-muted-foreground", children: "Interpolation" }),
6196
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
5878
6197
  "select",
5879
6198
  {
5880
6199
  "aria-label": "Interpolation",
5881
6200
  value: tool.interpolation,
5882
6201
  onChange: (e) => tool.setInterpolation(e.target.value),
5883
6202
  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))
6203
+ children: import_image_editor20.INTERPOLATIONS.map((i) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("option", { value: i, children: i[0].toUpperCase() + i.slice(1) }, i))
5885
6204
  }
5886
6205
  )
5887
6206
  ] }),
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 })
6207
+ /* @__PURE__ */ (0, import_jsx_runtime31.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" }),
6208
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("button", { type: "button", title: "Cancel (Esc)", className: imageChipClass(false), onClick: () => tool.cancel(), children: "Cancel" }),
6209
+ tool.error && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { role: "alert", className: "text-destructive", children: tool.error })
5891
6210
  ] });
5892
6211
  };
5893
6212
 
5894
6213
  // 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");
6214
+ var import_react32 = require("react");
6215
+ var import_image_editor21 = require("@pixerate/editor/image-editor");
6216
+ var import_jsx_runtime32 = require("react/jsx-runtime");
5898
6217
  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);
6218
+ const [, setTick] = (0, import_react32.useState)(0);
6219
+ (0, import_react32.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
6220
+ const [error, setError] = (0, import_react32.useState)(null);
5902
6221
  const active = controller.getActiveLayer();
5903
6222
  const shapeId = active?.type === "shape" ? active.id : null;
5904
6223
  const set = (change) => {
@@ -5906,28 +6225,28 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
5906
6225
  if (!shapeId) return;
5907
6226
  try {
5908
6227
  setError(null);
5909
- (0, import_image_editor19.applyShapeOptions)(controller, shapeId, change);
6228
+ (0, import_image_editor21.applyShapeOptions)(controller, shapeId, change);
5910
6229
  } catch (e) {
5911
6230
  setError(e instanceof Error ? e.message : String(e));
5912
6231
  }
5913
6232
  };
5914
6233
  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 }) }),
6234
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "shape-options", children: [
6235
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Shape kind", children: import_image_editor21.LIVE_SHAPE_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("button", { type: "button", "aria-pressed": options.kind === k, className: imageChipClass(options.kind === k), onClick: () => onChange({ ...options, kind: k }), children: import_image_editor21.SHAPE_KIND_LABELS[k] }, k)) }),
6236
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
6237
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { className: "flex items-center gap-1", children: [
6238
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ImageCheckbox, { label: "Fill", checked: options.fill !== null, onChange: (on) => set({ fill: on ? "#4f46e5" : null }) }),
5920
6239
  "Fill",
5921
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ImageColor, { label: "Fill colour", disabled: options.fill === null, value: options.fill ?? "#4f46e5", onChange: (fill) => set({ fill }) })
6240
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ImageColor, { label: "Fill colour", disabled: options.fill === null, value: options.fill ?? "#4f46e5", onChange: (fill) => set({ fill }) })
5922
6241
  ] }),
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 }) }),
6242
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { className: "flex items-center gap-1", children: [
6243
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ImageCheckbox, { label: "Stroke", checked: options.stroke !== null, onChange: (on) => set({ stroke: on ? "#000000" : null }) }),
5925
6244
  "Stroke",
5926
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ImageColor, { label: "Stroke colour", disabled: options.stroke === null, value: options.stroke ?? "#000000", onChange: (stroke) => set({ stroke }) })
6245
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ImageColor, { label: "Stroke colour", disabled: options.stroke === null, value: options.stroke ?? "#000000", onChange: (stroke) => set({ stroke }) })
5927
6246
  ] }),
5928
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-1", children: [
6247
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { className: "flex items-center gap-1", children: [
5929
6248
  "Width",
5930
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
6249
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
5931
6250
  "input",
5932
6251
  {
5933
6252
  type: "number",
@@ -5941,52 +6260,52 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
5941
6260
  )
5942
6261
  ] })
5943
6262
  ] }),
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: [
6263
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
6264
+ options.kind === "rect" && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { className: "flex items-center gap-1", children: [
5946
6265
  "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}` })
6266
+ /* @__PURE__ */ (0, import_jsx_runtime32.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
6267
  ] }),
5949
- options.kind === "polygon" && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-1", children: [
6268
+ options.kind === "polygon" && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { className: "flex items-center gap-1", children: [
5950
6269
  "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}` })
6270
+ /* @__PURE__ */ (0, import_jsx_runtime32.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
6271
  ] }),
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: [
6272
+ options.kind === "star" && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
6273
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { className: "flex items-center gap-1", children: [
5955
6274
  "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}` })
6275
+ /* @__PURE__ */ (0, import_jsx_runtime32.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
6276
  ] }),
5958
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-1", children: [
6277
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { className: "flex items-center gap-1", children: [
5959
6278
  "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 }) })
6279
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ImageRange, { label: "Inner radius", min: 0.05, max: 1, step: 0.05, value: options.innerRatio, onChange: (v) => set({ innerRatio: v }) })
5961
6280
  ] })
5962
6281
  ] }),
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: [
6282
+ options.kind === "line" && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
6283
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { className: "flex items-center gap-1", children: [
5965
6284
  "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}` })
6285
+ /* @__PURE__ */ (0, import_jsx_runtime32.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
6286
  ] }),
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 }) }),
6287
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { className: "flex items-center gap-1", children: [
6288
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ImageCheckbox, { label: "Arrowhead", checked: options.arrow, onChange: (on) => set({ arrow: on }) }),
5970
6289
  "Arrowhead"
5971
6290
  ] })
5972
6291
  ] })
5973
6292
  ] }),
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 })
6293
+ /* @__PURE__ */ (0, import_jsx_runtime32.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." }),
6294
+ error && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { role: "alert", className: "text-destructive", children: error })
5976
6295
  ] });
5977
6296
  };
5978
6297
 
5979
6298
  // 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");
6299
+ var import_react33 = require("react");
6300
+ var import_image_editor22 = require("@pixerate/editor/image-editor");
6301
+ var import_jsx_runtime33 = require("react/jsx-runtime");
5983
6302
  var ALIGN_LABELS = { left: "Left", center: "Centre", right: "Right", justify: "Justify" };
5984
6303
  var ORIENTATION_LABELS = { horizontal: "Horizontal", vertical: "Vertical" };
5985
6304
  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);
6305
+ const [, setTick] = (0, import_react33.useState)(0);
6306
+ (0, import_react33.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
6307
+ (0, import_react33.useEffect)(() => session?.subscribe(() => setTick((n) => n + 1)), [session]);
6308
+ const [error, setError] = (0, import_react33.useState)(null);
5990
6309
  const active = controller.getActiveLayer();
5991
6310
  const typeId = !session && active?.type === "type" ? active.id : null;
5992
6311
  const here = session?.alive ? session.styleHere() : {};
@@ -6039,11 +6358,11 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
6039
6358
  setError(e instanceof Error ? e.message : String(e));
6040
6359
  }
6041
6360
  };
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: [
6361
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "type-options", children: [
6362
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
6363
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("label", { className: "flex items-center gap-1", children: [
6045
6364
  "Font",
6046
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
6365
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6047
6366
  "input",
6048
6367
  {
6049
6368
  list: "pixerate-type-fonts",
@@ -6053,11 +6372,11 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
6053
6372
  className: "w-32 rounded border border-border bg-background px-1 py-0.5"
6054
6373
  }
6055
6374
  ),
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)) })
6375
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("datalist", { id: "pixerate-type-fonts", children: fonts.map((f) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("option", { value: f }, f)) })
6057
6376
  ] }),
6058
- /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "flex items-center gap-1", children: [
6377
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("label", { className: "flex items-center gap-1", children: [
6059
6378
  "Size",
6060
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
6379
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6061
6380
  "input",
6062
6381
  {
6063
6382
  type: "number",
@@ -6070,14 +6389,14 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
6070
6389
  }
6071
6390
  )
6072
6391
  ] }),
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 }) })
6392
+ /* @__PURE__ */ (0, import_jsx_runtime33.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" }),
6393
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("button", { type: "button", "aria-pressed": shown.italic, className: `${imageChipClass(shown.italic)} italic`, onClick: () => style({ italic: !shown.italic }), children: "I" }),
6394
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ImageColor, { label: "Text colour", value: shown.color, onChange: (color) => style({ color }) })
6076
6395
  ] }),
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)(
6396
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Alignment", children: import_image_editor22.TEXT_ALIGNS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("button", { type: "button", "aria-pressed": options.align === a, className: imageChipClass(options.align === a), onClick: () => style({ align: a }), children: ALIGN_LABELS[a] }, a)) }),
6397
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Orientation", children: [
6398
+ import_image_editor22.TEXT_ORIENTATIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("button", { type: "button", "aria-pressed": orientation === o, className: imageChipClass(orientation === o), onClick: () => orient(o), children: ORIENTATION_LABELS[o] }, o)),
6399
+ orientation === "vertical" && editedId && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6081
6400
  "button",
6082
6401
  {
6083
6402
  type: "button",
@@ -6089,19 +6408,19 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
6089
6408
  }
6090
6409
  )
6091
6410
  ] }),
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: [
6411
+ /* @__PURE__ */ (0, import_jsx_runtime33.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." }),
6412
+ missing.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("p", { role: "status", className: "text-amber-600", "data-testid": "type-missing-fonts", children: [
6094
6413
  "Missing ",
6095
6414
  missing.length === 1 ? "font" : "fonts",
6096
6415
  ": ",
6097
6416
  missing.join(", ")
6098
6417
  ] }),
6099
- error && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("p", { role: "alert", className: "text-destructive", children: error })
6418
+ error && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { role: "alert", className: "text-destructive", children: error })
6100
6419
  ] });
6101
6420
  };
6102
6421
 
6103
6422
  // src/image-editor/ImageEditor.tsx
6104
- var import_jsx_runtime32 = require("react/jsx-runtime");
6423
+ var import_jsx_runtime34 = require("react/jsx-runtime");
6105
6424
  var ImageEditor = ({
6106
6425
  editor: externalEditor,
6107
6426
  src,
@@ -6125,51 +6444,51 @@ var ImageEditor = ({
6125
6444
  const effectsShown = !!controller.effectsProvider || state.layers.some(function has(l) {
6126
6445
  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
6446
  });
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);
6447
+ const legacyProcess = (0, import_image_editor23.normalizeProcessVersion)(state.adjustments.process) < import_image_editor23.LATEST_PROCESS_VERSION;
6448
+ const [activeTab, setActiveTab] = (0, import_react34.useState)("crop");
6449
+ const rootRef = (0, import_react34.useRef)(null);
6131
6450
  const canvasMode = activeTab === "crop" || activeTab === "select" || activeTab === "paint" || activeTab === "annotate" ? activeTab : "none";
6132
- const activeTabRef = (0, import_react32.useRef)(activeTab);
6451
+ const activeTabRef = (0, import_react34.useRef)(activeTab);
6133
6452
  activeTabRef.current = activeTab;
6134
6453
  const openPanel = async (ref) => {
6135
6454
  if (ref.kind !== "panel" || activeTabRef.current === ref.id) return;
6136
6455
  rootRef.current?.querySelector(`[data-image-tab="${CSS.escape(ref.id)}"]`)?.click();
6137
6456
  await new Promise((resolve) => setTimeout(resolve, 60));
6138
6457
  };
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);
6458
+ const [activeCropRatio, setActiveCropRatio] = (0, import_react34.useState)(null);
6459
+ const [selectionOptions, setSelectionOptions] = (0, import_react34.useState)(import_image_editor23.DEFAULT_SELECTION_TOOL_OPTIONS);
6460
+ const [shapeOptions, setShapeOptions] = (0, import_react34.useState)(import_image_editor23.DEFAULT_SHAPE_TOOL_OPTIONS);
6461
+ const [typeOptions, setTypeOptions] = (0, import_react34.useState)(import_image_editor23.DEFAULT_TYPE_TOOL_OPTIONS);
6462
+ const [typeSession, setTypeSession] = (0, import_react34.useState)(null);
6463
+ const [selectionError, setSelectionError] = (0, import_react34.useState)(null);
6464
+ const [paintError, setPaintError] = (0, import_react34.useState)(null);
6465
+ const [shapeTypeError, setShapeTypeError] = (0, import_react34.useState)(null);
6147
6466
  const handleCanvasError = (source, message) => {
6148
6467
  if (source === "paint") setPaintError(message);
6149
6468
  else if (source === "select") setSelectionError(message);
6150
6469
  else setShapeTypeError(message);
6151
6470
  };
6152
6471
  const finishTyping = () => setTypeSession(null);
6153
- const transformToolRef = (0, import_react32.useRef)(null);
6154
- const transformControllerRef = (0, import_react32.useRef)(controller);
6472
+ const transformToolRef = (0, import_react34.useRef)(null);
6473
+ const transformControllerRef = (0, import_react34.useRef)(controller);
6155
6474
  if (!transformToolRef.current || transformControllerRef.current !== controller) {
6156
6475
  transformToolRef.current?.cancel();
6157
- transformToolRef.current = new import_image_editor21.FreeTransformTool(controller, {
6476
+ transformToolRef.current = new import_image_editor23.FreeTransformTool(controller, {
6158
6477
  schedule: (run) => typeof requestAnimationFrame !== "undefined" ? requestAnimationFrame(run) : run()
6159
6478
  });
6160
6479
  transformControllerRef.current = controller;
6161
6480
  }
6162
6481
  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");
6482
+ const [, setTransformTick] = (0, import_react34.useState)(0);
6483
+ (0, import_react34.useEffect)(() => transformTool.subscribe(() => setTransformTick((n) => n + 1)), [transformTool]);
6484
+ (0, import_react34.useEffect)(() => () => transformToolRef.current?.cancel(), []);
6485
+ const [inpaintPrompt, setInpaintPrompt] = (0, import_react34.useState)("");
6486
+ const [inpaintMaskMode, setInpaintMaskMode] = (0, import_react34.useState)("annotations");
6487
+ const [isRemovingBg, setIsRemovingBg] = (0, import_react34.useState)(false);
6488
+ const [isInpainting, setIsInpainting] = (0, import_react34.useState)(false);
6489
+ const [aiError, setAiError] = (0, import_react34.useState)(null);
6490
+ const [aiSuccess, setAiSuccess] = (0, import_react34.useState)(null);
6491
+ const [aiTarget, setAiTarget] = (0, import_react34.useState)("auto");
6173
6492
  const aiOptions = aiTarget === "auto" ? {} : { target: aiTarget };
6174
6493
  const effectiveOnInpaint = onInpaint || aiHooks?.onInpaint;
6175
6494
  const effectiveOnRemoveBg = onRemoveBackground || aiHooks?.onRemoveBackground;
@@ -6232,11 +6551,11 @@ var ImageEditor = ({
6232
6551
  setIsInpainting(false);
6233
6552
  }
6234
6553
  };
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)(() => {
6554
+ const [activeColor, setActiveColor] = (0, import_react34.useState)("#ef4444");
6555
+ const [strokeWidth, setStrokeWidth] = (0, import_react34.useState)(3);
6556
+ const [fontSize, setFontSize] = (0, import_react34.useState)(24);
6557
+ const [textInput, setTextInput] = (0, import_react34.useState)("");
6558
+ (0, import_react34.useEffect)(() => {
6240
6559
  if (activeTab === "crop" && editor.state.activeTool !== "crop") {
6241
6560
  editor.setTool("crop");
6242
6561
  }
@@ -6264,16 +6583,16 @@ var ImageEditor = ({
6264
6583
  link.click();
6265
6584
  }
6266
6585
  };
6267
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
6586
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
6268
6587
  "div",
6269
6588
  {
6270
6589
  ref: rootRef,
6271
6590
  className: `${imageEditorFrameClass} ${className}`,
6272
6591
  style,
6273
6592
  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)(
6593
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: imageEditorHeaderClass, children: [
6594
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { role: "tablist", className: imageTabListClass, children: [
6595
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6277
6596
  "button",
6278
6597
  {
6279
6598
  type: "button",
@@ -6288,7 +6607,7 @@ var ImageEditor = ({
6288
6607
  children: "Transform & Crop"
6289
6608
  }
6290
6609
  ),
6291
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6610
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6292
6611
  "button",
6293
6612
  {
6294
6613
  type: "button",
@@ -6303,7 +6622,7 @@ var ImageEditor = ({
6303
6622
  children: "Adjustments"
6304
6623
  }
6305
6624
  ),
6306
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6625
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6307
6626
  "button",
6308
6627
  {
6309
6628
  type: "button",
@@ -6318,7 +6637,7 @@ var ImageEditor = ({
6318
6637
  children: "Layers"
6319
6638
  }
6320
6639
  ),
6321
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6640
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6322
6641
  "button",
6323
6642
  {
6324
6643
  type: "button",
@@ -6333,7 +6652,7 @@ var ImageEditor = ({
6333
6652
  children: "Paint"
6334
6653
  }
6335
6654
  ),
6336
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6655
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6337
6656
  "button",
6338
6657
  {
6339
6658
  type: "button",
@@ -6348,7 +6667,7 @@ var ImageEditor = ({
6348
6667
  children: "Select & Mask"
6349
6668
  }
6350
6669
  ),
6351
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6670
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6352
6671
  "button",
6353
6672
  {
6354
6673
  type: "button",
@@ -6363,7 +6682,7 @@ var ImageEditor = ({
6363
6682
  children: "Annotations"
6364
6683
  }
6365
6684
  ),
6366
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6685
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6367
6686
  "button",
6368
6687
  {
6369
6688
  type: "button",
@@ -6378,7 +6697,7 @@ var ImageEditor = ({
6378
6697
  children: "Depth Mask"
6379
6698
  }
6380
6699
  ),
6381
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
6700
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
6382
6701
  "button",
6383
6702
  {
6384
6703
  type: "button",
@@ -6391,14 +6710,14 @@ var ImageEditor = ({
6391
6710
  "aria-selected": activeTab === "ai",
6392
6711
  className: `${imageTabClass(activeTab === "ai")} flex items-center gap-1.5`,
6393
6712
  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" }) }),
6713
+ /* @__PURE__ */ (0, import_jsx_runtime34.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_runtime34.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
6714
  "AI Tools"
6396
6715
  ]
6397
6716
  }
6398
6717
  )
6399
6718
  ] }),
6400
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex items-center gap-2 text-xs", children: [
6401
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6719
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex items-center gap-2 text-xs", children: [
6720
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6402
6721
  "button",
6403
6722
  {
6404
6723
  type: "button",
@@ -6409,7 +6728,7 @@ var ImageEditor = ({
6409
6728
  children: "\u21A9"
6410
6729
  }
6411
6730
  ),
6412
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6731
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6413
6732
  "button",
6414
6733
  {
6415
6734
  type: "button",
@@ -6420,7 +6739,7 @@ var ImageEditor = ({
6420
6739
  children: "\u21AA"
6421
6740
  }
6422
6741
  ),
6423
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6742
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6424
6743
  "button",
6425
6744
  {
6426
6745
  type: "button",
@@ -6429,8 +6748,8 @@ var ImageEditor = ({
6429
6748
  children: "Reset"
6430
6749
  }
6431
6750
  ),
6432
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "h-4 w-px bg-muted mx-1" }),
6433
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6751
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "h-4 w-px bg-muted mx-1" }),
6752
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6434
6753
  "button",
6435
6754
  {
6436
6755
  type: "button",
@@ -6440,11 +6759,11 @@ var ImageEditor = ({
6440
6759
  children: "-"
6441
6760
  }
6442
6761
  ),
6443
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("span", { className: "font-mono text-muted-foreground w-10 text-center", children: [
6762
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("span", { className: "font-mono text-muted-foreground w-10 text-center", children: [
6444
6763
  Math.round(state.zoom * 100),
6445
6764
  "%"
6446
6765
  ] }),
6447
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6766
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6448
6767
  "button",
6449
6768
  {
6450
6769
  type: "button",
@@ -6454,8 +6773,8 @@ var ImageEditor = ({
6454
6773
  children: "+"
6455
6774
  }
6456
6775
  ),
6457
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "h-4 w-px bg-muted mx-1" }),
6458
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6776
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "h-4 w-px bg-muted mx-1" }),
6777
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6459
6778
  "button",
6460
6779
  {
6461
6780
  type: "button",
@@ -6466,7 +6785,7 @@ var ImageEditor = ({
6466
6785
  children: "Hold Compare"
6467
6786
  }
6468
6787
  ),
6469
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6788
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6470
6789
  "button",
6471
6790
  {
6472
6791
  type: "button",
@@ -6477,10 +6796,10 @@ var ImageEditor = ({
6477
6796
  )
6478
6797
  ] })
6479
6798
  ] }),
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)(
6799
+ transformTool.active && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(FreeTransformOptionsBar, { tool: transformTool, className: "border-b border-border bg-background/95 px-4 py-2" }),
6800
+ !transformTool.active && transformTool.error && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { role: "alert", className: imageErrorBannerClass, children: transformTool.error }),
6801
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex flex-col md:flex-row flex-1 min-h-[520px] md:h-[560px]", children: [
6802
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6484
6803
  ImageEditorCanvas,
6485
6804
  {
6486
6805
  editor,
@@ -6504,11 +6823,11 @@ var ImageEditor = ({
6504
6823
  className: "flex-1 h-[360px] md:h-full min-h-[320px] bg-muted"
6505
6824
  }
6506
6825
  ),
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)(
6826
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: imageSidebarClass, children: [
6827
+ activeTab === "crop" && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
6828
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: imageSectionTitleClass, children: "Aspect Ratio Presets" }),
6829
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "grid grid-cols-3 gap-2", children: [
6830
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6512
6831
  "button",
6513
6832
  {
6514
6833
  type: "button",
@@ -6520,7 +6839,7 @@ var ImageEditor = ({
6520
6839
  children: "Freeform"
6521
6840
  }
6522
6841
  ),
6523
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6842
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6524
6843
  "button",
6525
6844
  {
6526
6845
  type: "button",
@@ -6532,7 +6851,7 @@ var ImageEditor = ({
6532
6851
  children: "1:1 Square"
6533
6852
  }
6534
6853
  ),
6535
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6854
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6536
6855
  "button",
6537
6856
  {
6538
6857
  type: "button",
@@ -6544,7 +6863,7 @@ var ImageEditor = ({
6544
6863
  children: "4:3 Standard"
6545
6864
  }
6546
6865
  ),
6547
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6866
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6548
6867
  "button",
6549
6868
  {
6550
6869
  type: "button",
@@ -6556,7 +6875,7 @@ var ImageEditor = ({
6556
6875
  children: "16:9 Wide"
6557
6876
  }
6558
6877
  ),
6559
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6878
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6560
6879
  "button",
6561
6880
  {
6562
6881
  type: "button",
@@ -6568,7 +6887,7 @@ var ImageEditor = ({
6568
6887
  children: "3:2 Photo"
6569
6888
  }
6570
6889
  ),
6571
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6890
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6572
6891
  "button",
6573
6892
  {
6574
6893
  type: "button",
@@ -6581,10 +6900,10 @@ var ImageEditor = ({
6581
6900
  }
6582
6901
  )
6583
6902
  ] }),
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)(
6903
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: imageDividerClass }),
6904
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: imageSectionTitleClass, children: "Orientation & Flips" }),
6905
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "grid grid-cols-2 gap-2", children: [
6906
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6588
6907
  "button",
6589
6908
  {
6590
6909
  type: "button",
@@ -6593,7 +6912,7 @@ var ImageEditor = ({
6593
6912
  children: "Rotate -90\xB0"
6594
6913
  }
6595
6914
  ),
6596
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6915
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6597
6916
  "button",
6598
6917
  {
6599
6918
  type: "button",
@@ -6602,7 +6921,7 @@ var ImageEditor = ({
6602
6921
  children: "Rotate +90\xB0"
6603
6922
  }
6604
6923
  ),
6605
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6924
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6606
6925
  "button",
6607
6926
  {
6608
6927
  type: "button",
@@ -6611,7 +6930,7 @@ var ImageEditor = ({
6611
6930
  children: "Flip Horizontal"
6612
6931
  }
6613
6932
  ),
6614
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6933
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6615
6934
  "button",
6616
6935
  {
6617
6936
  type: "button",
@@ -6622,10 +6941,10 @@ var ImageEditor = ({
6622
6941
  )
6623
6942
  ] })
6624
6943
  ] }),
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)(
6944
+ activeTab === "adjust" && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
6945
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex items-center justify-between", children: [
6946
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: imageSectionTitleClass, children: "Color Adjustments" }),
6947
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6629
6948
  "button",
6630
6949
  {
6631
6950
  type: "button",
@@ -6635,25 +6954,25 @@ var ImageEditor = ({
6635
6954
  }
6636
6955
  )
6637
6956
  ] }),
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)(
6957
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Histogram, { histogram: editor.histogram }),
6958
+ import_image_editor23.IMAGE_ADJUSTMENT_CONTROLS.map((spec) => /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_react34.default.Fragment, { children: [
6959
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6641
6960
  ControlSlider,
6642
6961
  {
6643
6962
  spec,
6644
- value: (0, import_image_editor21.readAdjustmentControls)(state.adjustments)[spec.id],
6963
+ value: (0, import_image_editor23.readAdjustmentControls)(state.adjustments)[spec.id],
6645
6964
  disabled: spec.requiresProcess !== void 0 && legacyProcess,
6646
6965
  onChange: (v) => editor.setAdjustments({ [spec.id]: v })
6647
6966
  }
6648
6967
  ),
6649
- spec.id === "tint" && legacyProcess && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
6968
+ spec.id === "tint" && legacyProcess && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
6650
6969
  "div",
6651
6970
  {
6652
6971
  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
6972
  "data-testid": "image-editor-process-notice",
6654
6973
  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)(
6974
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { children: "Legacy rendering (process 1). Tint needs the current process." }),
6975
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6657
6976
  "button",
6658
6977
  {
6659
6978
  type: "button",
@@ -6666,7 +6985,7 @@ var ImageEditor = ({
6666
6985
  }
6667
6986
  )
6668
6987
  ] }, spec.id)),
6669
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: imageSectionClass, children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6988
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: imageSectionClass, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6670
6989
  AdjustmentLayersPanel,
6671
6990
  {
6672
6991
  controller,
@@ -6675,9 +6994,9 @@ var ImageEditor = ({
6675
6994
  }
6676
6995
  ) })
6677
6996
  ] }),
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)(
6997
+ activeTab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
6998
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: imageSectionTitleClass, children: "Layers" }),
6999
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6681
7000
  "button",
6682
7001
  {
6683
7002
  type: "button",
@@ -6688,15 +7007,15 @@ var ImageEditor = ({
6688
7007
  children: "Free Transform"
6689
7008
  }
6690
7009
  ),
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 })
7010
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(LayersPanel, { controller }),
7011
+ effectsShown && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ImageProviderEffectsPanel, { controller, className: imageSectionClass }),
7012
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: imageSectionTitleClass, children: "Colour" }),
7013
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ColorProfilePanel, { controller })
6695
7014
  ] }),
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)(
7015
+ activeTab === "paint" && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
7016
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: imageSectionTitleClass, children: "Paint" }),
7017
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(BrushOptionsBar, { controller }),
7018
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6700
7019
  "button",
6701
7020
  {
6702
7021
  type: "button",
@@ -6707,12 +7026,12 @@ var ImageEditor = ({
6707
7026
  children: "Free Transform"
6708
7027
  }
6709
7028
  ),
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 }) })
7029
+ paintError && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("p", { role: "alert", className: "text-destructive", "data-testid": "paint-error", children: paintError }),
7030
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: imageSectionClass, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(LayersPanel, { controller }) })
6712
7031
  ] }),
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)(
7032
+ activeTab === "annotate" && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
7033
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: imageSectionTitleClass, children: "Shape & Type Layers" }),
7034
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "grid grid-cols-2 gap-1.5", children: ["shape", "type"].map((t) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6716
7035
  "button",
6717
7036
  {
6718
7037
  type: "button",
@@ -6723,13 +7042,13 @@ var ImageEditor = ({
6723
7042
  },
6724
7043
  t
6725
7044
  )) }),
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)(
7045
+ state.activeTool === "shape" && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ShapeOptionsBar, { controller, options: shapeOptions, onChange: setShapeOptions }),
7046
+ state.activeTool === "type" && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(TypeOptionsBar, { controller, options: typeOptions, onChange: setTypeOptions, session: typeSession }),
7047
+ state.activeTool === "type" && typeSession && /* @__PURE__ */ (0, import_jsx_runtime34.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" }),
7048
+ shapeTypeError && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("p", { role: "alert", className: "text-destructive", "data-testid": "shape-type-error", children: shapeTypeError }),
7049
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: imageDividerClass }),
7050
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: imageSectionTitleClass, children: "Draw & Annotate" }),
7051
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "grid grid-cols-3 gap-1.5", children: ["pen", "rect", "circle", "arrow", "line"].map((t) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6733
7052
  "button",
6734
7053
  {
6735
7054
  type: "button",
@@ -6739,18 +7058,18 @@ var ImageEditor = ({
6739
7058
  },
6740
7059
  t
6741
7060
  )) }),
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: [
7061
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex items-center gap-2 mt-2", children: [
7062
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("label", { className: "text-muted-foreground", children: "Color:" }),
7063
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ImageColor, { label: "Annotation colour", value: activeColor, onChange: setActiveColor }),
7064
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex-1 ml-2", children: [
7065
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-0.5", children: [
7066
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { children: "Width:" }),
7067
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("span", { className: "font-mono", children: [
6749
7068
  strokeWidth,
6750
7069
  "px"
6751
7070
  ] })
6752
7071
  ] }),
6753
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
7072
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6754
7073
  "input",
6755
7074
  {
6756
7075
  type: "range",
@@ -6763,10 +7082,10 @@ var ImageEditor = ({
6763
7082
  )
6764
7083
  ] })
6765
7084
  ] }),
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)(
7085
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: imageDividerClass }),
7086
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: imageSectionTitleClass, children: "Add Text" }),
7087
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex gap-2", children: [
7088
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6770
7089
  "input",
6771
7090
  {
6772
7091
  type: "text",
@@ -6777,7 +7096,7 @@ var ImageEditor = ({
6777
7096
  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
7097
  }
6779
7098
  ),
6780
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
7099
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6781
7100
  "button",
6782
7101
  {
6783
7102
  type: "button",
@@ -6787,14 +7106,14 @@ var ImageEditor = ({
6787
7106
  }
6788
7107
  )
6789
7108
  ] }),
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: [
7109
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex items-center justify-between text-muted-foreground", children: [
7110
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { children: "Font Size:" }),
7111
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("span", { className: "font-mono", children: [
6793
7112
  fontSize,
6794
7113
  "px"
6795
7114
  ] })
6796
7115
  ] }),
6797
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
7116
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6798
7117
  "input",
6799
7118
  {
6800
7119
  type: "range",
@@ -6805,14 +7124,14 @@ var ImageEditor = ({
6805
7124
  className: imageRangeClass
6806
7125
  }
6807
7126
  ),
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: [
7127
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: imageDividerClass }),
7128
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex items-center justify-between", children: [
7129
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("span", { className: "text-muted-foreground", children: [
6811
7130
  "Layers (",
6812
7131
  state.annotations.length,
6813
7132
  ")"
6814
7133
  ] }),
6815
- state.selectedAnnotationId && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
7134
+ state.selectedAnnotationId && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6816
7135
  "button",
6817
7136
  {
6818
7137
  type: "button",
@@ -6821,7 +7140,7 @@ var ImageEditor = ({
6821
7140
  children: "Delete Selected"
6822
7141
  }
6823
7142
  ),
6824
- state.annotations.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
7143
+ state.annotations.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6825
7144
  "button",
6826
7145
  {
6827
7146
  type: "button",
@@ -6832,10 +7151,10 @@ var ImageEditor = ({
6832
7151
  )
6833
7152
  ] })
6834
7153
  ] }),
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)(
7154
+ activeTab === "depth" && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
7155
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex items-center justify-between", children: [
7156
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: imageSectionTitleClass, children: "Depth Masking" }),
7157
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6839
7158
  "button",
6840
7159
  {
6841
7160
  type: "button",
@@ -6845,8 +7164,8 @@ var ImageEditor = ({
6845
7164
  }
6846
7165
  )
6847
7166
  ] }),
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)(
7167
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("label", { className: "flex items-center gap-2 cursor-pointer text-foreground", children: [
7168
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6850
7169
  "input",
6851
7170
  {
6852
7171
  type: "checkbox",
@@ -6855,12 +7174,12 @@ var ImageEditor = ({
6855
7174
  className: "rounded accent-primary"
6856
7175
  }
6857
7176
  ),
6858
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { children: "Enable Depth / Alpha Mask" })
7177
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { children: "Enable Depth / Alpha Mask" })
6859
7178
  ] }),
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)(
7179
+ state.depthMask.enabled && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
7180
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { children: [
7181
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("label", { className: "text-muted-foreground block mb-1", children: "Mask Image URL:" }),
7182
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6864
7183
  "input",
6865
7184
  {
6866
7185
  type: "text",
@@ -6871,8 +7190,8 @@ var ImageEditor = ({
6871
7190
  }
6872
7191
  )
6873
7192
  ] }),
6874
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex gap-2", children: [
6875
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
7193
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex gap-2", children: [
7194
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6876
7195
  "button",
6877
7196
  {
6878
7197
  type: "button",
@@ -6881,7 +7200,7 @@ var ImageEditor = ({
6881
7200
  children: "Threshold Mode"
6882
7201
  }
6883
7202
  ),
6884
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
7203
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6885
7204
  "button",
6886
7205
  {
6887
7206
  type: "button",
@@ -6891,12 +7210,12 @@ var ImageEditor = ({
6891
7210
  }
6892
7211
  )
6893
7212
  ] }),
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] })
7213
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { children: [
7214
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
7215
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { children: "Depth Start (Lower):" }),
7216
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "font-mono", children: state.depthMask.depthRange[0] })
6898
7217
  ] }),
6899
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
7218
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6900
7219
  "input",
6901
7220
  {
6902
7221
  type: "range",
@@ -6910,12 +7229,12 @@ var ImageEditor = ({
6910
7229
  }
6911
7230
  )
6912
7231
  ] }),
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] })
7232
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { children: [
7233
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
7234
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { children: "Depth Stop (Upper):" }),
7235
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "font-mono", children: state.depthMask.depthRange[1] })
6917
7236
  ] }),
6918
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
7237
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6919
7238
  "input",
6920
7239
  {
6921
7240
  type: "range",
@@ -6929,12 +7248,12 @@ var ImageEditor = ({
6929
7248
  }
6930
7249
  )
6931
7250
  ] }),
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 })
7251
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { children: [
7252
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
7253
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { children: "Softness:" }),
7254
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "font-mono", children: state.depthMask.softness })
6936
7255
  ] }),
6937
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
7256
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6938
7257
  "input",
6939
7258
  {
6940
7259
  type: "range",
@@ -6946,8 +7265,8 @@ var ImageEditor = ({
6946
7265
  }
6947
7266
  )
6948
7267
  ] }),
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)(
7268
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("label", { className: "flex items-center gap-2 cursor-pointer text-foreground mt-1", children: [
7269
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6951
7270
  "input",
6952
7271
  {
6953
7272
  type: "checkbox",
@@ -6956,12 +7275,12 @@ var ImageEditor = ({
6956
7275
  className: "rounded accent-primary"
6957
7276
  }
6958
7277
  ),
6959
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { children: "Invert Mask" })
7278
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { children: "Invert Mask" })
6960
7279
  ] })
6961
7280
  ] })
6962
7281
  ] }),
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)(
7282
+ activeTab === "select" && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
7283
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6965
7284
  SelectionOptionsBar,
6966
7285
  {
6967
7286
  controller,
@@ -6972,9 +7291,9 @@ var ImageEditor = ({
6972
7291
  selectionDisplay: state.selectionDisplay
6973
7292
  }
6974
7293
  ),
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)(
7294
+ selectionError && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("p", { role: "alert", className: "text-destructive", children: selectionError }),
7295
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex gap-1", children: [
7296
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6978
7297
  "button",
6979
7298
  {
6980
7299
  type: "button",
@@ -6985,7 +7304,7 @@ var ImageEditor = ({
6985
7304
  children: "Transform Selection"
6986
7305
  }
6987
7306
  ),
6988
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
7307
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6989
7308
  "button",
6990
7309
  {
6991
7310
  type: "button",
@@ -6997,13 +7316,14 @@ var ImageEditor = ({
6997
7316
  }
6998
7317
  )
6999
7318
  ] }),
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 })
7319
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(RefineEdgePanel, { controller, selection: state.selection ?? null, layers: state.adjustments.layers }),
7320
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ChannelsPanel, { controller }),
7321
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(PathsPanel, { controller })
7002
7322
  ] }),
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)(
7323
+ activeTab === "ai" && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
7324
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("label", { className: "flex items-center justify-between gap-2 text-foreground", children: [
7325
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { children: "Results go to" }),
7326
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
7007
7327
  "select",
7008
7328
  {
7009
7329
  "aria-label": "AI result target",
@@ -7011,54 +7331,54 @@ var ImageEditor = ({
7011
7331
  onChange: (e) => setAiTarget(e.target.value),
7012
7332
  className: imageSelectClass,
7013
7333
  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" })
7334
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("option", { value: "auto", children: controller.isMultiLayer ? "Auto (new layer)" : "Auto (replace image)" }),
7335
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("option", { value: "new-layer", children: "New layer / mask" }),
7336
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("option", { value: "replace", children: "Replace image" })
7017
7337
  ]
7018
7338
  }
7019
7339
  )
7020
7340
  ] }),
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" }) }),
7341
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
7342
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex items-center justify-between", children: [
7343
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
7344
+ /* @__PURE__ */ (0, import_jsx_runtime34.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_runtime34.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
7345
  "Background Removal"
7026
7346
  ] }),
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..." })
7347
+ isRemovingBg && /* @__PURE__ */ (0, import_jsx_runtime34.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
7348
  ] }),
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)(
7349
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Isolate foreground subject with AI alpha transparency segmentation." }),
7350
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
7031
7351
  "button",
7032
7352
  {
7033
7353
  type: "button",
7034
7354
  onClick: handleRemoveBackground,
7035
7355
  disabled: isRemovingBg || isInpainting,
7036
7356
  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 }),
7357
+ children: isRemovingBg ? /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
7358
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: imageSpinnerClass }),
7039
7359
  "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" }) }),
7360
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
7361
+ /* @__PURE__ */ (0, import_jsx_runtime34.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_runtime34.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
7362
  "Remove Background"
7043
7363
  ] })
7044
7364
  }
7045
7365
  )
7046
7366
  ] }),
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" })
7367
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
7368
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex items-center justify-between", children: [
7369
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
7370
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("svg", { className: "w-3.5 h-3.5 text-primary", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
7371
+ /* @__PURE__ */ (0, import_jsx_runtime34.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" }),
7372
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("path", { d: "m14 7 3 3" })
7053
7373
  ] }),
7054
7374
  "Generative Inpainting"
7055
7375
  ] }),
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..." })
7376
+ isInpainting && /* @__PURE__ */ (0, import_jsx_runtime34.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
7377
  ] }),
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)(
7378
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Replace, modify, or fill selected regions using prompt-guided generative inpainting." }),
7379
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex flex-col gap-1", children: [
7380
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("label", { htmlFor: "ai-inpaint-prompt-react", className: "text-foreground text-[11px] font-medium", children: "Prompt" }),
7381
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
7062
7382
  "textarea",
7063
7383
  {
7064
7384
  id: "ai-inpaint-prompt-react",
@@ -7070,10 +7390,10 @@ var ImageEditor = ({
7070
7390
  }
7071
7391
  )
7072
7392
  ] }),
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)(
7393
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex flex-col gap-1", children: [
7394
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "text-foreground text-[11px] font-medium", children: "Target Mask Region" }),
7395
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "grid grid-cols-2 gap-1.5", children: [
7396
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
7077
7397
  "button",
7078
7398
  {
7079
7399
  type: "button",
@@ -7086,7 +7406,7 @@ var ImageEditor = ({
7086
7406
  ]
7087
7407
  }
7088
7408
  ),
7089
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
7409
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
7090
7410
  "button",
7091
7411
  {
7092
7412
  type: "button",
@@ -7101,25 +7421,25 @@ var ImageEditor = ({
7101
7421
  )
7102
7422
  ] })
7103
7423
  ] }),
7104
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
7424
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
7105
7425
  "button",
7106
7426
  {
7107
7427
  type: "button",
7108
7428
  onClick: handleInpaint,
7109
7429
  disabled: isInpainting || isRemovingBg || !inpaintPrompt.trim(),
7110
7430
  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 }),
7431
+ children: isInpainting ? /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
7432
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: imageSpinnerClass }),
7113
7433
  "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" }) }),
7434
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
7435
+ /* @__PURE__ */ (0, import_jsx_runtime34.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_runtime34.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
7436
  "Apply Inpainting"
7117
7437
  ] })
7118
7438
  }
7119
7439
  )
7120
7440
  ] }),
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 })
7441
+ aiError && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "p-2.5 rounded-lg bg-destructive/10 border border-destructive/40 text-destructive text-[11px]", children: aiError }),
7442
+ aiSuccess && /* @__PURE__ */ (0, import_jsx_runtime34.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
7443
  ] })
7124
7444
  ] })
7125
7445
  ] })
@@ -7133,6 +7453,7 @@ var ImageEditor = ({
7133
7453
  BrushOptionsBar,
7134
7454
  ChannelsPanel,
7135
7455
  ColorProfilePanel,
7456
+ ContentAwareFillWorkspace,
7136
7457
  ControlSlider,
7137
7458
  CurvesEditor,
7138
7459
  FreeTransformOptionsBar,
@@ -7149,6 +7470,7 @@ var ImageEditor = ({
7149
7470
  LayerEffectsPanel,
7150
7471
  LayersPanel,
7151
7472
  PaintGradientEditor,
7473
+ PathsPanel,
7152
7474
  RefineEdgePanel,
7153
7475
  SelectAndMaskWorkspace,
7154
7476
  SelectionOptionsBar,