@pixerate/editor-react 0.143.0 → 0.144.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.
@@ -51,6 +51,7 @@ __export(image_editor_exports, {
51
51
  ImageSelect: () => ImageSelect,
52
52
  LayerEffectsPanel: () => LayerEffectsPanel,
53
53
  LayersPanel: () => LayersPanel,
54
+ MaskEdgeCheck: () => MaskEdgeCheck,
54
55
  PaintGradientEditor: () => PaintGradientEditor,
55
56
  PathsPanel: () => PathsPanel,
56
57
  RefineEdgePanel: () => RefineEdgePanel,
@@ -234,8 +235,8 @@ function useImageEffectsTools(registry, controller, options = {}) {
234
235
  }
235
236
 
236
237
  // src/image-editor/ImageEditor.tsx
237
- var import_react34 = __toESM(require("react"), 1);
238
- var import_image_editor23 = require("@pixerate/editor/image-editor");
238
+ var import_react35 = __toESM(require("react"), 1);
239
+ var import_image_editor24 = require("@pixerate/editor/image-editor");
239
240
 
240
241
  // src/image-editor/ImageEditorCanvas.tsx
241
242
  var import_react5 = require("react");
@@ -5662,20 +5663,69 @@ var SelectionOptionsBar = ({
5662
5663
  };
5663
5664
 
5664
5665
  // src/image-editor/RefineEdgePanel.tsx
5665
- var import_react28 = require("react");
5666
+ var import_react29 = require("react");
5667
+ var import_image_editor18 = require("@pixerate/editor/image-editor");
5668
+
5669
+ // src/image-editor/MaskEdgeCheck.tsx
5670
+ var import_react28 = __toESM(require("react"), 1);
5666
5671
  var import_image_editor17 = require("@pixerate/editor/image-editor");
5667
5672
  var import_jsx_runtime28 = require("react/jsx-runtime");
5668
- var DEFAULT_PARAMS = { radius: 8, smartRadius: false, smooth: 0, feather: 0, contrast: 0, shiftEdge: 0 };
5669
5673
  var button4 = "px-2 py-1 rounded-md border border-border bg-background text-[11px] text-foreground hover:bg-accent hover:text-accent-foreground disabled:opacity-40";
5670
- var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
5671
- const [params, setParams] = (0, import_react28.useState)(DEFAULT_PARAMS);
5672
- const [busy, setBusy] = (0, import_react28.useState)(false);
5674
+ var MaskEdgeCheck = ({ controller, selection, target = "selection", layerId, className = "" }) => {
5675
+ const sel = selection === void 0 ? controller.getSelection() : selection;
5676
+ const [result, setResult] = (0, import_react28.useState)(null);
5673
5677
  const [error, setError] = (0, import_react28.useState)(null);
5674
- const [layerId, setLayerId] = (0, import_react28.useState)("");
5675
- const [newKind, setNewKind] = (0, import_react28.useState)("hueSaturation");
5676
- const [output, setOutput] = (0, import_react28.useState)("selection");
5677
- const [decontaminate, setDecontaminate] = (0, import_react28.useState)(0);
5678
- const [objectAware, setObjectAware] = (0, import_react28.useState)(false);
5678
+ const report = result && (target !== "selection" || result.for === sel) ? result.report : null;
5679
+ const check = () => {
5680
+ setError(null);
5681
+ try {
5682
+ setResult({ report: controller.inspectMaskEdge(target, { layerId }), for: sel });
5683
+ } catch (err) {
5684
+ setResult(null);
5685
+ setError(err instanceof Error ? err.message : String(err));
5686
+ }
5687
+ };
5688
+ const T = import_image_editor17.MASK_EDGE_THRESHOLDS;
5689
+ const rows = report ? [
5690
+ { label: "Halo", value: report.haloScore, bad: report.haloScore >= T.halo },
5691
+ { label: "Edge alignment", value: report.edgeAlignment, bad: report.edgeAlignment < T.alignment },
5692
+ { label: "Jaggedness", value: report.jaggedness, bad: report.jaggedness >= T.jaggedness },
5693
+ { label: "Soft edge", value: report.softFraction, bad: report.softFraction >= T.soft }
5694
+ ] : [];
5695
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { "data-testid": "mask-edge-check", className: `flex flex-col gap-1.5 text-xs ${className}`, children: [
5696
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("button", { type: "button", className: `${button4} self-start`, disabled: target === "selection" && !sel, onClick: check, children: "Check Edge" }),
5697
+ report && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
5698
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("dl", { className: "grid grid-cols-[1fr_auto] gap-x-2 gap-y-0.5", children: [
5699
+ rows.map((r) => /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_react28.default.Fragment, { children: [
5700
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("dt", { className: "text-muted-foreground", children: r.label }),
5701
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("dd", { className: `font-mono text-right ${r.bad ? "text-destructive" : "text-foreground"}`, children: r.value })
5702
+ ] }, r.label)),
5703
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("dt", { className: "text-muted-foreground", children: "Holes / islands" }),
5704
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("dd", { className: `font-mono text-right ${report.holes.count || report.islands.count ? "text-destructive" : "text-foreground"}`, children: [
5705
+ report.holes.count,
5706
+ " / ",
5707
+ report.islands.count
5708
+ ] })
5709
+ ] }),
5710
+ report.issues.length ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("ul", { "data-testid": "mask-edge-issues", className: "list-disc pl-4 flex flex-col gap-1 text-foreground", children: report.issues.map((s) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("li", { children: s }, s)) }) : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { className: "text-muted-foreground", children: "The edge looks clean." })
5711
+ ] }),
5712
+ error && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { role: "alert", className: "text-destructive", children: error })
5713
+ ] });
5714
+ };
5715
+
5716
+ // src/image-editor/RefineEdgePanel.tsx
5717
+ var import_jsx_runtime29 = require("react/jsx-runtime");
5718
+ var DEFAULT_PARAMS = { radius: 8, smartRadius: false, smooth: 0, feather: 0, contrast: 0, shiftEdge: 0 };
5719
+ var button5 = "px-2 py-1 rounded-md border border-border bg-background text-[11px] text-foreground hover:bg-accent hover:text-accent-foreground disabled:opacity-40";
5720
+ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
5721
+ const [params, setParams] = (0, import_react29.useState)(DEFAULT_PARAMS);
5722
+ const [busy, setBusy] = (0, import_react29.useState)(false);
5723
+ const [error, setError] = (0, import_react29.useState)(null);
5724
+ const [layerId, setLayerId] = (0, import_react29.useState)("");
5725
+ const [newKind, setNewKind] = (0, import_react29.useState)("hueSaturation");
5726
+ const [output, setOutput] = (0, import_react29.useState)("selection");
5727
+ const [decontaminate, setDecontaminate] = (0, import_react29.useState)(0);
5728
+ const [objectAware, setObjectAware] = (0, import_react29.useState)(false);
5679
5729
  const canObject = Boolean(controller.segmentationProvider);
5680
5730
  const toLayer = output !== "selection" && output !== "layer-mask";
5681
5731
  const sel = selection === void 0 ? controller.getSelection() : selection;
@@ -5695,17 +5745,17 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
5695
5745
  setBusy(false);
5696
5746
  }
5697
5747
  };
5698
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { "data-testid": "refine-edge-panel", className: `flex flex-col gap-3 text-xs ${className}`, children: [
5699
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: imageSectionTitleClass, children: "Refine Edge" }),
5700
- import_image_editor17.REFINE_EDGE_CONTROLS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { className: "flex flex-col gap-1", children: [
5701
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
5702
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { children: c.label }),
5703
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { className: "font-mono", children: [
5748
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { "data-testid": "refine-edge-panel", className: `flex flex-col gap-3 text-xs ${className}`, children: [
5749
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: imageSectionTitleClass, children: "Refine Edge" }),
5750
+ import_image_editor18.REFINE_EDGE_CONTROLS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex flex-col gap-1", children: [
5751
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
5752
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { children: c.label }),
5753
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { className: "font-mono", children: [
5704
5754
  params[c.id],
5705
5755
  c.unit
5706
5756
  ] })
5707
5757
  ] }),
5708
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5758
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
5709
5759
  "input",
5710
5760
  {
5711
5761
  type: "range",
@@ -5719,39 +5769,39 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
5719
5769
  }
5720
5770
  )
5721
5771
  ] }, c.id)),
5722
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
5723
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("input", { type: "checkbox", checked: params.smartRadius, onChange: (e) => setParams({ ...params, smartRadius: e.target.checked }) }),
5772
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
5773
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("input", { type: "checkbox", checked: params.smartRadius, onChange: (e) => setParams({ ...params, smartRadius: e.target.checked }) }),
5724
5774
  "Smart Radius"
5725
5775
  ] }),
5726
- canObject && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
5727
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("input", { type: "checkbox", "aria-label": "Object aware", checked: objectAware, onChange: (e) => setObjectAware(e.target.checked) }),
5776
+ canObject && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
5777
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("input", { type: "checkbox", "aria-label": "Object aware", checked: objectAware, onChange: (e) => setObjectAware(e.target.checked) }),
5728
5778
  "Object aware (segmentation model)"
5729
5779
  ] }),
5730
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { className: "flex items-center gap-2 text-muted-foreground", children: [
5780
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex items-center gap-2 text-muted-foreground", children: [
5731
5781
  "Output to",
5732
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5782
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
5733
5783
  "select",
5734
5784
  {
5735
5785
  "aria-label": "Refine output",
5736
5786
  value: output,
5737
5787
  onChange: (e) => setOutput(e.target.value),
5738
5788
  className: "flex-1 bg-background border border-border rounded px-1 py-1 text-foreground",
5739
- children: import_image_editor17.REFINE_OUTPUTS.filter((o) => !o.needsDocuments || controller.canOpenDocuments).map((o) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("option", { value: o.id, children: o.label }, o.id))
5789
+ children: import_image_editor18.REFINE_OUTPUTS.filter((o) => !o.needsDocuments || controller.canOpenDocuments).map((o) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("option", { value: o.id, children: o.label }, o.id))
5740
5790
  }
5741
5791
  )
5742
5792
  ] }),
5743
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { className: "flex flex-col gap-1", children: [
5744
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
5745
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { children: [
5793
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex flex-col gap-1", children: [
5794
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
5795
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { children: [
5746
5796
  "Decontaminate colors",
5747
5797
  toLayer ? "" : " (new layer or document outputs)"
5748
5798
  ] }),
5749
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { className: "font-mono", children: [
5799
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { className: "font-mono", children: [
5750
5800
  decontaminate,
5751
5801
  "%"
5752
5802
  ] })
5753
5803
  ] }),
5754
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5804
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
5755
5805
  "input",
5756
5806
  {
5757
5807
  type: "range",
@@ -5766,63 +5816,64 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
5766
5816
  }
5767
5817
  )
5768
5818
  ] }),
5769
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex gap-1", children: [
5770
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("button", { type: "button", className: button4, disabled: !sel || busy, onClick: refine, children: "Refine Edge" }),
5771
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("button", { type: "button", className: button4, onClick: () => setParams(DEFAULT_PARAMS), children: "Reset" })
5819
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex gap-1", children: [
5820
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("button", { type: "button", className: button5, disabled: !sel || busy, onClick: refine, children: "Refine Edge" }),
5821
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("button", { type: "button", className: button5, onClick: () => setParams(DEFAULT_PARAMS), children: "Reset" })
5772
5822
  ] }),
5773
- error && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { role: "alert", className: "text-destructive", children: error }),
5774
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] mt-2", children: "Layer Mask" }),
5775
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex gap-1 items-center", children: [
5776
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5823
+ error && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("p", { role: "alert", className: "text-destructive", children: error }),
5824
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(MaskEdgeCheck, { controller, selection: sel }),
5825
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] mt-2", children: "Layer Mask" }),
5826
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex gap-1 items-center", children: [
5827
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
5777
5828
  "select",
5778
5829
  {
5779
5830
  "aria-label": "New masked layer kind",
5780
5831
  value: newKind,
5781
5832
  onChange: (e) => setNewKind(e.target.value),
5782
5833
  className: "flex-1 bg-background border border-border rounded px-1 py-1 text-foreground",
5783
- children: import_image_editor17.ADJUSTMENT_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("option", { value: k.kind, children: k.label }, k.kind))
5834
+ children: import_image_editor18.ADJUSTMENT_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("option", { value: k.kind, children: k.label }, k.kind))
5784
5835
  }
5785
5836
  ),
5786
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5837
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
5787
5838
  "button",
5788
5839
  {
5789
5840
  type: "button",
5790
- className: button4,
5841
+ className: button5,
5791
5842
  disabled: !sel,
5792
- onClick: () => sel && setLayerId(controller.addAdjustmentLayer({ kind: newKind, mask: (0, import_image_editor17.layerMaskFromSelection)(sel) })),
5843
+ onClick: () => sel && setLayerId(controller.addAdjustmentLayer({ kind: newKind, mask: (0, import_image_editor18.layerMaskFromSelection)(sel) })),
5793
5844
  children: "New Masked Layer"
5794
5845
  }
