@pixerate/editor-react 0.147.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 React22, { useRef as useRef12, useEffect as useEffect17, useState as useState23 } 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 useState17 } 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,24 +3961,87 @@ 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 })
3965
+ ] });
3966
+ };
3967
+
3968
+ // src/image-editor/SeparateSubjectPanel.tsx
3969
+ import { useRef as useRef11, useState as useState18 } from "react";
3970
+ import { jsx as jsx22, jsxs as jsxs20 } from "react/jsx-runtime";
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";
3972
+ var SeparateSubjectPanel = ({ controller, selection, className = "" }) => {
3973
+ const sel = selection === void 0 ? controller.getSelection() : selection;
3974
+ const [dilate, setDilate] = useState18(8);
3975
+ const [fill, setFill] = useState18(true);
3976
+ const [progress, setProgress] = useState18(null);
3977
+ const [error, setError] = useState18(null);
3978
+ const abort = useRef11(null);
3979
+ const run = async () => {
3980
+ setError(null);
3981
+ abort.current = new AbortController();
3982
+ setProgress("Starting");
3983
+ try {
3984
+ await controller.separateSubject({
3985
+ dilate,
3986
+ fill: fill ? "content-aware" : "none",
3987
+ signal: abort.current.signal,
3988
+ onProgress: (fraction, stage) => setProgress(`${stage ?? "Filling"} ${Math.round(fraction * 100)}%`)
3989
+ });
3990
+ } catch (err) {
3991
+ if (!abort.current.signal.aborted) setError(err instanceof Error ? err.message : String(err));
3992
+ } finally {
3993
+ abort.current = null;
3994
+ setProgress(null);
3995
+ }
3996
+ };
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: [
4002
+ "Grow",
4003
+ /* @__PURE__ */ jsx22(
4004
+ "input",
4005
+ {
4006
+ type: "number",
4007
+ min: 0,
4008
+ max: 200,
4009
+ "aria-label": "Separate grow",
4010
+ value: dilate,
4011
+ onChange: (e) => setDilate(Math.min(200, Math.max(0, Number(e.target.value) || 0))),
4012
+ className: "w-12 bg-background border border-border rounded px-1 py-0.5 text-foreground"
4013
+ }
4014
+ ),
4015
+ "px"
4016
+ ] }),
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) }),
4019
+ "Fill the background"
4020
+ ] })
4021
+ ] }),
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" })
4025
+ ] }),
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 })
3914
4028
  ] });
3915
4029
  };
3916
4030
 
3917
4031
  // src/image-editor/RefineEdgePanel.tsx
3918
- import { Fragment as Fragment6, jsx as jsx21, jsxs as jsxs19 } from "react/jsx-runtime";
4032
+ import { Fragment as Fragment7, jsx as jsx23, jsxs as jsxs21 } from "react/jsx-runtime";
3919
4033
  var DEFAULT_PARAMS = { radius: 8, smartRadius: false, smooth: 0, feather: 0, contrast: 0, shiftEdge: 0 };
3920
- var button5 = "px-2 py-1 rounded-md border border-border bg-background text-[11px] text-foreground hover:bg-accent hover:text-accent-foreground disabled:opacity-40";
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";
3921
4035
  var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
3922
- const [params, setParams] = useState17(DEFAULT_PARAMS);
3923
- const [busy, setBusy] = useState17(false);
3924
- const [error, setError] = useState17(null);
3925
- const [layerId, setLayerId] = useState17("");
3926
- const [newKind, setNewKind] = useState17("hueSaturation");
3927
- const [output, setOutput] = useState17("selection");
3928
- const [decontaminate, setDecontaminate] = useState17(0);
3929
- const [objectAware, setObjectAware] = useState17(false);
3930
- const [onlyUncertain, setOnlyUncertain] = useState17(false);
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);
3931
4045
  const canObject = Boolean(controller.segmentationProvider);
3932
4046
  const toLayer = output !== "selection" && output !== "layer-mask";
3933
4047
  const sel = selection === void 0 ? controller.getSelection() : selection;
@@ -3950,17 +4064,17 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
3950
4064
  setBusy(false);
3951
4065
  }
3952
4066
  };
3953
- return /* @__PURE__ */ jsxs19("div", { "data-testid": "refine-edge-panel", className: `flex flex-col gap-3 text-xs ${className}`, children: [
3954
- /* @__PURE__ */ jsx21("span", { className: imageSectionTitleClass, children: "Refine Edge" }),
3955
- REFINE_EDGE_CONTROLS2.map((c) => /* @__PURE__ */ jsxs19("label", { className: "flex flex-col gap-1", children: [
3956
- /* @__PURE__ */ jsxs19("span", { className: "flex justify-between text-muted-foreground", children: [
3957
- /* @__PURE__ */ jsx21("span", { children: c.label }),
3958
- /* @__PURE__ */ jsxs19("span", { className: "font-mono", children: [
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: [
3959
4073
  params[c.id],
3960
4074
  c.unit
3961
4075
  ] })
3962
4076
  ] }),
3963
- /* @__PURE__ */ jsx21(
4077
+ /* @__PURE__ */ jsx23(
3964
4078
  "input",
3965
4079
  {
3966
4080
  type: "range",
@@ -3974,43 +4088,43 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
3974
4088
  }
3975
4089
  )
3976
4090
  ] }, c.id)),
3977
- /* @__PURE__ */ jsxs19("label", { className: "flex items-center gap-2 text-foreground", children: [
3978
- /* @__PURE__ */ jsx21("input", { type: "checkbox", checked: params.smartRadius, onChange: (e) => setParams({ ...params, smartRadius: e.target.checked }) }),
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 }) }),
3979
4093
  "Smart Radius"
3980
4094
  ] }),
3981
- /* @__PURE__ */ jsxs19("label", { className: "flex items-center gap-2 text-foreground", title: "Refine only where the edge has no image edge under it", children: [
3982
- /* @__PURE__ */ jsx21("input", { type: "checkbox", "aria-label": "Only uncertain areas", checked: onlyUncertain, onChange: (e) => setOnlyUncertain(e.target.checked) }),
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) }),
3983
4097
  "Only uncertain areas"
3984
4098
  ] }),
3985
- canObject && /* @__PURE__ */ jsxs19("label", { className: "flex items-center gap-2 text-foreground", children: [
3986
- /* @__PURE__ */ jsx21("input", { type: "checkbox", "aria-label": "Object aware", checked: objectAware, onChange: (e) => setObjectAware(e.target.checked) }),
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) }),
3987
4101
  "Object aware (segmentation model)"
3988
4102
  ] }),
3989
- /* @__PURE__ */ jsxs19("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: [
3990
4104
  "Output to",
3991
- /* @__PURE__ */ jsx21(
4105
+ /* @__PURE__ */ jsx23(
3992
4106
  "select",
3993
4107
  {
3994
4108
  "aria-label": "Refine output",
3995
4109
  value: output,
3996
4110
  onChange: (e) => setOutput(e.target.value),
3997
4111
  className: "flex-1 bg-background border border-border rounded px-1 py-1 text-foreground",
3998
- children: REFINE_OUTPUTS2.filter((o) => !o.needsDocuments || controller.canOpenDocuments).map((o) => /* @__PURE__ */ jsx21("option", { value: o.id, children: o.label }, o.id))
4112
+ children: REFINE_OUTPUTS2.filter((o) => !o.needsDocuments || controller.canOpenDocuments).map((o) => /* @__PURE__ */ jsx23("option", { value: o.id, children: o.label }, o.id))
3999
4113
  }
4000
4114
  )
4001
4115
  ] }),
