@pixerate/editor-react 0.95.0 → 0.96.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.
Files changed (47) hide show
  1. package/README.md +2 -0
  2. package/dist/animation-editor/index.cjs +1240 -195
  3. package/dist/animation-editor/index.js +4 -2
  4. package/dist/canvas/index.cjs +1418 -373
  5. package/dist/canvas/index.js +4 -2
  6. package/dist/chunk-3I7FOSLF.js +988 -0
  7. package/dist/{chunk-OTGJEYHV.js → chunk-5LFQ2UQZ.js} +75 -68
  8. package/dist/{chunk-5R67YSSD.js → chunk-GLSOQNQR.js} +1 -1
  9. package/dist/{chunk-6YRSQW2V.js → chunk-IY6YOY5B.js} +1 -1
  10. package/dist/chunk-KIRIU53A.js +72 -0
  11. package/dist/color/ColorPicker.d.cts +30 -0
  12. package/dist/color/ColorPicker.d.ts +30 -0
  13. package/dist/color/DualColorPicker.d.cts +29 -0
  14. package/dist/color/DualColorPicker.d.ts +29 -0
  15. package/dist/color/index.cjs +1067 -0
  16. package/dist/color/index.d.cts +7 -0
  17. package/dist/color/index.d.ts +7 -0
  18. package/dist/color/index.js +14 -0
  19. package/dist/color/useColorScheme.d.cts +16 -0
  20. package/dist/color/useColorScheme.d.ts +16 -0
  21. package/dist/effects/index.cjs +1169 -124
  22. package/dist/effects/index.js +4 -2
  23. package/dist/gradient/FillPicker.d.cts +27 -0
  24. package/dist/gradient/FillPicker.d.ts +27 -0
  25. package/dist/gradient/GradientEditor.d.cts +21 -0
  26. package/dist/gradient/GradientEditor.d.ts +21 -0
  27. package/dist/gradient/index.cjs +1601 -0
  28. package/dist/gradient/index.d.cts +6 -0
  29. package/dist/gradient/index.d.ts +6 -0
  30. package/dist/gradient/index.js +617 -0
  31. package/dist/gradient/useGradientController.d.cts +10 -0
  32. package/dist/gradient/useGradientController.d.ts +10 -0
  33. package/dist/image-editor/index.cjs +1742 -697
  34. package/dist/image-editor/index.js +5 -3
  35. package/dist/index.cjs +2160 -1115
  36. package/dist/index.js +5 -3
  37. package/dist/paint-editor/index.cjs +1233 -188
  38. package/dist/paint-editor/index.js +4 -2
  39. package/dist/parameters/fields.d.cts +1 -1
  40. package/dist/parameters/fields.d.ts +1 -1
  41. package/dist/parameters/index.cjs +1218 -173
  42. package/dist/parameters/index.js +3 -1
  43. package/dist/vector/index.cjs +1219 -174
  44. package/dist/vector/index.js +4 -2
  45. package/dist/video-editor/index.cjs +1230 -185
  46. package/dist/video-editor/index.js +4 -2
  47. package/package.json +29 -3
@@ -17,6 +17,7 @@ var __copyProps = (to, from, except, desc) => {
17
17
  }
18
18
  return to;
19
19
  };
20
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
20
21
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
22
  // If the importer is in node compatibility mode or this is not an ESM
22
23
  // file that has been converted to a CommonJS file using a Babel-
@@ -218,7 +219,7 @@ function useImageEffectsTools(registry, controller, options = {}) {
218
219
  }
219
220
 
220
221
  // src/image-editor/ImageEditor.tsx
221
- var import_react24 = __toESM(require("react"), 1);
222
+ var import_react27 = __toESM(require("react"), 1);
222
223
 
223
224
  // src/playback/AgentPlaybackContext.tsx
224
225
  var import_react2 = require("react");
@@ -1358,7 +1359,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
1358
1359
  };
1359
1360
 
1360
1361
  // src/image-editor/ImageProviderEffectsPanel.tsx
1361
- var import_react15 = __toESM(require("react"), 1);
1362
+ var import_react18 = __toESM(require("react"), 1);
1362
1363
  var import_image_editor8 = require("@pixerate/editor/image-editor");
1363
1364
 
1364
1365
  // src/effects/useEffects.ts
@@ -1498,14 +1499,1055 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
1498
1499
  }
1499
1500
 
1500
1501
  // src/effects/EffectParameters.tsx
1501
- var import_react14 = __toESM(require("react"), 1);
1502
+ var import_react17 = __toESM(require("react"), 1);
1502
1503
  var import_effects3 = require("@pixerate/editor/effects");
1503
1504
  var import_parameters2 = require("@pixerate/editor/parameters");
1504
1505
 
1505
1506
  // src/parameters/fields.tsx
1506
- var import_react13 = require("react");
1507
+ var import_react16 = require("react");
1507
1508
  var import_parameters = require("@pixerate/editor/parameters");
1509
+
1510
+ // src/color/index.ts
1511
+ var color_exports = {};
1512
+ __export(color_exports, {
1513
+ ColorPicker: () => ColorPicker,
1514
+ DualColorPicker: () => DualColorPicker,
1515
+ useColorScheme: () => useColorScheme,
1516
+ useResolvedColor: () => useResolvedColor
1517
+ });
1518
+
1519
+ // src/color/ColorPicker.tsx
1520
+ var import_react13 = require("react");
1521
+ var import_color = require("@pixerate/editor/color");
1508
1522
  var import_jsx_runtime11 = require("react/jsx-runtime");
1523
+ var LOCAL_STORAGE_KEY = "pixerate:color:recent";
1524
+ function readLocalRecents() {
1525
+ try {
1526
+ if (typeof localStorage === "undefined") return [];
1527
+ const raw = localStorage.getItem(LOCAL_STORAGE_KEY);
1528
+ if (!raw) return [];
1529
+ const parsed = JSON.parse(raw);
1530
+ return Array.isArray(parsed) ? parsed : [];
1531
+ } catch {
1532
+ return [];
1533
+ }
1534
+ }
1535
+ function writeLocalRecents(list) {
1536
+ try {
1537
+ if (typeof localStorage !== "undefined") {
1538
+ localStorage.setItem(LOCAL_STORAGE_KEY, JSON.stringify(list));
1539
+ }
1540
+ } catch {
1541
+ }
1542
+ }
1543
+ var CHECKERBOARD_BG = "repeating-conic-gradient(var(--pixerate-checker-a, #d4d4d8) 0 25%, var(--pixerate-checker-b, #ffffff) 0 50%)";
1544
+ var DEFAULT_PICKER_STATE = { h: 0, s: 1, v: 1, alpha: 1 };
1545
+ var ColorPicker = ({
1546
+ value,
1547
+ onChange,
1548
+ onGestureStart,
1549
+ onGestureEnd,
1550
+ alpha = false,
1551
+ swatches,
1552
+ recent: controlledRecent,
1553
+ onRecentChange,
1554
+ contrastAgainst,
1555
+ disabled = false,
1556
+ className,
1557
+ id,
1558
+ "aria-label": ariaLabel = "Color picker"
1559
+ }) => {
1560
+ const generatedId = (0, import_react13.useId)();
1561
+ const pickerId = id || generatedId;
1562
+ const [pickerState, setPickerState] = (0, import_react13.useState)(
1563
+ () => (0, import_color.pickerStateFromColor)(value) ?? DEFAULT_PICKER_STATE
1564
+ );
1565
+ const stateRef = (0, import_react13.useRef)(pickerState);
1566
+ stateRef.current = pickerState;
1567
+ (0, import_react13.useEffect)(() => {
1568
+ const next = (0, import_color.pickerStateFromColor)(value, stateRef.current);
1569
+ if (next) {
1570
+ setPickerState(next);
1571
+ }
1572
+ }, [value]);
1573
+ const [internalRecent, setInternalRecent] = (0, import_react13.useState)(
1574
+ () => controlledRecent ? [] : readLocalRecents()
1575
+ );
1576
+ const activeRecent = controlledRecent ?? internalRecent;
1577
+ const recordRecent = (0, import_react13.useCallback)(
1578
+ (color) => {
1579
+ const updated = (0, import_color.pushRecentColor)(activeRecent, color, 12);
1580
+ if (!controlledRecent) {
1581
+ setInternalRecent(updated);
1582
+ writeLocalRecents(updated);
1583
+ }
1584
+ onRecentChange?.(updated);
1585
+ },
1586
+ [activeRecent, controlledRecent, onRecentChange]
1587
+ );
1588
+ const [textDraft, setTextDraft] = (0, import_react13.useState)(value);
1589
+ const [isInvalid, setIsInvalid] = (0, import_react13.useState)(false);
1590
+ const [isClipped, setIsClipped] = (0, import_react13.useState)(false);
1591
+ const isTypingRef = (0, import_react13.useRef)(false);
1592
+ (0, import_react13.useEffect)(() => {
1593
+ if (!isTypingRef.current) {
1594
+ setTextDraft(value);
1595
+ setIsInvalid(false);
1596
+ const parsed = (0, import_color.parseColor)(value);
1597
+ setIsClipped(Boolean(parsed && !(0, import_color.inSrgbGamut)(parsed)));
1598
+ }
1599
+ }, [value]);
1600
+ const [hasEyeDropper, setHasEyeDropper] = (0, import_react13.useState)(false);
1601
+ (0, import_react13.useEffect)(() => {
1602
+ setHasEyeDropper(typeof window !== "undefined" && "EyeDropper" in window);
1603
+ }, []);
1604
+ const emitColorChange = (0, import_react13.useCallback)(
1605
+ (nextState) => {
1606
+ setPickerState(nextState);
1607
+ const hex = (0, import_color.pickerStateToHex)(nextState, alpha);
1608
+ onChange(hex);
1609
+ },
1610
+ [alpha, onChange]
1611
+ );
1612
+ const latest = (0, import_react13.useRef)({ emitColorChange, recordRecent, onGestureEnd, alpha });
1613
+ latest.current = { emitColorChange, recordRecent, onGestureEnd, alpha };
1614
+ const endDragRef = (0, import_react13.useRef)(null);
1615
+ (0, import_react13.useEffect)(() => () => endDragRef.current?.(), []);
1616
+ const startDrag = (e, next) => {
1617
+ if (disabled) return;
1618
+ e.preventDefault();
1619
+ endDragRef.current?.();
1620
+ onGestureStart?.();
1621
+ const rect = e.currentTarget.getBoundingClientRect();
1622
+ const update = (clientX, clientY) => {
1623
+ const x = Math.max(0, Math.min(1, (clientX - rect.left) / rect.width));
1624
+ const y = Math.max(0, Math.min(1, (clientY - rect.top) / rect.height));
1625
+ latest.current.emitColorChange(next(stateRef.current, x, y));
1626
+ };
1627
+ update(e.clientX, e.clientY);
1628
+ const onPointerMove = (ev) => update(ev.clientX, ev.clientY);
1629
+ const end = () => {
1630
+ window.removeEventListener("pointermove", onPointerMove);
1631
+ window.removeEventListener("pointerup", onPointerUp);
1632
+ window.removeEventListener("pointercancel", onPointerUp);
1633
+ endDragRef.current = null;
1634
+ latest.current.onGestureEnd?.();
1635
+ };
1636
+ const onPointerUp = () => {
1637
+ end();
1638
+ latest.current.recordRecent((0, import_color.pickerStateToHex)(stateRef.current, latest.current.alpha));
1639
+ };
1640
+ endDragRef.current = end;
1641
+ window.addEventListener("pointermove", onPointerMove);
1642
+ window.addEventListener("pointerup", onPointerUp);
1643
+ window.addEventListener("pointercancel", onPointerUp);
1644
+ };
1645
+ const handleAreaPointerDown = (e) => startDrag(e, (state, x, y) => (0, import_color.pickerStateFromArea)(state, x, y));
1646
+ const handleHuePointerDown = (e) => startDrag(e, (state, x) => (0, import_color.pickerStateFromHue)(state, x));
1647
+ const handleAlphaPointerDown = (e) => startDrag(e, (state, x) => (0, import_color.pickerStateFromAlpha)(state, x));
1648
+ const handleAreaKeyDown = (e) => {
1649
+ if (disabled) return;
1650
+ const next = (0, import_color.pickerKeyStep)(pickerState, "area", e.key, e.shiftKey);
1651
+ if (next) {
1652
+ e.preventDefault();
1653
+ emitColorChange(next);
1654
+ recordRecent((0, import_color.pickerStateToHex)(next, alpha));
1655
+ }
1656
+ };
1657
+ const handleHueKeyDown = (e) => {
1658
+ if (disabled) return;
1659
+ const next = (0, import_color.pickerKeyStep)(pickerState, "hue", e.key, e.shiftKey);
1660
+ if (next) {
1661
+ e.preventDefault();
1662
+ emitColorChange(next);
1663
+ recordRecent((0, import_color.pickerStateToHex)(next, alpha));
1664
+ }
1665
+ };
1666
+ const handleAlphaKeyDown = (e) => {
1667
+ if (disabled) return;
1668
+ const next = (0, import_color.pickerKeyStep)(pickerState, "alpha", e.key, e.shiftKey);
1669
+ if (next) {
1670
+ e.preventDefault();
1671
+ emitColorChange(next);
1672
+ recordRecent((0, import_color.pickerStateToHex)(next, alpha));
1673
+ }
1674
+ };
1675
+ const commitTextInput = (inputElement) => {
1676
+ isTypingRef.current = false;
1677
+ const parsed = (0, import_color.parseColor)(textDraft);
1678
+ if (parsed) {
1679
+ setIsInvalid(false);
1680
+ setIsClipped(!(0, import_color.inSrgbGamut)(parsed));
1681
+ const formatted = (0, import_color.formatHex)(parsed);
1682
+ onChange(formatted);
1683
+ recordRecent(formatted);
1684
+ } else {
1685
+ setIsInvalid(true);
1686
+ setTextDraft(value);
1687
+ if (inputElement) {
1688
+ inputElement.value = value;
1689
+ }
1690
+ }
1691
+ };
1692
+ const handleTextKeyDown = (e) => {
1693
+ if (e.key === "Enter") {
1694
+ e.preventDefault();
1695
+ commitTextInput(e.currentTarget);
1696
+ } else if (e.key === "Escape") {
1697
+ e.preventDefault();
1698
+ isTypingRef.current = false;
1699
+ setIsInvalid(false);
1700
+ setTextDraft(value);
1701
+ e.currentTarget.value = value;
1702
+ }
1703
+ };
1704
+ const handleEyeDropper = async () => {
1705
+ if (disabled || !hasEyeDropper) return;
1706
+ try {
1707
+ const EyeDropperClass = window.EyeDropper;
1708
+ const eyeDropper = new EyeDropperClass();
1709
+ const res = await eyeDropper.open();
1710
+ if (res?.sRGBHex) {
1711
+ onChange(res.sRGBHex);
1712
+ recordRecent(res.sRGBHex);
1713
+ }
1714
+ } catch {
1715
+ }
1716
+ };
1717
+ const contrastResult = (0, import_react13.useMemo)(() => {
1718
+ if (!contrastAgainst) return null;
1719
+ const fg = (0, import_color.parseColor)(value);
1720
+ const bg = (0, import_color.parseColor)(contrastAgainst);
1721
+ if (!fg || !bg) return null;
1722
+ const ratio = (0, import_color.contrastRatio)(fg, bg);
1723
+ const aa = ratio >= 4.5;
1724
+ const aaa = ratio >= 7;
1725
+ return { ratio, aa, aaa };
1726
+ }, [value, contrastAgainst]);
1727
+ const currentHex = (0, import_color.pickerStateToHex)(pickerState, alpha);
1728
+ const liveDescription = `Selected color: ${value}${contrastResult ? `, contrast ${contrastResult.ratio.toFixed(1)}:1 against ${contrastAgainst}, ${contrastResult.aa ? "passes AA" : "fails AA"}` : ""}`;
1729
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
1730
+ "div",
1731
+ {
1732
+ id: pickerId,
1733
+ role: "group",
1734
+ "aria-label": ariaLabel,
1735
+ className,
1736
+ style: {
1737
+ boxSizing: "border-box",
1738
+ width: "var(--pixerate-color-picker-width, 240px)",
1739
+ borderRadius: "var(--pixerate-color-picker-radius, 8px)",
1740
+ background: "var(--pixerate-color-picker-bg, #1f2430)",
1741
+ color: "var(--pixerate-color-picker-fg, #f0f2f5)",
1742
+ padding: "12px",
1743
+ display: "flex",
1744
+ flexDirection: "column",
1745
+ gap: "10px",
1746
+ fontFamily: "system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",
1747
+ fontSize: "12px",
1748
+ userSelect: "none",
1749
+ opacity: disabled ? 0.6 : 1,
1750
+ pointerEvents: disabled ? "none" : "auto"
1751
+ },
1752
+ children: [
1753
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1754
+ "span",
1755
+ {
1756
+ role: "status",
1757
+ "aria-live": "polite",
1758
+ style: {
1759
+ position: "absolute",
1760
+ width: "1px",
1761
+ height: "1px",
1762
+ padding: 0,
1763
+ margin: "-1px",
1764
+ overflow: "hidden",
1765
+ clip: "rect(0, 0, 0, 0)",
1766
+ whiteSpace: "nowrap",
1767
+ border: 0
1768
+ },
1769
+ children: liveDescription
1770
+ }
1771
+ ),
1772
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1773
+ "div",
1774
+ {
1775
+ role: "slider",
1776
+ tabIndex: disabled ? -1 : 0,
1777
+ "aria-label": "Saturation and brightness",
1778
+ "aria-valuetext": `Saturation ${Math.round(pickerState.s * 100)}%, Brightness ${Math.round(
1779
+ pickerState.v * 100
1780
+ )}%`,
1781
+ "aria-disabled": disabled,
1782
+ onPointerDown: handleAreaPointerDown,
1783
+ onKeyDown: handleAreaKeyDown,
1784
+ style: {
1785
+ position: "relative",
1786
+ width: "100%",
1787
+ height: "150px",
1788
+ borderRadius: "6px",
1789
+ background: (0, import_color.pickerAreaBackground)(pickerState),
1790
+ cursor: disabled ? "default" : "crosshair",
1791
+ touchAction: "none",
1792
+ outline: "none"
1793
+ },
1794
+ children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1795
+ "div",
1796
+ {
1797
+ style: {
1798
+ position: "absolute",
1799
+ width: "var(--pixerate-color-picker-thumb-size, 14px)",
1800
+ height: "var(--pixerate-color-picker-thumb-size, 14px)",
1801
+ borderRadius: "50%",
1802
+ transform: "translate(-50%, -50%)",
1803
+ left: `${pickerState.s * 100}%`,
1804
+ top: `${(1 - pickerState.v) * 100}%`,
1805
+ border: "2px solid #ffffff",
1806
+ boxShadow: "0 0 2px 1px rgba(0,0,0,0.6)",
1807
+ pointerEvents: "none",
1808
+ backgroundColor: currentHex
1809
+ }
1810
+ }
1811
+ )
1812
+ }
1813
+ ),
1814
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1815
+ "div",
1816
+ {
1817
+ role: "slider",
1818
+ tabIndex: disabled ? -1 : 0,
1819
+ "aria-label": "Hue",
1820
+ "aria-valuenow": Math.round(pickerState.h),
1821
+ "aria-valuemin": 0,
1822
+ "aria-valuemax": 360,
1823
+ "aria-valuetext": `${Math.round(pickerState.h)} degrees`,
1824
+ "aria-disabled": disabled,
1825
+ onPointerDown: handleHuePointerDown,
1826
+ onKeyDown: handleHueKeyDown,
1827
+ style: {
1828
+ position: "relative",
1829
+ width: "100%",
1830
+ height: "12px",
1831
+ borderRadius: "6px",
1832
+ background: import_color.PICKER_HUE_BACKGROUND,
1833
+ cursor: disabled ? "default" : "pointer",
1834
+ touchAction: "none",
1835
+ outline: "none"
1836
+ },
1837
+ children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1838
+ "div",
1839
+ {
1840
+ style: {
1841
+ position: "absolute",
1842
+ top: "50%",
1843
+ transform: "translate(-50%, -50%)",
1844
+ left: `${pickerState.h / 360 * 100}%`,
1845
+ width: "var(--pixerate-color-picker-thumb-size, 14px)",
1846
+ height: "var(--pixerate-color-picker-thumb-size, 14px)",
1847
+ borderRadius: "50%",
1848
+ border: "2px solid #ffffff",
1849
+ boxShadow: "0 0 2px 1px rgba(0,0,0,0.6)",
1850
+ pointerEvents: "none",
1851
+ backgroundColor: `hsl(${pickerState.h}, 100%, 50%)`
1852
+ }
1853
+ }
1854
+ )
1855
+ }
1856
+ ),
1857
+ alpha && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
1858
+ "div",
1859
+ {
1860
+ role: "slider",
1861
+ tabIndex: disabled ? -1 : 0,
1862
+ "aria-label": "Alpha",
1863
+ "aria-valuenow": Math.round(pickerState.alpha * 100),
1864
+ "aria-valuemin": 0,
1865
+ "aria-valuemax": 100,
1866
+ "aria-valuetext": `${Math.round(pickerState.alpha * 100)}%`,
1867
+ "aria-disabled": disabled,
1868
+ onPointerDown: handleAlphaPointerDown,
1869
+ onKeyDown: handleAlphaKeyDown,
1870
+ style: {
1871
+ position: "relative",
1872
+ width: "100%",
1873
+ height: "12px",
1874
+ borderRadius: "6px",
1875
+ backgroundImage: CHECKERBOARD_BG,
1876
+ backgroundSize: "8px 8px",
1877
+ cursor: disabled ? "default" : "pointer",
1878
+ touchAction: "none",
1879
+ outline: "none",
1880
+ overflow: "hidden"
1881
+ },
1882
+ children: [
1883
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1884
+ "div",
1885
+ {
1886
+ style: {
1887
+ position: "absolute",
1888
+ inset: 0,
1889
+ background: (0, import_color.pickerAlphaBackground)(pickerState)
1890
+ }
1891
+ }
1892
+ ),
1893
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1894
+ "div",
1895
+ {
1896
+ style: {
1897
+ position: "absolute",
1898
+ top: "50%",
1899
+ transform: "translate(-50%, -50%)",
1900
+ left: `${pickerState.alpha * 100}%`,
1901
+ width: "var(--pixerate-color-picker-thumb-size, 14px)",
1902
+ height: "var(--pixerate-color-picker-thumb-size, 14px)",
1903
+ borderRadius: "50%",
1904
+ border: "2px solid #ffffff",
1905
+ boxShadow: "0 0 2px 1px rgba(0,0,0,0.6)",
1906
+ pointerEvents: "none",
1907
+ backgroundColor: currentHex
1908
+ }
1909
+ }
1910
+ )
1911
+ ]
1912
+ }
1913
+ ),
1914
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "8px", marginTop: "2px" }, children: [
1915
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1916
+ "div",
1917
+ {
1918
+ style: {
1919
+ position: "relative",
1920
+ width: "28px",
1921
+ height: "28px",
1922
+ borderRadius: "4px",
1923
+ backgroundImage: CHECKERBOARD_BG,
1924
+ backgroundSize: "8px 8px",
1925
+ overflow: "hidden",
1926
+ flexShrink: 0,
1927
+ border: "1px solid rgba(255,255,255,0.15)"
1928
+ },
1929
+ children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1930
+ "div",
1931
+ {
1932
+ style: {
1933
+ width: "100%",
1934
+ height: "100%",
1935
+ backgroundColor: currentHex
1936
+ }
1937
+ }
1938
+ )
1939
+ }
1940
+ ),
1941
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1942
+ "input",
1943
+ {
1944
+ type: "text",
1945
+ value: textDraft,
1946
+ disabled,
1947
+ "aria-label": "Color hex or CSS string",
1948
+ "aria-invalid": isInvalid ? "true" : void 0,
1949
+ onChange: (e) => {
1950
+ isTypingRef.current = true;
1951
+ setTextDraft(e.target.value);
1952
+ setIsInvalid(false);
1953
+ },
1954
+ onKeyDown: handleTextKeyDown,
1955
+ onBlur: (e) => commitTextInput(e.currentTarget),
1956
+ style: {
1957
+ flex: 1,
1958
+ minWidth: 0,
1959
+ height: "28px",
1960
+ padding: "0 8px",
1961
+ fontSize: "12px",
1962
+ fontFamily: "monospace",
1963
+ borderRadius: "4px",
1964
+ border: isInvalid ? "1px solid #ef4444" : "1px solid rgba(255,255,255,0.2)",
1965
+ background: "rgba(0,0,0,0.2)",
1966
+ color: "inherit",
1967
+ outline: "none"
1968
+ }
1969
+ }
1970
+ ),
1971
+ hasEyeDropper && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1972
+ "button",
1973
+ {
1974
+ type: "button",
1975
+ disabled,
1976
+ "aria-label": "Pick color from screen",
1977
+ title: "Pick color from screen",
1978
+ onClick: handleEyeDropper,
1979
+ style: {
1980
+ display: "inline-flex",
1981
+ alignItems: "center",
1982
+ justifyContent: "center",
1983
+ width: "28px",
1984
+ height: "28px",
1985
+ borderRadius: "4px",
1986
+ border: "1px solid rgba(255,255,255,0.2)",
1987
+ background: "transparent",
1988
+ color: "inherit",
1989
+ cursor: disabled ? "default" : "pointer"
1990
+ },
1991
+ children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
1992
+ "svg",
1993
+ {
1994
+ width: "14",
1995
+ height: "14",
1996
+ viewBox: "0 0 24 24",
1997
+ fill: "none",
1998
+ stroke: "currentColor",
1999
+ strokeWidth: "2",
2000
+ strokeLinecap: "round",
2001
+ strokeLinejoin: "round",
2002
+ children: [
2003
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: "m19 11-8-8-8.5 8.5a2.12 2.12 0 0 0 0 3l2.5 2.5 1.5-1.5" }),
2004
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: "m5 16-3 3 1 1 3-3" }),
2005
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: "m14 6 4 4" })
2006
+ ]
2007
+ }
2008
+ )
2009
+ }
2010
+ )
2011
+ ] }),
2012
+ isClipped && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2013
+ "div",
2014
+ {
2015
+ role: "note",
2016
+ title: "This colour was outside standard sRGB and clipped.",
2017
+ style: {
2018
+ display: "inline-flex",
2019
+ alignItems: "center",
2020
+ gap: "4px",
2021
+ fontSize: "10px",
2022
+ color: "#f59e0b",
2023
+ background: "rgba(245, 158, 11, 0.1)",
2024
+ padding: "2px 6px",
2025
+ borderRadius: "4px",
2026
+ alignSelf: "flex-start"
2027
+ },
2028
+ children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { children: "\u26A0 Clipped to sRGB" })
2029
+ }
2030
+ ),
2031
+ contrastResult && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
2032
+ "div",
2033
+ {
2034
+ style: {
2035
+ display: "flex",
2036
+ alignItems: "center",
2037
+ justifyContent: "space-between",
2038
+ fontSize: "11px",
2039
+ padding: "4px 8px",
2040
+ borderRadius: "4px",
2041
+ background: "rgba(255,255,255,0.05)",
2042
+ border: "1px solid rgba(255,255,255,0.1)"
2043
+ },
2044
+ children: [
2045
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { children: [
2046
+ "Contrast: ",
2047
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("strong", { children: [
2048
+ contrastResult.ratio.toFixed(2),
2049
+ ":1"
2050
+ ] })
2051
+ ] }),
2052
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: { display: "flex", gap: "6px" }, children: [
2053
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
2054
+ "span",
2055
+ {
2056
+ style: {
2057
+ color: contrastResult.aa ? "#10b981" : "#ef4444",
2058
+ fontWeight: 600
2059
+ },
2060
+ children: [
2061
+ "AA ",
2062
+ contrastResult.aa ? "\u2713" : "\u2717"
2063
+ ]
2064
+ }
2065
+ ),
2066
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
2067
+ "span",
2068
+ {
2069
+ style: {
2070
+ color: contrastResult.aaa ? "#10b981" : "#ef4444",
2071
+ fontWeight: 600
2072
+ },
2073
+ children: [
2074
+ "AAA ",
2075
+ contrastResult.aaa ? "\u2713" : "\u2717"
2076
+ ]
2077
+ }
2078
+ )
2079
+ ] })
2080
+ ]
2081
+ }
2082
+ ),
2083
+ swatches && swatches.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: "4px" }, children: [
2084
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { style: { fontSize: "10px", textTransform: "uppercase", opacity: 0.6 }, children: "Palette" }),
2085
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { style: { display: "flex", flexWrap: "wrap", gap: "4px" }, children: swatches.map((color, idx) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2086
+ "button",
2087
+ {
2088
+ type: "button",
2089
+ "data-testid": "color-picker-swatch",
2090
+ title: color,
2091
+ disabled,
2092
+ "aria-label": `Color ${color}`,
2093
+ onClick: () => {
2094
+ onChange(color);
2095
+ recordRecent(color);
2096
+ },
2097
+ style: {
2098
+ width: "18px",
2099
+ height: "18px",
2100
+ borderRadius: "3px",
2101
+ backgroundColor: color,
2102
+ border: color.toLowerCase() === value.toLowerCase() ? "2px solid #ffffff" : "1px solid rgba(255,255,255,0.2)",
2103
+ cursor: disabled ? "default" : "pointer",
2104
+ padding: 0,
2105
+ outline: "none"
2106
+ }
2107
+ },
2108
+ `${color}-${idx}`
2109
+ )) })
2110
+ ] }),
2111
+ activeRecent.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: "4px" }, children: [
2112
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { style: { fontSize: "10px", textTransform: "uppercase", opacity: 0.6 }, children: "Recent" }),
2113
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { style: { display: "flex", flexWrap: "wrap", gap: "4px" }, children: activeRecent.map((color, idx) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2114
+ "button",
2115
+ {
2116
+ type: "button",
2117
+ "data-testid": "color-picker-recent",
2118
+ disabled,
2119
+ "aria-label": `Color ${color}`,
2120
+ onClick: () => {
2121
+ onChange(color);
2122
+ recordRecent(color);
2123
+ },
2124
+ style: {
2125
+ width: "18px",
2126
+ height: "18px",
2127
+ borderRadius: "3px",
2128
+ backgroundColor: color,
2129
+ border: color.toLowerCase() === value.toLowerCase() ? "2px solid #ffffff" : "1px solid rgba(255,255,255,0.2)",
2130
+ cursor: disabled ? "default" : "pointer",
2131
+ padding: 0,
2132
+ outline: "none"
2133
+ }
2134
+ },
2135
+ `recent-${color}-${idx}`
2136
+ )) })
2137
+ ] })
2138
+ ]
2139
+ }
2140
+ );
2141
+ };
2142
+
2143
+ // src/color/DualColorPicker.tsx
2144
+ var import_react14 = require("react");
2145
+ var import_color2 = require("@pixerate/editor/color");
2146
+ var import_jsx_runtime12 = require("react/jsx-runtime");
2147
+ function DualColorPicker({
2148
+ value,
2149
+ onChange,
2150
+ onGestureStart,
2151
+ onGestureEnd,
2152
+ scheme: controlledScheme,
2153
+ onSchemeChange,
2154
+ surfaces = import_color2.DEFAULT_SCHEME_SURFACES,
2155
+ contrastAgainst,
2156
+ alpha = false,
2157
+ swatches,
2158
+ disabled = false,
2159
+ className = ""
2160
+ }) {
2161
+ const sameId = (0, import_react14.useId)();
2162
+ const [internalScheme, setInternalScheme] = (0, import_react14.useState)("light");
2163
+ const activeScheme = controlledScheme ?? internalScheme;
2164
+ const handleSchemeSelect = (nextScheme) => {
2165
+ if (onSchemeChange) {
2166
+ onSchemeChange(nextScheme);
2167
+ } else {
2168
+ setInternalScheme(nextScheme);
2169
+ }
2170
+ };
2171
+ const dual = (0, import_color2.normalizeDualColor)(value) ?? { light: "#000000", dark: "#000000" };
2172
+ const isSame = dual.light.toLowerCase() === dual.dark.toLowerCase();
2173
+ const [sameInBoth, setSameInBoth] = (0, import_react14.useState)(isSame);
2174
+ const handleSameToggle = (e) => {
2175
+ const nextSame = e.target.checked;
2176
+ setSameInBoth(nextSame);
2177
+ if (nextSame) {
2178
+ const activeVal = activeScheme === "dark" ? dual.dark : dual.light;
2179
+ onChange({ light: activeVal, dark: activeVal });
2180
+ }
2181
+ };
2182
+ const handleDerive = () => {
2183
+ if (disabled) return;
2184
+ onGestureStart?.();
2185
+ const currentActive = activeScheme === "dark" ? dual.dark : dual.light;
2186
+ const derived = (0, import_color2.deriveDualColor)(currentActive, {
2187
+ from: activeScheme,
2188
+ // An unreadable surfaces prop falls back to the defaults rather than throwing.
2189
+ surfaces: (0, import_color2.normalizeDualColor)(surfaces) ?? import_color2.DEFAULT_SCHEME_SURFACES
2190
+ });
2191
+ onChange(derived);
2192
+ onGestureEnd?.();
2193
+ };
2194
+ const handleInnerChange = (hex) => {
2195
+ if (sameInBoth) {
2196
+ onChange({ light: hex, dark: hex });
2197
+ } else {
2198
+ const updated = (0, import_color2.setDualColorSide)(dual, activeScheme, hex);
2199
+ onChange(updated);
2200
+ }
2201
+ };
2202
+ const activeColor = activeScheme === "dark" ? dual.dark : dual.light;
2203
+ const activeContrastTarget = contrastAgainst ? (0, import_color2.resolveColor)(contrastAgainst, activeScheme) ?? void 0 : void 0;
2204
+ const dualContrast = contrastAgainst && (0, import_color2.normalizeDualColor)(contrastAgainst) ? (0, import_color2.checkDualColorContrast)(dual, contrastAgainst) : null;
2205
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
2206
+ "div",
2207
+ {
2208
+ className: `pixerate-dual-color-picker ${className}`,
2209
+ style: {
2210
+ display: "flex",
2211
+ flexDirection: "column",
2212
+ gap: "12px",
2213
+ padding: "12px",
2214
+ background: "#1a1d24",
2215
+ color: "#e2e8f0",
2216
+ borderRadius: "10px",
2217
+ boxShadow: "0 4px 12px rgba(0,0,0,0.3)",
2218
+ width: "260px",
2219
+ fontFamily: "system-ui, -apple-system, sans-serif",
2220
+ fontSize: "13px",
2221
+ boxSizing: "border-box"
2222
+ },
2223
+ children: [
2224
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
2225
+ "div",
2226
+ {
2227
+ role: "tablist",
2228
+ "aria-label": "Color scheme mode",
2229
+ style: {
2230
+ display: "flex",
2231
+ background: "#111318",
2232
+ borderRadius: "6px",
2233
+ padding: "2px",
2234
+ gap: "2px"
2235
+ },
2236
+ children: [
2237
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2238
+ "button",
2239
+ {
2240
+ type: "button",
2241
+ role: "tab",
2242
+ "aria-selected": activeScheme === "light",
2243
+ onClick: () => handleSchemeSelect("light"),
2244
+ disabled,
2245
+ style: {
2246
+ flex: 1,
2247
+ padding: "6px 8px",
2248
+ border: "none",
2249
+ borderRadius: "4px",
2250
+ background: activeScheme === "light" ? "#2d3342" : "transparent",
2251
+ color: activeScheme === "light" ? "#ffffff" : "#8c95a6",
2252
+ fontWeight: activeScheme === "light" ? 600 : 400,
2253
+ cursor: disabled ? "not-allowed" : "pointer",
2254
+ fontSize: "12px",
2255
+ transition: "all 0.15s ease"
2256
+ },
2257
+ children: "Light"
2258
+ }
2259
+ ),
2260
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2261
+ "button",
2262
+ {
2263
+ type: "button",
2264
+ role: "tab",
2265
+ "aria-selected": activeScheme === "dark",
2266
+ onClick: () => handleSchemeSelect("dark"),
2267
+ disabled,
2268
+ style: {
2269
+ flex: 1,
2270
+ padding: "6px 8px",
2271
+ border: "none",
2272
+ borderRadius: "4px",
2273
+ background: activeScheme === "dark" ? "#2d3342" : "transparent",
2274
+ color: activeScheme === "dark" ? "#ffffff" : "#8c95a6",
2275
+ fontWeight: activeScheme === "dark" ? 600 : 400,
2276
+ cursor: disabled ? "not-allowed" : "pointer",
2277
+ fontSize: "12px",
2278
+ transition: "all 0.15s ease"
2279
+ },
2280
+ children: "Dark"
2281
+ }
2282
+ )
2283
+ ]
2284
+ }
2285
+ ),
2286
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { style: { display: "flex", gap: "8px" }, children: [
2287
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
2288
+ "button",
2289
+ {
2290
+ type: "button",
2291
+ onClick: () => handleSchemeSelect("light"),
2292
+ disabled,
2293
+ title: "Edit light mode colour",
2294
+ style: {
2295
+ flex: 1,
2296
+ display: "flex",
2297
+ flexDirection: "column",
2298
+ alignItems: "center",
2299
+ gap: "6px",
2300
+ padding: "8px",
2301
+ background: surfaces.light,
2302
+ color: "#000000",
2303
+ border: activeScheme === "light" ? "2px solid #3b82f6" : "1px solid #333842",
2304
+ borderRadius: "6px",
2305
+ cursor: disabled ? "not-allowed" : "pointer",
2306
+ outline: "none"
2307
+ },
2308
+ children: [
2309
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2310
+ "span",
2311
+ {
2312
+ style: {
2313
+ width: "100%",
2314
+ height: "24px",
2315
+ borderRadius: "4px",
2316
+ background: dual.light,
2317
+ border: "1px solid rgba(0,0,0,0.15)"
2318
+ }
2319
+ }
2320
+ ),
2321
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { style: { fontSize: "11px", fontWeight: 600 }, children: "Light" })
2322
+ ]
2323
+ }
2324
+ ),
2325
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
2326
+ "button",
2327
+ {
2328
+ type: "button",
2329
+ onClick: () => handleSchemeSelect("dark"),
2330
+ disabled,
2331
+ title: "Edit dark mode colour",
2332
+ style: {
2333
+ flex: 1,
2334
+ display: "flex",
2335
+ flexDirection: "column",
2336
+ alignItems: "center",
2337
+ gap: "6px",
2338
+ padding: "8px",
2339
+ background: surfaces.dark,
2340
+ color: "#ffffff",
2341
+ border: activeScheme === "dark" ? "2px solid #3b82f6" : "1px solid #333842",
2342
+ borderRadius: "6px",
2343
+ cursor: disabled ? "not-allowed" : "pointer",
2344
+ outline: "none"
2345
+ },
2346
+ children: [
2347
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2348
+ "span",
2349
+ {
2350
+ style: {
2351
+ width: "100%",
2352
+ height: "24px",
2353
+ borderRadius: "4px",
2354
+ background: dual.dark,
2355
+ border: "1px solid rgba(255,255,255,0.15)"
2356
+ }
2357
+ }
2358
+ ),
2359
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { style: { fontSize: "11px", fontWeight: 600 }, children: "Dark" })
2360
+ ]
2361
+ }
2362
+ )
2363
+ ] }),
2364
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
2365
+ "div",
2366
+ {
2367
+ style: {
2368
+ display: "flex",
2369
+ alignItems: "center",
2370
+ justifyContent: "space-between",
2371
+ gap: "8px",
2372
+ padding: "2px 0"
2373
+ },
2374
+ children: [
2375
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
2376
+ "label",
2377
+ {
2378
+ htmlFor: sameId,
2379
+ style: {
2380
+ display: "flex",
2381
+ alignItems: "center",
2382
+ gap: "6px",
2383
+ cursor: disabled ? "not-allowed" : "pointer",
2384
+ userSelect: "none",
2385
+ fontSize: "12px",
2386
+ color: "#c4cad4"
2387
+ },
2388
+ children: [
2389
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2390
+ "input",
2391
+ {
2392
+ id: sameId,
2393
+ type: "checkbox",
2394
+ checked: sameInBoth,
2395
+ onChange: handleSameToggle,
2396
+ disabled,
2397
+ style: { cursor: disabled ? "not-allowed" : "pointer" }
2398
+ }
2399
+ ),
2400
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { children: "Same in both" })
2401
+ ]
2402
+ }
2403
+ ),
2404
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2405
+ "button",
2406
+ {
2407
+ type: "button",
2408
+ onClick: handleDerive,
2409
+ disabled,
2410
+ style: {
2411
+ padding: "4px 10px",
2412
+ background: "#2d3342",
2413
+ color: "#e2e8f0",
2414
+ border: "1px solid #3b4252",
2415
+ borderRadius: "4px",
2416
+ fontSize: "11px",
2417
+ fontWeight: 500,
2418
+ cursor: disabled ? "not-allowed" : "pointer"
2419
+ },
2420
+ children: "Derive"
2421
+ }
2422
+ )
2423
+ ]
2424
+ }
2425
+ ),
2426
+ dualContrast && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
2427
+ "div",
2428
+ {
2429
+ "data-testid": "dual-contrast-summary",
2430
+ style: {
2431
+ display: "flex",
2432
+ justifyContent: "space-between",
2433
+ background: "#111318",
2434
+ padding: "6px 8px",
2435
+ borderRadius: "6px",
2436
+ fontSize: "11px",
2437
+ color: "#8c95a6"
2438
+ },
2439
+ children: [
2440
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { children: [
2441
+ "Light:",
2442
+ " ",
2443
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("strong", { style: { color: dualContrast.light.level === "fail" ? "#ef4444" : "#22c55e" }, children: [
2444
+ dualContrast.light.ratio.toFixed(2),
2445
+ " (",
2446
+ dualContrast.light.level,
2447
+ ")"
2448
+ ] })
2449
+ ] }),
2450
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { children: [
2451
+ "Dark:",
2452
+ " ",
2453
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("strong", { style: { color: dualContrast.dark.level === "fail" ? "#ef4444" : "#22c55e" }, children: [
2454
+ dualContrast.dark.ratio.toFixed(2),
2455
+ " (",
2456
+ dualContrast.dark.level,
2457
+ ")"
2458
+ ] })
2459
+ ] })
2460
+ ]
2461
+ }
2462
+ ),
2463
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2464
+ ColorPicker,
2465
+ {
2466
+ value: activeColor,
2467
+ onChange: handleInnerChange,
2468
+ onGestureStart,
2469
+ onGestureEnd,
2470
+ contrastAgainst: activeContrastTarget,
2471
+ alpha,
2472
+ swatches,
2473
+ disabled
2474
+ }
2475
+ )
2476
+ ]
2477
+ }
2478
+ );
2479
+ }
2480
+
2481
+ // src/color/useColorScheme.ts
2482
+ var import_react15 = require("react");
2483
+ var import_color3 = require("@pixerate/editor/color");
2484
+ function getSnapshot(attribute) {
2485
+ if (typeof window === "undefined" || typeof document === "undefined") {
2486
+ return "light";
2487
+ }
2488
+ if (attribute) {
2489
+ const el = document.documentElement;
2490
+ if (attribute === "class") {
2491
+ return el.classList.contains("dark") ? "dark" : "light";
2492
+ }
2493
+ const val = el.getAttribute(attribute);
2494
+ return val === "dark" ? "dark" : "light";
2495
+ }
2496
+ if (typeof window.matchMedia === "function") {
2497
+ return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
2498
+ }
2499
+ return "light";
2500
+ }
2501
+ function getServerSnapshot() {
2502
+ return "light";
2503
+ }
2504
+ function useColorScheme(options) {
2505
+ const override = options?.override;
2506
+ const attribute = options?.attribute;
2507
+ const subscribe = (0, import_react15.useMemo)(() => {
2508
+ return (callback) => {
2509
+ if (typeof window === "undefined" || typeof document === "undefined") {
2510
+ return () => {
2511
+ };
2512
+ }
2513
+ if (attribute) {
2514
+ const observer = new MutationObserver(() => {
2515
+ callback();
2516
+ });
2517
+ observer.observe(document.documentElement, {
2518
+ attributes: true,
2519
+ attributeFilter: [attribute]
2520
+ });
2521
+ return () => observer.disconnect();
2522
+ }
2523
+ if (typeof window.matchMedia === "function") {
2524
+ const mql = window.matchMedia("(prefers-color-scheme: dark)");
2525
+ const handler = () => callback();
2526
+ mql.addEventListener("change", handler);
2527
+ return () => mql.removeEventListener("change", handler);
2528
+ }
2529
+ return () => {
2530
+ };
2531
+ };
2532
+ }, [attribute]);
2533
+ const detected = (0, import_react15.useSyncExternalStore)(
2534
+ subscribe,
2535
+ () => getSnapshot(attribute),
2536
+ getServerSnapshot
2537
+ );
2538
+ return override ?? detected;
2539
+ }
2540
+ function useResolvedColor(value, scheme) {
2541
+ const detectedScheme = useColorScheme();
2542
+ const activeScheme = scheme ?? detectedScheme;
2543
+ return (0, import_color3.resolveColor)(value, activeScheme);
2544
+ }
2545
+
2546
+ // src/color/index.ts
2547
+ __reExport(color_exports, require("@pixerate/editor/color"));
2548
+
2549
+ // src/parameters/fields.tsx
2550
+ var import_jsx_runtime13 = require("react/jsx-runtime");
1509
2551
  var parameterInputClass = "h-7 w-full min-w-0 rounded-md border border-input bg-background px-2 text-xs text-foreground tabular-nums focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary disabled:cursor-not-allowed disabled:opacity-50";