5795
5846
  )
5796
5847
  ] }),
5797
- list.length > 0 && target && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex flex-col gap-2", children: [
5798
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5848
+ list.length > 0 && target && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex flex-col gap-2", children: [
5849
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
5799
5850
  "select",
5800
5851
  {
5801
5852
  "aria-label": "Mask layer",
5802
5853
  value: target.id,
5803
5854
  onChange: (e) => setLayerId(e.target.value),
5804
5855
  className: "bg-background border border-border rounded px-1 py-1 text-foreground",
5805
- children: list.map((l) => /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("option", { value: l.id, children: [
5806
- l.name || (0, import_image_editor17.adjustmentKindLabel)(l.kind),
5856
+ children: list.map((l) => /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("option", { value: l.id, children: [
5857
+ l.name || (0, import_image_editor18.adjustmentKindLabel)(l.kind),
5807
5858
  l.mask ? " (masked)" : ""
5808
5859
  ] }, l.id))
5809
5860
  }
5810
5861
  ),
5811
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
5812
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("button", { type: "button", className: button4, disabled: !sel, onClick: () => controller.applySelectionAsLayerMask(target.id), children: "Mask with Selection" }),
5813
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("button", { type: "button", className: button4, disabled: !target.mask, onClick: () => controller.selectionFromLayerMask(target.id), children: "Load as Selection" }),
5814
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("button", { type: "button", className: button4, disabled: !target.mask, onClick: () => controller.setAdjustmentLayerMask(target.id, null), children: "Remove Mask" })
5862
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
5863
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("button", { type: "button", className: button5, disabled: !sel, onClick: () => controller.applySelectionAsLayerMask(target.id), children: "Mask with Selection" }),
5864
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("button", { type: "button", className: button5, disabled: !target.mask, onClick: () => controller.selectionFromLayerMask(target.id), children: "Load as Selection" }),
5865
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("button", { type: "button", className: button5, disabled: !target.mask, onClick: () => controller.setAdjustmentLayerMask(target.id, null), children: "Remove Mask" })
5815
5866
  ] }),
5816
- target.mask && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
5817
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { className: "flex flex-col gap-1", children: [
5818
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
5819
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { children: "Density" }),
5820
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { className: "font-mono", children: [
5867
+ target.mask && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
5868
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex flex-col gap-1", children: [
5869
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
5870
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { children: "Density" }),
5871
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { className: "font-mono", children: [
5821
5872
  Math.round((target.mask.density ?? 1) * 100),
5822
5873
  "%"
5823
5874
  ] })
5824
5875
  ] }),
5825
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5876
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
5826
5877
  "input",
5827
5878
  {
5828
5879
  type: "range",
@@ -5836,15 +5887,15 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
5836
5887
  }
5837
5888
  )
5838
5889
  ] }),
5839
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { className: "flex flex-col gap-1", children: [
5840
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
5841
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { children: "Mask Feather" }),
5842
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { className: "font-mono", children: [
5890
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex flex-col gap-1", children: [
5891
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
5892
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { children: "Mask Feather" }),
5893
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { className: "font-mono", children: [
5843
5894
  target.mask.feather ?? 0,
5844
5895
  "px"
5845
5896
  ] })
5846
5897
  ] }),
5847
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5898
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
5848
5899
  "input",
5849
5900
  {
5850
5901
  type: "range",
@@ -5864,32 +5915,32 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
5864
5915
  };
5865
5916
 
5866
5917
  // src/image-editor/ChannelsPanel.tsx
5867
- var import_react29 = require("react");
5868
- var import_image_editor18 = require("@pixerate/editor/image-editor");
5869
- var import_jsx_runtime29 = require("react/jsx-runtime");
5918
+ var import_react30 = require("react");
5919
+ var import_image_editor19 = require("@pixerate/editor/image-editor");
5920
+ var import_jsx_runtime30 = require("react/jsx-runtime");
5870
5921
  var btn2 = (on = false) => `px-2 py-1 rounded-md border text-[11px] transition-colors disabled:opacity-40 ${on ? "bg-primary border-primary text-primary-foreground" : "bg-background border-border text-foreground hover:bg-accent hover:text-accent-foreground"}`;
5871
5922
  var ChannelThumb = ({ channel, size }) => {
5872
- const ref = (0, import_react29.useRef)(null);
5873
- (0, import_react29.useEffect)(() => {
5923
+ const ref = (0, import_react30.useRef)(null);
5924
+ (0, import_react30.useEffect)(() => {
5874
5925
  const canvas = ref.current;
5875
5926
  const ctx = canvas?.getContext("2d");
5876
5927
  if (!canvas || !ctx || typeof ctx.createImageData !== "function") return;
5877
- const px = (0, import_image_editor18.channelThumbnail)(channel, 64);
5928
+ const px = (0, import_image_editor19.channelThumbnail)(channel, 64);
5878
5929
  canvas.width = px.width;
5879
5930
  canvas.height = px.height;
5880
5931
  const img = ctx.createImageData(px.width, px.height);
5881
5932
  img.data.set(px.data);
5882
5933
  ctx.putImageData(img, 0, 0);
5883
5934
  }, [channel.mask]);
5884
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("canvas", { ref, "aria-hidden": "true", style: { width: size, height: size }, className: "shrink-0 rounded object-contain ring-1 ring-border bg-black" });
5935
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("canvas", { ref, "aria-hidden": "true", style: { width: size, height: size }, className: "shrink-0 rounded object-contain ring-1 ring-border bg-black" });
5885
5936
  };
5886
5937
  var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
5887
- const [, setTick] = (0, import_react29.useState)(0);
5888
- (0, import_react29.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
5889
- const [activeId, setActiveId] = (0, import_react29.useState)(null);
5890
- const [renaming, setRenaming] = (0, import_react29.useState)(null);
5891
- const [error, setError] = (0, import_react29.useState)(null);
5892
- const fileInput = (0, import_react29.useRef)(null);
5938
+ const [, setTick] = (0, import_react30.useState)(0);
5939
+ (0, import_react30.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
5940
+ const [activeId, setActiveId] = (0, import_react30.useState)(null);
5941
+ const [renaming, setRenaming] = (0, import_react30.useState)(null);
5942
+ const [error, setError] = (0, import_react30.useState)(null);
5943
+ const fileInput = (0, import_react30.useRef)(null);
5893
5944
  const channels = controller.getChannels();
5894
5945
  const active = channels.find((c) => c.id === activeId) ?? null;
5895
5946
  const hasSelection = Boolean(controller.getSelection());
@@ -5906,18 +5957,18 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
5906
5957
  if (!file) return;
5907
5958
  setError(null);
5908
5959
  try {
5909
- setActiveId((await (0, import_image_editor18.openMaskFile)(controller, file)).id);
5960
+ setActiveId((await (0, import_image_editor19.openMaskFile)(controller, file)).id);
5910
5961
  } catch (err) {
5911
5962
  setError(err instanceof Error ? err.message : String(err));
5912
5963
  }
5913
5964
  };
5914
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { "data-testid": "channels-panel", className: `flex flex-col gap-2 text-xs ${className}`, children: [
5915
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex items-center justify-between", children: [
5916
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: imageSectionTitleClass, children: "Channels" }),
5917
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("button", { type: "button", "aria-pressed": quickMask, className: btn2(quickMask), title: "Paint the selection: white selects, black deselects (Q)", onClick: () => controller.setQuickMaskMode(!quickMask), children: "Quick Mask" })
5965
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { "data-testid": "channels-panel", className: `flex flex-col gap-2 text-xs ${className}`, children: [
5966
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex items-center justify-between", children: [
5967
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: imageSectionTitleClass, children: "Channels" }),
5968
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", "aria-pressed": quickMask, className: btn2(quickMask), title: "Paint the selection: white selects, black deselects (Q)", onClick: () => controller.setQuickMaskMode(!quickMask), children: "Quick Mask" })
5918
5969
  ] }),
5919
- channels.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("p", { className: "text-muted-foreground", children: "No channels. Save a selection to keep it." }),
5920
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("ul", { role: "list", className: "flex flex-col gap-0.5", children: channels.map((c) => /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
5970
+ channels.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { className: "text-muted-foreground", children: "No channels. Save a selection to keep it." }),
5971
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("ul", { role: "list", className: "flex flex-col gap-0.5", children: channels.map((c) => /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
5921
5972
  "li",
5922
5973
  {
5923
5974
  "data-testid": "channel-row",
@@ -5925,11 +5976,11 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
5925
5976
  className: `flex items-center gap-1.5 px-1.5 py-1 rounded cursor-pointer select-none ${c.id === activeId ? "bg-primary/30 ring-1 ring-primary" : "hover:bg-muted"}`,
5926
5977
  onClick: (e) => {
5927
5978
  setActiveId(c.id);
5928
- attempt(() => controller.loadSelectionFromChannel(c.id, { mode: (0, import_image_editor18.selectionModeFromModifiers)(e, "replace") }));
5979
+ attempt(() => controller.loadSelectionFromChannel(c.id, { mode: (0, import_image_editor19.selectionModeFromModifiers)(e, "replace") }));
5929
5980
  },
5930
5981
  onDoubleClick: () => setRenaming(c.id),
5931
5982
  children: [
5932
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
5983
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5933
5984
  "button",
5934
5985
  {
5935
5986
  type: "button",
@@ -5943,8 +5994,8 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
5943
5994
  children: c.visible ? "\u25CF" : "\u25CB"
5944
5995
  }
5945
5996
  ),
5946
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ChannelThumb, { channel: c, size: thumbnailSize }),
5947
- renaming === c.id ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
5997
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ChannelThumb, { channel: c, size: thumbnailSize }),
5998
+ renaming === c.id ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5948
5999
  "input",
5949
6000
  {
5950
6001
  autoFocus: true,
@@ -5961,16 +6012,16 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
5961
6012
  if (e.key === "Escape") setRenaming(null);
5962
6013
  }
5963
6014
  }
5964
- ) : /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "min-w-0 flex-1 truncate", children: c.name })
6015
+ ) : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "min-w-0 flex-1 truncate", children: c.name })
5965
6016
  ]
5966
6017
  },
5967
6018
  c.id
5968
6019
  )) }),
5969
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
5970
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("button", { type: "button", className: btn2(), disabled: !hasSelection, onClick: () => attempt(() => setActiveId(controller.saveSelection().id)), children: "Save Selection" }),
5971
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("button", { type: "button", className: btn2(), disabled: !active || !hasSelection, title: "Add the selection to the channel", onClick: () => attempt(() => controller.saveSelection({ channelId: active.id, mode: "add" })), children: "Add to Channel" }),
5972
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("button", { type: "button", className: btn2(), disabled: !active, onClick: () => attempt(() => setActiveId(controller.duplicateChannel(active.id).id)), children: "Duplicate" }),
5973
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
6020
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
6021
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", className: btn2(), disabled: !hasSelection, onClick: () => attempt(() => setActiveId(controller.saveSelection().id)), children: "Save Selection" }),
6022
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", className: btn2(), disabled: !active || !hasSelection, title: "Add the selection to the channel", onClick: () => attempt(() => controller.saveSelection({ channelId: active.id, mode: "add" })), children: "Add to Channel" }),
6023
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", className: btn2(), disabled: !active, onClick: () => attempt(() => setActiveId(controller.duplicateChannel(active.id).id)), children: "Duplicate" }),
6024
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5974
6025
  "button",
5975
6026
  {
5976
6027
  type: "button",
@@ -5983,24 +6034,24 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
5983
6034
  children: "Delete"
5984
6035
  }
5985
6036
  ),
5986
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("button", { type: "button", className: btn2(), title: "Load a mask image (white = selected) into a new channel", onClick: () => fileInput.current?.click(), children: "Import\u2026" }),
5987
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
6037
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", className: btn2(), title: "Load a mask image (white = selected) into a new channel", onClick: () => fileInput.current?.click(), children: "Import\u2026" }),
6038
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5988
6039
  "button",
5989
6040
  {
5990
6041
  type: "button",
5991
6042
  className: btn2(),
5992
6043
  disabled: !active && !hasSelection,
5993
6044
  title: active ? "Save the channel as a greyscale PNG" : "Save the selection as a greyscale PNG",
5994
- onClick: () => attempt(() => (0, import_image_editor18.downloadMaskImage)(controller, active ? { channelId: active.id } : "selection", active?.name ?? "selection")),
6045
+ onClick: () => attempt(() => (0, import_image_editor19.downloadMaskImage)(controller, active ? { channelId: active.id } : "selection", active?.name ?? "selection")),
5995
6046
  children: "Export PNG"
5996
6047
  }
5997
6048
  ),
5998
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
6049
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5999
6050
  "input",
6000
6051
  {
6001
6052
  ref: fileInput,
6002
6053
  type: "file",
6003
- accept: import_image_editor18.MASK_FILE_ACCEPT,
6054
+ accept: import_image_editor19.MASK_FILE_ACCEPT,
6004
6055
  hidden: true,
6005
6056
  "data-testid": "channel-import-input",
6006
6057
  onChange: (e) => {
@@ -6010,22 +6061,22 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
6010
6061
  }
6011
6062
  )
