@pixerate/editor-react 0.148.0 → 0.149.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -190,7 +190,7 @@ function useImageEffectsTools(registry, controller, options = {}) {
190
190
  }
191
191
 
192
192
  // src/image-editor/ImageEditor.tsx
193
- import React23, { useRef as useRef13, useEffect as useEffect17, useState as useState24 } from "react";
193
+ import React24, { useRef as useRef13, useEffect as useEffect17, useState as useState25 } from "react";
194
194
  import {
195
195
  normalizeProcessVersion,
196
196
  LATEST_PROCESS_VERSION,
@@ -1538,7 +1538,7 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram, classN
1538
1538
  };
1539
1539
 
1540
1540
  // src/image-editor/LayersPanel.tsx
1541
- import { useEffect as useEffect6, useRef as useRef6, useState as useState8 } from "react";
1541
+ import { useEffect as useEffect6, useRef as useRef6, useState as useState9 } from "react";
1542
1542
 
1543
1543
  // src/image-editor/LayerEffectsPanel.tsx
1544
1544
  import { useEffect as useEffect5, useRef as useRef4, useState as useState6 } from "react";
@@ -1782,6 +1782,56 @@ var EdgeColorPanel = ({ controller, layer, className = "" }) => {
1782
1782
  ] });
1783
1783
  };
1784
1784
 
1785
+ // src/image-editor/VectorMaskEdgesPanel.tsx
1786
+ import { useState as useState8 } from "react";
1787
+ import { Fragment, jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
1788
+ var MODES = ["hard", "feather", "matte"];
1789
+ var input = "w-12 bg-background border border-border rounded px-1 py-0.5 text-foreground";
1790
+ var VectorMaskEdgesPanel = ({ controller, layer, className = "" }) => {
1791
+ const [error, setError] = useState8(null);
1792
+ const info = controller.getVectorMask(layer.id);
1793
+ if (!info) return null;
1794
+ const set = (e, mode, options = {}) => {
1795
+ setError(null);
1796
+ try {
1797
+ controller.setVectorMaskEdge(layer.id, { component: e.component, subpath: e.subpath, segment: e.segment }, mode, options);
1798
+ } catch (err) {
1799
+ setError(err instanceof Error ? err.message : String(err));
1800
+ }
1801
+ };
1802
+ const num = (v, fallback) => Number.isFinite(Number(v)) && Number(v) > 0 ? Number(v) : fallback;
1803
+ return /* @__PURE__ */ jsxs9("div", { className: `flex flex-col gap-1.5 text-xs ${className}`, "data-testid": "vector-mask-edges", children: [
1804
+ /* @__PURE__ */ jsx9("span", { className: "text-muted-foreground", children: "Vector mask edges" }),
1805
+ /* @__PURE__ */ jsx9("p", { className: "text-muted-foreground", children: "Alt+Shift-click a segment with Direct Selection to make it feathered or a hair matte." }),
1806
+ info.edges.length === 0 && /* @__PURE__ */ jsx9("p", { className: "text-muted-foreground", children: "Every segment is hard." }),
1807
+ /* @__PURE__ */ jsx9("ul", { className: "flex flex-col gap-1", children: info.edges.map((e) => /* @__PURE__ */ jsxs9("li", { "data-testid": "vector-mask-edge", className: "flex flex-wrap items-center gap-1.5", children: [
1808
+ /* @__PURE__ */ jsxs9("span", { className: "font-mono text-muted-foreground", children: [
1809
+ e.component,
1810
+ "/",
1811
+ e.subpath,
1812
+ "/",
1813
+ e.segment
1814
+ ] }),
1815
+ /* @__PURE__ */ jsx9("select", { "aria-label": "Edge mode", value: e.mode, onChange: (ev) => set(e, ev.target.value), className: "bg-background border border-border rounded px-1 py-0.5 text-foreground", children: MODES.map((m) => /* @__PURE__ */ jsx9("option", { value: m, children: m }, m)) }),
1816
+ e.mode === "feather" && /* @__PURE__ */ jsxs9("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
1817
+ "radius",
1818
+ /* @__PURE__ */ jsx9("input", { type: "number", min: 0.5, max: 250, step: 0.5, "aria-label": "Edge feather radius", value: e.radius, onChange: (ev) => set(e, "feather", { radius: num(ev.target.value, 4) }), className: input })
1819
+ ] }),
1820
+ e.mode === "matte" && /* @__PURE__ */ jsxs9(Fragment, { children: [
1821
+ /* @__PURE__ */ jsxs9("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
1822
+ "in",
1823
+ /* @__PURE__ */ jsx9("input", { type: "number", min: 0.5, max: 200, step: 0.5, "aria-label": "Edge matte inner", value: e.inner, onChange: (ev) => set(e, "matte", { inner: num(ev.target.value, 4), outer: e.outer }), className: input })
1824
+ ] }),
1825
+ /* @__PURE__ */ jsxs9("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
1826
+ "out",
1827
+ /* @__PURE__ */ jsx9("input", { type: "number", min: 0.5, max: 200, step: 0.5, "aria-label": "Edge matte outer", value: e.outer, onChange: (ev) => set(e, "matte", { inner: e.inner, outer: num(ev.target.value, 8) }), className: input })
1828
+ ] })
1829
+ ] })
1830
+ ] }, `${e.component}:${e.subpath}:${e.segment}`)) }),
1831
+ error && /* @__PURE__ */ jsx9("p", { role: "alert", className: "text-destructive", children: error })
1832
+ ] });
1833
+ };
1834
+
1785
1835
  // src/image-editor/LayersPanel.tsx