1510
2552
  var parameterButtonClass = "inline-flex h-7 items-center justify-center gap-1 rounded-md border border-input bg-background px-2 text-xs text-foreground hover:bg-muted focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary disabled:pointer-events-none disabled:opacity-50";
1511
2553
  var rangeClass = "h-4 w-full min-w-0 flex-1 cursor-pointer accent-primary disabled:cursor-not-allowed disabled:opacity-50";
@@ -1529,7 +2571,7 @@ function ParameterCommitInput({ value, onCommit, multiline, className, onKeyDown
1529
2571
  onKeyDown: keyDown,
1530
2572
  ...rest
1531
2573
  };
1532
- return multiline ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("textarea", { ...props, className: `${props.className} h-auto min-h-[3.5rem] py-1` }, value) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("input", { type: "text", ...props }, value);
2574
+ return multiline ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("textarea", { ...props, className: `${props.className} h-auto min-h-[3.5rem] py-1` }, value) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("input", { type: "text", ...props }, value);
1533
2575
  }
1534
2576
  var plainNumber = (field, value) => (0, import_parameters.formatParameterNumber)({ ...field, unit: void 0 }, value);
1535
2577
  function ParameterNumberInput({
@@ -1540,8 +2582,8 @@ function ParameterNumberInput({
1540
2582
  id,
1541
2583
  "aria-label": ariaLabel
1542
2584
  }) {
1543
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "relative min-w-0 flex-1", children: [
1544
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2585
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "relative min-w-0 flex-1", children: [
2586
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1545
2587
  ParameterCommitInput,
1546
2588
  {
1547
2589
  id,
@@ -1563,21 +2605,21 @@ function ParameterNumberInput({
1563
2605
  }
1564
2606
  }
1565
2607
  ),
1566
- field.unit && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "pointer-events-none absolute right-2 top-1/2 -translate-y-1/2 text-[10px] text-muted-foreground", children: field.unit })
2608
+ field.unit && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "pointer-events-none absolute right-2 top-1/2 -translate-y-1/2 text-[10px] text-muted-foreground", children: field.unit })
1567
2609
  ] });
1568
2610
  }
1569
2611
  function ParameterSlider(props) {
1570
2612
  const { field, value, onChange, onGestureStart, onGestureEnd, disabled } = props;
1571
- const dragging = (0, import_react13.useRef)(false);
2613
+ const dragging = (0, import_react16.useRef)(false);
1572
2614
  const end = () => {
1573
2615
  if (!dragging.current) return;
1574
2616
  dragging.current = false;
1575
2617
  onGestureEnd?.();
1576
2618
  };
1577
- if (!(0, import_parameters.isSliderField)(field)) return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ParameterNumberInput, { ...props });
2619
+ if (!(0, import_parameters.isSliderField)(field)) return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ParameterNumberInput, { ...props });
1578
2620
  const step = (0, import_parameters.parameterStep)(field);
1579
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex items-center gap-2", children: [
1580
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2621
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex items-center gap-2", children: [
2622
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1581
2623
  "input",
1582
2624
  {
1583
2625
  type: "range",
@@ -1600,11 +2642,11 @@ function ParameterSlider(props) {
1600
2642
  onChange: (e) => onChange((0, import_parameters.clampParameterNumber)(field, Number(e.target.value)))
1601
2643
  }
1602
2644
  ),
1603
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "w-20 shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ParameterNumberInput, { ...props, id: props.id, "aria-label": `${(0, import_parameters.parameterLabel)(field)} value` }) })
2645
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "w-20 shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ParameterNumberInput, { ...props, id: props.id, "aria-label": `${(0, import_parameters.parameterLabel)(field)} value` }) })
1604
2646
  ] });
1605
2647
  }
1606
2648
  function ParameterToggle({ field, value, onChange, disabled, id }) {
1607
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2649
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1608
2650
  "button",
1609
2651
  {
1610
2652
  type: "button",
@@ -1615,7 +2657,7 @@ function ParameterToggle({ field, value, onChange, disabled, id }) {
1615
2657
  disabled: disabled || field.readOnly,
1616
2658
  onClick: () => onChange(!value),
1617
2659
  className: `relative inline-flex h-5 w-9 shrink-0 items-center rounded-full border border-transparent transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary disabled:opacity-50 ${value ? "bg-primary" : "bg-muted"}`,
1618
- children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2660
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1619
2661
  "span",
1620
2662
  {
1621
2663
  className: `pointer-events-none block h-4 w-4 rounded-full bg-background shadow transition-transform ${value ? "translate-x-4" : "translate-x-0.5"}`
@@ -1628,7 +2670,7 @@ function ParameterSelect({ field, value, onChange, disabled, id }) {
1628
2670
  const options = (0, import_parameters.getChoiceOptions)(field);
1629
2671
  const off = disabled || field.readOnly;
1630
2672
  if (field.control === "segmented") {
1631
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { role: "radiogroup", "aria-label": (0, import_parameters.parameterLabel)(field), className: "inline-flex flex-wrap rounded-md border border-input bg-muted p-0.5", children: options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2673
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { role: "radiogroup", "aria-label": (0, import_parameters.parameterLabel)(field), className: "inline-flex flex-wrap rounded-md border border-input bg-muted p-0.5", children: options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1632
2674
  "button",
1633
2675
  {
1634
2676
  type: "button",
@@ -1644,7 +2686,7 @@ function ParameterSelect({ field, value, onChange, disabled, id }) {
1644
2686
  )) });
1645
2687
  }
1646
2688
  const index = options.findIndex((o) => o.value === value);
1647
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2689
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1648
2690
  "select",
1649
2691
  {
1650
2692
  id,
@@ -1656,53 +2698,64 @@ function ParameterSelect({ field, value, onChange, disabled, id }) {
1656
2698
  if (option) onChange(option.value);
1657
2699
  },
1658
2700
  className: parameterInputClass,
1659
- children: options.map((o, i) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("option", { value: String(i), title: o.description, children: (0, import_parameters.choiceOptionLabel)(o) }, String(o.value)))
2701
+ children: options.map((o, i) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("option", { value: String(i), title: o.description, children: (0, import_parameters.choiceOptionLabel)(o) }, String(o.value)))
1660
2702
  }
1661
2703
  );
1662
2704
  }
1663
2705
  function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd, disabled, id }) {
1664
- const picking = (0, import_react13.useRef)(false);
2706
+ const [open, setOpen] = (0, import_react16.useState)(false);
2707
+ const containerRef = (0, import_react16.useRef)(null);
2708
+ const buttonRef = (0, import_react16.useRef)(null);
2709
+ const popoverRef = (0, import_react16.useRef)(null);
1665
2710
  const alpha = !!field.alpha;
1666
2711
  const hex = (0, import_parameters.normalizeHexColor)(value, true) ?? "#000000ff";
1667
2712
  const rgb = hex.slice(0, 7);
1668
- const a = hex.slice(7);
2713
+ const shown = alpha ? hex : rgb;
1669
2714
  const off = disabled || field.readOnly;
1670
- const start = () => {
1671
- if (picking.current) return;
1672
- picking.current = true;
1673
- onGestureStart?.();
1674
- };
1675
- const end = () => {
1676
- if (!picking.current) return;
1677
- picking.current = false;
1678
- onGestureEnd?.();
1679
- };
1680
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "space-y-1.5", children: [
1681
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex items-center gap-2", children: [
1682
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { className: "relative h-7 w-9 shrink-0 overflow-hidden rounded-md border border-input bg-[repeating-conic-gradient(#d4d4d8_0_25%,#fff_0_50%)] bg-[length:8px_8px]", children: [
1683
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "absolute inset-0", style: { background: alpha ? hex : rgb } }),
1684
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1685
- "input",
1686
- {
1687
- type: "color",
1688
- "aria-label": (0, import_parameters.parameterLabel)(field),
1689
- value: rgb,
1690
- disabled: off,
1691
- className: "absolute inset-0 h-full w-full cursor-pointer opacity-0 disabled:cursor-not-allowed",
1692
- onChange: (e) => {
1693
- start();
1694
- onChange(alpha ? `${e.target.value}${a}` : e.target.value);
1695
- },
1696
- onBlur: end
1697
- }
1698
- )
1699
- ] }),
1700
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2715
+ const name = (0, import_parameters.parameterLabel)(field);
2716
+ (0, import_react16.useEffect)(() => {
2717
+ if (!open) return;
2718
+ const onPointerDown = (e) => {
2719
+ if (containerRef.current && !containerRef.current.contains(e.target)) {
2720
+ setOpen(false);
2721
+ }
2722
+ };
2723
+ const onKeyDown = (e) => {
2724
+ if (e.key === "Escape") {
2725
+ e.stopPropagation();
2726
+ setOpen(false);
2727
+ buttonRef.current?.focus();
2728
+ }
2729
+ };
2730
+ window.addEventListener("pointerdown", onPointerDown, true);
2731
+ window.addEventListener("keydown", onKeyDown, true);
2732
+ return () => {
2733
+ window.removeEventListener("pointerdown", onPointerDown, true);
2734
+ window.removeEventListener("keydown", onKeyDown, true);
2735
+ };
2736
+ }, [open]);
2737
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { ref: containerRef, className: "relative space-y-1.5", children: [
2738
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex items-center gap-2", children: [
2739
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2740
+ "button",
2741
+ {
2742
+ ref: buttonRef,
2743
+ type: "button",
2744
+ "aria-label": name,
2745
+ "aria-expanded": open,
2746
+ "aria-haspopup": "dialog",
2747
+ disabled: off,
2748
+ onClick: () => setOpen((prev) => !prev),
2749
+ className: "relative h-7 w-9 shrink-0 overflow-hidden rounded-md border border-input bg-[repeating-conic-gradient(#d4d4d8_0_25%,#fff_0_50%)] bg-[length:8px_8px] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary disabled:cursor-not-allowed disabled:opacity-50",
2750
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "absolute inset-0", style: { background: shown } })
2751
+ }
2752
+ ),
2753
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1701
2754
  ParameterCommitInput,