6012
6063
  ] }),
6013
- error && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("p", { role: "alert", className: "text-destructive", children: error })
6064
+ error && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { role: "alert", className: "text-destructive", children: error })
6014
6065
  ] });
6015
6066
  };
6016
6067
 
6017
6068
  // src/image-editor/PathsPanel.tsx
6018
- var import_react30 = require("react");
6019
- var import_image_editor19 = require("@pixerate/editor/image-editor");
6020
- var import_jsx_runtime30 = require("react/jsx-runtime");
6069
+ var import_react31 = require("react");
6070
+ var import_image_editor20 = require("@pixerate/editor/image-editor");
6071
+ var import_jsx_runtime31 = require("react/jsx-runtime");
6021
6072
  var btn3 = (on = false) => `px-2 py-1 rounded-md border text-[11px] transition-colors disabled:opacity-40 ${on ? "bg-primary border-primary text-primary-foreground" : "bg-background border-border text-foreground hover:bg-accent hover:text-accent-foreground"}`;
6022
6073
  var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
6023
- const [, setTick] = (0, import_react30.useState)(0);
6024
- (0, import_react30.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
6025
- const [renaming, setRenaming] = (0, import_react30.useState)(null);
6026
- const [color, setColor] = (0, import_react30.useState)("#000000");
6027
- const [width, setWidth] = (0, import_react30.useState)(2);
6028
- const [error, setError] = (0, import_react30.useState)(null);
6074
+ const [, setTick] = (0, import_react31.useState)(0);
6075
+ (0, import_react31.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
6076
+ const [renaming, setRenaming] = (0, import_react31.useState)(null);
6077
+ const [color, setColor] = (0, import_react31.useState)("#000000");
6078
+ const [width, setWidth] = (0, import_react31.useState)(2);
6079
+ const [error, setError] = (0, import_react31.useState)(null);
6029
6080
  const paths = controller.getPaths();
6030
6081
  const activeId = controller.getState().activePathId ?? null;
6031
6082
  const active = paths.find((p) => p.id === activeId) ?? null;
@@ -6041,10 +6092,10 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
6041
6092
  };
6042
6093
  return (
6043
6094
  // Clicking the panel's empty space deselects the path (the path tools then edit the active layer).
6044
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { "data-testid": "paths-panel", className: `flex flex-col gap-2 text-xs ${className}`, onClick: (e) => e.target === e.currentTarget && attempt(() => controller.setActivePath(null)), children: [
6045
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: imageSectionTitleClass, children: "Paths" }),
6046
- paths.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { className: "text-muted-foreground", children: "No paths. Make a work path from a selection." }),
6047
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("ul", { role: "list", className: "flex flex-col gap-0.5 min-h-4", onClick: (e) => e.target === e.currentTarget && attempt(() => controller.setActivePath(null)), children: paths.map((p) => /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
6095
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { "data-testid": "paths-panel", className: `flex flex-col gap-2 text-xs ${className}`, onClick: (e) => e.target === e.currentTarget && attempt(() => controller.setActivePath(null)), children: [
6096
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: imageSectionTitleClass, children: "Paths" }),
6097
+ paths.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("p", { className: "text-muted-foreground", children: "No paths. Make a work path from a selection." }),
6098
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("ul", { role: "list", className: "flex flex-col gap-0.5 min-h-4", onClick: (e) => e.target === e.currentTarget && attempt(() => controller.setActivePath(null)), children: paths.map((p) => /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
6048
6099
  "li",
6049
6100
  {
6050
6101
  "data-testid": "path-row",
@@ -6053,8 +6104,8 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
6053
6104
  onClick: () => attempt(() => controller.setActivePath(p.id)),
6054
6105
  onDoubleClick: () => setRenaming(p.id),
6055
6106
  children: [
6056
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("svg", { "aria-hidden": "true", viewBox: `0 0 ${w || 1} ${h || 1}`, style: { width: thumbnailSize, height: thumbnailSize }, className: "shrink-0 rounded ring-1 ring-border bg-background", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("path", { d: (0, import_image_editor19.pathSvgData)(p), fill: "currentColor", fillOpacity: 0.25, stroke: "currentColor", strokeWidth: Math.max(w, h) / 64, fillRule: p.fillRule ?? "nonzero" }) }),
6057
- renaming === p.id ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
6107
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("svg", { "aria-hidden": "true", viewBox: `0 0 ${w || 1} ${h || 1}`, style: { width: thumbnailSize, height: thumbnailSize }, className: "shrink-0 rounded ring-1 ring-border bg-background", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("path", { d: (0, import_image_editor20.pathSvgData)(p), fill: "currentColor", fillOpacity: 0.25, stroke: "currentColor", strokeWidth: Math.max(w, h) / 64, fillRule: p.fillRule ?? "nonzero" }) }),
6108
+ renaming === p.id ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
6058
6109
  "input",
6059
6110
  {
6060
6111
  autoFocus: true,
@@ -6073,32 +6124,32 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
6073
6124
  if (e.key === "Escape") setRenaming(null);
6074
6125
  }
6075
6126
  }
6076
- ) : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: `min-w-0 flex-1 truncate ${p.work ? "italic" : ""}`, children: p.name })
6127
+ ) : /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: `min-w-0 flex-1 truncate ${p.work ? "italic" : ""}`, children: p.name })
6077
6128
  ]
6078
6129
  },
6079
6130
  p.id
6080
6131
  )) }),
6081
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
6082
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
6132
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
6133
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
6083
6134
  "button",
6084
6135
  {
6085
6136
  type: "button",
6086
6137
  className: btn3(),
6087
6138
  disabled: !active,
6088
6139
  title: "Load the path as the selection (Shift adds, Alt subtracts)",
6089
- onClick: (e) => attempt(() => controller.loadPathAsSelection(active.id, { mode: (0, import_image_editor19.selectionModeFromModifiers)(e, "replace") })),
6140
+ onClick: (e) => attempt(() => controller.loadPathAsSelection(active.id, { mode: (0, import_image_editor20.selectionModeFromModifiers)(e, "replace") })),
6090
6141
  children: "Load as Selection"
6091
6142
  }
6092
6143
  ),
6093
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", className: btn3(), disabled: !hasSelection, onClick: () => attempt(() => controller.makeWorkPath()), children: "Make Work Path" }),
6094
- active?.work && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", className: btn3(), onClick: () => setRenaming(active.id), children: "Save Path" }),
6095
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.addVectorMaskFromPath(active.id)), children: "Add Vector Mask" })
6144
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("button", { type: "button", className: btn3(), disabled: !hasSelection, onClick: () => attempt(() => controller.makeWorkPath()), children: "Make Work Path" }),
6145
+ active?.work && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("button", { type: "button", className: btn3(), onClick: () => setRenaming(active.id), children: "Save Path" }),
6146
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.addVectorMaskFromPath(active.id)), children: "Add Vector Mask" })
6096
6147
  ] }),
6097
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
6098
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("input", { type: "color", "aria-label": "Path paint colour", value: color, onChange: (e) => setColor(e.target.value), className: "h-6 w-8 bg-background border border-border rounded" }),
6099
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.fillPath(active.id, { color })), children: "Fill Path" }),
6100
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
6101
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
6148
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
6149
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("input", { type: "color", "aria-label": "Path paint colour", value: color, onChange: (e) => setColor(e.target.value), className: "h-6 w-8 bg-background border border-border rounded" }),
6150
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.fillPath(active.id, { color })), children: "Fill Path" }),
6151
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
6152
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
6102
6153
  "input",
6103
6154
  {
6104
6155
  type: "number",
@@ -6113,25 +6164,25 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
6113
6164
  ),
6114
6165
  "px"
6115
6166
  ] }),
6116
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.strokePath(active.id, { width, color })), children: "Stroke Path" })
6167
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.strokePath(active.id, { width, color })), children: "Stroke Path" })
6117
6168
  ] }),
6118
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
6119
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.duplicatePath(active.id)), children: "Duplicate" }),
6120
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.deletePath(active.id)), children: "Delete" })
6169
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
6170
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.duplicatePath(active.id)), children: "Duplicate" }),
6171
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.deletePath(active.id)), children: "Delete" })
6121
6172
  ] }),
6122
- error && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { role: "alert", className: "text-destructive", children: error })
6173
+ error && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("p", { role: "alert", className: "text-destructive", children: error })
6123
6174
  ] })
6124
6175
  );
6125
6176
  };
6126
6177
 
6127
6178
  // src/image-editor/FreeTransformOptionsBar.tsx
6128
- var import_react31 = require("react");
6129
- var import_image_editor20 = require("@pixerate/editor/image-editor");
6130
- var import_jsx_runtime31 = require("react/jsx-runtime");
6179
+ var import_react32 = require("react");
6180
+ var import_image_editor21 = require("@pixerate/editor/image-editor");
6181
+ var import_jsx_runtime32 = require("react/jsx-runtime");
6131
6182
  var round = (v, unit) => unit === "px" ? Math.round(v * 10) / 10 : Math.round(v * 100) / 100;
6132
6183
  var FreeTransformOptionsBar = ({ tool, className }) => {
6133
- const [, setTick] = (0, import_react31.useState)(0);
6134
- (0, import_react31.useEffect)(() => tool.subscribe(() => setTick((n) => n + 1)), [tool]);
6184
+ const [, setTick] = (0, import_react32.useState)(0);
6185
+ (0, import_react32.useEffect)(() => tool.subscribe(() => setTick((n) => n + 1)), [tool]);
6135
6186
  const bar = tool.bar();
6136
6187
  if (!tool.active || !bar) return null;
6137
6188
  const warp = tool.warpBar();
@@ -6143,17 +6194,17 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
6143
6194
  const v = Number(raw);
6144
6195
  if (raw.trim() !== "" && Number.isFinite(v) && Math.abs(v - bar[field]) > 1e-9) tool.setField(field, v);
6145
6196
  };
6146
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: `flex flex-wrap items-center gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "free-transform-options", role: "toolbar", "aria-label": "Free Transform options", children: [
6147
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "flex gap-1", role: "group", "aria-label": "Transform mode", children: import_image_editor20.FREE_TRANSFORM_MODE_OPTIONS.map((m) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("button", { type: "button", title: m.title, "aria-pressed": tool.mode === m.id, className: imageChipClass(tool.mode === m.id), onClick: () => tool.setMode(m.id), children: m.label }, m.id)) }),
6148
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "grid grid-cols-3 gap-px", role: "group", "aria-label": "Reference point", children: import_image_editor20.TRANSFORM_ANCHORS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("button", { type: "button", "aria-label": `Reference point ${a}`, title: `Reference point: ${a}`, className: "h-2.5 w-2.5 rounded-sm bg-accent hover:bg-primary/90", onClick: () => tool.setReference(a) }, a)) }),
6149
- tool.mode === "warp" && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex flex-wrap items-center gap-2", role: "group", "aria-label": "Warp options", children: [
6150
- /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "flex items-center gap-1", children: [
6151
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "text-muted-foreground", children: "Warp" }),
6152
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("select", { "aria-label": "Warp style", value: warp.style, onChange: (e) => tool.setWarp({ style: e.target.value }), className: imageFieldClass, children: import_image_editor20.WARP_STYLE_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("option", { value: o.id, children: o.label }, o.id)) })
6197
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: `flex flex-wrap items-center gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "free-transform-options", role: "toolbar", "aria-label": "Free Transform options", children: [
6198
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "flex gap-1", role: "group", "aria-label": "Transform mode", children: import_image_editor21.FREE_TRANSFORM_MODE_OPTIONS.map((m) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("button", { type: "button", title: m.title, "aria-pressed": tool.mode === m.id, className: imageChipClass(tool.mode === m.id), onClick: () => tool.setMode(m.id), children: m.label }, m.id)) }),
6199
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "grid grid-cols-3 gap-px", role: "group", "aria-label": "Reference point", children: import_image_editor21.TRANSFORM_ANCHORS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("button", { type: "button", "aria-label": `Reference point ${a}`, title: `Reference point: ${a}`, className: "h-2.5 w-2.5 rounded-sm bg-accent hover:bg-primary/90", onClick: () => tool.setReference(a) }, a)) }),
6200
+ tool.mode === "warp" && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex flex-wrap items-center gap-2", role: "group", "aria-label": "Warp options", children: [
6201
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { className: "flex items-center gap-1", children: [
6202
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "text-muted-foreground", children: "Warp" }),
6203
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("select", { "aria-label": "Warp style", value: warp.style, onChange: (e) => tool.setWarp({ style: e.target.value }), className: imageFieldClass, children: import_image_editor21.WARP_STYLE_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("option", { value: o.id, children: o.label }, o.id)) })
6153
6204
  ] }),
6154
- ["bend", "horizontal", "vertical"].map((k) => /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "flex items-center gap-1", children: [
6155
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "text-muted-foreground", children: k === "bend" ? "Bend" : k === "horizontal" ? "H" : "V" }),
6156
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
6205
+ ["bend", "horizontal", "vertical"].map((k) => /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { className: "flex items-center gap-1", children: [
6206
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "text-muted-foreground", children: k === "bend" ? "Bend" : k === "horizontal" ? "H" : "V" }),
6207
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6157
6208
  "input",
6158
6209
  {
6159
6210
  type: "number",
@@ -6174,9 +6225,9 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
6174
6225
  },
6175
6226
  `${k}:${warp[k]}`
6176
6227
  ),