4002
- /* @__PURE__ */ jsxs19("label", { className: "flex flex-col gap-1", children: [
4003
- /* @__PURE__ */ jsxs19("span", { className: "flex justify-between text-muted-foreground", children: [
4004
- /* @__PURE__ */ jsxs19("span", { children: [
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: [
4005
4119
  "Decontaminate colors",
4006
4120
  toLayer ? "" : " (new layer or document outputs)"
4007
4121
  ] }),
4008
- /* @__PURE__ */ jsxs19("span", { className: "font-mono", children: [
4122
+ /* @__PURE__ */ jsxs21("span", { className: "font-mono", children: [
4009
4123
  decontaminate,
4010
4124
  "%"
4011
4125
  ] })
4012
4126
  ] }),
4013
- /* @__PURE__ */ jsx21(
4127
+ /* @__PURE__ */ jsx23(
4014
4128
  "input",
4015
4129
  {
4016
4130
  type: "range",
@@ -4025,65 +4139,66 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
4025
4139
  }
4026
4140
  )
4027
4141
  ] }),
4028
- /* @__PURE__ */ jsxs19("div", { className: "flex gap-1", children: [
4029
- /* @__PURE__ */ jsx21("button", { type: "button", className: button5, disabled: !sel || busy, onClick: refine, children: "Refine Edge" }),
4030
- /* @__PURE__ */ jsx21("button", { type: "button", className: button5, onClick: () => setParams(DEFAULT_PARAMS), children: "Reset" })
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" })
4031
4145
  ] }),
4032
- error && /* @__PURE__ */ jsx21("p", { role: "alert", className: "text-destructive", children: error }),
4033
- /* @__PURE__ */ jsx21(MaskEdgeCheck, { controller, selection: sel }),
4034
- /* @__PURE__ */ jsx21(SelectionChangeCheck, { controller, selection: sel }),
4035
- /* @__PURE__ */ jsx21("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] mt-2", children: "Layer Mask" }),
4036
- /* @__PURE__ */ jsxs19("div", { className: "flex gap-1 items-center", children: [
4037
- /* @__PURE__ */ jsx21(
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(
4038
4153
  "select",
4039
4154
  {
4040
4155
  "aria-label": "New masked layer kind",
4041
4156
  value: newKind,
4042
4157
  onChange: (e) => setNewKind(e.target.value),
4043
4158
  className: "flex-1 bg-background border border-border rounded px-1 py-1 text-foreground",
4044
- children: ADJUSTMENT_KINDS2.map((k) => /* @__PURE__ */ jsx21("option", { value: k.kind, children: k.label }, k.kind))
4159
+ children: ADJUSTMENT_KINDS2.map((k) => /* @__PURE__ */ jsx23("option", { value: k.kind, children: k.label }, k.kind))
4045
4160
  }
4046
4161
  ),
4047
- /* @__PURE__ */ jsx21(
4162
+ /* @__PURE__ */ jsx23(
4048
4163
  "button",
4049
4164
  {
4050
4165
  type: "button",
4051
- className: button5,
4166
+ className: button6,
4052
4167
  disabled: !sel,
4053
4168
  onClick: () => sel && setLayerId(controller.addAdjustmentLayer({ kind: newKind, mask: layerMaskFromSelection(sel) })),
4054
4169
  children: "New Masked Layer"
4055
4170
  }
4056
4171
  )
4057
4172
  ] }),
4058
- list.length > 0 && target && /* @__PURE__ */ jsxs19("div", { className: "flex flex-col gap-2", children: [
4059
- /* @__PURE__ */ jsx21(
4173
+ list.length > 0 && target && /* @__PURE__ */ jsxs21("div", { className: "flex flex-col gap-2", children: [
4174
+ /* @__PURE__ */ jsx23(
4060
4175
  "select",
4061
4176
  {
4062
4177
  "aria-label": "Mask layer",
4063
4178
  value: target.id,
4064
4179
  onChange: (e) => setLayerId(e.target.value),
4065
4180
  className: "bg-background border border-border rounded px-1 py-1 text-foreground",
4066
- children: list.map((l) => /* @__PURE__ */ jsxs19("option", { value: l.id, children: [
4181
+ children: list.map((l) => /* @__PURE__ */ jsxs21("option", { value: l.id, children: [
4067
4182
  l.name || adjustmentKindLabel2(l.kind),
4068
4183
  l.mask ? " (masked)" : ""
4069
4184
  ] }, l.id))
4070
4185
  }
4071
4186
  ),
4072
- /* @__PURE__ */ jsxs19("div", { className: "flex flex-wrap gap-1", children: [
4073
- /* @__PURE__ */ jsx21("button", { type: "button", className: button5, disabled: !sel, onClick: () => controller.applySelectionAsLayerMask(target.id), children: "Mask with Selection" }),
4074
- /* @__PURE__ */ jsx21("button", { type: "button", className: button5, disabled: !target.mask, onClick: () => controller.selectionFromLayerMask(target.id), children: "Load as Selection" }),
4075
- /* @__PURE__ */ jsx21("button", { type: "button", className: button5, disabled: !target.mask, onClick: () => controller.setAdjustmentLayerMask(target.id, null), children: "Remove Mask" })
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" })
4076
4191
  ] }),
4077
- target.mask && /* @__PURE__ */ jsxs19(Fragment6, { children: [
4078
- /* @__PURE__ */ jsxs19("label", { className: "flex flex-col gap-1", children: [
4079
- /* @__PURE__ */ jsxs19("span", { className: "flex justify-between text-muted-foreground", children: [
4080
- /* @__PURE__ */ jsx21("span", { children: "Density" }),
4081
- /* @__PURE__ */ jsxs19("span", { className: "font-mono", children: [
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: [
4082
4197
  Math.round((target.mask.density ?? 1) * 100),
4083
4198
  "%"
4084
4199
  ] })
4085
4200
  ] }),
4086
- /* @__PURE__ */ jsx21(
4201
+ /* @__PURE__ */ jsx23(
4087
4202
  "input",
4088
4203
  {
4089
4204
  type: "range",
@@ -4097,15 +4212,15 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
4097
4212
  }
4098
4213
  )
4099
4214
  ] }),
4100
- /* @__PURE__ */ jsxs19("label", { className: "flex flex-col gap-1", children: [
4101
- /* @__PURE__ */ jsxs19("span", { className: "flex justify-between text-muted-foreground", children: [
4102
- /* @__PURE__ */ jsx21("span", { children: "Mask Feather" }),
4103
- /* @__PURE__ */ jsxs19("span", { className: "font-mono", children: [
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: [
4104
4219
  target.mask.feather ?? 0,
4105
4220
  "px"
4106
4221
  ] })
4107
4222
  ] }),
4108
- /* @__PURE__ */ jsx21(
4223
+ /* @__PURE__ */ jsx23(
4109
4224
  "input",
4110
4225
  {
4111
4226
  type: "range",
@@ -4125,12 +4240,12 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
4125
4240
  };
4126
4241
 
4127
4242
  // src/image-editor/ChannelsPanel.tsx
4128
- import { useEffect as useEffect12, useRef as useRef11, useState as useState18 } from "react";
4243
+ import { useEffect as useEffect12, useRef as useRef12, useState as useState20 } from "react";
4129
4244
  import { MASK_FILE_ACCEPT, channelThumbnail, downloadMaskImage, openMaskFile, selectionModeFromModifiers } from "@pixerate/editor/image-editor";
4130
- import { jsx as jsx22, jsxs as jsxs20 } from "react/jsx-runtime";
4245
+ import { jsx as jsx24, jsxs as jsxs22 } from "react/jsx-runtime";
4131
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"}`;
4132
4247
  var ChannelThumb = ({ channel, size }) => {
4133
- const ref = useRef11(null);
4248
+ const ref = useRef12(null);
4134
4249
  useEffect12(() => {
4135
4250
  const canvas = ref.current;
4136
4251
  const ctx = canvas?.getContext("2d");
@@ -4142,15 +4257,15 @@ var ChannelThumb = ({ channel, size }) => {
4142
4257
  img.data.set(px.data);
4143
4258
  ctx.putImageData(img, 0, 0);
4144
4259
  }, [channel.mask]);
4145
- return /* @__PURE__ */ jsx22("canvas", { ref, "aria-hidden": "true", style: { width: size, height: size }, className: "shrink-0 rounded object-contain ring-1 ring-border bg-black" });
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" });
4146
4261
  };
4147
4262
  var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
4148
- const [, setTick] = useState18(0);
4263
+ const [, setTick] = useState20(0);
4149
4264
  useEffect12(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
4150
- const [activeId, setActiveId] = useState18(null);
4151
- const [renaming, setRenaming] = useState18(null);
4152
- const [error, setError] = useState18(null);
4153
- const fileInput = useRef11(null);
4265
+ const [activeId, setActiveId] = useState20(null);
4266
+ const [renaming, setRenaming] = useState20(null);
4267
+ const [error, setError] = useState20(null);
4268
+ const fileInput = useRef12(null);
4154
4269
  const channels = controller.getChannels();
4155
4270
  const active = channels.find((c) => c.id === activeId) ?? null;
4156
4271
  const hasSelection = Boolean(controller.getSelection());
@@ -4172,13 +4287,13 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
4172
4287
  setError(err instanceof Error ? err.message : String(err));
4173
4288
  }
4174
4289
  };
4175
- return /* @__PURE__ */ jsxs20("div", { "data-testid": "channels-panel", className: `flex flex-col gap-2 text-xs ${className}`, children: [
4176
- /* @__PURE__ */ jsxs20("div", { className: "flex items-center justify-between", children: [
4177
- /* @__PURE__ */ jsx22("span", { className: imageSectionTitleClass, children: "Channels" }),
4178
- /* @__PURE__ */ jsx22("button", { type: "button", "aria-pressed": quickMask, className: btn2(quickMask), title: "Paint the selection: white selects, black deselects (Q)", onClick: () => controller.setQuickMaskMode(!quickMask), children: "Quick Mask" })
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" })
4179
4294
  ] }),
4180
- channels.length === 0 && /* @__PURE__ */ jsx22("p", { className: "text-muted-foreground", children: "No channels. Save a selection to keep it." }),
4181
- /* @__PURE__ */ jsx22("ul", { role: "list", className: "flex flex-col gap-0.5", children: channels.map((c) => /* @__PURE__ */ jsxs20(
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(
4182
4297
  "li",
4183
4298
  {
4184
4299
  "data-testid": "channel-row",
@@ -4190,7 +4305,7 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
4190
4305
  },
4191
4306
  onDoubleClick: () => setRenaming(c.id),
4192
4307
  children: [
4193
- /* @__PURE__ */ jsx22(
4308
+ /* @__PURE__ */ jsx24(
4194
4309
  "button",
4195
4310
  {
4196
4311
  type: "button",
@@ -4204,8 +4319,8 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
4204
4319
  children: c.visible ? "\u25CF" : "\u25CB"
4205
4320
  }
4206
4321
  ),
4207
- /* @__PURE__ */ jsx22(ChannelThumb, { channel: c, size: thumbnailSize }),
4208
- renaming === c.id ? /* @__PURE__ */ jsx22(
4322
+ /* @__PURE__ */ jsx24(ChannelThumb, { channel: c, size: thumbnailSize }),
4323
+ renaming === c.id ? /* @__PURE__ */ jsx24(
4209
4324
  "input",
4210
4325
  {
4211
4326
  autoFocus: true,
@@ -4222,16 +4337,16 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
4222
4337
  if (e.key === "Escape") setRenaming(null);
4223
4338
  }
4224
4339
  }
4225
- ) : /* @__PURE__ */ jsx22("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 })
4226
4341
  ]
4227
4342
  },
4228
4343
  c.id
4229
4344
  )) }),
4230
- /* @__PURE__ */ jsxs20("div", { className: "flex flex-wrap gap-1", children: [
4231
- /* @__PURE__ */ jsx22("button", { type: "button", className: btn2(), disabled: !hasSelection, onClick: () => attempt(() => setActiveId(controller.saveSelection().id)), children: "Save Selection" }),
4232
- /* @__PURE__ */ jsx22("button", { type: "button", className: btn2(), disabled: !active || !hasSelection, title: "Add the selection to the channel", onClick: () => attempt(() => controller.saveSelection({ channelId: active.id, mode: "add" })), children: "Add to Channel" }),
4233
- /* @__PURE__ */ jsx22("button", { type: "button", className: btn2(), disabled: !active, onClick: () => attempt(() => setActiveId(controller.duplicateChannel(active.id).id)), children: "Duplicate" }),
4234
- /* @__PURE__ */ jsx22(
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(
4235
4350
  "button",
4236
4351
  {
4237
4352
  type: "button",
@@ -4244,8 +4359,8 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
4244
4359
  children: "Delete"
4245
4360
  }
4246
4361
  ),
4247
- /* @__PURE__ */ jsx22("button", { type: "button", className: btn2(), title: "Load a mask image (white = selected) into a new channel", onClick: () => fileInput.current?.click(), children: "Import\u2026" }),
4248
- /* @__PURE__ */ jsx22(
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(
4249
4364
  "button",
4250
4365
  {
4251
4366
  type: "button",
@@ -4256,7 +4371,7 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
4256
4371
  children: "Export PNG"
4257
4372
  }
4258
4373
  ),
4259
- /* @__PURE__ */ jsx22(
4374
+ /* @__PURE__ */ jsx24(
4260
4375
  "input",
4261
4376
  {
4262
4377
  ref: fileInput,
@@ -4271,22 +4386,22 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
4271
4386
  }
4272
4387
  )
4273
4388
  ] }),
4274
- error && /* @__PURE__ */ jsx22("p", { role: "alert", className: "text-destructive", children: error })
4389
+ error && /* @__PURE__ */ jsx24("p", { role: "alert", className: "text-destructive", children: error })
4275
4390
  ] });
4276
4391
  };
4277
4392
 
4278
4393
  // src/image-editor/PathsPanel.tsx
4279
- import { useEffect as useEffect13, useState as useState19 } from "react";
4394
+ import { useEffect as useEffect13, useState as useState21 } from "react";
4280
4395
  import { pathSvgData, selectionModeFromModifiers as selectionModeFromModifiers2 } from "@pixerate/editor/image-editor";
4281
- import { jsx as jsx23, jsxs as jsxs21 } from "react/jsx-runtime";
4396
+ import { jsx as jsx25, jsxs as jsxs23 } from "react/jsx-runtime";
4282
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"}`;
4283
4398
  var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
4284
- const [, setTick] = useState19(0);
4399
+ const [, setTick] = useState21(0);
4285
4400
  useEffect13(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
4286
- const [renaming, setRenaming] = useState19(null);
4287
- const [color, setColor] = useState19("#000000");
4288
- const [width, setWidth] = useState19(2);
4289
- const [error, setError] = useState19(null);
4401
+ const [renaming, setRenaming] = useState21(null);
4402
+ const [color, setColor] = useState21("#000000");
4403
+ const [width, setWidth] = useState21(2);
4404
+ const [error, setError] = useState21(null);
4290
4405
  const paths = controller.getPaths();
4291
4406
  const activeId = controller.getState().activePathId ?? null;
4292
4407
  const active = paths.find((p) => p.id === activeId) ?? null;
@@ -4302,10 +4417,10 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
4302
4417
  };
4303
4418
  return (
4304
4419
  // Clicking the panel's empty space deselects the path (the path tools then edit the active layer).
4305
- /* @__PURE__ */ jsxs21("div", { "data-testid": "paths-panel", className: `flex flex-col gap-2 text-xs ${className}`, onClick: (e) => e.target === e.currentTarget && attempt(() => controller.setActivePath(null)), children: [
4306
- /* @__PURE__ */ jsx23("span", { className: imageSectionTitleClass, children: "Paths" }),
4307
- paths.length === 0 && /* @__PURE__ */ jsx23("p", { className: "text-muted-foreground", children: "No paths. Make a work path from a selection." }),
4308
- /* @__PURE__ */ jsx23("ul", { role: "list", className: "flex flex-col gap-0.5 min-h-4", onClick: (e) => e.target === e.currentTarget && attempt(() => controller.setActivePath(null)), children: paths.map((p) => /* @__PURE__ */ jsxs21(
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(
4309
4424
  "li",
4310
4425
  {
4311
4426
  "data-testid": "path-row",
@@ -4314,8 +4429,8 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
4314
4429
  onClick: () => attempt(() => controller.setActivePath(p.id)),
4315
4430
  onDoubleClick: () => setRenaming(p.id),
4316
4431
  children: [
4317
- /* @__PURE__ */ jsx23("svg", { "aria-hidden": "true", viewBox: `0 0 ${w || 1} ${h || 1}`, style: { width: thumbnailSize, height: thumbnailSize }, className: "shrink-0 rounded ring-1 ring-border bg-background", children: /* @__PURE__ */ jsx23("path", { d: pathSvgData(p), fill: "currentColor", fillOpacity: 0.25, stroke: "currentColor", strokeWidth: Math.max(w, h) / 64, fillRule: p.fillRule ?? "nonzero" }) }),
4318
- renaming === p.id ? /* @__PURE__ */ jsx23(
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(
4319
4434
  "input",
4320
4435
  {
4321
4436
  autoFocus: true,
@@ -4334,13 +4449,13 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
4334
4449
  if (e.key === "Escape") setRenaming(null);
4335
4450
  }
4336
4451
  }
4337
- ) : /* @__PURE__ */ jsx23("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 })
4338
4453
  ]
4339
4454
  },
4340
4455
  p.id
4341
4456
  )) }),
4342
- /* @__PURE__ */ jsxs21("div", { className: "flex flex-wrap gap-1", children: [
4343
- /* @__PURE__ */ jsx23(
4457
+ /* @__PURE__ */ jsxs23("div", { className: "flex flex-wrap gap-1", children: [
4458
+ /* @__PURE__ */ jsx25(
4344
4459
  "button",
4345
4460
  {
4346
4461
  type: "button",
@@ -4351,15 +4466,15 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
4351
4466
  children: "Load as Selection"
4352
4467
  }
4353
4468
  ),
4354
- /* @__PURE__ */ jsx23("button", { type: "button", className: btn3(), disabled: !hasSelection, onClick: () => attempt(() => controller.makeWorkPath()), children: "Make Work Path" }),
4355
- active?.work && /* @__PURE__ */ jsx23("button", { type: "button", className: btn3(), onClick: () => setRenaming(active.id), children: "Save Path" }),
4356
- /* @__PURE__ */ jsx23("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.addVectorMaskFromPath(active.id)), children: "Add Vector Mask" })
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" })
4357
4472
  ] }),
4358
- /* @__PURE__ */ jsxs21("div", { className: "flex flex-wrap items-center gap-1", children: [
4359
- /* @__PURE__ */ jsx23("input", { type: "color", "aria-label": "Path paint colour", value: color, onChange: (e) => setColor(e.target.value), className: "h-6 w-8 bg-background border border-border rounded" }),
4360
- /* @__PURE__ */ jsx23("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.fillPath(active.id, { color })), children: "Fill Path" }),
4361
- /* @__PURE__ */ jsxs21("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
4362
- /* @__PURE__ */ jsx23(
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(
4363
4478
  "input",
4364
4479
  {
4365
4480
  type: "number",
@@ -4374,24 +4489,24 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
4374
4489
  ),
4375
4490
  "px"
4376
4491
  ] }),
4377
- /* @__PURE__ */ jsx23("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" })
4378
4493
  ] }),
4379
- /* @__PURE__ */ jsxs21("div", { className: "flex flex-wrap gap-1", children: [
4380
- /* @__PURE__ */ jsx23("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.duplicatePath(active.id)), children: "Duplicate" }),
4381
- /* @__PURE__ */ jsx23("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.deletePath(active.id)), children: "Delete" })
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" })
4382
4497
  ] }),
4383
- error && /* @__PURE__ */ jsx23("p", { role: "alert", className: "text-destructive", children: error })
4498
+ error && /* @__PURE__ */ jsx25("p", { role: "alert", className: "text-destructive", children: error })
4384
4499
  ] })
4385
4500
  );
4386
4501
  };
4387
4502
 
4388
4503
  // src/image-editor/FreeTransformOptionsBar.tsx
4389
- import { useEffect as useEffect14, useState as useState20 } from "react";
4504
+ import { useEffect as useEffect14, useState as useState22 } from "react";
4390
4505
  import { FREE_TRANSFORM_FIELDS, FREE_TRANSFORM_MODE_OPTIONS, INTERPOLATIONS, TRANSFORM_ANCHORS, WARP_GRID_OPTIONS, WARP_STYLE_OPTIONS } from "@pixerate/editor/image-editor";
4391
- import { jsx as jsx24, jsxs as jsxs22 } from "react/jsx-runtime";
4506
+ import { jsx as jsx26, jsxs as jsxs24 } from "react/jsx-runtime";
4392
4507
  var round = (v, unit) => unit === "px" ? Math.round(v * 10) / 10 : Math.round(v * 100) / 100;
4393
4508
  var FreeTransformOptionsBar = ({ tool, className }) => {
4394
- const [, setTick] = useState20(0);
4509
+ const [, setTick] = useState22(0);
4395
4510
  useEffect14(() => tool.subscribe(() => setTick((n) => n + 1)), [tool]);
4396
4511
  const bar = tool.bar();
4397
4512
  if (!tool.active || !bar) return null;
@@ -4404,17 +4519,17 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
4404
4519
  const v = Number(raw);
4405
4520
  if (raw.trim() !== "" && Number.isFinite(v) && Math.abs(v - bar[field]) > 1e-9) tool.setField(field, v);
4406
4521
  };
4407
- return /* @__PURE__ */ jsxs22("div", { className: `flex flex-wrap items-center gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "free-transform-options", role: "toolbar", "aria-label": "Free Transform options", children: [
4408
- /* @__PURE__ */ jsx24("div", { className: "flex gap-1", role: "group", "aria-label": "Transform mode", children: FREE_TRANSFORM_MODE_OPTIONS.map((m) => /* @__PURE__ */ jsx24("button", { type: "button", title: m.title, "aria-pressed": tool.mode === m.id, className: imageChipClass(tool.mode === m.id), onClick: () => tool.setMode(m.id), children: m.label }, m.id)) }),
4409
- /* @__PURE__ */ jsx24("div", { className: "grid grid-cols-3 gap-px", role: "group", "aria-label": "Reference point", children: TRANSFORM_ANCHORS.map((a) => /* @__PURE__ */ jsx24("button", { type: "button", "aria-label": `Reference point ${a}`, title: `Reference point: ${a}`, className: "h-2.5 w-2.5 rounded-sm bg-accent hover:bg-primary/90", onClick: () => tool.setReference(a) }, a)) }),
4410
- tool.mode === "warp" && /* @__PURE__ */ jsxs22("div", { className: "flex flex-wrap items-center gap-2", role: "group", "aria-label": "Warp options", children: [
4411
- /* @__PURE__ */ jsxs22("label", { className: "flex items-center gap-1", children: [
4412
- /* @__PURE__ */ jsx24("span", { className: "text-muted-foreground", children: "Warp" }),
4413
- /* @__PURE__ */ jsx24("select", { "aria-label": "Warp style", value: warp.style, onChange: (e) => tool.setWarp({ style: e.target.value }), className: imageFieldClass, children: WARP_STYLE_OPTIONS.map((o) => /* @__PURE__ */ jsx24("option", { value: o.id, children: o.label }, o.id)) })
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)) })
4414
4529
  ] }),
4415
- ["bend", "horizontal", "vertical"].map((k) => /* @__PURE__ */ jsxs22("label", { className: "flex items-center gap-1", children: [
4416
- /* @__PURE__ */ jsx24("span", { className: "text-muted-foreground", children: k === "bend" ? "Bend" : k === "horizontal" ? "H" : "V" }),
4417
- /* @__PURE__ */ jsx24(
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(
4418
4533
  "input",
4419
4534
  {
4420
4535
  type: "number",
@@ -4435,9 +4550,9 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
4435
4550
  },
4436
4551
  `${k}:${warp[k]}`
4437
4552
  ),
4438
- /* @__PURE__ */ jsx24("span", { className: "text-muted-foreground", children: "%" })
4553
+ /* @__PURE__ */ jsx26("span", { className: "text-muted-foreground", children: "%" })
4439
4554
  ] }, k)),
4440
- /* @__PURE__ */ jsx24(
4555
+ /* @__PURE__ */ jsx26(
4441
4556
  "button",
4442
4557
  {
4443
4558
  type: "button",
@@ -4449,9 +4564,9 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
4449
4564
  children: "Vertical"
4450
4565
  }
4451
4566
  ),
4452
- /* @__PURE__ */ jsxs22("label", { className: "flex items-center gap-1", children: [
4453
- /* @__PURE__ */ jsx24("span", { className: "text-muted-foreground", children: "Grid" }),
4454
- /* @__PURE__ */ jsx24(
4567
+ /* @__PURE__ */ jsxs24("label", { className: "flex items-center gap-1", children: [
4568
+ /* @__PURE__ */ jsx26("span", { className: "text-muted-foreground", children: "Grid" }),
4569
+ /* @__PURE__ */ jsx26(
4455
4570
  "select",
4456
4571
  {
4457
4572
  "aria-label": "Warp grid",
@@ -4461,14 +4576,14 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
4461
4576
  tool.setWarp({ columns: g.columns, rows: g.rows });
4462
4577
  },
4463
4578
  className: imageFieldClass,
4464
- children: WARP_GRID_OPTIONS.map((g) => /* @__PURE__ */ jsx24("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))
4465
4580
  }
4466
4581
  )
4467
4582
  ] })
4468
4583
  ] }),
4469
- tool.mode !== "warp" && FREE_TRANSFORM_FIELDS.map((f) => /* @__PURE__ */ jsxs22("label", { className: "flex items-center gap-1", title: f.title, children: [
4470
- /* @__PURE__ */ jsx24("span", { className: "text-muted-foreground", children: f.label }),
4471
- /* @__PURE__ */ jsx24(
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(
4472
4587
  "input",
4473
4588
  {
4474
4589
  type: "number",
@@ -4488,8 +4603,8 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
4488
4603
  },
4489
4604
  `${f.id}:${round(bar[f.id], f.unit)}`
4490
4605
  ),
4491
- /* @__PURE__ */ jsx24("span", { className: "text-muted-foreground", children: f.unit }),
4492
- f.id === "scaleX" && /* @__PURE__ */ jsx24(
4606
+ /* @__PURE__ */ jsx26("span", { className: "text-muted-foreground", children: f.unit }),
4607
+ f.id === "scaleX" && /* @__PURE__ */ jsx26(
4493
4608
  "button",
4494
4609
  {
4495
4610
  type: "button",
@@ -4504,33 +4619,33 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
4504
4619
  }
4505
4620
  )
4506
4621
  ] }, f.id)),
4507
- /* @__PURE__ */ jsxs22("label", { className: "flex items-center gap-1", children: [
4508
- /* @__PURE__ */ jsx24("span", { className: "text-muted-foreground", children: "Interpolation" }),
4509
- /* @__PURE__ */ jsx24(
4622
+ /* @__PURE__ */ jsxs24("label", { className: "flex items-center gap-1", children: [
4623
+ /* @__PURE__ */ jsx26("span", { className: "text-muted-foreground", children: "Interpolation" }),
4624
+ /* @__PURE__ */ jsx26(
4510
4625
  "select",
4511
4626
  {
4512
4627
  "aria-label": "Interpolation",
4513
4628
  value: tool.interpolation,
4514
4629
  onChange: (e) => tool.setInterpolation(e.target.value),
4515
4630
  className: imageFieldClass,
4516
- children: INTERPOLATIONS.map((i) => /* @__PURE__ */ jsx24("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))
4517
4632
  }
4518
4633
  )
4519
4634
  ] }),
4520
- /* @__PURE__ */ jsx24("button", { type: "button", title: "Commit (Enter)", className: "px-2 py-1 rounded bg-primary text-primary-foreground hover:bg-primary/90", onClick: () => tool.commit(), children: "Commit" }),
4521
- /* @__PURE__ */ jsx24("button", { type: "button", title: "Cancel (Esc)", className: imageChipClass(false), onClick: () => tool.cancel(), children: "Cancel" }),
4522
- tool.error && /* @__PURE__ */ jsx24("span", { role: "alert", className: "text-destructive", children: tool.error })
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 })
4523
4638
  ] });
4524
4639
  };
4525
4640
 
4526
4641
  // src/image-editor/ShapeOptionsBar.tsx
4527
- import { useEffect as useEffect15, useState as useState21 } from "react";
4642
+ import { useEffect as useEffect15, useState as useState23 } from "react";
4528
4643
  import { LIVE_SHAPE_KINDS, SHAPE_KIND_LABELS, applyShapeOptions } from "@pixerate/editor/image-editor";
4529
- import { Fragment as Fragment7, jsx as jsx25, jsxs as jsxs23 } from "react/jsx-runtime";
4644
+ import { Fragment as Fragment8, jsx as jsx27, jsxs as jsxs25 } from "react/jsx-runtime";
4530
4645
  var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
4531
- const [, setTick] = useState21(0);
4646
+ const [, setTick] = useState23(0);
4532
4647
  useEffect15(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
4533
- const [error, setError] = useState21(null);
4648
+ const [error, setError] = useState23(null);
4534
4649
  const active = controller.getActiveLayer();
4535
4650
  const shapeId = active?.type === "shape" ? active.id : null;
4536
4651
  const set = (change) => {
@@ -4544,22 +4659,22 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
4544
4659
  }
4545
4660
  };
4546
4661
  const num = (v, min, max) => Math.max(min, Math.min(max, Number(v) || min));
4547
- return /* @__PURE__ */ jsxs23("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "shape-options", children: [
4548
- /* @__PURE__ */ jsx25("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Shape kind", children: LIVE_SHAPE_KINDS.map((k) => /* @__PURE__ */ jsx25("button", { type: "button", "aria-pressed": options.kind === k, className: imageChipClass(options.kind === k), onClick: () => onChange({ ...options, kind: k }), children: SHAPE_KIND_LABELS[k] }, k)) }),
4549
- /* @__PURE__ */ jsxs23("div", { className: "flex flex-wrap items-center gap-3", children: [
4550
- /* @__PURE__ */ jsxs23("label", { className: "flex items-center gap-1", children: [
4551
- /* @__PURE__ */ jsx25(ImageCheckbox, { label: "Fill", checked: options.fill !== null, onChange: (on) => set({ fill: on ? "#4f46e5" : null }) }),
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 }) }),
4552
4667
  "Fill",
4553
- /* @__PURE__ */ jsx25(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 }) })
4554
4669
  ] }),
4555
- /* @__PURE__ */ jsxs23("label", { className: "flex items-center gap-1", children: [
4556
- /* @__PURE__ */ jsx25(ImageCheckbox, { label: "Stroke", checked: options.stroke !== null, onChange: (on) => set({ stroke: on ? "#000000" : null }) }),
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 }) }),
4557
4672
  "Stroke",
4558
- /* @__PURE__ */ jsx25(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 }) })
4559
4674
  ] }),
4560
- /* @__PURE__ */ jsxs23("label", { className: "flex items-center gap-1", children: [
4675
+ /* @__PURE__ */ jsxs25("label", { className: "flex items-center gap-1", children: [
4561
4676
  "Width",
4562
- /* @__PURE__ */ jsx25(
4677
+ /* @__PURE__ */ jsx27(
4563
4678
  "input",
4564
4679
  {
4565
4680
  type: "number",
@@ -4573,52 +4688,52 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
4573
4688
  )
4574
4689
  ] })
4575
4690
  ] }),
4576
- /* @__PURE__ */ jsxs23("div", { className: "flex flex-wrap items-center gap-3", children: [
4577
- options.kind === "rect" && /* @__PURE__ */ jsxs23("label", { className: "flex items-center gap-1", children: [
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: [
4578
4693
  "Radius",
4579
- /* @__PURE__ */ jsx25("input", { type: "number", "aria-label": "Corner radius", min: 0, max: 1e3, value: options.radius, onChange: (e) => set({ radius: num(e.target.value, 0, 1e3) }), className: `w-14 ${imageFieldClass}` })
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}` })
4580
4695
  ] }),
4581
- options.kind === "polygon" && /* @__PURE__ */ jsxs23("label", { className: "flex items-center gap-1", children: [
4696
+ options.kind === "polygon" && /* @__PURE__ */ jsxs25("label", { className: "flex items-center gap-1", children: [
4582
4697
  "Sides",
4583
- /* @__PURE__ */ jsx25("input", { type: "number", "aria-label": "Sides", min: 3, max: 100, value: options.sides, onChange: (e) => set({ sides: num(e.target.value, 3, 100) }), className: `w-14 ${imageFieldClass}` })
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}` })
4584
4699
  ] }),
4585
- options.kind === "star" && /* @__PURE__ */ jsxs23(Fragment7, { children: [
4586
- /* @__PURE__ */ jsxs23("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: [
4587
4702
  "Points",
4588
- /* @__PURE__ */ jsx25("input", { type: "number", "aria-label": "Points", min: 3, max: 100, value: options.points, onChange: (e) => set({ points: num(e.target.value, 3, 100) }), className: `w-14 ${imageFieldClass}` })
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}` })
4589
4704
  ] }),
4590
- /* @__PURE__ */ jsxs23("label", { className: "flex items-center gap-1", children: [
4705
+ /* @__PURE__ */ jsxs25("label", { className: "flex items-center gap-1", children: [
4591
4706
  "Inner",
4592
- /* @__PURE__ */ jsx25(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 }) })
4593
4708
  ] })
4594
4709
  ] }),
4595
- options.kind === "line" && /* @__PURE__ */ jsxs23(Fragment7, { children: [
4596
- /* @__PURE__ */ jsxs23("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: [
4597
4712
  "Weight",
4598
- /* @__PURE__ */ jsx25("input", { type: "number", "aria-label": "Line weight", min: 1, max: 200, value: options.weight, onChange: (e) => set({ weight: num(e.target.value, 1, 200) }), className: `w-14 ${imageFieldClass}` })
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}` })
4599
4714
  ] }),
4600
- /* @__PURE__ */ jsxs23("label", { className: "flex items-center gap-1", children: [
4601
- /* @__PURE__ */ jsx25(ImageCheckbox, { label: "Arrowhead", checked: options.arrow, onChange: (on) => set({ arrow: on }) }),
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 }) }),
4602
4717
  "Arrowhead"
4603
4718
  ] })
4604
4719
  ] })
4605
4720
  ] }),
4606
- /* @__PURE__ */ jsx25("p", { className: "text-[10px] text-muted-foreground", children: "Drag on the image to draw. Shift: square, circle or 45\xB0 line. Alt: from the centre." }),
4607
- error && /* @__PURE__ */ jsx25("p", { role: "alert", className: "text-destructive", children: error })
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 })
4608
4723
  ] });
4609
4724
  };
4610
4725
 
4611
4726
  // src/image-editor/TypeOptionsBar.tsx
4612
- import { useEffect as useEffect16, useState as useState22 } from "react";
4727
+ import { useEffect as useEffect16, useState as useState24 } from "react";
4613
4728
  import { TEXT_ALIGNS, TEXT_ORIENTATIONS } from "@pixerate/editor/image-editor";
4614
- import { jsx as jsx26, jsxs as jsxs24 } from "react/jsx-runtime";
4729
+ import { jsx as jsx28, jsxs as jsxs26 } from "react/jsx-runtime";
4615
4730
  var ALIGN_LABELS = { left: "Left", center: "Centre", right: "Right", justify: "Justify" };
4616
4731
  var ORIENTATION_LABELS = { horizontal: "Horizontal", vertical: "Vertical" };
4617
4732
  var TypeOptionsBar = ({ controller, options, onChange, session, className }) => {
4618
- const [, setTick] = useState22(0);
4733
+ const [, setTick] = useState24(0);
4619
4734
  useEffect16(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
4620
4735
  useEffect16(() => session?.subscribe(() => setTick((n) => n + 1)), [session]);
4621
- const [error, setError] = useState22(null);
4736
+ const [error, setError] = useState24(null);
4622
4737
  const active = controller.getActiveLayer();
4623
4738
  const typeId = !session && active?.type === "type" ? active.id : null;
4624
4739
  const here = session?.alive ? session.styleHere() : {};
@@ -4671,11 +4786,11 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
4671
4786
  setError(e instanceof Error ? e.message : String(e));
4672
4787
  }
4673
4788
  };
4674
- return /* @__PURE__ */ jsxs24("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "type-options", children: [
4675
- /* @__PURE__ */ jsxs24("div", { className: "flex flex-wrap items-center gap-2", children: [
4676
- /* @__PURE__ */ jsxs24("label", { className: "flex items-center gap-1", children: [
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: [
4677
4792
  "Font",
4678
- /* @__PURE__ */ jsx26(
4793
+ /* @__PURE__ */ jsx28(
4679
4794
  "input",
4680
4795
  {
4681
4796
  list: "pixerate-type-fonts",
@@ -4685,11 +4800,11 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
4685
4800
  className: "w-32 rounded border border-border bg-background px-1 py-0.5"
4686
4801
  }
4687
4802
  ),
4688
- /* @__PURE__ */ jsx26("datalist", { id: "pixerate-type-fonts", children: fonts.map((f) => /* @__PURE__ */ jsx26("option", { value: f }, f)) })
4803
+ /* @__PURE__ */ jsx28("datalist", { id: "pixerate-type-fonts", children: fonts.map((f) => /* @__PURE__ */ jsx28("option", { value: f }, f)) })
4689
4804
  ] }),
4690
- /* @__PURE__ */ jsxs24("label", { className: "flex items-center gap-1", children: [
4805
+ /* @__PURE__ */ jsxs26("label", { className: "flex items-center gap-1", children: [
4691
4806
  "Size",
4692
- /* @__PURE__ */ jsx26(
4807
+ /* @__PURE__ */ jsx28(
4693
4808
  "input",
4694
4809
  {
4695
4810
  type: "number",
@@ -4702,14 +4817,14 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
4702
4817
  }
4703
4818
  )
4704
4819
  ] }),
4705
- /* @__PURE__ */ jsx26("button", { type: "button", "aria-pressed": shown.fontWeight >= 600, className: `${imageChipClass(shown.fontWeight >= 600)} font-bold`, onClick: () => style({ fontWeight: shown.fontWeight >= 600 ? 400 : 700 }), children: "B" }),
4706
- /* @__PURE__ */ jsx26("button", { type: "button", "aria-pressed": shown.italic, className: `${imageChipClass(shown.italic)} italic`, onClick: () => style({ italic: !shown.italic }), children: "I" }),
4707
- /* @__PURE__ */ jsx26(ImageColor, { label: "Text colour", value: shown.color, onChange: (color) => style({ color }) })
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 }) })
4708
4823
  ] }),
4709
- /* @__PURE__ */ jsx26("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Alignment", children: TEXT_ALIGNS.map((a) => /* @__PURE__ */ jsx26("button", { type: "button", "aria-pressed": options.align === a, className: imageChipClass(options.align === a), onClick: () => style({ align: a }), children: ALIGN_LABELS[a] }, a)) }),
4710
- /* @__PURE__ */ jsxs24("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Orientation", children: [
4711
- TEXT_ORIENTATIONS.map((o) => /* @__PURE__ */ jsx26("button", { type: "button", "aria-pressed": orientation === o, className: imageChipClass(orientation === o), onClick: () => orient(o), children: ORIENTATION_LABELS[o] }, o)),
4712
- orientation === "vertical" && editedId && /* @__PURE__ */ jsx26(
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(
4713
4828
  "button",
4714
4829
  {
4715
4830
  type: "button",
@@ -4721,19 +4836,19 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
4721
4836
  }
4722
4837
  )
4723
4838
  ] }),
4724
- /* @__PURE__ */ jsx26("p", { className: "text-[10px] text-muted-foreground", children: "Click to type point text (vertical: a column down from the click), drag for a paragraph box, click text to edit it. Esc finishes." }),
4725
- missing.length > 0 && /* @__PURE__ */ jsxs24("p", { role: "status", className: "text-amber-600", "data-testid": "type-missing-fonts", children: [
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: [
4726
4841
  "Missing ",
4727
4842
  missing.length === 1 ? "font" : "fonts",
4728
4843
  ": ",
4729
4844
  missing.join(", ")
4730
4845
  ] }),
4731
- error && /* @__PURE__ */ jsx26("p", { role: "alert", className: "text-destructive", children: error })
4846
+ error && /* @__PURE__ */ jsx28("p", { role: "alert", className: "text-destructive", children: error })
4732
4847
  ] });
4733
4848
  };
4734
4849
 
4735
4850
  // src/image-editor/ImageEditor.tsx
4736
- import { Fragment as Fragment8, jsx as jsx27, jsxs as jsxs25 } from "react/jsx-runtime";
4851
+ import { Fragment as Fragment9, jsx as jsx29, jsxs as jsxs27 } from "react/jsx-runtime";
4737
4852
  var ImageEditor = ({
4738
4853
  editor: externalEditor,
4739
4854
  src,
@@ -4758,32 +4873,32 @@ var ImageEditor = ({
4758
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);
4759
4874
  });
4760
4875
  const legacyProcess = normalizeProcessVersion(state.adjustments.process) < LATEST_PROCESS_VERSION;
4761
- const [activeTab, setActiveTab] = useState23("crop");
4762
- const rootRef = useRef12(null);
4876
+ const [activeTab, setActiveTab] = useState25("crop");
4877
+ const rootRef = useRef13(null);
4763
4878
  const canvasMode = activeTab === "crop" || activeTab === "select" || activeTab === "paint" || activeTab === "annotate" ? activeTab : "none";
4764
- const activeTabRef = useRef12(activeTab);
4879
+ const activeTabRef = useRef13(activeTab);
4765
4880
  activeTabRef.current = activeTab;
4766
4881
  const openPanel = async (ref) => {
4767
4882
  if (ref.kind !== "panel" || activeTabRef.current === ref.id) return;
4768
4883
  rootRef.current?.querySelector(`[data-image-tab="${CSS.escape(ref.id)}"]`)?.click();
4769
4884
  await new Promise((resolve) => setTimeout(resolve, 60));
4770
4885
  };
4771
- const [activeCropRatio, setActiveCropRatio] = useState23(null);
4772
- const [selectionOptions, setSelectionOptions] = useState23(DEFAULT_SELECTION_TOOL_OPTIONS2);
4773
- const [shapeOptions, setShapeOptions] = useState23(DEFAULT_SHAPE_TOOL_OPTIONS2);
4774
- const [typeOptions, setTypeOptions] = useState23(DEFAULT_TYPE_TOOL_OPTIONS2);
4775
- const [typeSession, setTypeSession] = useState23(null);
4776
- const [selectionError, setSelectionError] = useState23(null);
4777
- const [paintError, setPaintError] = useState23(null);
4778
- const [shapeTypeError, setShapeTypeError] = useState23(null);
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);
4779
4894
  const handleCanvasError = (source, message) => {
4780
4895
  if (source === "paint") setPaintError(message);
4781
4896
  else if (source === "select") setSelectionError(message);
4782
4897
  else setShapeTypeError(message);
4783
4898
  };
4784
4899
  const finishTyping = () => setTypeSession(null);
4785
- const transformToolRef = useRef12(null);
4786
- const transformControllerRef = useRef12(controller);
4900
+ const transformToolRef = useRef13(null);
4901
+ const transformControllerRef = useRef13(controller);
4787
4902
  if (!transformToolRef.current || transformControllerRef.current !== controller) {
4788
4903
  transformToolRef.current?.cancel();
4789
4904
  transformToolRef.current = new FreeTransformTool2(controller, {
@@ -4792,16 +4907,16 @@ var ImageEditor = ({
4792
4907
  transformControllerRef.current = controller;
4793
4908
  }
4794
4909
  const transformTool = transformToolRef.current;
4795
- const [, setTransformTick] = useState23(0);
4910
+ const [, setTransformTick] = useState25(0);
4796
4911
  useEffect17(() => transformTool.subscribe(() => setTransformTick((n) => n + 1)), [transformTool]);
4797
4912
  useEffect17(() => () => transformToolRef.current?.cancel(), []);
4798
- const [inpaintPrompt, setInpaintPrompt] = useState23("");
4799
- const [inpaintMaskMode, setInpaintMaskMode] = useState23("annotations");
4800
- const [isRemovingBg, setIsRemovingBg] = useState23(false);
4801
- const [isInpainting, setIsInpainting] = useState23(false);
4802
- const [aiError, setAiError] = useState23(null);
4803
- const [aiSuccess, setAiSuccess] = useState23(null);
4804
- const [aiTarget, setAiTarget] = useState23("auto");
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");
4805
4920
  const aiOptions = aiTarget === "auto" ? {} : { target: aiTarget };
4806
4921
  const effectiveOnInpaint = onInpaint || aiHooks?.onInpaint;
4807
4922
  const effectiveOnRemoveBg = onRemoveBackground || aiHooks?.onRemoveBackground;
@@ -4864,10 +4979,10 @@ var ImageEditor = ({
4864
4979
  setIsInpainting(false);
4865
4980
  }
4866
4981
  };
4867
- const [activeColor, setActiveColor] = useState23("#ef4444");
4868
- const [strokeWidth, setStrokeWidth] = useState23(3);
4869
- const [fontSize, setFontSize] = useState23(24);
4870
- const [textInput, setTextInput] = useState23("");
4982
+ const [activeColor, setActiveColor] = useState25("#ef4444");
4983
+ const [strokeWidth, setStrokeWidth] = useState25(3);
4984
+ const [fontSize, setFontSize] = useState25(24);
4985
+ const [textInput, setTextInput] = useState25("");
4871
4986
  useEffect17(() => {
4872
4987
  if (activeTab === "crop" && editor.state.activeTool !== "crop") {
4873
4988
  editor.setTool("crop");
@@ -4896,16 +5011,16 @@ var ImageEditor = ({
4896
5011
  link.click();
4897
5012
  }
4898
5013
  };
4899
- return /* @__PURE__ */ jsxs25(
5014
+ return /* @__PURE__ */ jsxs27(
4900
5015
  "div",
4901
5016
  {
4902
5017
  ref: rootRef,
4903
5018
  className: `${imageEditorFrameClass} ${className}`,
4904
5019
  style,
4905
5020
  children: [
4906
- /* @__PURE__ */ jsxs25("div", { className: imageEditorHeaderClass, children: [
4907
- /* @__PURE__ */ jsxs25("div", { role: "tablist", className: imageTabListClass, children: [
4908
- /* @__PURE__ */ jsx27(
5021
+ /* @__PURE__ */ jsxs27("div", { className: imageEditorHeaderClass, children: [
5022
+ /* @__PURE__ */ jsxs27("div", { role: "tablist", className: imageTabListClass, children: [
5023
+ /* @__PURE__ */ jsx29(
4909
5024
  "button",
4910
5025
  {
4911
5026
  type: "button",
@@ -4920,7 +5035,7 @@ var ImageEditor = ({
4920
5035
  children: "Transform & Crop"
4921
5036
  }
4922
5037
  ),
4923
- /* @__PURE__ */ jsx27(
5038
+ /* @__PURE__ */ jsx29(
4924
5039
  "button",
4925
5040
  {
4926
5041
  type: "button",
@@ -4935,7 +5050,7 @@ var ImageEditor = ({
4935
5050
  children: "Adjustments"
4936
5051
  }
4937
5052
  ),
4938
- /* @__PURE__ */ jsx27(
5053
+ /* @__PURE__ */ jsx29(
4939
5054
  "button",
4940
5055
  {
4941
5056
  type: "button",
@@ -4950,7 +5065,7 @@ var ImageEditor = ({
4950
5065
  children: "Layers"
4951
5066
  }
4952
5067
  ),
4953
- /* @__PURE__ */ jsx27(
5068
+ /* @__PURE__ */ jsx29(
4954
5069
  "button",
4955
5070
  {
4956
5071
  type: "button",
@@ -4965,7 +5080,7 @@ var ImageEditor = ({
4965
5080
  children: "Paint"
4966
5081
  }
4967
5082
  ),
4968
- /* @__PURE__ */ jsx27(
5083
+ /* @__PURE__ */ jsx29(
4969
5084
  "button",
4970
5085
  {
4971
5086
  type: "button",
@@ -4980,7 +5095,7 @@ var ImageEditor = ({
4980
5095
  children: "Select & Mask"
4981
5096
  }
4982
5097
  ),
4983
- /* @__PURE__ */ jsx27(
5098
+ /* @__PURE__ */ jsx29(
4984
5099
  "button",
4985
5100
  {
4986
5101
  type: "button",
@@ -4995,7 +5110,7 @@ var ImageEditor = ({
4995
5110
  children: "Annotations"
4996
5111
  }
4997
5112
  ),
4998
- /* @__PURE__ */ jsx27(
5113
+ /* @__PURE__ */ jsx29(
4999
5114
  "button",
5000
5115
  {
5001
5116
  type: "button",
@@ -5010,7 +5125,7 @@ var ImageEditor = ({
5010
5125
  children: "Depth Mask"
5011
5126
  }
5012
5127
  ),
5013
- /* @__PURE__ */ jsxs25(
5128
+ /* @__PURE__ */ jsxs27(
5014
5129
  "button",
5015
5130
  {
5016
5131
  type: "button",
@@ -5023,14 +5138,14 @@ var ImageEditor = ({
5023
5138
  "aria-selected": activeTab === "ai",
5024
5139
  className: `${imageTabClass(activeTab === "ai")} flex items-center gap-1.5`,
5025
5140
  children: [
5026
- /* @__PURE__ */ jsx27("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx27("path", { d: "M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83" }) }),
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" }) }),
5027
5142
  "AI Tools"
5028
5143
  ]
5029
5144
  }
5030
5145
  )
5031
5146
  ] }),
5032
- /* @__PURE__ */ jsxs25("div", { className: "flex items-center gap-2 text-xs", children: [
5033
- /* @__PURE__ */ jsx27(
5147
+ /* @__PURE__ */ jsxs27("div", { className: "flex items-center gap-2 text-xs", children: [
5148
+ /* @__PURE__ */ jsx29(
5034
5149
  "button",
5035
5150
  {
5036
5151
  type: "button",
@@ -5041,7 +5156,7 @@ var ImageEditor = ({
5041
5156
  children: "\u21A9"
5042
5157
  }
5043
5158
  ),
5044
- /* @__PURE__ */ jsx27(
5159
+ /* @__PURE__ */ jsx29(
5045
5160
  "button",
5046
5161
  {
5047
5162
  type: "button",
@@ -5052,7 +5167,7 @@ var ImageEditor = ({
5052
5167
  children: "\u21AA"
5053
5168
  }
5054
5169
  ),
5055
- /* @__PURE__ */ jsx27(
5170
+ /* @__PURE__ */ jsx29(
5056
5171
  "button",
5057
5172
  {
5058
5173
  type: "button",
@@ -5061,8 +5176,8 @@ var ImageEditor = ({
5061
5176
  children: "Reset"
5062
5177
  }
5063
5178
  ),
5064
- /* @__PURE__ */ jsx27("div", { className: "h-4 w-px bg-muted mx-1" }),
5065
- /* @__PURE__ */ jsx27(
5179
+ /* @__PURE__ */ jsx29("div", { className: "h-4 w-px bg-muted mx-1" }),
5180
+ /* @__PURE__ */ jsx29(
5066
5181
  "button",
5067
5182
  {
5068
5183
  type: "button",
@@ -5072,11 +5187,11 @@ var ImageEditor = ({
5072
5187
  children: "-"
5073
5188
  }
5074
5189
  ),
5075
- /* @__PURE__ */ jsxs25("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: [
5076
5191
  Math.round(state.zoom * 100),
5077
5192
  "%"
5078
5193
  ] }),
5079
- /* @__PURE__ */ jsx27(
5194
+ /* @__PURE__ */ jsx29(
5080
5195
  "button",
5081
5196
  {
5082
5197
  type: "button",
@@ -5086,8 +5201,8 @@ var ImageEditor = ({
5086
5201
  children: "+"
5087
5202
  }
5088
5203
  ),
5089
- /* @__PURE__ */ jsx27("div", { className: "h-4 w-px bg-muted mx-1" }),
5090
- /* @__PURE__ */ jsx27(
5204
+ /* @__PURE__ */ jsx29("div", { className: "h-4 w-px bg-muted mx-1" }),
5205
+ /* @__PURE__ */ jsx29(
5091
5206
  "button",
5092
5207
  {
5093
5208
  type: "button",
@@ -5098,7 +5213,7 @@ var ImageEditor = ({
5098
5213
  children: "Hold Compare"
5099
5214
  }
5100
5215
  ),
5101
- /* @__PURE__ */ jsx27(
5216
+ /* @__PURE__ */ jsx29(
5102
5217
  "button",
5103
5218
  {
5104
5219
  type: "button",
@@ -5109,10 +5224,10 @@ var ImageEditor = ({
5109
5224
  )
5110
5225
  ] })
5111
5226
  ] }),
5112
- transformTool.active && /* @__PURE__ */ jsx27(FreeTransformOptionsBar, { tool: transformTool, className: "border-b border-border bg-background/95 px-4 py-2" }),
5113
- !transformTool.active && transformTool.error && /* @__PURE__ */ jsx27("div", { role: "alert", className: imageErrorBannerClass, children: transformTool.error }),
5114
- /* @__PURE__ */ jsxs25("div", { className: "flex flex-col md:flex-row flex-1 min-h-[520px] md:h-[560px]", children: [
5115
- /* @__PURE__ */ jsx27(
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(
5116
5231
  ImageEditorCanvas,
5117
5232
  {
5118
5233
  editor,
@@ -5136,11 +5251,11 @@ var ImageEditor = ({
5136
5251
  className: "flex-1 h-[360px] md:h-full min-h-[320px] bg-muted"
5137
5252
  }
5138
5253
  ),
5139
- /* @__PURE__ */ jsxs25("div", { className: imageSidebarClass, children: [
5140
- activeTab === "crop" && /* @__PURE__ */ jsxs25("div", { className: "flex flex-col gap-4 text-xs", children: [
5141
- /* @__PURE__ */ jsx27("span", { className: imageSectionTitleClass, children: "Aspect Ratio Presets" }),
5142
- /* @__PURE__ */ jsxs25("div", { className: "grid grid-cols-3 gap-2", children: [
5143
- /* @__PURE__ */ jsx27(
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(
5144
5259
  "button",
5145
5260
  {
5146
5261
  type: "button",
@@ -5152,7 +5267,7 @@ var ImageEditor = ({
5152
5267
  children: "Freeform"
5153
5268
  }
5154
5269
  ),
5155
- /* @__PURE__ */ jsx27(
5270
+ /* @__PURE__ */ jsx29(
5156
5271
  "button",
5157
5272
  {
5158
5273
  type: "button",
@@ -5164,7 +5279,7 @@ var ImageEditor = ({
5164
5279
  children: "1:1 Square"
5165
5280
  }
5166
5281
  ),
5167
- /* @__PURE__ */ jsx27(
5282
+ /* @__PURE__ */ jsx29(
5168
5283
  "button",
5169
5284
  {
5170
5285
  type: "button",
@@ -5176,7 +5291,7 @@ var ImageEditor = ({
5176
5291
  children: "4:3 Standard"
5177
5292
  }
5178
5293
  ),
5179
- /* @__PURE__ */ jsx27(
5294
+ /* @__PURE__ */ jsx29(
5180
5295
  "button",
5181
5296
  {
5182
5297
  type: "button",
@@ -5188,7 +5303,7 @@ var ImageEditor = ({
5188
5303
  children: "16:9 Wide"
5189
5304
  }
5190
5305
  ),
5191
- /* @__PURE__ */ jsx27(
5306
+ /* @__PURE__ */ jsx29(
5192
5307
  "button",
5193
5308
  {
5194
5309
  type: "button",
@@ -5200,7 +5315,7 @@ var ImageEditor = ({
5200
5315
  children: "3:2 Photo"
5201
5316
  }
5202
5317
  ),
5203
- /* @__PURE__ */ jsx27(
5318
+ /* @__PURE__ */ jsx29(
5204
5319
  "button",
5205
5320
  {
5206
5321
  type: "button",
@@ -5213,10 +5328,10 @@ var ImageEditor = ({
5213
5328
  }
5214
5329
  )
5215
5330
  ] }),
5216
- /* @__PURE__ */ jsx27("div", { className: imageDividerClass }),
5217
- /* @__PURE__ */ jsx27("span", { className: imageSectionTitleClass, children: "Orientation & Flips" }),
5218
- /* @__PURE__ */ jsxs25("div", { className: "grid grid-cols-2 gap-2", children: [
5219
- /* @__PURE__ */ jsx27(
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(
5220
5335
  "button",
5221
5336
  {
5222
5337
  type: "button",
@@ -5225,7 +5340,7 @@ var ImageEditor = ({
5225
5340
  children: "Rotate -90\xB0"
5226
5341
  }
5227
5342
  ),
5228
- /* @__PURE__ */ jsx27(
5343
+ /* @__PURE__ */ jsx29(
5229
5344
  "button",
5230
5345
  {
5231
5346
  type: "button",
@@ -5234,7 +5349,7 @@ var ImageEditor = ({
5234
5349
  children: "Rotate +90\xB0"
5235
5350
  }
5236
5351
  ),
5237
- /* @__PURE__ */ jsx27(
5352
+ /* @__PURE__ */ jsx29(
5238
5353
  "button",
5239
5354
  {
5240
5355
  type: "button",
@@ -5243,7 +5358,7 @@ var ImageEditor = ({
5243
5358
  children: "Flip Horizontal"
5244
5359
  }
5245
5360
  ),
5246
- /* @__PURE__ */ jsx27(
5361
+ /* @__PURE__ */ jsx29(
5247
5362
  "button",
5248
5363
  {
5249
5364
  type: "button",
@@ -5254,10 +5369,10 @@ var ImageEditor = ({
5254
5369
  )
5255
5370
  ] })
5256
5371
  ] }),
5257
- activeTab === "adjust" && /* @__PURE__ */ jsxs25("div", { className: "flex flex-col gap-3 text-xs", children: [
5258
- /* @__PURE__ */ jsxs25("div", { className: "flex items-center justify-between", children: [
5259
- /* @__PURE__ */ jsx27("span", { className: imageSectionTitleClass, children: "Color Adjustments" }),
5260
- /* @__PURE__ */ jsx27(
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(
5261
5376
  "button",
5262
5377
  {
5263
5378
  type: "button",
@@ -5267,9 +5382,9 @@ var ImageEditor = ({
5267
5382
  }
5268
5383
  )
5269
5384
  ] }),
5270
- /* @__PURE__ */ jsx27(Histogram, { histogram: editor.histogram }),
5271
- IMAGE_ADJUSTMENT_CONTROLS.map((spec) => /* @__PURE__ */ jsxs25(React22.Fragment, { children: [
5272
- /* @__PURE__ */ jsx27(
5385
+ /* @__PURE__ */ jsx29(Histogram, { histogram: editor.histogram }),
5386
+ IMAGE_ADJUSTMENT_CONTROLS.map((spec) => /* @__PURE__ */ jsxs27(React24.Fragment, { children: [
5387
+ /* @__PURE__ */ jsx29(
5273
5388
  ControlSlider,
5274
5389
  {
5275
5390
  spec,
@@ -5278,14 +5393,14 @@ var ImageEditor = ({
5278
5393
  onChange: (v) => editor.setAdjustments({ [spec.id]: v })
5279
5394
  }
5280
5395
  ),
5281
- spec.id === "tint" && legacyProcess && /* @__PURE__ */ jsxs25(
5396
+ spec.id === "tint" && legacyProcess && /* @__PURE__ */ jsxs27(
5282
5397
  "div",
5283
5398
  {
5284
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",
5285
5400
  "data-testid": "image-editor-process-notice",
5286
5401
  children: [
5287
- /* @__PURE__ */ jsx27("span", { children: "Legacy rendering (process 1). Tint needs the current process." }),
5288
- /* @__PURE__ */ jsx27(
5402
+ /* @__PURE__ */ jsx29("span", { children: "Legacy rendering (process 1). Tint needs the current process." }),
5403
+ /* @__PURE__ */ jsx29(
5289
5404
  "button",
5290
5405
  {
5291
5406
  type: "button",
@@ -5298,7 +5413,7 @@ var ImageEditor = ({
5298
5413
  }
5299
5414
  )
5300
5415
  ] }, spec.id)),
5301
- /* @__PURE__ */ jsx27("div", { className: imageSectionClass, children: /* @__PURE__ */ jsx27(
5416
+ /* @__PURE__ */ jsx29("div", { className: imageSectionClass, children: /* @__PURE__ */ jsx29(
5302
5417
  AdjustmentLayersPanel,
5303
5418
  {
5304
5419
  controller,
@@ -5307,9 +5422,9 @@ var ImageEditor = ({
5307
5422
  }
5308
5423
  ) })
5309
5424
  ] }),
5310
- activeTab === "layers" && /* @__PURE__ */ jsxs25("div", { className: "flex flex-col gap-3 text-xs", children: [
5311
- /* @__PURE__ */ jsx27("span", { className: imageSectionTitleClass, children: "Layers" }),
5312
- /* @__PURE__ */ jsx27(
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(
5313
5428
  "button",
5314
5429
  {
5315
5430
  type: "button",
@@ -5320,15 +5435,15 @@ var ImageEditor = ({
5320
5435
  children: "Free Transform"
5321
5436
  }
5322
5437
  ),
5323
- /* @__PURE__ */ jsx27(LayersPanel, { controller }),
5324
- effectsShown && /* @__PURE__ */ jsx27(ImageProviderEffectsPanel, { controller, className: imageSectionClass }),
5325
- /* @__PURE__ */ jsx27("span", { className: imageSectionTitleClass, children: "Colour" }),
5326
- /* @__PURE__ */ jsx27(ColorProfilePanel, { controller })
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 })
5327
5442
  ] }),
5328
- activeTab === "paint" && /* @__PURE__ */ jsxs25("div", { className: "flex flex-col gap-3 text-xs", children: [
5329
- /* @__PURE__ */ jsx27("span", { className: imageSectionTitleClass, children: "Paint" }),
5330
- /* @__PURE__ */ jsx27(BrushOptionsBar, { controller }),
5331
- /* @__PURE__ */ jsx27(
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(
5332
5447
  "button",
5333
5448
  {
5334
5449
  type: "button",
@@ -5339,12 +5454,12 @@ var ImageEditor = ({
5339
5454
  children: "Free Transform"
5340
5455
  }
5341
5456
  ),
5342
- paintError && /* @__PURE__ */ jsx27("p", { role: "alert", className: "text-destructive", "data-testid": "paint-error", children: paintError }),
5343
- /* @__PURE__ */ jsx27("div", { className: imageSectionClass, children: /* @__PURE__ */ jsx27(LayersPanel, { controller }) })
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 }) })
5344
5459
  ] }),
5345
- activeTab === "annotate" && /* @__PURE__ */ jsxs25("div", { className: "flex flex-col gap-3 text-xs", children: [
5346
- /* @__PURE__ */ jsx27("span", { className: imageSectionTitleClass, children: "Shape & Type Layers, Paths" }),
5347
- /* @__PURE__ */ jsx27("div", { className: "grid grid-cols-2 gap-1.5", children: ["shape", "type", "path-pen", "path-select", "direct-select"].map((t) => /* @__PURE__ */ jsx27(
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(
5348
5463
  "button",
5349
5464
  {
5350
5465
  type: "button",
@@ -5355,13 +5470,13 @@ var ImageEditor = ({
5355
5470
  },
5356
5471
  t
5357
5472
  )) }),
5358
- state.activeTool === "shape" && /* @__PURE__ */ jsx27(ShapeOptionsBar, { controller, options: shapeOptions, onChange: setShapeOptions }),
5359
- state.activeTool === "type" && /* @__PURE__ */ jsx27(TypeOptionsBar, { controller, options: typeOptions, onChange: setTypeOptions, session: typeSession }),
5360
- state.activeTool === "type" && typeSession && /* @__PURE__ */ jsx27("button", { type: "button", onClick: finishTyping, className: "self-start rounded bg-muted px-2 py-1 text-[11px] text-foreground hover:bg-accent", children: "Done editing text" }),
5361
- shapeTypeError && /* @__PURE__ */ jsx27("p", { role: "alert", className: "text-destructive", "data-testid": "shape-type-error", children: shapeTypeError }),
5362
- /* @__PURE__ */ jsx27("div", { className: imageDividerClass }),
5363
- /* @__PURE__ */ jsx27("span", { className: imageSectionTitleClass, children: "Draw & Annotate" }),
5364
- /* @__PURE__ */ jsx27("div", { className: "grid grid-cols-3 gap-1.5", children: ["pen", "rect", "circle", "arrow", "line"].map((t) => /* @__PURE__ */ jsx27(
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(
5365
5480
  "button",
5366
5481
  {
5367
5482
  type: "button",
@@ -5371,18 +5486,18 @@ var ImageEditor = ({
5371
5486
  },
5372
5487
  t
5373
5488
  )) }),
5374
- /* @__PURE__ */ jsxs25("div", { className: "flex items-center gap-2 mt-2", children: [
5375
- /* @__PURE__ */ jsx27("label", { className: "text-muted-foreground", children: "Color:" }),
5376
- /* @__PURE__ */ jsx27(ImageColor, { label: "Annotation colour", value: activeColor, onChange: setActiveColor }),
5377
- /* @__PURE__ */ jsxs25("div", { className: "flex-1 ml-2", children: [
5378
- /* @__PURE__ */ jsxs25("div", { className: "flex justify-between text-muted-foreground mb-0.5", children: [
5379
- /* @__PURE__ */ jsx27("span", { children: "Width:" }),
5380
- /* @__PURE__ */ jsxs25("span", { className: "font-mono", children: [
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: [
5381
5496
  strokeWidth,
5382
5497
  "px"
5383
5498
  ] })
5384
5499
  ] }),
5385
- /* @__PURE__ */ jsx27(
5500
+ /* @__PURE__ */ jsx29(
5386
5501
  "input",
5387
5502
  {
5388
5503
  type: "range",
@@ -5395,10 +5510,10 @@ var ImageEditor = ({
5395
5510
  )
5396
5511
  ] })
5397
5512
  ] }),
5398
- /* @__PURE__ */ jsx27("div", { className: imageDividerClass }),
5399
- /* @__PURE__ */ jsx27("span", { className: imageSectionTitleClass, children: "Add Text" }),
5400
- /* @__PURE__ */ jsxs25("div", { className: "flex gap-2", children: [
5401
- /* @__PURE__ */ jsx27(
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(
5402
5517
  "input",
5403
5518
  {
5404
5519
  type: "text",
@@ -5409,7 +5524,7 @@ var ImageEditor = ({
5409
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"
5410
5525
  }
5411
5526
  ),
5412
- /* @__PURE__ */ jsx27(
5527
+ /* @__PURE__ */ jsx29(
5413
5528
  "button",
5414
5529
  {
5415
5530
  type: "button",
@@ -5419,14 +5534,14 @@ var ImageEditor = ({
5419
5534
  }
5420
5535
  )
5421
5536
  ] }),
5422
- /* @__PURE__ */ jsxs25("div", { className: "flex items-center justify-between text-muted-foreground", children: [
5423
- /* @__PURE__ */ jsx27("span", { children: "Font Size:" }),
5424
- /* @__PURE__ */ jsxs25("span", { className: "font-mono", children: [
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: [
5425
5540
  fontSize,
5426
5541
  "px"
5427
5542
  ] })
5428
5543
  ] }),
5429
- /* @__PURE__ */ jsx27(
5544
+ /* @__PURE__ */ jsx29(
5430
5545
  "input",
5431
5546
  {
5432
5547
  type: "range",
@@ -5437,14 +5552,14 @@ var ImageEditor = ({
5437
5552
  className: imageRangeClass
5438
5553
  }
5439
5554
  ),
5440
- /* @__PURE__ */ jsx27("div", { className: imageDividerClass }),
5441
- /* @__PURE__ */ jsxs25("div", { className: "flex items-center justify-between", children: [
5442
- /* @__PURE__ */ jsxs25("span", { className: "text-muted-foreground", children: [
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: [
5443
5558
  "Layers (",
5444
5559
  state.annotations.length,
5445
5560
  ")"
5446
5561
  ] }),
5447
- state.selectedAnnotationId && /* @__PURE__ */ jsx27(
5562
+ state.selectedAnnotationId && /* @__PURE__ */ jsx29(
5448
5563
  "button",
5449
5564
  {
5450
5565
  type: "button",
@@ -5453,7 +5568,7 @@ var ImageEditor = ({
5453
5568
  children: "Delete Selected"
5454
5569
  }
5455
5570
  ),
5456
- state.annotations.length > 0 && /* @__PURE__ */ jsx27(
5571
+ state.annotations.length > 0 && /* @__PURE__ */ jsx29(
5457
5572
  "button",
5458
5573
  {
5459
5574
  type: "button",
@@ -5464,10 +5579,10 @@ var ImageEditor = ({
5464
5579
  )
5465
5580
  ] })
5466
5581
  ] }),
5467
- activeTab === "depth" && /* @__PURE__ */ jsxs25("div", { className: "flex flex-col gap-3 text-xs", children: [
5468
- /* @__PURE__ */ jsxs25("div", { className: "flex items-center justify-between", children: [
5469
- /* @__PURE__ */ jsx27("span", { className: imageSectionTitleClass, children: "Depth Masking" }),
5470
- /* @__PURE__ */ jsx27(
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(
5471
5586
  "button",
5472
5587
  {
5473
5588
  type: "button",
@@ -5477,8 +5592,8 @@ var ImageEditor = ({
5477
5592
  }
5478
5593
  )
5479
5594
  ] }),
5480
- /* @__PURE__ */ jsxs25("label", { className: "flex items-center gap-2 cursor-pointer text-foreground", children: [
5481
- /* @__PURE__ */ jsx27(
5595
+ /* @__PURE__ */ jsxs27("label", { className: "flex items-center gap-2 cursor-pointer text-foreground", children: [
5596
+ /* @__PURE__ */ jsx29(
5482
5597
  "input",
5483
5598
  {
5484
5599
  type: "checkbox",
@@ -5487,12 +5602,12 @@ var ImageEditor = ({
5487
5602
  className: "rounded accent-primary"
5488
5603
  }
5489
5604
  ),
5490
- /* @__PURE__ */ jsx27("span", { children: "Enable Depth / Alpha Mask" })
5605
+ /* @__PURE__ */ jsx29("span", { children: "Enable Depth / Alpha Mask" })
5491
5606
  ] }),
5492
- state.depthMask.enabled && /* @__PURE__ */ jsxs25(Fragment8, { children: [
5493
- /* @__PURE__ */ jsxs25("div", { children: [
5494
- /* @__PURE__ */ jsx27("label", { className: "text-muted-foreground block mb-1", children: "Mask Image URL:" }),
5495
- /* @__PURE__ */ jsx27(
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(
5496
5611
  "input",
5497
5612
  {
5498
5613
  type: "text",
@@ -5503,8 +5618,8 @@ var ImageEditor = ({
5503
5618
  }
5504
5619
  )
5505
5620
  ] }),
5506
- /* @__PURE__ */ jsxs25("div", { className: "flex gap-2", children: [
5507
- /* @__PURE__ */ jsx27(
5621
+ /* @__PURE__ */ jsxs27("div", { className: "flex gap-2", children: [
5622
+ /* @__PURE__ */ jsx29(
5508
5623
  "button",
5509
5624
  {
5510
5625
  type: "button",
@@ -5513,7 +5628,7 @@ var ImageEditor = ({
5513
5628
  children: "Threshold Mode"
5514
5629
  }
5515
5630
  ),
5516
- /* @__PURE__ */ jsx27(
5631
+ /* @__PURE__ */ jsx29(
5517
5632
  "button",
5518
5633
  {
5519
5634
  type: "button",
@@ -5523,12 +5638,12 @@ var ImageEditor = ({
5523
5638
  }
5524
5639
  )
5525
5640
  ] }),
5526
- /* @__PURE__ */ jsxs25("div", { children: [
5527
- /* @__PURE__ */ jsxs25("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
5528
- /* @__PURE__ */ jsx27("span", { children: "Depth Start (Lower):" }),
5529
- /* @__PURE__ */ jsx27("span", { className: "font-mono", children: state.depthMask.depthRange[0] })
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] })
5530
5645
  ] }),
5531
- /* @__PURE__ */ jsx27(
5646
+ /* @__PURE__ */ jsx29(
5532
5647
  "input",
5533
5648
  {
5534
5649
  type: "range",
@@ -5542,12 +5657,12 @@ var ImageEditor = ({
5542
5657
  }
5543
5658
  )
5544
5659
  ] }),
5545
- /* @__PURE__ */ jsxs25("div", { children: [
5546
- /* @__PURE__ */ jsxs25("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
5547
- /* @__PURE__ */ jsx27("span", { children: "Depth Stop (Upper):" }),
5548
- /* @__PURE__ */ jsx27("span", { className: "font-mono", children: state.depthMask.depthRange[1] })
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] })
5549
5664
  ] }),
5550
- /* @__PURE__ */ jsx27(
5665
+ /* @__PURE__ */ jsx29(
5551
5666
  "input",
5552
5667
  {
5553
5668
  type: "range",
@@ -5561,12 +5676,12 @@ var ImageEditor = ({
5561
5676
  }
5562
5677
  )
5563
5678
  ] }),
5564
- /* @__PURE__ */ jsxs25("div", { children: [
5565
- /* @__PURE__ */ jsxs25("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
5566
- /* @__PURE__ */ jsx27("span", { children: "Softness:" }),
5567
- /* @__PURE__ */ jsx27("span", { className: "font-mono", children: state.depthMask.softness })
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 })
5568
5683
  ] }),
5569
- /* @__PURE__ */ jsx27(
5684
+ /* @__PURE__ */ jsx29(
5570
5685
  "input",
5571
5686
  {
5572
5687
  type: "range",
@@ -5578,8 +5693,8 @@ var ImageEditor = ({
5578
5693
  }
5579
5694
  )
5580
5695
  ] }),
5581
- /* @__PURE__ */ jsxs25("label", { className: "flex items-center gap-2 cursor-pointer text-foreground mt-1", children: [
5582
- /* @__PURE__ */ jsx27(
5696
+ /* @__PURE__ */ jsxs27("label", { className: "flex items-center gap-2 cursor-pointer text-foreground mt-1", children: [
5697
+ /* @__PURE__ */ jsx29(
5583
5698
  "input",
5584
5699
  {
5585
5700
  type: "checkbox",
@@ -5588,12 +5703,12 @@ var ImageEditor = ({
5588
5703
  className: "rounded accent-primary"
5589
5704
  }
5590
5705
  ),
5591
- /* @__PURE__ */ jsx27("span", { children: "Invert Mask" })
5706
+ /* @__PURE__ */ jsx29("span", { children: "Invert Mask" })
5592
5707
  ] })
5593
5708
  ] })
5594
5709
  ] }),
5595
- activeTab === "select" && /* @__PURE__ */ jsxs25("div", { className: "flex flex-col gap-4 text-xs", children: [
5596
- /* @__PURE__ */ jsx27(
5710
+ activeTab === "select" && /* @__PURE__ */ jsxs27("div", { className: "flex flex-col gap-4 text-xs", children: [
5711
+ /* @__PURE__ */ jsx29(
5597
5712
  SelectionOptionsBar,
5598
5713
  {
5599
5714
  controller,
@@ -5604,9 +5719,9 @@ var ImageEditor = ({
5604
5719
  selectionDisplay: state.selectionDisplay
5605
5720
  }
5606
5721
  ),
5607
- selectionError && /* @__PURE__ */ jsx27("p", { role: "alert", className: "text-destructive", children: selectionError }),
5608
- /* @__PURE__ */ jsxs25("div", { className: "flex gap-1", children: [
5609
- /* @__PURE__ */ jsx27(
5722
+ selectionError && /* @__PURE__ */ jsx29("p", { role: "alert", className: "text-destructive", children: selectionError }),
5723
+ /* @__PURE__ */ jsxs27("div", { className: "flex gap-1", children: [
5724
+ /* @__PURE__ */ jsx29(
5610
5725
  "button",
5611
5726
  {
5612
5727
  type: "button",
@@ -5617,7 +5732,7 @@ var ImageEditor = ({
5617
5732
  children: "Transform Selection"
5618
5733
  }
5619
5734
  ),
5620
- /* @__PURE__ */ jsx27(
5735
+ /* @__PURE__ */ jsx29(
5621
5736
  "button",
5622
5737
  {
5623
5738
  type: "button",
@@ -5629,14 +5744,14 @@ var ImageEditor = ({
5629
5744
  }
5630
5745
  )
5631
5746
  ] }),
5632
- /* @__PURE__ */ jsx27(RefineEdgePanel, { controller, selection: state.selection ?? null, layers: state.adjustments.layers }),
5633
- /* @__PURE__ */ jsx27(ChannelsPanel, { controller }),
5634
- /* @__PURE__ */ jsx27(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 })
5635
5750
  ] }),
5636
- activeTab === "ai" && /* @__PURE__ */ jsxs25("div", { className: "flex flex-col gap-4 text-xs", children: [
5637
- /* @__PURE__ */ jsxs25("label", { className: "flex items-center justify-between gap-2 text-foreground", children: [
5638
- /* @__PURE__ */ jsx27("span", { children: "Results go to" }),
5639
- /* @__PURE__ */ jsxs25(
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(
5640
5755
  "select",
5641
5756
  {
5642
5757
  "aria-label": "AI result target",
@@ -5644,54 +5759,54 @@ var ImageEditor = ({
5644
5759
  onChange: (e) => setAiTarget(e.target.value),
5645
5760
  className: imageSelectClass,
5646
5761
  children: [
5647
- /* @__PURE__ */ jsx27("option", { value: "auto", children: controller.isMultiLayer ? "Auto (new layer)" : "Auto (replace image)" }),
5648
- /* @__PURE__ */ jsx27("option", { value: "new-layer", children: "New layer / mask" }),
5649
- /* @__PURE__ */ jsx27("option", { value: "replace", children: "Replace image" })
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" })
5650
5765
  ]
5651
5766
  }
5652
5767
  )
5653
5768
  ] }),
5654
- /* @__PURE__ */ jsxs25("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
5655
- /* @__PURE__ */ jsxs25("div", { className: "flex items-center justify-between", children: [
5656
- /* @__PURE__ */ jsxs25("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
5657
- /* @__PURE__ */ jsx27("svg", { className: "w-3.5 h-3.5 text-primary", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx27("path", { d: "M6 3v12M18 9a3 3 0 1 0 0-6 3 3 0 0 0 0 6zM6 21a3 3 0 1 0 0-6 3 3 0 0 0 0 6z" }) }),
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" }) }),
5658
5773
  "Background Removal"
5659
5774
  ] }),
5660
- isRemovingBg && /* @__PURE__ */ jsx27("span", { className: "inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium bg-primary/15 text-primary animate-pulse", children: "Removing..." })
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..." })
5661
5776
  ] }),
5662
- /* @__PURE__ */ jsx27("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Isolate foreground subject with AI alpha transparency segmentation." }),
5663
- /* @__PURE__ */ jsx27(
5777
+ /* @__PURE__ */ jsx29("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Isolate foreground subject with AI alpha transparency segmentation." }),
5778
+ /* @__PURE__ */ jsx29(
5664
5779
  "button",
5665
5780
  {
5666
5781
  type: "button",
5667
5782
  onClick: handleRemoveBackground,
5668
5783
  disabled: isRemovingBg || isInpainting,
5669
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",
5670
- children: isRemovingBg ? /* @__PURE__ */ jsxs25(Fragment8, { children: [
5671
- /* @__PURE__ */ jsx27("div", { className: imageSpinnerClass }),
5785
+ children: isRemovingBg ? /* @__PURE__ */ jsxs27(Fragment9, { children: [
5786
+ /* @__PURE__ */ jsx29("div", { className: imageSpinnerClass }),
5672
5787
  "Removing Background..."
5673
- ] }) : /* @__PURE__ */ jsxs25(Fragment8, { children: [
5674
- /* @__PURE__ */ jsx27("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx27("path", { d: "M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83" }) }),
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" }) }),
5675
5790
  "Remove Background"
5676
5791
  ] })
5677
5792
  }
5678
5793
  )
5679
5794
  ] }),
5680
- /* @__PURE__ */ jsxs25("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
5681
- /* @__PURE__ */ jsxs25("div", { className: "flex items-center justify-between", children: [
5682
- /* @__PURE__ */ jsxs25("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
5683
- /* @__PURE__ */ jsxs25("svg", { className: "w-3.5 h-3.5 text-primary", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
5684
- /* @__PURE__ */ jsx27("path", { d: "m21.64 3.64-1.28-1.28a1.2 1.2 0 0 0-1.7 0l-9.72 9.72-1.94 4.86 4.86-1.94 9.72-9.72a1.2 1.2 0 0 0 .06-1.64z" }),
5685
- /* @__PURE__ */ jsx27("path", { d: "m14 7 3 3" })
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" })
5686
5801
  ] }),
5687
5802
  "Generative Inpainting"
5688
5803
  ] }),
5689
- isInpainting && /* @__PURE__ */ jsx27("span", { className: "inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium bg-primary/15 text-primary animate-pulse", children: "Inpainting..." })
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..." })
5690
5805
  ] }),
5691
- /* @__PURE__ */ jsx27("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Replace, modify, or fill selected regions using prompt-guided generative inpainting." }),
5692
- /* @__PURE__ */ jsxs25("div", { className: "flex flex-col gap-1", children: [
5693
- /* @__PURE__ */ jsx27("label", { htmlFor: "ai-inpaint-prompt-react", className: "text-foreground text-[11px] font-medium", children: "Prompt" }),
5694
- /* @__PURE__ */ jsx27(
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(
5695
5810
  "textarea",
5696
5811
  {
5697
5812
  id: "ai-inpaint-prompt-react",
@@ -5703,10 +5818,10 @@ var ImageEditor = ({
5703
5818
  }
5704
5819
  )
5705
5820
  ] }),
5706
- /* @__PURE__ */ jsxs25("div", { className: "flex flex-col gap-1", children: [
5707
- /* @__PURE__ */ jsx27("span", { className: "text-foreground text-[11px] font-medium", children: "Target Mask Region" }),
5708
- /* @__PURE__ */ jsxs25("div", { className: "grid grid-cols-2 gap-1.5", children: [
5709
- /* @__PURE__ */ jsxs25(
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(
5710
5825
  "button",
5711
5826
  {
5712
5827
  type: "button",
@@ -5719,7 +5834,7 @@ var ImageEditor = ({
5719
5834
  ]
5720
5835
  }
5721
5836
  ),
5722
- /* @__PURE__ */ jsxs25(
5837
+ /* @__PURE__ */ jsxs27(
5723
5838
  "button",
5724
5839
  {
5725
5840
  type: "button",
@@ -5734,25 +5849,25 @@ var ImageEditor = ({
5734
5849
  )
5735
5850
  ] })
5736
5851
  ] }),
5737
- /* @__PURE__ */ jsx27(
5852
+ /* @__PURE__ */ jsx29(
5738
5853
  "button",
5739
5854
  {
5740
5855
  type: "button",
5741
5856
  onClick: handleInpaint,
5742
5857
  disabled: isInpainting || isRemovingBg || !inpaintPrompt.trim(),
5743
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",
5744
- children: isInpainting ? /* @__PURE__ */ jsxs25(Fragment8, { children: [
5745
- /* @__PURE__ */ jsx27("div", { className: imageSpinnerClass }),
5859
+ children: isInpainting ? /* @__PURE__ */ jsxs27(Fragment9, { children: [
5860
+ /* @__PURE__ */ jsx29("div", { className: imageSpinnerClass }),
5746
5861
  "Generating Inpaint..."
5747
- ] }) : /* @__PURE__ */ jsxs25(Fragment8, { children: [
5748
- /* @__PURE__ */ jsx27("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx27("path", { d: "M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83" }) }),
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" }) }),
5749
5864
  "Apply Inpainting"
5750
5865
  ] })
5751
5866
  }
5752
5867
  )
5753
5868
  ] }),
5754
- aiError && /* @__PURE__ */ jsx27("div", { className: "p-2.5 rounded-lg bg-destructive/10 border border-destructive/40 text-destructive text-[11px]", children: aiError }),
5755
- aiSuccess && /* @__PURE__ */ jsx27("div", { className: "p-2.5 rounded-lg bg-emerald-500/10 border border-emerald-500/30 text-emerald-600 text-[11px]", children: aiSuccess })
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 })
5756
5871
  ] })
5757
5872
  ] })
5758
5873
  ] })
@@ -5778,6 +5893,7 @@ export {
5778
5893
  AdjustmentLayersPanel,
5779
5894
  LayerEffectsPanel,
5780
5895
  EdgeColorPanel,
5896
+ VectorMaskEdgesPanel,
5781
5897
  LayersPanel,
5782
5898
  ImageEffectControls,
5783
5899
  ImageProviderEffectsPanel,
@@ -5789,6 +5905,7 @@ export {
5789
5905
  SelectionOptionsBar,
5790
5906
  MaskEdgeCheck,
5791
5907
  SelectionChangeCheck,
5908
+ SeparateSubjectPanel,
5792
5909
  RefineEdgePanel,
5793
5910
  ChannelsPanel,
5794
5911
  PathsPanel,