1702
2755
  {
1703
2756
  id,
1704
- "aria-label": `${(0, import_parameters.parameterLabel)(field)} hex`,
1705
- value: alpha ? hex : rgb,
2757
+ "aria-label": `${name} hex`,
2758
+ value: shown,
1706
2759
  disabled: off,
1707
2760
  spellCheck: false,
1708
2761
  className: `${parameterInputClass} font-mono`,
@@ -1713,51 +2766,43 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
1713
2766
  }
1714
2767
  )
1715
2768
  ] }),
1716
- alpha && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1717
- "input",
2769
+ open && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2770
+ "div",
1718
2771
  {
1719
- type: "range",
1720
- "aria-label": `${(0, import_parameters.parameterLabel)(field)} opacity`,
1721
- min: 0,
1722
- max: 255,
1723
- step: 1,
1724
- value: parseInt(a, 16),
1725
- disabled: off,
1726
- className: rangeClass,
1727
- onPointerDown: start,
1728
- onPointerUp: end,
1729
- onPointerCancel: end,
1730
- onBlur: end,
1731
- onChange: (e) => onChange(`${rgb}${Number(e.target.value).toString(16).padStart(2, "0")}`)
1732
- }
1733
- ),
1734
- field.swatches && field.swatches.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "flex flex-wrap gap-1", children: field.swatches.map((s) => {
1735
- const swatch = (0, import_parameters.normalizeHexColor)(s, alpha);
1736
- if (!swatch) return null;
1737
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1738
- "button",
1739
- {
1740
- type: "button",
1741
- title: swatch,
1742
- "aria-label": `${(0, import_parameters.parameterLabel)(field)} ${swatch}`,
1743
- "aria-pressed": swatch === (alpha ? hex : rgb),
1744
- disabled: off,
1745
- onClick: () => onChange(swatch),
1746
- className: "h-5 w-5 rounded border border-input aria-pressed:ring-1 aria-pressed:ring-primary",
1747
- style: { background: swatch }
2772
+ ref: popoverRef,
2773
+ role: "dialog",
2774
+ "aria-label": name,
2775
+ tabIndex: -1,
2776
+ onBlur: (e) => {
2777
+ if (popoverRef.current && !popoverRef.current.contains(e.relatedTarget)) {
2778
+ setOpen(false);
2779
+ }
1748
2780
  },
1749
- s
1750
- );
1751
- }) })
2781
+ className: "absolute left-0 top-full z-50 mt-1 w-64 rounded-lg border border-border bg-popover p-2 text-popover-foreground shadow-xl",
2782
+ style: { background: "var(--popover, var(--background, #fff))" },
2783
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2784
+ ColorPicker,
2785
+ {
2786
+ value: shown,
2787
+ alpha,
2788
+ swatches: field.swatches,
2789
+ disabled: off,
2790
+ onChange,
2791
+ onGestureStart,
2792
+ onGestureEnd
2793
+ }
2794
+ )
2795
+ }
2796
+ )
1752
2797
  ] });
1753
2798
  }
1754
2799
  function ParameterVector({ field, value, onChange, disabled, id }) {
1755
2800
  const size = (0, import_parameters.vectorSize)(field);
1756
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "grid gap-1.5", style: { gridTemplateColumns: `repeat(${size}, minmax(0, 1fr))` }, children: Array.from({ length: size }, (_, i) => {
2801
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "grid gap-1.5", style: { gridTemplateColumns: `repeat(${size}, minmax(0, 1fr))` }, children: Array.from({ length: size }, (_, i) => {
1757
2802
  const component = (0, import_parameters.vectorComponentField)(field, i);
1758
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("label", { className: "flex min-w-0 items-center gap-1", children: [
1759
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "w-3 shrink-0 text-[10px] uppercase text-muted-foreground", children: component.label }),
1760
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2803
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("label", { className: "flex min-w-0 items-center gap-1", children: [
2804
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "w-3 shrink-0 text-[10px] uppercase text-muted-foreground", children: component.label }),
2805
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1761
2806
  ParameterNumberInput,
1762
2807
  {
1763
2808
  field: component,
@@ -1774,11 +2819,11 @@ function ParameterVector({ field, value, onChange, disabled, id }) {
1774
2819
  function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
1775
2820
  const off = disabled || field.readOnly;
1776
2821
  const name = (0, import_parameters.parameterLabel)(field);
1777
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "space-y-1.5", children: [
1778
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex items-center gap-2", children: [
1779
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "flex h-12 w-16 shrink-0 items-center justify-center overflow-hidden rounded-md border border-input bg-muted", children: value ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("img", { src: value, alt: name, className: "h-full w-full object-cover" }) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "None" }) }),
1780
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
1781
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2822
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "space-y-1.5", children: [
2823
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex items-center gap-2", children: [
2824
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "flex h-12 w-16 shrink-0 items-center justify-center overflow-hidden rounded-md border border-input bg-muted", children: value ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("img", { src: value, alt: name, className: "h-full w-full object-cover" }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "None" }) }),
2825
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
2826
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1782
2827
  ParameterCommitInput,
1783
2828
  {
1784
2829
  id,
@@ -1789,10 +2834,10 @@ function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
1789
2834
  onCommit: (text) => onChange(text.trim())
1790
2835
  }
1791
2836
  ),
1792
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex gap-1", children: [
1793
- resolveFile && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("label", { className: `${parameterButtonClass} cursor-pointer ${off ? "pointer-events-none opacity-50" : ""}`, children: [
2837
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex gap-1", children: [
2838
+ resolveFile && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("label", { className: `${parameterButtonClass} cursor-pointer ${off ? "pointer-events-none opacity-50" : ""}`, children: [
1794
2839
  "Choose file\u2026",
1795
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2840
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1796
2841
  "input",
1797
2842
  {
1798
2843
  type: "file",
@@ -1808,11 +2853,11 @@ function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
1808
2853
  }
1809
2854
  )
1810
2855
  ] }),
1811
- value && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", className: parameterButtonClass, disabled: off, onClick: () => onChange(""), "aria-label": `Clear ${name}`, children: "Clear" })
2856
+ value && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", className: parameterButtonClass, disabled: off, onClick: () => onChange(""), "aria-label": `Clear ${name}`, children: "Clear" })
1812
2857
  ] })
1813
2858
  ] })
1814
2859
  ] }),
1815
- field.options && field.options.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "flex flex-wrap gap-1", children: field.options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2860
+ field.options && field.options.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "flex flex-wrap gap-1", children: field.options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1816
2861
  "button",
1817
2862
  {
1818
2863
  type: "button",
@@ -1822,14 +2867,14 @@ function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
1822
2867
  disabled: off,
1823
2868
  onClick: () => onChange(o.url),
1824
2869
  className: "h-9 w-12 overflow-hidden rounded border border-input aria-pressed:ring-2 aria-pressed:ring-primary",
1825
- children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("img", { src: o.url, alt: "", className: "h-full w-full object-cover" })
2870
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("img", { src: o.url, alt: "", className: "h-full w-full object-cover" })
1826
2871
  },
1827
2872
  o.url
1828
2873
  )) })
1829
2874
  ] });
1830
2875
  }
1831
2876
  function ParameterText({ field, value, onChange, disabled, id }) {
1832
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2877
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1833
2878
  ParameterCommitInput,
1834
2879
  {
1835
2880
  id,
@@ -1848,31 +2893,31 @@ function ParameterFieldControl({ field, value, onChange, resolveFile, ...rest })
1848
2893
  switch (field.type) {
1849
2894
  case "number":
1850
2895
  case "int":
1851
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ParameterSlider, { field, value, onChange: set, ...rest });
2896
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ParameterSlider, { field, value, onChange: set, ...rest });
1852
2897
  case "boolean":
1853
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ParameterToggle, { field, value, onChange: set, ...rest });
2898
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ParameterToggle, { field, value, onChange: set, ...rest });
1854
2899
  case "choice":
1855
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ParameterSelect, { field, value, onChange: set, ...rest });
2900
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ParameterSelect, { field, value, onChange: set, ...rest });
1856
2901
  case "color":
1857
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ParameterColor, { field, value, onChange: set, ...rest });
2902
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ParameterColor, { field, value, onChange: set, ...rest });
1858
2903
  case "vector":
1859
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ParameterVector, { field, value, onChange: set, ...rest });
2904
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ParameterVector, { field, value, onChange: set, ...rest });
1860
2905
  case "image":
1861
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ParameterImage, { field, value, onChange: set, resolveFile, ...rest });
2906
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ParameterImage, { field, value, onChange: set, resolveFile, ...rest });
1862
2907
  case "text":
1863
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ParameterText, { field, value, onChange: set, ...rest });
2908
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ParameterText, { field, value, onChange: set, ...rest });
1864
2909
  }
1865
2910
  }
1866
2911
 
1867
2912
  // src/effects/EffectParameters.tsx
1868
- var import_jsx_runtime12 = require("react/jsx-runtime");
2913
+ var import_jsx_runtime14 = require("react/jsx-runtime");
1869
2914
  function EffectParameters({ description, values, onChange, onReset, keyframed, onPreset, disabled = false, className = "" }) {
1870
- const fields = (0, import_react14.useMemo)(() => (0, import_effects3.effectParameterFields)(description), [description]);
1871
- const idBase = (0, import_react14.useId)();
1872
- const gesture = import_react14.default.useRef(null);
1873
- const count = import_react14.default.useRef(0);
1874
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: `space-y-2 ${className}`, "data-effect-parameters": description.id, children: [
1875
- onPreset && description.presets.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
2915
+ const fields = (0, import_react17.useMemo)(() => (0, import_effects3.effectParameterFields)(description), [description]);
2916
+ const idBase = (0, import_react17.useId)();
2917
+ const gesture = import_react17.default.useRef(null);
2918
+ const count = import_react17.default.useRef(0);
2919
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: `space-y-2 ${className}`, "data-effect-parameters": description.id, children: [
2920
+ onPreset && description.presets.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
1876
2921
  "select",
1877
2922
  {
1878
2923
  className: "w-full rounded border border-border bg-transparent px-1 py-0.5 text-xs",
@@ -1884,8 +2929,8 @@ function EffectParameters({ description, values, onChange, onReset, keyframed, o
1884
2929
  if (preset) onPreset({ ...description.defaults, ...preset.values });
1885
2930
  },
1886
2931
  children: [
1887
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: "", children: "Presets\u2026" }),
1888
- description.presets.map((p) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: p.name, children: p.name }, p.name))
2932
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: "", children: "Presets\u2026" }),
2933
+ description.presets.map((p) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: p.name, children: p.name }, p.name))
1889
2934
  ]
1890
2935
  }
1891
2936
  ),
@@ -1895,13 +2940,13 @@ function EffectParameters({ description, values, onChange, onReset, keyframed, o
1895
2940
  const keyed = keyframed?.has(field.id) ?? false;
1896
2941
  const value = (0, import_effects3.effectFieldValue)(field, values[field.id]);
1897
2942
  const changed = !keyed && !(0, import_parameters2.parameterValuesEqual)(value, field.default);
1898
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "space-y-1", "data-effect-control": field.id, children: [
1899
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center gap-1.5", children: [
1900
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("label", { htmlFor: inputId, className: "min-w-0 flex-1 truncate text-xs font-medium", title: field.description, children: label }),
1901
- keyed && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "keyframed" }),
1902
- onReset && changed && !disabled && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", className: "rounded px-1 text-[11px] text-muted-foreground hover:text-foreground", "aria-label": `Reset ${label}`, onClick: () => onReset(field.id), children: "\u21BA" })
2943
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "space-y-1", "data-effect-control": field.id, children: [
2944
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex items-center gap-1.5", children: [
2945
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("label", { htmlFor: inputId, className: "min-w-0 flex-1 truncate text-xs font-medium", title: field.description, children: label }),
2946
+ keyed && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "keyframed" }),
2947
+ onReset && changed && !disabled && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", className: "rounded px-1 text-[11px] text-muted-foreground hover:text-foreground", "aria-label": `Reset ${label}`, onClick: () => onReset(field.id), children: "\u21BA" })
1903
2948
  ] }),
1904
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2949
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1905
2950
  ParameterFieldControl,
1906
2951
  {
1907
2952
  field,
@@ -1915,12 +2960,12 @@ function EffectParameters({ description, values, onChange, onReset, keyframed, o
1915
2960
  )
1916
2961
  ] }, field.id);
1917
2962
  }),
1918
- !fields.length && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No controls." })
2963
+ !fields.length && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No controls." })
1919
2964
  ] });
1920
2965
  }
1921
2966
 
1922
2967
  // src/image-editor/ImageProviderEffectsPanel.tsx
1923
- var import_jsx_runtime13 = require("react/jsx-runtime");
2968
+ var import_jsx_runtime15 = require("react/jsx-runtime");
1924
2969
  var btn = "rounded border border-slate-700 px-1.5 py-0.5 text-[11px] text-slate-300 hover:text-white disabled:opacity-40";
1925
2970
  function Controls({
1926
2971
  provider,
@@ -1931,21 +2976,21 @@ function Controls({
1931
2976
  onPreset
1932
2977
  }) {
1933
2978
  const { description, error } = useEffectDescription(provider, effect);
1934
- if (!provider) return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("p", { className: "text-[11px] text-slate-400", children: [
2979
+ if (!provider) return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("p", { className: "text-[11px] text-slate-400", children: [
1935
2980
  'No effects provider: "',
1936
2981
  name ?? effect,
1937
2982
  '" is kept but not drawn.'
1938
2983
  ] });
1939
- if (error) return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "text-[11px] text-amber-400", children: error });
1940
- if (!description) return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "text-[11px] text-slate-400", children: "Loading\u2026" });
1941
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(EffectParameters, { description, values, onChange, onReset: (k) => onChange(k, description.defaults[k], null), onPreset });
2984
+ if (error) return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { className: "text-[11px] text-amber-400", children: error });
2985
+ if (!description) return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { className: "text-[11px] text-slate-400", children: "Loading\u2026" });
2986
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(EffectParameters, { description, values, onChange, onReset: (k) => onChange(k, description.defaults[k], null), onPreset });
1942
2987
  }
1943
2988
  function ImageProviderEffectsPanel({ controller, className = "" }) {
1944
- const [, setTick] = (0, import_react15.useState)(0);
1945
- (0, import_react15.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
1946
- const [browse, setBrowse] = (0, import_react15.useState)(null);
1947
- const [message, setMessage] = (0, import_react15.useState)(null);
1948
- const [open, setOpen] = (0, import_react15.useState)(null);
2989
+ const [, setTick] = (0, import_react18.useState)(0);
2990
+ (0, import_react18.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
2991
+ const [browse, setBrowse] = (0, import_react18.useState)(null);
2992
+ const [message, setMessage] = (0, import_react18.useState)(null);
2993
+ const [open, setOpen] = (0, import_react18.useState)(null);
1949
2994
  const provider = controller.effectsProvider;
1950
2995
  const state = controller.getState();
1951
2996
  const layer = state.activeLayerId ? (0, import_image_editor8.findLayer)(state.layers, state.activeLayerId)?.layer ?? null : null;
@@ -1953,7 +2998,7 @@ function ImageProviderEffectsPanel({ controller, className = "" }) {
1953
2998
  setMessage(null);
1954
2999
  Promise.resolve().then(work).catch((e) => setMessage(e instanceof Error ? e.message : String(e)));
1955
3000
  };
1956
- const drags = import_react15.default.useRef(/* @__PURE__ */ new Set());
3001
+ const drags = import_react18.default.useRef(/* @__PURE__ */ new Set());
1957
3002
  const commit = (gesture) => {
1958
3003
  if (gesture) {
1959
3004
  if (!drags.current.has(gesture)) {
@@ -1967,21 +3012,21 @@ function ImageProviderEffectsPanel({ controller, className = "" }) {
1967
3012
  const filters = layer?.type === "smart" ? (layer.smartFilters?.filters ?? []).filter((f) => f.kind === "effect") : [];
1968
3013
  const generator = layer?.type === "pixel" ? layer.generator : void 0;
1969
3014
  const canFilter = !!layer && layer.type !== "adjustment" && layer.type !== "annotation";
1970
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("section", { className: `flex flex-col gap-2 text-xs ${className}`, "aria-label": "Provider effects", "data-image-provider-effects": "", children: [
1971
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex items-center gap-1", children: [
1972
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "flex-1 font-semibold uppercase tracking-wider text-[11px] text-slate-200", children: "Effects" }),
1973
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", className: btn, disabled: !provider || !canFilter, "aria-pressed": browse === "filter", onClick: () => setBrowse(browse === "filter" ? null : "filter"), children: "Apply effect\u2026" }),
1974
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", className: btn, disabled: !provider, "aria-pressed": browse === "layer", onClick: () => setBrowse(browse === "layer" ? null : "layer"), children: "Effect layer\u2026" })
3015
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("section", { className: `flex flex-col gap-2 text-xs ${className}`, "aria-label": "Provider effects", "data-image-provider-effects": "", children: [
3016
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex items-center gap-1", children: [
3017
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "flex-1 font-semibold uppercase tracking-wider text-[11px] text-slate-200", children: "Effects" }),
3018
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: btn, disabled: !provider || !canFilter, "aria-pressed": browse === "filter", onClick: () => setBrowse(browse === "filter" ? null : "filter"), children: "Apply effect\u2026" }),
3019
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: btn, disabled: !provider, "aria-pressed": browse === "layer", onClick: () => setBrowse(browse === "layer" ? null : "layer"), children: "Effect layer\u2026" })
1975
3020
  ] }),
1976
- !provider && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "text-[11px] text-slate-400", children: "No effects provider is registered. Effects in the document are kept." }),
1977
- browse === "filter" && layer && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(EffectsBrowser, { provider, uses: ["filter"], title: "Filters", onPick: (e) => (setBrowse(null), run(() => controller.applyEffectFilter(layer.id, e.id))) }),
1978
- browse === "layer" && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(EffectsBrowser, { provider, uses: ["generator", "overlay", "title"], title: "Generators and overlays", onPick: (e) => (setBrowse(null), run(() => controller.addEffectLayer(e.id))) }),
1979
- generator && layer && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "space-y-1", "data-effect-part": "generator", children: [
1980
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex items-center gap-1", children: [
1981
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "flex-1 font-medium text-slate-200", children: generator.name ?? generator.effect }),
1982
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", className: btn, title: "Keep the pixels as a plain layer", onClick: () => run(() => controller.rasterizeEffectLayer(layer.id)), children: "Rasterize" })
3021
+ !provider && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { className: "text-[11px] text-slate-400", children: "No effects provider is registered. Effects in the document are kept." }),
3022
+ browse === "filter" && layer && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(EffectsBrowser, { provider, uses: ["filter"], title: "Filters", onPick: (e) => (setBrowse(null), run(() => controller.applyEffectFilter(layer.id, e.id))) }),
3023
+ browse === "layer" && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(EffectsBrowser, { provider, uses: ["generator", "overlay", "title"], title: "Generators and overlays", onPick: (e) => (setBrowse(null), run(() => controller.addEffectLayer(e.id))) }),
3024
+ generator && layer && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "space-y-1", "data-effect-part": "generator", children: [
3025
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex items-center gap-1", children: [
3026
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "flex-1 font-medium text-slate-200", children: generator.name ?? generator.effect }),
3027
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: btn, title: "Keep the pixels as a plain layer", onClick: () => run(() => controller.rasterizeEffectLayer(layer.id)), children: "Rasterize" })
1983
3028
  ] }),
1984
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3029
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1985
3030
  Controls,
1986
3031
  {
1987
3032
  provider,
@@ -1993,26 +3038,26 @@ function ImageProviderEffectsPanel({ controller, className = "" }) {
1993
3038
  }
1994
3039
  )
1995
3040
  ] }),
1996
- filters.length > 0 && layer && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("ol", { className: "space-y-1", "data-effect-part": "filters", children: filters.map((f) => {
3041
+ filters.length > 0 && layer && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("ol", { className: "space-y-1", "data-effect-part": "filters", children: filters.map((f) => {
1997
3042
  const label = f.kind === "effect" ? f.name ?? f.effect : f.kind;
1998
3043
  const all = layer.smartFilters.filters;
1999
3044
  const index = all.indexOf(f);
2000
3045
  if (f.kind !== "effect") return null;
2001
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("li", { className: "rounded border border-slate-700 p-1", "data-smart-effect": f.id, children: [
2002
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex items-center gap-1", children: [
2003
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("input", { type: "checkbox", checked: f.enabled, "aria-label": `${label} on`, onChange: (e) => {
3046
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("li", { className: "rounded border border-slate-700 p-1", "data-smart-effect": f.id, children: [
3047
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex items-center gap-1", children: [
3048
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("input", { type: "checkbox", checked: f.enabled, "aria-label": `${label} on`, onChange: (e) => {
2004
3049
  const enabled = e.currentTarget.checked;
2005
3050
  run(() => controller.updateEffectFilter(layer.id, f.id, { enabled }));
2006
3051
  } }),
2007
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", className: "min-w-0 flex-1 truncate text-left text-slate-200", "aria-expanded": open === f.id, onClick: () => setOpen(open === f.id ? null : f.id), children: label }),
2008
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", className: btn, disabled: index === all.length - 1, "aria-label": "Move up", onClick: () => run(() => controller.updateEffectFilter(layer.id, f.id, { index: index + 1 })), children: "\u2191" }),
2009
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", className: btn, disabled: index === 0, "aria-label": "Move down", onClick: () => run(() => controller.updateEffectFilter(layer.id, f.id, { index: index - 1 })), children: "\u2193" }),
2010
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", className: btn, "aria-label": `Remove ${label}`, onClick: () => run(() => controller.removeSmartFilter(layer.id, f.id)), children: "\u2715" })
3052
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: "min-w-0 flex-1 truncate text-left text-slate-200", "aria-expanded": open === f.id, onClick: () => setOpen(open === f.id ? null : f.id), children: label }),
3053
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: btn, disabled: index === all.length - 1, "aria-label": "Move up", onClick: () => run(() => controller.updateEffectFilter(layer.id, f.id, { index: index + 1 })), children: "\u2191" }),
3054
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: btn, disabled: index === 0, "aria-label": "Move down", onClick: () => run(() => controller.updateEffectFilter(layer.id, f.id, { index: index - 1 })), children: "\u2193" }),
3055
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: btn, "aria-label": `Remove ${label}`, onClick: () => run(() => controller.removeSmartFilter(layer.id, f.id)), children: "\u2715" })
2011
3056
  ] }),
2012
- open === f.id && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "mt-1 space-y-2", children: [
2013
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("label", { className: "flex items-center gap-1", children: [
2014
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "w-14 text-[11px] text-slate-300", children: "Opacity" }),
2015
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3057
+ open === f.id && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "mt-1 space-y-2", children: [
3058
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("label", { className: "flex items-center gap-1", children: [
3059
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "w-14 text-[11px] text-slate-300", children: "Opacity" }),
3060
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2016
3061
  "input",
2017
3062
  {
2018
3063
  type: "range",
@@ -2029,7 +3074,7 @@ function ImageProviderEffectsPanel({ controller, className = "" }) {
2029
3074
  }
2030
3075
  )
2031
3076
  ] }),
2032
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3077
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2033
3078
  Controls,
2034
3079
  {
2035
3080
  provider,
@@ -2043,13 +3088,13 @@ function ImageProviderEffectsPanel({ controller, className = "" }) {
2043
3088
  ] })
2044
3089
  ] }, f.id);
2045
3090
  }) }),
2046
- !layer && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "text-[11px] text-slate-400", children: "Select a layer to apply effects to it." }),
2047
- message && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { role: "alert", className: "text-[11px] text-rose-400", children: message })
3091
+ !layer && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { className: "text-[11px] text-slate-400", children: "Select a layer to apply effects to it." }),
3092
+ message && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { role: "alert", className: "text-[11px] text-rose-400", children: message })
2048
3093
  ] });
2049
3094
  }
2050
3095
 
2051
3096
  // src/image-editor/BrushOptionsBar.tsx
2052
- var import_react17 = require("react");
3097
+ var import_react20 = require("react");
2053
3098
  var import_image_editor10 = require("@pixerate/editor/image-editor");
2054
3099
  var import_image_editor11 = require("@pixerate/editor/image-editor");
2055
3100
 
@@ -2057,8 +3102,8 @@ var import_image_editor11 = require("@pixerate/editor/image-editor");
2057
3102
  var import_image_editor9 = require("@pixerate/editor/image-editor");
2058
3103
 
2059
3104
  // src/paint-editor/PaintGradientEditorView.tsx