6177
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "text-muted-foreground", children: "%" })
6228
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "text-muted-foreground", children: "%" })
6178
6229
  ] }, k)),
6179
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
6230
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6180
6231
  "button",
6181
6232
  {
6182
6233
  type: "button",
@@ -6188,26 +6239,26 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
6188
6239
  children: "Vertical"
6189
6240
  }
6190
6241
  ),
6191
- /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "flex items-center gap-1", children: [
6192
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "text-muted-foreground", children: "Grid" }),
6193
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
6242
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { className: "flex items-center gap-1", children: [
6243
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "text-muted-foreground", children: "Grid" }),
6244
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6194
6245
  "select",
6195
6246
  {
6196
6247
  "aria-label": "Warp grid",
6197
- value: import_image_editor20.WARP_GRID_OPTIONS.find((g) => g.columns === warp.columns && g.rows === warp.rows)?.id ?? "1x1",
6248
+ value: import_image_editor21.WARP_GRID_OPTIONS.find((g) => g.columns === warp.columns && g.rows === warp.rows)?.id ?? "1x1",
6198
6249
  onChange: (e) => {
6199
- const g = import_image_editor20.WARP_GRID_OPTIONS.find((o) => o.id === e.target.value);
6250
+ const g = import_image_editor21.WARP_GRID_OPTIONS.find((o) => o.id === e.target.value);
6200
6251
  tool.setWarp({ columns: g.columns, rows: g.rows });
6201
6252
  },
6202
6253
  className: imageFieldClass,
6203
- children: import_image_editor20.WARP_GRID_OPTIONS.map((g) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("option", { value: g.id, children: g.label }, g.id))
6254
+ children: import_image_editor21.WARP_GRID_OPTIONS.map((g) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("option", { value: g.id, children: g.label }, g.id))
6204
6255
  }
6205
6256
  )
6206
6257
  ] })
6207
6258
  ] }),
6208
- tool.mode !== "warp" && import_image_editor20.FREE_TRANSFORM_FIELDS.map((f) => /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "flex items-center gap-1", title: f.title, children: [
6209
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "text-muted-foreground", children: f.label }),
6210
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
6259
+ tool.mode !== "warp" && import_image_editor21.FREE_TRANSFORM_FIELDS.map((f) => /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { className: "flex items-center gap-1", title: f.title, children: [
6260
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "text-muted-foreground", children: f.label }),
6261
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6211
6262
  "input",
6212
6263
  {
6213
6264
  type: "number",
@@ -6227,8 +6278,8 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
6227
6278
  },
6228
6279
  `${f.id}:${round(bar[f.id], f.unit)}`
6229
6280
  ),
6230
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "text-muted-foreground", children: f.unit }),
6231
- f.id === "scaleX" && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
6281
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "text-muted-foreground", children: f.unit }),
6282
+ f.id === "scaleX" && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6232
6283
  "button",
6233
6284
  {
6234
6285
  type: "button",
@@ -6243,33 +6294,33 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
6243
6294
  }
6244
6295
  )
6245
6296
  ] }, f.id)),
6246
- /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "flex items-center gap-1", children: [
6247
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "text-muted-foreground", children: "Interpolation" }),
6248
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
6297
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { className: "flex items-center gap-1", children: [
6298
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "text-muted-foreground", children: "Interpolation" }),
6299
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6249
6300
  "select",
6250
6301
  {
6251
6302
  "aria-label": "Interpolation",
6252
6303
  value: tool.interpolation,
6253
6304
  onChange: (e) => tool.setInterpolation(e.target.value),
6254
6305
  className: imageFieldClass,
6255
- children: import_image_editor20.INTERPOLATIONS.map((i) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("option", { value: i, children: i[0].toUpperCase() + i.slice(1) }, i))
6306
+ children: import_image_editor21.INTERPOLATIONS.map((i) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("option", { value: i, children: i[0].toUpperCase() + i.slice(1) }, i))
6256
6307
  }
6257
6308
  )
6258
6309
  ] }),
6259
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("button", { type: "button", title: "Commit (Enter)", className: "px-2 py-1 rounded bg-primary text-primary-foreground hover:bg-primary/90", onClick: () => tool.commit(), children: "Commit" }),
6260
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("button", { type: "button", title: "Cancel (Esc)", className: imageChipClass(false), onClick: () => tool.cancel(), children: "Cancel" }),
6261
- tool.error && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { role: "alert", className: "text-destructive", children: tool.error })
6310
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("button", { type: "button", title: "Commit (Enter)", className: "px-2 py-1 rounded bg-primary text-primary-foreground hover:bg-primary/90", onClick: () => tool.commit(), children: "Commit" }),
6311
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("button", { type: "button", title: "Cancel (Esc)", className: imageChipClass(false), onClick: () => tool.cancel(), children: "Cancel" }),
6312
+ tool.error && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { role: "alert", className: "text-destructive", children: tool.error })
6262
6313
  ] });
6263
6314
  };
6264
6315
 
6265
6316
  // src/image-editor/ShapeOptionsBar.tsx
6266
- var import_react32 = require("react");
6267
- var import_image_editor21 = require("@pixerate/editor/image-editor");
6268
- var import_jsx_runtime32 = require("react/jsx-runtime");
6317
+ var import_react33 = require("react");
6318
+ var import_image_editor22 = require("@pixerate/editor/image-editor");
6319
+ var import_jsx_runtime33 = require("react/jsx-runtime");
6269
6320
  var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
6270
- const [, setTick] = (0, import_react32.useState)(0);
6271
- (0, import_react32.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
6272
- const [error, setError] = (0, import_react32.useState)(null);
6321
+ const [, setTick] = (0, import_react33.useState)(0);
6322
+ (0, import_react33.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
6323
+ const [error, setError] = (0, import_react33.useState)(null);
6273
6324
  const active = controller.getActiveLayer();
6274
6325
  const shapeId = active?.type === "shape" ? active.id : null;
6275
6326
  const set = (change) => {
@@ -6277,28 +6328,28 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
6277
6328
  if (!shapeId) return;
6278
6329
  try {
6279
6330
  setError(null);
6280
- (0, import_image_editor21.applyShapeOptions)(controller, shapeId, change);
6331
+ (0, import_image_editor22.applyShapeOptions)(controller, shapeId, change);
6281
6332
  } catch (e) {
6282
6333
  setError(e instanceof Error ? e.message : String(e));
6283
6334
  }
6284
6335
  };
6285
6336
  const num = (v, min, max) => Math.max(min, Math.min(max, Number(v) || min));
6286
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "shape-options", children: [
6287
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Shape kind", children: import_image_editor21.LIVE_SHAPE_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("button", { type: "button", "aria-pressed": options.kind === k, className: imageChipClass(options.kind === k), onClick: () => onChange({ ...options, kind: k }), children: import_image_editor21.SHAPE_KIND_LABELS[k] }, k)) }),
6288
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
6289
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { className: "flex items-center gap-1", children: [
6290
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ImageCheckbox, { label: "Fill", checked: options.fill !== null, onChange: (on) => set({ fill: on ? "#4f46e5" : null }) }),
6337
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "shape-options", children: [
6338
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Shape kind", children: import_image_editor22.LIVE_SHAPE_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("button", { type: "button", "aria-pressed": options.kind === k, className: imageChipClass(options.kind === k), onClick: () => onChange({ ...options, kind: k }), children: import_image_editor22.SHAPE_KIND_LABELS[k] }, k)) }),
6339
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
6340
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("label", { className: "flex items-center gap-1", children: [
6341
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ImageCheckbox, { label: "Fill", checked: options.fill !== null, onChange: (on) => set({ fill: on ? "#4f46e5" : null }) }),
6291
6342
  "Fill",
6292
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ImageColor, { label: "Fill colour", disabled: options.fill === null, value: options.fill ?? "#4f46e5", onChange: (fill) => set({ fill }) })
6343
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ImageColor, { label: "Fill colour", disabled: options.fill === null, value: options.fill ?? "#4f46e5", onChange: (fill) => set({ fill }) })
6293
6344
  ] }),
6294
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { className: "flex items-center gap-1", children: [
6295
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ImageCheckbox, { label: "Stroke", checked: options.stroke !== null, onChange: (on) => set({ stroke: on ? "#000000" : null }) }),
6345
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("label", { className: "flex items-center gap-1", children: [
6346
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ImageCheckbox, { label: "Stroke", checked: options.stroke !== null, onChange: (on) => set({ stroke: on ? "#000000" : null }) }),
6296
6347
  "Stroke",
6297
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ImageColor, { label: "Stroke colour", disabled: options.stroke === null, value: options.stroke ?? "#000000", onChange: (stroke) => set({ stroke }) })
6348
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ImageColor, { label: "Stroke colour", disabled: options.stroke === null, value: options.stroke ?? "#000000", onChange: (stroke) => set({ stroke }) })
6298
6349
  ] }),
6299
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { className: "flex items-center gap-1", children: [
6350
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("label", { className: "flex items-center gap-1", children: [
6300
6351
  "Width",
6301
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6352
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6302
6353
  "input",
6303
6354
  {
6304
6355
  type: "number",
@@ -6312,52 +6363,52 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
6312
6363
  )
6313
6364
  ] })
6314
6365
  ] }),
6315
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
6316
- options.kind === "rect" && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { className: "flex items-center gap-1", children: [
6366
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
6367
+ options.kind === "rect" && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("label", { className: "flex items-center gap-1", children: [
6317
6368
  "Radius",
6318
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("input", { type: "number", "aria-label": "Corner radius", min: 0, max: 1e3, value: options.radius, onChange: (e) => set({ radius: num(e.target.value, 0, 1e3) }), className: `w-14 ${imageFieldClass}` })
6369
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("input", { type: "number", "aria-label": "Corner radius", min: 0, max: 1e3, value: options.radius, onChange: (e) => set({ radius: num(e.target.value, 0, 1e3) }), className: `w-14 ${imageFieldClass}` })
6319
6370
  ] }),
6320
- options.kind === "polygon" && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { className: "flex items-center gap-1", children: [
6371
+ options.kind === "polygon" && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("label", { className: "flex items-center gap-1", children: [
6321
6372
  "Sides",
6322
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("input", { type: "number", "aria-label": "Sides", min: 3, max: 100, value: options.sides, onChange: (e) => set({ sides: num(e.target.value, 3, 100) }), className: `w-14 ${imageFieldClass}` })
6373
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("input", { type: "number", "aria-label": "Sides", min: 3, max: 100, value: options.sides, onChange: (e) => set({ sides: num(e.target.value, 3, 100) }), className: `w-14 ${imageFieldClass}` })
6323
6374
  ] }),
6324
- options.kind === "star" && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
6325
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { className: "flex items-center gap-1", children: [
6375
+ options.kind === "star" && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
6376
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("label", { className: "flex items-center gap-1", children: [
6326
6377
  "Points",
6327
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("input", { type: "number", "aria-label": "Points", min: 3, max: 100, value: options.points, onChange: (e) => set({ points: num(e.target.value, 3, 100) }), className: `w-14 ${imageFieldClass}` })
6378
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("input", { type: "number", "aria-label": "Points", min: 3, max: 100, value: options.points, onChange: (e) => set({ points: num(e.target.value, 3, 100) }), className: `w-14 ${imageFieldClass}` })
6328
6379
  ] }),
6329
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { className: "flex items-center gap-1", children: [
6380
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("label", { className: "flex items-center gap-1", children: [
6330
6381
  "Inner",
6331
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ImageRange, { label: "Inner radius", min: 0.05, max: 1, step: 0.05, value: options.innerRatio, onChange: (v) => set({ innerRatio: v }) })
6382
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ImageRange, { label: "Inner radius", min: 0.05, max: 1, step: 0.05, value: options.innerRatio, onChange: (v) => set({ innerRatio: v }) })
6332
6383
  ] })
6333
6384
  ] }),
6334
- options.kind === "line" && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
6335
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { className: "flex items-center gap-1", children: [
6385
+ options.kind === "line" && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
6386
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("label", { className: "flex items-center gap-1", children: [
6336
6387
  "Weight",
6337
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("input", { type: "number", "aria-label": "Line weight", min: 1, max: 200, value: options.weight, onChange: (e) => set({ weight: num(e.target.value, 1, 200) }), className: `w-14 ${imageFieldClass}` })
6388
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("input", { type: "number", "aria-label": "Line weight", min: 1, max: 200, value: options.weight, onChange: (e) => set({ weight: num(e.target.value, 1, 200) }), className: `w-14 ${imageFieldClass}` })
6338
6389
  ] }),
6339
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { className: "flex items-center gap-1", children: [
6340
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ImageCheckbox, { label: "Arrowhead", checked: options.arrow, onChange: (on) => set({ arrow: on }) }),
6390
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("label", { className: "flex items-center gap-1", children: [
6391
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ImageCheckbox, { label: "Arrowhead", checked: options.arrow, onChange: (on) => set({ arrow: on }) }),
6341
6392
  "Arrowhead"
6342
6393
  ] })
6343
6394
  ] })
6344
6395
  ] }),