1786
1836
  import {
1787
1837
  BIT_DEPTH_OPTIONS,
@@ -1803,7 +1853,7 @@ import {
1803
1853
  layerPanelRows,
1804
1854
  runLayerMenuAction
1805
1855
  } from "@pixerate/editor/image-editor";
1806
- import { Fragment, jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
1856
+ import { Fragment as Fragment2, jsx as jsx10, jsxs as jsxs10 } from "react/jsx-runtime";
1807
1857
  var rowClass = (active) => `flex items-center gap-1.5 px-1.5 py-1 rounded cursor-pointer select-none ${active ? "bg-primary/30 ring-1 ring-primary" : "hover:bg-muted"}`;
1808
1858
  var Thumbnail = ({
1809
1859
  pixels,
@@ -1825,7 +1875,7 @@ var Thumbnail = ({
1825
1875
  img.data.set(pixels.data);
1826
1876
  ctx.putImageData(img, 0, 0);
1827
1877
  }, [pixels]);
1828
- return /* @__PURE__ */ jsx9(
1878
+ return /* @__PURE__ */ jsx10(
1829
1879
  "canvas",
1830
1880
  {
1831
1881
  ref,
@@ -1840,13 +1890,13 @@ var Thumbnail = ({
1840
1890
  );
1841
1891
  };
1842
1892
  var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "image", effects = true, className }) => {
1843
- const [, setTick] = useState8(0);
1893
+ const [, setTick] = useState9(0);
1844
1894
  useEffect6(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
1845
- const [error, setError] = useState8(null);
1846
- const [renaming, setRenaming] = useState8(null);
1847
- const [menu, setMenu] = useState8(null);
1848
- const [drag, setDrag] = useState8(null);
1849
- const [psdNotes, setPsdNotes] = useState8([]);
1895
+ const [error, setError] = useState9(null);
1896
+ const [renaming, setRenaming] = useState9(null);
1897
+ const [menu, setMenu] = useState9(null);
1898
+ const [drag, setDrag] = useState9(null);
1899
+ const [psdNotes, setPsdNotes] = useState9([]);
1850
1900
  const fileInput = useRef6(null);
1851
1901
  const psdTask = async (fn) => {
1852
1902
  try {
@@ -1896,14 +1946,14 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
1896
1946
  const maskThumb = (layer) => layer.mask && !layer.mask.source ? controller.getLayerThumbnail(layer.id, { maxSide: 64, mask: true }) : null;
1897
1947
  const vectorThumb = (layer) => layer.vectorMask ? vectorMaskThumbnail(layer.vectorMask, state.imageDimensions.width, state.imageDimensions.height, 64) : null;
1898
1948
  const locked = (layer) => Boolean(layer.locks?.all || layer.locks?.pixels || layer.locks?.position || layer.locks?.transparency);
1899
- return /* @__PURE__ */ jsxs9("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "layers-panel", onClick: () => menu && setMenu(null), children: [
1900
- /* @__PURE__ */ jsxs9("div", { className: "flex flex-wrap items-center gap-1", role: "toolbar", "aria-label": "Layer actions", children: [
1901
- /* @__PURE__ */ jsx9("button", { type: "button", className: imageIconButtonClass, onClick: () => run("new-layer"), children: "New Layer" }),
1902
- /* @__PURE__ */ jsx9("button", { type: "button", className: imageIconButtonClass, onClick: () => run("new-group"), children: "New Group" }),
1903
- /* @__PURE__ */ jsx9("button", { type: "button", className: imageIconButtonClass, disabled: !active, onClick: () => run("duplicate"), children: "Duplicate" }),
1904
- /* @__PURE__ */ jsx9("button", { type: "button", className: imageIconButtonClass, disabled: !active, onClick: () => run("add-mask"), children: "Add Mask" }),
1905
- /* @__PURE__ */ jsx9("button", { type: "button", className: imageIconButtonClass, disabled: !active, onClick: () => run("delete"), children: "Delete" }),
1906
- /* @__PURE__ */ jsx9(
1949
+ return /* @__PURE__ */ jsxs10("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "layers-panel", onClick: () => menu && setMenu(null), children: [
1950
+ /* @__PURE__ */ jsxs10("div", { className: "flex flex-wrap items-center gap-1", role: "toolbar", "aria-label": "Layer actions", children: [
1951
+ /* @__PURE__ */ jsx10("button", { type: "button", className: imageIconButtonClass, onClick: () => run("new-layer"), children: "New Layer" }),
1952
+ /* @__PURE__ */ jsx10("button", { type: "button", className: imageIconButtonClass, onClick: () => run("new-group"), children: "New Group" }),
1953
+ /* @__PURE__ */ jsx10("button", { type: "button", className: imageIconButtonClass, disabled: !active, onClick: () => run("duplicate"), children: "Duplicate" }),
1954
+ /* @__PURE__ */ jsx10("button", { type: "button", className: imageIconButtonClass, disabled: !active, onClick: () => run("add-mask"), children: "Add Mask" }),
1955
+ /* @__PURE__ */ jsx10("button", { type: "button", className: imageIconButtonClass, disabled: !active, onClick: () => run("delete"), children: "Delete" }),
1956
+ /* @__PURE__ */ jsx10(
1907
1957
  "button",
1908
1958
  {
1909
1959
  type: "button",
@@ -1918,7 +1968,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
1918
1968
  children: "\u22EF"
1919
1969
  }
1920
1970
  ),
1921
- /* @__PURE__ */ jsx9(
1971
+ /* @__PURE__ */ jsx10(
1922
1972
  "select",
1923
1973
  {
1924
1974
  "aria-label": "Bits per channel",
@@ -1926,13 +1976,13 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
1926
1976
  className: "rounded bg-muted px-1 py-0.5 text-[11px] text-foreground",
1927
1977
  value: controller.bitDepth,
1928
1978
  onChange: (e) => attempt(() => controller.setBitDepth(Number(e.target.value))),
1929
- children: BIT_DEPTH_OPTIONS.map((o) => /* @__PURE__ */ jsx9("option", { value: o.depth, title: o.title, children: o.label }, o.depth))
1979
+ children: BIT_DEPTH_OPTIONS.map((o) => /* @__PURE__ */ jsx10("option", { value: o.depth, title: o.title, children: o.label }, o.depth))
1930
1980
  }
1931
1981
  ),
1932
- psd && /* @__PURE__ */ jsxs9(Fragment, { children: [
1933
- /* @__PURE__ */ jsx9("button", { type: "button", className: imageIconButtonClass, onClick: () => fileInput.current?.click(), children: "Open PSD\u2026" }),
1934
- /* @__PURE__ */ jsx9("button", { type: "button", className: imageIconButtonClass, onClick: () => psdTask(async () => (await downloadPsd(controller, psdFileName)).warnings), children: "Export PSD" }),
1935
- /* @__PURE__ */ jsx9(
1982
+ psd && /* @__PURE__ */ jsxs10(Fragment2, { children: [
1983
+ /* @__PURE__ */ jsx10("button", { type: "button", className: imageIconButtonClass, onClick: () => fileInput.current?.click(), children: "Open PSD\u2026" }),
1984
+ /* @__PURE__ */ jsx10("button", { type: "button", className: imageIconButtonClass, onClick: () => psdTask(async () => (await downloadPsd(controller, psdFileName)).warnings), children: "Export PSD" }),
1985
+ /* @__PURE__ */ jsx10(
1936
1986
  "input",
1937
1987
  {
1938
1988
  ref: fileInput,
@@ -1950,18 +2000,18 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
1950
2000
  )
1951
2001
  ] })
1952
2002
  ] }),
1953
- psdNotes.length > 0 && /* @__PURE__ */ jsxs9("ul", { className: "rounded bg-amber-500/10 text-amber-600 px-2 py-1 space-y-0.5", "data-testid": "psd-warnings", "aria-label": "PSD warnings", children: [
1954
- psdNotes.map((n) => /* @__PURE__ */ jsx9("li", { children: n }, n)),
1955
- /* @__PURE__ */ jsx9("li", { children: /* @__PURE__ */ jsx9("button", { type: "button", className: "underline", onClick: () => setPsdNotes([]), children: "Dismiss" }) })
2003
+ psdNotes.length > 0 && /* @__PURE__ */ jsxs10("ul", { className: "rounded bg-amber-500/10 text-amber-600 px-2 py-1 space-y-0.5", "data-testid": "psd-warnings", "aria-label": "PSD warnings", children: [
2004
+ psdNotes.map((n) => /* @__PURE__ */ jsx10("li", { children: n }, n)),
2005
+ /* @__PURE__ */ jsx10("li", { children: /* @__PURE__ */ jsx10("button", { type: "button", className: "underline", onClick: () => setPsdNotes([]), children: "Dismiss" }) })
1956
2006
  ] }),
1957
- active && /* @__PURE__ */ jsxs9("div", { className: "grid grid-cols-2 gap-x-2 gap-y-1 items-center", "data-testid": "layer-properties", children: [
1958
- /* @__PURE__ */ jsxs9("label", { className: "flex flex-col gap-0.5", children: [
1959
- /* @__PURE__ */ jsxs9("span", { className: "text-muted-foreground", children: [
2007
+ active && /* @__PURE__ */ jsxs10("div", { className: "grid grid-cols-2 gap-x-2 gap-y-1 items-center", "data-testid": "layer-properties", children: [
2008
+ /* @__PURE__ */ jsxs10("label", { className: "flex flex-col gap-0.5", children: [
2009
+ /* @__PURE__ */ jsxs10("span", { className: "text-muted-foreground", children: [
1960
2010
  "Opacity ",
1961
2011
  Math.round(active.opacity * 100),
1962
2012
  "%"
1963
2013
  ] }),
1964
- /* @__PURE__ */ jsx9(
2014
+ /* @__PURE__ */ jsx10(
1965
2015
  "input",
1966
2016
  {
1967
2017
  type: "range",
@@ -1975,13 +2025,13 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
1975
2025
  }
1976
2026
  )
1977
2027
  ] }),
1978
- /* @__PURE__ */ jsxs9("label", { className: "flex flex-col gap-0.5", children: [
1979
- /* @__PURE__ */ jsxs9("span", { className: "text-muted-foreground", children: [
2028
+ /* @__PURE__ */ jsxs10("label", { className: "flex flex-col gap-0.5", children: [
2029
+ /* @__PURE__ */ jsxs10("span", { className: "text-muted-foreground", children: [
1980
2030
  "Fill ",
1981
2031
  Math.round(((active.type === "pixel" ? active.fillOpacity : void 0) ?? 1) * 100),
1982
2032
  "%"
1983
2033
  ] }),
1984
- /* @__PURE__ */ jsx9(
2034
+ /* @__PURE__ */ jsx10(
1985
2035
  "input",
1986
2036
  {
1987
2037
  type: "range",
@@ -1996,7 +2046,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
1996
2046
  }
1997
2047
  )
1998
2048
  ] }),
1999
- /* @__PURE__ */ jsxs9(
2049
+ /* @__PURE__ */ jsxs10(
2000
2050
  "select",
2001
2051
  {
2002
2052
  "aria-label": "Layer blend mode",
@@ -2004,13 +2054,13 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
2004
2054
  value: active.blend,
2005
2055
  onChange: (e) => attempt(() => controller.setLayerProperties(active.id, { blend: e.target.value })),
2006
2056
  children: [
2007
- active.type === "group" && /* @__PURE__ */ jsx9("option", { value: "pass-through", children: "Pass Through" }),
2008
- BLEND_MODES2.map((m) => /* @__PURE__ */ jsx9("option", { value: m.id, children: m.label }, m.id))
2057
+ active.type === "group" && /* @__PURE__ */ jsx10("option", { value: "pass-through", children: "Pass Through" }),
2058
+ BLEND_MODES2.map((m) => /* @__PURE__ */ jsx10("option", { value: m.id, children: m.label }, m.id))
2009
2059
  ]
2010
2060
  }
2011
2061
  ),
2012
- /* @__PURE__ */ jsxs9("label", { className: "flex items-center gap-1.5 text-foreground", children: [
2013
- /* @__PURE__ */ jsx9(
2062
+ /* @__PURE__ */ jsxs10("label", { className: "flex items-center gap-1.5 text-foreground", children: [
2063
+ /* @__PURE__ */ jsx10(
2014
2064
  "input",
2015
2065
  {
2016
2066
  type: "checkbox",
@@ -2022,8 +2072,8 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
2022
2072
  ),
2023
2073
  "Clip to below"
2024
2074
  ] }),
2025
- /* @__PURE__ */ jsx9("div", { className: "col-span-2 flex flex-wrap gap-2 text-muted-foreground", role: "group", "aria-label": "Layer locks", children: ["pixels", "transparency", "position", "all"].map((k) => /* @__PURE__ */ jsxs9("label", { className: "flex items-center gap-1", children: [
2026
- /* @__PURE__ */ jsx9(
2075
+ /* @__PURE__ */ jsx10("div", { className: "col-span-2 flex flex-wrap gap-2 text-muted-foreground", role: "group", "aria-label": "Layer locks", children: ["pixels", "transparency", "position", "all"].map((k) => /* @__PURE__ */ jsxs10("label", { className: "flex items-center gap-1", children: [
2076
+ /* @__PURE__ */ jsx10(
2027
2077
  "input",
2028
2078
  {
2029
2079
  type: "checkbox",
@@ -2036,11 +2086,12 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
2036
2086
  k
2037
2087
  ] }, k)) })
2038
2088
  ] }),
2039
- active && (active.type === "pixel" || active.type === "shape" || active.type === "type" || active.type === "smart") && /* @__PURE__ */ jsx9(EdgeColorPanel, { controller, layer: active, className: "border-t border-border pt-1.5" }, active.id),
2040
- effects && active && active.type !== "adjustment" && /* @__PURE__ */ jsx9(LayerEffectsPanel, { controller, className: "border-t border-border pt-1.5" }),
2041
- /* @__PURE__ */ jsx9("ul", { className: "flex flex-col gap-0.5", role: "tree", "aria-label": "Layers", children: rows.map((row) => {
2089
+ active && (active.type === "pixel" || active.type === "shape" || active.type === "type" || active.type === "smart") && /* @__PURE__ */ jsx10(EdgeColorPanel, { controller, layer: active, className: "border-t border-border pt-1.5" }, active.id),
2090
+ active?.vectorMask && /* @__PURE__ */ jsx10(VectorMaskEdgesPanel, { controller, layer: active, className: "border-t border-border pt-1.5" }),
2091
+ effects && active && active.type !== "adjustment" && /* @__PURE__ */ jsx10(LayerEffectsPanel, { controller, className: "border-t border-border pt-1.5" }),
2092
+ /* @__PURE__ */ jsx10("ul", { className: "flex flex-col gap-0.5", role: "tree", "aria-label": "Layers", children: rows.map((row) => {
2042
2093
  const { layer } = row;
2043
- return /* @__PURE__ */ jsxs9(
2094
+ return /* @__PURE__ */ jsxs10(
2044
2095
  "li",
2045
2096
  {
2046
2097
  role: "treeitem",
@@ -2070,7 +2121,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
2070
2121
  className: rowClass(row.active),
2071
2122
  style: { paddingLeft: 6 + row.depth * 14 },
2072
2123
  children: [
2073
- /* @__PURE__ */ jsx9(
2124
+ /* @__PURE__ */ jsx10(
2074
2125
  "button",
2075
2126
  {
2076
2127
  type: "button",
@@ -2084,7 +2135,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
2084
2135
  children: layer.visible ? "\u25CF" : "\u25CB"
2085
2136
  }
2086
2137
  ),
2087
- layer.type === "group" && /* @__PURE__ */ jsx9(
2138
+ layer.type === "group" && /* @__PURE__ */ jsx10(
2088
2139
  "button",
2089
2140
  {
2090
2141
  type: "button",
@@ -2097,9 +2148,9 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
2097
2148
  children: layer.collapsed ? "\u25B8" : "\u25BE"
2098
2149
  }
2099
2150
  ),
2100
- row.clipped && /* @__PURE__ */ jsx9("span", { className: "text-muted-foreground", "aria-label": "Clipped", children: "\u21B3" }),
2101
- layerHasThumbnail(layer) ? /* @__PURE__ */ jsxs9("span", { className: "relative shrink-0", children: [
2102
- /* @__PURE__ */ jsx9(
2151
+ row.clipped && /* @__PURE__ */ jsx10("span", { className: "text-muted-foreground", "aria-label": "Clipped", children: "\u21B3" }),
2152
+ layerHasThumbnail(layer) ? /* @__PURE__ */ jsxs10("span", { className: "relative shrink-0", children: [
2153
+ /* @__PURE__ */ jsx10(
2103
2154
  Thumbnail,
2104
2155
  {
2105
2156
  pixels: thumb(layer),
@@ -2115,7 +2166,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
2115
2166
  }
2116
2167
  }
2117
2168
  ),
2118
- layer.type !== "pixel" && /* @__PURE__ */ jsx9(
2169
+ layer.type !== "pixel" && /* @__PURE__ */ jsx10(
2119
2170
  "span",
2120
2171
  {
2121
2172
  "data-testid": "layer-kind-badge",
@@ -2123,7 +2174,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
2123
2174
  children: layerBadge(layer)
2124
2175
  }
2125
2176
  )
2126
- ] }) : /* @__PURE__ */ jsx9(
2177
+ ] }) : /* @__PURE__ */ jsx10(
2127
2178
  "span",
2128
2179
  {
2129
2180
  className: "shrink-0 grid place-items-center rounded bg-muted text-[9px] text-muted-foreground ring-1 ring-border",
@@ -2131,7 +2182,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
2131
2182
  children: layerBadge(layer)
2132
2183
  }
2133
2184
  ),
2134
- layer.mask && !layer.mask.source && layer.type === "pixel" && /* @__PURE__ */ jsx9(
2185
+ layer.mask && !layer.mask.source && layer.type === "pixel" && /* @__PURE__ */ jsx10(
2135
2186
  "button",
2136
2187
  {
2137
2188
  type: "button",
@@ -2147,7 +2198,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
2147
2198
  children: layer.mask.linked === false ? "\u26D3\uFE0E\u0338" : "\u26D3\uFE0E"
2148
2199
  }
2149
2200
  ),
2150
- layer.mask && /* @__PURE__ */ jsx9(
2201
+ layer.mask && /* @__PURE__ */ jsx10(
2151
2202
  Thumbnail,
2152
2203
  {
2153
2204
  pixels: maskThumb(layer),
@@ -2162,7 +2213,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
2162
2213
  }
2163
2214
  }
2164
2215
  ),
2165
- layer.vectorMask && /* @__PURE__ */ jsx9(
2216
+ layer.vectorMask && /* @__PURE__ */ jsx10(
2166
2217
  Thumbnail,
2167
2218
  {
2168
2219
  pixels: vectorThumb(layer),
@@ -2176,7 +2227,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
2176
2227
  }
2177
2228
  }
2178
2229
  ),
2179
- renaming === layer.id ? /* @__PURE__ */ jsx9(
2230
+ renaming === layer.id ? /* @__PURE__ */ jsx10(
2180
2231
  "input",
2181
2232
  {
2182
2233
  autoFocus: true,
@@ -2193,7 +2244,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
2193
2244
  if (e.key === "Escape") setRenaming(null);
2194
2245
  }
2195
2246
  }
2196
- ) : /* @__PURE__ */ jsx9(
2247
+ ) : /* @__PURE__ */ jsx10(
2197
2248
  "span",
2198
2249
  {
2199
2250
  className: `flex-1 min-w-0 truncate ${layer.visible ? "" : "text-muted-foreground"}`,
@@ -2204,8 +2255,8 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
2204
2255
  children: row.label
2205
2256
  }
2206
2257
  ),
2207
- layerWarning(layer) && /* @__PURE__ */ jsx9("span", { role: "img", "data-testid": "layer-warning", "aria-label": layerWarning(layer), title: layerWarning(layer), className: "text-[10px] text-amber-600", children: "\u26A0" }),
2208
- layerEffectsBadge(layer) && /* @__PURE__ */ jsx9(
2258
+ layerWarning(layer) && /* @__PURE__ */ jsx10("span", { role: "img", "data-testid": "layer-warning", "aria-label": layerWarning(layer), title: layerWarning(layer), className: "text-[10px] text-amber-600", children: "\u26A0" }),
2259
+ layerEffectsBadge(layer) && /* @__PURE__ */ jsx10(
2209
2260
  "button",
2210
2261
  {
2211
2262
  type: "button",
@@ -2220,15 +2271,15 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
2220
2271
  children: "fx"
2221
2272
  }
2222
2273
  ),
2223
- locked(layer) && /* @__PURE__ */ jsx9("span", { "aria-label": "Locked", className: "text-muted-foreground", children: "\u{1F512}" }),
2224
- layer.blend !== "normal" && layer.blend !== "pass-through" && /* @__PURE__ */ jsx9("span", { className: "text-[9px] text-muted-foreground", children: layer.blend })
2274
+ locked(layer) && /* @__PURE__ */ jsx10("span", { "aria-label": "Locked", className: "text-muted-foreground", children: "\u{1F512}" }),
2275
+ layer.blend !== "normal" && layer.blend !== "pass-through" && /* @__PURE__ */ jsx10("span", { className: "text-[9px] text-muted-foreground", children: layer.blend })
2225
2276
  ]
2226
2277
  },
2227
2278
  layer.id
2228
2279
  );
2229
2280
  }) }),
2230
- error && /* @__PURE__ */ jsx9("p", { role: "alert", className: "text-destructive", children: error }),
2231
- menu && /* @__PURE__ */ jsx9(
2281
+ error && /* @__PURE__ */ jsx10("p", { role: "alert", className: "text-destructive", children: error }),
2282
+ menu && /* @__PURE__ */ jsx10(
2232
2283
  "div",
2233
2284
  {
2234
2285
  role: "menu",
@@ -2237,7 +2288,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
2237
2288
  style: { left: menu.x, top: menu.y },
2238
2289
  onClick: (e) => e.stopPropagation(),
2239
2290
  onKeyDown: (e) => e.key === "Escape" && setMenu(null),
2240
- children: layerMenu(controller).map((item) => /* @__PURE__ */ jsx9(
2291
+ children: layerMenu(controller).map((item) => /* @__PURE__ */ jsx10(
2241
2292
  "button",
2242
2293
  {
2243
2294
  type: "button",
@@ -2255,14 +2306,14 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
2255
2306
  };
2256
2307
 
2257
2308
  // src/image-editor/ImageProviderEffectsPanel.tsx
2258
- import { useEffect as useEffect7, useRef as useRef7, useState as useState9 } from "react";
2309
+ import { useEffect as useEffect7, useRef as useRef7, useState as useState10 } from "react";
2259
2310
  import { EFFECT_LAYER_USES, effectLayerTiming, findLayer } from "@pixerate/editor/image-editor";
2260
2311
 
2261
2312
  // src/image-editor/controls/parameterControls.tsx
2262
2313
  import { matchParameterOptionValue } from "@pixerate/editor/parameters";
2263
- import { jsx as jsx10 } from "react/jsx-runtime";
2314
+ import { jsx as jsx11 } from "react/jsx-runtime";
2264
2315
  function ImageParameterSlider({ value, min, max, step, label, disabled, className, onChange, onGestureStart, onGestureEnd }) {
2265
- return /* @__PURE__ */ jsx10(
2316
+ return /* @__PURE__ */ jsx11(
2266
2317
  ImageRange,
2267
2318
  {
2268
2319
  value,
@@ -2279,7 +2330,7 @@ function ImageParameterSlider({ value, min, max, step, label, disabled, classNam
2279
2330
  );
2280
2331
  }
2281
2332
  function ImageParameterSelect({ value, options, label, disabled, className, onChange }) {
2282
- return /* @__PURE__ */ jsx10(
2333
+ return /* @__PURE__ */ jsx11(
2283
2334
  ImageSelect,
2284
2335
  {
2285
2336
  value: String(value),
@@ -2292,7 +2343,7 @@ function ImageParameterSelect({ value, options, label, disabled, className, onCh
2292
2343
  );
2293
2344
  }
2294
2345
  function ImageParameterColor({ value, alpha, label, disabled, className, onChange, onGestureStart, onGestureEnd }) {
2295
- return /* @__PURE__ */ jsx10(
2346
+ return /* @__PURE__ */ jsx11(
2296
2347
  ImageColor,
2297
2348
  {
2298
2349
  value,
@@ -2315,33 +2366,33 @@ function imageEditorParameterComponents(controls) {
2315
2366
  }
2316
2367
 
2317
2368
  // src/image-editor/ImageEffectControls.tsx
2318
- import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
2369
+ import { jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
2319
2370
  function ImageEffectControls({ provider, effect, name, values, onChange, onPreset, className, components }) {
2320
2371
  const { description, error } = useEffectDescription(provider, effect);
2321
2372
  const fallback = resolveParameterComponents(useParameterComponents(), imageEditorParameterComponents(useImageEditorControls()));
2322
2373
  const effectiveComponents = resolveParameterComponents(components, fallback);
2323
2374
  let body;
2324
- if (!provider) body = /* @__PURE__ */ jsxs10("p", { className: "text-[11px] text-muted-foreground", children: [
2375
+ if (!provider) body = /* @__PURE__ */ jsxs11("p", { className: "text-[11px] text-muted-foreground", children: [
2325
2376
  'No effects provider: "',
2326
2377
  name ?? effect,
2327
2378
  '" is kept but not drawn.'
2328
2379
  ] });
2329
- else if (error) body = /* @__PURE__ */ jsx11("p", { className: "text-[11px] text-amber-600", children: error });
2330
- else if (!description) body = /* @__PURE__ */ jsx11("p", { className: "text-[11px] text-muted-foreground", children: "Loading\u2026" });
2331
- else body = /* @__PURE__ */ jsx11(EffectParameters, { description, values, onChange, onReset: (k) => onChange(k, description.defaults[k], null), onPreset, components: effectiveComponents });
2332
- return /* @__PURE__ */ jsx11("div", { className, "data-testid": "image-effect-controls", children: body });
2380
+ else if (error) body = /* @__PURE__ */ jsx12("p", { className: "text-[11px] text-amber-600", children: error });
2381
+ else if (!description) body = /* @__PURE__ */ jsx12("p", { className: "text-[11px] text-muted-foreground", children: "Loading\u2026" });
2382
+ else body = /* @__PURE__ */ jsx12(EffectParameters, { description, values, onChange, onReset: (k) => onChange(k, description.defaults[k], null), onPreset, components: effectiveComponents });
2383
+ return /* @__PURE__ */ jsx12("div", { className, "data-testid": "image-effect-controls", children: body });
2333
2384
  }
2334
2385
 
2335
2386
  // src/image-editor/ImageProviderEffectsPanel.tsx
2336
- import { jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
2387
+ import { jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
2337
2388
  var fmt = (ms) => `${(ms / 1e3).toFixed(ms < 1e4 ? 2 : 1)} s`;
2338
2389
  function ImageProviderEffectsPanel({ controller, className = "", components }) {
2339
- const [, setTick] = useState9(0);
2390
+ const [, setTick] = useState10(0);
2340
2391
  useEffect7(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
2341
- const [browse, setBrowse] = useState9(null);
2342
- const [message, setMessage] = useState9(null);
2343
- const [open, setOpen] = useState9(null);
2344
- const [scrubbed, setScrubbed] = useState9(null);
2392
+ const [browse, setBrowse] = useState10(null);
2393
+ const [message, setMessage] = useState10(null);
2394
+ const [open, setOpen] = useState10(null);
2395
+ const [scrubbed, setScrubbed] = useState10(null);
2345
2396
  const provider = controller.effectsProvider;
2346
2397
  const state = controller.getState();
2347
2398
  const layer = state.activeLayerId ? findLayer(state.layers, state.activeLayerId)?.layer ?? null : null;
@@ -2384,18 +2435,18 @@ function ImageProviderEffectsPanel({ controller, className = "", components }) {
2384
2435
  });
2385
2436
  };
2386
2437
  const shown = scrubbed ?? timing?.time ?? 0;
2387
- return /* @__PURE__ */ jsxs11("section", { className: `flex flex-col gap-2 text-xs ${className}`, "aria-label": "Effects", "data-image-provider-effects": "", children: [
2388
- !provider && /* @__PURE__ */ jsx12("p", { className: "text-[11px] text-muted-foreground", children: "No effects provider is registered. Effects in the document are kept." }),
2389
- generator && layer && /* @__PURE__ */ jsxs11("div", { className: "space-y-2", "data-effect-part": "generator", children: [
2390
- /* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-1", children: [
2391
- /* @__PURE__ */ jsx12("span", { className: "min-w-0 flex-1 truncate font-medium text-foreground", title: generator.name ?? generator.effect, children: generator.name ?? generator.effect }),
2392
- /* @__PURE__ */ jsx12("button", { type: "button", className: imageOutlineButtonClass, disabled: !provider, "aria-pressed": browse === "change", onClick: () => setBrowse(browse === "change" ? null : "change"), children: "Change\u2026" }),
2393
- /* @__PURE__ */ jsx12("button", { type: "button", className: imageOutlineButtonClass, title: "Keep the pixels as a plain layer", onClick: () => run(() => controller.rasterizeEffectLayer(layer.id)), children: "Rasterize" })
2438
+ return /* @__PURE__ */ jsxs12("section", { className: `flex flex-col gap-2 text-xs ${className}`, "aria-label": "Effects", "data-image-provider-effects": "", children: [
2439
+ !provider && /* @__PURE__ */ jsx13("p", { className: "text-[11px] text-muted-foreground", children: "No effects provider is registered. Effects in the document are kept." }),
2440
+ generator && layer && /* @__PURE__ */ jsxs12("div", { className: "space-y-2", "data-effect-part": "generator", children: [
2441
+ /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-1", children: [
2442
+ /* @__PURE__ */ jsx13("span", { className: "min-w-0 flex-1 truncate font-medium text-foreground", title: generator.name ?? generator.effect, children: generator.name ?? generator.effect }),
2443
+ /* @__PURE__ */ jsx13("button", { type: "button", className: imageOutlineButtonClass, disabled: !provider, "aria-pressed": browse === "change", onClick: () => setBrowse(browse === "change" ? null : "change"), children: "Change\u2026" }),
2444
+ /* @__PURE__ */ jsx13("button", { type: "button", className: imageOutlineButtonClass, title: "Keep the pixels as a plain layer", onClick: () => run(() => controller.rasterizeEffectLayer(layer.id)), children: "Rasterize" })
2394
2445
  ] }),
2395
- browse === "change" && /* @__PURE__ */ jsx12(EffectsBrowser, { provider, uses: EFFECT_LAYER_USES, title: "Change the effect to", onPick: (e) => (setBrowse(null), run(() => controller.updateEffectLayer(layer.id, { effect: e.id }))) }),
2396
- timing && /* @__PURE__ */ jsxs11("div", { className: "space-y-1.5 rounded border border-border p-1.5", "data-effect-part": "timing", role: "group", "aria-label": "Frames", children: [
2397
- /* @__PURE__ */ jsxs11("div", { className: "flex gap-1", role: "radiogroup", "aria-label": "Output", children: [
2398
- /* @__PURE__ */ jsx12(
2446
+ browse === "change" && /* @__PURE__ */ jsx13(EffectsBrowser, { provider, uses: EFFECT_LAYER_USES, title: "Change the effect to", onPick: (e) => (setBrowse(null), run(() => controller.updateEffectLayer(layer.id, { effect: e.id }))) }),
2447
+ timing && /* @__PURE__ */ jsxs12("div", { className: "space-y-1.5 rounded border border-border p-1.5", "data-effect-part": "timing", role: "group", "aria-label": "Frames", children: [
2448
+ /* @__PURE__ */ jsxs12("div", { className: "flex gap-1", role: "radiogroup", "aria-label": "Output", children: [
2449
+ /* @__PURE__ */ jsx13(
2399
2450
  "button",
2400
2451
  {
2401
2452
  type: "button",
@@ -2406,7 +2457,7 @@ function ImageProviderEffectsPanel({ controller, className = "", components }) {
2406
2457
  children: "Still frame"
2407
2458
  }
2408
2459
  ),
2409
- /* @__PURE__ */ jsx12(
2460
+ /* @__PURE__ */ jsx13(
2410
2461
  "button",
2411
2462
  {
2412
2463
  type: "button",
@@ -2418,9 +2469,9 @@ function ImageProviderEffectsPanel({ controller, className = "", components }) {
2418
2469
  }
2419
2470
  )
2420
2471
  ] }),
2421
- /* @__PURE__ */ jsxs11("label", { className: "flex items-center gap-1.5", children: [
2422
- /* @__PURE__ */ jsx12("span", { className: "w-16 shrink-0 text-[11px] text-foreground", children: timing.mode === "still" ? "Frame" : "Starts at" }),
2423
- /* @__PURE__ */ jsx12(
2472
+ /* @__PURE__ */ jsxs12("label", { className: "flex items-center gap-1.5", children: [
2473
+ /* @__PURE__ */ jsx13("span", { className: "w-16 shrink-0 text-[11px] text-foreground", children: timing.mode === "still" ? "Frame" : "Starts at" }),
2474
+ /* @__PURE__ */ jsx13(
2424
2475
  ImageRange,
2425
2476
  {
2426
2477
  min: 0,
@@ -2434,11 +2485,11 @@ function ImageProviderEffectsPanel({ controller, className = "", components }) {
2434
2485
  onChange: (t) => scrubTo(layer.id, t)
2435
2486
  }
2436
2487
  ),
2437
- /* @__PURE__ */ jsx12("span", { className: "w-12 shrink-0 text-right tabular-nums text-muted-foreground", children: fmt(shown) })
2488
+ /* @__PURE__ */ jsx13("span", { className: "w-12 shrink-0 text-right tabular-nums text-muted-foreground", children: fmt(shown) })
2438
2489
  ] }),
2439
- timing.mode === "animate" && /* @__PURE__ */ jsxs11("label", { className: "flex items-center gap-1.5", children: [
2440
- /* @__PURE__ */ jsx12("span", { className: "w-16 shrink-0 text-[11px] text-foreground", children: "Length" }),
2441
- /* @__PURE__ */ jsx12(
2490
+ timing.mode === "animate" && /* @__PURE__ */ jsxs12("label", { className: "flex items-center gap-1.5", children: [
2491
+ /* @__PURE__ */ jsx13("span", { className: "w-16 shrink-0 text-[11px] text-foreground", children: "Length" }),
2492
+ /* @__PURE__ */ jsx13(
2442
2493
  "input",
2443
2494
  {
2444
2495
  type: "number",
@@ -2455,13 +2506,13 @@ function ImageProviderEffectsPanel({ controller, className = "", components }) {
2455
2506
  },
2456
2507
  timing.duration
2457
2508
  ),
2458
- /* @__PURE__ */ jsxs11("span", { className: "text-muted-foreground", children: [
2509
+ /* @__PURE__ */ jsxs12("span", { className: "text-muted-foreground", children: [
2459
2510
  "s",
2460
2511
  timing.loops ? ` \xB7 loops every ${fmt(timing.range)}` : ""
2461
2512
  ] })
2462
2513
  ] })
2463
2514
  ] }),
2464
- /* @__PURE__ */ jsx12(
2515
+ /* @__PURE__ */ jsx13(
2465
2516
  ImageEffectControls,
2466
2517
  {
2467
2518
  provider,
@@ -2474,19 +2525,19 @@ function ImageProviderEffectsPanel({ controller, className = "", components }) {
2474
2525
  }
2475
2526
  )
2476
2527
  ] }),
2477
- layer && canFilter && /* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-1", "data-effect-part": "applied", children: [
2478
- /* @__PURE__ */ jsx12("span", { className: "flex-1 font-semibold uppercase tracking-wider text-[11px] text-foreground", children: "Filters" }),
2479
- /* @__PURE__ */ jsx12("button", { type: "button", className: imageOutlineButtonClass, "aria-pressed": browse === "filter", onClick: () => setBrowse(browse === "filter" ? null : "filter"), children: "Add filter\u2026" })
2528
+ layer && canFilter && /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-1", "data-effect-part": "applied", children: [
2529
+ /* @__PURE__ */ jsx13("span", { className: "flex-1 font-semibold uppercase tracking-wider text-[11px] text-foreground", children: "Filters" }),
2530
+ /* @__PURE__ */ jsx13("button", { type: "button", className: imageOutlineButtonClass, "aria-pressed": browse === "filter", onClick: () => setBrowse(browse === "filter" ? null : "filter"), children: "Add filter\u2026" })
2480
2531
  ] }),
2481
- browse === "filter" && layer && /* @__PURE__ */ jsx12(EffectsBrowser, { provider, uses: ["filter"], title: "Filters", onPick: (e) => (setBrowse(null), run(() => controller.applyEffectFilter(layer.id, e.id, { useSelection: true }))) }),
2482
- filters.length > 0 && layer && /* @__PURE__ */ jsx12("ol", { className: "space-y-1", "data-effect-part": "filters", "aria-label": "Filters", children: filters.map((f) => {
2532
+ browse === "filter" && layer && /* @__PURE__ */ jsx13(EffectsBrowser, { provider, uses: ["filter"], title: "Filters", onPick: (e) => (setBrowse(null), run(() => controller.applyEffectFilter(layer.id, e.id, { useSelection: true }))) }),
2533
+ filters.length > 0 && layer && /* @__PURE__ */ jsx13("ol", { className: "space-y-1", "data-effect-part": "filters", "aria-label": "Filters", children: filters.map((f) => {
2483
2534
  const label = f.kind === "effect" ? f.name ?? f.effect : f.kind;
2484
2535
  const all = layer.smartFilters.filters;
2485
2536
  const index = all.indexOf(f);
2486
2537
  if (f.kind !== "effect") return null;
2487
- return /* @__PURE__ */ jsxs11("li", { className: "rounded border border-border p-1", "data-smart-effect": f.id, children: [
2488
- /* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-1", children: [
2489
- /* @__PURE__ */ jsx12(
2538
+ return /* @__PURE__ */ jsxs12("li", { className: "rounded border border-border p-1", "data-smart-effect": f.id, children: [
2539
+ /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-1", children: [
2540
+ /* @__PURE__ */ jsx13(
2490
2541
  ImageCheckbox,
2491
2542
  {
2492
2543
  checked: f.enabled,
@@ -2494,15 +2545,15 @@ function ImageProviderEffectsPanel({ controller, className = "", components }) {
2494
2545
  onChange: (enabled) => run(() => controller.updateEffectFilter(layer.id, f.id, { enabled }))
2495
2546
  }
2496
2547
  ),
2497
- /* @__PURE__ */ jsx12("button", { type: "button", className: "min-w-0 flex-1 truncate text-left text-foreground", "aria-expanded": open === f.id, onClick: () => setOpen(open === f.id ? null : f.id), children: label }),
2498
- /* @__PURE__ */ jsx12("button", { type: "button", className: imageOutlineButtonClass, disabled: index === all.length - 1, "aria-label": "Move up", onClick: () => run(() => controller.updateEffectFilter(layer.id, f.id, { index: index + 1 })), children: "\u2191" }),
2499
- /* @__PURE__ */ jsx12("button", { type: "button", className: imageOutlineButtonClass, disabled: index === 0, "aria-label": "Move down", onClick: () => run(() => controller.updateEffectFilter(layer.id, f.id, { index: index - 1 })), children: "\u2193" }),
2500
- /* @__PURE__ */ jsx12("button", { type: "button", className: imageOutlineButtonClass, "aria-label": `Remove ${label}`, onClick: () => run(() => controller.removeSmartFilter(layer.id, f.id)), children: "\u2715" })
2548
+ /* @__PURE__ */ jsx13("button", { type: "button", className: "min-w-0 flex-1 truncate text-left text-foreground", "aria-expanded": open === f.id, onClick: () => setOpen(open === f.id ? null : f.id), children: label }),
2549
+ /* @__PURE__ */ jsx13("button", { type: "button", className: imageOutlineButtonClass, disabled: index === all.length - 1, "aria-label": "Move up", onClick: () => run(() => controller.updateEffectFilter(layer.id, f.id, { index: index + 1 })), children: "\u2191" }),
2550
+ /* @__PURE__ */ jsx13("button", { type: "button", className: imageOutlineButtonClass, disabled: index === 0, "aria-label": "Move down", onClick: () => run(() => controller.updateEffectFilter(layer.id, f.id, { index: index - 1 })), children: "\u2193" }),
2551
+ /* @__PURE__ */ jsx13("button", { type: "button", className: imageOutlineButtonClass, "aria-label": `Remove ${label}`, onClick: () => run(() => controller.removeSmartFilter(layer.id, f.id)), children: "\u2715" })
2501
2552
  ] }),
2502
- open === f.id && /* @__PURE__ */ jsxs11("div", { className: "mt-1 space-y-2", children: [
2503
- /* @__PURE__ */ jsxs11("label", { className: "flex items-center gap-1", children: [
2504
- /* @__PURE__ */ jsx12("span", { className: "w-14 text-[11px] text-foreground", children: "Opacity" }),
2505
- /* @__PURE__ */ jsx12(
2553
+ open === f.id && /* @__PURE__ */ jsxs12("div", { className: "mt-1 space-y-2", children: [
2554
+ /* @__PURE__ */ jsxs12("label", { className: "flex items-center gap-1", children: [
2555
+ /* @__PURE__ */ jsx13("span", { className: "w-14 text-[11px] text-foreground", children: "Opacity" }),
2556
+ /* @__PURE__ */ jsx13(
2506
2557
  ImageRange,
2507
2558
  {
2508
2559
  min: 0,
@@ -2515,7 +2566,7 @@ function ImageProviderEffectsPanel({ controller, className = "", components }) {
2515
2566
  }
2516
2567
  )
2517
2568
  ] }),
2518
- /* @__PURE__ */ jsx12(
2569
+ /* @__PURE__ */ jsx13(
2519
2570
  ImageEffectControls,
2520
2571
  {
2521
2572
  provider,
@@ -2530,14 +2581,14 @@ function ImageProviderEffectsPanel({ controller, className = "", components }) {
2530
2581
  ] })
2531
2582
  ] }, f.id);
2532
2583
  }) }),
2533
- layer && canFilter && !generator && filters.length === 0 && /* @__PURE__ */ jsx12("p", { className: "text-[11px] text-muted-foreground", children: "No filters yet. A filter changes the layer's pixels and stays editable. Layer styles such as a drop shadow are in the layer's properties; new effect layers are added from the layers panel." }),
2534
- !layer && /* @__PURE__ */ jsx12("p", { className: "text-[11px] text-muted-foreground", children: "Select a layer to apply effects to it." }),
2535
- message && /* @__PURE__ */ jsx12("p", { role: "alert", className: "text-[11px] text-destructive", children: message })
2584
+ layer && canFilter && !generator && filters.length === 0 && /* @__PURE__ */ jsx13("p", { className: "text-[11px] text-muted-foreground", children: "No filters yet. A filter changes the layer's pixels and stays editable. Layer styles such as a drop shadow are in the layer's properties; new effect layers are added from the layers panel." }),
2585
+ !layer && /* @__PURE__ */ jsx13("p", { className: "text-[11px] text-muted-foreground", children: "Select a layer to apply effects to it." }),
2586
+ message && /* @__PURE__ */ jsx13("p", { role: "alert", className: "text-[11px] text-destructive", children: message })
2536
2587
  ] });
2537
2588
  }
2538
2589
 
2539
2590
  // src/image-editor/BrushOptionsBar.tsx
2540
- import { useEffect as useEffect8, useState as useState10 } from "react";
2591
+ import { useEffect as useEffect8, useState as useState11 } from "react";
2541
2592
  import {
2542
2593
  BRUSH_OPTION_CONTROLS,
2543
2594
  MIXER_MIXING_OPTIONS,
@@ -2558,15 +2609,15 @@ import { DEFAULT_PAINT_GRADIENT, userErrorMessage } from "@pixerate/editor/image
2558
2609
 
2559
2610
  // src/image-editor/PaintGradientEditor.tsx
2560
2611
  import { PAINT_GRADIENT_KIT } from "@pixerate/editor/image-editor";
2561
- import { jsx as jsx13 } from "react/jsx-runtime";
2562
- var PaintGradientEditor = (props) => /* @__PURE__ */ jsx13(PaintGradientEditorView, { ...props, kit: PAINT_GRADIENT_KIT });
2612
+ import { jsx as jsx14 } from "react/jsx-runtime";
2613
+ var PaintGradientEditor = (props) => /* @__PURE__ */ jsx14(PaintGradientEditorView, { ...props, kit: PAINT_GRADIENT_KIT });
2563
2614
 
2564
2615
  // src/image-editor/BrushOptionsBar.tsx
2565
- import { jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
2616
+ import { jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
2566
2617
  var BrushOptionsBar = ({ controller, className }) => {
2567
- const [, setTick] = useState10(0);
2618
+ const [, setTick] = useState11(0);
2568
2619
  useEffect8(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
2569
- const [error, setError] = useState10(null);
2620
+ const [error, setError] = useState11(null);
2570
2621
  const state = controller.getState();
2571
2622
  const { brush, foreground, background, mixer, mixerLoad, retouch, cloneSource, paint } = state.paint;
2572
2623
  const tool = state.activeTool;
@@ -2578,8 +2629,8 @@ var BrushOptionsBar = ({ controller, className }) => {
2578
2629
  setError(userErrorMessage(err));
2579
2630
  }
2580
2631
  };
2581
- return /* @__PURE__ */ jsxs12("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "brush-options", children: [
2582
- /* @__PURE__ */ jsx14("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Paint tools", children: PAINT_TOOLS.map((t) => /* @__PURE__ */ jsx14(
2632
+ return /* @__PURE__ */ jsxs13("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "brush-options", children: [
2633
+ /* @__PURE__ */ jsx15("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Paint tools", children: PAINT_TOOLS.map((t) => /* @__PURE__ */ jsx15(
2583
2634
  "button",
2584
2635
  {
2585
2636
  type: "button",
@@ -2591,18 +2642,18 @@ var BrushOptionsBar = ({ controller, className }) => {
2591
2642
  },
2592
2643
  t.id
2593
2644
  )) }),
2594
- /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-2", role: "group", "aria-label": "Colours", children: [
2595
- /* @__PURE__ */ jsxs12("label", { className: "flex items-center gap-1", children: [
2596
- /* @__PURE__ */ jsx14(ImageColor, { label: "Foreground colour", value: foreground, onChange: (fg) => controller.setPaintOptions({ foreground: fg }) }),
2597
- /* @__PURE__ */ jsx14("span", { className: "text-muted-foreground", children: "FG" })
2645
+ /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-2", role: "group", "aria-label": "Colours", children: [
2646
+ /* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-1", children: [
2647
+ /* @__PURE__ */ jsx15(ImageColor, { label: "Foreground colour", value: foreground, onChange: (fg) => controller.setPaintOptions({ foreground: fg }) }),
2648
+ /* @__PURE__ */ jsx15("span", { className: "text-muted-foreground", children: "FG" })
2598
2649
  ] }),
2599
- /* @__PURE__ */ jsxs12("label", { className: "flex items-center gap-1", children: [
2600
- /* @__PURE__ */ jsx14(ImageColor, { label: "Background colour", value: background, onChange: (bg) => controller.setPaintOptions({ background: bg }) }),
2601
- /* @__PURE__ */ jsx14("span", { className: "text-muted-foreground", children: "BG" })
2650
+ /* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-1", children: [
2651
+ /* @__PURE__ */ jsx15(ImageColor, { label: "Background colour", value: background, onChange: (bg) => controller.setPaintOptions({ background: bg }) }),
2652
+ /* @__PURE__ */ jsx15("span", { className: "text-muted-foreground", children: "BG" })
2602
2653
  ] }),
2603
- /* @__PURE__ */ jsx14("button", { type: "button", title: "Swap colours (X)", className: imageChipClass(false), onClick: () => controller.swapPaintColors(), children: "Swap" }),
2604
- /* @__PURE__ */ jsx14("button", { type: "button", title: "Default colours (D)", className: imageChipClass(false), onClick: () => controller.resetPaintColors(), children: "Default" }),
2605
- state.activeTool === "brush" && /* @__PURE__ */ jsx14(
2654
+ /* @__PURE__ */ jsx15("button", { type: "button", title: "Swap colours (X)", className: imageChipClass(false), onClick: () => controller.swapPaintColors(), children: "Swap" }),
2655
+ /* @__PURE__ */ jsx15("button", { type: "button", title: "Default colours (D)", className: imageChipClass(false), onClick: () => controller.resetPaintColors(), children: "Default" }),
2656
+ state.activeTool === "brush" && /* @__PURE__ */ jsx15(
2606
2657
  "button",
2607
2658
  {
2608
2659
  type: "button",
@@ -2614,8 +2665,8 @@ var BrushOptionsBar = ({ controller, className }) => {
2614
2665
  }
2615
2666
  )
2616
2667
  ] }),
2617
- state.activeTool === "brush" && paint.type === "gradient" && /* @__PURE__ */ jsx14(PaintGradientEditor, { value: paint, colors: { paint: foreground, secondary: background }, onChange: (g) => attempt(() => controller.setPaintOptions({ paint: g })) }),
2618
- BRUSH_OPTION_CONTROLS.map((spec) => /* @__PURE__ */ jsx14(
2668
+ state.activeTool === "brush" && paint.type === "gradient" && /* @__PURE__ */ jsx15(PaintGradientEditor, { value: paint, colors: { paint: foreground, secondary: background }, onChange: (g) => attempt(() => controller.setPaintOptions({ paint: g })) }),
2669
+ BRUSH_OPTION_CONTROLS.map((spec) => /* @__PURE__ */ jsx15(
2619
2670
  ControlSlider,
2620
2671
  {
2621
2672
  spec,
@@ -2624,9 +2675,9 @@ var BrushOptionsBar = ({ controller, className }) => {
2624
2675
  },
2625
2676
  spec.id
2626
2677
  )),
2627
- state.activeTool === "mixer" && /* @__PURE__ */ jsxs12("div", { className: "flex flex-col gap-2 border-t border-border pt-2", role: "group", "aria-label": "Mixer Brush", "data-testid": "mixer-options", children: [
2628
- /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-2", children: [
2629
- /* @__PURE__ */ jsx14(
2678
+ state.activeTool === "mixer" && /* @__PURE__ */ jsxs13("div", { className: "flex flex-col gap-2 border-t border-border pt-2", role: "group", "aria-label": "Mixer Brush", "data-testid": "mixer-options", children: [
2679
+ /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-2", children: [
2680
+ /* @__PURE__ */ jsx15(
2630
2681
  "span",
2631
2682
  {
2632
2683
  "aria-label": "Brush load",
@@ -2635,10 +2686,10 @@ var BrushOptionsBar = ({ controller, className }) => {
2635
2686
  style: { background: mixerLoad.reservoir ? rgbUnitToHex(mixerLoad.reservoir) : "transparent" }
2636
2687
  }
2637
2688
  ),
2638
- /* @__PURE__ */ jsx14("button", { type: "button", title: "Fill the reservoir with the foreground colour", className: imageChipClass(false), onClick: () => controller.loadMixerBrush(), children: "Load brush" }),
2639
- /* @__PURE__ */ jsx14("button", { type: "button", title: "Empty the picked-up colour", className: imageChipClass(false), onClick: () => controller.cleanMixerBrush(), children: "Clean brush" })
2689
+ /* @__PURE__ */ jsx15("button", { type: "button", title: "Fill the reservoir with the foreground colour", className: imageChipClass(false), onClick: () => controller.loadMixerBrush(), children: "Load brush" }),
2690
+ /* @__PURE__ */ jsx15("button", { type: "button", title: "Empty the picked-up colour", className: imageChipClass(false), onClick: () => controller.cleanMixerBrush(), children: "Clean brush" })
2640
2691
  ] }),
2641
- /* @__PURE__ */ jsx14("div", { className: "flex gap-1", role: "group", "aria-label": "Mixing", children: MIXER_MIXING_OPTIONS.map((m) => /* @__PURE__ */ jsx14(
2692
+ /* @__PURE__ */ jsx15("div", { className: "flex gap-1", role: "group", "aria-label": "Mixing", children: MIXER_MIXING_OPTIONS.map((m) => /* @__PURE__ */ jsx15(
2642
2693
  "button",
2643
2694
  {
2644
2695
  type: "button",
@@ -2650,34 +2701,34 @@ var BrushOptionsBar = ({ controller, className }) => {
2650
2701
  },
2651
2702
  m.id
2652
2703
  )) }),
2653
- MIXER_OPTION_CONTROLS.map((spec) => /* @__PURE__ */ jsx14(ControlSlider, { spec, value: mixer[spec.id], onChange: (v) => controller.setPaintOptions({ mixer: { [spec.id]: v } }) }, spec.id)),
2654
- /* @__PURE__ */ jsxs12("div", { className: "flex flex-wrap gap-3 text-foreground", children: [
2655
- /* @__PURE__ */ jsxs12("label", { className: "flex items-center gap-1.5", children: [
2656
- /* @__PURE__ */ jsx14(ImageCheckbox, { label: "Load the brush after each stroke", checked: mixer.loadEachStroke, onChange: (on) => controller.setPaintOptions({ mixer: { loadEachStroke: on } }) }),
2704
+ MIXER_OPTION_CONTROLS.map((spec) => /* @__PURE__ */ jsx15(ControlSlider, { spec, value: mixer[spec.id], onChange: (v) => controller.setPaintOptions({ mixer: { [spec.id]: v } }) }, spec.id)),
2705
+ /* @__PURE__ */ jsxs13("div", { className: "flex flex-wrap gap-3 text-foreground", children: [
2706
+ /* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-1.5", children: [
2707
+ /* @__PURE__ */ jsx15(ImageCheckbox, { label: "Load the brush after each stroke", checked: mixer.loadEachStroke, onChange: (on) => controller.setPaintOptions({ mixer: { loadEachStroke: on } }) }),
2657
2708
  "Load each stroke"
2658
2709
  ] }),
2659
- /* @__PURE__ */ jsxs12("label", { className: "flex items-center gap-1.5", children: [
2660
- /* @__PURE__ */ jsx14(ImageCheckbox, { label: "Clean the brush after each stroke", checked: mixer.cleanEachStroke, onChange: (on) => controller.setPaintOptions({ mixer: { cleanEachStroke: on } }) }),
2710
+ /* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-1.5", children: [
2711
+ /* @__PURE__ */ jsx15(ImageCheckbox, { label: "Clean the brush after each stroke", checked: mixer.cleanEachStroke, onChange: (on) => controller.setPaintOptions({ mixer: { cleanEachStroke: on } }) }),
2661
2712
  "Clean each stroke"
2662
2713
  ] })
2663
2714
  ] })
2664
2715
  ] }),
2665
- isRetouchPaintTool(tool) && /* @__PURE__ */ jsxs12("div", { className: "flex flex-col gap-2 border-t border-border pt-2", role: "group", "aria-label": "Retouch options", "data-testid": "retouch-options", children: [
2666
- (tool === "clone" || tool === "heal") && /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-2", children: [
2667
- /* @__PURE__ */ jsx14("span", { className: "text-muted-foreground", "data-testid": "clone-source", children: cloneSourceLabel(controller) }),
2668
- cloneSource && /* @__PURE__ */ jsx14("button", { type: "button", title: "Forget the source point", className: imageChipClass(false), onClick: () => controller.setCloneSource(null), children: "Clear source" })
2716
+ isRetouchPaintTool(tool) && /* @__PURE__ */ jsxs13("div", { className: "flex flex-col gap-2 border-t border-border pt-2", role: "group", "aria-label": "Retouch options", "data-testid": "retouch-options", children: [
2717
+ (tool === "clone" || tool === "heal") && /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-2", children: [
2718
+ /* @__PURE__ */ jsx15("span", { className: "text-muted-foreground", "data-testid": "clone-source", children: cloneSourceLabel(controller) }),
2719
+ cloneSource && /* @__PURE__ */ jsx15("button", { type: "button", title: "Forget the source point", className: imageChipClass(false), onClick: () => controller.setCloneSource(null), children: "Clear source" })
2669
2720
  ] }),
2670
- (tool === "clone" || tool === "heal") && /* @__PURE__ */ jsxs12("div", { className: "flex flex-col gap-1", role: "group", "aria-label": "Clone source transform", "data-testid": "clone-transform", children: [
2671
- CLONE_TRANSFORM_CONTROLS.map((spec) => /* @__PURE__ */ jsx14(ControlSlider, { spec, value: cloneTransformView(controller)[spec.id], onChange: (v) => setCloneTransformValue(controller, spec.id, v) }, spec.id)),
2672
- /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-1", children: [
2673
- /* @__PURE__ */ jsx14("button", { type: "button", "aria-pressed": cloneTransformView(controller).flipH, title: "Mirror the source left to right", className: imageChipClass(cloneTransformView(controller).flipH), onClick: () => setCloneTransformValue(controller, "flipH"), children: "Flip H" }),
2674
- /* @__PURE__ */ jsx14("button", { type: "button", "aria-pressed": cloneTransformView(controller).flipV, title: "Mirror the source top to bottom", className: imageChipClass(cloneTransformView(controller).flipV), onClick: () => setCloneTransformValue(controller, "flipV"), children: "Flip V" }),
2675
- !cloneTransformView(controller).identity && /* @__PURE__ */ jsx14("button", { type: "button", title: "Back to 100 %, no flip, 0\xB0", className: imageChipClass(false), onClick: () => controller.setCloneTransform(null), children: "Reset transform" })
2721
+ (tool === "clone" || tool === "heal") && /* @__PURE__ */ jsxs13("div", { className: "flex flex-col gap-1", role: "group", "aria-label": "Clone source transform", "data-testid": "clone-transform", children: [
2722
+ CLONE_TRANSFORM_CONTROLS.map((spec) => /* @__PURE__ */ jsx15(ControlSlider, { spec, value: cloneTransformView(controller)[spec.id], onChange: (v) => setCloneTransformValue(controller, spec.id, v) }, spec.id)),
2723
+ /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-1", children: [
2724
+ /* @__PURE__ */ jsx15("button", { type: "button", "aria-pressed": cloneTransformView(controller).flipH, title: "Mirror the source left to right", className: imageChipClass(cloneTransformView(controller).flipH), onClick: () => setCloneTransformValue(controller, "flipH"), children: "Flip H" }),
2725
+ /* @__PURE__ */ jsx15("button", { type: "button", "aria-pressed": cloneTransformView(controller).flipV, title: "Mirror the source top to bottom", className: imageChipClass(cloneTransformView(controller).flipV), onClick: () => setCloneTransformValue(controller, "flipV"), children: "Flip V" }),
2726
+ !cloneTransformView(controller).identity && /* @__PURE__ */ jsx15("button", { type: "button", title: "Back to 100 %, no flip, 0\xB0", className: imageChipClass(false), onClick: () => controller.setCloneTransform(null), children: "Reset transform" })
2676
2727
  ] })
2677
2728
  ] }),
2678
- RETOUCH_CHOICES.filter((c) => c.tools.includes(tool)).map((choice) => /* @__PURE__ */ jsxs12("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": choice.label, children: [
2679
- /* @__PURE__ */ jsx14("span", { className: "text-muted-foreground", children: choice.label }),
2680
- choice.options.map((o) => /* @__PURE__ */ jsx14(
2729
+ RETOUCH_CHOICES.filter((c) => c.tools.includes(tool)).map((choice) => /* @__PURE__ */ jsxs13("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": choice.label, children: [
2730
+ /* @__PURE__ */ jsx15("span", { className: "text-muted-foreground", children: choice.label }),
2731
+ choice.options.map((o) => /* @__PURE__ */ jsx15(
2681
2732
  "button",
2682
2733
  {
2683
2734
  type: "button",
@@ -2690,43 +2741,43 @@ var BrushOptionsBar = ({ controller, className }) => {
2690
2741
  o.id
2691
2742
  ))
2692
2743
  ] }, choice.id)),
2693
- RETOUCH_OPTION_CONTROLS.filter((c) => c.tools.includes(tool)).map((spec) => /* @__PURE__ */ jsx14(ControlSlider, { spec, value: retouch[spec.id], onChange: (v) => controller.setPaintOptions({ retouch: { [spec.id]: v } }) }, spec.id)),
2694
- /* @__PURE__ */ jsx14("div", { className: "flex flex-wrap gap-3 text-foreground", children: RETOUCH_TOGGLES.filter((t) => t.tools.includes(tool)).map((t) => /* @__PURE__ */ jsxs12("label", { className: "flex items-center gap-1.5", children: [
2695
- /* @__PURE__ */ jsx14(ImageCheckbox, { label: t.label, checked: retouch[t.id], onChange: (on) => controller.setPaintOptions({ retouch: { [t.id]: on } }) }),
2744
+ RETOUCH_OPTION_CONTROLS.filter((c) => c.tools.includes(tool)).map((spec) => /* @__PURE__ */ jsx15(ControlSlider, { spec, value: retouch[spec.id], onChange: (v) => controller.setPaintOptions({ retouch: { [spec.id]: v } }) }, spec.id)),
2745
+ /* @__PURE__ */ jsx15("div", { className: "flex flex-wrap gap-3 text-foreground", children: RETOUCH_TOGGLES.filter((t) => t.tools.includes(tool)).map((t) => /* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-1.5", children: [
2746
+ /* @__PURE__ */ jsx15(ImageCheckbox, { label: t.label, checked: retouch[t.id], onChange: (on) => controller.setPaintOptions({ retouch: { [t.id]: on } }) }),
2696
2747
  t.label
2697
2748
  ] }, t.id)) })
2698
2749
  ] }),
2699
- /* @__PURE__ */ jsxs12("div", { className: "flex flex-wrap gap-3 text-foreground", role: "group", "aria-label": "Pressure", children: [
2700
- /* @__PURE__ */ jsxs12("label", { className: "flex items-center gap-1.5", children: [
2701
- /* @__PURE__ */ jsx14(ImageCheckbox, { label: "Pressure controls size", checked: brush.pressureSize, onChange: (on) => controller.setPaintOptions({ brush: { pressureSize: on } }) }),
2750
+ /* @__PURE__ */ jsxs13("div", { className: "flex flex-wrap gap-3 text-foreground", role: "group", "aria-label": "Pressure", children: [
2751
+ /* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-1.5", children: [
2752
+ /* @__PURE__ */ jsx15(ImageCheckbox, { label: "Pressure controls size", checked: brush.pressureSize, onChange: (on) => controller.setPaintOptions({ brush: { pressureSize: on } }) }),
2702
2753
  "Pressure size"
2703
2754
  ] }),
2704
- /* @__PURE__ */ jsxs12("label", { className: "flex items-center gap-1.5", children: [
2705
- /* @__PURE__ */ jsx14(ImageCheckbox, { label: "Pressure controls opacity", checked: brush.pressureOpacity, onChange: (on) => controller.setPaintOptions({ brush: { pressureOpacity: on } }) }),
2755
+ /* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-1.5", children: [
2756
+ /* @__PURE__ */ jsx15(ImageCheckbox, { label: "Pressure controls opacity", checked: brush.pressureOpacity, onChange: (on) => controller.setPaintOptions({ brush: { pressureOpacity: on } }) }),
2706
2757
  "Pressure opacity"
2707
2758
  ] })
2708
2759
  ] }),
2709
- /* @__PURE__ */ jsxs12("div", { className: "flex gap-1", children: [
2710
- /* @__PURE__ */ jsx14("button", { type: "button", className: imageChipClass(false), onClick: () => attempt(() => controller.fillPixels()), children: "Fill" }),
2711
- /* @__PURE__ */ jsx14("button", { type: "button", className: imageChipClass(false), onClick: () => attempt(() => controller.clearPixels()), children: "Clear" })
2760
+ /* @__PURE__ */ jsxs13("div", { className: "flex gap-1", children: [
2761
+ /* @__PURE__ */ jsx15("button", { type: "button", className: imageChipClass(false), onClick: () => attempt(() => controller.fillPixels()), children: "Fill" }),
2762
+ /* @__PURE__ */ jsx15("button", { type: "button", className: imageChipClass(false), onClick: () => attempt(() => controller.clearPixels()), children: "Clear" })
2712
2763
  ] }),
2713
- error && /* @__PURE__ */ jsx14("p", { role: "alert", className: "text-destructive", children: error })
2764
+ error && /* @__PURE__ */ jsx15("p", { role: "alert", className: "text-destructive", children: error })
2714
2765
  ] });
2715
2766
  };
2716
2767
 
2717
2768
  // src/image-editor/ColorProfilePanel.tsx
2718
- import { useEffect as useEffect9, useState as useState11 } from "react";
2769
+ import { useEffect as useEffect9, useState as useState12 } from "react";
2719
2770
  import { COLOR_MODE_OPTIONS, INTENT_OPTIONS, PROOF_PROFILE_OPTIONS, WORKING_SPACE_OPTIONS, colorPanelView } from "@pixerate/editor/image-editor";
2720
- import { Fragment as Fragment2, jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
2771
+ import { Fragment as Fragment3, jsx as jsx16, jsxs as jsxs14 } from "react/jsx-runtime";
2721
2772
  var chip = imageChipClass(false);
2722
2773
  var select = "rounded bg-muted px-1 py-0.5 text-[11px] text-foreground";
2723
2774
  var ColorProfilePanel = ({ controller, className }) => {
2724
- const [, setTick] = useState11(0);
2775
+ const [, setTick] = useState12(0);
2725
2776
  useEffect9(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
2726
- const [target, setTarget] = useState11("display-p3");
2727
- const [intent, setIntent] = useState11("relative");
2728
- const [bpc, setBpc] = useState11(true);
2729
- const [error, setError] = useState11(null);
2777
+ const [target, setTarget] = useState12("display-p3");
2778
+ const [intent, setIntent] = useState12("relative");
2779
+ const [bpc, setBpc] = useState12(true);
2780
+ const [error, setError] = useState12(null);
2730
2781
  const view = colorPanelView(controller);
2731
2782
  const attempt = (fn) => {
2732
2783
  try {
@@ -2748,29 +2799,29 @@ var ColorProfilePanel = ({ controller, className }) => {
2748
2799
  })
2749
2800
  );
2750
2801
  };
2751
- return /* @__PURE__ */ jsxs13("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "color-profile-panel", children: [
2752
- /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-2", children: [
2753
- /* @__PURE__ */ jsx15("span", { className: "text-muted-foreground", children: "Profile" }),
2754
- /* @__PURE__ */ jsx15("span", { "data-testid": "color-profile-name", children: view.profileName })
2802
+ return /* @__PURE__ */ jsxs14("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "color-profile-panel", children: [
2803
+ /* @__PURE__ */ jsxs14("div", { className: "flex items-center gap-2", children: [
2804
+ /* @__PURE__ */ jsx16("span", { className: "text-muted-foreground", children: "Profile" }),
2805
+ /* @__PURE__ */ jsx16("span", { "data-testid": "color-profile-name", children: view.profileName })
2755
2806
  ] }),
2756
- /* @__PURE__ */ jsxs13("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": "Colour mode", children: [
2757
- /* @__PURE__ */ jsx15("span", { className: "text-muted-foreground", children: "Mode" }),
2758
- /* @__PURE__ */ jsx15("select", { "aria-label": "Colour mode", className: select, value: view.mode, onChange: (e) => attempt(() => controller.setColorMode(e.target.value)), children: COLOR_MODE_OPTIONS.map((o) => /* @__PURE__ */ jsx15("option", { value: o.id, title: o.title, children: o.label }, o.id)) }),
2759
- view.cmykProfileName && /* @__PURE__ */ jsx15("span", { className: "text-muted-foreground", children: view.cmykProfileName })
2807
+ /* @__PURE__ */ jsxs14("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": "Colour mode", children: [
2808
+ /* @__PURE__ */ jsx16("span", { className: "text-muted-foreground", children: "Mode" }),
2809
+ /* @__PURE__ */ jsx16("select", { "aria-label": "Colour mode", className: select, value: view.mode, onChange: (e) => attempt(() => controller.setColorMode(e.target.value)), children: COLOR_MODE_OPTIONS.map((o) => /* @__PURE__ */ jsx16("option", { value: o.id, title: o.title, children: o.label }, o.id)) }),
2810
+ view.cmykProfileName && /* @__PURE__ */ jsx16("span", { className: "text-muted-foreground", children: view.cmykProfileName })
2760
2811
  ] }),
2761
- /* @__PURE__ */ jsxs13("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": "Assign or convert", children: [
2762
- /* @__PURE__ */ jsx15("select", { "aria-label": "Target profile", className: select, value: target, onChange: (e) => setTarget(e.target.value), children: WORKING_SPACE_OPTIONS.map((o) => /* @__PURE__ */ jsx15("option", { value: o.id, children: o.label }, o.id)) }),
2763
- /* @__PURE__ */ jsx15("select", { "aria-label": "Rendering intent", className: select, value: intent, onChange: (e) => setIntent(e.target.value), children: INTENT_OPTIONS.map((o) => /* @__PURE__ */ jsx15("option", { value: o.id, title: o.title, children: o.label }, o.id)) }),
2764
- /* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-1", children: [
2765
- /* @__PURE__ */ jsx15("input", { type: "checkbox", "aria-label": "Black point compensation", checked: bpc, onChange: (e) => setBpc(e.target.checked), className: "accent-primary" }),
2812
+ /* @__PURE__ */ jsxs14("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": "Assign or convert", children: [
2813
+ /* @__PURE__ */ jsx16("select", { "aria-label": "Target profile", className: select, value: target, onChange: (e) => setTarget(e.target.value), children: WORKING_SPACE_OPTIONS.map((o) => /* @__PURE__ */ jsx16("option", { value: o.id, children: o.label }, o.id)) }),
2814
+ /* @__PURE__ */ jsx16("select", { "aria-label": "Rendering intent", className: select, value: intent, onChange: (e) => setIntent(e.target.value), children: INTENT_OPTIONS.map((o) => /* @__PURE__ */ jsx16("option", { value: o.id, title: o.title, children: o.label }, o.id)) }),
2815
+ /* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-1", children: [
2816
+ /* @__PURE__ */ jsx16("input", { type: "checkbox", "aria-label": "Black point compensation", checked: bpc, onChange: (e) => setBpc(e.target.checked), className: "accent-primary" }),
2766
2817
  "BPC"
2767
2818
  ] }),
2768
- /* @__PURE__ */ jsx15("button", { type: "button", className: chip, title: "Edit \u203A Assign Profile: keep the numbers", onClick: () => attempt(() => controller.assignProfile(target)), children: "Assign" }),
2769
- /* @__PURE__ */ jsx15("button", { type: "button", className: chip, title: "Edit \u203A Convert to Profile: keep the look", onClick: () => attempt(() => controller.convertToProfile(target, { intent, bpc })), children: "Convert" })
2819
+ /* @__PURE__ */ jsx16("button", { type: "button", className: chip, title: "Edit \u203A Assign Profile: keep the numbers", onClick: () => attempt(() => controller.assignProfile(target)), children: "Assign" }),
2820
+ /* @__PURE__ */ jsx16("button", { type: "button", className: chip, title: "Edit \u203A Convert to Profile: keep the look", onClick: () => attempt(() => controller.convertToProfile(target, { intent, bpc })), children: "Convert" })
2770
2821
  ] }),
2771
- /* @__PURE__ */ jsxs13("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": "Proof setup", children: [
2772
- /* @__PURE__ */ jsx15("span", { className: "text-muted-foreground", children: "Proof" }),
2773
- /* @__PURE__ */ jsxs13(
2822
+ /* @__PURE__ */ jsxs14("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": "Proof setup", children: [
2823
+ /* @__PURE__ */ jsx16("span", { className: "text-muted-foreground", children: "Proof" }),
2824
+ /* @__PURE__ */ jsxs14(
2774
2825
  "select",
2775
2826
  {
2776
2827
  "aria-label": "Proof profile",
@@ -2778,29 +2829,29 @@ var ColorProfilePanel = ({ controller, className }) => {
2778
2829
  value: view.proof?.id ?? "",
2779
2830
  onChange: (e) => e.target.value ? proofWith({ id: e.target.value }) : attempt(() => controller.setProofSetup(null)),
2780
2831
  children: [
2781
- /* @__PURE__ */ jsx15("option", { value: "", children: "Off" }),
2782
- PROOF_PROFILE_OPTIONS.map((o) => /* @__PURE__ */ jsx15("option", { value: o.id, children: o.label }, o.id))
2832
+ /* @__PURE__ */ jsx16("option", { value: "", children: "Off" }),
2833
+ PROOF_PROFILE_OPTIONS.map((o) => /* @__PURE__ */ jsx16("option", { value: o.id, children: o.label }, o.id))
2783
2834
  ]
2784
2835
  }
2785
2836
  ),
2786
- view.proof && /* @__PURE__ */ jsxs13(Fragment2, { children: [
2787
- /* @__PURE__ */ jsx15("select", { "aria-label": "Proof intent", className: select, value: view.proof.intent, onChange: (e) => proofWith({ intent: e.target.value }), children: INTENT_OPTIONS.map((o) => /* @__PURE__ */ jsx15("option", { value: o.id, children: o.label }, o.id)) }),
2788
- /* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-1", children: [
2789
- /* @__PURE__ */ jsx15("input", { type: "checkbox", "aria-label": "Simulate paper colour", checked: view.proof.simulatePaper, onChange: (e) => proofWith({ simulatePaper: e.target.checked }), className: "accent-primary" }),
2837
+ view.proof && /* @__PURE__ */ jsxs14(Fragment3, { children: [
2838
+ /* @__PURE__ */ jsx16("select", { "aria-label": "Proof intent", className: select, value: view.proof.intent, onChange: (e) => proofWith({ intent: e.target.value }), children: INTENT_OPTIONS.map((o) => /* @__PURE__ */ jsx16("option", { value: o.id, children: o.label }, o.id)) }),
2839
+ /* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-1", children: [
2840
+ /* @__PURE__ */ jsx16("input", { type: "checkbox", "aria-label": "Simulate paper colour", checked: view.proof.simulatePaper, onChange: (e) => proofWith({ simulatePaper: e.target.checked }), className: "accent-primary" }),
2790
2841
  "Paper"
2791
2842
  ] }),
2792
- /* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-1", children: [
2793
- /* @__PURE__ */ jsx15("input", { type: "checkbox", "aria-label": "Gamut warning", checked: view.proof.gamutWarning, onChange: (e) => proofWith({ gamutWarning: e.target.checked }), className: "accent-primary" }),
2843
+ /* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-1", children: [
2844
+ /* @__PURE__ */ jsx16("input", { type: "checkbox", "aria-label": "Gamut warning", checked: view.proof.gamutWarning, onChange: (e) => proofWith({ gamutWarning: e.target.checked }), className: "accent-primary" }),
2794
2845
  "Gamut warning"
2795
2846
  ] })
2796
2847
  ] })
2797
2848
  ] }),
2798
- error && /* @__PURE__ */ jsx15("p", { role: "alert", className: "text-destructive", children: error })
2849
+ error && /* @__PURE__ */ jsx16("p", { role: "alert", className: "text-destructive", children: error })
2799
2850
  ] });
2800
2851
  };
2801
2852
 
2802
2853
  // src/image-editor/SelectionOptionsBar.tsx
2803
- import { useRef as useRef10, useState as useState14 } from "react";
2854
+ import { useRef as useRef10, useState as useState15 } from "react";
2804
2855
  import {
2805
2856
  COLOR_RANGE_PRESETS,
2806
2857
  COLOR_RANGE_PRESET_LABELS,
@@ -2811,18 +2862,18 @@ import {
2811
2862
  } from "@pixerate/editor/image-editor";
2812
2863
 
2813
2864
  // src/image-editor/SelectAndMaskWorkspace.tsx
2814
- import { useEffect as useEffect10, useMemo as useMemo4, useRef as useRef8, useState as useState12 } from "react";
2865
+ import { useEffect as useEffect10, useMemo as useMemo4, useRef as useRef8, useState as useState13 } from "react";
2815
2866
  import { REFINE_EDGE_CONTROLS, REFINE_OUTPUTS, SELECT_AND_MASK_TOOLS, SELECT_AND_MASK_VIEWS, SelectAndMaskSession } from "@pixerate/editor/image-editor";
2816
- import { jsx as jsx16, jsxs as jsxs14 } from "react/jsx-runtime";
2867
+ import { jsx as jsx17, jsxs as jsxs15 } from "react/jsx-runtime";
2817
2868
  var button = "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";
2818
2869
  var toggle = (on) => `${button} ${on ? "bg-primary text-primary-foreground border-primary" : ""}`;
2819
2870
  var SelectAndMaskWorkspace = ({ controller, onClose, className = "" }) => {
2820
2871
  const session = useMemo4(() => new SelectAndMaskSession(controller), [controller]);
2821
- const [, setRevision] = useState12(0);
2822
- const [zoom, setZoom] = useState12(1);
2823
- const [pan, setPan] = useState12({ x: 0, y: 0 });
2824
- const [busy, setBusy] = useState12(false);
2825
- const [error, setError] = useState12(null);
2872
+ const [, setRevision] = useState13(0);
2873
+ const [zoom, setZoom] = useState13(1);
2874
+ const [pan, setPan] = useState13({ x: 0, y: 0 });
2875
+ const [busy, setBusy] = useState13(false);
2876
+ const [error, setError] = useState13(null);
2826
2877
  const canvasRef = useRef8(null);
2827
2878
  const panFrom = useRef8(null);
2828
2879
  const settings = session.settings;
@@ -2898,7 +2949,7 @@ var SelectAndMaskWorkspace = ({ controller, onClose, className = "" }) => {
2898
2949
  };
2899
2950
  const toLayer = settings.output !== "selection" && settings.output !== "layer-mask";
2900
2951
  const brushTool = settings.tool === "quick-select" || settings.tool === "brush" || settings.tool === "refine-brush";
2901
- return /* @__PURE__ */ jsxs14(
2952
+ return /* @__PURE__ */ jsxs15(
2902
2953
  "div",
2903
2954
  {
2904
2955
  "data-testid": "select-and-mask-workspace",
@@ -2906,12 +2957,12 @@ var SelectAndMaskWorkspace = ({ controller, onClose, className = "" }) => {
2906
2957
  "aria-label": "Select and Mask",
2907
2958
  className: `fixed inset-0 z-50 flex bg-background text-xs text-foreground ${className}`,
2908
2959
  children: [
2909
- /* @__PURE__ */ jsx16("div", { role: "group", "aria-label": "Select and Mask tool", className: "flex flex-col gap-1 p-2 border-r border-border", children: SELECT_AND_MASK_TOOLS.map((t) => /* @__PURE__ */ jsx16("button", { type: "button", title: `${t.label} (${t.key.toUpperCase()})`, "aria-pressed": settings.tool === t.id, className: toggle(settings.tool === t.id), onClick: () => set({ tool: t.id }), children: t.label }, t.id)) }),
2910
- /* @__PURE__ */ jsxs14("div", { className: "flex-1 flex flex-col min-w-0", children: [
2911
- /* @__PURE__ */ jsxs14("div", { className: "flex flex-wrap items-center gap-2 p-2 border-b border-border", children: [
2912
- brushTool && /* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
2960
+ /* @__PURE__ */ jsx17("div", { role: "group", "aria-label": "Select and Mask tool", className: "flex flex-col gap-1 p-2 border-r border-border", children: SELECT_AND_MASK_TOOLS.map((t) => /* @__PURE__ */ jsx17("button", { type: "button", title: `${t.label} (${t.key.toUpperCase()})`, "aria-pressed": settings.tool === t.id, className: toggle(settings.tool === t.id), onClick: () => set({ tool: t.id }), children: t.label }, t.id)) }),
2961
+ /* @__PURE__ */ jsxs15("div", { className: "flex-1 flex flex-col min-w-0", children: [
2962
+ /* @__PURE__ */ jsxs15("div", { className: "flex flex-wrap items-center gap-2 p-2 border-b border-border", children: [
2963
+ brushTool && /* @__PURE__ */ jsxs15("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
2913
2964
  "Size",
2914
- /* @__PURE__ */ jsx16(
2965
+ /* @__PURE__ */ jsx17(
2915
2966
  "input",
2916
2967
  {
2917
2968
  type: "number",
@@ -2924,22 +2975,22 @@ var SelectAndMaskWorkspace = ({ controller, onClose, className = "" }) => {
2924
2975
  ),
2925
2976
  "px"
2926
2977
  ] }),
2927
- settings.tool !== "refine-brush" && settings.tool !== "hand" && settings.tool !== "zoom" && /* @__PURE__ */ jsxs14("div", { role: "group", "aria-label": "Stroke mode", className: "flex gap-1", children: [
2928
- /* @__PURE__ */ jsx16("button", { type: "button", "aria-pressed": settings.brushMode === "add", className: toggle(settings.brushMode === "add"), onClick: () => set({ brushMode: "add" }), children: "Add" }),
2929
- /* @__PURE__ */ jsx16("button", { type: "button", "aria-pressed": settings.brushMode === "subtract", className: toggle(settings.brushMode === "subtract"), onClick: () => set({ brushMode: "subtract" }), children: "Subtract" })
2978
+ settings.tool !== "refine-brush" && settings.tool !== "hand" && settings.tool !== "zoom" && /* @__PURE__ */ jsxs15("div", { role: "group", "aria-label": "Stroke mode", className: "flex gap-1", children: [
2979
+ /* @__PURE__ */ jsx17("button", { type: "button", "aria-pressed": settings.brushMode === "add", className: toggle(settings.brushMode === "add"), onClick: () => set({ brushMode: "add" }), children: "Add" }),
2980
+ /* @__PURE__ */ jsx17("button", { type: "button", "aria-pressed": settings.brushMode === "subtract", className: toggle(settings.brushMode === "subtract"), onClick: () => set({ brushMode: "subtract" }), children: "Subtract" })
2930
2981
  ] }),
2931
- /* @__PURE__ */ jsxs14("span", { className: "text-muted-foreground", children: [
2982
+ /* @__PURE__ */ jsxs15("span", { className: "text-muted-foreground", children: [
2932
2983
  session.edits.length,
2933
2984
  " strokes"
2934
2985
  ] }),
2935
- /* @__PURE__ */ jsx16("button", { type: "button", className: button, disabled: !session.edits.length, onClick: () => session.undoEdit(), children: "Undo Stroke" }),
2936
- /* @__PURE__ */ jsxs14("span", { className: "font-mono text-muted-foreground", children: [
2986
+ /* @__PURE__ */ jsx17("button", { type: "button", className: button, disabled: !session.edits.length, onClick: () => session.undoEdit(), children: "Undo Stroke" }),
2987
+ /* @__PURE__ */ jsxs15("span", { className: "font-mono text-muted-foreground", children: [
2937
2988
  Math.round(zoom * 100),
2938
2989
  "%"
2939
2990
  ] }),
2940
- session.computing && /* @__PURE__ */ jsx16("span", { role: "status", className: "text-muted-foreground", children: "Updating preview\u2026" })
2991
+ session.computing && /* @__PURE__ */ jsx17("span", { role: "status", className: "text-muted-foreground", children: "Updating preview\u2026" })
2941
2992
  ] }),
2942
- /* @__PURE__ */ jsx16("div", { className: "flex-1 overflow-hidden flex items-center justify-center bg-muted/30", children: /* @__PURE__ */ jsx16(
2993
+ /* @__PURE__ */ jsx17("div", { className: "flex-1 overflow-hidden flex items-center justify-center bg-muted/30", children: /* @__PURE__ */ jsx17(
2943
2994
  "canvas",
2944
2995
  {
2945
2996
  ref: canvasRef,
@@ -2958,11 +3009,11 @@ var SelectAndMaskWorkspace = ({ controller, onClose, className = "" }) => {
2958
3009
  }
2959
3010
  ) })
2960
3011
  ] }),
2961
- /* @__PURE__ */ jsxs14("div", { className: "w-64 flex flex-col gap-3 p-3 border-l border-border overflow-y-auto", children: [
2962
- /* @__PURE__ */ jsx16("span", { className: imageSectionTitleClass, children: "View Mode" }),
2963
- /* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-2", children: [
3012
+ /* @__PURE__ */ jsxs15("div", { className: "w-64 flex flex-col gap-3 p-3 border-l border-border overflow-y-auto", children: [
3013
+ /* @__PURE__ */ jsx17("span", { className: imageSectionTitleClass, children: "View Mode" }),
3014
+ /* @__PURE__ */ jsxs15("label", { className: "flex items-center gap-2", children: [
2964
3015
  "View",
2965
- /* @__PURE__ */ jsx16(
3016
+ /* @__PURE__ */ jsx17(
2966
3017
  ImageSelect,
2967
3018
  {
2968
3019
  label: "View",
@@ -2972,36 +3023,36 @@ var SelectAndMaskWorkspace = ({ controller, onClose, className = "" }) => {
2972
3023
  }
2973
3024
  )
2974
3025
  ] }),
2975
- /* @__PURE__ */ jsxs14("label", { className: "flex flex-col gap-1", children: [
2976
- /* @__PURE__ */ jsxs14("span", { className: "flex justify-between text-muted-foreground", children: [
2977
- /* @__PURE__ */ jsx16("span", { children: "Opacity" }),
2978
- /* @__PURE__ */ jsxs14("span", { className: "font-mono", children: [
3026
+ /* @__PURE__ */ jsxs15("label", { className: "flex flex-col gap-1", children: [
3027
+ /* @__PURE__ */ jsxs15("span", { className: "flex justify-between text-muted-foreground", children: [
3028
+ /* @__PURE__ */ jsx17("span", { children: "Opacity" }),
3029
+ /* @__PURE__ */ jsxs15("span", { className: "font-mono", children: [
2979
3030
  Math.round(settings.opacity * 100),
2980
3031
  "%"
2981
3032
  ] })
2982
3033
  ] }),
2983
- /* @__PURE__ */ jsx16(ImageRange, { label: "View opacity", min: 0, max: 100, step: 1, value: Math.round(settings.opacity * 100), onChange: (v) => set({ opacity: v / 100 }) })
3034
+ /* @__PURE__ */ jsx17(ImageRange, { label: "View opacity", min: 0, max: 100, step: 1, value: Math.round(settings.opacity * 100), onChange: (v) => set({ opacity: v / 100 }) })
2984
3035
  ] }),
2985
- /* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-2", children: [
2986
- /* @__PURE__ */ jsx16(ImageCheckbox, { label: "Show Edge", checked: settings.showEdge, onChange: (on) => set({ showEdge: on }) }),
3036
+ /* @__PURE__ */ jsxs15("label", { className: "flex items-center gap-2", children: [
3037
+ /* @__PURE__ */ jsx17(ImageCheckbox, { label: "Show Edge", checked: settings.showEdge, onChange: (on) => set({ showEdge: on }) }),
2987
3038
  "Show Edge (J)"
2988
3039
  ] }),
2989
- /* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-2", children: [
2990
- /* @__PURE__ */ jsx16(ImageCheckbox, { label: "Show Original", checked: settings.showOriginal, onChange: (on) => set({ showOriginal: on }) }),
3040
+ /* @__PURE__ */ jsxs15("label", { className: "flex items-center gap-2", children: [
3041
+ /* @__PURE__ */ jsx17(ImageCheckbox, { label: "Show Original", checked: settings.showOriginal, onChange: (on) => set({ showOriginal: on }) }),
2991
3042
  "Show Original (P)"
2992
3043
  ] }),
2993
- /* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-2", children: [
2994
- /* @__PURE__ */ jsx16(ImageCheckbox, { label: "Real-Time Refinement", checked: settings.realTime, onChange: (on) => set({ realTime: on }) }),
3044
+ /* @__PURE__ */ jsxs15("label", { className: "flex items-center gap-2", children: [
3045
+ /* @__PURE__ */ jsx17(ImageCheckbox, { label: "Real-Time Refinement", checked: settings.realTime, onChange: (on) => set({ realTime: on }) }),
2995
3046
  "Real-Time Refinement"
2996
3047
  ] }),
2997
- /* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-2", children: [
2998
- /* @__PURE__ */ jsx16(ImageCheckbox, { label: "High Quality Preview", checked: settings.highQuality, onChange: (on) => set({ highQuality: on }) }),
3048
+ /* @__PURE__ */ jsxs15("label", { className: "flex items-center gap-2", children: [
3049
+ /* @__PURE__ */ jsx17(ImageCheckbox, { label: "High Quality Preview", checked: settings.highQuality, onChange: (on) => set({ highQuality: on }) }),
2999
3050
  "High Quality Preview"
3000
3051
  ] }),
3001
- /* @__PURE__ */ jsx16("span", { className: imageSectionTitleClass, children: "Edge Detection and Refinement" }),
3002
- controller.segmentationProvider && /* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-2", children: [
3052
+ /* @__PURE__ */ jsx17("span", { className: imageSectionTitleClass, children: "Edge Detection and Refinement" }),
3053
+ controller.segmentationProvider && /* @__PURE__ */ jsxs15("label", { className: "flex items-center gap-2", children: [
3003
3054
  "Mode",
3004
- /* @__PURE__ */ jsx16(
3055
+ /* @__PURE__ */ jsx17(
3005
3056
  ImageSelect,
3006
3057
  {
3007
3058
  label: "Refine mode",
@@ -3014,37 +3065,37 @@ var SelectAndMaskWorkspace = ({ controller, onClose, className = "" }) => {
3014
3065
  }
3015
3066
  )
3016
3067
  ] }),
3017
- REFINE_EDGE_CONTROLS.map((c) => /* @__PURE__ */ jsxs14("label", { className: "flex flex-col gap-1", children: [
3018
- /* @__PURE__ */ jsxs14("span", { className: "flex justify-between text-muted-foreground", children: [
3019
- /* @__PURE__ */ jsx16("span", { children: c.label }),
3020
- /* @__PURE__ */ jsxs14("span", { className: "font-mono", children: [
3068
+ REFINE_EDGE_CONTROLS.map((c) => /* @__PURE__ */ jsxs15("label", { className: "flex flex-col gap-1", children: [
3069
+ /* @__PURE__ */ jsxs15("span", { className: "flex justify-between text-muted-foreground", children: [
3070
+ /* @__PURE__ */ jsx17("span", { children: c.label }),
3071
+ /* @__PURE__ */ jsxs15("span", { className: "font-mono", children: [
3021
3072
  settings.params[c.id],
3022
3073
  c.unit
3023
3074
  ] })
3024
3075
  ] }),
3025
- /* @__PURE__ */ jsx16(ImageRange, { label: `Workspace ${c.label}`, min: c.min, max: c.max, step: c.step, value: settings.params[c.id], onChange: (v) => set({ params: { ...settings.params, [c.id]: v } }) })
3076
+ /* @__PURE__ */ jsx17(ImageRange, { label: `Workspace ${c.label}`, min: c.min, max: c.max, step: c.step, value: settings.params[c.id], onChange: (v) => set({ params: { ...settings.params, [c.id]: v } }) })
3026
3077
  ] }, c.id)),
3027
- /* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-2", children: [
3028
- /* @__PURE__ */ jsx16(ImageCheckbox, { label: "Workspace Smart Radius", checked: settings.params.smartRadius, onChange: (on) => set({ params: { ...settings.params, smartRadius: on } }) }),
3078
+ /* @__PURE__ */ jsxs15("label", { className: "flex items-center gap-2", children: [
3079
+ /* @__PURE__ */ jsx17(ImageCheckbox, { label: "Workspace Smart Radius", checked: settings.params.smartRadius, onChange: (on) => set({ params: { ...settings.params, smartRadius: on } }) }),
3029
3080
  "Smart Radius"
3030
3081
  ] }),
3031
- /* @__PURE__ */ jsx16("span", { className: imageSectionTitleClass, children: "Output Settings" }),
3032
- /* @__PURE__ */ jsxs14("label", { className: "flex flex-col gap-1", children: [
3033
- /* @__PURE__ */ jsxs14("span", { className: "flex justify-between text-muted-foreground", children: [
3034
- /* @__PURE__ */ jsxs14("span", { children: [
3082
+ /* @__PURE__ */ jsx17("span", { className: imageSectionTitleClass, children: "Output Settings" }),
3083
+ /* @__PURE__ */ jsxs15("label", { className: "flex flex-col gap-1", children: [
3084
+ /* @__PURE__ */ jsxs15("span", { className: "flex justify-between text-muted-foreground", children: [
3085
+ /* @__PURE__ */ jsxs15("span", { children: [
3035
3086
  "Decontaminate Colors",
3036
3087
  toLayer ? "" : " (new layer or document outputs)"
3037
3088
  ] }),
3038
- /* @__PURE__ */ jsxs14("span", { className: "font-mono", children: [
3089
+ /* @__PURE__ */ jsxs15("span", { className: "font-mono", children: [
3039
3090
  settings.decontaminate,
3040
3091
  "%"
3041
3092
  ] })
3042
3093
  ] }),
3043
- /* @__PURE__ */ jsx16(ImageRange, { label: "Workspace decontaminate amount", min: 0, max: 100, step: 1, value: settings.decontaminate, disabled: !toLayer, onChange: (v) => set({ decontaminate: v }) })
3094
+ /* @__PURE__ */ jsx17(ImageRange, { label: "Workspace decontaminate amount", min: 0, max: 100, step: 1, value: settings.decontaminate, disabled: !toLayer, onChange: (v) => set({ decontaminate: v }) })
3044
3095
  ] }),
3045
- /* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-2", children: [
3096
+ /* @__PURE__ */ jsxs15("label", { className: "flex items-center gap-2", children: [
3046
3097
  "Output To",
3047
- /* @__PURE__ */ jsx16(
3098
+ /* @__PURE__ */ jsx17(
3048
3099
  ImageSelect,
3049
3100
  {
3050
3101
  label: "Output to",
@@ -3054,16 +3105,16 @@ var SelectAndMaskWorkspace = ({ controller, onClose, className = "" }) => {
3054
3105
  }
3055
3106
  )
3056
3107
  ] }),
3057
- /* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-2", children: [
3058
- /* @__PURE__ */ jsx16(ImageCheckbox, { label: "Remember Settings", checked: settings.remember, onChange: (on) => set({ remember: on }) }),
3108
+ /* @__PURE__ */ jsxs15("label", { className: "flex items-center gap-2", children: [
3109
+ /* @__PURE__ */ jsx17(ImageCheckbox, { label: "Remember Settings", checked: settings.remember, onChange: (on) => set({ remember: on }) }),
3059
3110
  "Remember Settings"
3060
3111
  ] }),
3061
- (error ?? session.error) && /* @__PURE__ */ jsx16("p", { role: "alert", className: "text-destructive", children: error ?? session.error }),
3062
- session.note && /* @__PURE__ */ jsx16("p", { className: "text-muted-foreground", children: session.note }),
3063
- /* @__PURE__ */ jsxs14("div", { className: "flex gap-1 mt-auto", children: [
3064
- /* @__PURE__ */ jsx16("button", { type: "button", className: button, onClick: () => session.reset(), children: "Reset" }),
3065
- /* @__PURE__ */ jsx16("button", { type: "button", className: button, onClick: () => onClose(null), children: "Cancel" }),
3066
- /* @__PURE__ */ jsx16("button", { type: "button", className: toggle(true), disabled: busy, "aria-busy": busy, onClick: () => void ok(), children: "OK" })
3112
+ (error ?? session.error) && /* @__PURE__ */ jsx17("p", { role: "alert", className: "text-destructive", children: error ?? session.error }),
3113
+ session.note && /* @__PURE__ */ jsx17("p", { className: "text-muted-foreground", children: session.note }),
3114
+ /* @__PURE__ */ jsxs15("div", { className: "flex gap-1 mt-auto", children: [
3115
+ /* @__PURE__ */ jsx17("button", { type: "button", className: button, onClick: () => session.reset(), children: "Reset" }),
3116
+ /* @__PURE__ */ jsx17("button", { type: "button", className: button, onClick: () => onClose(null), children: "Cancel" }),
3117
+ /* @__PURE__ */ jsx17("button", { type: "button", className: toggle(true), disabled: busy, "aria-busy": busy, onClick: () => void ok(), children: "OK" })
3067
3118
  ] })
3068
3119
  ] })
3069
3120
  ]
@@ -3072,18 +3123,18 @@ var SelectAndMaskWorkspace = ({ controller, onClose, className = "" }) => {
3072
3123
  };
3073
3124
 
3074
3125
  // src/image-editor/ContentAwareFillWorkspace.tsx
3075
- import { useEffect as useEffect11, useMemo as useMemo5, useRef as useRef9, useState as useState13 } from "react";
3126
+ import { useEffect as useEffect11, useMemo as useMemo5, useRef as useRef9, useState as useState14 } from "react";
3076
3127
  import { CONTENT_AWARE_FILL_SAMPLING, CONTENT_AWARE_FILL_TOOLS, ContentAwareFillSession } from "@pixerate/editor/image-editor";
3077
- import { Fragment as Fragment3, jsx as jsx17, jsxs as jsxs15 } from "react/jsx-runtime";
3128
+ import { Fragment as Fragment4, jsx as jsx18, jsxs as jsxs16 } from "react/jsx-runtime";
3078
3129
  var button2 = "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";
3079
3130
  var toggle2 = (on) => `${button2} ${on ? "bg-primary text-primary-foreground border-primary" : ""}`;
3080
3131
  var ContentAwareFillWorkspace = ({ controller, onClose, className = "" }) => {
3081
3132
  const session = useMemo5(() => new ContentAwareFillSession(controller), [controller]);
3082
- const [, setRevision] = useState13(0);
3083
- const [zoom, setZoom] = useState13(1);
3084
- const [pan, setPan] = useState13({ x: 0, y: 0 });
3085
- const [busy, setBusy] = useState13(false);
3086
- const [error, setError] = useState13(null);
3133
+ const [, setRevision] = useState14(0);
3134
+ const [zoom, setZoom] = useState14(1);
3135
+ const [pan, setPan] = useState14({ x: 0, y: 0 });
3136
+ const [busy, setBusy] = useState14(false);
3137
+ const [error, setError] = useState14(null);
3087
3138
  const sourceRef = useRef9(null);
3088
3139
  const previewRef = useRef9(null);
3089
3140
  const panFrom = useRef9(null);
@@ -3162,14 +3213,14 @@ var ContentAwareFillWorkspace = ({ controller, onClose, className = "" }) => {
3162
3213
  session.end();
3163
3214
  };
3164
3215
  const view = { maxWidth: "100%", maxHeight: "100%", transform: `translate(${pan.x}px, ${pan.y}px) scale(${zoom})`, imageRendering: zoom > 2 ? "pixelated" : void 0 };
3165
- return /* @__PURE__ */ jsxs15("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: [
3166
- /* @__PURE__ */ jsx17("div", { role: "group", "aria-label": "Content-Aware Fill tool", className: "flex flex-col gap-1 p-2 border-r border-border", children: CONTENT_AWARE_FILL_TOOLS.map((t) => /* @__PURE__ */ jsx17("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)) }),
3167
- /* @__PURE__ */ jsxs15("div", { className: "flex-1 flex flex-col min-w-0", children: [
3168
- /* @__PURE__ */ jsxs15("div", { className: "flex flex-wrap items-center gap-2 p-2 border-b border-border", children: [
3169
- settings.tool === "sampling-brush" && /* @__PURE__ */ jsxs15(Fragment3, { children: [
3170
- /* @__PURE__ */ jsxs15("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
3216
+ return /* @__PURE__ */ jsxs16("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: [
3217
+ /* @__PURE__ */ jsx18("div", { role: "group", "aria-label": "Content-Aware Fill tool", className: "flex flex-col gap-1 p-2 border-r border-border", children: CONTENT_AWARE_FILL_TOOLS.map((t) => /* @__PURE__ */ jsx18("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)) }),
3218
+ /* @__PURE__ */ jsxs16("div", { className: "flex-1 flex flex-col min-w-0", children: [
3219
+ /* @__PURE__ */ jsxs16("div", { className: "flex flex-wrap items-center gap-2 p-2 border-b border-border", children: [
3220
+ settings.tool === "sampling-brush" && /* @__PURE__ */ jsxs16(Fragment4, { children: [
3221
+ /* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
3171
3222
  "Size",
3172
- /* @__PURE__ */ jsx17(
3223
+ /* @__PURE__ */ jsx18(
3173
3224
  "input",
3174
3225
  {
3175
3226
  type: "number",
@@ -3182,22 +3233,22 @@ var ContentAwareFillWorkspace = ({ controller, onClose, className = "" }) => {
3182
3233
  ),
3183
3234
  "px"
3184
3235
  ] }),
3185
- /* @__PURE__ */ jsxs15("div", { role: "group", "aria-label": "Sampling brush mode", className: "flex gap-1", children: [
3186
- /* @__PURE__ */ jsx17("button", { type: "button", "aria-pressed": settings.brushMode === "add", className: toggle2(settings.brushMode === "add"), onClick: () => set({ brushMode: "add" }), children: "Add" }),
3187
- /* @__PURE__ */ jsx17("button", { type: "button", "aria-pressed": settings.brushMode === "subtract", className: toggle2(settings.brushMode === "subtract"), onClick: () => set({ brushMode: "subtract" }), children: "Subtract" })
3236
+ /* @__PURE__ */ jsxs16("div", { role: "group", "aria-label": "Sampling brush mode", className: "flex gap-1", children: [
3237
+ /* @__PURE__ */ jsx18("button", { type: "button", "aria-pressed": settings.brushMode === "add", className: toggle2(settings.brushMode === "add"), onClick: () => set({ brushMode: "add" }), children: "Add" }),
3238
+ /* @__PURE__ */ jsx18("button", { type: "button", "aria-pressed": settings.brushMode === "subtract", className: toggle2(settings.brushMode === "subtract"), onClick: () => set({ brushMode: "subtract" }), children: "Subtract" })
3188
3239
  ] })
3189
3240
  ] }),
3190
- /* @__PURE__ */ jsxs15("span", { className: "font-mono text-muted-foreground", children: [
3241
+ /* @__PURE__ */ jsxs16("span", { className: "font-mono text-muted-foreground", children: [
3191
3242
  Math.round(zoom * 100),
3192
3243
  "%"
3193
3244
  ] }),
3194
- !session.showsWholeImage && /* @__PURE__ */ jsx17("button", { type: "button", className: button2, title: "Show (and sample from) more of the image around the selection", onClick: () => session.expandView(), children: "Expand View" }),
3195
- session.computing && /* @__PURE__ */ jsx17("span", { role: "status", className: "text-muted-foreground", children: "Updating preview\u2026" })
3245
+ !session.showsWholeImage && /* @__PURE__ */ jsx18("button", { type: "button", className: button2, title: "Show (and sample from) more of the image around the selection", onClick: () => session.expandView(), children: "Expand View" }),
3246
+ session.computing && /* @__PURE__ */ jsx18("span", { role: "status", className: "text-muted-foreground", children: "Updating preview\u2026" })
3196
3247
  ] }),
3197
- /* @__PURE__ */ jsxs15("div", { className: "flex-1 grid grid-cols-2 gap-2 p-2 min-h-0", children: [
3198
- /* @__PURE__ */ jsxs15("div", { className: "flex flex-col min-h-0", children: [
3199
- /* @__PURE__ */ jsx17("span", { className: "text-muted-foreground", children: "Source (green: sampling area)" }),
3200
- /* @__PURE__ */ jsx17("div", { className: "flex-1 overflow-hidden flex items-center justify-center bg-muted/30", children: /* @__PURE__ */ jsx17(
3248
+ /* @__PURE__ */ jsxs16("div", { className: "flex-1 grid grid-cols-2 gap-2 p-2 min-h-0", children: [
3249
+ /* @__PURE__ */ jsxs16("div", { className: "flex flex-col min-h-0", children: [
3250
+ /* @__PURE__ */ jsx18("span", { className: "text-muted-foreground", children: "Source (green: sampling area)" }),
3251
+ /* @__PURE__ */ jsx18("div", { className: "flex-1 overflow-hidden flex items-center justify-center bg-muted/30", children: /* @__PURE__ */ jsx18(
3201
3252
  "canvas",
3202
3253
  {
3203
3254
  ref: sourceRef,
@@ -3209,33 +3260,33 @@ var ContentAwareFillWorkspace = ({ controller, onClose, className = "" }) => {
3209
3260
  }
3210
3261
  ) })
3211
3262
  ] }),
3212
- /* @__PURE__ */ jsxs15("div", { className: "flex flex-col min-h-0", children: [
3213
- /* @__PURE__ */ jsx17("span", { className: "text-muted-foreground", children: "Preview" }),
3214
- /* @__PURE__ */ jsx17("div", { className: "flex-1 overflow-hidden flex items-center justify-center bg-muted/30", children: /* @__PURE__ */ jsx17("canvas", { ref: previewRef, "data-testid": "content-aware-fill-preview", style: view }) })
3263
+ /* @__PURE__ */ jsxs16("div", { className: "flex flex-col min-h-0", children: [
3264
+ /* @__PURE__ */ jsx18("span", { className: "text-muted-foreground", children: "Preview" }),
3265
+ /* @__PURE__ */ jsx18("div", { className: "flex-1 overflow-hidden flex items-center justify-center bg-muted/30", children: /* @__PURE__ */ jsx18("canvas", { ref: previewRef, "data-testid": "content-aware-fill-preview", style: view }) })
3215
3266
  ] })
3216
3267
  ] })
3217
3268
  ] }),
3218
- /* @__PURE__ */ jsxs15("div", { className: "w-64 flex flex-col gap-3 p-3 border-l border-border overflow-y-auto", children: [
3219
- /* @__PURE__ */ jsx17("span", { className: imageSectionTitleClass, children: "Sampling Area Options" }),
3220
- /* @__PURE__ */ jsx17("div", { role: "group", "aria-label": "Sampling area", className: "flex gap-1", children: CONTENT_AWARE_FILL_SAMPLING.map((m) => /* @__PURE__ */ jsx17("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)) }),
3221
- /* @__PURE__ */ jsxs15("label", { className: "flex items-center gap-2", children: [
3222
- /* @__PURE__ */ jsx17(ImageCheckbox, { label: "Show Sampling Area", checked: settings.showSampling, onChange: (on) => set({ showSampling: on }) }),
3269
+ /* @__PURE__ */ jsxs16("div", { className: "w-64 flex flex-col gap-3 p-3 border-l border-border overflow-y-auto", children: [
3270
+ /* @__PURE__ */ jsx18("span", { className: imageSectionTitleClass, children: "Sampling Area Options" }),
3271
+ /* @__PURE__ */ jsx18("div", { role: "group", "aria-label": "Sampling area", className: "flex gap-1", children: CONTENT_AWARE_FILL_SAMPLING.map((m) => /* @__PURE__ */ jsx18("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)) }),
3272
+ /* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-2", children: [
3273
+ /* @__PURE__ */ jsx18(ImageCheckbox, { label: "Show Sampling Area", checked: settings.showSampling, onChange: (on) => set({ showSampling: on }) }),
3223
3274
  "Show Sampling Area"
3224
3275
  ] }),
3225
- /* @__PURE__ */ jsxs15("label", { className: "flex flex-col gap-1", children: [
3226
- /* @__PURE__ */ jsxs15("span", { className: "flex justify-between text-muted-foreground", children: [
3227
- /* @__PURE__ */ jsx17("span", { children: "Opacity" }),
3228
- /* @__PURE__ */ jsxs15("span", { className: "font-mono", children: [
3276
+ /* @__PURE__ */ jsxs16("label", { className: "flex flex-col gap-1", children: [
3277
+ /* @__PURE__ */ jsxs16("span", { className: "flex justify-between text-muted-foreground", children: [
3278
+ /* @__PURE__ */ jsx18("span", { children: "Opacity" }),
3279
+ /* @__PURE__ */ jsxs16("span", { className: "font-mono", children: [
3229
3280
  Math.round(settings.opacity * 100),
3230
3281
  "%"
3231
3282
  ] })
3232
3283
  ] }),
3233
- /* @__PURE__ */ jsx17(ImageRange, { label: "Sampling overlay opacity", min: 0, max: 100, step: 1, value: Math.round(settings.opacity * 100), onChange: (v) => set({ opacity: v / 100 }) })
3284
+ /* @__PURE__ */ jsx18(ImageRange, { label: "Sampling overlay opacity", min: 0, max: 100, step: 1, value: Math.round(settings.opacity * 100), onChange: (v) => set({ opacity: v / 100 }) })
3234
3285
  ] }),
3235
- /* @__PURE__ */ jsx17("span", { className: imageSectionTitleClass, children: "Fill Settings" }),
3236
- /* @__PURE__ */ jsxs15("label", { className: "flex items-center gap-2 text-muted-foreground", children: [
3286
+ /* @__PURE__ */ jsx18("span", { className: imageSectionTitleClass, children: "Fill Settings" }),
3287
+ /* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-2 text-muted-foreground", children: [
3237
3288
  "Seed",
3238
- /* @__PURE__ */ jsx17(
3289
+ /* @__PURE__ */ jsx18(
3239
3290
  "input",
3240
3291
  {
3241
3292
  type: "number",
@@ -3246,17 +3297,17 @@ var ContentAwareFillWorkspace = ({ controller, onClose, className = "" }) => {
3246
3297
  className: "w-16 bg-background border border-border rounded px-1 py-0.5 text-foreground"
3247
3298
  }
3248
3299
  ),
3249
- /* @__PURE__ */ jsx17("button", { type: "button", className: button2, onClick: () => set({ seed: settings.seed + 1 }), children: "Try Another" })
3300
+ /* @__PURE__ */ jsx18("button", { type: "button", className: button2, onClick: () => set({ seed: settings.seed + 1 }), children: "Try Another" })
3250
3301
  ] }),
3251
- /* @__PURE__ */ jsxs15("label", { className: "flex items-center gap-2", children: [
3252
- /* @__PURE__ */ jsx17(ImageCheckbox, { label: "Live Preview", checked: settings.livePreview, onChange: (on) => set({ livePreview: on }) }),
3302
+ /* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-2", children: [
3303
+ /* @__PURE__ */ jsx18(ImageCheckbox, { label: "Live Preview", checked: settings.livePreview, onChange: (on) => set({ livePreview: on }) }),
3253
3304
  "Live Preview"
3254
3305
  ] }),
3255
- !settings.livePreview && /* @__PURE__ */ jsx17("button", { type: "button", className: button2, disabled: session.computing, onClick: () => void session.refresh(), children: "Preview" }),
3256
- /* @__PURE__ */ jsx17("span", { className: imageSectionTitleClass, children: "Output Settings" }),
3257
- /* @__PURE__ */ jsxs15("label", { className: "flex items-center gap-2", children: [
3306
+ !settings.livePreview && /* @__PURE__ */ jsx18("button", { type: "button", className: button2, disabled: session.computing, onClick: () => void session.refresh(), children: "Preview" }),
3307
+ /* @__PURE__ */ jsx18("span", { className: imageSectionTitleClass, children: "Output Settings" }),
3308
+ /* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-2", children: [
3258
3309
  "Output To",
3259
- /* @__PURE__ */ jsx17(
3310
+ /* @__PURE__ */ jsx18(
3260
3311
  ImageSelect,
3261
3312
  {
3262
3313
  label: "Fill output",
@@ -3270,18 +3321,18 @@ var ContentAwareFillWorkspace = ({ controller, onClose, className = "" }) => {
3270
3321
  }
3271
3322
  )
3272
3323
  ] }),
3273
- (error ?? session.error) && /* @__PURE__ */ jsx17("p", { role: "alert", className: "text-destructive", children: error ?? session.error }),
3274
- /* @__PURE__ */ jsxs15("div", { className: "flex gap-1 mt-auto", children: [
3275
- /* @__PURE__ */ jsx17("button", { type: "button", className: button2, onClick: () => session.reset(), children: "Reset" }),
3276
- /* @__PURE__ */ jsx17("button", { type: "button", className: button2, onClick: () => onClose(null), children: "Cancel" }),
3277
- /* @__PURE__ */ jsx17("button", { type: "button", className: toggle2(true), disabled: busy || !win, "aria-busy": busy, onClick: () => void ok(), children: "OK" })
3324
+ (error ?? session.error) && /* @__PURE__ */ jsx18("p", { role: "alert", className: "text-destructive", children: error ?? session.error }),
3325
+ /* @__PURE__ */ jsxs16("div", { className: "flex gap-1 mt-auto", children: [
3326
+ /* @__PURE__ */ jsx18("button", { type: "button", className: button2, onClick: () => session.reset(), children: "Reset" }),
3327
+ /* @__PURE__ */ jsx18("button", { type: "button", className: button2, onClick: () => onClose(null), children: "Cancel" }),
3328
+ /* @__PURE__ */ jsx18("button", { type: "button", className: toggle2(true), disabled: busy || !win, "aria-busy": busy, onClick: () => void ok(), children: "OK" })
3278
3329
  ] })
3279
3330
  ] })
3280
3331
  ] });
3281
3332
  };
3282
3333
 
3283
3334
  // src/image-editor/SelectionOptionsBar.tsx
3284
- import { jsx as jsx18, jsxs as jsxs16 } from "react/jsx-runtime";
3335
+ import { jsx as jsx19, jsxs as jsxs17 } from "react/jsx-runtime";
3285
3336
  var MODIFY_OPS = [
3286
3337
  { op: "expand", label: "Expand" },
3287
3338
  { op: "contract", label: "Contract" },
@@ -3305,15 +3356,15 @@ var SelectionOptionsBar = ({
3305
3356
  selectionDisplay,
3306
3357
  className = ""
3307
3358
  }) => {
3308
- const [radius, setRadius] = useState14(2);
3359
+ const [radius, setRadius] = useState15(2);
3309
3360
  const set = (patch) => onOptionsChange({ ...options, ...patch });
3310
3361
  const sel = selection === void 0 ? controller.getSelection() : selection;
3311
3362
  const display = selectionDisplay ?? (quickMask === void 0 ? controller.getSelectionDisplay() : quickMask ? "quickMask" : "ants");
3312
- const [preset, setPreset] = useState14("reds");
3313
- const [rangeStatus, setRangeStatus] = useState14(null);
3314
- const [colorStatus, setColorStatus] = useState14(null);
3315
- const [strokeWidth, setStrokeWidth] = useState14(4);
3316
- const [strokeLocation, setStrokeLocation] = useState14("outside");
3363
+ const [preset, setPreset] = useState15("reds");
3364
+ const [rangeStatus, setRangeStatus] = useState15(null);
3365
+ const [colorStatus, setColorStatus] = useState15(null);
3366
+ const [strokeWidth, setStrokeWidth] = useState15(4);
3367
+ const [strokeLocation, setStrokeLocation] = useState15("outside");
3317
3368
  const edit = (fn) => {
3318
3369
  setColorStatus(null);
3319
3370
  try {
@@ -3346,7 +3397,7 @@ var SelectionOptionsBar = ({
3346
3397
  setRangeStatus(err instanceof Error ? err.message : String(err));
3347
3398
  }
3348
3399
  };
3349
- const [task, setTask] = useState14(null);
3400
+ const [task, setTask] = useState15(null);
3350
3401
  const taskAbort = useRef10(null);
3351
3402
  const tracked = () => {
3352
3403
  const abort = new AbortController();
@@ -3359,9 +3410,9 @@ var SelectionOptionsBar = ({
3359
3410
  setTask(null);
3360
3411
  };
3361
3412
  const failure = (err) => err?.name === "AbortError" ? "Cancelled." : err instanceof Error ? err.message : String(err);
3362
- const [subject, setSubject] = useState14("");
3363
- const [segmenting, setSegmenting] = useState14(false);
3364
- const [subjectStatus, setSubjectStatus] = useState14(null);
3413
+ const [subject, setSubject] = useState15("");
3414
+ const [segmenting, setSegmenting] = useState15(false);
3415
+ const [subjectStatus, setSubjectStatus] = useState15(null);
3365
3416
  const selectSubject = async () => {
3366
3417
  const target = subject.trim();
3367
3418
  const canSegment = Boolean(controller.segmentationProvider);
@@ -3378,10 +3429,10 @@ var SelectionOptionsBar = ({
3378
3429
  setSegmenting(false);
3379
3430
  }
3380
3431
  };
3381
- const [workspace, setWorkspace] = useState14(false);
3382
- const [fillWorkspace, setFillWorkspace] = useState14(false);
3383
- const [skying, setSkying] = useState14(false);
3384
- const [skyStatus, setSkyStatus] = useState14(null);
3432
+ const [workspace, setWorkspace] = useState15(false);
3433
+ const [fillWorkspace, setFillWorkspace] = useState15(false);
3434
+ const [skying, setSkying] = useState15(false);
3435
+ const [skyStatus, setSkyStatus] = useState15(null);
3385
3436
  const selectSky = async () => {
3386
3437
  if (skying) return;
3387
3438
  setSkying(true);
@@ -3396,8 +3447,8 @@ var SelectionOptionsBar = ({
3396
3447
  setSkying(false);
3397
3448
  }
3398
3449
  };
3399
- const [focusing, setFocusing] = useState14(false);
3400
- const [focusStatus, setFocusStatus] = useState14(null);
3450
+ const [focusing, setFocusing] = useState15(false);
3451
+ const [focusStatus, setFocusStatus] = useState15(null);
3401
3452
  const selectFocusArea = async () => {
3402
3453
  if (focusing) return;
3403
3454
  setFocusing(true);
@@ -3418,24 +3469,24 @@ var SelectionOptionsBar = ({
3418
3469
  setFocusing(false);
3419
3470
  }
3420
3471
  };
3421
- return /* @__PURE__ */ jsxs16("div", { "data-testid": "selection-options-bar", className: `flex flex-col gap-3 text-xs ${className}`, children: [
3422
- /* @__PURE__ */ jsx18("div", { role: "group", "aria-label": "Selection tool", className: "flex flex-wrap gap-1", children: SELECTION_TOOLS.map((t) => /* @__PURE__ */ jsx18("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)) }),
3423
- /* @__PURE__ */ jsx18("div", { role: "group", "aria-label": "Selection mode", className: "flex flex-wrap gap-1", children: SELECTION_MODES.map((m) => /* @__PURE__ */ jsx18("button", { type: "button", "aria-pressed": options.mode === m, className: btn(options.mode === m), onClick: () => set({ mode: m }), children: SELECTION_MODE_LABELS[m] }, m)) }),
3424
- options.tool === "wand" && /* @__PURE__ */ jsxs16("div", { className: "flex flex-col gap-2", children: [
3425
- /* @__PURE__ */ jsxs16("label", { className: "flex flex-col gap-1", children: [
3426
- /* @__PURE__ */ jsxs16("span", { className: "flex justify-between text-muted-foreground", children: [
3427
- /* @__PURE__ */ jsx18("span", { children: "Tolerance" }),
3428
- /* @__PURE__ */ jsx18("span", { className: "font-mono", children: options.tolerance })
3472
+ return /* @__PURE__ */ jsxs17("div", { "data-testid": "selection-options-bar", className: `flex flex-col gap-3 text-xs ${className}`, children: [
3473
+ /* @__PURE__ */ jsx19("div", { role: "group", "aria-label": "Selection tool", className: "flex flex-wrap gap-1", children: SELECTION_TOOLS.map((t) => /* @__PURE__ */ jsx19("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)) }),
3474
+ /* @__PURE__ */ jsx19("div", { role: "group", "aria-label": "Selection mode", className: "flex flex-wrap gap-1", children: SELECTION_MODES.map((m) => /* @__PURE__ */ jsx19("button", { type: "button", "aria-pressed": options.mode === m, className: btn(options.mode === m), onClick: () => set({ mode: m }), children: SELECTION_MODE_LABELS[m] }, m)) }),
3475
+ options.tool === "wand" && /* @__PURE__ */ jsxs17("div", { className: "flex flex-col gap-2", children: [
3476
+ /* @__PURE__ */ jsxs17("label", { className: "flex flex-col gap-1", children: [
3477
+ /* @__PURE__ */ jsxs17("span", { className: "flex justify-between text-muted-foreground", children: [
3478
+ /* @__PURE__ */ jsx19("span", { children: "Tolerance" }),
3479
+ /* @__PURE__ */ jsx19("span", { className: "font-mono", children: options.tolerance })
3429
3480
  ] }),
3430
- /* @__PURE__ */ jsx18(ImageRange, { label: "Tolerance", min: 0, max: 255, step: 1, value: options.tolerance, onChange: (v) => set({ tolerance: v }) })
3481
+ /* @__PURE__ */ jsx19(ImageRange, { label: "Tolerance", min: 0, max: 255, step: 1, value: options.tolerance, onChange: (v) => set({ tolerance: v }) })
3431
3482
  ] }),
3432
- /* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-2 text-foreground", children: [
3433
- /* @__PURE__ */ jsx18(ImageCheckbox, { label: "Contiguous", checked: options.contiguous, onChange: (on) => set({ contiguous: on }) }),
3483
+ /* @__PURE__ */ jsxs17("label", { className: "flex items-center gap-2 text-foreground", children: [
3484
+ /* @__PURE__ */ jsx19(ImageCheckbox, { label: "Contiguous", checked: options.contiguous, onChange: (on) => set({ contiguous: on }) }),
3434
3485
  "Contiguous"
3435
3486
  ] }),
3436
- /* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-2 text-foreground", children: [
3487
+ /* @__PURE__ */ jsxs17("label", { className: "flex items-center gap-2 text-foreground", children: [
3437
3488
  "Distance",
3438
- /* @__PURE__ */ jsx18(
3489
+ /* @__PURE__ */ jsx19(
3439
3490
  ImageSelect,
3440
3491
  {
3441
3492
  label: "Colour distance",
@@ -3448,13 +3499,13 @@ var SelectionOptionsBar = ({
3448
3499
  }
3449
3500
  )
3450
3501
  ] }),
3451
- /* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-2 text-foreground", children: [
3452
- /* @__PURE__ */ jsx18(ImageCheckbox, { label: "Sample adjusted image", checked: options.sampleMerged, onChange: (on) => set({ sampleMerged: on }) }),
3502
+ /* @__PURE__ */ jsxs17("label", { className: "flex items-center gap-2 text-foreground", children: [
3503
+ /* @__PURE__ */ jsx19(ImageCheckbox, { label: "Sample adjusted image", checked: options.sampleMerged, onChange: (on) => set({ sampleMerged: on }) }),
3453
3504
  "Sample adjusted image"
3454
3505
  ] }),
3455
- /* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-2 text-foreground", children: [
3506
+ /* @__PURE__ */ jsxs17("label", { className: "flex items-center gap-2 text-foreground", children: [
3456
3507
  "Sample",
3457
- /* @__PURE__ */ jsx18(
3508
+ /* @__PURE__ */ jsx19(
3458
3509
  ImageSelect,
3459
3510
  {
3460
3511
  label: "Sample from",
@@ -3468,77 +3519,77 @@ var SelectionOptionsBar = ({
3468
3519
  )
3469
3520
  ] })
3470
3521
  ] }),
3471
- options.tool === "polygon" && /* @__PURE__ */ jsx18("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." }),
3472
- options.tool === "magnetic" && /* @__PURE__ */ jsxs16("div", { "data-testid": "magnetic-lasso-options", className: "flex flex-col gap-2", children: [
3473
- /* @__PURE__ */ jsx18("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." }),
3474
- /* @__PURE__ */ jsxs16("label", { className: "flex flex-col gap-1", children: [
3475
- /* @__PURE__ */ jsxs16("span", { className: "flex justify-between text-muted-foreground", children: [
3476
- /* @__PURE__ */ jsx18("span", { children: "Width" }),
3477
- /* @__PURE__ */ jsxs16("span", { className: "font-mono", children: [
3522
+ options.tool === "polygon" && /* @__PURE__ */ jsx19("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." }),
3523
+ options.tool === "magnetic" && /* @__PURE__ */ jsxs17("div", { "data-testid": "magnetic-lasso-options", className: "flex flex-col gap-2", children: [
3524
+ /* @__PURE__ */ jsx19("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." }),
3525
+ /* @__PURE__ */ jsxs17("label", { className: "flex flex-col gap-1", children: [
3526
+ /* @__PURE__ */ jsxs17("span", { className: "flex justify-between text-muted-foreground", children: [
3527
+ /* @__PURE__ */ jsx19("span", { children: "Width" }),
3528
+ /* @__PURE__ */ jsxs17("span", { className: "font-mono", children: [
3478
3529
  options.magneticWidth ?? 10,
3479
3530
  " px"
3480
3531
  ] })
3481
3532
  ] }),
3482
- /* @__PURE__ */ jsx18(ImageRange, { label: "Magnetic lasso width", min: 1, max: 256, step: 1, value: options.magneticWidth ?? 10, onChange: (v) => set({ magneticWidth: v }) })
3533
+ /* @__PURE__ */ jsx19(ImageRange, { label: "Magnetic lasso width", min: 1, max: 256, step: 1, value: options.magneticWidth ?? 10, onChange: (v) => set({ magneticWidth: v }) })
3483
3534
  ] }),
3484
- /* @__PURE__ */ jsxs16("label", { className: "flex flex-col gap-1", children: [
3485
- /* @__PURE__ */ jsxs16("span", { className: "flex justify-between text-muted-foreground", children: [
3486
- /* @__PURE__ */ jsx18("span", { children: "Contrast" }),
3487
- /* @__PURE__ */ jsxs16("span", { className: "font-mono", children: [
3535
+ /* @__PURE__ */ jsxs17("label", { className: "flex flex-col gap-1", children: [
3536
+ /* @__PURE__ */ jsxs17("span", { className: "flex justify-between text-muted-foreground", children: [
3537
+ /* @__PURE__ */ jsx19("span", { children: "Contrast" }),
3538
+ /* @__PURE__ */ jsxs17("span", { className: "font-mono", children: [
3488
3539
  options.magneticContrast ?? 10,
3489
3540
  "%"
3490
3541
  ] })
3491
3542
  ] }),
3492
- /* @__PURE__ */ jsx18(ImageRange, { label: "Magnetic lasso contrast", min: 1, max: 100, step: 1, value: options.magneticContrast ?? 10, onChange: (v) => set({ magneticContrast: v }) })
3543
+ /* @__PURE__ */ jsx19(ImageRange, { label: "Magnetic lasso contrast", min: 1, max: 100, step: 1, value: options.magneticContrast ?? 10, onChange: (v) => set({ magneticContrast: v }) })
3493
3544
  ] }),
3494
- /* @__PURE__ */ jsxs16("label", { className: "flex flex-col gap-1", children: [
3495
- /* @__PURE__ */ jsxs16("span", { className: "flex justify-between text-muted-foreground", children: [
3496
- /* @__PURE__ */ jsx18("span", { children: "Frequency" }),
3497
- /* @__PURE__ */ jsx18("span", { className: "font-mono", children: options.magneticFrequency ?? 57 })
3545
+ /* @__PURE__ */ jsxs17("label", { className: "flex flex-col gap-1", children: [
3546
+ /* @__PURE__ */ jsxs17("span", { className: "flex justify-between text-muted-foreground", children: [
3547
+ /* @__PURE__ */ jsx19("span", { children: "Frequency" }),
3548
+ /* @__PURE__ */ jsx19("span", { className: "font-mono", children: options.magneticFrequency ?? 57 })
3498
3549
  ] }),
3499
- /* @__PURE__ */ jsx18(ImageRange, { label: "Magnetic lasso frequency", min: 0, max: 100, step: 1, value: options.magneticFrequency ?? 57, onChange: (v) => set({ magneticFrequency: v }) })
3550
+ /* @__PURE__ */ jsx19(ImageRange, { label: "Magnetic lasso frequency", min: 0, max: 100, step: 1, value: options.magneticFrequency ?? 57, onChange: (v) => set({ magneticFrequency: v }) })
3500
3551
  ] })
3501
3552
  ] }),
3502
- options.tool === "quick" && /* @__PURE__ */ jsxs16("div", { "data-testid": "quick-selection-options", className: "flex flex-col gap-2", children: [
3503
- /* @__PURE__ */ jsx18("p", { className: "text-muted-foreground", children: "Paint inside the area: the selection grows out to its edges. Each stroke adds (Alt-drag subtracts)." }),
3504
- /* @__PURE__ */ jsxs16("label", { className: "flex flex-col gap-1", children: [
3505
- /* @__PURE__ */ jsxs16("span", { className: "flex justify-between text-muted-foreground", children: [
3506
- /* @__PURE__ */ jsx18("span", { children: "Size" }),
3507
- /* @__PURE__ */ jsxs16("span", { className: "font-mono", children: [
3553
+ options.tool === "quick" && /* @__PURE__ */ jsxs17("div", { "data-testid": "quick-selection-options", className: "flex flex-col gap-2", children: [
3554
+ /* @__PURE__ */ jsx19("p", { className: "text-muted-foreground", children: "Paint inside the area: the selection grows out to its edges. Each stroke adds (Alt-drag subtracts)." }),
3555
+ /* @__PURE__ */ jsxs17("label", { className: "flex flex-col gap-1", children: [
3556
+ /* @__PURE__ */ jsxs17("span", { className: "flex justify-between text-muted-foreground", children: [
3557
+ /* @__PURE__ */ jsx19("span", { children: "Size" }),
3558
+ /* @__PURE__ */ jsxs17("span", { className: "font-mono", children: [
3508
3559
  options.quickSize ?? 30,
3509
3560
  " px"
3510
3561
  ] })
3511
3562
  ] }),
3512
- /* @__PURE__ */ jsx18(ImageRange, { label: "Quick selection size", min: 1, max: 500, step: 1, value: options.quickSize ?? 30, onChange: (v) => set({ quickSize: v }) })
3563
+ /* @__PURE__ */ jsx19(ImageRange, { label: "Quick selection size", min: 1, max: 500, step: 1, value: options.quickSize ?? 30, onChange: (v) => set({ quickSize: v }) })
3513
3564
  ] }),
3514
- /* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-2 text-foreground", children: [
3515
- /* @__PURE__ */ jsx18(ImageCheckbox, { label: "Sample all layers", checked: options.quickSampleAll ?? true, onChange: (on) => set({ quickSampleAll: on }) }),
3565
+ /* @__PURE__ */ jsxs17("label", { className: "flex items-center gap-2 text-foreground", children: [
3566
+ /* @__PURE__ */ jsx19(ImageCheckbox, { label: "Sample all layers", checked: options.quickSampleAll ?? true, onChange: (on) => set({ quickSampleAll: on }) }),
3516
3567
  "Sample all layers"
3517
3568
  ] }),
3518
- /* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-2 text-foreground", children: [
3519
- /* @__PURE__ */ jsx18(ImageCheckbox, { label: "Auto-enhance edges", checked: options.quickEnhance ?? false, onChange: (on) => set({ quickEnhance: on }) }),
3569
+ /* @__PURE__ */ jsxs17("label", { className: "flex items-center gap-2 text-foreground", children: [
3570
+ /* @__PURE__ */ jsx19(ImageCheckbox, { label: "Auto-enhance edges", checked: options.quickEnhance ?? false, onChange: (on) => set({ quickEnhance: on }) }),
3520
3571
  "Auto-enhance edges"
3521
3572
  ] })
3522
3573
  ] }),
3523
- options.tool === "object" && /* @__PURE__ */ jsxs16("div", { "data-testid": "object-selection-options", className: "flex flex-col gap-2", children: [
3524
- /* @__PURE__ */ jsx18("p", { className: "text-muted-foreground", children: "Drag a box loosely around an object, or click on it. Shift adds, Alt subtracts." }),
3525
- /* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-2 text-foreground", children: [
3526
- /* @__PURE__ */ jsx18(ImageCheckbox, { label: "Object sample all layers", checked: options.objectSampleAll ?? true, onChange: (on) => set({ objectSampleAll: on }) }),
3574
+ options.tool === "object" && /* @__PURE__ */ jsxs17("div", { "data-testid": "object-selection-options", className: "flex flex-col gap-2", children: [
3575
+ /* @__PURE__ */ jsx19("p", { className: "text-muted-foreground", children: "Drag a box loosely around an object, or click on it. Shift adds, Alt subtracts." }),
3576
+ /* @__PURE__ */ jsxs17("label", { className: "flex items-center gap-2 text-foreground", children: [
3577
+ /* @__PURE__ */ jsx19(ImageCheckbox, { label: "Object sample all layers", checked: options.objectSampleAll ?? true, onChange: (on) => set({ objectSampleAll: on }) }),
3527
3578
  "Sample all layers"
3528
3579
  ] }),
3529
- /* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-2 text-foreground", children: [
3530
- /* @__PURE__ */ jsx18(ImageCheckbox, { label: "Object auto-enhance edges", checked: options.objectEnhance ?? false, onChange: (on) => set({ objectEnhance: on }) }),
3580
+ /* @__PURE__ */ jsxs17("label", { className: "flex items-center gap-2 text-foreground", children: [
3581
+ /* @__PURE__ */ jsx19(ImageCheckbox, { label: "Object auto-enhance edges", checked: options.objectEnhance ?? false, onChange: (on) => set({ objectEnhance: on }) }),
3531
3582
  "Auto-enhance edges"
3532
3583
  ] })
3533
3584
  ] }),
3534
- (options.tool === "type" || options.tool === "type-vertical") && /* @__PURE__ */ jsxs16("div", { "data-testid": "type-mask-options", className: "flex flex-col gap-2", children: [
3535
- /* @__PURE__ */ jsxs16("p", { className: "text-muted-foreground", children: [
3585
+ (options.tool === "type" || options.tool === "type-vertical") && /* @__PURE__ */ jsxs17("div", { "data-testid": "type-mask-options", className: "flex flex-col gap-2", children: [
3586
+ /* @__PURE__ */ jsxs17("p", { className: "text-muted-foreground", children: [
3536
3587
  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).",
3537
3588
  " Shift-click adds, Alt-click subtracts."
3538
3589
  ] }),
3539
- /* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
3590
+ /* @__PURE__ */ jsxs17("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
3540
3591
  "Text",
3541
- /* @__PURE__ */ jsx18(
3592
+ /* @__PURE__ */ jsx19(
3542
3593
  "input",
3543
3594
  {
3544
3595
  type: "text",
@@ -3549,9 +3600,9 @@ var SelectionOptionsBar = ({
3549
3600
  }
3550
3601
  )
3551
3602
  ] }),
3552
- /* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
3603
+ /* @__PURE__ */ jsxs17("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
3553
3604
  "Size",
3554
- /* @__PURE__ */ jsx18(
3605
+ /* @__PURE__ */ jsx19(
3555
3606
  "input",
3556
3607
  {
3557
3608
  type: "number",
@@ -3565,9 +3616,9 @@ var SelectionOptionsBar = ({
3565
3616
  ),
3566
3617
  "px"
3567
3618
  ] }),
3568
- /* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
3619
+ /* @__PURE__ */ jsxs17("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
3569
3620
  "Font",
3570
- /* @__PURE__ */ jsx18(
3621
+ /* @__PURE__ */ jsx19(
3571
3622
  "input",
3572
3623
  {
3573
3624
  type: "text",
@@ -3579,18 +3630,18 @@ var SelectionOptionsBar = ({
3579
3630
  )
3580
3631
  ] })
3581
3632
  ] }),
3582
- options.tool === "range" && /* @__PURE__ */ jsxs16("div", { "data-testid": "color-range-options", className: "flex flex-col gap-2", children: [
3583
- /* @__PURE__ */ jsx18("p", { className: "text-muted-foreground", children: "Click a colour to select it; Shift-click adds a colour, Alt-click removes one." }),
3584
- /* @__PURE__ */ jsxs16("label", { className: "flex flex-col gap-1", children: [
3585
- /* @__PURE__ */ jsxs16("span", { className: "flex justify-between text-muted-foreground", children: [
3586
- /* @__PURE__ */ jsx18("span", { children: "Fuzziness" }),
3587
- /* @__PURE__ */ jsx18("span", { className: "font-mono", children: options.fuzziness ?? 40 })
3633
+ options.tool === "range" && /* @__PURE__ */ jsxs17("div", { "data-testid": "color-range-options", className: "flex flex-col gap-2", children: [
3634
+ /* @__PURE__ */ jsx19("p", { className: "text-muted-foreground", children: "Click a colour to select it; Shift-click adds a colour, Alt-click removes one." }),
3635
+ /* @__PURE__ */ jsxs17("label", { className: "flex flex-col gap-1", children: [
3636
+ /* @__PURE__ */ jsxs17("span", { className: "flex justify-between text-muted-foreground", children: [
3637
+ /* @__PURE__ */ jsx19("span", { children: "Fuzziness" }),
3638
+ /* @__PURE__ */ jsx19("span", { className: "font-mono", children: options.fuzziness ?? 40 })
3588
3639
  ] }),
3589
- /* @__PURE__ */ jsx18(ImageRange, { label: "Fuzziness", min: 0, max: 200, step: 1, value: options.fuzziness ?? 40, onChange: (v) => set({ fuzziness: v }) })
3640
+ /* @__PURE__ */ jsx19(ImageRange, { label: "Fuzziness", min: 0, max: 200, step: 1, value: options.fuzziness ?? 40, onChange: (v) => set({ fuzziness: v }) })
3590
3641
  ] }),
3591
- /* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
3642
+ /* @__PURE__ */ jsxs17("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
3592
3643
  "Localized radius",
3593
- /* @__PURE__ */ jsx18(
3644
+ /* @__PURE__ */ jsx19(
3594
3645
  "input",
3595
3646
  {
3596
3647
  type: "number",
@@ -3604,12 +3655,12 @@ var SelectionOptionsBar = ({
3604
3655
  ),
3605
3656
  "px"
3606
3657
  ] }),
3607
- /* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-2 text-foreground", children: [
3608
- /* @__PURE__ */ jsx18(ImageCheckbox, { label: "Invert", checked: options.rangeInvert ?? false, onChange: (on) => set({ rangeInvert: on }) }),
3658
+ /* @__PURE__ */ jsxs17("label", { className: "flex items-center gap-2 text-foreground", children: [
3659
+ /* @__PURE__ */ jsx19(ImageCheckbox, { label: "Invert", checked: options.rangeInvert ?? false, onChange: (on) => set({ rangeInvert: on }) }),
3609
3660
  "Invert"
3610
3661
  ] }),
3611
- /* @__PURE__ */ jsxs16("div", { className: "flex items-center gap-1", children: [
3612
- /* @__PURE__ */ jsx18(
3662
+ /* @__PURE__ */ jsxs17("div", { className: "flex items-center gap-1", children: [
3663
+ /* @__PURE__ */ jsx19(
3613
3664
  ImageSelect,
3614
3665
  {
3615
3666
  label: "Color Range preset",
@@ -3618,13 +3669,13 @@ var SelectionOptionsBar = ({
3618
3669
  onChange: (v) => setPreset(v)
3619
3670
  }
3620
3671
  ),
3621
- /* @__PURE__ */ jsx18("button", { type: "button", className: btn(false), onClick: () => void applyPreset(), children: "Select" })
3672
+ /* @__PURE__ */ jsx19("button", { type: "button", className: btn(false), onClick: () => void applyPreset(), children: "Select" })
3622
3673
  ] }),
3623
- rangeStatus && /* @__PURE__ */ jsx18("p", { role: "status", className: "text-muted-foreground", children: rangeStatus })
3674
+ rangeStatus && /* @__PURE__ */ jsx19("p", { role: "status", className: "text-muted-foreground", children: rangeStatus })
3624
3675
  ] }),
3625
- /* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
3676
+ /* @__PURE__ */ jsxs17("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
3626
3677
  "Feather",
3627
- /* @__PURE__ */ jsx18(
3678
+ /* @__PURE__ */ jsx19(
3628
3679
  "input",
3629
3680
  {
3630
3681
  type: "number",
@@ -3639,7 +3690,7 @@ var SelectionOptionsBar = ({
3639
3690
  ),
3640
3691
  "px"
3641
3692
  ] }),
3642
- /* @__PURE__ */ jsxs16(
3693
+ /* @__PURE__ */ jsxs17(
3643
3694
  "form",
3644
3695
  {
3645
3696
  "data-testid": "select-subject",
@@ -3649,8 +3700,8 @@ var SelectionOptionsBar = ({
3649
3700
  void selectSubject();
3650
3701
  },
3651
3702
  children: [
3652
- /* @__PURE__ */ jsxs16("div", { className: "flex gap-1", children: [
3653
- controller.segmentationProvider && /* @__PURE__ */ jsx18(
3703
+ /* @__PURE__ */ jsxs17("div", { className: "flex gap-1", children: [
3704
+ controller.segmentationProvider && /* @__PURE__ */ jsx19(
3654
3705
  "input",
3655
3706
  {
3656
3707
  type: "text",
@@ -3662,7 +3713,7 @@ var SelectionOptionsBar = ({
3662
3713
  className: "min-w-0 flex-1 bg-background border border-border rounded px-2 py-1 text-foreground"
3663
3714
  }
3664
3715
  ),
3665
- /* @__PURE__ */ jsx18(
3716
+ /* @__PURE__ */ jsx19(
3666
3717
  "button",
3667
3718
  {
3668
3719
  type: "submit",
@@ -3674,12 +3725,12 @@ var SelectionOptionsBar = ({
3674
3725
  }
3675
3726
  )
3676
3727
  ] }),
3677
- subjectStatus && /* @__PURE__ */ jsx18("p", { role: "status", className: "text-muted-foreground", children: subjectStatus })
3728
+ subjectStatus && /* @__PURE__ */ jsx19("p", { role: "status", className: "text-muted-foreground", children: subjectStatus })
3678
3729
  ]
3679
3730
  }
3680
3731
  ),
3681
- task && /* @__PURE__ */ jsxs16("div", { "data-testid": "selection-progress", className: "flex items-center gap-2", children: [
3682
- /* @__PURE__ */ jsx18(
3732
+ task && /* @__PURE__ */ jsxs17("div", { "data-testid": "selection-progress", className: "flex items-center gap-2", children: [
3733
+ /* @__PURE__ */ jsx19(
3683
3734
  "div",
3684
3735
  {
3685
3736
  role: "progressbar",
@@ -3688,69 +3739,69 @@ var SelectionOptionsBar = ({
3688
3739
  "aria-valuemax": 100,
3689
3740
  "aria-valuenow": Math.round(task.fraction * 100),
3690
3741
  className: "flex-1 h-1.5 rounded bg-muted overflow-hidden",
3691
- children: /* @__PURE__ */ jsx18("div", { className: "h-full bg-primary", style: { width: `${Math.round(task.fraction * 100)}%` } })
3742
+ children: /* @__PURE__ */ jsx19("div", { className: "h-full bg-primary", style: { width: `${Math.round(task.fraction * 100)}%` } })
3692
3743
  }
3693
3744
  ),
3694
- /* @__PURE__ */ jsx18("span", { className: "text-muted-foreground", children: task.stage }),
3695
- /* @__PURE__ */ jsx18("button", { type: "button", className: btn(false), onClick: () => taskAbort.current?.abort(), children: "Cancel" })
3745
+ /* @__PURE__ */ jsx19("span", { className: "text-muted-foreground", children: task.stage }),
3746
+ /* @__PURE__ */ jsx19("button", { type: "button", className: btn(false), onClick: () => taskAbort.current?.abort(), children: "Cancel" })
3696
3747
  ] }),
3697
- /* @__PURE__ */ jsx18("button", { type: "button", className: btn(false), onClick: () => setWorkspace(true), children: "Select and Mask\u2026" }),
3698
- workspace && /* @__PURE__ */ jsx18(SelectAndMaskWorkspace, { controller, onClose: () => setWorkspace(false) }),
3699
- /* @__PURE__ */ jsxs16("div", { "data-testid": "select-sky", className: "flex flex-col gap-1", children: [
3700
- /* @__PURE__ */ jsx18("button", { type: "button", className: btn(false), disabled: skying, "aria-busy": skying, onClick: () => void selectSky(), children: skying ? "Selecting\u2026" : "Select Sky" }),
3701
- skyStatus && /* @__PURE__ */ jsx18("p", { role: "status", className: "text-muted-foreground", children: skyStatus })
3748
+ /* @__PURE__ */ jsx19("button", { type: "button", className: btn(false), onClick: () => setWorkspace(true), children: "Select and Mask\u2026" }),
3749
+ workspace && /* @__PURE__ */ jsx19(SelectAndMaskWorkspace, { controller, onClose: () => setWorkspace(false) }),
3750
+ /* @__PURE__ */ jsxs17("div", { "data-testid": "select-sky", className: "flex flex-col gap-1", children: [
3751
+ /* @__PURE__ */ jsx19("button", { type: "button", className: btn(false), disabled: skying, "aria-busy": skying, onClick: () => void selectSky(), children: skying ? "Selecting\u2026" : "Select Sky" }),
3752
+ skyStatus && /* @__PURE__ */ jsx19("p", { role: "status", className: "text-muted-foreground", children: skyStatus })
3702
3753
  ] }),
3703
- /* @__PURE__ */ jsxs16("details", { "data-testid": "focus-area", className: "flex flex-col gap-2", children: [
3704
- /* @__PURE__ */ jsx18("summary", { className: "cursor-pointer text-foreground", children: "Focus Area" }),
3705
- /* @__PURE__ */ jsxs16("div", { className: "flex flex-col gap-2 pt-2", children: [
3706
- /* @__PURE__ */ jsxs16("label", { className: "flex flex-col gap-1", children: [
3707
- /* @__PURE__ */ jsxs16("span", { className: "flex justify-between text-muted-foreground", children: [
3708
- /* @__PURE__ */ jsx18("span", { children: "In-focus range" }),
3709
- /* @__PURE__ */ jsx18("span", { className: "font-mono", children: options.focusRange ?? 50 })
3754
+ /* @__PURE__ */ jsxs17("details", { "data-testid": "focus-area", className: "flex flex-col gap-2", children: [
3755
+ /* @__PURE__ */ jsx19("summary", { className: "cursor-pointer text-foreground", children: "Focus Area" }),
3756
+ /* @__PURE__ */ jsxs17("div", { className: "flex flex-col gap-2 pt-2", children: [
3757
+ /* @__PURE__ */ jsxs17("label", { className: "flex flex-col gap-1", children: [
3758
+ /* @__PURE__ */ jsxs17("span", { className: "flex justify-between text-muted-foreground", children: [
3759
+ /* @__PURE__ */ jsx19("span", { children: "In-focus range" }),
3760
+ /* @__PURE__ */ jsx19("span", { className: "font-mono", children: options.focusRange ?? 50 })
3710
3761
  ] }),
3711
- /* @__PURE__ */ jsx18(ImageRange, { label: "In-focus range", min: 0, max: 100, step: 1, value: options.focusRange ?? 50, onChange: (v) => set({ focusRange: v }) })
3762
+ /* @__PURE__ */ jsx19(ImageRange, { label: "In-focus range", min: 0, max: 100, step: 1, value: options.focusRange ?? 50, onChange: (v) => set({ focusRange: v }) })
3712
3763
  ] }),
3713
- /* @__PURE__ */ jsxs16("label", { className: "flex flex-col gap-1", children: [
3714
- /* @__PURE__ */ jsxs16("span", { className: "flex justify-between text-muted-foreground", children: [
3715
- /* @__PURE__ */ jsx18("span", { children: "Image noise level" }),
3716
- /* @__PURE__ */ jsx18("span", { className: "font-mono", children: options.focusNoise ?? 0 })
3764
+ /* @__PURE__ */ jsxs17("label", { className: "flex flex-col gap-1", children: [
3765
+ /* @__PURE__ */ jsxs17("span", { className: "flex justify-between text-muted-foreground", children: [
3766
+ /* @__PURE__ */ jsx19("span", { children: "Image noise level" }),
3767
+ /* @__PURE__ */ jsx19("span", { className: "font-mono", children: options.focusNoise ?? 0 })
3717
3768
  ] }),
3718
- /* @__PURE__ */ jsx18(ImageRange, { label: "Image noise level", min: 0, max: 100, step: 1, value: options.focusNoise ?? 0, onChange: (v) => set({ focusNoise: v }) })
3769
+ /* @__PURE__ */ jsx19(ImageRange, { label: "Image noise level", min: 0, max: 100, step: 1, value: options.focusNoise ?? 0, onChange: (v) => set({ focusNoise: v }) })
3719
3770
  ] }),
3720
- /* @__PURE__ */ jsxs16("label", { className: "flex flex-col gap-1", children: [
3721
- /* @__PURE__ */ jsxs16("span", { className: "flex justify-between text-muted-foreground", children: [
3722
- /* @__PURE__ */ jsx18("span", { children: "Soften edge" }),
3723
- /* @__PURE__ */ jsxs16("span", { className: "font-mono", children: [
3771
+ /* @__PURE__ */ jsxs17("label", { className: "flex flex-col gap-1", children: [
3772
+ /* @__PURE__ */ jsxs17("span", { className: "flex justify-between text-muted-foreground", children: [
3773
+ /* @__PURE__ */ jsx19("span", { children: "Soften edge" }),
3774
+ /* @__PURE__ */ jsxs17("span", { className: "font-mono", children: [
3724
3775
  options.focusSoftness ?? 4,
3725
3776
  " px"
3726
3777
  ] })
3727
3778
  ] }),
3728
- /* @__PURE__ */ jsx18(ImageRange, { label: "Focus soften edge", min: 0, max: 50, step: 1, value: options.focusSoftness ?? 4, onChange: (v) => set({ focusSoftness: v }) })
3779
+ /* @__PURE__ */ jsx19(ImageRange, { label: "Focus soften edge", min: 0, max: 50, step: 1, value: options.focusSoftness ?? 4, onChange: (v) => set({ focusSoftness: v }) })
3729
3780
  ] }),
3730
- /* @__PURE__ */ jsx18("button", { type: "button", className: btn(false), disabled: focusing, "aria-busy": focusing, onClick: () => void selectFocusArea(), children: focusing ? "Selecting\u2026" : "Select Focus Area" }),
3731
- focusStatus && /* @__PURE__ */ jsx18("p", { role: "status", className: "text-muted-foreground", children: focusStatus })
3781
+ /* @__PURE__ */ jsx19("button", { type: "button", className: btn(false), disabled: focusing, "aria-busy": focusing, onClick: () => void selectFocusArea(), children: focusing ? "Selecting\u2026" : "Select Focus Area" }),
3782
+ focusStatus && /* @__PURE__ */ jsx19("p", { role: "status", className: "text-muted-foreground", children: focusStatus })
3732
3783
  ] })
3733
3784
  ] }),
3734
- /* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-2 text-foreground", children: [
3735
- /* @__PURE__ */ jsx18(ImageCheckbox, { label: "Anti-alias", checked: options.antiAlias, onChange: (on) => set({ antiAlias: on }) }),
3785
+ /* @__PURE__ */ jsxs17("label", { className: "flex items-center gap-2 text-foreground", children: [
3786
+ /* @__PURE__ */ jsx19(ImageCheckbox, { label: "Anti-alias", checked: options.antiAlias, onChange: (on) => set({ antiAlias: on }) }),
3736
3787
  "Anti-alias"
3737
3788
  ] }),
3738
- /* @__PURE__ */ jsxs16("div", { className: "flex flex-wrap gap-1", children: [
3739
- /* @__PURE__ */ jsx18("button", { type: "button", className: btn(false), onClick: () => controller.selectAll(), children: "Select All" }),
3740
- /* @__PURE__ */ jsx18("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => controller.deselect(), children: "Deselect" }),
3741
- /* @__PURE__ */ jsx18("button", { type: "button", className: btn(false), onClick: () => controller.invertSelection(), children: "Inverse" }),
3742
- /* @__PURE__ */ jsx18("button", { type: "button", className: btn(false), disabled: !controller.canReselect(), onClick: () => controller.reselect(), children: "Reselect" }),
3743
- /* @__PURE__ */ jsx18("button", { type: "button", className: btn(false), disabled: !sel, title: "Add connected pixels of a selected colour (wand tolerance)", onClick: () => void runColor("grow"), children: "Grow" }),
3744
- /* @__PURE__ */ jsx18("button", { type: "button", className: btn(false), disabled: !sel, title: "Add every pixel of a selected colour (wand tolerance)", onClick: () => void runColor("similar"), children: "Similar" })
3789
+ /* @__PURE__ */ jsxs17("div", { className: "flex flex-wrap gap-1", children: [
3790
+ /* @__PURE__ */ jsx19("button", { type: "button", className: btn(false), onClick: () => controller.selectAll(), children: "Select All" }),
3791
+ /* @__PURE__ */ jsx19("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => controller.deselect(), children: "Deselect" }),
3792
+ /* @__PURE__ */ jsx19("button", { type: "button", className: btn(false), onClick: () => controller.invertSelection(), children: "Inverse" }),
3793
+ /* @__PURE__ */ jsx19("button", { type: "button", className: btn(false), disabled: !controller.canReselect(), onClick: () => controller.reselect(), children: "Reselect" }),
3794
+ /* @__PURE__ */ jsx19("button", { type: "button", className: btn(false), disabled: !sel, title: "Add connected pixels of a selected colour (wand tolerance)", onClick: () => void runColor("grow"), children: "Grow" }),
3795
+ /* @__PURE__ */ jsx19("button", { type: "button", className: btn(false), disabled: !sel, title: "Add every pixel of a selected colour (wand tolerance)", onClick: () => void runColor("similar"), children: "Similar" })
3745
3796
  ] }),
3746
- /* @__PURE__ */ jsxs16("div", { role: "group", "aria-label": "Show selection", className: "flex flex-wrap items-center gap-1", children: [
3747
- /* @__PURE__ */ jsx18("span", { className: "text-muted-foreground", children: "Show" }),
3748
- DISPLAYS.map((d) => /* @__PURE__ */ jsx18("button", { type: "button", "aria-pressed": display === d.id, className: btn(display === d.id), onClick: () => controller.setSelectionDisplay(d.id), children: d.label }, d.id))
3797
+ /* @__PURE__ */ jsxs17("div", { role: "group", "aria-label": "Show selection", className: "flex flex-wrap items-center gap-1", children: [
3798
+ /* @__PURE__ */ jsx19("span", { className: "text-muted-foreground", children: "Show" }),
3799
+ DISPLAYS.map((d) => /* @__PURE__ */ jsx19("button", { type: "button", "aria-pressed": display === d.id, className: btn(display === d.id), onClick: () => controller.setSelectionDisplay(d.id), children: d.label }, d.id))
3749
3800
  ] }),
3750
- /* @__PURE__ */ jsxs16("div", { className: "flex flex-wrap items-center gap-1", children: [
3751
- /* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
3801
+ /* @__PURE__ */ jsxs17("div", { className: "flex flex-wrap items-center gap-1", children: [
3802
+ /* @__PURE__ */ jsxs17("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
3752
3803
  "Radius",
3753
- /* @__PURE__ */ jsx18(
3804
+ /* @__PURE__ */ jsx19(
3754
3805
  "input",
3755
3806
  {
3756
3807
  type: "number",
@@ -3764,12 +3815,12 @@ var SelectionOptionsBar = ({
3764
3815
  }
3765
3816
  )
3766
3817
  ] }),
3767
- MODIFY_OPS.map(({ op, label }) => /* @__PURE__ */ jsx18("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => controller.modifySelection(op, radius), children: label }, op))
3818
+ MODIFY_OPS.map(({ op, label }) => /* @__PURE__ */ jsx19("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => controller.modifySelection(op, radius), children: label }, op))
3768
3819
  ] }),
3769
- /* @__PURE__ */ jsxs16("div", { role: "group", "aria-label": "Edit selection", className: "flex flex-wrap items-center gap-1", children: [
3770
- /* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
3820
+ /* @__PURE__ */ jsxs17("div", { role: "group", "aria-label": "Edit selection", className: "flex flex-wrap items-center gap-1", children: [
3821
+ /* @__PURE__ */ jsxs17("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
3771
3822
  "Stroke",
3772
- /* @__PURE__ */ jsx18(
3823
+ /* @__PURE__ */ jsx19(
3773
3824
  "input",
3774
3825
  {
3775
3826
  type: "number",
@@ -3784,7 +3835,7 @@ var SelectionOptionsBar = ({
3784
3835
  ),
3785
3836
  "px"
3786
3837
  ] }),
3787
- /* @__PURE__ */ jsx18(
3838
+ /* @__PURE__ */ jsx19(
3788
3839
  ImageSelect,
3789
3840
  {
3790
3841
  label: "Stroke location",
@@ -3797,28 +3848,28 @@ var SelectionOptionsBar = ({
3797
3848
  onChange: (v) => setStrokeLocation(v)
3798
3849
  }
3799
3850
  ),
3800
- /* @__PURE__ */ jsx18("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.strokeSelection({ width: strokeWidth, location: strokeLocation })), children: "Stroke" }),
3801
- /* @__PURE__ */ jsx18("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.cropToSelection()), children: "Crop to Selection" }),
3802
- /* @__PURE__ */ jsx18("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.contentAwareFill({ output: "new-layer" })), children: "Content-Aware Fill" }),
3803
- /* @__PURE__ */ jsx18("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => setFillWorkspace(true), children: "Content-Aware Fill\u2026" }),
3804
- fillWorkspace && /* @__PURE__ */ jsx18(ContentAwareFillWorkspace, { controller, onClose: () => setFillWorkspace(false) })
3851
+ /* @__PURE__ */ jsx19("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.strokeSelection({ width: strokeWidth, location: strokeLocation })), children: "Stroke" }),
3852
+ /* @__PURE__ */ jsx19("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.cropToSelection()), children: "Crop to Selection" }),
3853
+ /* @__PURE__ */ jsx19("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.contentAwareFill({ output: "new-layer" })), children: "Content-Aware Fill" }),
3854
+ /* @__PURE__ */ jsx19("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => setFillWorkspace(true), children: "Content-Aware Fill\u2026" }),
3855
+ fillWorkspace && /* @__PURE__ */ jsx19(ContentAwareFillWorkspace, { controller, onClose: () => setFillWorkspace(false) })
3805
3856
  ] }),
3806
- /* @__PURE__ */ jsxs16("div", { role: "group", "aria-label": "Clipboard", className: "flex flex-wrap gap-1", children: [
3807
- /* @__PURE__ */ jsx18("button", { type: "button", className: btn(false), onClick: () => edit(() => controller.copyPixels()), children: "Copy" }),
3808
- /* @__PURE__ */ jsx18("button", { type: "button", className: btn(false), onClick: () => edit(() => controller.copyPixels({ merged: true })), children: "Copy Merged" }),
3809
- /* @__PURE__ */ jsx18("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.cutPixels()), children: "Cut" }),
3810
- /* @__PURE__ */ jsx18("button", { type: "button", className: btn(false), onClick: () => edit(() => controller.pastePixels("new-layer")), children: "Paste" }),
3811
- /* @__PURE__ */ jsx18("button", { type: "button", className: btn(false), onClick: () => edit(() => controller.pastePixels("in-place")), children: "Paste in Place" }),
3812
- /* @__PURE__ */ jsx18("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.pastePixels("into")), children: "Paste Into" }),
3813
- /* @__PURE__ */ jsx18("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.pastePixels("outside")), children: "Paste Outside" })
3857
+ /* @__PURE__ */ jsxs17("div", { role: "group", "aria-label": "Clipboard", className: "flex flex-wrap gap-1", children: [
3858
+ /* @__PURE__ */ jsx19("button", { type: "button", className: btn(false), onClick: () => edit(() => controller.copyPixels()), children: "Copy" }),
3859
+ /* @__PURE__ */ jsx19("button", { type: "button", className: btn(false), onClick: () => edit(() => controller.copyPixels({ merged: true })), children: "Copy Merged" }),
3860
+ /* @__PURE__ */ jsx19("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.cutPixels()), children: "Cut" }),
3861
+ /* @__PURE__ */ jsx19("button", { type: "button", className: btn(false), onClick: () => edit(() => controller.pastePixels("new-layer")), children: "Paste" }),
3862
+ /* @__PURE__ */ jsx19("button", { type: "button", className: btn(false), onClick: () => edit(() => controller.pastePixels("in-place")), children: "Paste in Place" }),
3863
+ /* @__PURE__ */ jsx19("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.pastePixels("into")), children: "Paste Into" }),
3864
+ /* @__PURE__ */ jsx19("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.pastePixels("outside")), children: "Paste Outside" })
3814
3865
  ] }),
3815
- colorStatus && /* @__PURE__ */ jsx18("p", { role: "status", className: "text-muted-foreground", children: colorStatus }),
3816
- /* @__PURE__ */ jsx18("p", { "data-testid": "selection-status", className: "text-muted-foreground", children: describeSelection(sel) })
3866
+ colorStatus && /* @__PURE__ */ jsx19("p", { role: "status", className: "text-muted-foreground", children: colorStatus }),
3867
+ /* @__PURE__ */ jsx19("p", { "data-testid": "selection-status", className: "text-muted-foreground", children: describeSelection(sel) })
3817
3868
  ] });
3818
3869
  };
3819
3870
 
3820
3871
  // src/image-editor/RefineEdgePanel.tsx
3821
- import { useState as useState18 } from "react";
3872
+ import { useState as useState19 } from "react";
3822
3873
  import {
3823
3874
  ADJUSTMENT_KINDS as ADJUSTMENT_KINDS2,
3824
3875
  REFINE_EDGE_CONTROLS as REFINE_EDGE_CONTROLS2,
@@ -3828,14 +3879,14 @@ import {
3828
3879
  } from "@pixerate/editor/image-editor";
3829
3880
 
3830
3881
  // src/image-editor/MaskEdgeCheck.tsx
3831
- import React14, { useState as useState15 } from "react";
3882
+ import React15, { useState as useState16 } from "react";
3832
3883
  import { MASK_EDGE_THRESHOLDS } from "@pixerate/editor/image-editor";
3833
- import { Fragment as Fragment4, jsx as jsx19, jsxs as jsxs17 } from "react/jsx-runtime";
3884
+ import { Fragment as Fragment5, jsx as jsx20, jsxs as jsxs18 } from "react/jsx-runtime";
3834
3885
  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";
3835
3886
  var MaskEdgeCheck = ({ controller, selection, target = "selection", layerId, className = "" }) => {
3836
3887
  const sel = selection === void 0 ? controller.getSelection() : selection;
3837
- const [result, setResult] = useState15(null);
3838
- const [error, setError] = useState15(null);
3888
+ const [result, setResult] = useState16(null);
3889
+ const [error, setError] = useState16(null);
3839
3890
  const report = result && (target !== "selection" || result.for === sel) ? result.report : null;
3840
3891
  const check = () => {
3841
3892
  setError(null);
@@ -3853,35 +3904,35 @@ var MaskEdgeCheck = ({ controller, selection, target = "selection", layerId, cla
3853
3904
  { label: "Jaggedness", value: report.jaggedness, bad: report.jaggedness >= T.jaggedness },
3854
3905
  { label: "Soft edge", value: report.softFraction, bad: report.softFraction >= T.soft }
3855
3906
  ] : [];
3856
- return /* @__PURE__ */ jsxs17("div", { "data-testid": "mask-edge-check", className: `flex flex-col gap-1.5 text-xs ${className}`, children: [
3857
- /* @__PURE__ */ jsx19("button", { type: "button", className: `${button3} self-start`, disabled: target === "selection" && !sel, onClick: check, children: "Check Edge" }),
3858
- report && /* @__PURE__ */ jsxs17(Fragment4, { children: [
3859
- /* @__PURE__ */ jsxs17("dl", { className: "grid grid-cols-[1fr_auto] gap-x-2 gap-y-0.5", children: [
3860
- rows.map((r) => /* @__PURE__ */ jsxs17(React14.Fragment, { children: [
3861
- /* @__PURE__ */ jsx19("dt", { className: "text-muted-foreground", children: r.label }),
3862
- /* @__PURE__ */ jsx19("dd", { className: `font-mono text-right ${r.bad ? "text-destructive" : "text-foreground"}`, children: r.value })
3907
+ return /* @__PURE__ */ jsxs18("div", { "data-testid": "mask-edge-check", className: `flex flex-col gap-1.5 text-xs ${className}`, children: [
3908
+ /* @__PURE__ */ jsx20("button", { type: "button", className: `${button3} self-start`, disabled: target === "selection" && !sel, onClick: check, children: "Check Edge" }),
3909
+ report && /* @__PURE__ */ jsxs18(Fragment5, { children: [
3910
+ /* @__PURE__ */ jsxs18("dl", { className: "grid grid-cols-[1fr_auto] gap-x-2 gap-y-0.5", children: [
3911
+ rows.map((r) => /* @__PURE__ */ jsxs18(React15.Fragment, { children: [
3912
+ /* @__PURE__ */ jsx20("dt", { className: "text-muted-foreground", children: r.label }),
3913
+ /* @__PURE__ */ jsx20("dd", { className: `font-mono text-right ${r.bad ? "text-destructive" : "text-foreground"}`, children: r.value })
3863
3914
  ] }, r.label)),
3864
- /* @__PURE__ */ jsx19("dt", { className: "text-muted-foreground", children: "Holes / islands" }),
3865
- /* @__PURE__ */ jsxs17("dd", { className: `font-mono text-right ${report.holes.count || report.islands.count ? "text-destructive" : "text-foreground"}`, children: [
3915
+ /* @__PURE__ */ jsx20("dt", { className: "text-muted-foreground", children: "Holes / islands" }),
3916
+ /* @__PURE__ */ jsxs18("dd", { className: `font-mono text-right ${report.holes.count || report.islands.count ? "text-destructive" : "text-foreground"}`, children: [
3866
3917
  report.holes.count,
3867
3918
  " / ",
3868
3919
  report.islands.count
3869
3920
  ] })
3870
3921
  ] }),
3871
- report.issues.length ? /* @__PURE__ */ jsx19("ul", { "data-testid": "mask-edge-issues", className: "list-disc pl-4 flex flex-col gap-1 text-foreground", children: report.issues.map((s) => /* @__PURE__ */ jsx19("li", { children: s }, s)) }) : /* @__PURE__ */ jsx19("p", { className: "text-muted-foreground", children: "The edge looks clean." })
3922
+ report.issues.length ? /* @__PURE__ */ jsx20("ul", { "data-testid": "mask-edge-issues", className: "list-disc pl-4 flex flex-col gap-1 text-foreground", children: report.issues.map((s) => /* @__PURE__ */ jsx20("li", { children: s }, s)) }) : /* @__PURE__ */ jsx20("p", { className: "text-muted-foreground", children: "The edge looks clean." })
3872
3923
  ] }),
3873
- error && /* @__PURE__ */ jsx19("p", { role: "alert", className: "text-destructive", children: error })
3924
+ error && /* @__PURE__ */ jsx20("p", { role: "alert", className: "text-destructive", children: error })
3874
3925
  ] });
3875
3926
  };
3876
3927
 
3877
3928
  // src/image-editor/SelectionChangeCheck.tsx
3878
- import { useState as useState16 } from "react";
3879
- import { Fragment as Fragment5, jsx as jsx20, jsxs as jsxs18 } from "react/jsx-runtime";
3929
+ import { useState as useState17 } from "react";
3930
+ import { Fragment as Fragment6, jsx as jsx21, jsxs as jsxs19 } from "react/jsx-runtime";
3880
3931
  var button4 = "px-2 py-1 rounded-md border border-border bg-background text-[11px] text-foreground hover:bg-accent hover:text-accent-foreground disabled:opacity-40";
3881
3932
  var SelectionChangeCheck = ({ controller, selection, className = "" }) => {
3882
3933
  const sel = selection === void 0 ? controller.getSelection() : selection;
3883
- const [result, setResult] = useState16(null);
3884
- const [error, setError] = useState16(null);
3934
+ const [result, setResult] = useState17(null);
3935
+ const [error, setError] = useState17(null);
3885
3936
  const diff = result && result.for === sel ? result.diff : null;
3886
3937
  const show = () => {
3887
3938
  setError(null);
@@ -3892,16 +3943,16 @@ var SelectionChangeCheck = ({ controller, selection, className = "" }) => {
3892
3943
  setError(err instanceof Error ? err.message : String(err));
3893
3944
  }
3894
3945
  };
3895
- return /* @__PURE__ */ jsxs18("div", { "data-testid": "selection-change-check", className: `flex flex-col gap-1 text-xs ${className}`, children: [
3896
- /* @__PURE__ */ jsx20("button", { type: "button", className: `${button4} self-start`, onClick: show, children: "Show Last Change" }),
3897
- diff && /* @__PURE__ */ jsx20("p", { "data-testid": "selection-change-summary", className: "text-foreground", children: diff.identical ? "The last step did not change the selection." : /* @__PURE__ */ jsxs18(Fragment5, { children: [
3898
- /* @__PURE__ */ jsxs18("span", { className: "text-green-600", children: [
3946
+ return /* @__PURE__ */ jsxs19("div", { "data-testid": "selection-change-check", className: `flex flex-col gap-1 text-xs ${className}`, children: [
3947
+ /* @__PURE__ */ jsx21("button", { type: "button", className: `${button4} self-start`, onClick: show, children: "Show Last Change" }),
3948
+ diff && /* @__PURE__ */ jsx21("p", { "data-testid": "selection-change-summary", className: "text-foreground", children: diff.identical ? "The last step did not change the selection." : /* @__PURE__ */ jsxs19(Fragment6, { children: [
3949
+ /* @__PURE__ */ jsxs19("span", { className: "text-green-600", children: [
3899
3950
  "+",
3900
3951
  diff.added.area,
3901
3952
  " px"
3902
3953
  ] }),
3903
3954
  " ",
3904
- /* @__PURE__ */ jsxs18("span", { className: "text-destructive", children: [
3955
+ /* @__PURE__ */ jsxs19("span", { className: "text-destructive", children: [
3905
3956
  "\u2212",
3906
3957
  diff.removed.area,
3907
3958
  " px"
@@ -3910,20 +3961,20 @@ var SelectionChangeCheck = ({ controller, selection, className = "" }) => {
3910
3961
  Math.round(diff.iou * 100),
3911
3962
  "%"
3912
3963
  ] }) }),
3913
- error && /* @__PURE__ */ jsx20("p", { role: "alert", className: "text-destructive", children: error })
3964
+ error && /* @__PURE__ */ jsx21("p", { role: "alert", className: "text-destructive", children: error })
3914
3965
  ] });
3915
3966
  };
3916
3967
 
3917
3968
  // src/image-editor/SeparateSubjectPanel.tsx
3918
- import { useRef as useRef11, useState as useState17 } from "react";
3919
- import { jsx as jsx21, jsxs as jsxs19 } from "react/jsx-runtime";
3969
+ import { useRef as useRef11, useState as useState18 } from "react";
3970
+ import { jsx as jsx22, jsxs as jsxs20 } from "react/jsx-runtime";
3920
3971
  var button5 = "px-2 py-1 rounded-md border border-border bg-background text-[11px] text-foreground hover:bg-accent hover:text-accent-foreground disabled:opacity-40";
3921
3972
  var SeparateSubjectPanel = ({ controller, selection, className = "" }) => {
3922
3973
  const sel = selection === void 0 ? controller.getSelection() : selection;
3923
- const [dilate, setDilate] = useState17(8);
3924
- const [fill, setFill] = useState17(true);
3925
- const [progress, setProgress] = useState17(null);
3926
- const [error, setError] = useState17(null);
3974
+ const [dilate, setDilate] = useState18(8);
3975
+ const [fill, setFill] = useState18(true);
3976
+ const [progress, setProgress] = useState18(null);
3977
+ const [error, setError] = useState18(null);
3927
3978
  const abort = useRef11(null);
3928
3979
  const run = async () => {
3929
3980
  setError(null);
@@ -3943,13 +3994,13 @@ var SeparateSubjectPanel = ({ controller, selection, className = "" }) => {
3943
3994
  setProgress(null);
3944
3995
  }
3945
3996
  };
3946
- return /* @__PURE__ */ jsxs19("div", { "data-testid": "separate-subject", className: `flex flex-col gap-1.5 text-xs ${className}`, children: [
3947
- /* @__PURE__ */ jsx21("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px]", children: "Separate Subject" }),
3948
- /* @__PURE__ */ jsx21("p", { className: "text-muted-foreground", children: "The selection onto its own masked layer, over the background with the subject filled out." }),
3949
- /* @__PURE__ */ jsxs19("div", { className: "flex flex-wrap items-center gap-2", children: [
3950
- /* @__PURE__ */ jsxs19("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
3997
+ return /* @__PURE__ */ jsxs20("div", { "data-testid": "separate-subject", className: `flex flex-col gap-1.5 text-xs ${className}`, children: [
3998
+ /* @__PURE__ */ jsx22("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px]", children: "Separate Subject" }),
3999
+ /* @__PURE__ */ jsx22("p", { className: "text-muted-foreground", children: "The selection onto its own masked layer, over the background with the subject filled out." }),
4000
+ /* @__PURE__ */ jsxs20("div", { className: "flex flex-wrap items-center gap-2", children: [
4001
+ /* @__PURE__ */ jsxs20("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
3951
4002
  "Grow",
3952
- /* @__PURE__ */ jsx21(
4003
+ /* @__PURE__ */ jsx22(
3953
4004
  "input",
3954
4005
  {
3955
4006
  type: "number",
@@ -3963,34 +4014,34 @@ var SeparateSubjectPanel = ({ controller, selection, className = "" }) => {
3963
4014
  ),
3964
4015
  "px"
3965
4016
  ] }),
3966
- /* @__PURE__ */ jsxs19("label", { className: "flex items-center gap-1 text-foreground", children: [
3967
- /* @__PURE__ */ jsx21("input", { type: "checkbox", "aria-label": "Fill the background", checked: fill, onChange: (e) => setFill(e.target.checked) }),
4017
+ /* @__PURE__ */ jsxs20("label", { className: "flex items-center gap-1 text-foreground", children: [
4018
+ /* @__PURE__ */ jsx22("input", { type: "checkbox", "aria-label": "Fill the background", checked: fill, onChange: (e) => setFill(e.target.checked) }),
3968
4019
  "Fill the background"
3969
4020
  ] })
3970
4021
  ] }),
3971
- /* @__PURE__ */ jsxs19("div", { className: "flex gap-1", children: [
3972
- /* @__PURE__ */ jsx21("button", { type: "button", className: button5, disabled: !sel || progress !== null, onClick: run, children: "Separate Subject" }),
3973
- progress !== null && /* @__PURE__ */ jsx21("button", { type: "button", className: button5, onClick: () => abort.current?.abort(), children: "Cancel" })
4022
+ /* @__PURE__ */ jsxs20("div", { className: "flex gap-1", children: [
4023
+ /* @__PURE__ */ jsx22("button", { type: "button", className: button5, disabled: !sel || progress !== null, onClick: run, children: "Separate Subject" }),
4024
+ progress !== null && /* @__PURE__ */ jsx22("button", { type: "button", className: button5, onClick: () => abort.current?.abort(), children: "Cancel" })
3974
4025
  ] }),
3975
- progress !== null && /* @__PURE__ */ jsx21("p", { role: "status", className: "text-muted-foreground", children: progress }),
3976
- error && /* @__PURE__ */ jsx21("p", { role: "alert", className: "text-destructive", children: error })
4026
+ progress !== null && /* @__PURE__ */ jsx22("p", { role: "status", className: "text-muted-foreground", children: progress }),
4027
+ error && /* @__PURE__ */ jsx22("p", { role: "alert", className: "text-destructive", children: error })
3977
4028
  ] });
3978
4029
  };
3979
4030
 
3980
4031
  // src/image-editor/RefineEdgePanel.tsx
3981
- import { Fragment as Fragment6, jsx as jsx22, jsxs as jsxs20 } from "react/jsx-runtime";
4032
+ import { Fragment as Fragment7, jsx as jsx23, jsxs as jsxs21 } from "react/jsx-runtime";
3982
4033
  var DEFAULT_PARAMS = { radius: 8, smartRadius: false, smooth: 0, feather: 0, contrast: 0, shiftEdge: 0 };
3983
4034
  var button6 = "px-2 py-1 rounded-md border border-border bg-background text-[11px] text-foreground hover:bg-accent hover:text-accent-foreground disabled:opacity-40";
3984
4035
  var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
3985
- const [params, setParams] = useState18(DEFAULT_PARAMS);
3986
- const [busy, setBusy] = useState18(false);
3987
- const [error, setError] = useState18(null);
3988
- const [layerId, setLayerId] = useState18("");
3989
- const [newKind, setNewKind] = useState18("hueSaturation");
3990
- const [output, setOutput] = useState18("selection");
3991
- const [decontaminate, setDecontaminate] = useState18(0);
3992
- const [objectAware, setObjectAware] = useState18(false);
3993
- const [onlyUncertain, setOnlyUncertain] = useState18(false);
4036
+ const [params, setParams] = useState19(DEFAULT_PARAMS);
4037
+ const [busy, setBusy] = useState19(false);
4038
+ const [error, setError] = useState19(null);
4039
+ const [layerId, setLayerId] = useState19("");
4040
+ const [newKind, setNewKind] = useState19("hueSaturation");
4041
+ const [output, setOutput] = useState19("selection");
4042
+ const [decontaminate, setDecontaminate] = useState19(0);
4043
+ const [objectAware, setObjectAware] = useState19(false);
4044
+ const [onlyUncertain, setOnlyUncertain] = useState19(false);
3994
4045
  const canObject = Boolean(controller.segmentationProvider);
3995
4046
  const toLayer = output !== "selection" && output !== "layer-mask";
3996
4047
  const sel = selection === void 0 ? controller.getSelection() : selection;
@@ -4013,17 +4064,17 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
4013
4064
  setBusy(false);
4014
4065
  }
4015
4066
  };
4016
- return /* @__PURE__ */ jsxs20("div", { "data-testid": "refine-edge-panel", className: `flex flex-col gap-3 text-xs ${className}`, children: [
4017
- /* @__PURE__ */ jsx22("span", { className: imageSectionTitleClass, children: "Refine Edge" }),
4018
- REFINE_EDGE_CONTROLS2.map((c) => /* @__PURE__ */ jsxs20("label", { className: "flex flex-col gap-1", children: [
4019
- /* @__PURE__ */ jsxs20("span", { className: "flex justify-between text-muted-foreground", children: [
4020
- /* @__PURE__ */ jsx22("span", { children: c.label }),
4021
- /* @__PURE__ */ jsxs20("span", { className: "font-mono", children: [
4067
+ return /* @__PURE__ */ jsxs21("div", { "data-testid": "refine-edge-panel", className: `flex flex-col gap-3 text-xs ${className}`, children: [
4068
+ /* @__PURE__ */ jsx23("span", { className: imageSectionTitleClass, children: "Refine Edge" }),
4069
+ REFINE_EDGE_CONTROLS2.map((c) => /* @__PURE__ */ jsxs21("label", { className: "flex flex-col gap-1", children: [
4070
+ /* @__PURE__ */ jsxs21("span", { className: "flex justify-between text-muted-foreground", children: [
4071
+ /* @__PURE__ */ jsx23("span", { children: c.label }),
4072
+ /* @__PURE__ */ jsxs21("span", { className: "font-mono", children: [
4022
4073
  params[c.id],
4023
4074
  c.unit
4024
4075
  ] })
4025
4076
  ] }),
4026
- /* @__PURE__ */ jsx22(
4077
+ /* @__PURE__ */ jsx23(
4027
4078
  "input",
4028
4079
  {
4029
4080
  type: "range",
@@ -4037,43 +4088,43 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
4037
4088
  }
4038
4089
  )
4039
4090
  ] }, c.id)),
4040
- /* @__PURE__ */ jsxs20("label", { className: "flex items-center gap-2 text-foreground", children: [
4041
- /* @__PURE__ */ jsx22("input", { type: "checkbox", checked: params.smartRadius, onChange: (e) => setParams({ ...params, smartRadius: e.target.checked }) }),
4091
+ /* @__PURE__ */ jsxs21("label", { className: "flex items-center gap-2 text-foreground", children: [
4092
+ /* @__PURE__ */ jsx23("input", { type: "checkbox", checked: params.smartRadius, onChange: (e) => setParams({ ...params, smartRadius: e.target.checked }) }),
4042
4093
  "Smart Radius"
4043
4094
  ] }),
4044
- /* @__PURE__ */ jsxs20("label", { className: "flex items-center gap-2 text-foreground", title: "Refine only where the edge has no image edge under it", children: [
4045
- /* @__PURE__ */ jsx22("input", { type: "checkbox", "aria-label": "Only uncertain areas", checked: onlyUncertain, onChange: (e) => setOnlyUncertain(e.target.checked) }),
4095
+ /* @__PURE__ */ jsxs21("label", { className: "flex items-center gap-2 text-foreground", title: "Refine only where the edge has no image edge under it", children: [
4096
+ /* @__PURE__ */ jsx23("input", { type: "checkbox", "aria-label": "Only uncertain areas", checked: onlyUncertain, onChange: (e) => setOnlyUncertain(e.target.checked) }),
4046
4097
  "Only uncertain areas"
4047
4098
  ] }),
4048
- canObject && /* @__PURE__ */ jsxs20("label", { className: "flex items-center gap-2 text-foreground", children: [
4049
- /* @__PURE__ */ jsx22("input", { type: "checkbox", "aria-label": "Object aware", checked: objectAware, onChange: (e) => setObjectAware(e.target.checked) }),
4099
+ canObject && /* @__PURE__ */ jsxs21("label", { className: "flex items-center gap-2 text-foreground", children: [
4100
+ /* @__PURE__ */ jsx23("input", { type: "checkbox", "aria-label": "Object aware", checked: objectAware, onChange: (e) => setObjectAware(e.target.checked) }),
4050
4101
  "Object aware (segmentation model)"
4051
4102
  ] }),
4052
- /* @__PURE__ */ jsxs20("label", { className: "flex items-center gap-2 text-muted-foreground", children: [
4103
+ /* @__PURE__ */ jsxs21("label", { className: "flex items-center gap-2 text-muted-foreground", children: [
4053
4104
  "Output to",
4054
- /* @__PURE__ */ jsx22(
4105
+ /* @__PURE__ */ jsx23(
4055
4106
  "select",
4056
4107
  {
4057
4108
  "aria-label": "Refine output",
4058
4109
  value: output,
4059
4110
  onChange: (e) => setOutput(e.target.value),
4060
4111
  className: "flex-1 bg-background border border-border rounded px-1 py-1 text-foreground",
4061
- children: REFINE_OUTPUTS2.filter((o) => !o.needsDocuments || controller.canOpenDocuments).map((o) => /* @__PURE__ */ jsx22("option", { value: o.id, children: o.label }, o.id))
4112
+ children: REFINE_OUTPUTS2.filter((o) => !o.needsDocuments || controller.canOpenDocuments).map((o) => /* @__PURE__ */ jsx23("option", { value: o.id, children: o.label }, o.id))
4062
4113
  }
4063
4114
  )
4064
4115
  ] }),
4065
- /* @__PURE__ */ jsxs20("label", { className: "flex flex-col gap-1", children: [
4066
- /* @__PURE__ */ jsxs20("span", { className: "flex justify-between text-muted-foreground", children: [
4067
- /* @__PURE__ */ jsxs20("span", { children: [
4116
+ /* @__PURE__ */ jsxs21("label", { className: "flex flex-col gap-1", children: [
4117
+ /* @__PURE__ */ jsxs21("span", { className: "flex justify-between text-muted-foreground", children: [
4118
+ /* @__PURE__ */ jsxs21("span", { children: [
4068
4119
  "Decontaminate colors",
4069
4120
  toLayer ? "" : " (new layer or document outputs)"
4070
4121
  ] }),
4071
- /* @__PURE__ */ jsxs20("span", { className: "font-mono", children: [
4122
+ /* @__PURE__ */ jsxs21("span", { className: "font-mono", children: [
4072
4123
  decontaminate,
4073
4124
  "%"
4074
4125
  ] })
4075
4126
  ] }),
4076
- /* @__PURE__ */ jsx22(
4127
+ /* @__PURE__ */ jsx23(
4077
4128
  "input",
4078
4129
  {
4079
4130
  type: "range",
@@ -4088,27 +4139,27 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
4088
4139
  }
4089
4140
  )
4090
4141
  ] }),
4091
- /* @__PURE__ */ jsxs20("div", { className: "flex gap-1", children: [
4092
- /* @__PURE__ */ jsx22("button", { type: "button", className: button6, disabled: !sel || busy, onClick: refine, children: "Refine Edge" }),
4093
- /* @__PURE__ */ jsx22("button", { type: "button", className: button6, onClick: () => setParams(DEFAULT_PARAMS), children: "Reset" })
4142
+ /* @__PURE__ */ jsxs21("div", { className: "flex gap-1", children: [
4143
+ /* @__PURE__ */ jsx23("button", { type: "button", className: button6, disabled: !sel || busy, onClick: refine, children: "Refine Edge" }),
4144
+ /* @__PURE__ */ jsx23("button", { type: "button", className: button6, onClick: () => setParams(DEFAULT_PARAMS), children: "Reset" })
4094
4145
  ] }),
4095
- error && /* @__PURE__ */ jsx22("p", { role: "alert", className: "text-destructive", children: error }),
4096
- /* @__PURE__ */ jsx22(MaskEdgeCheck, { controller, selection: sel }),
4097
- /* @__PURE__ */ jsx22(SelectionChangeCheck, { controller, selection: sel }),
4098
- /* @__PURE__ */ jsx22(SeparateSubjectPanel, { controller, selection: sel, className: "mt-2" }),
4099
- /* @__PURE__ */ jsx22("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] mt-2", children: "Layer Mask" }),
4100
- /* @__PURE__ */ jsxs20("div", { className: "flex gap-1 items-center", children: [
4101
- /* @__PURE__ */ jsx22(
4146
+ error && /* @__PURE__ */ jsx23("p", { role: "alert", className: "text-destructive", children: error }),
4147
+ /* @__PURE__ */ jsx23(MaskEdgeCheck, { controller, selection: sel }),
4148
+ /* @__PURE__ */ jsx23(SelectionChangeCheck, { controller, selection: sel }),
4149
+ /* @__PURE__ */ jsx23(SeparateSubjectPanel, { controller, selection: sel, className: "mt-2" }),
4150
+ /* @__PURE__ */ jsx23("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] mt-2", children: "Layer Mask" }),
4151
+ /* @__PURE__ */ jsxs21("div", { className: "flex gap-1 items-center", children: [
4152
+ /* @__PURE__ */ jsx23(
4102
4153
  "select",
4103
4154
  {
4104
4155
  "aria-label": "New masked layer kind",
4105
4156
  value: newKind,
4106
4157
  onChange: (e) => setNewKind(e.target.value),
4107
4158
  className: "flex-1 bg-background border border-border rounded px-1 py-1 text-foreground",
4108
- children: ADJUSTMENT_KINDS2.map((k) => /* @__PURE__ */ jsx22("option", { value: k.kind, children: k.label }, k.kind))
4159
+ children: ADJUSTMENT_KINDS2.map((k) => /* @__PURE__ */ jsx23("option", { value: k.kind, children: k.label }, k.kind))
4109
4160
  }
4110
4161
  ),
4111
- /* @__PURE__ */ jsx22(
4162
+ /* @__PURE__ */ jsx23(
4112
4163
  "button",
4113
4164
  {
4114
4165
  type: "button",
@@ -4119,35 +4170,35 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
4119
4170
  }
4120
4171
  )
4121
4172
  ] }),
4122
- list.length > 0 && target && /* @__PURE__ */ jsxs20("div", { className: "flex flex-col gap-2", children: [
4123
- /* @__PURE__ */ jsx22(
4173
+ list.length > 0 && target && /* @__PURE__ */ jsxs21("div", { className: "flex flex-col gap-2", children: [
4174
+ /* @__PURE__ */ jsx23(
4124
4175
  "select",
4125
4176
  {
4126
4177
  "aria-label": "Mask layer",
4127
4178
  value: target.id,
4128
4179
  onChange: (e) => setLayerId(e.target.value),
4129
4180
  className: "bg-background border border-border rounded px-1 py-1 text-foreground",
4130
- children: list.map((l) => /* @__PURE__ */ jsxs20("option", { value: l.id, children: [
4181
+ children: list.map((l) => /* @__PURE__ */ jsxs21("option", { value: l.id, children: [
4131
4182
  l.name || adjustmentKindLabel2(l.kind),
4132
4183
  l.mask ? " (masked)" : ""
4133
4184
  ] }, l.id))
4134
4185
  }
4135
4186
  ),
4136
- /* @__PURE__ */ jsxs20("div", { className: "flex flex-wrap gap-1", children: [
4137
- /* @__PURE__ */ jsx22("button", { type: "button", className: button6, disabled: !sel, onClick: () => controller.applySelectionAsLayerMask(target.id), children: "Mask with Selection" }),
4138
- /* @__PURE__ */ jsx22("button", { type: "button", className: button6, disabled: !target.mask, onClick: () => controller.selectionFromLayerMask(target.id), children: "Load as Selection" }),
4139
- /* @__PURE__ */ jsx22("button", { type: "button", className: button6, disabled: !target.mask, onClick: () => controller.setAdjustmentLayerMask(target.id, null), children: "Remove Mask" })
4187
+ /* @__PURE__ */ jsxs21("div", { className: "flex flex-wrap gap-1", children: [
4188
+ /* @__PURE__ */ jsx23("button", { type: "button", className: button6, disabled: !sel, onClick: () => controller.applySelectionAsLayerMask(target.id), children: "Mask with Selection" }),
4189
+ /* @__PURE__ */ jsx23("button", { type: "button", className: button6, disabled: !target.mask, onClick: () => controller.selectionFromLayerMask(target.id), children: "Load as Selection" }),
4190
+ /* @__PURE__ */ jsx23("button", { type: "button", className: button6, disabled: !target.mask, onClick: () => controller.setAdjustmentLayerMask(target.id, null), children: "Remove Mask" })
4140
4191
  ] }),
4141
- target.mask && /* @__PURE__ */ jsxs20(Fragment6, { children: [
4142
- /* @__PURE__ */ jsxs20("label", { className: "flex flex-col gap-1", children: [
4143
- /* @__PURE__ */ jsxs20("span", { className: "flex justify-between text-muted-foreground", children: [
4144
- /* @__PURE__ */ jsx22("span", { children: "Density" }),
4145
- /* @__PURE__ */ jsxs20("span", { className: "font-mono", children: [
4192
+ target.mask && /* @__PURE__ */ jsxs21(Fragment7, { children: [
4193
+ /* @__PURE__ */ jsxs21("label", { className: "flex flex-col gap-1", children: [
4194
+ /* @__PURE__ */ jsxs21("span", { className: "flex justify-between text-muted-foreground", children: [
4195
+ /* @__PURE__ */ jsx23("span", { children: "Density" }),
4196
+ /* @__PURE__ */ jsxs21("span", { className: "font-mono", children: [
4146
4197
  Math.round((target.mask.density ?? 1) * 100),
4147
4198
  "%"
4148
4199
  ] })
4149
4200
  ] }),
4150
- /* @__PURE__ */ jsx22(
4201
+ /* @__PURE__ */ jsx23(
4151
4202
  "input",
4152
4203
  {
4153
4204
  type: "range",
@@ -4161,15 +4212,15 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
4161
4212
  }
4162
4213
  )
4163
4214
  ] }),
4164
- /* @__PURE__ */ jsxs20("label", { className: "flex flex-col gap-1", children: [
4165
- /* @__PURE__ */ jsxs20("span", { className: "flex justify-between text-muted-foreground", children: [
4166
- /* @__PURE__ */ jsx22("span", { children: "Mask Feather" }),
4167
- /* @__PURE__ */ jsxs20("span", { className: "font-mono", children: [
4215
+ /* @__PURE__ */ jsxs21("label", { className: "flex flex-col gap-1", children: [
4216
+ /* @__PURE__ */ jsxs21("span", { className: "flex justify-between text-muted-foreground", children: [
4217
+ /* @__PURE__ */ jsx23("span", { children: "Mask Feather" }),
4218
+ /* @__PURE__ */ jsxs21("span", { className: "font-mono", children: [
4168
4219
  target.mask.feather ?? 0,
4169
4220
  "px"
4170
4221
  ] })
4171
4222
  ] }),
4172
- /* @__PURE__ */ jsx22(
4223
+ /* @__PURE__ */ jsx23(
4173
4224
  "input",
4174
4225
  {
4175
4226
  type: "range",
@@ -4189,9 +4240,9 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
4189
4240
  };
4190
4241
 
4191
4242
  // src/image-editor/ChannelsPanel.tsx
4192
- import { useEffect as useEffect12, useRef as useRef12, useState as useState19 } from "react";
4243
+ import { useEffect as useEffect12, useRef as useRef12, useState as useState20 } from "react";
4193
4244
  import { MASK_FILE_ACCEPT, channelThumbnail, downloadMaskImage, openMaskFile, selectionModeFromModifiers } from "@pixerate/editor/image-editor";
4194
- import { jsx as jsx23, jsxs as jsxs21 } from "react/jsx-runtime";
4245
+ import { jsx as jsx24, jsxs as jsxs22 } from "react/jsx-runtime";
4195
4246
  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"}`;
4196
4247
  var ChannelThumb = ({ channel, size }) => {
4197
4248
  const ref = useRef12(null);
@@ -4206,14 +4257,14 @@ var ChannelThumb = ({ channel, size }) => {
4206
4257
  img.data.set(px.data);
4207
4258
  ctx.putImageData(img, 0, 0);
4208
4259
  }, [channel.mask]);
4209
- return /* @__PURE__ */ jsx23("canvas", { ref, "aria-hidden": "true", style: { width: size, height: size }, className: "shrink-0 rounded object-contain ring-1 ring-border bg-black" });
4260
+ return /* @__PURE__ */ jsx24("canvas", { ref, "aria-hidden": "true", style: { width: size, height: size }, className: "shrink-0 rounded object-contain ring-1 ring-border bg-black" });
4210
4261
  };
4211
4262
  var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
4212
- const [, setTick] = useState19(0);
4263
+ const [, setTick] = useState20(0);
4213
4264
  useEffect12(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
4214
- const [activeId, setActiveId] = useState19(null);
4215
- const [renaming, setRenaming] = useState19(null);
4216
- const [error, setError] = useState19(null);
4265
+ const [activeId, setActiveId] = useState20(null);
4266
+ const [renaming, setRenaming] = useState20(null);
4267
+ const [error, setError] = useState20(null);
4217
4268
  const fileInput = useRef12(null);
4218
4269
  const channels = controller.getChannels();
4219
4270
  const active = channels.find((c) => c.id === activeId) ?? null;
@@ -4236,13 +4287,13 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
4236
4287
  setError(err instanceof Error ? err.message : String(err));
4237
4288
  }
4238
4289
  };
4239
- return /* @__PURE__ */ jsxs21("div", { "data-testid": "channels-panel", className: `flex flex-col gap-2 text-xs ${className}`, children: [
4240
- /* @__PURE__ */ jsxs21("div", { className: "flex items-center justify-between", children: [
4241
- /* @__PURE__ */ jsx23("span", { className: imageSectionTitleClass, children: "Channels" }),
4242
- /* @__PURE__ */ jsx23("button", { type: "button", "aria-pressed": quickMask, className: btn2(quickMask), title: "Paint the selection: white selects, black deselects (Q)", onClick: () => controller.setQuickMaskMode(!quickMask), children: "Quick Mask" })
4290
+ return /* @__PURE__ */ jsxs22("div", { "data-testid": "channels-panel", className: `flex flex-col gap-2 text-xs ${className}`, children: [
4291
+ /* @__PURE__ */ jsxs22("div", { className: "flex items-center justify-between", children: [
4292
+ /* @__PURE__ */ jsx24("span", { className: imageSectionTitleClass, children: "Channels" }),
4293
+ /* @__PURE__ */ jsx24("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" })
4243
4294
  ] }),
4244
- channels.length === 0 && /* @__PURE__ */ jsx23("p", { className: "text-muted-foreground", children: "No channels. Save a selection to keep it." }),
4245
- /* @__PURE__ */ jsx23("ul", { role: "list", className: "flex flex-col gap-0.5", children: channels.map((c) => /* @__PURE__ */ jsxs21(
4295
+ channels.length === 0 && /* @__PURE__ */ jsx24("p", { className: "text-muted-foreground", children: "No channels. Save a selection to keep it." }),
4296
+ /* @__PURE__ */ jsx24("ul", { role: "list", className: "flex flex-col gap-0.5", children: channels.map((c) => /* @__PURE__ */ jsxs22(
4246
4297
  "li",
4247
4298
  {
4248
4299
  "data-testid": "channel-row",
@@ -4254,7 +4305,7 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
4254
4305
  },
4255
4306
  onDoubleClick: () => setRenaming(c.id),
4256
4307
  children: [
4257
- /* @__PURE__ */ jsx23(
4308
+ /* @__PURE__ */ jsx24(
4258
4309
  "button",
4259
4310
  {
4260
4311
  type: "button",
@@ -4268,8 +4319,8 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
4268
4319
  children: c.visible ? "\u25CF" : "\u25CB"
4269
4320
  }
4270
4321
  ),
4271
- /* @__PURE__ */ jsx23(ChannelThumb, { channel: c, size: thumbnailSize }),
4272
- renaming === c.id ? /* @__PURE__ */ jsx23(
4322
+ /* @__PURE__ */ jsx24(ChannelThumb, { channel: c, size: thumbnailSize }),
4323
+ renaming === c.id ? /* @__PURE__ */ jsx24(
4273
4324
  "input",
4274
4325
  {
4275
4326
  autoFocus: true,
@@ -4286,16 +4337,16 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
4286
4337
  if (e.key === "Escape") setRenaming(null);
4287
4338
  }
4288
4339
  }
4289
- ) : /* @__PURE__ */ jsx23("span", { className: "min-w-0 flex-1 truncate", children: c.name })
4340
+ ) : /* @__PURE__ */ jsx24("span", { className: "min-w-0 flex-1 truncate", children: c.name })
4290
4341
  ]
4291
4342
  },
4292
4343
  c.id
4293
4344
  )) }),
4294
- /* @__PURE__ */ jsxs21("div", { className: "flex flex-wrap gap-1", children: [
4295
- /* @__PURE__ */ jsx23("button", { type: "button", className: btn2(), disabled: !hasSelection, onClick: () => attempt(() => setActiveId(controller.saveSelection().id)), children: "Save Selection" }),
4296
- /* @__PURE__ */ jsx23("button", { type: "button", className: btn2(), disabled: !active || !hasSelection, title: "Add the selection to the channel", onClick: () => attempt(() => controller.saveSelection({ channelId: active.id, mode: "add" })), children: "Add to Channel" }),
4297
- /* @__PURE__ */ jsx23("button", { type: "button", className: btn2(), disabled: !active, onClick: () => attempt(() => setActiveId(controller.duplicateChannel(active.id).id)), children: "Duplicate" }),
4298
- /* @__PURE__ */ jsx23(
4345
+ /* @__PURE__ */ jsxs22("div", { className: "flex flex-wrap gap-1", children: [
4346
+ /* @__PURE__ */ jsx24("button", { type: "button", className: btn2(), disabled: !hasSelection, onClick: () => attempt(() => setActiveId(controller.saveSelection().id)), children: "Save Selection" }),
4347
+ /* @__PURE__ */ jsx24("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" }),
4348
+ /* @__PURE__ */ jsx24("button", { type: "button", className: btn2(), disabled: !active, onClick: () => attempt(() => setActiveId(controller.duplicateChannel(active.id).id)), children: "Duplicate" }),
4349
+ /* @__PURE__ */ jsx24(
4299
4350
  "button",
4300
4351
  {
4301
4352
  type: "button",
@@ -4308,8 +4359,8 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
4308
4359
  children: "Delete"
4309
4360
  }
4310
4361
  ),
4311
- /* @__PURE__ */ jsx23("button", { type: "button", className: btn2(), title: "Load a mask image (white = selected) into a new channel", onClick: () => fileInput.current?.click(), children: "Import\u2026" }),
4312
- /* @__PURE__ */ jsx23(
4362
+ /* @__PURE__ */ jsx24("button", { type: "button", className: btn2(), title: "Load a mask image (white = selected) into a new channel", onClick: () => fileInput.current?.click(), children: "Import\u2026" }),
4363
+ /* @__PURE__ */ jsx24(
4313
4364
  "button",
4314
4365
  {
4315
4366
  type: "button",
@@ -4320,7 +4371,7 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
4320
4371
  children: "Export PNG"
4321
4372
  }
4322
4373
  ),
4323
- /* @__PURE__ */ jsx23(
4374
+ /* @__PURE__ */ jsx24(
4324
4375
  "input",
4325
4376
  {
4326
4377
  ref: fileInput,
@@ -4335,22 +4386,22 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
4335
4386
  }
4336
4387
  )
4337
4388
  ] }),
4338
- error && /* @__PURE__ */ jsx23("p", { role: "alert", className: "text-destructive", children: error })
4389
+ error && /* @__PURE__ */ jsx24("p", { role: "alert", className: "text-destructive", children: error })
4339
4390
  ] });
4340
4391
  };
4341
4392
 
4342
4393
  // src/image-editor/PathsPanel.tsx
4343
- import { useEffect as useEffect13, useState as useState20 } from "react";
4394
+ import { useEffect as useEffect13, useState as useState21 } from "react";
4344
4395
  import { pathSvgData, selectionModeFromModifiers as selectionModeFromModifiers2 } from "@pixerate/editor/image-editor";
4345
- import { jsx as jsx24, jsxs as jsxs22 } from "react/jsx-runtime";
4396
+ import { jsx as jsx25, jsxs as jsxs23 } from "react/jsx-runtime";
4346
4397
  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"}`;
4347
4398
  var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
4348
- const [, setTick] = useState20(0);
4399
+ const [, setTick] = useState21(0);
4349
4400
  useEffect13(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
4350
- const [renaming, setRenaming] = useState20(null);
4351
- const [color, setColor] = useState20("#000000");
4352
- const [width, setWidth] = useState20(2);
4353
- const [error, setError] = useState20(null);
4401
+ const [renaming, setRenaming] = useState21(null);
4402
+ const [color, setColor] = useState21("#000000");
4403
+ const [width, setWidth] = useState21(2);
4404
+ const [error, setError] = useState21(null);
4354
4405
  const paths = controller.getPaths();
4355
4406
  const activeId = controller.getState().activePathId ?? null;
4356
4407
  const active = paths.find((p) => p.id === activeId) ?? null;
@@ -4366,10 +4417,10 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
4366
4417
  };
4367
4418
  return (
4368
4419
  // Clicking the panel's empty space deselects the path (the path tools then edit the active layer).
4369
- /* @__PURE__ */ jsxs22("div", { "data-testid": "paths-panel", className: `flex flex-col gap-2 text-xs ${className}`, onClick: (e) => e.target === e.currentTarget && attempt(() => controller.setActivePath(null)), children: [
4370
- /* @__PURE__ */ jsx24("span", { className: imageSectionTitleClass, children: "Paths" }),
4371
- paths.length === 0 && /* @__PURE__ */ jsx24("p", { className: "text-muted-foreground", children: "No paths. Make a work path from a selection." }),
4372
- /* @__PURE__ */ jsx24("ul", { role: "list", className: "flex flex-col gap-0.5 min-h-4", onClick: (e) => e.target === e.currentTarget && attempt(() => controller.setActivePath(null)), children: paths.map((p) => /* @__PURE__ */ jsxs22(
4420
+ /* @__PURE__ */ jsxs23("div", { "data-testid": "paths-panel", className: `flex flex-col gap-2 text-xs ${className}`, onClick: (e) => e.target === e.currentTarget && attempt(() => controller.setActivePath(null)), children: [
4421
+ /* @__PURE__ */ jsx25("span", { className: imageSectionTitleClass, children: "Paths" }),
4422
+ paths.length === 0 && /* @__PURE__ */ jsx25("p", { className: "text-muted-foreground", children: "No paths. Make a work path from a selection." }),
4423
+ /* @__PURE__ */ jsx25("ul", { role: "list", className: "flex flex-col gap-0.5 min-h-4", onClick: (e) => e.target === e.currentTarget && attempt(() => controller.setActivePath(null)), children: paths.map((p) => /* @__PURE__ */ jsxs23(
4373
4424
  "li",
4374
4425
  {
4375
4426
  "data-testid": "path-row",
@@ -4378,8 +4429,8 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
4378
4429
  onClick: () => attempt(() => controller.setActivePath(p.id)),
4379
4430
  onDoubleClick: () => setRenaming(p.id),
4380
4431
  children: [
4381
- /* @__PURE__ */ jsx24("svg", { "aria-hidden": "true", viewBox: `0 0 ${w || 1} ${h || 1}`, style: { width: thumbnailSize, height: thumbnailSize }, className: "shrink-0 rounded ring-1 ring-border bg-background", children: /* @__PURE__ */ jsx24("path", { d: pathSvgData(p), fill: "currentColor", fillOpacity: 0.25, stroke: "currentColor", strokeWidth: Math.max(w, h) / 64, fillRule: p.fillRule ?? "nonzero" }) }),
4382
- renaming === p.id ? /* @__PURE__ */ jsx24(
4432
+ /* @__PURE__ */ jsx25("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__ */ jsx25("path", { d: pathSvgData(p), fill: "currentColor", fillOpacity: 0.25, stroke: "currentColor", strokeWidth: Math.max(w, h) / 64, fillRule: p.fillRule ?? "nonzero" }) }),
4433
+ renaming === p.id ? /* @__PURE__ */ jsx25(
4383
4434
  "input",
4384
4435
  {
4385
4436
  autoFocus: true,
@@ -4398,13 +4449,13 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
4398
4449
  if (e.key === "Escape") setRenaming(null);
4399
4450
  }
4400
4451
  }
4401
- ) : /* @__PURE__ */ jsx24("span", { className: `min-w-0 flex-1 truncate ${p.work ? "italic" : ""}`, children: p.name })
4452
+ ) : /* @__PURE__ */ jsx25("span", { className: `min-w-0 flex-1 truncate ${p.work ? "italic" : ""}`, children: p.name })
4402
4453
  ]
4403
4454
  },
4404
4455
  p.id
4405
4456
  )) }),
4406
- /* @__PURE__ */ jsxs22("div", { className: "flex flex-wrap gap-1", children: [
4407
- /* @__PURE__ */ jsx24(
4457
+ /* @__PURE__ */ jsxs23("div", { className: "flex flex-wrap gap-1", children: [
4458
+ /* @__PURE__ */ jsx25(
4408
4459
  "button",
4409
4460
  {
4410
4461
  type: "button",
@@ -4415,15 +4466,15 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
4415
4466
  children: "Load as Selection"
4416
4467
  }
4417
4468
  ),
4418
- /* @__PURE__ */ jsx24("button", { type: "button", className: btn3(), disabled: !hasSelection, onClick: () => attempt(() => controller.makeWorkPath()), children: "Make Work Path" }),
4419
- active?.work && /* @__PURE__ */ jsx24("button", { type: "button", className: btn3(), onClick: () => setRenaming(active.id), children: "Save Path" }),
4420
- /* @__PURE__ */ jsx24("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.addVectorMaskFromPath(active.id)), children: "Add Vector Mask" })
4469
+ /* @__PURE__ */ jsx25("button", { type: "button", className: btn3(), disabled: !hasSelection, onClick: () => attempt(() => controller.makeWorkPath()), children: "Make Work Path" }),
4470
+ active?.work && /* @__PURE__ */ jsx25("button", { type: "button", className: btn3(), onClick: () => setRenaming(active.id), children: "Save Path" }),
4471
+ /* @__PURE__ */ jsx25("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.addVectorMaskFromPath(active.id)), children: "Add Vector Mask" })
4421
4472
  ] }),
4422
- /* @__PURE__ */ jsxs22("div", { className: "flex flex-wrap items-center gap-1", children: [
4423
- /* @__PURE__ */ jsx24("input", { type: "color", "aria-label": "Path paint colour", value: color, onChange: (e) => setColor(e.target.value), className: "h-6 w-8 bg-background border border-border rounded" }),
4424
- /* @__PURE__ */ jsx24("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.fillPath(active.id, { color })), children: "Fill Path" }),
4425
- /* @__PURE__ */ jsxs22("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
4426
- /* @__PURE__ */ jsx24(
4473
+ /* @__PURE__ */ jsxs23("div", { className: "flex flex-wrap items-center gap-1", children: [
4474
+ /* @__PURE__ */ jsx25("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" }),
4475
+ /* @__PURE__ */ jsx25("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.fillPath(active.id, { color })), children: "Fill Path" }),
4476
+ /* @__PURE__ */ jsxs23("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
4477
+ /* @__PURE__ */ jsx25(
4427
4478
  "input",
4428
4479
  {
4429
4480
  type: "number",
@@ -4438,24 +4489,24 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
4438
4489
  ),
4439
4490
  "px"
4440
4491
  ] }),
4441
- /* @__PURE__ */ jsx24("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.strokePath(active.id, { width, color })), children: "Stroke Path" })
4492
+ /* @__PURE__ */ jsx25("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.strokePath(active.id, { width, color })), children: "Stroke Path" })
4442
4493
  ] }),
4443
- /* @__PURE__ */ jsxs22("div", { className: "flex flex-wrap gap-1", children: [
4444
- /* @__PURE__ */ jsx24("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.duplicatePath(active.id)), children: "Duplicate" }),
4445
- /* @__PURE__ */ jsx24("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.deletePath(active.id)), children: "Delete" })
4494
+ /* @__PURE__ */ jsxs23("div", { className: "flex flex-wrap gap-1", children: [
4495
+ /* @__PURE__ */ jsx25("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.duplicatePath(active.id)), children: "Duplicate" }),
4496
+ /* @__PURE__ */ jsx25("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.deletePath(active.id)), children: "Delete" })
4446
4497
  ] }),
4447
- error && /* @__PURE__ */ jsx24("p", { role: "alert", className: "text-destructive", children: error })
4498
+ error && /* @__PURE__ */ jsx25("p", { role: "alert", className: "text-destructive", children: error })
4448
4499
  ] })
4449
4500
  );
4450
4501
  };
4451
4502
 
4452
4503
  // src/image-editor/FreeTransformOptionsBar.tsx
4453
- import { useEffect as useEffect14, useState as useState21 } from "react";
4504
+ import { useEffect as useEffect14, useState as useState22 } from "react";
4454
4505
  import { FREE_TRANSFORM_FIELDS, FREE_TRANSFORM_MODE_OPTIONS, INTERPOLATIONS, TRANSFORM_ANCHORS, WARP_GRID_OPTIONS, WARP_STYLE_OPTIONS } from "@pixerate/editor/image-editor";
4455
- import { jsx as jsx25, jsxs as jsxs23 } from "react/jsx-runtime";
4506
+ import { jsx as jsx26, jsxs as jsxs24 } from "react/jsx-runtime";
4456
4507
  var round = (v, unit) => unit === "px" ? Math.round(v * 10) / 10 : Math.round(v * 100) / 100;
4457
4508
  var FreeTransformOptionsBar = ({ tool, className }) => {
4458
- const [, setTick] = useState21(0);
4509
+ const [, setTick] = useState22(0);
4459
4510
  useEffect14(() => tool.subscribe(() => setTick((n) => n + 1)), [tool]);
4460
4511
  const bar = tool.bar();
4461
4512
  if (!tool.active || !bar) return null;
@@ -4468,17 +4519,17 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
4468
4519
  const v = Number(raw);
4469
4520
  if (raw.trim() !== "" && Number.isFinite(v) && Math.abs(v - bar[field]) > 1e-9) tool.setField(field, v);
4470
4521
  };
4471
- return /* @__PURE__ */ jsxs23("div", { className: `flex flex-wrap items-center gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "free-transform-options", role: "toolbar", "aria-label": "Free Transform options", children: [
4472
- /* @__PURE__ */ jsx25("div", { className: "flex gap-1", role: "group", "aria-label": "Transform mode", children: FREE_TRANSFORM_MODE_OPTIONS.map((m) => /* @__PURE__ */ jsx25("button", { type: "button", title: m.title, "aria-pressed": tool.mode === m.id, className: imageChipClass(tool.mode === m.id), onClick: () => tool.setMode(m.id), children: m.label }, m.id)) }),
4473
- /* @__PURE__ */ jsx25("div", { className: "grid grid-cols-3 gap-px", role: "group", "aria-label": "Reference point", children: TRANSFORM_ANCHORS.map((a) => /* @__PURE__ */ jsx25("button", { type: "button", "aria-label": `Reference point ${a}`, title: `Reference point: ${a}`, className: "h-2.5 w-2.5 rounded-sm bg-accent hover:bg-primary/90", onClick: () => tool.setReference(a) }, a)) }),
4474
- tool.mode === "warp" && /* @__PURE__ */ jsxs23("div", { className: "flex flex-wrap items-center gap-2", role: "group", "aria-label": "Warp options", children: [
4475
- /* @__PURE__ */ jsxs23("label", { className: "flex items-center gap-1", children: [
4476
- /* @__PURE__ */ jsx25("span", { className: "text-muted-foreground", children: "Warp" }),
4477
- /* @__PURE__ */ jsx25("select", { "aria-label": "Warp style", value: warp.style, onChange: (e) => tool.setWarp({ style: e.target.value }), className: imageFieldClass, children: WARP_STYLE_OPTIONS.map((o) => /* @__PURE__ */ jsx25("option", { value: o.id, children: o.label }, o.id)) })
4522
+ return /* @__PURE__ */ jsxs24("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: [
4523
+ /* @__PURE__ */ jsx26("div", { className: "flex gap-1", role: "group", "aria-label": "Transform mode", children: FREE_TRANSFORM_MODE_OPTIONS.map((m) => /* @__PURE__ */ jsx26("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)) }),
4524
+ /* @__PURE__ */ jsx26("div", { className: "grid grid-cols-3 gap-px", role: "group", "aria-label": "Reference point", children: TRANSFORM_ANCHORS.map((a) => /* @__PURE__ */ jsx26("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)) }),
4525
+ tool.mode === "warp" && /* @__PURE__ */ jsxs24("div", { className: "flex flex-wrap items-center gap-2", role: "group", "aria-label": "Warp options", children: [
4526
+ /* @__PURE__ */ jsxs24("label", { className: "flex items-center gap-1", children: [
4527
+ /* @__PURE__ */ jsx26("span", { className: "text-muted-foreground", children: "Warp" }),
4528
+ /* @__PURE__ */ jsx26("select", { "aria-label": "Warp style", value: warp.style, onChange: (e) => tool.setWarp({ style: e.target.value }), className: imageFieldClass, children: WARP_STYLE_OPTIONS.map((o) => /* @__PURE__ */ jsx26("option", { value: o.id, children: o.label }, o.id)) })
4478
4529
  ] }),
4479
- ["bend", "horizontal", "vertical"].map((k) => /* @__PURE__ */ jsxs23("label", { className: "flex items-center gap-1", children: [
4480
- /* @__PURE__ */ jsx25("span", { className: "text-muted-foreground", children: k === "bend" ? "Bend" : k === "horizontal" ? "H" : "V" }),
4481
- /* @__PURE__ */ jsx25(
4530
+ ["bend", "horizontal", "vertical"].map((k) => /* @__PURE__ */ jsxs24("label", { className: "flex items-center gap-1", children: [
4531
+ /* @__PURE__ */ jsx26("span", { className: "text-muted-foreground", children: k === "bend" ? "Bend" : k === "horizontal" ? "H" : "V" }),
4532
+ /* @__PURE__ */ jsx26(
4482
4533
  "input",
4483
4534
  {
4484
4535
  type: "number",
@@ -4499,9 +4550,9 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
4499
4550
  },
4500
4551
  `${k}:${warp[k]}`
4501
4552
  ),
4502
- /* @__PURE__ */ jsx25("span", { className: "text-muted-foreground", children: "%" })
4553
+ /* @__PURE__ */ jsx26("span", { className: "text-muted-foreground", children: "%" })
4503
4554
  ] }, k)),
4504
- /* @__PURE__ */ jsx25(
4555
+ /* @__PURE__ */ jsx26(
4505
4556
  "button",
4506
4557
  {
4507
4558
  type: "button",
@@ -4513,9 +4564,9 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
4513
4564
  children: "Vertical"
4514
4565
  }
4515
4566
  ),
4516
- /* @__PURE__ */ jsxs23("label", { className: "flex items-center gap-1", children: [
4517
- /* @__PURE__ */ jsx25("span", { className: "text-muted-foreground", children: "Grid" }),
4518
- /* @__PURE__ */ jsx25(
4567
+ /* @__PURE__ */ jsxs24("label", { className: "flex items-center gap-1", children: [
4568
+ /* @__PURE__ */ jsx26("span", { className: "text-muted-foreground", children: "Grid" }),
4569
+ /* @__PURE__ */ jsx26(
4519
4570
  "select",
4520
4571
  {
4521
4572
  "aria-label": "Warp grid",
@@ -4525,14 +4576,14 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
4525
4576
  tool.setWarp({ columns: g.columns, rows: g.rows });
4526
4577
  },
4527
4578
  className: imageFieldClass,
4528
- children: WARP_GRID_OPTIONS.map((g) => /* @__PURE__ */ jsx25("option", { value: g.id, children: g.label }, g.id))
4579
+ children: WARP_GRID_OPTIONS.map((g) => /* @__PURE__ */ jsx26("option", { value: g.id, children: g.label }, g.id))
4529
4580
  }
4530
4581
  )
4531
4582
  ] })
4532
4583
  ] }),
4533
- tool.mode !== "warp" && FREE_TRANSFORM_FIELDS.map((f) => /* @__PURE__ */ jsxs23("label", { className: "flex items-center gap-1", title: f.title, children: [
4534
- /* @__PURE__ */ jsx25("span", { className: "text-muted-foreground", children: f.label }),
4535
- /* @__PURE__ */ jsx25(
4584
+ tool.mode !== "warp" && FREE_TRANSFORM_FIELDS.map((f) => /* @__PURE__ */ jsxs24("label", { className: "flex items-center gap-1", title: f.title, children: [
4585
+ /* @__PURE__ */ jsx26("span", { className: "text-muted-foreground", children: f.label }),
4586
+ /* @__PURE__ */ jsx26(
4536
4587
  "input",
4537
4588
  {
4538
4589
  type: "number",
@@ -4552,8 +4603,8 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
4552
4603
  },
4553
4604
  `${f.id}:${round(bar[f.id], f.unit)}`
4554
4605
  ),
4555
- /* @__PURE__ */ jsx25("span", { className: "text-muted-foreground", children: f.unit }),
4556
- f.id === "scaleX" && /* @__PURE__ */ jsx25(
4606
+ /* @__PURE__ */ jsx26("span", { className: "text-muted-foreground", children: f.unit }),
4607
+ f.id === "scaleX" && /* @__PURE__ */ jsx26(
4557
4608
  "button",
4558
4609
  {
4559
4610
  type: "button",
@@ -4568,33 +4619,33 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
4568
4619
  }
4569
4620
  )
4570
4621
  ] }, f.id)),
4571
- /* @__PURE__ */ jsxs23("label", { className: "flex items-center gap-1", children: [
4572
- /* @__PURE__ */ jsx25("span", { className: "text-muted-foreground", children: "Interpolation" }),
4573
- /* @__PURE__ */ jsx25(
4622
+ /* @__PURE__ */ jsxs24("label", { className: "flex items-center gap-1", children: [
4623
+ /* @__PURE__ */ jsx26("span", { className: "text-muted-foreground", children: "Interpolation" }),
4624
+ /* @__PURE__ */ jsx26(
4574
4625
  "select",
4575
4626
  {
4576
4627
  "aria-label": "Interpolation",
4577
4628
  value: tool.interpolation,
4578
4629
  onChange: (e) => tool.setInterpolation(e.target.value),
4579
4630
  className: imageFieldClass,
4580
- children: INTERPOLATIONS.map((i) => /* @__PURE__ */ jsx25("option", { value: i, children: i[0].toUpperCase() + i.slice(1) }, i))
4631
+ children: INTERPOLATIONS.map((i) => /* @__PURE__ */ jsx26("option", { value: i, children: i[0].toUpperCase() + i.slice(1) }, i))
4581
4632
  }
4582
4633
  )
4583
4634
  ] }),
4584
- /* @__PURE__ */ jsx25("button", { type: "button", title: "Commit (Enter)", className: "px-2 py-1 rounded bg-primary text-primary-foreground hover:bg-primary/90", onClick: () => tool.commit(), children: "Commit" }),
4585
- /* @__PURE__ */ jsx25("button", { type: "button", title: "Cancel (Esc)", className: imageChipClass(false), onClick: () => tool.cancel(), children: "Cancel" }),
4586
- tool.error && /* @__PURE__ */ jsx25("span", { role: "alert", className: "text-destructive", children: tool.error })
4635
+ /* @__PURE__ */ jsx26("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" }),
4636
+ /* @__PURE__ */ jsx26("button", { type: "button", title: "Cancel (Esc)", className: imageChipClass(false), onClick: () => tool.cancel(), children: "Cancel" }),
4637
+ tool.error && /* @__PURE__ */ jsx26("span", { role: "alert", className: "text-destructive", children: tool.error })
4587
4638
  ] });
4588
4639
  };
4589
4640
 
4590
4641
  // src/image-editor/ShapeOptionsBar.tsx
4591
- import { useEffect as useEffect15, useState as useState22 } from "react";
4642
+ import { useEffect as useEffect15, useState as useState23 } from "react";
4592
4643
  import { LIVE_SHAPE_KINDS, SHAPE_KIND_LABELS, applyShapeOptions } from "@pixerate/editor/image-editor";
4593
- import { Fragment as Fragment7, jsx as jsx26, jsxs as jsxs24 } from "react/jsx-runtime";
4644
+ import { Fragment as Fragment8, jsx as jsx27, jsxs as jsxs25 } from "react/jsx-runtime";
4594
4645
  var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
4595
- const [, setTick] = useState22(0);
4646
+ const [, setTick] = useState23(0);
4596
4647
  useEffect15(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
4597
- const [error, setError] = useState22(null);
4648
+ const [error, setError] = useState23(null);
4598
4649
  const active = controller.getActiveLayer();
4599
4650
  const shapeId = active?.type === "shape" ? active.id : null;
4600
4651
  const set = (change) => {
@@ -4608,22 +4659,22 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
4608
4659
  }
4609
4660
  };
4610
4661
  const num = (v, min, max) => Math.max(min, Math.min(max, Number(v) || min));
4611
- return /* @__PURE__ */ jsxs24("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "shape-options", children: [
4612
- /* @__PURE__ */ jsx26("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Shape kind", children: LIVE_SHAPE_KINDS.map((k) => /* @__PURE__ */ jsx26("button", { type: "button", "aria-pressed": options.kind === k, className: imageChipClass(options.kind === k), onClick: () => onChange({ ...options, kind: k }), children: SHAPE_KIND_LABELS[k] }, k)) }),
4613
- /* @__PURE__ */ jsxs24("div", { className: "flex flex-wrap items-center gap-3", children: [
4614
- /* @__PURE__ */ jsxs24("label", { className: "flex items-center gap-1", children: [
4615
- /* @__PURE__ */ jsx26(ImageCheckbox, { label: "Fill", checked: options.fill !== null, onChange: (on) => set({ fill: on ? "#4f46e5" : null }) }),
4662
+ return /* @__PURE__ */ jsxs25("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "shape-options", children: [
4663
+ /* @__PURE__ */ jsx27("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Shape kind", children: LIVE_SHAPE_KINDS.map((k) => /* @__PURE__ */ jsx27("button", { type: "button", "aria-pressed": options.kind === k, className: imageChipClass(options.kind === k), onClick: () => onChange({ ...options, kind: k }), children: SHAPE_KIND_LABELS[k] }, k)) }),
4664
+ /* @__PURE__ */ jsxs25("div", { className: "flex flex-wrap items-center gap-3", children: [
4665
+ /* @__PURE__ */ jsxs25("label", { className: "flex items-center gap-1", children: [
4666
+ /* @__PURE__ */ jsx27(ImageCheckbox, { label: "Fill", checked: options.fill !== null, onChange: (on) => set({ fill: on ? "#4f46e5" : null }) }),
4616
4667
  "Fill",
4617
- /* @__PURE__ */ jsx26(ImageColor, { label: "Fill colour", disabled: options.fill === null, value: options.fill ?? "#4f46e5", onChange: (fill) => set({ fill }) })
4668
+ /* @__PURE__ */ jsx27(ImageColor, { label: "Fill colour", disabled: options.fill === null, value: options.fill ?? "#4f46e5", onChange: (fill) => set({ fill }) })
4618
4669
  ] }),
4619
- /* @__PURE__ */ jsxs24("label", { className: "flex items-center gap-1", children: [
4620
- /* @__PURE__ */ jsx26(ImageCheckbox, { label: "Stroke", checked: options.stroke !== null, onChange: (on) => set({ stroke: on ? "#000000" : null }) }),
4670
+ /* @__PURE__ */ jsxs25("label", { className: "flex items-center gap-1", children: [
4671
+ /* @__PURE__ */ jsx27(ImageCheckbox, { label: "Stroke", checked: options.stroke !== null, onChange: (on) => set({ stroke: on ? "#000000" : null }) }),
4621
4672
  "Stroke",
4622
- /* @__PURE__ */ jsx26(ImageColor, { label: "Stroke colour", disabled: options.stroke === null, value: options.stroke ?? "#000000", onChange: (stroke) => set({ stroke }) })
4673
+ /* @__PURE__ */ jsx27(ImageColor, { label: "Stroke colour", disabled: options.stroke === null, value: options.stroke ?? "#000000", onChange: (stroke) => set({ stroke }) })
4623
4674
  ] }),
4624
- /* @__PURE__ */ jsxs24("label", { className: "flex items-center gap-1", children: [
4675
+ /* @__PURE__ */ jsxs25("label", { className: "flex items-center gap-1", children: [
4625
4676
  "Width",
4626
- /* @__PURE__ */ jsx26(
4677
+ /* @__PURE__ */ jsx27(
4627
4678
  "input",
4628
4679
  {
4629
4680
  type: "number",
@@ -4637,52 +4688,52 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
4637
4688
  )
4638
4689
  ] })
4639
4690
  ] }),
4640
- /* @__PURE__ */ jsxs24("div", { className: "flex flex-wrap items-center gap-3", children: [
4641
- options.kind === "rect" && /* @__PURE__ */ jsxs24("label", { className: "flex items-center gap-1", children: [
4691
+ /* @__PURE__ */ jsxs25("div", { className: "flex flex-wrap items-center gap-3", children: [
4692
+ options.kind === "rect" && /* @__PURE__ */ jsxs25("label", { className: "flex items-center gap-1", children: [
4642
4693
  "Radius",
4643
- /* @__PURE__ */ jsx26("input", { type: "number", "aria-label": "Corner radius", min: 0, max: 1e3, value: options.radius, onChange: (e) => set({ radius: num(e.target.value, 0, 1e3) }), className: `w-14 ${imageFieldClass}` })
4694
+ /* @__PURE__ */ jsx27("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}` })
4644
4695
  ] }),
4645
- options.kind === "polygon" && /* @__PURE__ */ jsxs24("label", { className: "flex items-center gap-1", children: [
4696
+ options.kind === "polygon" && /* @__PURE__ */ jsxs25("label", { className: "flex items-center gap-1", children: [
4646
4697
  "Sides",
4647
- /* @__PURE__ */ jsx26("input", { type: "number", "aria-label": "Sides", min: 3, max: 100, value: options.sides, onChange: (e) => set({ sides: num(e.target.value, 3, 100) }), className: `w-14 ${imageFieldClass}` })
4698
+ /* @__PURE__ */ jsx27("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}` })
4648
4699
  ] }),
4649
- options.kind === "star" && /* @__PURE__ */ jsxs24(Fragment7, { children: [
4650
- /* @__PURE__ */ jsxs24("label", { className: "flex items-center gap-1", children: [
4700
+ options.kind === "star" && /* @__PURE__ */ jsxs25(Fragment8, { children: [
4701
+ /* @__PURE__ */ jsxs25("label", { className: "flex items-center gap-1", children: [
4651
4702
  "Points",
4652
- /* @__PURE__ */ jsx26("input", { type: "number", "aria-label": "Points", min: 3, max: 100, value: options.points, onChange: (e) => set({ points: num(e.target.value, 3, 100) }), className: `w-14 ${imageFieldClass}` })
4703
+ /* @__PURE__ */ jsx27("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}` })
4653
4704
  ] }),
4654
- /* @__PURE__ */ jsxs24("label", { className: "flex items-center gap-1", children: [
4705
+ /* @__PURE__ */ jsxs25("label", { className: "flex items-center gap-1", children: [
4655
4706
  "Inner",
4656
- /* @__PURE__ */ jsx26(ImageRange, { label: "Inner radius", min: 0.05, max: 1, step: 0.05, value: options.innerRatio, onChange: (v) => set({ innerRatio: v }) })
4707
+ /* @__PURE__ */ jsx27(ImageRange, { label: "Inner radius", min: 0.05, max: 1, step: 0.05, value: options.innerRatio, onChange: (v) => set({ innerRatio: v }) })
4657
4708
  ] })
4658
4709
  ] }),
4659
- options.kind === "line" && /* @__PURE__ */ jsxs24(Fragment7, { children: [
4660
- /* @__PURE__ */ jsxs24("label", { className: "flex items-center gap-1", children: [
4710
+ options.kind === "line" && /* @__PURE__ */ jsxs25(Fragment8, { children: [
4711
+ /* @__PURE__ */ jsxs25("label", { className: "flex items-center gap-1", children: [
4661
4712
  "Weight",
4662
- /* @__PURE__ */ jsx26("input", { type: "number", "aria-label": "Line weight", min: 1, max: 200, value: options.weight, onChange: (e) => set({ weight: num(e.target.value, 1, 200) }), className: `w-14 ${imageFieldClass}` })
4713
+ /* @__PURE__ */ jsx27("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}` })
4663
4714
  ] }),
4664
- /* @__PURE__ */ jsxs24("label", { className: "flex items-center gap-1", children: [
4665
- /* @__PURE__ */ jsx26(ImageCheckbox, { label: "Arrowhead", checked: options.arrow, onChange: (on) => set({ arrow: on }) }),
4715
+ /* @__PURE__ */ jsxs25("label", { className: "flex items-center gap-1", children: [
4716
+ /* @__PURE__ */ jsx27(ImageCheckbox, { label: "Arrowhead", checked: options.arrow, onChange: (on) => set({ arrow: on }) }),
4666
4717
  "Arrowhead"
4667
4718
  ] })
4668
4719
  ] })
4669
4720
  ] }),
4670
- /* @__PURE__ */ jsx26("p", { className: "text-[10px] text-muted-foreground", children: "Drag on the image to draw. Shift: square, circle or 45\xB0 line. Alt: from the centre." }),
4671
- error && /* @__PURE__ */ jsx26("p", { role: "alert", className: "text-destructive", children: error })
4721
+ /* @__PURE__ */ jsx27("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." }),
4722
+ error && /* @__PURE__ */ jsx27("p", { role: "alert", className: "text-destructive", children: error })
4672
4723
  ] });
4673
4724
  };
4674
4725
 
4675
4726
  // src/image-editor/TypeOptionsBar.tsx
4676
- import { useEffect as useEffect16, useState as useState23 } from "react";
4727
+ import { useEffect as useEffect16, useState as useState24 } from "react";
4677
4728
  import { TEXT_ALIGNS, TEXT_ORIENTATIONS } from "@pixerate/editor/image-editor";
4678
- import { jsx as jsx27, jsxs as jsxs25 } from "react/jsx-runtime";
4729
+ import { jsx as jsx28, jsxs as jsxs26 } from "react/jsx-runtime";
4679
4730
  var ALIGN_LABELS = { left: "Left", center: "Centre", right: "Right", justify: "Justify" };
4680
4731
  var ORIENTATION_LABELS = { horizontal: "Horizontal", vertical: "Vertical" };
4681
4732
  var TypeOptionsBar = ({ controller, options, onChange, session, className }) => {
4682
- const [, setTick] = useState23(0);
4733
+ const [, setTick] = useState24(0);
4683
4734
  useEffect16(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
4684
4735
  useEffect16(() => session?.subscribe(() => setTick((n) => n + 1)), [session]);
4685
- const [error, setError] = useState23(null);
4736
+ const [error, setError] = useState24(null);
4686
4737
  const active = controller.getActiveLayer();
4687
4738
  const typeId = !session && active?.type === "type" ? active.id : null;
4688
4739
  const here = session?.alive ? session.styleHere() : {};
@@ -4735,11 +4786,11 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
4735
4786
  setError(e instanceof Error ? e.message : String(e));
4736
4787
  }
4737
4788
  };
4738
- return /* @__PURE__ */ jsxs25("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "type-options", children: [
4739
- /* @__PURE__ */ jsxs25("div", { className: "flex flex-wrap items-center gap-2", children: [
4740
- /* @__PURE__ */ jsxs25("label", { className: "flex items-center gap-1", children: [
4789
+ return /* @__PURE__ */ jsxs26("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "type-options", children: [
4790
+ /* @__PURE__ */ jsxs26("div", { className: "flex flex-wrap items-center gap-2", children: [
4791
+ /* @__PURE__ */ jsxs26("label", { className: "flex items-center gap-1", children: [
4741
4792
  "Font",
4742
- /* @__PURE__ */ jsx27(
4793
+ /* @__PURE__ */ jsx28(
4743
4794
  "input",
4744
4795
  {
4745
4796
  list: "pixerate-type-fonts",
@@ -4749,11 +4800,11 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
4749
4800
  className: "w-32 rounded border border-border bg-background px-1 py-0.5"
4750
4801
  }
4751
4802
  ),
4752
- /* @__PURE__ */ jsx27("datalist", { id: "pixerate-type-fonts", children: fonts.map((f) => /* @__PURE__ */ jsx27("option", { value: f }, f)) })
4803
+ /* @__PURE__ */ jsx28("datalist", { id: "pixerate-type-fonts", children: fonts.map((f) => /* @__PURE__ */ jsx28("option", { value: f }, f)) })
4753
4804
  ] }),
4754
- /* @__PURE__ */ jsxs25("label", { className: "flex items-center gap-1", children: [
4805
+ /* @__PURE__ */ jsxs26("label", { className: "flex items-center gap-1", children: [
4755
4806
  "Size",
4756
- /* @__PURE__ */ jsx27(
4807
+ /* @__PURE__ */ jsx28(
4757
4808
  "input",
4758
4809
  {
4759
4810
  type: "number",
@@ -4766,14 +4817,14 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
4766
4817
  }
4767
4818
  )
4768
4819
  ] }),
4769
- /* @__PURE__ */ jsx27("button", { type: "button", "aria-pressed": shown.fontWeight >= 600, className: `${imageChipClass(shown.fontWeight >= 600)} font-bold`, onClick: () => style({ fontWeight: shown.fontWeight >= 600 ? 400 : 700 }), children: "B" }),
4770
- /* @__PURE__ */ jsx27("button", { type: "button", "aria-pressed": shown.italic, className: `${imageChipClass(shown.italic)} italic`, onClick: () => style({ italic: !shown.italic }), children: "I" }),
4771
- /* @__PURE__ */ jsx27(ImageColor, { label: "Text colour", value: shown.color, onChange: (color) => style({ color }) })
4820
+ /* @__PURE__ */ jsx28("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" }),
4821
+ /* @__PURE__ */ jsx28("button", { type: "button", "aria-pressed": shown.italic, className: `${imageChipClass(shown.italic)} italic`, onClick: () => style({ italic: !shown.italic }), children: "I" }),
4822
+ /* @__PURE__ */ jsx28(ImageColor, { label: "Text colour", value: shown.color, onChange: (color) => style({ color }) })
4772
4823
  ] }),
4773
- /* @__PURE__ */ jsx27("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Alignment", children: TEXT_ALIGNS.map((a) => /* @__PURE__ */ jsx27("button", { type: "button", "aria-pressed": options.align === a, className: imageChipClass(options.align === a), onClick: () => style({ align: a }), children: ALIGN_LABELS[a] }, a)) }),
4774
- /* @__PURE__ */ jsxs25("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Orientation", children: [
4775
- TEXT_ORIENTATIONS.map((o) => /* @__PURE__ */ jsx27("button", { type: "button", "aria-pressed": orientation === o, className: imageChipClass(orientation === o), onClick: () => orient(o), children: ORIENTATION_LABELS[o] }, o)),
4776
- orientation === "vertical" && editedId && /* @__PURE__ */ jsx27(
4824
+ /* @__PURE__ */ jsx28("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Alignment", children: TEXT_ALIGNS.map((a) => /* @__PURE__ */ jsx28("button", { type: "button", "aria-pressed": options.align === a, className: imageChipClass(options.align === a), onClick: () => style({ align: a }), children: ALIGN_LABELS[a] }, a)) }),
4825
+ /* @__PURE__ */ jsxs26("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Orientation", children: [
4826
+ TEXT_ORIENTATIONS.map((o) => /* @__PURE__ */ jsx28("button", { type: "button", "aria-pressed": orientation === o, className: imageChipClass(orientation === o), onClick: () => orient(o), children: ORIENTATION_LABELS[o] }, o)),
4827
+ orientation === "vertical" && editedId && /* @__PURE__ */ jsx28(
4777
4828
  "button",
4778
4829
  {
4779
4830
  type: "button",
@@ -4785,19 +4836,19 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
4785
4836
  }
4786
4837
  )
4787
4838
  ] }),
4788
- /* @__PURE__ */ jsx27("p", { className: "text-[10px] text-muted-foreground", children: "Click to type point text (vertical: a column down from the click), drag for a paragraph box, click text to edit it. Esc finishes." }),
4789
- missing.length > 0 && /* @__PURE__ */ jsxs25("p", { role: "status", className: "text-amber-600", "data-testid": "type-missing-fonts", children: [
4839
+ /* @__PURE__ */ jsx28("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." }),
4840
+ missing.length > 0 && /* @__PURE__ */ jsxs26("p", { role: "status", className: "text-amber-600", "data-testid": "type-missing-fonts", children: [
4790
4841
  "Missing ",
4791
4842
  missing.length === 1 ? "font" : "fonts",
4792
4843
  ": ",
4793
4844
  missing.join(", ")
4794
4845
  ] }),
4795
- error && /* @__PURE__ */ jsx27("p", { role: "alert", className: "text-destructive", children: error })
4846
+ error && /* @__PURE__ */ jsx28("p", { role: "alert", className: "text-destructive", children: error })
4796
4847
  ] });
4797
4848
  };
4798
4849
 
4799
4850
  // src/image-editor/ImageEditor.tsx
4800
- import { Fragment as Fragment8, jsx as jsx28, jsxs as jsxs26 } from "react/jsx-runtime";
4851
+ import { Fragment as Fragment9, jsx as jsx29, jsxs as jsxs27 } from "react/jsx-runtime";
4801
4852
  var ImageEditor = ({
4802
4853
  editor: externalEditor,
4803
4854
  src,
@@ -4822,7 +4873,7 @@ var ImageEditor = ({
4822
4873
  return l.type === "pixel" && !!l.generator || l.type === "smart" && !!l.smartFilters?.filters.some((f) => f.kind === "effect") || l.type === "group" && l.children.some(has);
4823
4874
  });
4824
4875
  const legacyProcess = normalizeProcessVersion(state.adjustments.process) < LATEST_PROCESS_VERSION;
4825
- const [activeTab, setActiveTab] = useState24("crop");
4876
+ const [activeTab, setActiveTab] = useState25("crop");
4826
4877
  const rootRef = useRef13(null);
4827
4878
  const canvasMode = activeTab === "crop" || activeTab === "select" || activeTab === "paint" || activeTab === "annotate" ? activeTab : "none";
4828
4879
  const activeTabRef = useRef13(activeTab);
@@ -4832,14 +4883,14 @@ var ImageEditor = ({
4832
4883
  rootRef.current?.querySelector(`[data-image-tab="${CSS.escape(ref.id)}"]`)?.click();
4833
4884
  await new Promise((resolve) => setTimeout(resolve, 60));
4834
4885
  };
4835
- const [activeCropRatio, setActiveCropRatio] = useState24(null);
4836
- const [selectionOptions, setSelectionOptions] = useState24(DEFAULT_SELECTION_TOOL_OPTIONS2);
4837
- const [shapeOptions, setShapeOptions] = useState24(DEFAULT_SHAPE_TOOL_OPTIONS2);
4838
- const [typeOptions, setTypeOptions] = useState24(DEFAULT_TYPE_TOOL_OPTIONS2);
4839
- const [typeSession, setTypeSession] = useState24(null);
4840
- const [selectionError, setSelectionError] = useState24(null);
4841
- const [paintError, setPaintError] = useState24(null);
4842
- const [shapeTypeError, setShapeTypeError] = useState24(null);
4886
+ const [activeCropRatio, setActiveCropRatio] = useState25(null);
4887
+ const [selectionOptions, setSelectionOptions] = useState25(DEFAULT_SELECTION_TOOL_OPTIONS2);
4888
+ const [shapeOptions, setShapeOptions] = useState25(DEFAULT_SHAPE_TOOL_OPTIONS2);
4889
+ const [typeOptions, setTypeOptions] = useState25(DEFAULT_TYPE_TOOL_OPTIONS2);
4890
+ const [typeSession, setTypeSession] = useState25(null);
4891
+ const [selectionError, setSelectionError] = useState25(null);
4892
+ const [paintError, setPaintError] = useState25(null);
4893
+ const [shapeTypeError, setShapeTypeError] = useState25(null);
4843
4894
  const handleCanvasError = (source, message) => {
4844
4895
  if (source === "paint") setPaintError(message);
4845
4896
  else if (source === "select") setSelectionError(message);
@@ -4856,16 +4907,16 @@ var ImageEditor = ({
4856
4907
  transformControllerRef.current = controller;
4857
4908
  }
4858
4909
  const transformTool = transformToolRef.current;
4859
- const [, setTransformTick] = useState24(0);
4910
+ const [, setTransformTick] = useState25(0);
4860
4911
  useEffect17(() => transformTool.subscribe(() => setTransformTick((n) => n + 1)), [transformTool]);
4861
4912
  useEffect17(() => () => transformToolRef.current?.cancel(), []);
4862
- const [inpaintPrompt, setInpaintPrompt] = useState24("");
4863
- const [inpaintMaskMode, setInpaintMaskMode] = useState24("annotations");
4864
- const [isRemovingBg, setIsRemovingBg] = useState24(false);
4865
- const [isInpainting, setIsInpainting] = useState24(false);
4866
- const [aiError, setAiError] = useState24(null);
4867
- const [aiSuccess, setAiSuccess] = useState24(null);
4868
- const [aiTarget, setAiTarget] = useState24("auto");
4913
+ const [inpaintPrompt, setInpaintPrompt] = useState25("");
4914
+ const [inpaintMaskMode, setInpaintMaskMode] = useState25("annotations");
4915
+ const [isRemovingBg, setIsRemovingBg] = useState25(false);
4916
+ const [isInpainting, setIsInpainting] = useState25(false);
4917
+ const [aiError, setAiError] = useState25(null);
4918
+ const [aiSuccess, setAiSuccess] = useState25(null);
4919
+ const [aiTarget, setAiTarget] = useState25("auto");
4869
4920
  const aiOptions = aiTarget === "auto" ? {} : { target: aiTarget };
4870
4921
  const effectiveOnInpaint = onInpaint || aiHooks?.onInpaint;
4871
4922
  const effectiveOnRemoveBg = onRemoveBackground || aiHooks?.onRemoveBackground;
@@ -4928,10 +4979,10 @@ var ImageEditor = ({
4928
4979
  setIsInpainting(false);
4929
4980
  }
4930
4981
  };
4931
- const [activeColor, setActiveColor] = useState24("#ef4444");
4932
- const [strokeWidth, setStrokeWidth] = useState24(3);
4933
- const [fontSize, setFontSize] = useState24(24);
4934
- const [textInput, setTextInput] = useState24("");
4982
+ const [activeColor, setActiveColor] = useState25("#ef4444");
4983
+ const [strokeWidth, setStrokeWidth] = useState25(3);
4984
+ const [fontSize, setFontSize] = useState25(24);
4985
+ const [textInput, setTextInput] = useState25("");
4935
4986
  useEffect17(() => {
4936
4987
  if (activeTab === "crop" && editor.state.activeTool !== "crop") {
4937
4988
  editor.setTool("crop");
@@ -4960,16 +5011,16 @@ var ImageEditor = ({
4960
5011
  link.click();
4961
5012
  }
4962
5013
  };
4963
- return /* @__PURE__ */ jsxs26(
5014
+ return /* @__PURE__ */ jsxs27(
4964
5015
  "div",
4965
5016
  {
4966
5017
  ref: rootRef,
4967
5018
  className: `${imageEditorFrameClass} ${className}`,
4968
5019
  style,
4969
5020
  children: [
4970
- /* @__PURE__ */ jsxs26("div", { className: imageEditorHeaderClass, children: [
4971
- /* @__PURE__ */ jsxs26("div", { role: "tablist", className: imageTabListClass, children: [
4972
- /* @__PURE__ */ jsx28(
5021
+ /* @__PURE__ */ jsxs27("div", { className: imageEditorHeaderClass, children: [
5022
+ /* @__PURE__ */ jsxs27("div", { role: "tablist", className: imageTabListClass, children: [
5023
+ /* @__PURE__ */ jsx29(
4973
5024
  "button",
4974
5025
  {
4975
5026
  type: "button",
@@ -4984,7 +5035,7 @@ var ImageEditor = ({
4984
5035
  children: "Transform & Crop"
4985
5036
  }
4986
5037
  ),
4987
- /* @__PURE__ */ jsx28(
5038
+ /* @__PURE__ */ jsx29(
4988
5039
  "button",
4989
5040
  {
4990
5041
  type: "button",
@@ -4999,7 +5050,7 @@ var ImageEditor = ({
4999
5050
  children: "Adjustments"
5000
5051
  }
5001
5052
  ),
5002
- /* @__PURE__ */ jsx28(
5053
+ /* @__PURE__ */ jsx29(
5003
5054
  "button",
5004
5055
  {
5005
5056
  type: "button",
@@ -5014,7 +5065,7 @@ var ImageEditor = ({
5014
5065
  children: "Layers"
5015
5066
  }
5016
5067
  ),
5017
- /* @__PURE__ */ jsx28(
5068
+ /* @__PURE__ */ jsx29(
5018
5069
  "button",
5019
5070
  {
5020
5071
  type: "button",
@@ -5029,7 +5080,7 @@ var ImageEditor = ({
5029
5080
  children: "Paint"
5030
5081
  }
5031
5082
  ),
5032
- /* @__PURE__ */ jsx28(
5083
+ /* @__PURE__ */ jsx29(
5033
5084
  "button",
5034
5085
  {
5035
5086
  type: "button",
@@ -5044,7 +5095,7 @@ var ImageEditor = ({
5044
5095
  children: "Select & Mask"
5045
5096
  }
5046
5097
  ),
5047
- /* @__PURE__ */ jsx28(
5098
+ /* @__PURE__ */ jsx29(
5048
5099
  "button",
5049
5100
  {
5050
5101
  type: "button",
@@ -5059,7 +5110,7 @@ var ImageEditor = ({
5059
5110
  children: "Annotations"
5060
5111
  }
5061
5112
  ),
5062
- /* @__PURE__ */ jsx28(
5113
+ /* @__PURE__ */ jsx29(
5063
5114
  "button",
5064
5115
  {
5065
5116
  type: "button",
@@ -5074,7 +5125,7 @@ var ImageEditor = ({
5074
5125
  children: "Depth Mask"
5075
5126
  }
5076
5127
  ),
5077
- /* @__PURE__ */ jsxs26(
5128
+ /* @__PURE__ */ jsxs27(
5078
5129
  "button",
5079
5130
  {
5080
5131
  type: "button",
@@ -5087,14 +5138,14 @@ var ImageEditor = ({
5087
5138
  "aria-selected": activeTab === "ai",
5088
5139
  className: `${imageTabClass(activeTab === "ai")} flex items-center gap-1.5`,
5089
5140
  children: [
5090
- /* @__PURE__ */ jsx28("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx28("path", { d: "M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83" }) }),
5141
+ /* @__PURE__ */ jsx29("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx29("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" }) }),
5091
5142
  "AI Tools"
5092
5143
  ]
5093
5144
  }
5094
5145
  )
5095
5146
  ] }),
5096
- /* @__PURE__ */ jsxs26("div", { className: "flex items-center gap-2 text-xs", children: [
5097
- /* @__PURE__ */ jsx28(
5147
+ /* @__PURE__ */ jsxs27("div", { className: "flex items-center gap-2 text-xs", children: [
5148
+ /* @__PURE__ */ jsx29(
5098
5149
  "button",
5099
5150
  {
5100
5151
  type: "button",
@@ -5105,7 +5156,7 @@ var ImageEditor = ({
5105
5156
  children: "\u21A9"
5106
5157
  }
5107
5158
  ),
5108
- /* @__PURE__ */ jsx28(
5159
+ /* @__PURE__ */ jsx29(
5109
5160
  "button",
5110
5161
  {
5111
5162
  type: "button",
@@ -5116,7 +5167,7 @@ var ImageEditor = ({
5116
5167
  children: "\u21AA"
5117
5168
  }
5118
5169
  ),
5119
- /* @__PURE__ */ jsx28(
5170
+ /* @__PURE__ */ jsx29(
5120
5171
  "button",
5121
5172
  {
5122
5173
  type: "button",
@@ -5125,8 +5176,8 @@ var ImageEditor = ({
5125
5176
  children: "Reset"
5126
5177
  }
5127
5178
  ),
5128
- /* @__PURE__ */ jsx28("div", { className: "h-4 w-px bg-muted mx-1" }),
5129
- /* @__PURE__ */ jsx28(
5179
+ /* @__PURE__ */ jsx29("div", { className: "h-4 w-px bg-muted mx-1" }),
5180
+ /* @__PURE__ */ jsx29(
5130
5181
  "button",
5131
5182
  {
5132
5183
  type: "button",
@@ -5136,11 +5187,11 @@ var ImageEditor = ({
5136
5187
  children: "-"
5137
5188
  }
5138
5189
  ),
5139
- /* @__PURE__ */ jsxs26("span", { className: "font-mono text-muted-foreground w-10 text-center", children: [
5190
+ /* @__PURE__ */ jsxs27("span", { className: "font-mono text-muted-foreground w-10 text-center", children: [
5140
5191
  Math.round(state.zoom * 100),
5141
5192
  "%"
5142
5193
  ] }),
5143
- /* @__PURE__ */ jsx28(
5194
+ /* @__PURE__ */ jsx29(
5144
5195
  "button",
5145
5196
  {
5146
5197
  type: "button",
@@ -5150,8 +5201,8 @@ var ImageEditor = ({
5150
5201
  children: "+"
5151
5202
  }
5152
5203
  ),
5153
- /* @__PURE__ */ jsx28("div", { className: "h-4 w-px bg-muted mx-1" }),
5154
- /* @__PURE__ */ jsx28(
5204
+ /* @__PURE__ */ jsx29("div", { className: "h-4 w-px bg-muted mx-1" }),
5205
+ /* @__PURE__ */ jsx29(
5155
5206
  "button",
5156
5207
  {
5157
5208
  type: "button",
@@ -5162,7 +5213,7 @@ var ImageEditor = ({
5162
5213
  children: "Hold Compare"
5163
5214
  }
5164
5215
  ),
5165
- /* @__PURE__ */ jsx28(
5216
+ /* @__PURE__ */ jsx29(
5166
5217
  "button",
5167
5218
  {
5168
5219
  type: "button",
@@ -5173,10 +5224,10 @@ var ImageEditor = ({
5173
5224
  )
5174
5225
  ] })
5175
5226
  ] }),
5176
- transformTool.active && /* @__PURE__ */ jsx28(FreeTransformOptionsBar, { tool: transformTool, className: "border-b border-border bg-background/95 px-4 py-2" }),
5177
- !transformTool.active && transformTool.error && /* @__PURE__ */ jsx28("div", { role: "alert", className: imageErrorBannerClass, children: transformTool.error }),
5178
- /* @__PURE__ */ jsxs26("div", { className: "flex flex-col md:flex-row flex-1 min-h-[520px] md:h-[560px]", children: [
5179
- /* @__PURE__ */ jsx28(
5227
+ transformTool.active && /* @__PURE__ */ jsx29(FreeTransformOptionsBar, { tool: transformTool, className: "border-b border-border bg-background/95 px-4 py-2" }),
5228
+ !transformTool.active && transformTool.error && /* @__PURE__ */ jsx29("div", { role: "alert", className: imageErrorBannerClass, children: transformTool.error }),
5229
+ /* @__PURE__ */ jsxs27("div", { className: "flex flex-col md:flex-row flex-1 min-h-[520px] md:h-[560px]", children: [
5230
+ /* @__PURE__ */ jsx29(
5180
5231
  ImageEditorCanvas,
5181
5232
  {
5182
5233
  editor,
@@ -5200,11 +5251,11 @@ var ImageEditor = ({
5200
5251
  className: "flex-1 h-[360px] md:h-full min-h-[320px] bg-muted"
5201
5252
  }
5202
5253
  ),
5203
- /* @__PURE__ */ jsxs26("div", { className: imageSidebarClass, children: [
5204
- activeTab === "crop" && /* @__PURE__ */ jsxs26("div", { className: "flex flex-col gap-4 text-xs", children: [
5205
- /* @__PURE__ */ jsx28("span", { className: imageSectionTitleClass, children: "Aspect Ratio Presets" }),
5206
- /* @__PURE__ */ jsxs26("div", { className: "grid grid-cols-3 gap-2", children: [
5207
- /* @__PURE__ */ jsx28(
5254
+ /* @__PURE__ */ jsxs27("div", { className: imageSidebarClass, children: [
5255
+ activeTab === "crop" && /* @__PURE__ */ jsxs27("div", { className: "flex flex-col gap-4 text-xs", children: [
5256
+ /* @__PURE__ */ jsx29("span", { className: imageSectionTitleClass, children: "Aspect Ratio Presets" }),
5257
+ /* @__PURE__ */ jsxs27("div", { className: "grid grid-cols-3 gap-2", children: [
5258
+ /* @__PURE__ */ jsx29(
5208
5259
  "button",
5209
5260
  {
5210
5261
  type: "button",
@@ -5216,7 +5267,7 @@ var ImageEditor = ({
5216
5267
  children: "Freeform"
5217
5268
  }
5218
5269
  ),
5219
- /* @__PURE__ */ jsx28(
5270
+ /* @__PURE__ */ jsx29(
5220
5271
  "button",
5221
5272
  {
5222
5273
  type: "button",
@@ -5228,7 +5279,7 @@ var ImageEditor = ({
5228
5279
  children: "1:1 Square"
5229
5280
  }
5230
5281
  ),
5231
- /* @__PURE__ */ jsx28(
5282
+ /* @__PURE__ */ jsx29(
5232
5283
  "button",
5233
5284
  {
5234
5285
  type: "button",
@@ -5240,7 +5291,7 @@ var ImageEditor = ({
5240
5291
  children: "4:3 Standard"
5241
5292
  }
5242
5293
  ),
5243
- /* @__PURE__ */ jsx28(
5294
+ /* @__PURE__ */ jsx29(
5244
5295
  "button",
5245
5296
  {
5246
5297
  type: "button",
@@ -5252,7 +5303,7 @@ var ImageEditor = ({
5252
5303
  children: "16:9 Wide"
5253
5304
  }
5254
5305
  ),
5255
- /* @__PURE__ */ jsx28(
5306
+ /* @__PURE__ */ jsx29(
5256
5307
  "button",
5257
5308
  {
5258
5309
  type: "button",
@@ -5264,7 +5315,7 @@ var ImageEditor = ({
5264
5315
  children: "3:2 Photo"
5265
5316
  }
5266
5317
  ),
5267
- /* @__PURE__ */ jsx28(
5318
+ /* @__PURE__ */ jsx29(
5268
5319
  "button",
5269
5320
  {
5270
5321
  type: "button",
@@ -5277,10 +5328,10 @@ var ImageEditor = ({
5277
5328
  }
5278
5329
  )
5279
5330
  ] }),
5280
- /* @__PURE__ */ jsx28("div", { className: imageDividerClass }),
5281
- /* @__PURE__ */ jsx28("span", { className: imageSectionTitleClass, children: "Orientation & Flips" }),
5282
- /* @__PURE__ */ jsxs26("div", { className: "grid grid-cols-2 gap-2", children: [
5283
- /* @__PURE__ */ jsx28(
5331
+ /* @__PURE__ */ jsx29("div", { className: imageDividerClass }),
5332
+ /* @__PURE__ */ jsx29("span", { className: imageSectionTitleClass, children: "Orientation & Flips" }),
5333
+ /* @__PURE__ */ jsxs27("div", { className: "grid grid-cols-2 gap-2", children: [
5334
+ /* @__PURE__ */ jsx29(
5284
5335
  "button",
5285
5336
  {
5286
5337
  type: "button",
@@ -5289,7 +5340,7 @@ var ImageEditor = ({
5289
5340
  children: "Rotate -90\xB0"
5290
5341
  }
5291
5342
  ),
5292
- /* @__PURE__ */ jsx28(
5343
+ /* @__PURE__ */ jsx29(
5293
5344
  "button",
5294
5345
  {
5295
5346
  type: "button",
@@ -5298,7 +5349,7 @@ var ImageEditor = ({
5298
5349
  children: "Rotate +90\xB0"
5299
5350
  }
5300
5351
  ),
5301
- /* @__PURE__ */ jsx28(
5352
+ /* @__PURE__ */ jsx29(
5302
5353
  "button",
5303
5354
  {
5304
5355
  type: "button",
@@ -5307,7 +5358,7 @@ var ImageEditor = ({
5307
5358
  children: "Flip Horizontal"
5308
5359
  }
5309
5360
  ),
5310
- /* @__PURE__ */ jsx28(
5361
+ /* @__PURE__ */ jsx29(
5311
5362
  "button",
5312
5363
  {
5313
5364
  type: "button",
@@ -5318,10 +5369,10 @@ var ImageEditor = ({
5318
5369
  )
5319
5370
  ] })
5320
5371
  ] }),
5321
- activeTab === "adjust" && /* @__PURE__ */ jsxs26("div", { className: "flex flex-col gap-3 text-xs", children: [
5322
- /* @__PURE__ */ jsxs26("div", { className: "flex items-center justify-between", children: [
5323
- /* @__PURE__ */ jsx28("span", { className: imageSectionTitleClass, children: "Color Adjustments" }),
5324
- /* @__PURE__ */ jsx28(
5372
+ activeTab === "adjust" && /* @__PURE__ */ jsxs27("div", { className: "flex flex-col gap-3 text-xs", children: [
5373
+ /* @__PURE__ */ jsxs27("div", { className: "flex items-center justify-between", children: [
5374
+ /* @__PURE__ */ jsx29("span", { className: imageSectionTitleClass, children: "Color Adjustments" }),
5375
+ /* @__PURE__ */ jsx29(
5325
5376
  "button",
5326
5377
  {
5327
5378
  type: "button",
@@ -5331,9 +5382,9 @@ var ImageEditor = ({
5331
5382
  }
5332
5383
  )
5333
5384
  ] }),
5334
- /* @__PURE__ */ jsx28(Histogram, { histogram: editor.histogram }),
5335
- IMAGE_ADJUSTMENT_CONTROLS.map((spec) => /* @__PURE__ */ jsxs26(React23.Fragment, { children: [
5336
- /* @__PURE__ */ jsx28(
5385
+ /* @__PURE__ */ jsx29(Histogram, { histogram: editor.histogram }),
5386
+ IMAGE_ADJUSTMENT_CONTROLS.map((spec) => /* @__PURE__ */ jsxs27(React24.Fragment, { children: [
5387
+ /* @__PURE__ */ jsx29(
5337
5388
  ControlSlider,
5338
5389
  {
5339
5390
  spec,
@@ -5342,14 +5393,14 @@ var ImageEditor = ({
5342
5393
  onChange: (v) => editor.setAdjustments({ [spec.id]: v })
5343
5394
  }
5344
5395
  ),
5345
- spec.id === "tint" && legacyProcess && /* @__PURE__ */ jsxs26(
5396
+ spec.id === "tint" && legacyProcess && /* @__PURE__ */ jsxs27(
5346
5397
  "div",
5347
5398
  {
5348
5399
  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",
5349
5400
  "data-testid": "image-editor-process-notice",
5350
5401
  children: [
5351
- /* @__PURE__ */ jsx28("span", { children: "Legacy rendering (process 1). Tint needs the current process." }),
5352
- /* @__PURE__ */ jsx28(
5402
+ /* @__PURE__ */ jsx29("span", { children: "Legacy rendering (process 1). Tint needs the current process." }),
5403
+ /* @__PURE__ */ jsx29(
5353
5404
  "button",
5354
5405
  {
5355
5406
  type: "button",
@@ -5362,7 +5413,7 @@ var ImageEditor = ({
5362
5413
  }
5363
5414
  )
5364
5415
  ] }, spec.id)),
5365
- /* @__PURE__ */ jsx28("div", { className: imageSectionClass, children: /* @__PURE__ */ jsx28(
5416
+ /* @__PURE__ */ jsx29("div", { className: imageSectionClass, children: /* @__PURE__ */ jsx29(
5366
5417
  AdjustmentLayersPanel,
5367
5418
  {
5368
5419
  controller,
@@ -5371,9 +5422,9 @@ var ImageEditor = ({
5371
5422
  }
5372
5423
  ) })
5373
5424
  ] }),
5374
- activeTab === "layers" && /* @__PURE__ */ jsxs26("div", { className: "flex flex-col gap-3 text-xs", children: [
5375
- /* @__PURE__ */ jsx28("span", { className: imageSectionTitleClass, children: "Layers" }),
5376
- /* @__PURE__ */ jsx28(
5425
+ activeTab === "layers" && /* @__PURE__ */ jsxs27("div", { className: "flex flex-col gap-3 text-xs", children: [
5426
+ /* @__PURE__ */ jsx29("span", { className: imageSectionTitleClass, children: "Layers" }),
5427
+ /* @__PURE__ */ jsx29(
5377
5428
  "button",
5378
5429
  {
5379
5430
  type: "button",
@@ -5384,15 +5435,15 @@ var ImageEditor = ({
5384
5435
  children: "Free Transform"
5385
5436
  }
5386
5437
  ),
5387
- /* @__PURE__ */ jsx28(LayersPanel, { controller }),
5388
- effectsShown && /* @__PURE__ */ jsx28(ImageProviderEffectsPanel, { controller, className: imageSectionClass }),
5389
- /* @__PURE__ */ jsx28("span", { className: imageSectionTitleClass, children: "Colour" }),
5390
- /* @__PURE__ */ jsx28(ColorProfilePanel, { controller })
5438
+ /* @__PURE__ */ jsx29(LayersPanel, { controller }),
5439
+ effectsShown && /* @__PURE__ */ jsx29(ImageProviderEffectsPanel, { controller, className: imageSectionClass }),
5440
+ /* @__PURE__ */ jsx29("span", { className: imageSectionTitleClass, children: "Colour" }),
5441
+ /* @__PURE__ */ jsx29(ColorProfilePanel, { controller })
5391
5442
  ] }),
5392
- activeTab === "paint" && /* @__PURE__ */ jsxs26("div", { className: "flex flex-col gap-3 text-xs", children: [
5393
- /* @__PURE__ */ jsx28("span", { className: imageSectionTitleClass, children: "Paint" }),
5394
- /* @__PURE__ */ jsx28(BrushOptionsBar, { controller }),
5395
- /* @__PURE__ */ jsx28(
5443
+ activeTab === "paint" && /* @__PURE__ */ jsxs27("div", { className: "flex flex-col gap-3 text-xs", children: [
5444
+ /* @__PURE__ */ jsx29("span", { className: imageSectionTitleClass, children: "Paint" }),
5445
+ /* @__PURE__ */ jsx29(BrushOptionsBar, { controller }),
5446
+ /* @__PURE__ */ jsx29(
5396
5447
  "button",
5397
5448
  {
5398
5449
  type: "button",
@@ -5403,12 +5454,12 @@ var ImageEditor = ({
5403
5454
  children: "Free Transform"
5404
5455
  }
5405
5456
  ),
5406
- paintError && /* @__PURE__ */ jsx28("p", { role: "alert", className: "text-destructive", "data-testid": "paint-error", children: paintError }),
5407
- /* @__PURE__ */ jsx28("div", { className: imageSectionClass, children: /* @__PURE__ */ jsx28(LayersPanel, { controller }) })
5457
+ paintError && /* @__PURE__ */ jsx29("p", { role: "alert", className: "text-destructive", "data-testid": "paint-error", children: paintError }),
5458
+ /* @__PURE__ */ jsx29("div", { className: imageSectionClass, children: /* @__PURE__ */ jsx29(LayersPanel, { controller }) })
5408
5459
  ] }),
5409
- activeTab === "annotate" && /* @__PURE__ */ jsxs26("div", { className: "flex flex-col gap-3 text-xs", children: [
5410
- /* @__PURE__ */ jsx28("span", { className: imageSectionTitleClass, children: "Shape & Type Layers, Paths" }),
5411
- /* @__PURE__ */ jsx28("div", { className: "grid grid-cols-2 gap-1.5", children: ["shape", "type", "path-pen", "path-select", "direct-select"].map((t) => /* @__PURE__ */ jsx28(
5460
+ activeTab === "annotate" && /* @__PURE__ */ jsxs27("div", { className: "flex flex-col gap-3 text-xs", children: [
5461
+ /* @__PURE__ */ jsx29("span", { className: imageSectionTitleClass, children: "Shape & Type Layers, Paths" }),
5462
+ /* @__PURE__ */ jsx29("div", { className: "grid grid-cols-2 gap-1.5", children: ["shape", "type", "path-pen", "path-select", "direct-select"].map((t) => /* @__PURE__ */ jsx29(
5412
5463
  "button",
5413
5464
  {
5414
5465
  type: "button",
@@ -5419,13 +5470,13 @@ var ImageEditor = ({
5419
5470
  },
5420
5471
  t
5421
5472
  )) }),
5422
- state.activeTool === "shape" && /* @__PURE__ */ jsx28(ShapeOptionsBar, { controller, options: shapeOptions, onChange: setShapeOptions }),
5423
- state.activeTool === "type" && /* @__PURE__ */ jsx28(TypeOptionsBar, { controller, options: typeOptions, onChange: setTypeOptions, session: typeSession }),
5424
- state.activeTool === "type" && typeSession && /* @__PURE__ */ jsx28("button", { type: "button", onClick: finishTyping, className: "self-start rounded bg-muted px-2 py-1 text-[11px] text-foreground hover:bg-accent", children: "Done editing text" }),
5425
- shapeTypeError && /* @__PURE__ */ jsx28("p", { role: "alert", className: "text-destructive", "data-testid": "shape-type-error", children: shapeTypeError }),
5426
- /* @__PURE__ */ jsx28("div", { className: imageDividerClass }),
5427
- /* @__PURE__ */ jsx28("span", { className: imageSectionTitleClass, children: "Draw & Annotate" }),
5428
- /* @__PURE__ */ jsx28("div", { className: "grid grid-cols-3 gap-1.5", children: ["pen", "rect", "circle", "arrow", "line"].map((t) => /* @__PURE__ */ jsx28(
5473
+ state.activeTool === "shape" && /* @__PURE__ */ jsx29(ShapeOptionsBar, { controller, options: shapeOptions, onChange: setShapeOptions }),
5474
+ state.activeTool === "type" && /* @__PURE__ */ jsx29(TypeOptionsBar, { controller, options: typeOptions, onChange: setTypeOptions, session: typeSession }),
5475
+ state.activeTool === "type" && typeSession && /* @__PURE__ */ jsx29("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" }),
5476
+ shapeTypeError && /* @__PURE__ */ jsx29("p", { role: "alert", className: "text-destructive", "data-testid": "shape-type-error", children: shapeTypeError }),
5477
+ /* @__PURE__ */ jsx29("div", { className: imageDividerClass }),
5478
+ /* @__PURE__ */ jsx29("span", { className: imageSectionTitleClass, children: "Draw & Annotate" }),
5479
+ /* @__PURE__ */ jsx29("div", { className: "grid grid-cols-3 gap-1.5", children: ["pen", "rect", "circle", "arrow", "line"].map((t) => /* @__PURE__ */ jsx29(
5429
5480
  "button",
5430
5481
  {
5431
5482
  type: "button",
@@ -5435,18 +5486,18 @@ var ImageEditor = ({
5435
5486
  },
5436
5487
  t
5437
5488
  )) }),
5438
- /* @__PURE__ */ jsxs26("div", { className: "flex items-center gap-2 mt-2", children: [
5439
- /* @__PURE__ */ jsx28("label", { className: "text-muted-foreground", children: "Color:" }),
5440
- /* @__PURE__ */ jsx28(ImageColor, { label: "Annotation colour", value: activeColor, onChange: setActiveColor }),
5441
- /* @__PURE__ */ jsxs26("div", { className: "flex-1 ml-2", children: [
5442
- /* @__PURE__ */ jsxs26("div", { className: "flex justify-between text-muted-foreground mb-0.5", children: [
5443
- /* @__PURE__ */ jsx28("span", { children: "Width:" }),
5444
- /* @__PURE__ */ jsxs26("span", { className: "font-mono", children: [
5489
+ /* @__PURE__ */ jsxs27("div", { className: "flex items-center gap-2 mt-2", children: [
5490
+ /* @__PURE__ */ jsx29("label", { className: "text-muted-foreground", children: "Color:" }),
5491
+ /* @__PURE__ */ jsx29(ImageColor, { label: "Annotation colour", value: activeColor, onChange: setActiveColor }),
5492
+ /* @__PURE__ */ jsxs27("div", { className: "flex-1 ml-2", children: [
5493
+ /* @__PURE__ */ jsxs27("div", { className: "flex justify-between text-muted-foreground mb-0.5", children: [
5494
+ /* @__PURE__ */ jsx29("span", { children: "Width:" }),
5495
+ /* @__PURE__ */ jsxs27("span", { className: "font-mono", children: [
5445
5496
  strokeWidth,
5446
5497
  "px"
5447
5498
  ] })
5448
5499
  ] }),
5449
- /* @__PURE__ */ jsx28(
5500
+ /* @__PURE__ */ jsx29(
5450
5501
  "input",
5451
5502
  {
5452
5503
  type: "range",
@@ -5459,10 +5510,10 @@ var ImageEditor = ({
5459
5510
  )
5460
5511
  ] })
5461
5512
  ] }),
5462
- /* @__PURE__ */ jsx28("div", { className: imageDividerClass }),
5463
- /* @__PURE__ */ jsx28("span", { className: imageSectionTitleClass, children: "Add Text" }),
5464
- /* @__PURE__ */ jsxs26("div", { className: "flex gap-2", children: [
5465
- /* @__PURE__ */ jsx28(
5513
+ /* @__PURE__ */ jsx29("div", { className: imageDividerClass }),
5514
+ /* @__PURE__ */ jsx29("span", { className: imageSectionTitleClass, children: "Add Text" }),
5515
+ /* @__PURE__ */ jsxs27("div", { className: "flex gap-2", children: [
5516
+ /* @__PURE__ */ jsx29(
5466
5517
  "input",
5467
5518
  {
5468
5519
  type: "text",
@@ -5473,7 +5524,7 @@ var ImageEditor = ({
5473
5524
  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"
5474
5525
  }
5475
5526
  ),
5476
- /* @__PURE__ */ jsx28(
5527
+ /* @__PURE__ */ jsx29(
5477
5528
  "button",
5478
5529
  {
5479
5530
  type: "button",
@@ -5483,14 +5534,14 @@ var ImageEditor = ({
5483
5534
  }
5484
5535
  )
5485
5536
  ] }),
5486
- /* @__PURE__ */ jsxs26("div", { className: "flex items-center justify-between text-muted-foreground", children: [
5487
- /* @__PURE__ */ jsx28("span", { children: "Font Size:" }),
5488
- /* @__PURE__ */ jsxs26("span", { className: "font-mono", children: [
5537
+ /* @__PURE__ */ jsxs27("div", { className: "flex items-center justify-between text-muted-foreground", children: [
5538
+ /* @__PURE__ */ jsx29("span", { children: "Font Size:" }),
5539
+ /* @__PURE__ */ jsxs27("span", { className: "font-mono", children: [
5489
5540
  fontSize,
5490
5541
  "px"
5491
5542
  ] })
5492
5543
  ] }),
5493
- /* @__PURE__ */ jsx28(
5544
+ /* @__PURE__ */ jsx29(
5494
5545
  "input",
5495
5546
  {
5496
5547
  type: "range",
@@ -5501,14 +5552,14 @@ var ImageEditor = ({
5501
5552
  className: imageRangeClass
5502
5553
  }
5503
5554
  ),
5504
- /* @__PURE__ */ jsx28("div", { className: imageDividerClass }),
5505
- /* @__PURE__ */ jsxs26("div", { className: "flex items-center justify-between", children: [
5506
- /* @__PURE__ */ jsxs26("span", { className: "text-muted-foreground", children: [
5555
+ /* @__PURE__ */ jsx29("div", { className: imageDividerClass }),
5556
+ /* @__PURE__ */ jsxs27("div", { className: "flex items-center justify-between", children: [
5557
+ /* @__PURE__ */ jsxs27("span", { className: "text-muted-foreground", children: [
5507
5558
  "Layers (",
5508
5559
  state.annotations.length,
5509
5560
  ")"
5510
5561
  ] }),
5511
- state.selectedAnnotationId && /* @__PURE__ */ jsx28(
5562
+ state.selectedAnnotationId && /* @__PURE__ */ jsx29(
5512
5563
  "button",
5513
5564
  {
5514
5565
  type: "button",
@@ -5517,7 +5568,7 @@ var ImageEditor = ({
5517
5568
  children: "Delete Selected"
5518
5569
  }
5519
5570
  ),
5520
- state.annotations.length > 0 && /* @__PURE__ */ jsx28(
5571
+ state.annotations.length > 0 && /* @__PURE__ */ jsx29(
5521
5572
  "button",
5522
5573
  {
5523
5574
  type: "button",
@@ -5528,10 +5579,10 @@ var ImageEditor = ({
5528
5579
  )
5529
5580
  ] })
5530
5581
  ] }),
5531
- activeTab === "depth" && /* @__PURE__ */ jsxs26("div", { className: "flex flex-col gap-3 text-xs", children: [
5532
- /* @__PURE__ */ jsxs26("div", { className: "flex items-center justify-between", children: [
5533
- /* @__PURE__ */ jsx28("span", { className: imageSectionTitleClass, children: "Depth Masking" }),
5534
- /* @__PURE__ */ jsx28(
5582
+ activeTab === "depth" && /* @__PURE__ */ jsxs27("div", { className: "flex flex-col gap-3 text-xs", children: [
5583
+ /* @__PURE__ */ jsxs27("div", { className: "flex items-center justify-between", children: [
5584
+ /* @__PURE__ */ jsx29("span", { className: imageSectionTitleClass, children: "Depth Masking" }),
5585
+ /* @__PURE__ */ jsx29(
5535
5586
  "button",
5536
5587
  {
5537
5588
  type: "button",
@@ -5541,8 +5592,8 @@ var ImageEditor = ({
5541
5592
  }
5542
5593
  )
5543
5594
  ] }),
5544
- /* @__PURE__ */ jsxs26("label", { className: "flex items-center gap-2 cursor-pointer text-foreground", children: [
5545
- /* @__PURE__ */ jsx28(
5595
+ /* @__PURE__ */ jsxs27("label", { className: "flex items-center gap-2 cursor-pointer text-foreground", children: [
5596
+ /* @__PURE__ */ jsx29(
5546
5597
  "input",
5547
5598
  {
5548
5599
  type: "checkbox",
@@ -5551,12 +5602,12 @@ var ImageEditor = ({
5551
5602
  className: "rounded accent-primary"
5552
5603
  }
5553
5604
  ),
5554
- /* @__PURE__ */ jsx28("span", { children: "Enable Depth / Alpha Mask" })
5605
+ /* @__PURE__ */ jsx29("span", { children: "Enable Depth / Alpha Mask" })
5555
5606
  ] }),
5556
- state.depthMask.enabled && /* @__PURE__ */ jsxs26(Fragment8, { children: [
5557
- /* @__PURE__ */ jsxs26("div", { children: [
5558
- /* @__PURE__ */ jsx28("label", { className: "text-muted-foreground block mb-1", children: "Mask Image URL:" }),
5559
- /* @__PURE__ */ jsx28(
5607
+ state.depthMask.enabled && /* @__PURE__ */ jsxs27(Fragment9, { children: [
5608
+ /* @__PURE__ */ jsxs27("div", { children: [
5609
+ /* @__PURE__ */ jsx29("label", { className: "text-muted-foreground block mb-1", children: "Mask Image URL:" }),
5610
+ /* @__PURE__ */ jsx29(
5560
5611
  "input",
5561
5612
  {
5562
5613
  type: "text",
@@ -5567,8 +5618,8 @@ var ImageEditor = ({
5567
5618
  }
5568
5619
  )
5569
5620
  ] }),
5570
- /* @__PURE__ */ jsxs26("div", { className: "flex gap-2", children: [
5571
- /* @__PURE__ */ jsx28(
5621
+ /* @__PURE__ */ jsxs27("div", { className: "flex gap-2", children: [
5622
+ /* @__PURE__ */ jsx29(
5572
5623
  "button",
5573
5624
  {
5574
5625
  type: "button",
@@ -5577,7 +5628,7 @@ var ImageEditor = ({
5577
5628
  children: "Threshold Mode"
5578
5629
  }
5579
5630
  ),
5580
- /* @__PURE__ */ jsx28(
5631
+ /* @__PURE__ */ jsx29(
5581
5632
  "button",
5582
5633
  {
5583
5634
  type: "button",
@@ -5587,12 +5638,12 @@ var ImageEditor = ({
5587
5638
  }
5588
5639
  )
5589
5640
  ] }),
5590
- /* @__PURE__ */ jsxs26("div", { children: [
5591
- /* @__PURE__ */ jsxs26("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
5592
- /* @__PURE__ */ jsx28("span", { children: "Depth Start (Lower):" }),
5593
- /* @__PURE__ */ jsx28("span", { className: "font-mono", children: state.depthMask.depthRange[0] })
5641
+ /* @__PURE__ */ jsxs27("div", { children: [
5642
+ /* @__PURE__ */ jsxs27("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
5643
+ /* @__PURE__ */ jsx29("span", { children: "Depth Start (Lower):" }),
5644
+ /* @__PURE__ */ jsx29("span", { className: "font-mono", children: state.depthMask.depthRange[0] })
5594
5645
  ] }),
5595
- /* @__PURE__ */ jsx28(
5646
+ /* @__PURE__ */ jsx29(
5596
5647
  "input",
5597
5648
  {
5598
5649
  type: "range",
@@ -5606,12 +5657,12 @@ var ImageEditor = ({
5606
5657
  }
5607
5658
  )
5608
5659
  ] }),
5609
- /* @__PURE__ */ jsxs26("div", { children: [
5610
- /* @__PURE__ */ jsxs26("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
5611
- /* @__PURE__ */ jsx28("span", { children: "Depth Stop (Upper):" }),
5612
- /* @__PURE__ */ jsx28("span", { className: "font-mono", children: state.depthMask.depthRange[1] })
5660
+ /* @__PURE__ */ jsxs27("div", { children: [
5661
+ /* @__PURE__ */ jsxs27("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
5662
+ /* @__PURE__ */ jsx29("span", { children: "Depth Stop (Upper):" }),
5663
+ /* @__PURE__ */ jsx29("span", { className: "font-mono", children: state.depthMask.depthRange[1] })
5613
5664
  ] }),
5614
- /* @__PURE__ */ jsx28(
5665
+ /* @__PURE__ */ jsx29(
5615
5666
  "input",
5616
5667
  {
5617
5668
  type: "range",
@@ -5625,12 +5676,12 @@ var ImageEditor = ({
5625
5676
  }
5626
5677
  )
5627
5678
  ] }),
5628
- /* @__PURE__ */ jsxs26("div", { children: [
5629
- /* @__PURE__ */ jsxs26("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
5630
- /* @__PURE__ */ jsx28("span", { children: "Softness:" }),
5631
- /* @__PURE__ */ jsx28("span", { className: "font-mono", children: state.depthMask.softness })
5679
+ /* @__PURE__ */ jsxs27("div", { children: [
5680
+ /* @__PURE__ */ jsxs27("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
5681
+ /* @__PURE__ */ jsx29("span", { children: "Softness:" }),
5682
+ /* @__PURE__ */ jsx29("span", { className: "font-mono", children: state.depthMask.softness })
5632
5683
  ] }),
5633
- /* @__PURE__ */ jsx28(
5684
+ /* @__PURE__ */ jsx29(
5634
5685
  "input",
5635
5686
  {
5636
5687
  type: "range",
@@ -5642,8 +5693,8 @@ var ImageEditor = ({
5642
5693
  }
5643
5694
  )
5644
5695
  ] }),
5645
- /* @__PURE__ */ jsxs26("label", { className: "flex items-center gap-2 cursor-pointer text-foreground mt-1", children: [
5646
- /* @__PURE__ */ jsx28(
5696
+ /* @__PURE__ */ jsxs27("label", { className: "flex items-center gap-2 cursor-pointer text-foreground mt-1", children: [
5697
+ /* @__PURE__ */ jsx29(
5647
5698
  "input",
5648
5699
  {
5649
5700
  type: "checkbox",
@@ -5652,12 +5703,12 @@ var ImageEditor = ({
5652
5703
  className: "rounded accent-primary"
5653
5704
  }
5654
5705
  ),
5655
- /* @__PURE__ */ jsx28("span", { children: "Invert Mask" })
5706
+ /* @__PURE__ */ jsx29("span", { children: "Invert Mask" })
5656
5707
  ] })
5657
5708
  ] })
5658
5709
  ] }),
5659
- activeTab === "select" && /* @__PURE__ */ jsxs26("div", { className: "flex flex-col gap-4 text-xs", children: [
5660
- /* @__PURE__ */ jsx28(
5710
+ activeTab === "select" && /* @__PURE__ */ jsxs27("div", { className: "flex flex-col gap-4 text-xs", children: [
5711
+ /* @__PURE__ */ jsx29(
5661
5712
  SelectionOptionsBar,
5662
5713
  {
5663
5714
  controller,
@@ -5668,9 +5719,9 @@ var ImageEditor = ({
5668
5719
  selectionDisplay: state.selectionDisplay
5669
5720
  }
5670
5721
  ),
5671
- selectionError && /* @__PURE__ */ jsx28("p", { role: "alert", className: "text-destructive", children: selectionError }),
5672
- /* @__PURE__ */ jsxs26("div", { className: "flex gap-1", children: [
5673
- /* @__PURE__ */ jsx28(
5722
+ selectionError && /* @__PURE__ */ jsx29("p", { role: "alert", className: "text-destructive", children: selectionError }),
5723
+ /* @__PURE__ */ jsxs27("div", { className: "flex gap-1", children: [
5724
+ /* @__PURE__ */ jsx29(
5674
5725
  "button",
5675
5726
  {
5676
5727
  type: "button",
@@ -5681,7 +5732,7 @@ var ImageEditor = ({
5681
5732
  children: "Transform Selection"
5682
5733
  }
5683
5734
  ),
5684
- /* @__PURE__ */ jsx28(
5735
+ /* @__PURE__ */ jsx29(
5685
5736
  "button",
5686
5737
  {
5687
5738
  type: "button",
@@ -5693,14 +5744,14 @@ var ImageEditor = ({
5693
5744
  }
5694
5745
  )
5695
5746
  ] }),
5696
- /* @__PURE__ */ jsx28(RefineEdgePanel, { controller, selection: state.selection ?? null, layers: state.adjustments.layers }),
5697
- /* @__PURE__ */ jsx28(ChannelsPanel, { controller }),
5698
- /* @__PURE__ */ jsx28(PathsPanel, { controller })
5747
+ /* @__PURE__ */ jsx29(RefineEdgePanel, { controller, selection: state.selection ?? null, layers: state.adjustments.layers }),
5748
+ /* @__PURE__ */ jsx29(ChannelsPanel, { controller }),
5749
+ /* @__PURE__ */ jsx29(PathsPanel, { controller })
5699
5750
  ] }),
5700
- activeTab === "ai" && /* @__PURE__ */ jsxs26("div", { className: "flex flex-col gap-4 text-xs", children: [
5701
- /* @__PURE__ */ jsxs26("label", { className: "flex items-center justify-between gap-2 text-foreground", children: [
5702
- /* @__PURE__ */ jsx28("span", { children: "Results go to" }),
5703
- /* @__PURE__ */ jsxs26(
5751
+ activeTab === "ai" && /* @__PURE__ */ jsxs27("div", { className: "flex flex-col gap-4 text-xs", children: [
5752
+ /* @__PURE__ */ jsxs27("label", { className: "flex items-center justify-between gap-2 text-foreground", children: [
5753
+ /* @__PURE__ */ jsx29("span", { children: "Results go to" }),
5754
+ /* @__PURE__ */ jsxs27(
5704
5755
  "select",
5705
5756
  {
5706
5757
  "aria-label": "AI result target",
@@ -5708,54 +5759,54 @@ var ImageEditor = ({
5708
5759
  onChange: (e) => setAiTarget(e.target.value),
5709
5760
  className: imageSelectClass,
5710
5761
  children: [
5711
- /* @__PURE__ */ jsx28("option", { value: "auto", children: controller.isMultiLayer ? "Auto (new layer)" : "Auto (replace image)" }),
5712
- /* @__PURE__ */ jsx28("option", { value: "new-layer", children: "New layer / mask" }),
5713
- /* @__PURE__ */ jsx28("option", { value: "replace", children: "Replace image" })
5762
+ /* @__PURE__ */ jsx29("option", { value: "auto", children: controller.isMultiLayer ? "Auto (new layer)" : "Auto (replace image)" }),
5763
+ /* @__PURE__ */ jsx29("option", { value: "new-layer", children: "New layer / mask" }),
5764
+ /* @__PURE__ */ jsx29("option", { value: "replace", children: "Replace image" })
5714
5765
  ]
5715
5766
  }
5716
5767
  )
5717
5768
  ] }),
5718
- /* @__PURE__ */ jsxs26("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
5719
- /* @__PURE__ */ jsxs26("div", { className: "flex items-center justify-between", children: [
5720
- /* @__PURE__ */ jsxs26("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
5721
- /* @__PURE__ */ jsx28("svg", { className: "w-3.5 h-3.5 text-primary", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx28("path", { d: "M6 3v12M18 9a3 3 0 1 0 0-6 3 3 0 0 0 0 6zM6 21a3 3 0 1 0 0-6 3 3 0 0 0 0 6z" }) }),
5769
+ /* @__PURE__ */ jsxs27("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
5770
+ /* @__PURE__ */ jsxs27("div", { className: "flex items-center justify-between", children: [
5771
+ /* @__PURE__ */ jsxs27("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
5772
+ /* @__PURE__ */ jsx29("svg", { className: "w-3.5 h-3.5 text-primary", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx29("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" }) }),
5722
5773
  "Background Removal"
5723
5774
  ] }),
5724
- isRemovingBg && /* @__PURE__ */ jsx28("span", { className: "inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium bg-primary/15 text-primary animate-pulse", children: "Removing..." })
5775
+ isRemovingBg && /* @__PURE__ */ jsx29("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..." })
5725
5776
  ] }),
5726
- /* @__PURE__ */ jsx28("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Isolate foreground subject with AI alpha transparency segmentation." }),
5727
- /* @__PURE__ */ jsx28(
5777
+ /* @__PURE__ */ jsx29("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Isolate foreground subject with AI alpha transparency segmentation." }),
5778
+ /* @__PURE__ */ jsx29(
5728
5779
  "button",
5729
5780
  {
5730
5781
  type: "button",
5731
5782
  onClick: handleRemoveBackground,
5732
5783
  disabled: isRemovingBg || isInpainting,
5733
5784
  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",
5734
- children: isRemovingBg ? /* @__PURE__ */ jsxs26(Fragment8, { children: [
5735
- /* @__PURE__ */ jsx28("div", { className: imageSpinnerClass }),
5785
+ children: isRemovingBg ? /* @__PURE__ */ jsxs27(Fragment9, { children: [
5786
+ /* @__PURE__ */ jsx29("div", { className: imageSpinnerClass }),
5736
5787
  "Removing Background..."
5737
- ] }) : /* @__PURE__ */ jsxs26(Fragment8, { children: [
5738
- /* @__PURE__ */ jsx28("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx28("path", { d: "M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83" }) }),
5788
+ ] }) : /* @__PURE__ */ jsxs27(Fragment9, { children: [
5789
+ /* @__PURE__ */ jsx29("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx29("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" }) }),
5739
5790
  "Remove Background"
5740
5791
  ] })
5741
5792
  }
5742
5793
  )
5743
5794
  ] }),
5744
- /* @__PURE__ */ jsxs26("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
5745
- /* @__PURE__ */ jsxs26("div", { className: "flex items-center justify-between", children: [
5746
- /* @__PURE__ */ jsxs26("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
5747
- /* @__PURE__ */ jsxs26("svg", { className: "w-3.5 h-3.5 text-primary", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
5748
- /* @__PURE__ */ jsx28("path", { d: "m21.64 3.64-1.28-1.28a1.2 1.2 0 0 0-1.7 0l-9.72 9.72-1.94 4.86 4.86-1.94 9.72-9.72a1.2 1.2 0 0 0 .06-1.64z" }),
5749
- /* @__PURE__ */ jsx28("path", { d: "m14 7 3 3" })
5795
+ /* @__PURE__ */ jsxs27("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
5796
+ /* @__PURE__ */ jsxs27("div", { className: "flex items-center justify-between", children: [
5797
+ /* @__PURE__ */ jsxs27("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
5798
+ /* @__PURE__ */ jsxs27("svg", { className: "w-3.5 h-3.5 text-primary", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
5799
+ /* @__PURE__ */ jsx29("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" }),
5800
+ /* @__PURE__ */ jsx29("path", { d: "m14 7 3 3" })
5750
5801
  ] }),
5751
5802
  "Generative Inpainting"
5752
5803
  ] }),
5753
- isInpainting && /* @__PURE__ */ jsx28("span", { className: "inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium bg-primary/15 text-primary animate-pulse", children: "Inpainting..." })
5804
+ isInpainting && /* @__PURE__ */ jsx29("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..." })
5754
5805
  ] }),
5755
- /* @__PURE__ */ jsx28("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Replace, modify, or fill selected regions using prompt-guided generative inpainting." }),
5756
- /* @__PURE__ */ jsxs26("div", { className: "flex flex-col gap-1", children: [
5757
- /* @__PURE__ */ jsx28("label", { htmlFor: "ai-inpaint-prompt-react", className: "text-foreground text-[11px] font-medium", children: "Prompt" }),
5758
- /* @__PURE__ */ jsx28(
5806
+ /* @__PURE__ */ jsx29("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Replace, modify, or fill selected regions using prompt-guided generative inpainting." }),
5807
+ /* @__PURE__ */ jsxs27("div", { className: "flex flex-col gap-1", children: [
5808
+ /* @__PURE__ */ jsx29("label", { htmlFor: "ai-inpaint-prompt-react", className: "text-foreground text-[11px] font-medium", children: "Prompt" }),
5809
+ /* @__PURE__ */ jsx29(
5759
5810
  "textarea",
5760
5811
  {
5761
5812
  id: "ai-inpaint-prompt-react",
@@ -5767,10 +5818,10 @@ var ImageEditor = ({
5767
5818
  }
5768
5819
  )
5769
5820
  ] }),
5770
- /* @__PURE__ */ jsxs26("div", { className: "flex flex-col gap-1", children: [
5771
- /* @__PURE__ */ jsx28("span", { className: "text-foreground text-[11px] font-medium", children: "Target Mask Region" }),
5772
- /* @__PURE__ */ jsxs26("div", { className: "grid grid-cols-2 gap-1.5", children: [
5773
- /* @__PURE__ */ jsxs26(
5821
+ /* @__PURE__ */ jsxs27("div", { className: "flex flex-col gap-1", children: [
5822
+ /* @__PURE__ */ jsx29("span", { className: "text-foreground text-[11px] font-medium", children: "Target Mask Region" }),
5823
+ /* @__PURE__ */ jsxs27("div", { className: "grid grid-cols-2 gap-1.5", children: [
5824
+ /* @__PURE__ */ jsxs27(
5774
5825
  "button",
5775
5826
  {
5776
5827
  type: "button",
@@ -5783,7 +5834,7 @@ var ImageEditor = ({
5783
5834
  ]
5784
5835
  }
5785
5836
  ),
5786
- /* @__PURE__ */ jsxs26(
5837
+ /* @__PURE__ */ jsxs27(
5787
5838
  "button",
5788
5839
  {
5789
5840
  type: "button",
@@ -5798,25 +5849,25 @@ var ImageEditor = ({
5798
5849
  )
5799
5850
  ] })
5800
5851
  ] }),
5801
- /* @__PURE__ */ jsx28(
5852
+ /* @__PURE__ */ jsx29(
5802
5853
  "button",
5803
5854
  {
5804
5855
  type: "button",
5805
5856
  onClick: handleInpaint,
5806
5857
  disabled: isInpainting || isRemovingBg || !inpaintPrompt.trim(),
5807
5858
  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",
5808
- children: isInpainting ? /* @__PURE__ */ jsxs26(Fragment8, { children: [
5809
- /* @__PURE__ */ jsx28("div", { className: imageSpinnerClass }),
5859
+ children: isInpainting ? /* @__PURE__ */ jsxs27(Fragment9, { children: [
5860
+ /* @__PURE__ */ jsx29("div", { className: imageSpinnerClass }),
5810
5861
  "Generating Inpaint..."
5811
- ] }) : /* @__PURE__ */ jsxs26(Fragment8, { children: [
5812
- /* @__PURE__ */ jsx28("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx28("path", { d: "M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83" }) }),
5862
+ ] }) : /* @__PURE__ */ jsxs27(Fragment9, { children: [
5863
+ /* @__PURE__ */ jsx29("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx29("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" }) }),
5813
5864
  "Apply Inpainting"
5814
5865
  ] })
5815
5866
  }
5816
5867
  )
5817
5868
  ] }),
5818
- aiError && /* @__PURE__ */ jsx28("div", { className: "p-2.5 rounded-lg bg-destructive/10 border border-destructive/40 text-destructive text-[11px]", children: aiError }),
5819
- aiSuccess && /* @__PURE__ */ jsx28("div", { className: "p-2.5 rounded-lg bg-emerald-500/10 border border-emerald-500/30 text-emerald-600 text-[11px]", children: aiSuccess })
5869
+ aiError && /* @__PURE__ */ jsx29("div", { className: "p-2.5 rounded-lg bg-destructive/10 border border-destructive/40 text-destructive text-[11px]", children: aiError }),
5870
+ aiSuccess && /* @__PURE__ */ jsx29("div", { className: "p-2.5 rounded-lg bg-emerald-500/10 border border-emerald-500/30 text-emerald-600 text-[11px]", children: aiSuccess })
5820
5871
  ] })
5821
5872
  ] })
5822
5873
  ] })
@@ -5842,6 +5893,7 @@ export {
5842
5893
  AdjustmentLayersPanel,
5843
5894
  LayerEffectsPanel,
5844
5895
  EdgeColorPanel,
5896
+ VectorMaskEdgesPanel,
5845
5897
  LayersPanel,
5846
5898
  ImageEffectControls,
5847
5899
  ImageProviderEffectsPanel,