2060
- var import_react16 = require("react");
2061
- var import_jsx_runtime14 = require("react/jsx-runtime");
3105
+ var import_react19 = require("react");
3106
+ var import_jsx_runtime16 = require("react/jsx-runtime");
2062
3107
  var button2 = "px-2 py-1 rounded text-[11px] bg-slate-800 text-slate-200 hover:bg-slate-700 disabled:opacity-40";
2063
3108
  var select = "rounded bg-slate-800 px-1 py-0.5 text-[11px]";
2064
3109
  var number = "w-16 rounded bg-slate-800 px-1 py-0.5 text-[11px]";
@@ -2079,7 +3124,7 @@ var PaintGradientEditorView = ({ value, onChange, colors, className, kit }) => {
2079
3124
  reversePaintGradient,
2080
3125
  updatePaintGradientStop
2081
3126
  } = kit;
2082
- const [selected, setSelected] = (0, import_react16.useState)(0);
3127
+ const [selected, setSelected] = (0, import_react19.useState)(0);
2083
3128
  const sel = Math.min(selected, value.stops.length - 1);
2084
3129
  const stop = value.stops[sel];
2085
3130
  const map = value.map;
@@ -2089,15 +3134,15 @@ var PaintGradientEditorView = ({ value, onChange, colors, className, kit }) => {
2089
3134
  setSelected(r.index);
2090
3135
  onChange(r.paint);
2091
3136
  };
2092
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: `flex flex-col gap-1.5 text-xs text-slate-200 ${className ?? ""}`, "data-testid": "paint-gradient-editor", "aria-label": "Gradient paint", children: [
2093
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex items-center gap-1", children: [
2094
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("select", { "aria-label": "Gradient preset", className: select, value: "", onChange: (e) => e.target.value && (setSelected(0), onChange(PAINT_GRADIENT_PRESETS[Number(e.target.value)].paint)), children: [
2095
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: "", children: "Presets\u2026" }),
2096
- PAINT_GRADIENT_PRESETS.map((p, i) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: i, children: p.name }, p.name))
3137
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: `flex flex-col gap-1.5 text-xs text-slate-200 ${className ?? ""}`, "data-testid": "paint-gradient-editor", "aria-label": "Gradient paint", children: [
3138
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex items-center gap-1", children: [
3139
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("select", { "aria-label": "Gradient preset", className: select, value: "", onChange: (e) => e.target.value && (setSelected(0), onChange(PAINT_GRADIENT_PRESETS[Number(e.target.value)].paint)), children: [
3140
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: "", children: "Presets\u2026" }),
3141
+ PAINT_GRADIENT_PRESETS.map((p, i) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: i, children: p.name }, p.name))
2097
3142
  ] }),
2098
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", className: button2, onClick: () => onChange(reversePaintGradient(value)), children: "Reverse" })
3143
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", className: button2, onClick: () => onChange(reversePaintGradient(value)), children: "Reverse" })
2099
3144
  ] }),
2100
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3145
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2101
3146
  "div",
2102
3147
  {
2103
3148
  role: "slider",
@@ -2119,7 +3164,7 @@ var PaintGradientEditorView = ({ value, onChange, colors, className, kit }) => {
2119
3164
  }
2120
3165
  }
2121
3166
  ),
2122
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "relative h-4", "aria-label": "Stops", children: value.stops.map((s, i) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3167
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "relative h-4", "aria-label": "Stops", children: value.stops.map((s, i) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2123
3168
  "button",
2124
3169
  {
2125
3170
  type: "button",
@@ -2131,64 +3176,64 @@ var PaintGradientEditorView = ({ value, onChange, colors, className, kit }) => {
2131
3176
  },
2132
3177
  i
2133
3178
  )) }),
2134
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex flex-wrap items-center gap-1", "data-testid": "paint-gradient-stop", children: [
2135
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("select", { "aria-label": "Stop colour source", className: select, value: stop.color === "paint" || stop.color === "secondary" ? stop.color : "color", onChange: (e) => patchStop({ color: e.target.value === "color" ? stopHex(stop.color) : e.target.value }), children: [
2136
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: "color", children: "Colour" }),
2137
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: "paint", children: "Paint colour" }),
2138
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: "secondary", children: "Second colour" })
3179
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex flex-wrap items-center gap-1", "data-testid": "paint-gradient-stop", children: [
3180
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("select", { "aria-label": "Stop colour source", className: select, value: stop.color === "paint" || stop.color === "secondary" ? stop.color : "color", onChange: (e) => patchStop({ color: e.target.value === "color" ? stopHex(stop.color) : e.target.value }), children: [
3181
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: "color", children: "Colour" }),
3182
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: "paint", children: "Paint colour" }),
3183
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: "secondary", children: "Second colour" })
2139
3184
  ] }),
2140
- stop.color !== "paint" && stop.color !== "secondary" && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("input", { type: "color", "aria-label": "Stop colour", value: stop.color, onChange: (e) => patchStop({ color: e.target.value }), className: "h-6 w-8 rounded bg-transparent" }),
2141
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { className: "flex items-center gap-1", children: [
3185
+ stop.color !== "paint" && stop.color !== "secondary" && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("input", { type: "color", "aria-label": "Stop colour", value: stop.color, onChange: (e) => patchStop({ color: e.target.value }), className: "h-6 w-8 rounded bg-transparent" }),
3186
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: "flex items-center gap-1", children: [
2142
3187
  "At",
2143
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("input", { type: "number", "aria-label": "Stop position", min: 0, max: 100, step: 1, value: pct(stop.offset), onChange: (e) => patchStop({ offset: Number(e.target.value) / 100 }), className: number }),
3188
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("input", { type: "number", "aria-label": "Stop position", min: 0, max: 100, step: 1, value: pct(stop.offset), onChange: (e) => patchStop({ offset: Number(e.target.value) / 100 }), className: number }),
2144
3189
  "%"
2145
3190
  ] }),
2146
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { className: "flex items-center gap-1", children: [
3191
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: "flex items-center gap-1", children: [
2147
3192
  "Opacity",
2148
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("input", { type: "number", "aria-label": "Stop opacity", min: 0, max: 100, step: 5, value: pct(stop.opacity ?? 1), onChange: (e) => patchStop({ opacity: Number(e.target.value) / 100 }), className: number }),
3193
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("input", { type: "number", "aria-label": "Stop opacity", min: 0, max: 100, step: 5, value: pct(stop.opacity ?? 1), onChange: (e) => patchStop({ opacity: Number(e.target.value) / 100 }), className: number }),
2149
3194
  "%"
2150
3195
  ] }),
2151
- sel < value.stops.length - 1 && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { className: "flex items-center gap-1", children: [
3196
+ sel < value.stops.length - 1 && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: "flex items-center gap-1", children: [
2152
3197
  "Midpoint",
2153
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("input", { type: "number", "aria-label": "Stop midpoint", min: 5, max: 95, step: 1, value: pct(stop.midpoint ?? 0.5), onChange: (e) => patchStop({ midpoint: Number(e.target.value) / 100 }), className: number }),
3198
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("input", { type: "number", "aria-label": "Stop midpoint", min: 5, max: 95, step: 1, value: pct(stop.midpoint ?? 0.5), onChange: (e) => patchStop({ midpoint: Number(e.target.value) / 100 }), className: number }),
2154
3199
  "%"
2155
3200
  ] }),
2156
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", className: button2, disabled: value.stops.length <= 2, onClick: () => (setSelected(Math.max(0, sel - 1)), onChange(removePaintGradientStop(value, sel))), children: "Remove stop" })
3201
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", className: button2, disabled: value.stops.length <= 2, onClick: () => (setSelected(Math.max(0, sel - 1)), onChange(removePaintGradientStop(value, sel))), children: "Remove stop" })
2157
3202
  ] }),
2158
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex flex-wrap items-center gap-1", "data-testid": "paint-gradient-mapping", children: [
2159
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("select", { "aria-label": "Gradient follows", className: select, value: map.by, onChange: (e) => onChange({ ...value, map: paintGradientMappingFor(e.target.value, map) }), children: PAINT_GRADIENT_MAPPINGS.map((m) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: m, children: PAINT_GRADIENT_MAPPING_LABELS[m] }, m)) }),
2160
- map.by === "distance" && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
2161
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("input", { type: "number", "aria-label": "Gradient length", min: 1, max: 1e5, value: map.length, onChange: (e) => onChange({ ...value, map: { ...map, length: Math.max(1, Number(e.target.value) || 1) } }), className: number }),
2162
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("select", { "aria-label": "Gradient length unit", className: select, value: map.unit ?? "px", onChange: (e) => onChange({ ...value, map: { ...map, unit: e.target.value } }), children: [
2163
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: "px", children: "px" }),
2164
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: "dabs", children: "dabs" })
3203
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex flex-wrap items-center gap-1", "data-testid": "paint-gradient-mapping", children: [
3204
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("select", { "aria-label": "Gradient follows", className: select, value: map.by, onChange: (e) => onChange({ ...value, map: paintGradientMappingFor(e.target.value, map) }), children: PAINT_GRADIENT_MAPPINGS.map((m) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: m, children: PAINT_GRADIENT_MAPPING_LABELS[m] }, m)) }),
3205
+ map.by === "distance" && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
3206
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("input", { type: "number", "aria-label": "Gradient length", min: 1, max: 1e5, value: map.length, onChange: (e) => onChange({ ...value, map: { ...map, length: Math.max(1, Number(e.target.value) || 1) } }), className: number }),
3207
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("select", { "aria-label": "Gradient length unit", className: select, value: map.unit ?? "px", onChange: (e) => onChange({ ...value, map: { ...map, unit: e.target.value } }), children: [
3208
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: "px", children: "px" }),
3209
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: "dabs", children: "dabs" })
2165
3210
  ] })
2166
3211
  ] }),
2167
- map.by === "time" && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("input", { type: "number", "aria-label": "Gradient duration", min: 1, max: 6e5, value: map.duration, onChange: (e) => onChange({ ...value, map: { ...map, duration: Math.max(1, Number(e.target.value) || 1) } }), className: number }),
2168
- map.by === "random" && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("input", { type: "number", "aria-label": "Dabs per pick", min: 1, max: 500, value: map.every ?? 1, onChange: (e) => onChange({ ...value, map: { ...map, every: Math.max(1, Math.round(Number(e.target.value) || 1)) } }), className: number }),
2169
- (map.by === "distance" || map.by === "time") && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("select", { "aria-label": "Gradient repeat", className: select, value: map.repeat ?? "clamp", onChange: (e) => onChange({ ...value, map: { ...map, repeat: e.target.value } }), children: PAINT_GRADIENT_REPEATS.map((r) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: r, children: PAINT_GRADIENT_REPEAT_LABELS[r] }, r)) })
3212
+ map.by === "time" && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("input", { type: "number", "aria-label": "Gradient duration", min: 1, max: 6e5, value: map.duration, onChange: (e) => onChange({ ...value, map: { ...map, duration: Math.max(1, Number(e.target.value) || 1) } }), className: number }),
3213
+ map.by === "random" && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("input", { type: "number", "aria-label": "Dabs per pick", min: 1, max: 500, value: map.every ?? 1, onChange: (e) => onChange({ ...value, map: { ...map, every: Math.max(1, Math.round(Number(e.target.value) || 1)) } }), className: number }),
3214
+ (map.by === "distance" || map.by === "time") && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("select", { "aria-label": "Gradient repeat", className: select, value: map.repeat ?? "clamp", onChange: (e) => onChange({ ...value, map: { ...map, repeat: e.target.value } }), children: PAINT_GRADIENT_REPEATS.map((r) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: r, children: PAINT_GRADIENT_REPEAT_LABELS[r] }, r)) })
2170
3215
  ] }),
2171
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex items-center gap-1", children: [
2172
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("select", { "aria-label": "Gradient mixing", className: select, value: value.space, onChange: (e) => onChange({ ...value, space: e.target.value }), children: PAINT_GRADIENT_SPACES.map((s) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: s, children: PAINT_GRADIENT_SPACE_LABELS[s] }, s)) }),
2173
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { className: "flex flex-1 items-center gap-1", children: [
3216
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex items-center gap-1", children: [
3217
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("select", { "aria-label": "Gradient mixing", className: select, value: value.space, onChange: (e) => onChange({ ...value, space: e.target.value }), children: PAINT_GRADIENT_SPACES.map((s) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: s, children: PAINT_GRADIENT_SPACE_LABELS[s] }, s)) }),
3218
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: "flex flex-1 items-center gap-1", children: [
2174
3219
  "Softness",
2175
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("input", { type: "range", "aria-label": "Gradient softness", min: 0, max: 1, step: 0.05, value: value.softness ?? 1, onChange: (e) => onChange({ ...value, softness: Number(e.target.value) }), className: "flex-1 accent-indigo-500" })
3220
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("input", { type: "range", "aria-label": "Gradient softness", min: 0, max: 1, step: 0.05, value: value.softness ?? 1, onChange: (e) => onChange({ ...value, softness: Number(e.target.value) }), className: "flex-1 accent-indigo-500" })
2176
3221
  ] })
2177
3222
  ] })
2178
3223
  ] });
2179
3224
  };
2180
3225
 
2181
3226
  // src/image-editor/PaintGradientEditor.tsx
2182
- var import_jsx_runtime15 = require("react/jsx-runtime");
2183
- var PaintGradientEditor = (props) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(PaintGradientEditorView, { ...props, kit: import_image_editor9.PAINT_GRADIENT_KIT });
3227
+ var import_jsx_runtime17 = require("react/jsx-runtime");
3228
+ var PaintGradientEditor = (props) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(PaintGradientEditorView, { ...props, kit: import_image_editor9.PAINT_GRADIENT_KIT });
2184
3229
 
2185
3230
  // src/image-editor/BrushOptionsBar.tsx
2186
- var import_jsx_runtime16 = require("react/jsx-runtime");
3231
+ var import_jsx_runtime18 = require("react/jsx-runtime");
2187
3232
  var chip = (on) => `px-2 py-1 rounded text-[11px] ${on ? "bg-indigo-600 text-white" : "bg-slate-800 text-slate-300 hover:text-white"}`;
2188
3233
  var BrushOptionsBar = ({ controller, className }) => {
2189
- const [, setTick] = (0, import_react17.useState)(0);
2190
- (0, import_react17.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
2191
- const [error, setError] = (0, import_react17.useState)(null);
3234
+ const [, setTick] = (0, import_react20.useState)(0);
3235
+ (0, import_react20.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
3236
+ const [error, setError] = (0, import_react20.useState)(null);
2192
3237
  const state = controller.getState();
2193
3238
  const { brush, foreground, background, mixer, mixerLoad, retouch, cloneSource, paint } = state.paint;
2194
3239
  const tool = state.activeTool;
@@ -2200,8 +3245,8 @@ var BrushOptionsBar = ({ controller, className }) => {
2200
3245
  setError(err instanceof Error ? err.message : String(err));
2201
3246
  }
2202
3247
  };
2203
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-slate-200 ${className ?? ""}`, "data-testid": "brush-options", children: [
2204
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Paint tools", children: import_image_editor10.PAINT_TOOLS.map((t) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3248
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-slate-200 ${className ?? ""}`, "data-testid": "brush-options", children: [
3249
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Paint tools", children: import_image_editor10.PAINT_TOOLS.map((t) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2205
3250
  "button",
2206
3251
  {
2207
3252
  type: "button",
@@ -2213,9 +3258,9 @@ var BrushOptionsBar = ({ controller, className }) => {
2213
3258
  },
2214
3259
  t.id
2215
3260
  )) }),
2216
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex items-center gap-2", role: "group", "aria-label": "Colours", children: [
2217
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: "flex items-center gap-1", children: [
2218
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3261
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center gap-2", role: "group", "aria-label": "Colours", children: [
3262
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { className: "flex items-center gap-1", children: [
3263
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2219
3264
  "input",
2220
3265
  {
2221
3266
  type: "color",
@@ -2225,10 +3270,10 @@ var BrushOptionsBar = ({ controller, className }) => {
2225
3270
  className: "h-6 w-8 rounded border border-slate-700 bg-transparent"
2226
3271
  }
2227
3272
  ),
2228
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "text-slate-400", children: "FG" })
3273
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "text-slate-400", children: "FG" })
2229
3274
  ] }),
2230
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: "flex items-center gap-1", children: [
2231
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3275
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { className: "flex items-center gap-1", children: [
3276
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2232
3277
  "input",
2233
3278
  {
2234
3279
  type: "color",
@@ -2238,11 +3283,11 @@ var BrushOptionsBar = ({ controller, className }) => {
2238
3283
  className: "h-6 w-8 rounded border border-slate-700 bg-transparent"
2239
3284
  }
2240
3285
  ),
2241
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "text-slate-400", children: "BG" })
3286
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "text-slate-400", children: "BG" })
2242
3287
  ] }),
2243
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", title: "Swap colours (X)", className: chip(false), onClick: () => controller.swapPaintColors(), children: "Swap" }),
2244
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", title: "Default colours (D)", className: chip(false), onClick: () => controller.resetPaintColors(), children: "Default" }),
2245
- state.activeTool === "brush" && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3288
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", title: "Swap colours (X)", className: chip(false), onClick: () => controller.swapPaintColors(), children: "Swap" }),
3289
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", title: "Default colours (D)", className: chip(false), onClick: () => controller.resetPaintColors(), children: "Default" }),
3290
+ state.activeTool === "brush" && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2246
3291
  "button",
2247
3292
  {
2248
3293
  type: "button",
@@ -2254,8 +3299,8 @@ var BrushOptionsBar = ({ controller, className }) => {
2254
3299
  }
2255
3300
  )
2256
3301
  ] }),
2257
- state.activeTool === "brush" && paint.type === "gradient" && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(PaintGradientEditor, { value: paint, colors: { paint: foreground, secondary: background }, onChange: (g) => attempt(() => controller.setPaintOptions({ paint: g })) }),
2258
- import_image_editor10.BRUSH_OPTION_CONTROLS.map((spec) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3302
+ state.activeTool === "brush" && paint.type === "gradient" && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(PaintGradientEditor, { value: paint, colors: { paint: foreground, secondary: background }, onChange: (g) => attempt(() => controller.setPaintOptions({ paint: g })) }),
3303
+ import_image_editor10.BRUSH_OPTION_CONTROLS.map((spec) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2259
3304
  ControlSlider,
2260
3305
  {
2261
3306
  spec,
@@ -2264,9 +3309,9 @@ var BrushOptionsBar = ({ controller, className }) => {
2264
3309
  },
2265
3310
  spec.id
2266
3311
  )),
2267
- state.activeTool === "mixer" && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex flex-col gap-2 border-t border-slate-800 pt-2", role: "group", "aria-label": "Mixer Brush", "data-testid": "mixer-options", children: [
2268
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex items-center gap-2", children: [
2269
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3312
+ state.activeTool === "mixer" && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-col gap-2 border-t border-slate-800 pt-2", role: "group", "aria-label": "Mixer Brush", "data-testid": "mixer-options", children: [
3313
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center gap-2", children: [
3314
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2270
3315
  "span",
2271
3316
  {
2272
3317
  "aria-label": "Brush load",
@@ -2275,10 +3320,10 @@ var BrushOptionsBar = ({ controller, className }) => {
2275
3320
  style: { background: mixerLoad.reservoir ? (0, import_image_editor10.rgbUnitToHex)(mixerLoad.reservoir) : "transparent" }
2276
3321
  }
2277
3322
  ),
2278
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", title: "Fill the reservoir with the foreground colour", className: chip(false), onClick: () => controller.loadMixerBrush(), children: "Load brush" }),
2279
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", title: "Empty the picked-up colour", className: chip(false), onClick: () => controller.cleanMixerBrush(), children: "Clean brush" })
3323
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", title: "Fill the reservoir with the foreground colour", className: chip(false), onClick: () => controller.loadMixerBrush(), children: "Load brush" }),
3324
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", title: "Empty the picked-up colour", className: chip(false), onClick: () => controller.cleanMixerBrush(), children: "Clean brush" })
2280
3325
  ] }),
2281
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "flex gap-1", role: "group", "aria-label": "Mixing", children: import_image_editor10.MIXER_MIXING_OPTIONS.map((m) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3326
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "flex gap-1", role: "group", "aria-label": "Mixing", children: import_image_editor10.MIXER_MIXING_OPTIONS.map((m) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2282
3327
  "button",
2283
3328
  {
2284
3329
  type: "button",
@@ -2290,10 +3335,10 @@ var BrushOptionsBar = ({ controller, className }) => {
2290
3335
  },
2291
3336
  m.id
2292
3337
  )) }),
2293
- import_image_editor10.MIXER_OPTION_CONTROLS.map((spec) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ControlSlider, { spec, value: mixer[spec.id], onChange: (v) => controller.setPaintOptions({ mixer: { [spec.id]: v } }) }, spec.id)),
2294
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex flex-wrap gap-3 text-slate-300", children: [
2295
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: "flex items-center gap-1.5", children: [
2296
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3338
+ import_image_editor10.MIXER_OPTION_CONTROLS.map((spec) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ControlSlider, { spec, value: mixer[spec.id], onChange: (v) => controller.setPaintOptions({ mixer: { [spec.id]: v } }) }, spec.id)),
3339
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-wrap gap-3 text-slate-300", children: [
3340
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { className: "flex items-center gap-1.5", children: [
3341
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2297
3342
  "input",
2298
3343
  {
2299
3344
  type: "checkbox",
@@ -2305,8 +3350,8 @@ var BrushOptionsBar = ({ controller, className }) => {
2305
3350
  ),
2306
3351
  "Load each stroke"
2307
3352
  ] }),
2308
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: "flex items-center gap-1.5", children: [
2309
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3353
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { className: "flex items-center gap-1.5", children: [
3354
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2310
3355
  "input",
2311
3356
  {
2312
3357
  type: "checkbox",
@@ -2320,22 +3365,22 @@ var BrushOptionsBar = ({ controller, className }) => {
2320
3365
  ] })
2321
3366
  ] })
2322
3367
  ] }),
2323
- (0, import_image_editor10.isRetouchPaintTool)(tool) && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex flex-col gap-2 border-t border-slate-800 pt-2", role: "group", "aria-label": "Retouch options", "data-testid": "retouch-options", children: [
2324
- (tool === "clone" || tool === "heal") && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex items-center gap-2", children: [
2325
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "text-slate-400", "data-testid": "clone-source", children: (0, import_image_editor10.cloneSourceLabel)(controller) }),
2326
- cloneSource && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", title: "Forget the source point", className: chip(false), onClick: () => controller.setCloneSource(null), children: "Clear source" })
3368
+ (0, import_image_editor10.isRetouchPaintTool)(tool) && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-col gap-2 border-t border-slate-800 pt-2", role: "group", "aria-label": "Retouch options", "data-testid": "retouch-options", children: [
3369
+ (tool === "clone" || tool === "heal") && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center gap-2", children: [
3370
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "text-slate-400", "data-testid": "clone-source", children: (0, import_image_editor10.cloneSourceLabel)(controller) }),
3371
+ cloneSource && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", title: "Forget the source point", className: chip(false), onClick: () => controller.setCloneSource(null), children: "Clear source" })
2327
3372
  ] }),
2328
- (tool === "clone" || tool === "heal") && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex flex-col gap-1", role: "group", "aria-label": "Clone source transform", "data-testid": "clone-transform", children: [
2329
- import_image_editor10.CLONE_TRANSFORM_CONTROLS.map((spec) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ControlSlider, { spec, value: (0, import_image_editor10.cloneTransformView)(controller)[spec.id], onChange: (v) => (0, import_image_editor10.setCloneTransformValue)(controller, spec.id, v) }, spec.id)),
2330
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex items-center gap-1", children: [
2331
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", "aria-pressed": (0, import_image_editor10.cloneTransformView)(controller).flipH, title: "Mirror the source left to right", className: chip((0, import_image_editor10.cloneTransformView)(controller).flipH), onClick: () => (0, import_image_editor10.setCloneTransformValue)(controller, "flipH"), children: "Flip H" }),
2332
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", "aria-pressed": (0, import_image_editor10.cloneTransformView)(controller).flipV, title: "Mirror the source top to bottom", className: chip((0, import_image_editor10.cloneTransformView)(controller).flipV), onClick: () => (0, import_image_editor10.setCloneTransformValue)(controller, "flipV"), children: "Flip V" }),
2333
- !(0, import_image_editor10.cloneTransformView)(controller).identity && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", title: "Back to 100 %, no flip, 0\xB0", className: chip(false), onClick: () => controller.setCloneTransform(null), children: "Reset transform" })
3373
+ (tool === "clone" || tool === "heal") && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-col gap-1", role: "group", "aria-label": "Clone source transform", "data-testid": "clone-transform", children: [
3374
+ import_image_editor10.CLONE_TRANSFORM_CONTROLS.map((spec) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ControlSlider, { spec, value: (0, import_image_editor10.cloneTransformView)(controller)[spec.id], onChange: (v) => (0, import_image_editor10.setCloneTransformValue)(controller, spec.id, v) }, spec.id)),
3375
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center gap-1", children: [
3376
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", "aria-pressed": (0, import_image_editor10.cloneTransformView)(controller).flipH, title: "Mirror the source left to right", className: chip((0, import_image_editor10.cloneTransformView)(controller).flipH), onClick: () => (0, import_image_editor10.setCloneTransformValue)(controller, "flipH"), children: "Flip H" }),
3377
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", "aria-pressed": (0, import_image_editor10.cloneTransformView)(controller).flipV, title: "Mirror the source top to bottom", className: chip((0, import_image_editor10.cloneTransformView)(controller).flipV), onClick: () => (0, import_image_editor10.setCloneTransformValue)(controller, "flipV"), children: "Flip V" }),
3378
+ !(0, import_image_editor10.cloneTransformView)(controller).identity && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", title: "Back to 100 %, no flip, 0\xB0", className: chip(false), onClick: () => controller.setCloneTransform(null), children: "Reset transform" })
2334
3379
  ] })
2335
3380
  ] }),
2336
- import_image_editor10.RETOUCH_CHOICES.filter((c) => c.tools.includes(tool)).map((choice) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": choice.label, children: [
2337
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "text-slate-400", children: choice.label }),
2338
- choice.options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3381
+ import_image_editor10.RETOUCH_CHOICES.filter((c) => c.tools.includes(tool)).map((choice) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": choice.label, children: [
3382
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "text-slate-400", children: choice.label }),
3383
+ choice.options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2339
3384
  "button",
2340
3385
  {
2341
3386
  type: "button",
@@ -2348,9 +3393,9 @@ var BrushOptionsBar = ({ controller, className }) => {
2348
3393
  o.id
2349
3394
  ))
2350
3395
  ] }, choice.id)),