6345
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { className: "text-[10px] text-muted-foreground", children: "Drag on the image to draw. Shift: square, circle or 45\xB0 line. Alt: from the centre." }),
6346
- error && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { role: "alert", className: "text-destructive", children: error })
6396
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { className: "text-[10px] text-muted-foreground", children: "Drag on the image to draw. Shift: square, circle or 45\xB0 line. Alt: from the centre." }),
6397
+ error && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { role: "alert", className: "text-destructive", children: error })
6347
6398
  ] });
6348
6399
  };
6349
6400
 
6350
6401
  // src/image-editor/TypeOptionsBar.tsx
6351
- var import_react33 = require("react");
6352
- var import_image_editor22 = require("@pixerate/editor/image-editor");
6353
- var import_jsx_runtime33 = require("react/jsx-runtime");
6402
+ var import_react34 = require("react");
6403
+ var import_image_editor23 = require("@pixerate/editor/image-editor");
6404
+ var import_jsx_runtime34 = require("react/jsx-runtime");
6354
6405
  var ALIGN_LABELS = { left: "Left", center: "Centre", right: "Right", justify: "Justify" };
6355
6406
  var ORIENTATION_LABELS = { horizontal: "Horizontal", vertical: "Vertical" };
6356
6407
  var TypeOptionsBar = ({ controller, options, onChange, session, className }) => {
6357
- const [, setTick] = (0, import_react33.useState)(0);
6358
- (0, import_react33.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
6359
- (0, import_react33.useEffect)(() => session?.subscribe(() => setTick((n) => n + 1)), [session]);
6360
- const [error, setError] = (0, import_react33.useState)(null);
6408
+ const [, setTick] = (0, import_react34.useState)(0);
6409
+ (0, import_react34.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
6410
+ (0, import_react34.useEffect)(() => session?.subscribe(() => setTick((n) => n + 1)), [session]);
6411
+ const [error, setError] = (0, import_react34.useState)(null);
6361
6412
  const active = controller.getActiveLayer();
6362
6413
  const typeId = !session && active?.type === "type" ? active.id : null;
6363
6414
  const here = session?.alive ? session.styleHere() : {};
@@ -6410,11 +6461,11 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
6410
6461
  setError(e instanceof Error ? e.message : String(e));
6411
6462
  }
6412
6463
  };
6413
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "type-options", children: [
6414
- /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
6415
- /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("label", { className: "flex items-center gap-1", children: [
6464
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "type-options", children: [
6465
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
6466
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("label", { className: "flex items-center gap-1", children: [
6416
6467
  "Font",
6417
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6468
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6418
6469
  "input",
6419
6470
  {
6420
6471
  list: "pixerate-type-fonts",
@@ -6424,11 +6475,11 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
6424
6475
  className: "w-32 rounded border border-border bg-background px-1 py-0.5"
6425
6476
  }
6426
6477
  ),
6427
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("datalist", { id: "pixerate-type-fonts", children: fonts.map((f) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("option", { value: f }, f)) })
6478
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("datalist", { id: "pixerate-type-fonts", children: fonts.map((f) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("option", { value: f }, f)) })
6428
6479
  ] }),
6429
- /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("label", { className: "flex items-center gap-1", children: [
6480
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("label", { className: "flex items-center gap-1", children: [
6430
6481
  "Size",
6431
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6482
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6432
6483
  "input",
6433
6484
  {
6434
6485
  type: "number",
@@ -6441,14 +6492,14 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
6441
6492
  }
6442
6493
  )
6443
6494
  ] }),
6444
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("button", { type: "button", "aria-pressed": shown.fontWeight >= 600, className: `${imageChipClass(shown.fontWeight >= 600)} font-bold`, onClick: () => style({ fontWeight: shown.fontWeight >= 600 ? 400 : 700 }), children: "B" }),
6445
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("button", { type: "button", "aria-pressed": shown.italic, className: `${imageChipClass(shown.italic)} italic`, onClick: () => style({ italic: !shown.italic }), children: "I" }),
6446
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ImageColor, { label: "Text colour", value: shown.color, onChange: (color) => style({ color }) })
6495
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("button", { type: "button", "aria-pressed": shown.fontWeight >= 600, className: `${imageChipClass(shown.fontWeight >= 600)} font-bold`, onClick: () => style({ fontWeight: shown.fontWeight >= 600 ? 400 : 700 }), children: "B" }),
6496
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("button", { type: "button", "aria-pressed": shown.italic, className: `${imageChipClass(shown.italic)} italic`, onClick: () => style({ italic: !shown.italic }), children: "I" }),
6497
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ImageColor, { label: "Text colour", value: shown.color, onChange: (color) => style({ color }) })
6447
6498
  ] }),
6448
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Alignment", children: import_image_editor22.TEXT_ALIGNS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("button", { type: "button", "aria-pressed": options.align === a, className: imageChipClass(options.align === a), onClick: () => style({ align: a }), children: ALIGN_LABELS[a] }, a)) }),
6449
- /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Orientation", children: [
6450
- import_image_editor22.TEXT_ORIENTATIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("button", { type: "button", "aria-pressed": orientation === o, className: imageChipClass(orientation === o), onClick: () => orient(o), children: ORIENTATION_LABELS[o] }, o)),
6451
- orientation === "vertical" && editedId && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6499
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Alignment", children: import_image_editor23.TEXT_ALIGNS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("button", { type: "button", "aria-pressed": options.align === a, className: imageChipClass(options.align === a), onClick: () => style({ align: a }), children: ALIGN_LABELS[a] }, a)) }),
6500
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Orientation", children: [
6501
+ import_image_editor23.TEXT_ORIENTATIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("button", { type: "button", "aria-pressed": orientation === o, className: imageChipClass(orientation === o), onClick: () => orient(o), children: ORIENTATION_LABELS[o] }, o)),
6502
+ orientation === "vertical" && editedId && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6452
6503
  "button",
6453
6504
  {
6454
6505
  type: "button",
@@ -6460,19 +6511,19 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
6460
6511
  }
6461
6512
  )
6462
6513
  ] }),
6463
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { className: "text-[10px] text-muted-foreground", children: "Click to type point text (vertical: a column down from the click), drag for a paragraph box, click text to edit it. Esc finishes." }),
6464
- missing.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("p", { role: "status", className: "text-amber-600", "data-testid": "type-missing-fonts", children: [
6514
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("p", { className: "text-[10px] text-muted-foreground", children: "Click to type point text (vertical: a column down from the click), drag for a paragraph box, click text to edit it. Esc finishes." }),
6515
+ missing.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("p", { role: "status", className: "text-amber-600", "data-testid": "type-missing-fonts", children: [
6465
6516
  "Missing ",
6466
6517
  missing.length === 1 ? "font" : "fonts",
6467
6518
  ": ",
6468
6519
  missing.join(", ")
6469
6520
  ] }),
6470
- error && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { role: "alert", className: "text-destructive", children: error })
6521
+ error && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("p", { role: "alert", className: "text-destructive", children: error })
6471
6522
  ] });
6472
6523
  };
6473
6524
 
6474
6525
  // src/image-editor/ImageEditor.tsx