2351
- import_image_editor10.RETOUCH_OPTION_CONTROLS.filter((c) => c.tools.includes(tool)).map((spec) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ControlSlider, { spec, value: retouch[spec.id], onChange: (v) => controller.setPaintOptions({ retouch: { [spec.id]: v } }) }, spec.id)),
2352
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "flex flex-wrap gap-3 text-slate-300", children: import_image_editor10.RETOUCH_TOGGLES.filter((t) => t.tools.includes(tool)).map((t) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: "flex items-center gap-1.5", children: [
2353
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3396
+ import_image_editor10.RETOUCH_OPTION_CONTROLS.filter((c) => c.tools.includes(tool)).map((spec) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ControlSlider, { spec, value: retouch[spec.id], onChange: (v) => controller.setPaintOptions({ retouch: { [spec.id]: v } }) }, spec.id)),
3397
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "flex flex-wrap gap-3 text-slate-300", children: import_image_editor10.RETOUCH_TOGGLES.filter((t) => t.tools.includes(tool)).map((t) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { className: "flex items-center gap-1.5", children: [
3398
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2354
3399
  "input",
2355
3400
  {
2356
3401
  type: "checkbox",
@@ -2363,9 +3408,9 @@ var BrushOptionsBar = ({ controller, className }) => {
2363
3408
  t.label
2364
3409
  ] }, t.id)) })
2365
3410
  ] }),
2366
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex flex-wrap gap-3 text-slate-300", role: "group", "aria-label": "Pressure", children: [
2367
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: "flex items-center gap-1.5", children: [
2368
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3411
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-wrap gap-3 text-slate-300", role: "group", "aria-label": "Pressure", children: [
3412
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { className: "flex items-center gap-1.5", children: [
3413
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2369
3414
  "input",
2370
3415
  {
2371
3416
  type: "checkbox",
@@ -2377,8 +3422,8 @@ var BrushOptionsBar = ({ controller, className }) => {
2377
3422
  ),
2378
3423
  "Pressure size"
2379
3424
  ] }),
2380
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: "flex items-center gap-1.5", children: [
2381
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3425
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { className: "flex items-center gap-1.5", children: [
3426
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2382
3427
  "input",
2383
3428
  {
2384
3429
  type: "checkbox",
@@ -2391,27 +3436,27 @@ var BrushOptionsBar = ({ controller, className }) => {
2391
3436
  "Pressure opacity"
2392
3437
  ] })
2393
3438
  ] }),
2394
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex gap-1", children: [
2395
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", className: chip(false), onClick: () => attempt(() => controller.fillPixels()), children: "Fill" }),
2396
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", className: chip(false), onClick: () => attempt(() => controller.clearPixels()), children: "Clear" })
3439
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex gap-1", children: [
3440
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: chip(false), onClick: () => attempt(() => controller.fillPixels()), children: "Fill" }),
3441
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: chip(false), onClick: () => attempt(() => controller.clearPixels()), children: "Clear" })
2397
3442
  ] }),
2398
- error && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { role: "alert", className: "text-rose-400", children: error })
3443
+ error && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { role: "alert", className: "text-rose-400", children: error })
2399
3444
  ] });
2400
3445
  };
2401
3446
 
2402
3447
  // src/image-editor/ColorProfilePanel.tsx
2403
- var import_react18 = require("react");
3448
+ var import_react21 = require("react");
2404
3449
  var import_image_editor12 = require("@pixerate/editor/image-editor");
2405
- var import_jsx_runtime17 = require("react/jsx-runtime");
3450
+ var import_jsx_runtime19 = require("react/jsx-runtime");
2406
3451
  var chip2 = "px-2 py-1 rounded text-[11px] bg-slate-800 text-slate-300 hover:text-white";
2407
3452
  var select2 = "rounded bg-slate-800 px-1 py-0.5 text-[11px] text-slate-200";
2408
3453
  var ColorProfilePanel = ({ controller, className }) => {
2409
- const [, setTick] = (0, import_react18.useState)(0);
2410
- (0, import_react18.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
2411
- const [target, setTarget] = (0, import_react18.useState)("display-p3");
2412
- const [intent, setIntent] = (0, import_react18.useState)("relative");
2413
- const [bpc, setBpc] = (0, import_react18.useState)(true);
2414
- const [error, setError] = (0, import_react18.useState)(null);
3454
+ const [, setTick] = (0, import_react21.useState)(0);
3455
+ (0, import_react21.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
3456
+ const [target, setTarget] = (0, import_react21.useState)("display-p3");
3457
+ const [intent, setIntent] = (0, import_react21.useState)("relative");
3458
+ const [bpc, setBpc] = (0, import_react21.useState)(true);
3459
+ const [error, setError] = (0, import_react21.useState)(null);
2415
3460
  const view = (0, import_image_editor12.colorPanelView)(controller);
2416
3461
  const attempt = (fn) => {
2417
3462
  try {
@@ -2433,29 +3478,29 @@ var ColorProfilePanel = ({ controller, className }) => {
2433
3478
  })
2434
3479
  );
2435
3480
  };
2436
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-slate-200 ${className ?? ""}`, "data-testid": "color-profile-panel", children: [
2437
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex items-center gap-2", children: [
2438
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "text-slate-400", children: "Profile" }),
2439
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { "data-testid": "color-profile-name", children: view.profileName })
3481
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-slate-200 ${className ?? ""}`, "data-testid": "color-profile-panel", children: [
3482
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center gap-2", children: [
3483
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "text-slate-400", children: "Profile" }),
3484
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { "data-testid": "color-profile-name", children: view.profileName })
2440
3485
  ] }),
2441
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": "Colour mode", children: [
2442
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "text-slate-400", children: "Mode" }),
2443
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("select", { "aria-label": "Colour mode", className: select2, value: view.mode, onChange: (e) => attempt(() => controller.setColorMode(e.target.value)), children: import_image_editor12.COLOR_MODE_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("option", { value: o.id, title: o.title, children: o.label }, o.id)) }),
2444
- view.cmykProfileName && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "text-slate-400", children: view.cmykProfileName })
3486
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": "Colour mode", children: [
3487
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "text-slate-400", children: "Mode" }),
3488
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("select", { "aria-label": "Colour mode", className: select2, value: view.mode, onChange: (e) => attempt(() => controller.setColorMode(e.target.value)), children: import_image_editor12.COLOR_MODE_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: o.id, title: o.title, children: o.label }, o.id)) }),
3489
+ view.cmykProfileName && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "text-slate-400", children: view.cmykProfileName })
2445
3490
  ] }),
2446
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": "Assign or convert", children: [
2447
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("select", { "aria-label": "Target profile", className: select2, value: target, onChange: (e) => setTarget(e.target.value), children: import_image_editor12.WORKING_SPACE_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("option", { value: o.id, children: o.label }, o.id)) }),
2448
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("select", { "aria-label": "Rendering intent", className: select2, value: intent, onChange: (e) => setIntent(e.target.value), children: import_image_editor12.INTENT_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("option", { value: o.id, title: o.title, children: o.label }, o.id)) }),
2449
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("label", { className: "flex items-center gap-1", children: [
2450
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("input", { type: "checkbox", "aria-label": "Black point compensation", checked: bpc, onChange: (e) => setBpc(e.target.checked), className: "accent-indigo-500" }),
3491
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": "Assign or convert", children: [
3492
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("select", { "aria-label": "Target profile", className: select2, value: target, onChange: (e) => setTarget(e.target.value), children: import_image_editor12.WORKING_SPACE_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: o.id, children: o.label }, o.id)) }),
3493
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("select", { "aria-label": "Rendering intent", className: select2, value: intent, onChange: (e) => setIntent(e.target.value), children: import_image_editor12.INTENT_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: o.id, title: o.title, children: o.label }, o.id)) }),
3494
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("label", { className: "flex items-center gap-1", children: [
3495
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("input", { type: "checkbox", "aria-label": "Black point compensation", checked: bpc, onChange: (e) => setBpc(e.target.checked), className: "accent-indigo-500" }),
2451
3496
  "BPC"
2452
3497
  ] }),
2453
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: chip2, title: "Edit \u203A Assign Profile: keep the numbers", onClick: () => attempt(() => controller.assignProfile(target)), children: "Assign" }),
2454
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: chip2, title: "Edit \u203A Convert to Profile: keep the look", onClick: () => attempt(() => controller.convertToProfile(target, { intent, bpc })), children: "Convert" })
3498
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", className: chip2, title: "Edit \u203A Assign Profile: keep the numbers", onClick: () => attempt(() => controller.assignProfile(target)), children: "Assign" }),
3499
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", className: chip2, title: "Edit \u203A Convert to Profile: keep the look", onClick: () => attempt(() => controller.convertToProfile(target, { intent, bpc })), children: "Convert" })
2455
3500
  ] }),
2456
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": "Proof setup", children: [
2457
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "text-slate-400", children: "Proof" }),
2458
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
3501
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": "Proof setup", children: [
3502
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "text-slate-400", children: "Proof" }),
3503
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
2459
3504
  "select",
2460
3505
  {
2461
3506
  "aria-label": "Proof profile",
@@ -2463,31 +3508,31 @@ var ColorProfilePanel = ({ controller, className }) => {
2463
3508
  value: view.proof?.id ?? "",
2464
3509
  onChange: (e) => e.target.value ? proofWith({ id: e.target.value }) : attempt(() => controller.setProofSetup(null)),
2465
3510
  children: [
2466
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("option", { value: "", children: "Off" }),
2467
- import_image_editor12.PROOF_PROFILE_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("option", { value: o.id, children: o.label }, o.id))
3511
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: "", children: "Off" }),
3512
+ import_image_editor12.PROOF_PROFILE_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: o.id, children: o.label }, o.id))
2468
3513
  ]
2469
3514
  }
2470
3515
  ),
2471
- view.proof && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
2472
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("select", { "aria-label": "Proof intent", className: select2, value: view.proof.intent, onChange: (e) => proofWith({ intent: e.target.value }), children: import_image_editor12.INTENT_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("option", { value: o.id, children: o.label }, o.id)) }),
2473
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("label", { className: "flex items-center gap-1", children: [
2474
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("input", { type: "checkbox", "aria-label": "Simulate paper colour", checked: view.proof.simulatePaper, onChange: (e) => proofWith({ simulatePaper: e.target.checked }), className: "accent-indigo-500" }),
3516
+ view.proof && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
3517
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("select", { "aria-label": "Proof intent", className: select2, value: view.proof.intent, onChange: (e) => proofWith({ intent: e.target.value }), children: import_image_editor12.INTENT_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: o.id, children: o.label }, o.id)) }),
3518
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("label", { className: "flex items-center gap-1", children: [
3519
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("input", { type: "checkbox", "aria-label": "Simulate paper colour", checked: view.proof.simulatePaper, onChange: (e) => proofWith({ simulatePaper: e.target.checked }), className: "accent-indigo-500" }),
2475
3520
  "Paper"
2476
3521
  ] }),
2477
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("label", { className: "flex items-center gap-1", children: [
2478
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("input", { type: "checkbox", "aria-label": "Gamut warning", checked: view.proof.gamutWarning, onChange: (e) => proofWith({ gamutWarning: e.target.checked }), className: "accent-indigo-500" }),
3522
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("label", { className: "flex items-center gap-1", children: [
3523
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("input", { type: "checkbox", "aria-label": "Gamut warning", checked: view.proof.gamutWarning, onChange: (e) => proofWith({ gamutWarning: e.target.checked }), className: "accent-indigo-500" }),
2479
3524
  "Gamut warning"
2480
3525
  ] })
2481
3526
  ] })
2482
3527
  ] }),
2483
- error && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { role: "alert", className: "text-rose-400", children: error })
3528
+ error && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { role: "alert", className: "text-rose-400", children: error })
2484
3529
  ] });
2485
3530
  };
2486
3531
 
2487
3532
  // src/image-editor/SelectionOptionsBar.tsx
2488
- var import_react19 = require("react");
3533
+ var import_react22 = require("react");
2489
3534
  var import_image_editor13 = require("@pixerate/editor/image-editor");
2490
- var import_jsx_runtime18 = require("react/jsx-runtime");
3535
+ var import_jsx_runtime20 = require("react/jsx-runtime");
2491
3536
  var MODIFY_OPS = [
2492
3537
  { op: "grow", label: "Grow" },
2493
3538
  { op: "shrink", label: "Shrink" },
@@ -2504,20 +3549,20 @@ var SelectionOptionsBar = ({
2504
3549
  quickMask,
2505
3550
  className = ""
2506
3551
  }) => {
2507
- const [radius, setRadius] = (0, import_react19.useState)(2);
3552
+ const [radius, setRadius] = (0, import_react22.useState)(2);
2508
3553
  const set = (patch) => onOptionsChange({ ...options, ...patch });
2509
3554
  const sel = selection === void 0 ? controller.getSelection() : selection;
2510
3555
  const qm = quickMask ?? Boolean(controller.getState().quickMask);
2511
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { "data-testid": "selection-options-bar", className: `flex flex-col gap-3 text-xs ${className}`, children: [
2512
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { role: "group", "aria-label": "Selection tool", className: "flex flex-wrap gap-1", children: import_image_editor13.SELECTION_TOOLS.map((t) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", "aria-pressed": options.tool === t.id, className: btn2(options.tool === t.id), onClick: () => set({ tool: t.id }), children: t.label }, t.id)) }),
2513
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { role: "group", "aria-label": "Selection mode", className: "flex flex-wrap gap-1", children: import_image_editor13.SELECTION_MODES.map((m) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", "aria-pressed": options.mode === m, className: btn2(options.mode === m), onClick: () => set({ mode: m }), children: import_image_editor13.SELECTION_MODE_LABELS[m] }, m)) }),
2514
- options.tool === "wand" && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-col gap-2", children: [
2515
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { className: "flex flex-col gap-1", children: [
2516
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { className: "flex justify-between text-slate-400", children: [
2517
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { children: "Tolerance" }),
2518
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "font-mono", children: options.tolerance })
3556
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { "data-testid": "selection-options-bar", className: `flex flex-col gap-3 text-xs ${className}`, children: [
3557
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { role: "group", "aria-label": "Selection tool", className: "flex flex-wrap gap-1", children: import_image_editor13.SELECTION_TOOLS.map((t) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", "aria-pressed": options.tool === t.id, className: btn2(options.tool === t.id), onClick: () => set({ tool: t.id }), children: t.label }, t.id)) }),
3558
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { role: "group", "aria-label": "Selection mode", className: "flex flex-wrap gap-1", children: import_image_editor13.SELECTION_MODES.map((m) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", "aria-pressed": options.mode === m, className: btn2(options.mode === m), onClick: () => set({ mode: m }), children: import_image_editor13.SELECTION_MODE_LABELS[m] }, m)) }),
3559
+ options.tool === "wand" && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex flex-col gap-2", children: [
3560
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { className: "flex flex-col gap-1", children: [
3561
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { className: "flex justify-between text-slate-400", children: [
3562
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { children: "Tolerance" }),
3563
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "font-mono", children: options.tolerance })
2519
3564
  ] }),
2520
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3565
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2521
3566
  "input",
2522
3567
  {
2523
3568
  type: "range",
@@ -2531,17 +3576,17 @@ var SelectionOptionsBar = ({
2531
3576
  }
2532
3577
  )
2533
3578
  ] }),
2534
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { className: "flex items-center gap-2 text-slate-300", children: [
2535
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("input", { type: "checkbox", checked: options.contiguous, onChange: (e) => set({ contiguous: e.target.checked }) }),
3579
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { className: "flex items-center gap-2 text-slate-300", children: [
3580
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("input", { type: "checkbox", checked: options.contiguous, onChange: (e) => set({ contiguous: e.target.checked }) }),
2536
3581
  "Contiguous"
2537
3582
  ] }),
2538
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { className: "flex items-center gap-2 text-slate-300", children: [
2539
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("input", { type: "checkbox", checked: options.sampleMerged, onChange: (e) => set({ sampleMerged: e.target.checked }) }),
3583
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { className: "flex items-center gap-2 text-slate-300", children: [
3584
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("input", { type: "checkbox", checked: options.sampleMerged, onChange: (e) => set({ sampleMerged: e.target.checked }) }),
2540
3585
  "Sample adjusted image"
2541
3586
  ] }),
2542
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { className: "flex items-center gap-2 text-slate-300", children: [
3587
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { className: "flex items-center gap-2 text-slate-300", children: [
2543
3588
  "Sample",
2544
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
3589
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
2545
3590
  "select",
2546
3591
  {
2547
3592
  "aria-label": "Sample from",
@@ -2549,27 +3594,27 @@ var SelectionOptionsBar = ({
2549
3594
  onChange: (e) => set({ sample: e.target.value }),
2550
3595
  className: "bg-slate-800 border border-slate-700 rounded px-1 py-0.5",
2551
3596
  children: [
2552
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("option", { value: "composite", children: "All layers" }),
2553
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("option", { value: "active-layer", children: "Active layer" })
3597
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: "composite", children: "All layers" }),
3598
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: "active-layer", children: "Active layer" })
2554
3599
  ]
2555
3600
  }
2556
3601
  )
2557
3602
  ] })
2558
3603
  ] }),
2559
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { className: "flex items-center gap-2 text-slate-300", children: [
2560
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("input", { type: "checkbox", checked: options.antiAlias, onChange: (e) => set({ antiAlias: e.target.checked }) }),
3604
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { className: "flex items-center gap-2 text-slate-300", children: [
3605
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("input", { type: "checkbox", checked: options.antiAlias, onChange: (e) => set({ antiAlias: e.target.checked }) }),
2561
3606
  "Anti-alias"
2562
3607
  ] }),
2563
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
2564
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: btn2(false), onClick: () => controller.selectAll(), children: "Select All" }),
2565
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: btn2(false), disabled: !sel, onClick: () => controller.deselect(), children: "Deselect" }),
2566
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: btn2(false), onClick: () => controller.invertSelection(), children: "Inverse" }),
2567
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", "aria-pressed": qm, className: btn2(qm), onClick: () => controller.setQuickMask(!qm), children: "Quick Mask" })
3608
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
3609
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", className: btn2(false), onClick: () => controller.selectAll(), children: "Select All" }),
3610
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", className: btn2(false), disabled: !sel, onClick: () => controller.deselect(), children: "Deselect" }),
3611
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", className: btn2(false), onClick: () => controller.invertSelection(), children: "Inverse" }),
3612
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", "aria-pressed": qm, className: btn2(qm), onClick: () => controller.setQuickMask(!qm), children: "Quick Mask" })
2568
3613
  ] }),
2569
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
2570
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { className: "flex items-center gap-1 text-slate-400", children: [
3614
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
3615
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { className: "flex items-center gap-1 text-slate-400", children: [
2571
3616
  "Radius",
2572
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3617
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2573
3618
  "input",
2574
3619
  {
2575
3620
  type: "number",
@@ -2583,24 +3628,24 @@ var SelectionOptionsBar = ({
2583
3628
  }
2584
3629
  )
2585
3630
  ] }),
2586
- MODIFY_OPS.map(({ op, label }) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: btn2(false), disabled: !sel, onClick: () => controller.modifySelection(op, radius), children: label }, op))
3631
+ MODIFY_OPS.map(({ op, label }) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", className: btn2(false), disabled: !sel, onClick: () => controller.modifySelection(op, radius), children: label }, op))
2587
3632
  ] }),
2588
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { "data-testid": "selection-status", className: "text-slate-400", children: (0, import_image_editor13.describeSelection)(sel) })
3633
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { "data-testid": "selection-status", className: "text-slate-400", children: (0, import_image_editor13.describeSelection)(sel) })
2589
3634
  ] });
2590
3635
  };
2591
3636
 
2592
3637
  // src/image-editor/RefineEdgePanel.tsx
2593
- var import_react20 = require("react");
3638
+ var import_react23 = require("react");
2594
3639
  var import_image_editor14 = require("@pixerate/editor/image-editor");
2595
- var import_jsx_runtime19 = require("react/jsx-runtime");
3640
+ var import_jsx_runtime21 = require("react/jsx-runtime");
2596
3641
  var DEFAULT_PARAMS = { radius: 8, smartRadius: false, smooth: 0, feather: 0, contrast: 0, shiftEdge: 0 };
2597
3642
  var button3 = "px-2 py-1 rounded-md border border-slate-800 bg-slate-950 text-[11px] text-slate-200 hover:text-white disabled:opacity-40";
2598
3643
  var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
2599
- const [params, setParams] = (0, import_react20.useState)(DEFAULT_PARAMS);
2600
- const [busy, setBusy] = (0, import_react20.useState)(false);
2601
- const [error, setError] = (0, import_react20.useState)(null);
2602
- const [layerId, setLayerId] = (0, import_react20.useState)("");
2603
- const [newKind, setNewKind] = (0, import_react20.useState)("hueSaturation");
3644
+ const [params, setParams] = (0, import_react23.useState)(DEFAULT_PARAMS);
3645
+ const [busy, setBusy] = (0, import_react23.useState)(false);
3646
+ const [error, setError] = (0, import_react23.useState)(null);
3647
+ const [layerId, setLayerId] = (0, import_react23.useState)("");
3648
+ const [newKind, setNewKind] = (0, import_react23.useState)("hueSaturation");
2604
3649
  const sel = selection === void 0 ? controller.getSelection() : selection;
2605
3650
  const list = layers ?? controller.getAdjustmentLayers();
2606
3651
  const target = list.find((l) => l.id === layerId) ?? list[list.length - 1];
@@ -2615,17 +3660,17 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
2615
3660
  setBusy(false);
2616
3661
  }
2617
3662
  };
2618
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { "data-testid": "refine-edge-panel", className: `flex flex-col gap-3 text-xs ${className}`, children: [
2619
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "font-semibold text-slate-200 uppercase tracking-wider text-[11px]", children: "Refine Edge" }),
2620
- import_image_editor14.REFINE_EDGE_CONTROLS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("label", { className: "flex flex-col gap-1", children: [
2621
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { className: "flex justify-between text-slate-400", children: [
2622
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { children: c.label }),
2623
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { className: "font-mono", children: [
3663
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { "data-testid": "refine-edge-panel", className: `flex flex-col gap-3 text-xs ${className}`, children: [
3664
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "font-semibold text-slate-200 uppercase tracking-wider text-[11px]", children: "Refine Edge" }),
3665
+ import_image_editor14.REFINE_EDGE_CONTROLS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex flex-col gap-1", children: [
3666
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { className: "flex justify-between text-slate-400", children: [
3667
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: c.label }),
3668
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { className: "font-mono", children: [
2624
3669
  params[c.id],
2625
3670
  c.unit
2626
3671
  ] })
2627
3672
  ] }),
2628
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
3673
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2629
3674
  "input",
2630
3675
  {
2631
3676
  type: "range",
@@ -2639,28 +3684,28 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
2639
3684
  }
2640
3685
  )
2641
3686
  ] }, c.id)),
2642
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("label", { className: "flex items-center gap-2 text-slate-300", children: [
2643
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("input", { type: "checkbox", checked: params.smartRadius, onChange: (e) => setParams({ ...params, smartRadius: e.target.checked }) }),
3687
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center gap-2 text-slate-300", children: [
3688
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("input", { type: "checkbox", checked: params.smartRadius, onChange: (e) => setParams({ ...params, smartRadius: e.target.checked }) }),
2644
3689
  "Smart Radius"
2645
3690
  ] }),
2646
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex gap-1", children: [
2647
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", className: button3, disabled: !sel || busy, onClick: refine, children: "Refine Edge" }),
2648
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", className: button3, onClick: () => setParams(DEFAULT_PARAMS), children: "Reset" })
3691
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex gap-1", children: [
3692
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", className: button3, disabled: !sel || busy, onClick: refine, children: "Refine Edge" }),
3693
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", className: button3, onClick: () => setParams(DEFAULT_PARAMS), children: "Reset" })
2649
3694
  ] }),
2650
- error && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { role: "alert", className: "text-rose-400", children: error }),
2651
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "font-semibold text-slate-200 uppercase tracking-wider text-[11px] mt-2", children: "Layer Mask" }),
2652
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex gap-1 items-center", children: [
2653
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
3695
+ error && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { role: "alert", className: "text-rose-400", children: error }),
3696
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "font-semibold text-slate-200 uppercase tracking-wider text-[11px] mt-2", children: "Layer Mask" }),
3697
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex gap-1 items-center", children: [
3698
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2654
3699
  "select",
2655
3700
  {
2656
3701
  "aria-label": "New masked layer kind",
2657
3702
  value: newKind,
2658
3703
  onChange: (e) => setNewKind(e.target.value),
2659
3704
  className: "flex-1 bg-slate-950 border border-slate-800 rounded px-1 py-1 text-slate-200",
2660
- children: import_image_editor14.ADJUSTMENT_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: k.kind, children: k.label }, k.kind))
3705
+ children: import_image_editor14.ADJUSTMENT_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("option", { value: k.kind, children: k.label }, k.kind))
2661
3706
  }
2662
3707
  ),
2663
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
3708
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2664
3709
  "button",
2665
3710
  {
2666
3711
  type: "button",
@@ -2671,35 +3716,35 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
2671
3716
  }
2672
3717
  )
2673
3718
  ] }),
2674
- list.length > 0 && target && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex flex-col gap-2", children: [
2675
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
3719
+ list.length > 0 && target && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-col gap-2", children: [
3720
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2676
3721
  "select",
2677
3722
  {
2678
3723
  "aria-label": "Mask layer",
2679
3724
  value: target.id,
2680
3725
  onChange: (e) => setLayerId(e.target.value),
2681
3726
  className: "bg-slate-950 border border-slate-800 rounded px-1 py-1 text-slate-200",
2682
- children: list.map((l) => /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("option", { value: l.id, children: [
3727
+ children: list.map((l) => /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("option", { value: l.id, children: [
2683
3728
  l.name || (0, import_image_editor14.adjustmentKindLabel)(l.kind),
2684
3729
  l.mask ? " (masked)" : ""
2685
3730
  ] }, l.id))
2686
3731
  }
2687
3732
  ),
2688
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
2689
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", className: button3, disabled: !sel, onClick: () => controller.applySelectionAsLayerMask(target.id), children: "Mask with Selection" }),
2690
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", className: button3, disabled: !target.mask, onClick: () => controller.selectionFromLayerMask(target.id), children: "Load as Selection" }),
2691
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", className: button3, disabled: !target.mask, onClick: () => controller.setAdjustmentLayerMask(target.id, null), children: "Remove Mask" })
3733
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
3734
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", className: button3, disabled: !sel, onClick: () => controller.applySelectionAsLayerMask(target.id), children: "Mask with Selection" }),
3735
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", className: button3, disabled: !target.mask, onClick: () => controller.selectionFromLayerMask(target.id), children: "Load as Selection" }),
3736
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", className: button3, disabled: !target.mask, onClick: () => controller.setAdjustmentLayerMask(target.id, null), children: "Remove Mask" })
2692
3737
  ] }),
2693
- target.mask && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
2694
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("label", { className: "flex flex-col gap-1", children: [
2695
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { className: "flex justify-between text-slate-400", children: [
2696
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { children: "Density" }),
2697
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { className: "font-mono", children: [
3738
+ target.mask && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
3739
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex flex-col gap-1", children: [
3740
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { className: "flex justify-between text-slate-400", children: [
3741
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: "Density" }),
3742
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { className: "font-mono", children: [
2698
3743
  Math.round((target.mask.density ?? 1) * 100),
2699
3744
  "%"
2700
3745
  ] })
2701
3746
  ] }),
2702
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
3747
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2703
3748
  "input",
2704
3749
  {
2705
3750
  type: "range",
@@ -2713,15 +3758,15 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
2713
3758
  }
2714
3759
  )
2715
3760
  ] }),
2716
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("label", { className: "flex flex-col gap-1", children: [
2717
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { className: "flex justify-between text-slate-400", children: [
2718
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { children: "Mask Feather" }),
2719
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { className: "font-mono", children: [
3761
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex flex-col gap-1", children: [
3762
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { className: "flex justify-between text-slate-400", children: [
3763
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: "Mask Feather" }),
3764
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { className: "font-mono", children: [
2720
3765
  target.mask.feather ?? 0,
2721
3766
  "px"
2722
3767
  ] })
2723
3768
  ] }),
2724
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
3769
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2725
3770
  "input",
2726
3771
  {
2727
3772
  type: "range",
@@ -2741,14 +3786,14 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
2741
3786
  };
2742
3787
 
2743
3788
  // src/image-editor/FreeTransformOptionsBar.tsx
2744
- var import_react21 = require("react");
3789
+ var import_react24 = require("react");
2745
3790
  var import_image_editor15 = require("@pixerate/editor/image-editor");
2746
- var import_jsx_runtime20 = require("react/jsx-runtime");
3791
+ var import_jsx_runtime22 = require("react/jsx-runtime");
2747
3792
  var chip3 = (on) => `px-2 py-1 rounded text-[11px] ${on ? "bg-indigo-600 text-white" : "bg-slate-800 text-slate-300 hover:text-white"}`;
2748
3793
  var round = (v, unit) => unit === "px" ? Math.round(v * 10) / 10 : Math.round(v * 100) / 100;
2749
3794
  var FreeTransformOptionsBar = ({ tool, className }) => {
2750
- const [, setTick] = (0, import_react21.useState)(0);
2751
- (0, import_react21.useEffect)(() => tool.subscribe(() => setTick((n) => n + 1)), [tool]);
3795
+ const [, setTick] = (0, import_react24.useState)(0);
3796
+ (0, import_react24.useEffect)(() => tool.subscribe(() => setTick((n) => n + 1)), [tool]);
2752
3797
  const bar = tool.bar();
2753
3798
  if (!tool.active || !bar) return null;
2754
3799
  const warp = tool.warpBar();
@@ -2760,17 +3805,17 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
2760
3805
  const v = Number(raw);
2761
3806
  if (raw.trim() !== "" && Number.isFinite(v) && Math.abs(v - bar[field]) > 1e-9) tool.setField(field, v);
2762
3807
  };
2763
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: `flex flex-wrap items-center gap-2 text-xs text-slate-200 ${className ?? ""}`, "data-testid": "free-transform-options", role: "toolbar", "aria-label": "Free Transform options", children: [
2764
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "flex gap-1", role: "group", "aria-label": "Transform mode", children: import_image_editor15.FREE_TRANSFORM_MODE_OPTIONS.map((m) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", title: m.title, "aria-pressed": tool.mode === m.id, className: chip3(tool.mode === m.id), onClick: () => tool.setMode(m.id), children: m.label }, m.id)) }),
2765
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "grid grid-cols-3 gap-px", role: "group", "aria-label": "Reference point", children: import_image_editor15.TRANSFORM_ANCHORS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", "aria-label": `Reference point ${a}`, title: `Reference point: ${a}`, className: "h-2.5 w-2.5 rounded-sm bg-slate-700 hover:bg-indigo-500", onClick: () => tool.setReference(a) }, a)) }),
2766
- tool.mode === "warp" && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex flex-wrap items-center gap-2", role: "group", "aria-label": "Warp options", children: [
2767
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { className: "flex items-center gap-1", children: [
2768
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-slate-400", children: "Warp" }),
2769
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("select", { "aria-label": "Warp style", value: warp.style, onChange: (e) => tool.setWarp({ style: e.target.value }), className: "rounded border border-slate-700 bg-slate-900 px-1 py-0.5", children: import_image_editor15.WARP_STYLE_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: o.id, children: o.label }, o.id)) })
3808
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: `flex flex-wrap items-center gap-2 text-xs text-slate-200 ${className ?? ""}`, "data-testid": "free-transform-options", role: "toolbar", "aria-label": "Free Transform options", children: [
3809
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "flex gap-1", role: "group", "aria-label": "Transform mode", children: import_image_editor15.FREE_TRANSFORM_MODE_OPTIONS.map((m) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", title: m.title, "aria-pressed": tool.mode === m.id, className: chip3(tool.mode === m.id), onClick: () => tool.setMode(m.id), children: m.label }, m.id)) }),
3810
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "grid grid-cols-3 gap-px", role: "group", "aria-label": "Reference point", children: import_image_editor15.TRANSFORM_ANCHORS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", "aria-label": `Reference point ${a}`, title: `Reference point: ${a}`, className: "h-2.5 w-2.5 rounded-sm bg-slate-700 hover:bg-indigo-500", onClick: () => tool.setReference(a) }, a)) }),
3811
+ tool.mode === "warp" && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex flex-wrap items-center gap-2", role: "group", "aria-label": "Warp options", children: [
3812
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("label", { className: "flex items-center gap-1", children: [
3813
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-slate-400", children: "Warp" }),
3814
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("select", { "aria-label": "Warp style", value: warp.style, onChange: (e) => tool.setWarp({ style: e.target.value }), className: "rounded border border-slate-700 bg-slate-900 px-1 py-0.5", children: import_image_editor15.WARP_STYLE_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("option", { value: o.id, children: o.label }, o.id)) })
2770
3815
  ] }),
2771
- ["bend", "horizontal", "vertical"].map((k) => /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { className: "flex items-center gap-1", children: [
2772
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-slate-400", children: k === "bend" ? "Bend" : k === "horizontal" ? "H" : "V" }),
2773
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3816
+ ["bend", "horizontal", "vertical"].map((k) => /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("label", { className: "flex items-center gap-1", children: [
3817
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-slate-400", children: k === "bend" ? "Bend" : k === "horizontal" ? "H" : "V" }),
3818
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2774
3819
  "input",
2775
3820
  {
2776
3821
  type: "number",
@@ -2791,9 +3836,9 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
2791
3836
  },
2792
3837
  `${k}:${warp[k]}`
2793
3838
  ),
2794
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-slate-500", children: "%" })
3839
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-slate-500", children: "%" })
2795
3840
  ] }, k)),
2796
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3841
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2797
3842
  "button",
2798
3843
  {
2799
3844
  type: "button",
@@ -2805,9 +3850,9 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
2805
3850
  children: "Vertical"
2806
3851
  }
2807
3852
  ),
2808
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { className: "flex items-center gap-1", children: [
2809
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-slate-400", children: "Grid" }),
2810
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3853
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("label", { className: "flex items-center gap-1", children: [
3854
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-slate-400", children: "Grid" }),
3855
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2811
3856
  "select",
2812
3857
  {
2813
3858
  "aria-label": "Warp grid",
@@ -2817,14 +3862,14 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
2817
3862
  tool.setWarp({ columns: g.columns, rows: g.rows });
2818
3863
  },
2819
3864
  className: "rounded border border-slate-700 bg-slate-900 px-1 py-0.5",
2820
- children: import_image_editor15.WARP_GRID_OPTIONS.map((g) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: g.id, children: g.label }, g.id))
3865
+ children: import_image_editor15.WARP_GRID_OPTIONS.map((g) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("option", { value: g.id, children: g.label }, g.id))
2821
3866
  }
2822
3867
  )
2823
3868
  ] })
2824
3869
  ] }),
2825
- tool.mode !== "warp" && import_image_editor15.FREE_TRANSFORM_FIELDS.map((f) => /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { className: "flex items-center gap-1", title: f.title, children: [
2826
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-slate-400", children: f.label }),
2827
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3870
+ tool.mode !== "warp" && import_image_editor15.FREE_TRANSFORM_FIELDS.map((f) => /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("label", { className: "flex items-center gap-1", title: f.title, children: [
3871
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-slate-400", children: f.label }),
3872
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2828
3873
  "input",
2829
3874
  {
2830
3875
  type: "number",
@@ -2844,8 +3889,8 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
2844
3889
  },
2845
3890
  `${f.id}:${round(bar[f.id], f.unit)}`
2846
3891
  ),
2847
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-slate-500", children: f.unit }),
2848
- f.id === "scaleX" && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3892
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-slate-500", children: f.unit }),
3893
+ f.id === "scaleX" && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2849
3894
  "button",
2850
3895
  {
2851
3896
  type: "button",
@@ -2860,34 +3905,34 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
2860
3905
  }
2861
3906
  )
2862
3907
  ] }, f.id)),
2863
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { className: "flex items-center gap-1", children: [
2864
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-slate-400", children: "Interpolation" }),
2865
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3908
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("label", { className: "flex items-center gap-1", children: [
3909
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-slate-400", children: "Interpolation" }),
3910
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2866
3911
  "select",
2867
3912
  {
2868
3913
  "aria-label": "Interpolation",
2869
3914
  value: tool.interpolation,
2870
3915
  onChange: (e) => tool.setInterpolation(e.target.value),
2871
3916
  className: "rounded border border-slate-700 bg-slate-900 px-1 py-0.5",
2872
- children: import_image_editor15.INTERPOLATIONS.map((i) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: i, children: i[0].toUpperCase() + i.slice(1) }, i))
3917
+ children: import_image_editor15.INTERPOLATIONS.map((i) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("option", { value: i, children: i[0].toUpperCase() + i.slice(1) }, i))
2873
3918
  }
2874
3919
  )
2875
3920
  ] }),
2876
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", title: "Commit (Enter)", className: "px-2 py-1 rounded bg-emerald-600 text-white hover:bg-emerald-500", onClick: () => tool.commit(), children: "Commit" }),
2877
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", title: "Cancel (Esc)", className: chip3(false), onClick: () => tool.cancel(), children: "Cancel" }),
2878
- tool.error && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { role: "alert", className: "text-rose-400", children: tool.error })
3921
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", title: "Commit (Enter)", className: "px-2 py-1 rounded bg-emerald-600 text-white hover:bg-emerald-500", onClick: () => tool.commit(), children: "Commit" }),
3922
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", title: "Cancel (Esc)", className: chip3(false), onClick: () => tool.cancel(), children: "Cancel" }),
3923
+ tool.error && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { role: "alert", className: "text-rose-400", children: tool.error })
2879
3924
  ] });
2880
3925
  };
2881
3926
 
2882
3927
  // src/image-editor/ShapeOptionsBar.tsx
2883
- var import_react22 = require("react");
3928
+ var import_react25 = require("react");
2884
3929
  var import_image_editor16 = require("@pixerate/editor/image-editor");
2885
- var import_jsx_runtime21 = require("react/jsx-runtime");
3930
+ var import_jsx_runtime23 = require("react/jsx-runtime");
2886
3931
  var chip4 = (on) => `px-2 py-1 rounded text-[11px] ${on ? "bg-indigo-600 text-white" : "bg-slate-800 text-slate-300 hover:text-white"}`;
2887
3932
  var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
2888
- const [, setTick] = (0, import_react22.useState)(0);
2889
- (0, import_react22.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
2890
- const [error, setError] = (0, import_react22.useState)(null);
3933
+ const [, setTick] = (0, import_react25.useState)(0);
3934
+ (0, import_react25.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
3935
+ const [error, setError] = (0, import_react25.useState)(null);
2891
3936
  const active = controller.getActiveLayer();
2892
3937
  const shapeId = active?.type === "shape" ? active.id : null;
2893
3938
  const set = (change) => {
@@ -2901,13 +3946,13 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
2901
3946
  }
2902
3947
  };
2903
3948
  const num = (v, min, max) => Math.max(min, Math.min(max, Number(v) || min));
2904
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-slate-200 ${className ?? ""}`, "data-testid": "shape-options", children: [
2905
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Shape kind", children: import_image_editor16.LIVE_SHAPE_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", "aria-pressed": options.kind === k, className: chip4(options.kind === k), onClick: () => onChange({ ...options, kind: k }), children: import_image_editor16.SHAPE_KIND_LABELS[k] }, k)) }),
2906
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
2907
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center gap-1", children: [
2908
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("input", { type: "checkbox", "aria-label": "Fill", checked: options.fill !== null, onChange: (e) => set({ fill: e.target.checked ? "#4f46e5" : null }) }),
3949
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-slate-200 ${className ?? ""}`, "data-testid": "shape-options", children: [
3950
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Shape kind", children: import_image_editor16.LIVE_SHAPE_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { type: "button", "aria-pressed": options.kind === k, className: chip4(options.kind === k), onClick: () => onChange({ ...options, kind: k }), children: import_image_editor16.SHAPE_KIND_LABELS[k] }, k)) }),
3951
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
3952
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { className: "flex items-center gap-1", children: [
3953
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("input", { type: "checkbox", "aria-label": "Fill", checked: options.fill !== null, onChange: (e) => set({ fill: e.target.checked ? "#4f46e5" : null }) }),
2909
3954
  "Fill",
2910
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3955
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2911
3956
  "input",
2912
3957
  {
2913
3958
  type: "color",
@@ -2919,10 +3964,10 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
2919
3964
  }
2920
3965
  )
2921
3966
  ] }),
2922
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center gap-1", children: [
2923
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("input", { type: "checkbox", "aria-label": "Stroke", checked: options.stroke !== null, onChange: (e) => set({ stroke: e.target.checked ? "#000000" : null }) }),
3967
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { className: "flex items-center gap-1", children: [
3968
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("input", { type: "checkbox", "aria-label": "Stroke", checked: options.stroke !== null, onChange: (e) => set({ stroke: e.target.checked ? "#000000" : null }) }),
2924
3969
  "Stroke",
2925
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3970
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2926
3971
  "input",
2927
3972
  {
2928
3973
  type: "color",
@@ -2934,9 +3979,9 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
2934
3979
  }
2935
3980
  )
2936
3981
  ] }),
2937
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center gap-1", children: [
3982
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { className: "flex items-center gap-1", children: [
2938
3983
  "Width",
2939
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3984
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2940
3985
  "input",
2941
3986
  {
2942
3987
  type: "number",
@@ -2950,23 +3995,23 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
2950
3995
  )
2951
3996
  ] })
2952
3997
  ] }),
2953
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
2954
- options.kind === "rect" && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center gap-1", children: [
3998
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
3999
+ options.kind === "rect" && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { className: "flex items-center gap-1", children: [
2955
4000
  "Radius",
2956
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("input", { type: "number", "aria-label": "Corner radius", min: 0, max: 1e3, value: options.radius, onChange: (e) => set({ radius: num(e.target.value, 0, 1e3) }), className: "w-14 rounded border border-slate-700 bg-slate-950 px-1 py-0.5" })
4001
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("input", { type: "number", "aria-label": "Corner radius", min: 0, max: 1e3, value: options.radius, onChange: (e) => set({ radius: num(e.target.value, 0, 1e3) }), className: "w-14 rounded border border-slate-700 bg-slate-950 px-1 py-0.5" })
2957
4002
  ] }),
2958
- options.kind === "polygon" && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center gap-1", children: [
4003
+ options.kind === "polygon" && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { className: "flex items-center gap-1", children: [
2959
4004
  "Sides",
2960
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("input", { type: "number", "aria-label": "Sides", min: 3, max: 100, value: options.sides, onChange: (e) => set({ sides: num(e.target.value, 3, 100) }), className: "w-14 rounded border border-slate-700 bg-slate-950 px-1 py-0.5" })
4005
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("input", { type: "number", "aria-label": "Sides", min: 3, max: 100, value: options.sides, onChange: (e) => set({ sides: num(e.target.value, 3, 100) }), className: "w-14 rounded border border-slate-700 bg-slate-950 px-1 py-0.5" })
2961
4006
  ] }),
2962
- options.kind === "star" && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
2963
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center gap-1", children: [
4007
+ options.kind === "star" && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
4008
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { className: "flex items-center gap-1", children: [
2964
4009
  "Points",
2965
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("input", { type: "number", "aria-label": "Points", min: 3, max: 100, value: options.points, onChange: (e) => set({ points: num(e.target.value, 3, 100) }), className: "w-14 rounded border border-slate-700 bg-slate-950 px-1 py-0.5" })
4010
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("input", { type: "number", "aria-label": "Points", min: 3, max: 100, value: options.points, onChange: (e) => set({ points: num(e.target.value, 3, 100) }), className: "w-14 rounded border border-slate-700 bg-slate-950 px-1 py-0.5" })
2966
4011
  ] }),
2967
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center gap-1", children: [
4012
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { className: "flex items-center gap-1", children: [
2968
4013
  "Inner",
2969
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4014
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2970
4015
  "input",
2971
4016
  {
2972
4017
  type: "range",
@@ -2981,33 +4026,33 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
2981
4026
  )
2982
4027
  ] })
2983
4028
  ] }),
2984
- options.kind === "line" && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
2985
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center gap-1", children: [
4029
+ options.kind === "line" && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
4030
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { className: "flex items-center gap-1", children: [
2986
4031
  "Weight",
2987
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("input", { type: "number", "aria-label": "Line weight", min: 1, max: 200, value: options.weight, onChange: (e) => set({ weight: num(e.target.value, 1, 200) }), className: "w-14 rounded border border-slate-700 bg-slate-950 px-1 py-0.5" })
4032
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("input", { type: "number", "aria-label": "Line weight", min: 1, max: 200, value: options.weight, onChange: (e) => set({ weight: num(e.target.value, 1, 200) }), className: "w-14 rounded border border-slate-700 bg-slate-950 px-1 py-0.5" })
2988
4033
  ] }),
2989
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center gap-1", children: [
2990
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("input", { type: "checkbox", "aria-label": "Arrowhead", checked: options.arrow, onChange: (e) => set({ arrow: e.target.checked }) }),
4034
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { className: "flex items-center gap-1", children: [
4035
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("input", { type: "checkbox", "aria-label": "Arrowhead", checked: options.arrow, onChange: (e) => set({ arrow: e.target.checked }) }),
2991
4036
  "Arrowhead"
2992
4037
  ] })
2993
4038
  ] })
2994
4039
  ] }),
2995
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "text-[10px] text-slate-500", children: "Drag on the image to draw. Shift: square, circle or 45\xB0 line. Alt: from the centre." }),
2996
- error && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { role: "alert", className: "text-rose-400", children: error })
4040
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "text-[10px] text-slate-500", children: "Drag on the image to draw. Shift: square, circle or 45\xB0 line. Alt: from the centre." }),
4041
+ error && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { role: "alert", className: "text-rose-400", children: error })
2997
4042
  ] });
2998
4043
  };
2999
4044
 
3000
4045
  // src/image-editor/TypeOptionsBar.tsx
3001
- var import_react23 = require("react");
4046
+ var import_react26 = require("react");
3002
4047
  var import_image_editor17 = require("@pixerate/editor/image-editor");
3003
- var import_jsx_runtime22 = require("react/jsx-runtime");
4048
+ var import_jsx_runtime24 = require("react/jsx-runtime");
3004
4049
  var chip5 = (on) => `px-2 py-1 rounded text-[11px] ${on ? "bg-indigo-600 text-white" : "bg-slate-800 text-slate-300 hover:text-white"}`;
3005
4050
  var ALIGN_LABELS = { left: "Left", center: "Centre", right: "Right", justify: "Justify" };
3006
4051
  var TypeOptionsBar = ({ controller, options, onChange, session, className }) => {
3007
- const [, setTick] = (0, import_react23.useState)(0);
3008
- (0, import_react23.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
3009
- (0, import_react23.useEffect)(() => session?.subscribe(() => setTick((n) => n + 1)), [session]);
3010
- const [error, setError] = (0, import_react23.useState)(null);
4052
+ const [, setTick] = (0, import_react26.useState)(0);
4053
+ (0, import_react26.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
4054
+ (0, import_react26.useEffect)(() => session?.subscribe(() => setTick((n) => n + 1)), [session]);
4055
+ const [error, setError] = (0, import_react26.useState)(null);
3011
4056
  const active = controller.getActiveLayer();
3012
4057
  const typeId = !session && active?.type === "type" ? active.id : null;
3013
4058
  const here = session?.alive ? session.styleHere() : {};
@@ -3039,11 +4084,11 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
3039
4084
  setError(e instanceof Error ? e.message : String(e));
3040
4085
  }
3041
4086
  };
3042
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-slate-200 ${className ?? ""}`, "data-testid": "type-options", children: [
3043
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
3044
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("label", { className: "flex items-center gap-1", children: [
4087
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-slate-200 ${className ?? ""}`, "data-testid": "type-options", children: [
4088
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
4089
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("label", { className: "flex items-center gap-1", children: [
3045
4090
  "Font",
3046
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
4091
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3047
4092
  "input",
3048
4093
  {
3049
4094
  list: "pixerate-type-fonts",
@@ -3053,11 +4098,11 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
3053
4098
  className: "w-32 rounded border border-slate-700 bg-slate-950 px-1 py-0.5"
3054
4099
  }
3055
4100
  ),
3056
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("datalist", { id: "pixerate-type-fonts", children: fonts.map((f) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("option", { value: f }, f)) })
4101
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("datalist", { id: "pixerate-type-fonts", children: fonts.map((f) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("option", { value: f }, f)) })
3057
4102
  ] }),
3058
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("label", { className: "flex items-center gap-1", children: [
4103
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("label", { className: "flex items-center gap-1", children: [
3059
4104
  "Size",
3060
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
4105
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3061
4106
  "input",
3062
4107
  {
3063
4108
  type: "number",
@@ -3070,24 +4115,24 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
3070
4115
  }
3071
4116
  )
3072
4117
  ] }),
3073
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", "aria-pressed": shown.fontWeight >= 600, className: `${chip5(shown.fontWeight >= 600)} font-bold`, onClick: () => style({ fontWeight: shown.fontWeight >= 600 ? 400 : 700 }), children: "B" }),
3074
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", "aria-pressed": shown.italic, className: `${chip5(shown.italic)} italic`, onClick: () => style({ italic: !shown.italic }), children: "I" }),
3075
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("input", { type: "color", "aria-label": "Text colour", value: shown.color, onChange: (e) => style({ color: e.target.value }), className: "h-6 w-8 rounded border border-slate-700 bg-transparent" })
4118
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("button", { type: "button", "aria-pressed": shown.fontWeight >= 600, className: `${chip5(shown.fontWeight >= 600)} font-bold`, onClick: () => style({ fontWeight: shown.fontWeight >= 600 ? 400 : 700 }), children: "B" }),
4119
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("button", { type: "button", "aria-pressed": shown.italic, className: `${chip5(shown.italic)} italic`, onClick: () => style({ italic: !shown.italic }), children: "I" }),
4120
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("input", { type: "color", "aria-label": "Text colour", value: shown.color, onChange: (e) => style({ color: e.target.value }), className: "h-6 w-8 rounded border border-slate-700 bg-transparent" })
3076
4121
  ] }),
3077
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Alignment", children: import_image_editor17.TEXT_ALIGNS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", "aria-pressed": options.align === a, className: chip5(options.align === a), onClick: () => style({ align: a }), children: ALIGN_LABELS[a] }, a)) }),
3078
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "text-[10px] text-slate-500", children: "Click to type point text, drag for a paragraph box, click text to edit it. Esc finishes." }),
3079
- missing.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("p", { role: "status", className: "text-amber-400", "data-testid": "type-missing-fonts", children: [
4122
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Alignment", children: import_image_editor17.TEXT_ALIGNS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("button", { type: "button", "aria-pressed": options.align === a, className: chip5(options.align === a), onClick: () => style({ align: a }), children: ALIGN_LABELS[a] }, a)) }),
4123
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { className: "text-[10px] text-slate-500", children: "Click to type point text, drag for a paragraph box, click text to edit it. Esc finishes." }),
4124
+ missing.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("p", { role: "status", className: "text-amber-400", "data-testid": "type-missing-fonts", children: [
3080
4125
  "Missing ",
3081
4126
  missing.length === 1 ? "font" : "fonts",
3082
4127
  ": ",
3083
4128
  missing.join(", ")
3084
4129
  ] }),
3085
- error && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { role: "alert", className: "text-rose-400", children: error })
4130
+ error && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { role: "alert", className: "text-rose-400", children: error })
3086
4131
  ] });
3087
4132
  };
3088
4133
 
3089
4134
  // src/image-editor/ImageEditor.tsx