6475
- var import_jsx_runtime34 = require("react/jsx-runtime");
6526
+ var import_jsx_runtime35 = require("react/jsx-runtime");
6476
6527
  var ImageEditor = ({
6477
6528
  editor: externalEditor,
6478
6529
  src,
@@ -6496,51 +6547,51 @@ var ImageEditor = ({
6496
6547
  const effectsShown = !!controller.effectsProvider || state.layers.some(function has(l) {
6497
6548
  return l.type === "pixel" && !!l.generator || l.type === "smart" && !!l.smartFilters?.filters.some((f) => f.kind === "effect") || l.type === "group" && l.children.some(has);
6498
6549
  });
6499
- const legacyProcess = (0, import_image_editor23.normalizeProcessVersion)(state.adjustments.process) < import_image_editor23.LATEST_PROCESS_VERSION;
6500
- const [activeTab, setActiveTab] = (0, import_react34.useState)("crop");
6501
- const rootRef = (0, import_react34.useRef)(null);
6550
+ const legacyProcess = (0, import_image_editor24.normalizeProcessVersion)(state.adjustments.process) < import_image_editor24.LATEST_PROCESS_VERSION;
6551
+ const [activeTab, setActiveTab] = (0, import_react35.useState)("crop");
6552
+ const rootRef = (0, import_react35.useRef)(null);
6502
6553
  const canvasMode = activeTab === "crop" || activeTab === "select" || activeTab === "paint" || activeTab === "annotate" ? activeTab : "none";
6503
- const activeTabRef = (0, import_react34.useRef)(activeTab);
6554
+ const activeTabRef = (0, import_react35.useRef)(activeTab);
6504
6555
  activeTabRef.current = activeTab;
6505
6556
  const openPanel = async (ref) => {
6506
6557
  if (ref.kind !== "panel" || activeTabRef.current === ref.id) return;
6507
6558
  rootRef.current?.querySelector(`[data-image-tab="${CSS.escape(ref.id)}"]`)?.click();
6508
6559
  await new Promise((resolve) => setTimeout(resolve, 60));
6509
6560
  };
6510
- const [activeCropRatio, setActiveCropRatio] = (0, import_react34.useState)(null);
6511
- const [selectionOptions, setSelectionOptions] = (0, import_react34.useState)(import_image_editor23.DEFAULT_SELECTION_TOOL_OPTIONS);
6512
- const [shapeOptions, setShapeOptions] = (0, import_react34.useState)(import_image_editor23.DEFAULT_SHAPE_TOOL_OPTIONS);
6513
- const [typeOptions, setTypeOptions] = (0, import_react34.useState)(import_image_editor23.DEFAULT_TYPE_TOOL_OPTIONS);
6514
- const [typeSession, setTypeSession] = (0, import_react34.useState)(null);
6515
- const [selectionError, setSelectionError] = (0, import_react34.useState)(null);
6516
- const [paintError, setPaintError] = (0, import_react34.useState)(null);
6517
- const [shapeTypeError, setShapeTypeError] = (0, import_react34.useState)(null);
6561
+ const [activeCropRatio, setActiveCropRatio] = (0, import_react35.useState)(null);
6562
+ const [selectionOptions, setSelectionOptions] = (0, import_react35.useState)(import_image_editor24.DEFAULT_SELECTION_TOOL_OPTIONS);
6563
+ const [shapeOptions, setShapeOptions] = (0, import_react35.useState)(import_image_editor24.DEFAULT_SHAPE_TOOL_OPTIONS);
6564
+ const [typeOptions, setTypeOptions] = (0, import_react35.useState)(import_image_editor24.DEFAULT_TYPE_TOOL_OPTIONS);
6565
+ const [typeSession, setTypeSession] = (0, import_react35.useState)(null);
6566
+ const [selectionError, setSelectionError] = (0, import_react35.useState)(null);
6567
+ const [paintError, setPaintError] = (0, import_react35.useState)(null);
6568
+ const [shapeTypeError, setShapeTypeError] = (0, import_react35.useState)(null);
6518
6569
  const handleCanvasError = (source, message) => {
6519
6570
  if (source === "paint") setPaintError(message);
6520
6571
  else if (source === "select") setSelectionError(message);
6521
6572
  else setShapeTypeError(message);
6522
6573
  };
6523
6574
  const finishTyping = () => setTypeSession(null);
6524
- const transformToolRef = (0, import_react34.useRef)(null);
6525
- const transformControllerRef = (0, import_react34.useRef)(controller);
6575
+ const transformToolRef = (0, import_react35.useRef)(null);
6576
+ const transformControllerRef = (0, import_react35.useRef)(controller);
6526
6577
  if (!transformToolRef.current || transformControllerRef.current !== controller) {
6527
6578
  transformToolRef.current?.cancel();
6528
- transformToolRef.current = new import_image_editor23.FreeTransformTool(controller, {
6579
+ transformToolRef.current = new import_image_editor24.FreeTransformTool(controller, {
6529
6580
  schedule: (run) => typeof requestAnimationFrame !== "undefined" ? requestAnimationFrame(run) : run()
6530
6581
  });
6531
6582
  transformControllerRef.current = controller;
6532
6583
  }
6533
6584
  const transformTool = transformToolRef.current;
6534
- const [, setTransformTick] = (0, import_react34.useState)(0);
6535
- (0, import_react34.useEffect)(() => transformTool.subscribe(() => setTransformTick((n) => n + 1)), [transformTool]);
6536
- (0, import_react34.useEffect)(() => () => transformToolRef.current?.cancel(), []);
6537
- const [inpaintPrompt, setInpaintPrompt] = (0, import_react34.useState)("");
6538
- const [inpaintMaskMode, setInpaintMaskMode] = (0, import_react34.useState)("annotations");
6539
- const [isRemovingBg, setIsRemovingBg] = (0, import_react34.useState)(false);
6540
- const [isInpainting, setIsInpainting] = (0, import_react34.useState)(false);
6541
- const [aiError, setAiError] = (0, import_react34.useState)(null);
6542
- const [aiSuccess, setAiSuccess] = (0, import_react34.useState)(null);
6543
- const [aiTarget, setAiTarget] = (0, import_react34.useState)("auto");
6585
+ const [, setTransformTick] = (0, import_react35.useState)(0);
6586
+ (0, import_react35.useEffect)(() => transformTool.subscribe(() => setTransformTick((n) => n + 1)), [transformTool]);
6587
+ (0, import_react35.useEffect)(() => () => transformToolRef.current?.cancel(), []);
6588
+ const [inpaintPrompt, setInpaintPrompt] = (0, import_react35.useState)("");
6589
+ const [inpaintMaskMode, setInpaintMaskMode] = (0, import_react35.useState)("annotations");
6590
+ const [isRemovingBg, setIsRemovingBg] = (0, import_react35.useState)(false);
6591
+ const [isInpainting, setIsInpainting] = (0, import_react35.useState)(false);
6592
+ const [aiError, setAiError] = (0, import_react35.useState)(null);
6593
+ const [aiSuccess, setAiSuccess] = (0, import_react35.useState)(null);
6594
+ const [aiTarget, setAiTarget] = (0, import_react35.useState)("auto");
6544
6595
  const aiOptions = aiTarget === "auto" ? {} : { target: aiTarget };
6545
6596
  const effectiveOnInpaint = onInpaint || aiHooks?.onInpaint;
6546
6597
  const effectiveOnRemoveBg = onRemoveBackground || aiHooks?.onRemoveBackground;
@@ -6603,11 +6654,11 @@ var ImageEditor = ({
6603
6654
  setIsInpainting(false);
6604
6655
  }
6605
6656
  };
6606
- const [activeColor, setActiveColor] = (0, import_react34.useState)("#ef4444");
6607
- const [strokeWidth, setStrokeWidth] = (0, import_react34.useState)(3);
6608
- const [fontSize, setFontSize] = (0, import_react34.useState)(24);
6609
- const [textInput, setTextInput] = (0, import_react34.useState)("");
6610
- (0, import_react34.useEffect)(() => {
6657
+ const [activeColor, setActiveColor] = (0, import_react35.useState)("#ef4444");
6658
+ const [strokeWidth, setStrokeWidth] = (0, import_react35.useState)(3);
6659
+ const [fontSize, setFontSize] = (0, import_react35.useState)(24);
6660
+ const [textInput, setTextInput] = (0, import_react35.useState)("");
6661
+ (0, import_react35.useEffect)(() => {
6611
6662
  if (activeTab === "crop" && editor.state.activeTool !== "crop") {
6612
6663
  editor.setTool("crop");
6613
6664
  }
@@ -6635,16 +6686,16 @@ var ImageEditor = ({
6635
6686
  link.click();
6636
6687
  }
6637
6688
  };
6638
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
6689
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
6639
6690
  "div",
6640
6691
  {
6641
6692
  ref: rootRef,
6642
6693
  className: `${imageEditorFrameClass} ${className}`,
6643
6694
  style,
6644
6695
  children: [
6645
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: imageEditorHeaderClass, children: [
6646
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { role: "tablist", className: imageTabListClass, children: [
6647
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6696
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: imageEditorHeaderClass, children: [
6697
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { role: "tablist", className: imageTabListClass, children: [
6698
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
6648
6699
  "button",
6649
6700
  {
6650
6701
  type: "button",
@@ -6659,7 +6710,7 @@ var ImageEditor = ({
6659
6710
  children: "Transform & Crop"
6660
6711
  }
6661
6712
  ),
6662
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6713
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
6663
6714
  "button",
6664
6715
  {
6665
6716
  type: "button",
@@ -6674,7 +6725,7 @@ var ImageEditor = ({
6674
6725
  children: "Adjustments"
6675
6726
  }
6676
6727
  ),
6677
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6728
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
6678
6729
  "button",
6679
6730
  {
6680
6731
  type: "button",
@@ -6689,7 +6740,7 @@ var ImageEditor = ({
6689
6740
  children: "Layers"
6690
6741
  }
6691
6742
  ),
6692
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6743
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
6693
6744
  "button",
6694
6745
  {
6695
6746
  type: "button",
@@ -6704,7 +6755,7 @@ var ImageEditor = ({
6704
6755
  children: "Paint"
6705
6756
  }
6706
6757
  ),
6707
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6758
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
6708
6759
  "button",
6709
6760
  {
6710
6761
  type: "button",
@@ -6719,7 +6770,7 @@ var ImageEditor = ({
6719
6770
  children: "Select & Mask"
6720
6771
  }
6721
6772
  ),
6722
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6773
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
6723
6774
  "button",
6724
6775
  {
6725
6776
  type: "button",
@@ -6734,7 +6785,7 @@ var ImageEditor = ({
6734
6785
  children: "Annotations"
6735
6786
  }
6736
6787
  ),
6737
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6788
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
6738
6789
  "button",
6739
6790
  {
6740
6791
  type: "button",
@@ -6749,7 +6800,7 @@ var ImageEditor = ({
6749
6800
  children: "Depth Mask"
6750
6801
  }
6751
6802
  ),
6752
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
6803
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
6753
6804
  "button",
6754
6805
  {
6755
6806
  type: "button",
@@ -6762,14 +6813,14 @@ var ImageEditor = ({
6762
6813
  "aria-selected": activeTab === "ai",
6763
6814
  className: `${imageTabClass(activeTab === "ai")} flex items-center gap-1.5`,
6764
6815
  children: [
6765
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("path", { d: "M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83" }) }),
6816
+ /* @__PURE__ */ (0, import_jsx_runtime35.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_runtime35.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" }) }),
6766
6817
  "AI Tools"
6767
6818
  ]
6768
6819
  }
6769
6820
  )
6770
6821
  ] }),
6771
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex items-center gap-2 text-xs", children: [
6772
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6822
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex items-center gap-2 text-xs", children: [
6823
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
6773
6824
  "button",
6774
6825
  {
6775
6826
  type: "button",
@@ -6780,7 +6831,7 @@ var ImageEditor = ({
6780
6831
  children: "\u21A9"
6781
6832
  }
6782
6833
  ),
6783
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6834
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
6784
6835
  "button",
6785
6836
  {
6786
6837
  type: "button",
@@ -6791,7 +6842,7 @@ var ImageEditor = ({
6791
6842
  children: "\u21AA"
6792
6843
  }
6793
6844
  ),
6794
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6845
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
6795
6846
  "button",
6796
6847
  {
6797
6848
  type: "button",
@@ -6800,8 +6851,8 @@ var ImageEditor = ({
6800
6851
  children: "Reset"
6801
6852
  }
6802
6853
  ),
6803
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "h-4 w-px bg-muted mx-1" }),
6804
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6854
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "h-4 w-px bg-muted mx-1" }),
6855
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
6805
6856
  "button",
6806
6857
  {
6807
6858
  type: "button",
@@ -6811,11 +6862,11 @@ var ImageEditor = ({
6811
6862
  children: "-"
6812
6863
  }
6813
6864
  ),
6814
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("span", { className: "font-mono text-muted-foreground w-10 text-center", children: [
6865
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("span", { className: "font-mono text-muted-foreground w-10 text-center", children: [
6815
6866
  Math.round(state.zoom * 100),
6816
6867
  "%"
6817
6868
  ] }),
6818
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6869
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
6819
6870
  "button",
6820
6871
  {
6821
6872
  type: "button",
@@ -6825,8 +6876,8 @@ var ImageEditor = ({
6825
6876
  children: "+"
6826
6877
  }
6827
6878
  ),
6828
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "h-4 w-px bg-muted mx-1" }),
6829
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6879
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "h-4 w-px bg-muted mx-1" }),
6880
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
6830
6881
  "button",
6831
6882
  {
6832
6883
  type: "button",
@@ -6837,7 +6888,7 @@ var ImageEditor = ({
6837
6888
  children: "Hold Compare"
6838
6889
  }
6839
6890
  ),
6840
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6891
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
6841
6892
  "button",
6842
6893
  {
6843
6894
  type: "button",
@@ -6848,10 +6899,10 @@ var ImageEditor = ({
6848
6899
  )
6849
6900
  ] })
6850
6901
  ] }),
6851
- transformTool.active && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(FreeTransformOptionsBar, { tool: transformTool, className: "border-b border-border bg-background/95 px-4 py-2" }),
6852
- !transformTool.active && transformTool.error && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { role: "alert", className: imageErrorBannerClass, children: transformTool.error }),
6853
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex flex-col md:flex-row flex-1 min-h-[520px] md:h-[560px]", children: [
6854
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6902
+ transformTool.active && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(FreeTransformOptionsBar, { tool: transformTool, className: "border-b border-border bg-background/95 px-4 py-2" }),
6903
+ !transformTool.active && transformTool.error && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { role: "alert", className: imageErrorBannerClass, children: transformTool.error }),
6904
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex flex-col md:flex-row flex-1 min-h-[520px] md:h-[560px]", children: [
6905
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
6855
6906
  ImageEditorCanvas,
6856
6907
  {
6857
6908
  editor,
@@ -6875,11 +6926,11 @@ var ImageEditor = ({
6875
6926
  className: "flex-1 h-[360px] md:h-full min-h-[320px] bg-muted"
6876
6927
  }
6877
6928
  ),
6878
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: imageSidebarClass, children: [
6879
- activeTab === "crop" && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
6880
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: imageSectionTitleClass, children: "Aspect Ratio Presets" }),
6881
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "grid grid-cols-3 gap-2", children: [
6882
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6929
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: imageSidebarClass, children: [
6930
+ activeTab === "crop" && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
6931
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: imageSectionTitleClass, children: "Aspect Ratio Presets" }),
6932
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "grid grid-cols-3 gap-2", children: [
6933
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
6883
6934
  "button",
6884
6935
  {
6885
6936
  type: "button",
@@ -6891,7 +6942,7 @@ var ImageEditor = ({
6891
6942
  children: "Freeform"
6892
6943
  }
6893
6944
  ),
6894
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6945
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
6895
6946
  "button",
6896
6947
  {
6897
6948
  type: "button",
@@ -6903,7 +6954,7 @@ var ImageEditor = ({
6903
6954
  children: "1:1 Square"
6904
6955
  }
6905
6956
  ),
6906
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6957
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
6907
6958
  "button",
6908
6959
  {
6909
6960
  type: "button",
@@ -6915,7 +6966,7 @@ var ImageEditor = ({
6915
6966
  children: "4:3 Standard"
6916
6967
  }
6917
6968
  ),
6918
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6969
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
6919
6970
  "button",
6920
6971
  {
6921
6972
  type: "button",
@@ -6927,7 +6978,7 @@ var ImageEditor = ({
6927
6978
  children: "16:9 Wide"
6928
6979
  }
6929
6980
  ),
6930
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6981
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
6931
6982
  "button",
6932
6983
  {
6933
6984
  type: "button",
@@ -6939,7 +6990,7 @@ var ImageEditor = ({
6939
6990
  children: "3:2 Photo"
6940
6991
  }
6941
6992
  ),
6942
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6993
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
6943
6994
  "button",
6944
6995
  {
6945
6996
  type: "button",
@@ -6952,10 +7003,10 @@ var ImageEditor = ({
6952
7003
  }
6953
7004
  )
6954
7005
  ] }),
6955
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: imageDividerClass }),
6956
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: imageSectionTitleClass, children: "Orientation & Flips" }),
6957
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "grid grid-cols-2 gap-2", children: [
6958
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
7006
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: imageDividerClass }),
7007
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: imageSectionTitleClass, children: "Orientation & Flips" }),
7008
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "grid grid-cols-2 gap-2", children: [
7009
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
6959
7010
  "button",
6960
7011
  {
6961
7012
  type: "button",
@@ -6964,7 +7015,7 @@ var ImageEditor = ({
6964
7015
  children: "Rotate -90\xB0"
6965
7016
  }
6966
7017
  ),
6967
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
7018
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
6968
7019
  "button",
6969
7020
  {
6970
7021
  type: "button",
@@ -6973,7 +7024,7 @@ var ImageEditor = ({
6973
7024
  children: "Rotate +90\xB0"
6974
7025
  }
6975
7026
  ),
6976
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
7027
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
6977
7028
  "button",
6978
7029
  {
6979
7030
  type: "button",
@@ -6982,7 +7033,7 @@ var ImageEditor = ({
6982
7033
  children: "Flip Horizontal"
6983
7034
  }
6984
7035
  ),
6985
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
7036
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
6986
7037
  "button",
6987
7038
  {
6988
7039
  type: "button",
@@ -6993,10 +7044,10 @@ var ImageEditor = ({
6993
7044
  )
6994
7045
  ] })
6995
7046
  ] }),
6996
- activeTab === "adjust" && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
6997
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex items-center justify-between", children: [
6998
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: imageSectionTitleClass, children: "Color Adjustments" }),
6999
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
7047
+ activeTab === "adjust" && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
7048
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex items-center justify-between", children: [
7049
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: imageSectionTitleClass, children: "Color Adjustments" }),
7050
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
7000
7051
  "button",
7001
7052
  {
7002
7053
  type: "button",
@@ -7006,25 +7057,25 @@ var ImageEditor = ({
7006
7057
  }
7007
7058
  )
7008
7059
  ] }),
7009
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Histogram, { histogram: editor.histogram }),
7010
- import_image_editor23.IMAGE_ADJUSTMENT_CONTROLS.map((spec) => /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_react34.default.Fragment, { children: [
7011
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
7060
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Histogram, { histogram: editor.histogram }),
7061
+ import_image_editor24.IMAGE_ADJUSTMENT_CONTROLS.map((spec) => /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_react35.default.Fragment, { children: [
7062
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
7012
7063
  ControlSlider,
7013
7064
  {
7014
7065
  spec,
7015
- value: (0, import_image_editor23.readAdjustmentControls)(state.adjustments)[spec.id],
7066
+ value: (0, import_image_editor24.readAdjustmentControls)(state.adjustments)[spec.id],
7016
7067
  disabled: spec.requiresProcess !== void 0 && legacyProcess,
7017
7068
  onChange: (v) => editor.setAdjustments({ [spec.id]: v })
7018
7069
  }
7019
7070
  ),
7020
- spec.id === "tint" && legacyProcess && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
7071
+ spec.id === "tint" && legacyProcess && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
7021
7072
  "div",
7022
7073
  {
7023
7074
  className: "flex items-center justify-between gap-2 rounded border border-amber-500/30 bg-amber-500/10 px-2 py-1.5 text-[10px] text-amber-600",
7024
7075
  "data-testid": "image-editor-process-notice",
7025
7076
  children: [
7026
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { children: "Legacy rendering (process 1). Tint needs the current process." }),
7027
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
7077
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { children: "Legacy rendering (process 1). Tint needs the current process." }),
7078
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
7028
7079
  "button",
7029
7080
  {
7030
7081
  type: "button",
@@ -7037,7 +7088,7 @@ var ImageEditor = ({
7037
7088
  }
7038
7089
  )
7039
7090
  ] }, spec.id)),
7040
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: imageSectionClass, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
7091
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: imageSectionClass, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
7041
7092
  AdjustmentLayersPanel,
7042
7093
  {
7043
7094
  controller,
@@ -7046,9 +7097,9 @@ var ImageEditor = ({
7046
7097
  }
7047
7098
  ) })
7048
7099
  ] }),
7049
- activeTab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
7050
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: imageSectionTitleClass, children: "Layers" }),
7051
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
7100
+ activeTab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
7101
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: imageSectionTitleClass, children: "Layers" }),
7102
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
7052
7103
  "button",