3090
- var import_jsx_runtime23 = require("react/jsx-runtime");
4135
+ var import_jsx_runtime25 = require("react/jsx-runtime");
3091
4136
  var ImageEditor = ({
3092
4137
  editor: externalEditor,
3093
4138
  src,
@@ -3111,15 +4156,15 @@ var ImageEditor = ({
3111
4156
  return l.type === "pixel" && !!l.generator || l.type === "smart" && !!l.smartFilters?.filters.some((f) => f.kind === "effect") || l.type === "group" && l.children.some(has);
3112
4157
  });
3113
4158
  const legacyProcess = (0, import_image_editor18.normalizeProcessVersion)(state.adjustments.process) < import_image_editor18.LATEST_PROCESS_VERSION;
3114
- const canvasRef = (0, import_react24.useRef)(null);
3115
- const containerRef = (0, import_react24.useRef)(null);
3116
- const [activeTab, setActiveTab] = (0, import_react24.useState)("crop");
3117
- const rootRef = (0, import_react24.useRef)(null);
3118
- const activeTabRef = (0, import_react24.useRef)(activeTab);
4159
+ const canvasRef = (0, import_react27.useRef)(null);
4160
+ const containerRef = (0, import_react27.useRef)(null);
4161
+ const [activeTab, setActiveTab] = (0, import_react27.useState)("crop");
4162
+ const rootRef = (0, import_react27.useRef)(null);
4163
+ const activeTabRef = (0, import_react27.useRef)(activeTab);
3119
4164
  activeTabRef.current = activeTab;
3120
4165
  const ambientPlayback = useAgentPlayback();
3121
4166
  const playing = (playback === void 0 ? ambientPlayback : playback) ?? null;
3122
- const [locateLayer] = (0, import_react24.useState)(() => (0, import_image_editor18.createImagePlaybackLocator)(controller));
4167
+ const [locateLayer] = (0, import_react27.useState)(() => (0, import_image_editor18.createImagePlaybackLocator)(controller));
3123
4168
  const docToRoot = (p) => {
3124
4169
  const canvas = canvasRef.current;
3125
4170
  const root = rootRef.current;
@@ -3176,26 +4221,26 @@ var ImageEditor = ({
3176
4221
  fromViewport: clientToDoc,
3177
4222
  reveal: () => onPlaybackReveal?.()
3178
4223
  });
3179
- const [activeCropRatio, setActiveCropRatio] = (0, import_react24.useState)(null);
3180
- const [selectionOptions, setSelectionOptions] = (0, import_react24.useState)(import_image_editor18.DEFAULT_SELECTION_TOOL_OPTIONS);
3181
- const selectionOptionsRef = (0, import_react24.useRef)(selectionOptions);
4224
+ const [activeCropRatio, setActiveCropRatio] = (0, import_react27.useState)(null);
4225
+ const [selectionOptions, setSelectionOptions] = (0, import_react27.useState)(import_image_editor18.DEFAULT_SELECTION_TOOL_OPTIONS);
4226
+ const selectionOptionsRef = (0, import_react27.useRef)(selectionOptions);
3182
4227
  selectionOptionsRef.current = selectionOptions;
3183
- const selectionGestureRef = (0, import_react24.useRef)(null);
4228
+ const selectionGestureRef = (0, import_react27.useRef)(null);
3184
4229
  if (!selectionGestureRef.current || selectionGestureRef.current.controller !== controller) {
3185
4230
  selectionGestureRef.current = new import_image_editor18.SelectionGesture(controller, () => selectionOptionsRef.current);
3186
4231
  }
3187
- const selectionDraftRef = (0, import_react24.useRef)(null);
3188
- const [selectionError, setSelectionError] = (0, import_react24.useState)(null);
3189
- const paintGestureRef = (0, import_react24.useRef)(null);
3190
- const paintControllerRef = (0, import_react24.useRef)(controller);
4232
+ const selectionDraftRef = (0, import_react27.useRef)(null);
4233
+ const [selectionError, setSelectionError] = (0, import_react27.useState)(null);
4234
+ const paintGestureRef = (0, import_react27.useRef)(null);
4235
+ const paintControllerRef = (0, import_react27.useRef)(controller);
3191
4236
  if (!paintGestureRef.current || paintControllerRef.current !== controller) {
3192
4237
  paintGestureRef.current = new import_image_editor18.PaintGesture(controller);
3193
4238
  paintControllerRef.current = controller;
3194
4239
  }
3195
- const brushCursorRef = (0, import_react24.useRef)(null);
3196
- const [paintError, setPaintError] = (0, import_react24.useState)(null);
3197
- const transformToolRef = (0, import_react24.useRef)(null);
3198
- const transformControllerRef = (0, import_react24.useRef)(controller);
4240
+ const brushCursorRef = (0, import_react27.useRef)(null);
4241
+ const [paintError, setPaintError] = (0, import_react27.useState)(null);
4242
+ const transformToolRef = (0, import_react27.useRef)(null);
4243
+ const transformControllerRef = (0, import_react27.useRef)(controller);
3199
4244
  if (!transformToolRef.current || transformControllerRef.current !== controller) {
3200
4245
  transformToolRef.current?.cancel();
3201
4246
  transformToolRef.current = new import_image_editor18.FreeTransformTool(controller, {
@@ -3204,33 +4249,33 @@ var ImageEditor = ({
3204
4249
  transformControllerRef.current = controller;
3205
4250
  }
3206
4251
  const transformTool = transformToolRef.current;
3207
- const [, setTransformTick] = (0, import_react24.useState)(0);
3208
- const [transformCursor, setTransformCursor] = (0, import_react24.useState)("default");
3209
- const [shapeOptions, setShapeOptions] = (0, import_react24.useState)(import_image_editor18.DEFAULT_SHAPE_TOOL_OPTIONS);
3210
- const shapeOptionsRef = (0, import_react24.useRef)(shapeOptions);
4252
+ const [, setTransformTick] = (0, import_react27.useState)(0);
4253
+ const [transformCursor, setTransformCursor] = (0, import_react27.useState)("default");
4254
+ const [shapeOptions, setShapeOptions] = (0, import_react27.useState)(import_image_editor18.DEFAULT_SHAPE_TOOL_OPTIONS);
4255
+ const shapeOptionsRef = (0, import_react27.useRef)(shapeOptions);
3211
4256
  shapeOptionsRef.current = shapeOptions;
3212
- const [typeOptions, setTypeOptions] = (0, import_react24.useState)(import_image_editor18.DEFAULT_TYPE_TOOL_OPTIONS);
3213
- const typeOptionsRef = (0, import_react24.useRef)(typeOptions);
4257
+ const [typeOptions, setTypeOptions] = (0, import_react27.useState)(import_image_editor18.DEFAULT_TYPE_TOOL_OPTIONS);
4258
+ const typeOptionsRef = (0, import_react27.useRef)(typeOptions);
3214
4259
  typeOptionsRef.current = typeOptions;
3215
- const shapeGestureRef = (0, import_react24.useRef)(null);
3216
- const typeToolRef = (0, import_react24.useRef)(null);
3217
- const shapeTypeControllerRef = (0, import_react24.useRef)(controller);
4260
+ const shapeGestureRef = (0, import_react27.useRef)(null);
4261
+ const typeToolRef = (0, import_react27.useRef)(null);
4262
+ const shapeTypeControllerRef = (0, import_react27.useRef)(controller);
3218
4263
  if (!shapeGestureRef.current || !typeToolRef.current || shapeTypeControllerRef.current !== controller) {
3219
4264
  typeToolRef.current?.finish();
3220
4265
  shapeGestureRef.current = new import_image_editor18.ShapeDrawGesture(controller, () => shapeOptionsRef.current);
3221
4266
  typeToolRef.current = new import_image_editor18.TypeToolGesture(controller, () => typeOptionsRef.current);
3222
4267
  shapeTypeControllerRef.current = controller;
3223
4268
  }
3224
- const typeInputRef = (0, import_react24.useRef)(null);
3225
- const [typeSession, setTypeSession] = (0, import_react24.useState)(typeToolRef.current.session);
3226
- const [shapeTypeError, setShapeTypeError] = (0, import_react24.useState)(null);
3227
- const [inpaintPrompt, setInpaintPrompt] = (0, import_react24.useState)("");
3228
- const [inpaintMaskMode, setInpaintMaskMode] = (0, import_react24.useState)("annotations");
3229
- const [isRemovingBg, setIsRemovingBg] = (0, import_react24.useState)(false);
3230
- const [isInpainting, setIsInpainting] = (0, import_react24.useState)(false);
3231
- const [aiError, setAiError] = (0, import_react24.useState)(null);
3232
- const [aiSuccess, setAiSuccess] = (0, import_react24.useState)(null);
3233
- const [aiTarget, setAiTarget] = (0, import_react24.useState)("auto");
4269
+ const typeInputRef = (0, import_react27.useRef)(null);
4270
+ const [typeSession, setTypeSession] = (0, import_react27.useState)(typeToolRef.current.session);
4271
+ const [shapeTypeError, setShapeTypeError] = (0, import_react27.useState)(null);
4272
+ const [inpaintPrompt, setInpaintPrompt] = (0, import_react27.useState)("");
4273
+ const [inpaintMaskMode, setInpaintMaskMode] = (0, import_react27.useState)("annotations");
4274
+ const [isRemovingBg, setIsRemovingBg] = (0, import_react27.useState)(false);
4275
+ const [isInpainting, setIsInpainting] = (0, import_react27.useState)(false);
4276
+ const [aiError, setAiError] = (0, import_react27.useState)(null);
4277
+ const [aiSuccess, setAiSuccess] = (0, import_react27.useState)(null);
4278
+ const [aiTarget, setAiTarget] = (0, import_react27.useState)("auto");
3234
4279
  const aiOptions = aiTarget === "auto" ? {} : { target: aiTarget };
3235
4280
  const effectiveOnInpaint = onInpaint || aiHooks?.onInpaint;
3236
4281
  const effectiveOnRemoveBg = onRemoveBackground || aiHooks?.onRemoveBackground;
@@ -3293,18 +4338,18 @@ var ImageEditor = ({
3293
4338
  setIsInpainting(false);
3294
4339
  }
3295
4340
  };
3296
- const [activeColor, setActiveColor] = (0, import_react24.useState)("#ef4444");
3297
- const [strokeWidth, setStrokeWidth] = (0, import_react24.useState)(3);
3298
- const [fontSize, setFontSize] = (0, import_react24.useState)(24);
3299
- const [textInput, setTextInput] = (0, import_react24.useState)("");
3300
- const draftAnnotationRef = (0, import_react24.useRef)(null);
3301
- const draftCropRef = (0, import_react24.useRef)(null);
3302
- const cropDragInfoRef = (0, import_react24.useRef)(null);
3303
- const annotationDragInfoRef = (0, import_react24.useRef)(null);
3304
- const isDrawingRef = (0, import_react24.useRef)(false);
3305
- const currentPathRef = (0, import_react24.useRef)([]);
3306
- const dragStartPointRef = (0, import_react24.useRef)(null);
3307
- const renderCanvas = (0, import_react24.useCallback)(
4341
+ const [activeColor, setActiveColor] = (0, import_react27.useState)("#ef4444");
4342
+ const [strokeWidth, setStrokeWidth] = (0, import_react27.useState)(3);
4343
+ const [fontSize, setFontSize] = (0, import_react27.useState)(24);
4344
+ const [textInput, setTextInput] = (0, import_react27.useState)("");
4345
+ const draftAnnotationRef = (0, import_react27.useRef)(null);
4346
+ const draftCropRef = (0, import_react27.useRef)(null);
4347
+ const cropDragInfoRef = (0, import_react27.useRef)(null);
4348
+ const annotationDragInfoRef = (0, import_react27.useRef)(null);
4349
+ const isDrawingRef = (0, import_react27.useRef)(false);
4350
+ const currentPathRef = (0, import_react27.useRef)([]);
4351
+ const dragStartPointRef = (0, import_react27.useRef)(null);
4352
+ const renderCanvas = (0, import_react27.useCallback)(
3308
4353
  async (draftAnnotation, draftCrop) => {
3309
4354
  const canvas = canvasRef.current;
3310
4355
  const container = containerRef.current;
@@ -3327,8 +4372,8 @@ var ImageEditor = ({
3327
4372
  },
3328
4373
  [controller, activeTab, transformTool]
3329
4374
  );
3330
- (0, import_react24.useEffect)(() => typeSession?.subscribe(() => void renderCanvas()), [typeSession, renderCanvas]);
3331
- (0, import_react24.useEffect)(() => {
4375
+ (0, import_react27.useEffect)(() => typeSession?.subscribe(() => void renderCanvas()), [typeSession, renderCanvas]);
4376
+ (0, import_react27.useEffect)(() => {
3332
4377
  if (activeTab === "annotate" && state.activeTool === "type") return;
3333
4378
  if (typeToolRef.current?.session) {
3334
4379
  typeToolRef.current.finish();
@@ -3363,7 +4408,7 @@ var ImageEditor = ({
3363
4408
  el.value = "";
3364
4409
  }
3365
4410
  };
3366
- (0, import_react24.useEffect)(() => transformTool.subscribe(() => {
4411
+ (0, import_react27.useEffect)(() => transformTool.subscribe(() => {
3367
4412
  setTransformTick((n) => n + 1);
3368
4413
  void renderCanvas();
3369
4414
  }), [transformTool, renderCanvas]);
@@ -3406,7 +4451,7 @@ var ImageEditor = ({
3406
4451
  transformTool.up();
3407
4452
  return true;
3408
4453
  };
3409
- (0, import_react24.useEffect)(() => {
4454
+ (0, import_react27.useEffect)(() => {
3410
4455
  if (typeof window === "undefined") return;
3411
4456
  const onKey = (e) => {
3412
4457
  if (transformTool.key(e)) e.preventDefault();
@@ -3414,7 +4459,7 @@ var ImageEditor = ({
3414
4459
  window.addEventListener("keydown", onKey);
3415
4460
  return () => window.removeEventListener("keydown", onKey);
3416
4461
  }, [transformTool]);
3417
- (0, import_react24.useEffect)(() => {
4462
+ (0, import_react27.useEffect)(() => {
3418
4463
  const raf = typeof requestAnimationFrame !== "undefined" ? requestAnimationFrame : (cb) => setTimeout(cb, 0);
3419
4464
  const caf = typeof cancelAnimationFrame !== "undefined" ? cancelAnimationFrame : (id) => clearTimeout(id);
3420
4465
  const animId = raf(() => {
@@ -3422,12 +4467,12 @@ var ImageEditor = ({
3422
4467
  });
3423
4468
  return () => caf(animId);
3424
4469
  }, [renderCanvas, state]);
3425
- (0, import_react24.useEffect)(() => {
4470
+ (0, import_react27.useEffect)(() => {
3426
4471
  if (activeTab === "crop" && editor.state.activeTool !== "crop") {
3427
4472
  editor.setTool("crop");
3428
4473
  }
3429
4474
  }, [activeTab, editor]);
3430
- (0, import_react24.useEffect)(() => {
4475
+ (0, import_react27.useEffect)(() => {
3431
4476
  const container = containerRef.current;
3432
4477
  if (!container) return;
3433
4478
  if (typeof ResizeObserver !== "undefined") {
@@ -3495,7 +4540,7 @@ var ImageEditor = ({
3495
4540
  if (g.error) setPaintError(g.error);
3496
4541
  }
3497
4542
  };
3498
- (0, import_react24.useEffect)(() => {
4543
+ (0, import_react27.useEffect)(() => {
3499
4544
  if (activeTab !== "paint" || typeof window === "undefined") return;
3500
4545
  const onKey = (e) => {
3501
4546
  if ((0, import_image_editor18.handlePaintShortcut)(controller, e)) e.preventDefault();
@@ -3890,17 +4935,17 @@ var ImageEditor = ({
3890
4935
  link.click();
3891
4936
  }
3892
4937
  };
3893
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
4938
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
3894
4939
  "div",
3895
4940
  {
3896
4941
  ref: rootRef,
3897
4942
  className: `relative flex flex-col bg-slate-900 border border-slate-800 rounded-xl overflow-hidden shadow-2xl text-slate-100 ${className}`,
3898
4943
  style,
3899
4944
  children: [
3900
- playing && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(PresenceLayer, { presence: agentPresence, viewport: docToRoot }),
3901
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-wrap items-center justify-between px-4 py-3 bg-slate-950/80 border-b border-slate-800 gap-3", children: [
3902
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex items-center gap-1 bg-slate-900 p-1 rounded-lg border border-slate-800 text-xs", children: [
3903
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
4945
+ playing && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(PresenceLayer, { presence: agentPresence, viewport: docToRoot }),
4946
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex flex-wrap items-center justify-between px-4 py-3 bg-slate-950/80 border-b border-slate-800 gap-3", children: [
4947
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex items-center gap-1 bg-slate-900 p-1 rounded-lg border border-slate-800 text-xs", children: [
4948
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3904
4949
  "button",
3905
4950
  {
3906
4951
  type: "button",
@@ -3913,7 +4958,7 @@ var ImageEditor = ({
3913
4958
  children: "Transform & Crop"
3914
4959
  }
3915
4960
  ),
3916
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
4961
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3917
4962
  "button",
3918
4963
  {
3919
4964
  type: "button",
@@ -3926,7 +4971,7 @@ var ImageEditor = ({
3926
4971
  children: "Adjustments"
3927
4972
  }
3928
4973
  ),
3929
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
4974
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3930
4975
  "button",
3931
4976
  {
3932
4977
  type: "button",
@@ -3939,7 +4984,7 @@ var ImageEditor = ({
3939
4984
  children: "Layers"
3940
4985
  }
3941
4986
  ),
3942
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
4987
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3943
4988
  "button",
3944
4989
  {
3945
4990
  type: "button",
@@ -3952,7 +4997,7 @@ var ImageEditor = ({
3952
4997
  children: "Paint"
3953
4998
  }
3954
4999
  ),
3955
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
5000
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3956
5001
  "button",
3957
5002
  {
3958
5003
  type: "button",
@@ -3965,7 +5010,7 @@ var ImageEditor = ({
3965
5010
  children: "Select & Mask"
3966
5011
  }
3967
5012
  ),
3968
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
5013
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3969
5014
  "button",
3970
5015
  {
3971
5016
  type: "button",
@@ -3978,7 +5023,7 @@ var ImageEditor = ({
3978
5023
  children: "Annotations"
3979
5024
  }
3980
5025
  ),
3981
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
5026
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3982
5027
  "button",
3983
5028
  {
3984
5029
  type: "button",
@@ -3991,7 +5036,7 @@ var ImageEditor = ({
3991
5036
  children: "Depth Mask"
3992
5037
  }
3993
5038
  ),
3994
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
5039
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
3995
5040
  "button",
3996
5041
  {
3997
5042
  type: "button",
@@ -4002,14 +5047,14 @@ var ImageEditor = ({
4002
5047
  },
4003
5048
  className: `px-3 py-1.5 rounded-md font-medium transition-colors flex items-center gap-1.5 ${activeTab === "ai" ? "bg-indigo-600 text-white shadow" : "text-slate-400 hover:text-slate-200"}`,
4004
5049
  children: [
4005
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83" }) }),
5050
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("path", { d: "M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83" }) }),
4006
5051
  "AI Tools"
4007
5052
  ]
4008
5053
  }
4009
5054
  )
4010
5055
  ] }),
4011
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex items-center gap-2 text-xs", children: [
4012
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
5056
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex items-center gap-2 text-xs", children: [
5057
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4013
5058
  "button",
4014
5059
  {
4015
5060
  type: "button",
@@ -4020,7 +5065,7 @@ var ImageEditor = ({
4020
5065
  children: "\u21A9"
4021
5066
  }
4022
5067
  ),
4023
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
5068
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4024
5069
  "button",
4025
5070
  {
4026
5071
  type: "button",
@@ -4031,7 +5076,7 @@ var ImageEditor = ({
4031
5076
  children: "\u21AA"
4032
5077
  }
4033
5078
  ),
4034
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
5079
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4035
5080
  "button",
4036
5081
  {
4037
5082
  type: "button",
@@ -4040,8 +5085,8 @@ var ImageEditor = ({
4040
5085
  children: "Reset"
4041
5086
  }
4042
5087
  ),
4043
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "h-4 w-px bg-slate-800 mx-1" }),
4044
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
5088
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "h-4 w-px bg-slate-800 mx-1" }),
5089
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4045
5090
  "button",
4046
5091
  {
4047
5092
  type: "button",
@@ -4051,11 +5096,11 @@ var ImageEditor = ({
4051
5096
  children: "-"
4052
5097
  }
4053
5098
  ),
4054
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { className: "font-mono text-slate-400 w-10 text-center", children: [
5099
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("span", { className: "font-mono text-slate-400 w-10 text-center", children: [
4055
5100
  Math.round(state.zoom * 100),
4056
5101
  "%"
4057
5102
  ] }),
4058
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
5103
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4059
5104
  "button",
4060
5105
  {
4061
5106
  type: "button",
@@ -4065,8 +5110,8 @@ var ImageEditor = ({
4065
5110
  children: "+"
4066
5111
  }
4067
5112
  ),
4068
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "h-4 w-px bg-slate-800 mx-1" }),
4069
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
5113
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "h-4 w-px bg-slate-800 mx-1" }),
5114
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4070
5115
  "button",
4071
5116
  {
4072
5117
  type: "button",
@@ -4077,7 +5122,7 @@ var ImageEditor = ({
4077
5122
  children: "Hold Compare"
4078
5123
  }
4079
5124
  ),
4080
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
5125
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4081
5126
  "button",
4082
5127
  {
4083
5128
  type: "button",
@@ -4088,16 +5133,16 @@ var ImageEditor = ({
4088
5133
  )
4089
5134
  ] })
4090
5135
  ] }),
4091
- transformTool.active && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(FreeTransformOptionsBar, { tool: transformTool, className: "border-b border-slate-800 bg-slate-900/95 px-4 py-2" }),
4092
- !transformTool.active && transformTool.error && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { role: "alert", className: "border-b border-rose-900 bg-rose-950/80 px-4 py-1.5 text-xs text-rose-200", children: transformTool.error }),
4093
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-col md:flex-row flex-1 min-h-[520px] md:h-[560px]", children: [
4094
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
5136
+ transformTool.active && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(FreeTransformOptionsBar, { tool: transformTool, className: "border-b border-slate-800 bg-slate-900/95 px-4 py-2" }),
5137
+ !transformTool.active && transformTool.error && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { role: "alert", className: "border-b border-rose-900 bg-rose-950/80 px-4 py-1.5 text-xs text-rose-200", children: transformTool.error }),
5138
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex flex-col md:flex-row flex-1 min-h-[520px] md:h-[560px]", children: [
5139
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
4095
5140
  "div",
4096
5141
  {
4097
5142
  ref: containerRef,
4098
5143
  className: "relative flex-1 h-[360px] md:h-full min-h-[320px] bg-slate-950 overflow-hidden select-none",
4099
5144
  children: [
4100
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
5145
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4101
5146
  "canvas",
4102
5147
  {
4103
5148
  ref: canvasRef,
@@ -4114,7 +5159,7 @@ var ImageEditor = ({
4114
5159
  className: `absolute inset-0 w-full h-full block ${transformTool.active ? "touch-none" : activeTab === "paint" ? "touch-none cursor-crosshair" : activeTab === "annotate" && state.activeTool === "type" ? "cursor-text" : activeTab === "annotate" && state.activeTool === "shape" ? "cursor-crosshair" : ""}`
4115
5160
  }
4116
5161
  ),
4117
- typeSession && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
5162
+ typeSession && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4118
5163
  "textarea",
4119
5164
  {
4120
5165
  ref: typeInputRef,
@@ -4136,11 +5181,11 @@ var ImageEditor = ({
4136
5181
  ]
4137
5182
  }
4138
5183
  ),
4139
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "w-full md:w-80 bg-slate-900/90 border-t md:border-t-0 md:border-l border-slate-800 p-4 overflow-y-auto h-auto md:h-full md:max-h-[560px]", children: [
4140
- activeTab === "crop" && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
4141
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "font-semibold text-slate-200 uppercase tracking-wider text-[11px]", children: "Aspect Ratio Presets" }),
4142
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "grid grid-cols-3 gap-2", children: [
4143
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
5184
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "w-full md:w-80 bg-slate-900/90 border-t md:border-t-0 md:border-l border-slate-800 p-4 overflow-y-auto h-auto md:h-full md:max-h-[560px]", children: [
5185
+ activeTab === "crop" && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
5186
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "font-semibold text-slate-200 uppercase tracking-wider text-[11px]", children: "Aspect Ratio Presets" }),
5187
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "grid grid-cols-3 gap-2", children: [
5188
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4144
5189
  "button",
4145
5190
  {
4146
5191
  type: "button",
@@ -4152,7 +5197,7 @@ var ImageEditor = ({
4152
5197
  children: "Freeform"
4153
5198
  }
4154
5199
  ),
4155
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
5200
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4156
5201
  "button",
4157
5202
  {
4158
5203
  type: "button",
@@ -4164,7 +5209,7 @@ var ImageEditor = ({
4164
5209
  children: "1:1 Square"
4165
5210
  }
4166
5211
  ),
4167
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
5212
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4168
5213
  "button",
4169
5214
  {
4170
5215
  type: "button",
@@ -4176,7 +5221,7 @@ var ImageEditor = ({
4176
5221
  children: "4:3 Standard"
4177
5222
  }
4178
5223
  ),
4179
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
5224
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4180
5225
  "button",
4181
5226
  {
4182
5227
  type: "button",
@@ -4188,7 +5233,7 @@ var ImageEditor = ({
4188
5233
  children: "16:9 Wide"
4189
5234
  }
4190
5235
  ),
4191
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
5236
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4192
5237
  "button",
4193
5238
  {
4194
5239
  type: "button",
@@ -4200,7 +5245,7 @@ var ImageEditor = ({
4200
5245
  children: "3:2 Photo"
4201
5246
  }
4202
5247
  ),
4203
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
5248
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4204
5249
  "button",
4205
5250
  {
4206
5251
  type: "button",
@@ -4213,10 +5258,10 @@ var ImageEditor = ({
4213
5258
  }
4214
5259
  )
4215
5260
  ] }),
4216
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "h-px bg-slate-800 my-1" }),
4217
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "font-semibold text-slate-200 uppercase tracking-wider text-[11px]", children: "Orientation & Flips" }),
4218
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "grid grid-cols-2 gap-2", children: [
4219
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
5261
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "h-px bg-slate-800 my-1" }),
5262
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "font-semibold text-slate-200 uppercase tracking-wider text-[11px]", children: "Orientation & Flips" }),
5263
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "grid grid-cols-2 gap-2", children: [
5264
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4220
5265
  "button",
4221
5266
  {
4222
5267
  type: "button",
@@ -4225,7 +5270,7 @@ var ImageEditor = ({
4225
5270
  children: "Rotate -90\xB0"
4226
5271
  }
4227
5272
  ),
4228
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
5273
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4229
5274
  "button",
4230
5275
  {
4231
5276
  type: "button",
@@ -4234,7 +5279,7 @@ var ImageEditor = ({
4234
5279
  children: "Rotate +90\xB0"
4235
5280
  }
4236
5281
  ),
4237
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
5282
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4238
5283
  "button",
4239
5284
  {
4240
5285
  type: "button",
@@ -4243,7 +5288,7 @@ var ImageEditor = ({
4243
5288
  children: "Flip Horizontal"
4244
5289
  }
4245
5290
  ),
4246
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
5291
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4247
5292
  "button",
4248
5293
  {
4249
5294
  type: "button",
@@ -4254,10 +5299,10 @@ var ImageEditor = ({
4254
5299
  )
4255
5300
  ] })
4256
5301
  ] }),
4257
- activeTab === "adjust" && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
4258
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex items-center justify-between", children: [
4259
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "font-semibold text-slate-200 uppercase tracking-wider text-[11px]", children: "Color Adjustments" }),
4260
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
5302
+ activeTab === "adjust" && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
5303
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex items-center justify-between", children: [
5304
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "font-semibold text-slate-200 uppercase tracking-wider text-[11px]", children: "Color Adjustments" }),
5305
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4261
5306
  "button",
4262
5307
  {
4263
5308
  type: "button",
@@ -4267,9 +5312,9 @@ var ImageEditor = ({
4267
5312
  }
4268
5313
  )
4269
5314
  ] }),
4270
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Histogram, { histogram: editor.histogram }),
4271
- import_image_editor18.IMAGE_ADJUSTMENT_CONTROLS.map((spec) => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_react24.default.Fragment, { children: [
4272
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
5315
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Histogram, { histogram: editor.histogram }),
5316
+ import_image_editor18.IMAGE_ADJUSTMENT_CONTROLS.map((spec) => /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_react27.default.Fragment, { children: [
5317
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4273
5318
  ControlSlider,
4274
5319
  {
4275
5320
  spec,
@@ -4278,14 +5323,14 @@ var ImageEditor = ({
4278
5323
  onChange: (v) => editor.setAdjustments({ [spec.id]: v })
4279
5324
  }
4280
5325
  ),
4281
- spec.id === "tint" && legacyProcess && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
5326
+ spec.id === "tint" && legacyProcess && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
4282
5327
  "div",
4283
5328
  {
4284
5329
  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-200",
4285
5330
  "data-testid": "image-editor-process-notice",
4286
5331
  children: [
4287
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { children: "Legacy rendering (process 1). Tint needs the current process." }),
4288
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
5332
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { children: "Legacy rendering (process 1). Tint needs the current process." }),
5333
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4289
5334
  "button",
4290
5335
  {
4291
5336
  type: "button",
@@ -4298,7 +5343,7 @@ var ImageEditor = ({
4298
5343
  }
4299
5344
  )
4300
5345
  ] }, spec.id)),
4301
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "border-t border-slate-700/60 pt-3", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
5346
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "border-t border-slate-700/60 pt-3", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4302
5347
  AdjustmentLayersPanel,
4303
5348
  {
4304
5349
  controller,
@@ -4307,9 +5352,9 @@ var ImageEditor = ({
4307
5352
  }
4308
5353
  ) })
4309
5354
  ] }),
4310
- activeTab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
4311
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "font-semibold text-slate-200 uppercase tracking-wider text-[11px]", children: "Layers" }),
4312
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
5355
+ activeTab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
5356
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "font-semibold text-slate-200 uppercase tracking-wider text-[11px]", children: "Layers" }),
5357
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4313
5358
  "button",
4314
5359
  {
4315
5360
  type: "button",
@@ -4320,15 +5365,15 @@ var ImageEditor = ({
4320
5365
  children: "Free Transform"
4321
5366
  }
4322
5367
  ),
4323
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(LayersPanel, { controller }),
4324
- effectsShown && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ImageProviderEffectsPanel, { controller, className: "border-t border-slate-700/60 pt-3" }),
4325
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "font-semibold text-slate-200 uppercase tracking-wider text-[11px]", children: "Colour" }),
4326
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ColorProfilePanel, { controller })
5368
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(LayersPanel, { controller }),
5369
+ effectsShown && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ImageProviderEffectsPanel, { controller, className: "border-t border-slate-700/60 pt-3" }),
5370
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "font-semibold text-slate-200 uppercase tracking-wider text-[11px]", children: "Colour" }),
5371
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ColorProfilePanel, { controller })
4327
5372
  ] }),
4328
- activeTab === "paint" && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
4329
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "font-semibold text-slate-200 uppercase tracking-wider text-[11px]", children: "Paint" }),
4330
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(BrushOptionsBar, { controller }),
4331
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
5373
+ activeTab === "paint" && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
5374
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "font-semibold text-slate-200 uppercase tracking-wider text-[11px]", children: "Paint" }),
5375
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(BrushOptionsBar, { controller }),
5376
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4332
5377
  "button",
4333
5378
  {
4334
5379
  type: "button",
@@ -4339,12 +5384,12 @@ var ImageEditor = ({
4339
5384
  children: "Free Transform"
4340
5385
  }
4341
5386
  ),
4342
- paintError && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { role: "alert", className: "text-rose-400", "data-testid": "paint-error", children: paintError }),
4343
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "border-t border-slate-700/60 pt-3", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(LayersPanel, { controller }) })
5387
+ paintError && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { role: "alert", className: "text-rose-400", "data-testid": "paint-error", children: paintError }),
5388
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "border-t border-slate-700/60 pt-3", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(LayersPanel, { controller }) })
4344
5389
  ] }),
4345
- activeTab === "annotate" && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
4346
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "font-semibold text-slate-200 uppercase tracking-wider text-[11px]", children: "Shape & Type Layers" }),
4347
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "grid grid-cols-2 gap-1.5", children: ["shape", "type"].map((t) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
5390
+ activeTab === "annotate" && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
5391
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "font-semibold text-slate-200 uppercase tracking-wider text-[11px]", children: "Shape & Type Layers" }),
5392
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "grid grid-cols-2 gap-1.5", children: ["shape", "type"].map((t) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4348
5393
  "button",
4349
5394
  {
4350
5395
  type: "button",
@@ -4355,13 +5400,13 @@ var ImageEditor = ({
4355
5400
  },
4356
5401
  t
4357
5402
  )) }),
4358
- state.activeTool === "shape" && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ShapeOptionsBar, { controller, options: shapeOptions, onChange: setShapeOptions }),
4359
- state.activeTool === "type" && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(TypeOptionsBar, { controller, options: typeOptions, onChange: setTypeOptions, session: typeSession }),
4360
- state.activeTool === "type" && typeSession && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { type: "button", onClick: finishTyping, className: "self-start rounded bg-slate-800 px-2 py-1 text-[11px] text-slate-200 hover:bg-slate-700", children: "Done editing text" }),
4361
- shapeTypeError && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { role: "alert", className: "text-rose-400", "data-testid": "shape-type-error", children: shapeTypeError }),
4362
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "h-px bg-slate-800 my-1" }),
4363
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "font-semibold text-slate-200 uppercase tracking-wider text-[11px]", children: "Draw & Annotate" }),
4364
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "grid grid-cols-3 gap-1.5", children: ["pen", "rect", "circle", "arrow", "line"].map((t) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
5403
+ state.activeTool === "shape" && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ShapeOptionsBar, { controller, options: shapeOptions, onChange: setShapeOptions }),
5404
+ state.activeTool === "type" && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(TypeOptionsBar, { controller, options: typeOptions, onChange: setTypeOptions, session: typeSession }),
5405
+ state.activeTool === "type" && typeSession && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", onClick: finishTyping, className: "self-start rounded bg-slate-800 px-2 py-1 text-[11px] text-slate-200 hover:bg-slate-700", children: "Done editing text" }),
5406
+ shapeTypeError && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { role: "alert", className: "text-rose-400", "data-testid": "shape-type-error", children: shapeTypeError }),
5407
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "h-px bg-slate-800 my-1" }),
5408
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "font-semibold text-slate-200 uppercase tracking-wider text-[11px]", children: "Draw & Annotate" }),
5409
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "grid grid-cols-3 gap-1.5", children: ["pen", "rect", "circle", "arrow", "line"].map((t) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4365
5410
  "button",
4366
5411
  {
4367
5412
  type: "button",
@@ -4371,9 +5416,9 @@ var ImageEditor = ({
4371
5416
  },
4372
5417
  t
4373
5418
  )) }),
4374
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex items-center gap-2 mt-2", children: [
4375
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("label", { className: "text-slate-400", children: "Color:" }),
4376
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
5419
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex items-center gap-2 mt-2", children: [
5420
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("label", { className: "text-slate-400", children: "Color:" }),
5421
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4377
5422
  "input",
4378
5423
  {
4379
5424
  type: "color",
@@ -4382,15 +5427,15 @@ var ImageEditor = ({
4382
5427
  className: "w-8 h-8 rounded border border-slate-700 cursor-pointer bg-transparent"
4383
5428
  }
4384
5429
  ),
4385
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex-1 ml-2", children: [
4386
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex justify-between text-slate-400 mb-0.5", children: [
4387
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { children: "Width:" }),
4388
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { className: "font-mono", children: [
5430
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex-1 ml-2", children: [
5431
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex justify-between text-slate-400 mb-0.5", children: [
5432
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { children: "Width:" }),
5433
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("span", { className: "font-mono", children: [
4389
5434
  strokeWidth,
4390
5435
  "px"
4391
5436
  ] })
4392
5437
  ] }),
4393
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
5438
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4394
5439
  "input",
4395
5440
  {
4396
5441
  type: "range",
@@ -4403,10 +5448,10 @@ var ImageEditor = ({
4403
5448
  )
4404
5449
  ] })
4405
5450
  ] }),
4406
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "h-px bg-slate-800 my-1" }),
4407
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "font-semibold text-slate-200 uppercase tracking-wider text-[11px]", children: "Add Text" }),
4408
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex gap-2", children: [
4409
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
5451
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "h-px bg-slate-800 my-1" }),
5452
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "font-semibold text-slate-200 uppercase tracking-wider text-[11px]", children: "Add Text" }),
5453
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex gap-2", children: [
5454
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4410
5455
  "input",
4411
5456
  {
4412
5457
  type: "text",
@@ -4417,7 +5462,7 @@ var ImageEditor = ({
4417
5462
  className: "flex-1 bg-slate-950 border border-slate-700 rounded-lg px-2.5 py-1.5 text-xs text-slate-100 placeholder-slate-500 focus:outline-none focus:border-indigo-500"
4418
5463
  }
4419
5464
  ),
4420
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
5465
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4421
5466
  "button",
4422
5467
  {
4423
5468
  type: "button",
@@ -4427,14 +5472,14 @@ var ImageEditor = ({
4427
5472
  }
4428
5473
  )
4429
5474
  ] }),
4430
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex items-center justify-between text-slate-400", children: [
4431
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { children: "Font Size:" }),
4432
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { className: "font-mono", children: [
5475
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex items-center justify-between text-slate-400", children: [
5476
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { children: "Font Size:" }),
5477
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("span", { className: "font-mono", children: [
4433
5478
  fontSize,
4434
5479
  "px"
4435
5480
  ] })
4436
5481
  ] }),
4437
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
5482
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4438
5483
  "input",
4439
5484
  {
4440
5485
  type: "range",
@@ -4445,14 +5490,14 @@ var ImageEditor = ({
4445
5490
  className: "w-full accent-indigo-500"
4446
5491
  }
4447
5492
  ),
4448
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "h-px bg-slate-800 my-1" }),
4449
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex items-center justify-between", children: [
4450
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { className: "text-slate-400", children: [
5493
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "h-px bg-slate-800 my-1" }),
5494
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex items-center justify-between", children: [
5495
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("span", { className: "text-slate-400", children: [
4451
5496
  "Layers (",
4452
5497
  state.annotations.length,
4453
5498
  ")"
4454
5499
  ] }),
4455
- state.selectedAnnotationId && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
5500
+ state.selectedAnnotationId && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4456
5501
  "button",
4457
5502
  {
4458
5503
  type: "button",
@@ -4461,7 +5506,7 @@ var ImageEditor = ({
4461
5506
  children: "Delete Selected"
4462
5507
  }
4463
5508
  ),
4464
- state.annotations.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
5509
+ state.annotations.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4465
5510
  "button",
4466
5511
  {
4467
5512
  type: "button",
@@ -4472,10 +5517,10 @@ var ImageEditor = ({
4472
5517
  )
4473
5518
  ] })
4474
5519
  ] }),
4475
- activeTab === "depth" && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
4476
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex items-center justify-between", children: [
4477
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "font-semibold text-slate-200 uppercase tracking-wider text-[11px]", children: "Depth Masking" }),
4478
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
5520
+ activeTab === "depth" && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
5521
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex items-center justify-between", children: [
5522
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "font-semibold text-slate-200 uppercase tracking-wider text-[11px]", children: "Depth Masking" }),
5523
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4479
5524
  "button",
4480
5525
  {
4481
5526
  type: "button",
@@ -4485,8 +5530,8 @@ var ImageEditor = ({
4485
5530
  }
4486
5531
  )
4487
5532
  ] }),
4488
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { className: "flex items-center gap-2 cursor-pointer text-slate-300", children: [
4489
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
5533
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-2 cursor-pointer text-slate-300", children: [
5534
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4490
5535
  "input",
4491
5536
  {
4492
5537
  type: "checkbox",
@@ -4495,12 +5540,12 @@ var ImageEditor = ({
4495
5540
  className: "rounded accent-indigo-500"
4496
5541
  }
4497
5542
  ),
4498
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { children: "Enable Depth / Alpha Mask" })
5543
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { children: "Enable Depth / Alpha Mask" })
4499
5544
  ] }),
4500
- state.depthMask.enabled && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
4501
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { children: [
4502
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("label", { className: "text-slate-400 block mb-1", children: "Mask Image URL:" }),
4503
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
5545
+ state.depthMask.enabled && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
5546
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { children: [
5547
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("label", { className: "text-slate-400 block mb-1", children: "Mask Image URL:" }),
5548
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4504
5549
  "input",
4505
5550
  {
4506
5551
  type: "text",
@@ -4511,8 +5556,8 @@ var ImageEditor = ({
4511
5556
  }
4512
5557
  )
4513
5558
  ] }),
4514
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex gap-2", children: [
4515
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
5559
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex gap-2", children: [
5560
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4516
5561
  "button",
4517
5562
  {
4518
5563
  type: "button",
@@ -4521,7 +5566,7 @@ var ImageEditor = ({
4521
5566
  children: "Threshold Mode"
4522
5567
  }
4523
5568
  ),
4524
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
5569
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4525
5570
  "button",
4526
5571
  {
4527
5572
  type: "button",
@@ -4531,12 +5576,12 @@ var ImageEditor = ({
4531
5576
  }
4532
5577
  )
4533
5578
  ] }),
4534
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { children: [
4535
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex justify-between text-slate-400 mb-1", children: [
4536
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { children: "Depth Start (Lower):" }),
4537
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "font-mono", children: state.depthMask.depthRange[0] })
5579
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { children: [
5580
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex justify-between text-slate-400 mb-1", children: [
5581
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { children: "Depth Start (Lower):" }),
5582
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "font-mono", children: state.depthMask.depthRange[0] })
4538
5583
  ] }),
4539
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
5584
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4540
5585
  "input",
4541
5586
  {
4542
5587
  type: "range",
@@ -4550,12 +5595,12 @@ var ImageEditor = ({
4550
5595
  }
4551
5596
  )
4552
5597
  ] }),
4553
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { children: [
4554
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex justify-between text-slate-400 mb-1", children: [
4555
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { children: "Depth Stop (Upper):" }),
4556
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "font-mono", children: state.depthMask.depthRange[1] })
5598
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { children: [
5599
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex justify-between text-slate-400 mb-1", children: [
5600
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { children: "Depth Stop (Upper):" }),
5601
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "font-mono", children: state.depthMask.depthRange[1] })
4557
5602
  ] }),
4558
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
5603
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4559
5604
  "input",
4560
5605
  {
4561
5606
  type: "range",
@@ -4569,12 +5614,12 @@ var ImageEditor = ({
4569
5614
  }
4570
5615
  )
4571
5616
  ] }),
4572
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { children: [
4573
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex justify-between text-slate-400 mb-1", children: [
4574
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { children: "Softness:" }),
4575
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "font-mono", children: state.depthMask.softness })
5617
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { children: [
5618
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex justify-between text-slate-400 mb-1", children: [
5619
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { children: "Softness:" }),
5620
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "font-mono", children: state.depthMask.softness })
4576
5621
  ] }),
4577
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
5622
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4578
5623
  "input",
4579
5624
  {
4580
5625
  type: "range",
@@ -4586,8 +5631,8 @@ var ImageEditor = ({
4586
5631
  }
4587
5632
  )
4588
5633
  ] }),
4589
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { className: "flex items-center gap-2 cursor-pointer text-slate-300 mt-1", children: [
4590
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
5634
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-2 cursor-pointer text-slate-300 mt-1", children: [
5635
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4591
5636
  "input",
4592
5637
  {
4593
5638
  type: "checkbox",
@@ -4596,12 +5641,12 @@ var ImageEditor = ({
4596
5641
  className: "rounded accent-indigo-500"
4597
5642
  }
4598
5643
  ),
4599
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { children: "Invert Mask" })
5644
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { children: "Invert Mask" })
4600
5645
  ] })
4601
5646
  ] })
4602
5647
  ] }),
4603
- activeTab === "select" && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
4604
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
5648
+ activeTab === "select" && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
5649
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4605
5650
  SelectionOptionsBar,
4606
5651
  {
4607
5652
  controller,
@@ -4611,9 +5656,9 @@ var ImageEditor = ({
4611
5656
  quickMask: Boolean(state.quickMask)
4612
5657
  }
4613
5658
  ),
4614
- selectionError && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { role: "alert", className: "text-rose-400", children: selectionError }),
4615
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex gap-1", children: [
4616
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
5659
+ selectionError && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { role: "alert", className: "text-rose-400", children: selectionError }),
5660
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex gap-1", children: [
5661
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4617
5662
  "button",
4618
5663
  {
4619
5664
  type: "button",
@@ -4624,7 +5669,7 @@ var ImageEditor = ({
4624
5669
  children: "Transform Selection"
4625
5670
  }
4626
5671
  ),
4627
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
5672
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4628
5673
  "button",
4629
5674
  {
4630
5675
  type: "button",
@@ -4636,12 +5681,12 @@ var ImageEditor = ({
4636
5681
  }
4637
5682
  )
4638
5683
  ] }),
4639
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(RefineEdgePanel, { controller, selection: state.selection ?? null, layers: state.adjustments.layers })
5684
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(RefineEdgePanel, { controller, selection: state.selection ?? null, layers: state.adjustments.layers })
4640
5685
  ] }),
4641
- activeTab === "ai" && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
4642
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { className: "flex items-center justify-between gap-2 text-slate-300", children: [
4643
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { children: "Results go to" }),
4644
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
5686
+ activeTab === "ai" && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
5687
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center justify-between gap-2 text-slate-300", children: [
5688
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { children: "Results go to" }),
5689
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
4645
5690
  "select",
4646
5691
  {
4647
5692
  "aria-label": "AI result target",
@@ -4649,54 +5694,54 @@ var ImageEditor = ({
4649
5694
  onChange: (e) => setAiTarget(e.target.value),
4650
5695
  className: "bg-slate-800 border border-slate-700 rounded px-1.5 py-1",
4651
5696
  children: [
4652
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("option", { value: "auto", children: controller.isMultiLayer ? "Auto (new layer)" : "Auto (replace image)" }),
4653
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("option", { value: "new-layer", children: "New layer / mask" }),
4654
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("option", { value: "replace", children: "Replace image" })
5697
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("option", { value: "auto", children: controller.isMultiLayer ? "Auto (new layer)" : "Auto (replace image)" }),
5698
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("option", { value: "new-layer", children: "New layer / mask" }),
5699
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("option", { value: "replace", children: "Replace image" })
4655
5700
  ]
4656
5701
  }
4657
5702
  )
4658
5703
  ] }),
4659
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "p-3 rounded-lg bg-slate-950/60 border border-slate-800 flex flex-col gap-2.5", children: [
4660
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex items-center justify-between", children: [
4661
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { className: "font-semibold text-slate-200 uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
4662
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("svg", { className: "w-3.5 h-3.5 text-indigo-400", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M6 3v12M18 9a3 3 0 1 0 0-6 3 3 0 0 0 0 6zM6 21a3 3 0 1 0 0-6 3 3 0 0 0 0 6z" }) }),
5704
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "p-3 rounded-lg bg-slate-950/60 border border-slate-800 flex flex-col gap-2.5", children: [
5705
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex items-center justify-between", children: [
5706
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("span", { className: "font-semibold text-slate-200 uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
5707
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("svg", { className: "w-3.5 h-3.5 text-indigo-400", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("path", { d: "M6 3v12M18 9a3 3 0 1 0 0-6 3 3 0 0 0 0 6zM6 21a3 3 0 1 0 0-6 3 3 0 0 0 0 6z" }) }),
4663
5708
  "Background Removal"
4664
5709
  ] }),
4665
- isRemovingBg && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium bg-indigo-900/60 text-indigo-300 animate-pulse", children: "Removing..." })
5710
+ isRemovingBg && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium bg-indigo-900/60 text-indigo-300 animate-pulse", children: "Removing..." })
4666
5711
  ] }),
4667
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "text-slate-400 text-[11px] leading-relaxed", children: "Isolate foreground subject with AI alpha transparency segmentation." }),
4668
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
5712
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: "text-slate-400 text-[11px] leading-relaxed", children: "Isolate foreground subject with AI alpha transparency segmentation." }),
5713
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4669
5714
  "button",
4670
5715
  {
4671
5716
  type: "button",
4672
5717
  onClick: handleRemoveBackground,
4673
5718
  disabled: isRemovingBg || isInpainting,
4674
5719
  className: "mt-1 px-3 py-2 rounded-lg bg-indigo-600 hover:bg-indigo-500 disabled:opacity-50 text-white font-medium shadow transition-colors flex items-center justify-center gap-2",
4675
- children: isRemovingBg ? /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
4676
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "w-3.5 h-3.5 border-2 border-white/30 border-t-white rounded-full animate-spin" }),
5720
+ children: isRemovingBg ? /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
5721
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "w-3.5 h-3.5 border-2 border-white/30 border-t-white rounded-full animate-spin" }),
4677
5722
  "Removing Background..."
4678
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
4679
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83" }) }),
5723
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
5724
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("path", { d: "M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83" }) }),
4680
5725
  "Remove Background"
4681
5726
  ] })
4682
5727
  }
4683
5728
  )
4684
5729
  ] }),
4685
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "p-3 rounded-lg bg-slate-950/60 border border-slate-800 flex flex-col gap-2.5", children: [
4686
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex items-center justify-between", children: [
4687
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { className: "font-semibold text-slate-200 uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
4688
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("svg", { className: "w-3.5 h-3.5 text-purple-400", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
4689
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "m21.64 3.64-1.28-1.28a1.2 1.2 0 0 0-1.7 0l-9.72 9.72-1.94 4.86 4.86-1.94 9.72-9.72a1.2 1.2 0 0 0 .06-1.64z" }),
4690
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "m14 7 3 3" })
5730
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "p-3 rounded-lg bg-slate-950/60 border border-slate-800 flex flex-col gap-2.5", children: [
5731
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex items-center justify-between", children: [
5732
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("span", { className: "font-semibold text-slate-200 uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
5733
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("svg", { className: "w-3.5 h-3.5 text-purple-400", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
5734
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("path", { d: "m21.64 3.64-1.28-1.28a1.2 1.2 0 0 0-1.7 0l-9.72 9.72-1.94 4.86 4.86-1.94 9.72-9.72a1.2 1.2 0 0 0 .06-1.64z" }),
5735
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("path", { d: "m14 7 3 3" })
4691
5736
  ] }),
4692
5737
  "Generative Inpainting"
4693
5738
  ] }),
4694
- isInpainting && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium bg-purple-900/60 text-purple-300 animate-pulse", children: "Inpainting..." })
5739
+ isInpainting && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium bg-purple-900/60 text-purple-300 animate-pulse", children: "Inpainting..." })
4695
5740
  ] }),
4696
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "text-slate-400 text-[11px] leading-relaxed", children: "Replace, modify, or fill selected regions using prompt-guided generative inpainting." }),
4697
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-col gap-1", children: [
4698
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("label", { htmlFor: "ai-inpaint-prompt-react", className: "text-slate-300 text-[11px] font-medium", children: "Prompt" }),
4699
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
5741
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: "text-slate-400 text-[11px] leading-relaxed", children: "Replace, modify, or fill selected regions using prompt-guided generative inpainting." }),
5742
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex flex-col gap-1", children: [
5743
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("label", { htmlFor: "ai-inpaint-prompt-react", className: "text-slate-300 text-[11px] font-medium", children: "Prompt" }),
5744
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4700
5745
  "textarea",
4701
5746
  {
4702
5747
  id: "ai-inpaint-prompt-react",
@@ -4708,10 +5753,10 @@ var ImageEditor = ({
4708
5753
  }
4709
5754
  )
4710
5755
  ] }),
4711
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-col gap-1", children: [
4712
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "text-slate-300 text-[11px] font-medium", children: "Target Mask Region" }),
4713
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "grid grid-cols-2 gap-1.5", children: [
4714
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
5756
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex flex-col gap-1", children: [
5757
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "text-slate-300 text-[11px] font-medium", children: "Target Mask Region" }),
5758
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "grid grid-cols-2 gap-1.5", children: [
5759
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
4715
5760
  "button",
4716
5761
  {
4717
5762
  type: "button",
@@ -4724,7 +5769,7 @@ var ImageEditor = ({
4724
5769
  ]
4725
5770
  }
4726
5771
  ),
4727
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
5772
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
4728
5773
  "button",
4729
5774
  {
4730
5775
  type: "button",
@@ -4739,25 +5784,25 @@ var ImageEditor = ({
4739
5784
  )
4740
5785
  ] })
4741
5786
  ] }),
4742
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
5787
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4743
5788
  "button",
4744
5789
  {
4745
5790
  type: "button",
4746
5791
  onClick: handleInpaint,
4747
5792
  disabled: isInpainting || isRemovingBg || !inpaintPrompt.trim(),
4748
5793
  className: "mt-1 px-3 py-2 rounded-lg bg-purple-600 hover:bg-purple-500 disabled:opacity-50 text-white font-medium shadow transition-colors flex items-center justify-center gap-2",
4749
- children: isInpainting ? /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
4750
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "w-3.5 h-3.5 border-2 border-white/30 border-t-white rounded-full animate-spin" }),
5794
+ children: isInpainting ? /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
5795
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "w-3.5 h-3.5 border-2 border-white/30 border-t-white rounded-full animate-spin" }),
4751
5796
  "Generating Inpaint..."
4752
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
4753
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83" }) }),
5797
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
5798
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("path", { d: "M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83" }) }),
4754
5799
  "Apply Inpainting"
4755
5800
  ] })
4756
5801
  }
4757
5802
  )
4758
5803
  ] }),
4759
- aiError && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "p-2.5 rounded-lg bg-rose-950/60 border border-rose-800 text-rose-300 text-[11px]", children: aiError }),
4760
- aiSuccess && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "p-2.5 rounded-lg bg-emerald-950/60 border border-emerald-800 text-emerald-300 text-[11px]", children: aiSuccess })
5804
+ aiError && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "p-2.5 rounded-lg bg-rose-950/60 border border-rose-800 text-rose-300 text-[11px]", children: aiError }),
5805
+ aiSuccess && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "p-2.5 rounded-lg bg-emerald-950/60 border border-emerald-800 text-emerald-300 text-[11px]", children: aiSuccess })
4761
5806
  ] })
4762
5807
  ] })
4763
5808
  ] })