7053
7104
  {
7054
7105
  type: "button",
@@ -7059,15 +7110,15 @@ var ImageEditor = ({
7059
7110
  children: "Free Transform"
7060
7111
  }
7061
7112
  ),
7062
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(LayersPanel, { controller }),
7063
- effectsShown && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ImageProviderEffectsPanel, { controller, className: imageSectionClass }),
7064
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: imageSectionTitleClass, children: "Colour" }),
7065
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ColorProfilePanel, { controller })
7113
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(LayersPanel, { controller }),
7114
+ effectsShown && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ImageProviderEffectsPanel, { controller, className: imageSectionClass }),
7115
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: imageSectionTitleClass, children: "Colour" }),
7116
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ColorProfilePanel, { controller })
7066
7117
  ] }),
7067
- activeTab === "paint" && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
7068
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: imageSectionTitleClass, children: "Paint" }),
7069
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(BrushOptionsBar, { controller }),
7070
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
7118
+ activeTab === "paint" && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
7119
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: imageSectionTitleClass, children: "Paint" }),
7120
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(BrushOptionsBar, { controller }),
7121
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
7071
7122
  "button",
7072
7123
  {
7073
7124
  type: "button",
@@ -7078,29 +7129,29 @@ var ImageEditor = ({
7078
7129
  children: "Free Transform"
7079
7130
  }
7080
7131
  ),
7081
- paintError && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("p", { role: "alert", className: "text-destructive", "data-testid": "paint-error", children: paintError }),
7082
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: imageSectionClass, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(LayersPanel, { controller }) })
7132
+ paintError && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("p", { role: "alert", className: "text-destructive", "data-testid": "paint-error", children: paintError }),
7133
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: imageSectionClass, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(LayersPanel, { controller }) })
7083
7134
  ] }),
7084
- activeTab === "annotate" && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
7085
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: imageSectionTitleClass, children: "Shape & Type Layers, Paths" }),
7086
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "grid grid-cols-2 gap-1.5", children: ["shape", "type", "path-pen", "path-select", "direct-select"].map((t) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
7135
+ activeTab === "annotate" && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
7136
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: imageSectionTitleClass, children: "Shape & Type Layers, Paths" }),
7137
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "grid grid-cols-2 gap-1.5", children: ["shape", "type", "path-pen", "path-select", "direct-select"].map((t) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
7087
7138
  "button",
7088
7139
  {
7089
7140
  type: "button",
7090
7141
  "aria-pressed": state.activeTool === t,
7091
7142
  onClick: () => editor.setTool(t),
7092
7143
  className: `py-1.5 px-2 rounded-lg font-medium border transition-colors ${state.activeTool === t ? "bg-primary border-primary text-primary-foreground" : "bg-muted border-border text-foreground hover:bg-accent"}`,
7093
- children: (0, import_image_editor23.imageToolLabel)(t)
7144
+ children: (0, import_image_editor24.imageToolLabel)(t)
7094
7145
  },
7095
7146
  t
7096
7147
  )) }),
7097
- state.activeTool === "shape" && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ShapeOptionsBar, { controller, options: shapeOptions, onChange: setShapeOptions }),
7098
- state.activeTool === "type" && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(TypeOptionsBar, { controller, options: typeOptions, onChange: setTypeOptions, session: typeSession }),
7099
- state.activeTool === "type" && typeSession && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("button", { type: "button", onClick: finishTyping, className: "self-start rounded bg-muted px-2 py-1 text-[11px] text-foreground hover:bg-accent", children: "Done editing text" }),
7100
- shapeTypeError && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("p", { role: "alert", className: "text-destructive", "data-testid": "shape-type-error", children: shapeTypeError }),
7101
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: imageDividerClass }),
7102
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: imageSectionTitleClass, children: "Draw & Annotate" }),
7103
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "grid grid-cols-3 gap-1.5", children: ["pen", "rect", "circle", "arrow", "line"].map((t) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
7148
+ state.activeTool === "shape" && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ShapeOptionsBar, { controller, options: shapeOptions, onChange: setShapeOptions }),
7149
+ state.activeTool === "type" && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TypeOptionsBar, { controller, options: typeOptions, onChange: setTypeOptions, session: typeSession }),
7150
+ state.activeTool === "type" && typeSession && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("button", { type: "button", onClick: finishTyping, className: "self-start rounded bg-muted px-2 py-1 text-[11px] text-foreground hover:bg-accent", children: "Done editing text" }),
7151
+ shapeTypeError && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("p", { role: "alert", className: "text-destructive", "data-testid": "shape-type-error", children: shapeTypeError }),
7152
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: imageDividerClass }),
7153
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: imageSectionTitleClass, children: "Draw & Annotate" }),
7154
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "grid grid-cols-3 gap-1.5", children: ["pen", "rect", "circle", "arrow", "line"].map((t) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
7104
7155
  "button",
7105
7156
  {
7106
7157
  type: "button",
@@ -7110,18 +7161,18 @@ var ImageEditor = ({
7110
7161
  },
7111
7162
  t
7112
7163
  )) }),
7113
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex items-center gap-2 mt-2", children: [
7114
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("label", { className: "text-muted-foreground", children: "Color:" }),
7115
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ImageColor, { label: "Annotation colour", value: activeColor, onChange: setActiveColor }),
7116
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex-1 ml-2", children: [
7117
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-0.5", children: [
7118
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { children: "Width:" }),
7119
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("span", { className: "font-mono", children: [
7164
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex items-center gap-2 mt-2", children: [
7165
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("label", { className: "text-muted-foreground", children: "Color:" }),
7166
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ImageColor, { label: "Annotation colour", value: activeColor, onChange: setActiveColor }),
7167
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex-1 ml-2", children: [
7168
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-0.5", children: [
7169
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { children: "Width:" }),
7170
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("span", { className: "font-mono", children: [
7120
7171
  strokeWidth,
7121
7172
  "px"
7122
7173
  ] })
7123
7174
  ] }),
7124
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
7175
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
7125
7176
  "input",
7126
7177
  {
7127
7178
  type: "range",
@@ -7134,10 +7185,10 @@ var ImageEditor = ({
7134
7185
  )
7135
7186
  ] })
7136
7187
  ] }),
7137
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: imageDividerClass }),
7138
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: imageSectionTitleClass, children: "Add Text" }),
7139
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex gap-2", children: [
7140
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
7188
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: imageDividerClass }),
7189
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: imageSectionTitleClass, children: "Add Text" }),
7190
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex gap-2", children: [
7191
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
7141
7192
  "input",
7142
7193
  {
7143
7194
  type: "text",
@@ -7148,7 +7199,7 @@ var ImageEditor = ({
7148
7199
  className: "flex-1 bg-background border border-border rounded-lg px-2.5 py-1.5 text-xs text-foreground placeholder:text-muted-foreground focus:outline-none focus:border-primary"
7149
7200
  }
7150
7201
  ),
7151
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
7202
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
7152
7203
  "button",
7153
7204
  {
7154
7205
  type: "button",
@@ -7158,14 +7209,14 @@ var ImageEditor = ({
7158
7209
  }
7159
7210
  )
7160
7211
  ] }),
7161
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex items-center justify-between text-muted-foreground", children: [
7162
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { children: "Font Size:" }),
7163
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("span", { className: "font-mono", children: [
7212
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex items-center justify-between text-muted-foreground", children: [
7213
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { children: "Font Size:" }),
7214
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("span", { className: "font-mono", children: [
7164
7215
  fontSize,
7165
7216
  "px"
7166
7217
  ] })
7167
7218
  ] }),
7168
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
7219
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
7169
7220
  "input",
7170
7221
  {
7171
7222
  type: "range",
@@ -7176,14 +7227,14 @@ var ImageEditor = ({
7176
7227
  className: imageRangeClass
7177
7228
  }
7178
7229
  ),
7179
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: imageDividerClass }),
7180
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex items-center justify-between", children: [
7181
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("span", { className: "text-muted-foreground", children: [
7230
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: imageDividerClass }),
7231
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex items-center justify-between", children: [
7232
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("span", { className: "text-muted-foreground", children: [
7182
7233
  "Layers (",
7183
7234
  state.annotations.length,
7184
7235
  ")"
7185
7236
  ] }),
7186
- state.selectedAnnotationId && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
7237
+ state.selectedAnnotationId && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
7187
7238
  "button",
7188
7239
  {
7189
7240
  type: "button",
@@ -7192,7 +7243,7 @@ var ImageEditor = ({
7192
7243
  children: "Delete Selected"
7193
7244
  }
7194
7245
  ),
7195
- state.annotations.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
7246
+ state.annotations.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
7196
7247
  "button",
7197
7248
  {
7198
7249
  type: "button",
@@ -7203,10 +7254,10 @@ var ImageEditor = ({
7203
7254
  )
7204
7255
  ] })
7205
7256
  ] }),
7206
- activeTab === "depth" && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
7207
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex items-center justify-between", children: [
7208
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: imageSectionTitleClass, children: "Depth Masking" }),
7209
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
7257
+ activeTab === "depth" && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
7258
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex items-center justify-between", children: [
7259
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: imageSectionTitleClass, children: "Depth Masking" }),
7260
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
7210
7261
  "button",
7211
7262
  {
7212
7263
  type: "button",
@@ -7216,8 +7267,8 @@ var ImageEditor = ({
7216
7267
  }
7217
7268
  )
7218
7269
  ] }),
7219
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("label", { className: "flex items-center gap-2 cursor-pointer text-foreground", children: [
7220
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
7270
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("label", { className: "flex items-center gap-2 cursor-pointer text-foreground", children: [
7271
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
7221
7272
  "input",
7222
7273
  {
7223
7274
  type: "checkbox",
@@ -7226,12 +7277,12 @@ var ImageEditor = ({
7226
7277
  className: "rounded accent-primary"
7227
7278
  }
7228
7279
  ),
7229
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { children: "Enable Depth / Alpha Mask" })
7280
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { children: "Enable Depth / Alpha Mask" })
7230
7281
  ] }),
7231
- state.depthMask.enabled && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
7232
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { children: [
7233
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("label", { className: "text-muted-foreground block mb-1", children: "Mask Image URL:" }),
7234
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
7282
+ state.depthMask.enabled && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
7283
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { children: [
7284
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("label", { className: "text-muted-foreground block mb-1", children: "Mask Image URL:" }),
7285
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
7235
7286
  "input",
7236
7287
  {
7237
7288
  type: "text",
@@ -7242,8 +7293,8 @@ var ImageEditor = ({
7242
7293
  }
7243
7294
  )
7244
7295
  ] }),
7245
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex gap-2", children: [
7246
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
7296
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex gap-2", children: [
7297
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
7247
7298
  "button",
7248
7299
  {
7249
7300
  type: "button",
@@ -7252,7 +7303,7 @@ var ImageEditor = ({
7252
7303
  children: "Threshold Mode"
7253
7304
  }
7254
7305
  ),
7255
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
7306
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
7256
7307
  "button",
7257
7308
  {
7258
7309
  type: "button",
@@ -7262,12 +7313,12 @@ var ImageEditor = ({
7262
7313
  }
7263
7314
  )
7264
7315
  ] }),
7265
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { children: [
7266
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
7267
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { children: "Depth Start (Lower):" }),
7268
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "font-mono", children: state.depthMask.depthRange[0] })
7316
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { children: [
7317
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
7318
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { children: "Depth Start (Lower):" }),
7319
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "font-mono", children: state.depthMask.depthRange[0] })
7269
7320
  ] }),
7270
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
7321
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
7271
7322
  "input",
7272
7323
  {
7273
7324
  type: "range",
@@ -7281,12 +7332,12 @@ var ImageEditor = ({
7281
7332
  }
7282
7333
  )
7283
7334
  ] }),
7284
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { children: [
7285
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
7286
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { children: "Depth Stop (Upper):" }),
7287
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "font-mono", children: state.depthMask.depthRange[1] })
7335
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { children: [
7336
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
7337
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { children: "Depth Stop (Upper):" }),
7338
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "font-mono", children: state.depthMask.depthRange[1] })
7288
7339
  ] }),
7289
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
7340
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
7290
7341
  "input",
7291
7342
  {
7292
7343
  type: "range",
@@ -7300,12 +7351,12 @@ var ImageEditor = ({
7300
7351
  }
7301
7352
  )
7302
7353
  ] }),
7303
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { children: [
7304
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
7305
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { children: "Softness:" }),
7306
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "font-mono", children: state.depthMask.softness })
7354
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { children: [
7355
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
7356
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { children: "Softness:" }),
7357
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "font-mono", children: state.depthMask.softness })
7307
7358
  ] }),
7308
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
7359
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
7309
7360
  "input",
7310
7361
  {
7311
7362
  type: "range",
@@ -7317,8 +7368,8 @@ var ImageEditor = ({
7317
7368
  }
7318
7369
  )
7319
7370
  ] }),
7320
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("label", { className: "flex items-center gap-2 cursor-pointer text-foreground mt-1", children: [
7321
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
7371
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("label", { className: "flex items-center gap-2 cursor-pointer text-foreground mt-1", children: [
7372
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
7322
7373
  "input",
7323
7374
  {
7324
7375
  type: "checkbox",
@@ -7327,12 +7378,12 @@ var ImageEditor = ({
7327
7378
  className: "rounded accent-primary"
7328
7379
  }
7329
7380
  ),
7330
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { children: "Invert Mask" })
7381
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { children: "Invert Mask" })
7331
7382
  ] })
7332
7383
  ] })
7333
7384
  ] }),
7334
- activeTab === "select" && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
7335
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
7385
+ activeTab === "select" && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
7386
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
7336
7387
  SelectionOptionsBar,
7337
7388
  {
7338
7389
  controller,
@@ -7343,9 +7394,9 @@ var ImageEditor = ({
7343
7394
  selectionDisplay: state.selectionDisplay
7344
7395
  }
7345
7396
  ),
7346
- selectionError && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("p", { role: "alert", className: "text-destructive", children: selectionError }),
7347
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex gap-1", children: [
7348
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
7397
+ selectionError && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("p", { role: "alert", className: "text-destructive", children: selectionError }),
7398
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex gap-1", children: [
7399
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
7349
7400
  "button",
7350
7401
  {
7351
7402
  type: "button",
@@ -7356,7 +7407,7 @@ var ImageEditor = ({
7356
7407
  children: "Transform Selection"
7357
7408
  }
7358
7409
  ),
7359
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
7410
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
7360
7411
  "button",
7361
7412
  {
7362
7413
  type: "button",
@@ -7368,14 +7419,14 @@ var ImageEditor = ({
7368
7419
  }
7369
7420
  )
7370
7421
  ] }),
7371
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(RefineEdgePanel, { controller, selection: state.selection ?? null, layers: state.adjustments.layers }),
7372
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ChannelsPanel, { controller }),
7373
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(PathsPanel, { controller })
7422
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(RefineEdgePanel, { controller, selection: state.selection ?? null, layers: state.adjustments.layers }),
7423
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ChannelsPanel, { controller }),
7424
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(PathsPanel, { controller })
7374
7425
  ] }),
7375
- activeTab === "ai" && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
7376
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("label", { className: "flex items-center justify-between gap-2 text-foreground", children: [
7377
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { children: "Results go to" }),
7378
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
7426
+ activeTab === "ai" && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
7427
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("label", { className: "flex items-center justify-between gap-2 text-foreground", children: [
7428
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { children: "Results go to" }),
7429
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
7379
7430
  "select",
7380
7431
  {
7381
7432
  "aria-label": "AI result target",
@@ -7383,54 +7434,54 @@ var ImageEditor = ({
7383
7434
  onChange: (e) => setAiTarget(e.target.value),
7384
7435
  className: imageSelectClass,
7385
7436
  children: [
7386
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("option", { value: "auto", children: controller.isMultiLayer ? "Auto (new layer)" : "Auto (replace image)" }),
7387
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("option", { value: "new-layer", children: "New layer / mask" }),
7388
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("option", { value: "replace", children: "Replace image" })
7437
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("option", { value: "auto", children: controller.isMultiLayer ? "Auto (new layer)" : "Auto (replace image)" }),
7438
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("option", { value: "new-layer", children: "New layer / mask" }),
7439
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("option", { value: "replace", children: "Replace image" })
7389
7440
  ]
7390
7441
  }
7391
7442
  )
7392
7443
  ] }),
7393
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
7394
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex items-center justify-between", children: [
7395
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
7396
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("svg", { className: "w-3.5 h-3.5 text-primary", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("path", { d: "M6 3v12M18 9a3 3 0 1 0 0-6 3 3 0 0 0 0 6zM6 21a3 3 0 1 0 0-6 3 3 0 0 0 0 6z" }) }),
7444
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
7445
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex items-center justify-between", children: [
7446
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
7447
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("svg", { className: "w-3.5 h-3.5 text-primary", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ (0, import_jsx_runtime35.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" }) }),
7397
7448
  "Background Removal"
7398
7449
  ] }),
7399
- isRemovingBg && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium bg-primary/15 text-primary animate-pulse", children: "Removing..." })
7450
+ isRemovingBg && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium bg-primary/15 text-primary animate-pulse", children: "Removing..." })
7400
7451
  ] }),
7401
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Isolate foreground subject with AI alpha transparency segmentation." }),
7402
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
7452
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Isolate foreground subject with AI alpha transparency segmentation." }),
7453
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
7403
7454
  "button",
7404
7455
  {
7405
7456
  type: "button",
7406
7457
  onClick: handleRemoveBackground,
7407
7458
  disabled: isRemovingBg || isInpainting,
7408
7459
  className: "mt-1 px-3 py-2 rounded-lg bg-primary hover:bg-primary/90 disabled:opacity-50 text-primary-foreground font-medium shadow transition-colors flex items-center justify-center gap-2",
7409
- children: isRemovingBg ? /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
7410
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: imageSpinnerClass }),
7460
+ children: isRemovingBg ? /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
7461
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: imageSpinnerClass }),
7411
7462
  "Removing Background..."
7412
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
7413
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("path", { d: "M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83" }) }),
7463
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
7464
+ /* @__PURE__ */ (0, import_jsx_runtime35.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_runtime35.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" }) }),
7414
7465
  "Remove Background"
7415
7466
  ] })
7416
7467
  }
7417
7468
  )
7418
7469
  ] }),
7419
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
7420
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex items-center justify-between", children: [
7421
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
7422
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("svg", { className: "w-3.5 h-3.5 text-primary", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
7423
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("path", { d: "m21.64 3.64-1.28-1.28a1.2 1.2 0 0 0-1.7 0l-9.72 9.72-1.94 4.86 4.86-1.94 9.72-9.72a1.2 1.2 0 0 0 .06-1.64z" }),
7424
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("path", { d: "m14 7 3 3" })
7470
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
7471
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex items-center justify-between", children: [
7472
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
7473
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("svg", { className: "w-3.5 h-3.5 text-primary", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
7474
+ /* @__PURE__ */ (0, import_jsx_runtime35.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" }),
7475
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("path", { d: "m14 7 3 3" })
7425
7476
  ] }),
7426
7477
  "Generative Inpainting"
7427
7478
  ] }),
7428
- isInpainting && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium bg-primary/15 text-primary animate-pulse", children: "Inpainting..." })
7479
+ isInpainting && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium bg-primary/15 text-primary animate-pulse", children: "Inpainting..." })
7429
7480
  ] }),
7430
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Replace, modify, or fill selected regions using prompt-guided generative inpainting." }),
7431
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex flex-col gap-1", children: [
7432
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("label", { htmlFor: "ai-inpaint-prompt-react", className: "text-foreground text-[11px] font-medium", children: "Prompt" }),
7433
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
7481
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Replace, modify, or fill selected regions using prompt-guided generative inpainting." }),
7482
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex flex-col gap-1", children: [
7483
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("label", { htmlFor: "ai-inpaint-prompt-react", className: "text-foreground text-[11px] font-medium", children: "Prompt" }),
7484
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
7434
7485
  "textarea",
7435
7486
  {
7436
7487
  id: "ai-inpaint-prompt-react",
@@ -7442,10 +7493,10 @@ var ImageEditor = ({
7442
7493
  }
7443
7494
  )
7444
7495
  ] }),
7445
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex flex-col gap-1", children: [
7446
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "text-foreground text-[11px] font-medium", children: "Target Mask Region" }),
7447
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "grid grid-cols-2 gap-1.5", children: [
7448
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
7496
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex flex-col gap-1", children: [
7497
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "text-foreground text-[11px] font-medium", children: "Target Mask Region" }),
7498
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "grid grid-cols-2 gap-1.5", children: [
7499
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
7449
7500
  "button",
7450
7501
  {
7451
7502
  type: "button",
@@ -7458,7 +7509,7 @@ var ImageEditor = ({
7458
7509
  ]
7459
7510
  }
7460
7511
  ),
7461
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
7512
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
7462
7513
  "button",
7463
7514
  {
7464
7515
  type: "button",
@@ -7473,25 +7524,25 @@ var ImageEditor = ({
7473
7524
  )
7474
7525
  ] })
7475
7526
  ] }),
7476
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
7527
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
7477
7528
  "button",
7478
7529
  {
7479
7530
  type: "button",
7480
7531
  onClick: handleInpaint,
7481
7532
  disabled: isInpainting || isRemovingBg || !inpaintPrompt.trim(),
7482
7533
  className: "mt-1 px-3 py-2 rounded-lg bg-primary hover:bg-primary/90 disabled:opacity-50 text-primary-foreground font-medium shadow transition-colors flex items-center justify-center gap-2",
7483
- children: isInpainting ? /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
7484
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: imageSpinnerClass }),
7534
+ children: isInpainting ? /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
7535
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: imageSpinnerClass }),
7485
7536
  "Generating Inpaint..."
7486
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
7487
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("path", { d: "M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83" }) }),
7537
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
7538
+ /* @__PURE__ */ (0, import_jsx_runtime35.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_runtime35.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" }) }),
7488
7539
  "Apply Inpainting"
7489
7540
  ] })
7490
7541
  }
7491
7542
  )
7492
7543
  ] }),
7493
- aiError && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "p-2.5 rounded-lg bg-destructive/10 border border-destructive/40 text-destructive text-[11px]", children: aiError }),
7494
- aiSuccess && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "p-2.5 rounded-lg bg-emerald-500/10 border border-emerald-500/30 text-emerald-600 text-[11px]", children: aiSuccess })
7544
+ aiError && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "p-2.5 rounded-lg bg-destructive/10 border border-destructive/40 text-destructive text-[11px]", children: aiError }),
7545
+ aiSuccess && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "p-2.5 rounded-lg bg-emerald-500/10 border border-emerald-500/30 text-emerald-600 text-[11px]", children: aiSuccess })
7495
7546
  ] })
7496
7547
  ] })
7497
7548
  ] })
@@ -7521,6 +7572,7 @@ var ImageEditor = ({
7521
7572
  ImageSelect,
7522
7573
  LayerEffectsPanel,
7523
7574
  LayersPanel,
7575
+ MaskEdgeCheck,
7524
7576
  PaintGradientEditor,
7525
7577
  PathsPanel,
7526
7578
  RefineEdgePanel,