@pixerate/editor-react 0.146.0 → 0.148.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.
@@ -57,7 +57,9 @@ __export(image_editor_exports, {
57
57
  PathsPanel: () => PathsPanel,
58
58
  RefineEdgePanel: () => RefineEdgePanel,
59
59
  SelectAndMaskWorkspace: () => SelectAndMaskWorkspace,
60
+ SelectionChangeCheck: () => SelectionChangeCheck,
60
61
  SelectionOptionsBar: () => SelectionOptionsBar,
62
+ SeparateSubjectPanel: () => SeparateSubjectPanel,
61
63
  ShapeOptionsBar: () => ShapeOptionsBar,
62
64
  TypeOptionsBar: () => TypeOptionsBar,
63
65
  useImageEditor: () => useImageEditor,
@@ -236,7 +238,7 @@ function useImageEffectsTools(registry, controller, options = {}) {
236
238
  }
237
239
 
238
240
  // src/image-editor/ImageEditor.tsx
239
- var import_react36 = __toESM(require("react"), 1);
241
+ var import_react38 = __toESM(require("react"), 1);
240
242
  var import_image_editor24 = require("@pixerate/editor/image-editor");
241
243
 
242
244
  // src/image-editor/ImageEditorCanvas.tsx
@@ -5751,7 +5753,7 @@ var SelectionOptionsBar = ({
5751
5753
  };
5752
5754
 
5753
5755
  // src/image-editor/RefineEdgePanel.tsx
5754
- var import_react30 = require("react");
5756
+ var import_react32 = require("react");
5755
5757
  var import_image_editor18 = require("@pixerate/editor/image-editor");
5756
5758
 
5757
5759
  // src/image-editor/MaskEdgeCheck.tsx
@@ -5801,20 +5803,123 @@ var MaskEdgeCheck = ({ controller, selection, target = "selection", layerId, cla
5801
5803
  ] });
5802
5804
  };
5803
5805
 
5804
- // src/image-editor/RefineEdgePanel.tsx
5806
+ // src/image-editor/SelectionChangeCheck.tsx
5807
+ var import_react30 = require("react");
5805
5808
  var import_jsx_runtime30 = require("react/jsx-runtime");
5806
- var DEFAULT_PARAMS = { radius: 8, smartRadius: false, smooth: 0, feather: 0, contrast: 0, shiftEdge: 0 };
5807
5809
  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";
5808
- var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
5809
- const [params, setParams] = (0, import_react30.useState)(DEFAULT_PARAMS);
5810
- const [busy, setBusy] = (0, import_react30.useState)(false);
5810
+ var SelectionChangeCheck = ({ controller, selection, className = "" }) => {
5811
+ const sel = selection === void 0 ? controller.getSelection() : selection;
5812
+ const [result, setResult] = (0, import_react30.useState)(null);
5811
5813
  const [error, setError] = (0, import_react30.useState)(null);
5812
- const [layerId, setLayerId] = (0, import_react30.useState)("");
5813
- const [newKind, setNewKind] = (0, import_react30.useState)("hueSaturation");
5814
- const [output, setOutput] = (0, import_react30.useState)("selection");
5815
- const [decontaminate, setDecontaminate] = (0, import_react30.useState)(0);
5816
- const [objectAware, setObjectAware] = (0, import_react30.useState)(false);
5817
- const [onlyUncertain, setOnlyUncertain] = (0, import_react30.useState)(false);
5814
+ const diff = result && result.for === sel ? result.diff : null;
5815
+ const show = () => {
5816
+ setError(null);
5817
+ try {
5818
+ setResult({ diff: controller.compareSelections(), for: sel });
5819
+ } catch (err) {
5820
+ setResult(null);
5821
+ setError(err instanceof Error ? err.message : String(err));
5822
+ }
5823
+ };
5824
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { "data-testid": "selection-change-check", className: `flex flex-col gap-1 text-xs ${className}`, children: [
5825
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", className: `${button5} self-start`, onClick: show, children: "Show Last Change" }),
5826
+ diff && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { "data-testid": "selection-change-summary", className: "text-foreground", children: diff.identical ? "The last step did not change the selection." : /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
5827
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { className: "text-green-600", children: [
5828
+ "+",
5829
+ diff.added.area,
5830
+ " px"
5831
+ ] }),
5832
+ " ",
5833
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { className: "text-destructive", children: [
5834
+ "\u2212",
5835
+ diff.removed.area,
5836
+ " px"
5837
+ ] }),
5838
+ ", overlap ",
5839
+ Math.round(diff.iou * 100),
5840
+ "%"
5841
+ ] }) }),
5842
+ error && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { role: "alert", className: "text-destructive", children: error })
5843
+ ] });
5844
+ };
5845
+
5846
+ // src/image-editor/SeparateSubjectPanel.tsx
5847
+ var import_react31 = require("react");
5848
+ var import_jsx_runtime31 = require("react/jsx-runtime");
5849
+ var button6 = "px-2 py-1 rounded-md border border-border bg-background text-[11px] text-foreground hover:bg-accent hover:text-accent-foreground disabled:opacity-40";
5850
+ var SeparateSubjectPanel = ({ controller, selection, className = "" }) => {
5851
+ const sel = selection === void 0 ? controller.getSelection() : selection;
5852
+ const [dilate, setDilate] = (0, import_react31.useState)(8);
5853
+ const [fill, setFill] = (0, import_react31.useState)(true);
5854
+ const [progress, setProgress] = (0, import_react31.useState)(null);
5855
+ const [error, setError] = (0, import_react31.useState)(null);
5856
+ const abort = (0, import_react31.useRef)(null);
5857
+ const run = async () => {
5858
+ setError(null);
5859
+ abort.current = new AbortController();
5860
+ setProgress("Starting");
5861
+ try {
5862
+ await controller.separateSubject({
5863
+ dilate,
5864
+ fill: fill ? "content-aware" : "none",
5865
+ signal: abort.current.signal,
5866
+ onProgress: (fraction, stage) => setProgress(`${stage ?? "Filling"} ${Math.round(fraction * 100)}%`)
5867
+ });
5868
+ } catch (err) {
5869
+ if (!abort.current.signal.aborted) setError(err instanceof Error ? err.message : String(err));
5870
+ } finally {
5871
+ abort.current = null;
5872
+ setProgress(null);
5873
+ }
5874
+ };
5875
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { "data-testid": "separate-subject", className: `flex flex-col gap-1.5 text-xs ${className}`, children: [
5876
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px]", children: "Separate Subject" }),
5877
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("p", { className: "text-muted-foreground", children: "The selection onto its own masked layer, over the background with the subject filled out." }),
5878
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
5879
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
5880
+ "Grow",
5881
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
5882
+ "input",
5883
+ {
5884
+ type: "number",
5885
+ min: 0,
5886
+ max: 200,
5887
+ "aria-label": "Separate grow",
5888
+ value: dilate,
5889
+ onChange: (e) => setDilate(Math.min(200, Math.max(0, Number(e.target.value) || 0))),
5890
+ className: "w-12 bg-background border border-border rounded px-1 py-0.5 text-foreground"
5891
+ }
5892
+ ),
5893
+ "px"
5894
+ ] }),
5895
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "flex items-center gap-1 text-foreground", children: [
5896
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("input", { type: "checkbox", "aria-label": "Fill the background", checked: fill, onChange: (e) => setFill(e.target.checked) }),
5897
+ "Fill the background"
5898
+ ] })
5899
+ ] }),
5900
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex gap-1", children: [
5901
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("button", { type: "button", className: button6, disabled: !sel || progress !== null, onClick: run, children: "Separate Subject" }),
5902
+ progress !== null && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("button", { type: "button", className: button6, onClick: () => abort.current?.abort(), children: "Cancel" })
5903
+ ] }),
5904
+ progress !== null && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("p", { role: "status", className: "text-muted-foreground", children: progress }),
5905
+ error && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("p", { role: "alert", className: "text-destructive", children: error })
5906
+ ] });
5907
+ };
5908
+
5909
+ // src/image-editor/RefineEdgePanel.tsx
5910
+ var import_jsx_runtime32 = require("react/jsx-runtime");
5911
+ var DEFAULT_PARAMS = { radius: 8, smartRadius: false, smooth: 0, feather: 0, contrast: 0, shiftEdge: 0 };
5912
+ var button7 = "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";
5913
+ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
5914
+ const [params, setParams] = (0, import_react32.useState)(DEFAULT_PARAMS);
5915
+ const [busy, setBusy] = (0, import_react32.useState)(false);
5916
+ const [error, setError] = (0, import_react32.useState)(null);
5917
+ const [layerId, setLayerId] = (0, import_react32.useState)("");
5918
+ const [newKind, setNewKind] = (0, import_react32.useState)("hueSaturation");
5919
+ const [output, setOutput] = (0, import_react32.useState)("selection");
5920
+ const [decontaminate, setDecontaminate] = (0, import_react32.useState)(0);
5921
+ const [objectAware, setObjectAware] = (0, import_react32.useState)(false);
5922
+ const [onlyUncertain, setOnlyUncertain] = (0, import_react32.useState)(false);
5818
5923
  const canObject = Boolean(controller.segmentationProvider);
5819
5924
  const toLayer = output !== "selection" && output !== "layer-mask";
5820
5925
  const sel = selection === void 0 ? controller.getSelection() : selection;
@@ -5837,17 +5942,17 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
5837
5942
  setBusy(false);
5838
5943
  }
5839
5944
  };
5840
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { "data-testid": "refine-edge-panel", className: `flex flex-col gap-3 text-xs ${className}`, children: [
5841
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: imageSectionTitleClass, children: "Refine Edge" }),
5842
- import_image_editor18.REFINE_EDGE_CONTROLS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex flex-col gap-1", children: [
5843
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
5844
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { children: c.label }),
5845
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { className: "font-mono", children: [
5945
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { "data-testid": "refine-edge-panel", className: `flex flex-col gap-3 text-xs ${className}`, children: [
5946
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: imageSectionTitleClass, children: "Refine Edge" }),
5947
+ import_image_editor18.REFINE_EDGE_CONTROLS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { className: "flex flex-col gap-1", children: [
5948
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
5949
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { children: c.label }),
5950
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("span", { className: "font-mono", children: [
5846
5951
  params[c.id],
5847
5952
  c.unit
5848
5953
  ] })
5849
5954
  ] }),
5850
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5955
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
5851
5956
  "input",
5852
5957
  {
5853
5958
  type: "range",
@@ -5861,43 +5966,43 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
5861
5966
  }
5862
5967
  )
5863
5968
  ] }, c.id)),
5864
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
5865
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("input", { type: "checkbox", checked: params.smartRadius, onChange: (e) => setParams({ ...params, smartRadius: e.target.checked }) }),
5969
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
5970
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("input", { type: "checkbox", checked: params.smartRadius, onChange: (e) => setParams({ ...params, smartRadius: e.target.checked }) }),
5866
5971
  "Smart Radius"
5867
5972
  ] }),
5868
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-2 text-foreground", title: "Refine only where the edge has no image edge under it", children: [
5869
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("input", { type: "checkbox", "aria-label": "Only uncertain areas", checked: onlyUncertain, onChange: (e) => setOnlyUncertain(e.target.checked) }),
5973
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { className: "flex items-center gap-2 text-foreground", title: "Refine only where the edge has no image edge under it", children: [
5974
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("input", { type: "checkbox", "aria-label": "Only uncertain areas", checked: onlyUncertain, onChange: (e) => setOnlyUncertain(e.target.checked) }),
5870
5975
  "Only uncertain areas"
5871
5976
  ] }),
5872
- canObject && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
5873
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("input", { type: "checkbox", "aria-label": "Object aware", checked: objectAware, onChange: (e) => setObjectAware(e.target.checked) }),
5977
+ canObject && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
5978
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("input", { type: "checkbox", "aria-label": "Object aware", checked: objectAware, onChange: (e) => setObjectAware(e.target.checked) }),
5874
5979
  "Object aware (segmentation model)"
5875
5980
  ] }),
5876
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-2 text-muted-foreground", children: [
5981
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { className: "flex items-center gap-2 text-muted-foreground", children: [
5877
5982
  "Output to",
5878
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5983
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
5879
5984
  "select",
5880
5985
  {
5881
5986
  "aria-label": "Refine output",
5882
5987
  value: output,
5883
5988
  onChange: (e) => setOutput(e.target.value),
5884
5989
  className: "flex-1 bg-background border border-border rounded px-1 py-1 text-foreground",
5885
- children: import_image_editor18.REFINE_OUTPUTS.filter((o) => !o.needsDocuments || controller.canOpenDocuments).map((o) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("option", { value: o.id, children: o.label }, o.id))
5990
+ children: import_image_editor18.REFINE_OUTPUTS.filter((o) => !o.needsDocuments || controller.canOpenDocuments).map((o) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("option", { value: o.id, children: o.label }, o.id))
5886
5991
  }
5887
5992
  )
5888
5993
  ] }),
5889
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex flex-col gap-1", children: [
5890
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
5891
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { children: [
5994
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { className: "flex flex-col gap-1", children: [
5995
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
5996
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("span", { children: [
5892
5997
  "Decontaminate colors",
5893
5998
  toLayer ? "" : " (new layer or document outputs)"
5894
5999
  ] }),
5895
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { className: "font-mono", children: [
6000
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("span", { className: "font-mono", children: [
5896
6001
  decontaminate,
5897
6002
  "%"
5898
6003
  ] })
5899
6004
  ] }),
5900
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
6005
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
5901
6006
  "input",
5902
6007
  {
5903
6008
  type: "range",
@@ -5912,64 +6017,66 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
5912
6017
  }
5913
6018
  )
5914
6019
  ] }),
5915
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex gap-1", children: [
5916
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", className: button5, disabled: !sel || busy, onClick: refine, children: "Refine Edge" }),
5917
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", className: button5, onClick: () => setParams(DEFAULT_PARAMS), children: "Reset" })
6020
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex gap-1", children: [
6021
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("button", { type: "button", className: button7, disabled: !sel || busy, onClick: refine, children: "Refine Edge" }),
6022
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("button", { type: "button", className: button7, onClick: () => setParams(DEFAULT_PARAMS), children: "Reset" })
5918
6023
  ] }),
5919
- error && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { role: "alert", className: "text-destructive", children: error }),
5920
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(MaskEdgeCheck, { controller, selection: sel }),
5921
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] mt-2", children: "Layer Mask" }),
5922
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex gap-1 items-center", children: [
5923
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
6024
+ error && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { role: "alert", className: "text-destructive", children: error }),
6025
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(MaskEdgeCheck, { controller, selection: sel }),
6026
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(SelectionChangeCheck, { controller, selection: sel }),
6027
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(SeparateSubjectPanel, { controller, selection: sel, className: "mt-2" }),
6028
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] mt-2", children: "Layer Mask" }),
6029
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex gap-1 items-center", children: [
6030
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
5924
6031
  "select",
5925
6032
  {
5926
6033
  "aria-label": "New masked layer kind",
5927
6034
  value: newKind,
5928
6035
  onChange: (e) => setNewKind(e.target.value),
5929
6036
  className: "flex-1 bg-background border border-border rounded px-1 py-1 text-foreground",
5930
- children: import_image_editor18.ADJUSTMENT_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("option", { value: k.kind, children: k.label }, k.kind))
6037
+ children: import_image_editor18.ADJUSTMENT_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("option", { value: k.kind, children: k.label }, k.kind))
5931
6038
  }
5932
6039
  ),
5933
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
6040
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
5934
6041
  "button",
5935
6042
  {
5936
6043
  type: "button",
5937
- className: button5,
6044
+ className: button7,
5938
6045
  disabled: !sel,
5939
6046
  onClick: () => sel && setLayerId(controller.addAdjustmentLayer({ kind: newKind, mask: (0, import_image_editor18.layerMaskFromSelection)(sel) })),
5940
6047
  children: "New Masked Layer"
5941
6048
  }
5942
6049
  )
5943
6050
  ] }),
5944
- list.length > 0 && target && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex flex-col gap-2", children: [
5945
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
6051
+ list.length > 0 && target && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex flex-col gap-2", children: [
6052
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
5946
6053
  "select",
5947
6054
  {
5948
6055
  "aria-label": "Mask layer",
5949
6056
  value: target.id,
5950
6057
  onChange: (e) => setLayerId(e.target.value),
5951
6058
  className: "bg-background border border-border rounded px-1 py-1 text-foreground",
5952
- children: list.map((l) => /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("option", { value: l.id, children: [
6059
+ children: list.map((l) => /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("option", { value: l.id, children: [
5953
6060
  l.name || (0, import_image_editor18.adjustmentKindLabel)(l.kind),
5954
6061
  l.mask ? " (masked)" : ""
5955
6062
  ] }, l.id))
5956
6063
  }
5957
6064
  ),
5958
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
5959
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", className: button5, disabled: !sel, onClick: () => controller.applySelectionAsLayerMask(target.id), children: "Mask with Selection" }),
5960
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", className: button5, disabled: !target.mask, onClick: () => controller.selectionFromLayerMask(target.id), children: "Load as Selection" }),
5961
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", className: button5, disabled: !target.mask, onClick: () => controller.setAdjustmentLayerMask(target.id, null), children: "Remove Mask" })
6065
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
6066
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("button", { type: "button", className: button7, disabled: !sel, onClick: () => controller.applySelectionAsLayerMask(target.id), children: "Mask with Selection" }),
6067
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("button", { type: "button", className: button7, disabled: !target.mask, onClick: () => controller.selectionFromLayerMask(target.id), children: "Load as Selection" }),
6068
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("button", { type: "button", className: button7, disabled: !target.mask, onClick: () => controller.setAdjustmentLayerMask(target.id, null), children: "Remove Mask" })
5962
6069
  ] }),
5963
- target.mask && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
5964
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex flex-col gap-1", children: [
5965
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
5966
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { children: "Density" }),
5967
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { className: "font-mono", children: [
6070
+ target.mask && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
6071
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { className: "flex flex-col gap-1", children: [
6072
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
6073
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { children: "Density" }),
6074
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("span", { className: "font-mono", children: [
5968
6075
  Math.round((target.mask.density ?? 1) * 100),
5969
6076
  "%"
5970
6077
  ] })
5971
6078
  ] }),
5972
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
6079
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
5973
6080
  "input",
5974
6081
  {
5975
6082
  type: "range",
@@ -5983,15 +6090,15 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
5983
6090
  }
5984
6091
  )
5985
6092
  ] }),
5986
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex flex-col gap-1", children: [
5987
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
5988
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { children: "Mask Feather" }),
5989
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { className: "font-mono", children: [
6093
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { className: "flex flex-col gap-1", children: [
6094
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
6095
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { children: "Mask Feather" }),
6096
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("span", { className: "font-mono", children: [
5990
6097
  target.mask.feather ?? 0,
5991
6098
  "px"
5992
6099
  ] })
5993
6100
  ] }),
5994
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
6101
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
5995
6102
  "input",
5996
6103
  {
5997
6104
  type: "range",
@@ -6011,13 +6118,13 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
6011
6118
  };
6012
6119
 
6013
6120
  // src/image-editor/ChannelsPanel.tsx
6014
- var import_react31 = require("react");
6121
+ var import_react33 = require("react");
6015
6122
  var import_image_editor19 = require("@pixerate/editor/image-editor");
6016
- var import_jsx_runtime31 = require("react/jsx-runtime");
6123
+ var import_jsx_runtime33 = require("react/jsx-runtime");
6017
6124
  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"}`;
6018
6125
  var ChannelThumb = ({ channel, size }) => {
6019
- const ref = (0, import_react31.useRef)(null);
6020
- (0, import_react31.useEffect)(() => {
6126
+ const ref = (0, import_react33.useRef)(null);
6127
+ (0, import_react33.useEffect)(() => {
6021
6128
  const canvas = ref.current;
6022
6129
  const ctx = canvas?.getContext("2d");
6023
6130
  if (!canvas || !ctx || typeof ctx.createImageData !== "function") return;
@@ -6028,15 +6135,15 @@ var ChannelThumb = ({ channel, size }) => {
6028
6135
  img.data.set(px.data);
6029
6136
  ctx.putImageData(img, 0, 0);
6030
6137
  }, [channel.mask]);
6031
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("canvas", { ref, "aria-hidden": "true", style: { width: size, height: size }, className: "shrink-0 rounded object-contain ring-1 ring-border bg-black" });
6138
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("canvas", { ref, "aria-hidden": "true", style: { width: size, height: size }, className: "shrink-0 rounded object-contain ring-1 ring-border bg-black" });
6032
6139
  };
6033
6140
  var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
6034
- const [, setTick] = (0, import_react31.useState)(0);
6035
- (0, import_react31.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
6036
- const [activeId, setActiveId] = (0, import_react31.useState)(null);
6037
- const [renaming, setRenaming] = (0, import_react31.useState)(null);
6038
- const [error, setError] = (0, import_react31.useState)(null);
6039
- const fileInput = (0, import_react31.useRef)(null);
6141
+ const [, setTick] = (0, import_react33.useState)(0);
6142
+ (0, import_react33.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
6143
+ const [activeId, setActiveId] = (0, import_react33.useState)(null);
6144
+ const [renaming, setRenaming] = (0, import_react33.useState)(null);
6145
+ const [error, setError] = (0, import_react33.useState)(null);
6146
+ const fileInput = (0, import_react33.useRef)(null);
6040
6147
  const channels = controller.getChannels();
6041
6148
  const active = channels.find((c) => c.id === activeId) ?? null;
6042
6149
  const hasSelection = Boolean(controller.getSelection());
@@ -6058,13 +6165,13 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
6058
6165
  setError(err instanceof Error ? err.message : String(err));
6059
6166
  }
6060
6167
  };
6061
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { "data-testid": "channels-panel", className: `flex flex-col gap-2 text-xs ${className}`, children: [
6062
- /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex items-center justify-between", children: [
6063
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: imageSectionTitleClass, children: "Channels" }),
6064
- /* @__PURE__ */ (0, import_jsx_runtime31.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" })
6168
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { "data-testid": "channels-panel", className: `flex flex-col gap-2 text-xs ${className}`, children: [
6169
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex items-center justify-between", children: [
6170
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: imageSectionTitleClass, children: "Channels" }),
6171
+ /* @__PURE__ */ (0, import_jsx_runtime33.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" })
6065
6172
  ] }),
6066
- channels.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("p", { className: "text-muted-foreground", children: "No channels. Save a selection to keep it." }),
6067
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("ul", { role: "list", className: "flex flex-col gap-0.5", children: channels.map((c) => /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
6173
+ channels.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { className: "text-muted-foreground", children: "No channels. Save a selection to keep it." }),
6174
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("ul", { role: "list", className: "flex flex-col gap-0.5", children: channels.map((c) => /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
6068
6175
  "li",
6069
6176
  {
6070
6177
  "data-testid": "channel-row",
@@ -6076,7 +6183,7 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
6076
6183
  },
6077
6184
  onDoubleClick: () => setRenaming(c.id),
6078
6185
  children: [
6079
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
6186
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6080
6187
  "button",
6081
6188
  {
6082
6189
  type: "button",
@@ -6090,8 +6197,8 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
6090
6197
  children: c.visible ? "\u25CF" : "\u25CB"
6091
6198
  }
6092
6199
  ),
6093
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ChannelThumb, { channel: c, size: thumbnailSize }),
6094
- renaming === c.id ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
6200
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ChannelThumb, { channel: c, size: thumbnailSize }),
6201
+ renaming === c.id ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6095
6202
  "input",
6096
6203
  {
6097
6204
  autoFocus: true,
@@ -6108,16 +6215,16 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
6108
6215
  if (e.key === "Escape") setRenaming(null);
6109
6216
  }
6110
6217
  }
6111
- ) : /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "min-w-0 flex-1 truncate", children: c.name })
6218
+ ) : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "min-w-0 flex-1 truncate", children: c.name })
6112
6219
  ]
6113
6220
  },
6114
6221
  c.id
6115
6222
  )) }),
6116
- /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
6117
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("button", { type: "button", className: btn2(), disabled: !hasSelection, onClick: () => attempt(() => setActiveId(controller.saveSelection().id)), children: "Save Selection" }),
6118
- /* @__PURE__ */ (0, import_jsx_runtime31.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" }),
6119
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("button", { type: "button", className: btn2(), disabled: !active, onClick: () => attempt(() => setActiveId(controller.duplicateChannel(active.id).id)), children: "Duplicate" }),
6120
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
6223
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
6224
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("button", { type: "button", className: btn2(), disabled: !hasSelection, onClick: () => attempt(() => setActiveId(controller.saveSelection().id)), children: "Save Selection" }),
6225
+ /* @__PURE__ */ (0, import_jsx_runtime33.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" }),
6226
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("button", { type: "button", className: btn2(), disabled: !active, onClick: () => attempt(() => setActiveId(controller.duplicateChannel(active.id).id)), children: "Duplicate" }),
6227
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6121
6228
  "button",
6122
6229
  {
6123
6230
  type: "button",
@@ -6130,8 +6237,8 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
6130
6237
  children: "Delete"
6131
6238
  }
6132
6239
  ),
6133
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("button", { type: "button", className: btn2(), title: "Load a mask image (white = selected) into a new channel", onClick: () => fileInput.current?.click(), children: "Import\u2026" }),
6134
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
6240
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("button", { type: "button", className: btn2(), title: "Load a mask image (white = selected) into a new channel", onClick: () => fileInput.current?.click(), children: "Import\u2026" }),
6241
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6135
6242
  "button",
6136
6243
  {
6137
6244
  type: "button",
@@ -6142,7 +6249,7 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
6142
6249
  children: "Export PNG"
6143
6250
  }
6144
6251
  ),
6145
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
6252
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6146
6253
  "input",
6147
6254
  {
6148
6255
  ref: fileInput,
@@ -6157,22 +6264,22 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
6157
6264
  }
6158
6265
  )
6159
6266
  ] }),
6160
- error && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("p", { role: "alert", className: "text-destructive", children: error })
6267
+ error && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { role: "alert", className: "text-destructive", children: error })
6161
6268
  ] });
6162
6269
  };
6163
6270
 
6164
6271
  // src/image-editor/PathsPanel.tsx
6165
- var import_react32 = require("react");
6272
+ var import_react34 = require("react");
6166
6273
  var import_image_editor20 = require("@pixerate/editor/image-editor");
6167
- var import_jsx_runtime32 = require("react/jsx-runtime");
6274
+ var import_jsx_runtime34 = require("react/jsx-runtime");
6168
6275
  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"}`;
6169
6276
  var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
6170
- const [, setTick] = (0, import_react32.useState)(0);
6171
- (0, import_react32.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
6172
- const [renaming, setRenaming] = (0, import_react32.useState)(null);
6173
- const [color, setColor] = (0, import_react32.useState)("#000000");
6174
- const [width, setWidth] = (0, import_react32.useState)(2);
6175
- const [error, setError] = (0, import_react32.useState)(null);
6277
+ const [, setTick] = (0, import_react34.useState)(0);
6278
+ (0, import_react34.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
6279
+ const [renaming, setRenaming] = (0, import_react34.useState)(null);
6280
+ const [color, setColor] = (0, import_react34.useState)("#000000");
6281
+ const [width, setWidth] = (0, import_react34.useState)(2);
6282
+ const [error, setError] = (0, import_react34.useState)(null);
6176
6283
  const paths = controller.getPaths();
6177
6284
  const activeId = controller.getState().activePathId ?? null;
6178
6285
  const active = paths.find((p) => p.id === activeId) ?? null;
@@ -6188,10 +6295,10 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
6188
6295
  };
6189
6296
  return (
6190
6297
  // Clicking the panel's empty space deselects the path (the path tools then edit the active layer).
6191
- /* @__PURE__ */ (0, import_jsx_runtime32.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: [
6192
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: imageSectionTitleClass, children: "Paths" }),
6193
- paths.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { className: "text-muted-foreground", children: "No paths. Make a work path from a selection." }),
6194
- /* @__PURE__ */ (0, import_jsx_runtime32.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_runtime32.jsxs)(
6298
+ /* @__PURE__ */ (0, import_jsx_runtime34.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: [
6299
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: imageSectionTitleClass, children: "Paths" }),
6300
+ paths.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("p", { className: "text-muted-foreground", children: "No paths. Make a work path from a selection." }),
6301
+ /* @__PURE__ */ (0, import_jsx_runtime34.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_runtime34.jsxs)(
6195
6302
  "li",
6196
6303
  {
6197
6304
  "data-testid": "path-row",
@@ -6200,8 +6307,8 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
6200
6307
  onClick: () => attempt(() => controller.setActivePath(p.id)),
6201
6308
  onDoubleClick: () => setRenaming(p.id),
6202
6309
  children: [
6203
- /* @__PURE__ */ (0, import_jsx_runtime32.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_runtime32.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" }) }),
6204
- renaming === p.id ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6310
+ /* @__PURE__ */ (0, import_jsx_runtime34.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_runtime34.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" }) }),
6311
+ renaming === p.id ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6205
6312
  "input",
6206
6313
  {
6207
6314
  autoFocus: true,
@@ -6220,13 +6327,13 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
6220
6327
  if (e.key === "Escape") setRenaming(null);
6221
6328
  }
6222
6329
  }
6223
- ) : /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: `min-w-0 flex-1 truncate ${p.work ? "italic" : ""}`, children: p.name })
6330
+ ) : /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: `min-w-0 flex-1 truncate ${p.work ? "italic" : ""}`, children: p.name })
6224
6331
  ]
6225
6332
  },
6226
6333
  p.id
6227
6334
  )) }),
6228
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
6229
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6335
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
6336
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6230
6337
  "button",
6231
6338
  {
6232
6339
  type: "button",
@@ -6237,15 +6344,15 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
6237
6344
  children: "Load as Selection"
6238
6345
  }
6239
6346
  ),
6240
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("button", { type: "button", className: btn3(), disabled: !hasSelection, onClick: () => attempt(() => controller.makeWorkPath()), children: "Make Work Path" }),
6241
- active?.work && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("button", { type: "button", className: btn3(), onClick: () => setRenaming(active.id), children: "Save Path" }),
6242
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.addVectorMaskFromPath(active.id)), children: "Add Vector Mask" })
6347
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("button", { type: "button", className: btn3(), disabled: !hasSelection, onClick: () => attempt(() => controller.makeWorkPath()), children: "Make Work Path" }),
6348
+ active?.work && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("button", { type: "button", className: btn3(), onClick: () => setRenaming(active.id), children: "Save Path" }),
6349
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.addVectorMaskFromPath(active.id)), children: "Add Vector Mask" })
6243
6350
  ] }),
6244
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
6245
- /* @__PURE__ */ (0, import_jsx_runtime32.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" }),
6246
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.fillPath(active.id, { color })), children: "Fill Path" }),
6247
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
6248
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6351
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
6352
+ /* @__PURE__ */ (0, import_jsx_runtime34.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" }),
6353
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.fillPath(active.id, { color })), children: "Fill Path" }),
6354
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
6355
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6249
6356
  "input",
6250
6357
  {
6251
6358
  type: "number",
@@ -6260,25 +6367,25 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
6260
6367
  ),
6261
6368
  "px"
6262
6369
  ] }),
6263
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.strokePath(active.id, { width, color })), children: "Stroke Path" })
6370
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.strokePath(active.id, { width, color })), children: "Stroke Path" })
6264
6371
  ] }),
6265
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
6266
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.duplicatePath(active.id)), children: "Duplicate" }),
6267
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.deletePath(active.id)), children: "Delete" })
6372
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
6373
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.duplicatePath(active.id)), children: "Duplicate" }),
6374
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.deletePath(active.id)), children: "Delete" })
6268
6375
  ] }),
6269
- error && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { role: "alert", className: "text-destructive", children: error })
6376
+ error && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("p", { role: "alert", className: "text-destructive", children: error })
6270
6377
  ] })
6271
6378
  );
6272
6379
  };
6273
6380
 
6274
6381
  // src/image-editor/FreeTransformOptionsBar.tsx
6275
- var import_react33 = require("react");
6382
+ var import_react35 = require("react");
6276
6383
  var import_image_editor21 = require("@pixerate/editor/image-editor");
6277
- var import_jsx_runtime33 = require("react/jsx-runtime");
6384
+ var import_jsx_runtime35 = require("react/jsx-runtime");
6278
6385
  var round = (v, unit) => unit === "px" ? Math.round(v * 10) / 10 : Math.round(v * 100) / 100;
6279
6386
  var FreeTransformOptionsBar = ({ tool, className }) => {
6280
- const [, setTick] = (0, import_react33.useState)(0);
6281
- (0, import_react33.useEffect)(() => tool.subscribe(() => setTick((n) => n + 1)), [tool]);
6387
+ const [, setTick] = (0, import_react35.useState)(0);
6388
+ (0, import_react35.useEffect)(() => tool.subscribe(() => setTick((n) => n + 1)), [tool]);
6282
6389
  const bar = tool.bar();
6283
6390
  if (!tool.active || !bar) return null;
6284
6391
  const warp = tool.warpBar();
@@ -6290,17 +6397,17 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
6290
6397
  const v = Number(raw);
6291
6398
  if (raw.trim() !== "" && Number.isFinite(v) && Math.abs(v - bar[field]) > 1e-9) tool.setField(field, v);
6292
6399
  };
6293
- return /* @__PURE__ */ (0, import_jsx_runtime33.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: [
6294
- /* @__PURE__ */ (0, import_jsx_runtime33.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_runtime33.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)) }),
6295
- /* @__PURE__ */ (0, import_jsx_runtime33.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_runtime33.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)) }),
6296
- tool.mode === "warp" && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex flex-wrap items-center gap-2", role: "group", "aria-label": "Warp options", children: [
6297
- /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("label", { className: "flex items-center gap-1", children: [
6298
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "text-muted-foreground", children: "Warp" }),
6299
- /* @__PURE__ */ (0, import_jsx_runtime33.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_runtime33.jsx)("option", { value: o.id, children: o.label }, o.id)) })
6400
+ return /* @__PURE__ */ (0, import_jsx_runtime35.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: [
6401
+ /* @__PURE__ */ (0, import_jsx_runtime35.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_runtime35.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)) }),
6402
+ /* @__PURE__ */ (0, import_jsx_runtime35.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_runtime35.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)) }),
6403
+ tool.mode === "warp" && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex flex-wrap items-center gap-2", role: "group", "aria-label": "Warp options", children: [
6404
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("label", { className: "flex items-center gap-1", children: [
6405
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "text-muted-foreground", children: "Warp" }),
6406
+ /* @__PURE__ */ (0, import_jsx_runtime35.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_runtime35.jsx)("option", { value: o.id, children: o.label }, o.id)) })
6300
6407
  ] }),
6301
- ["bend", "horizontal", "vertical"].map((k) => /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("label", { className: "flex items-center gap-1", children: [
6302
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "text-muted-foreground", children: k === "bend" ? "Bend" : k === "horizontal" ? "H" : "V" }),
6303
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6408
+ ["bend", "horizontal", "vertical"].map((k) => /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("label", { className: "flex items-center gap-1", children: [
6409
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "text-muted-foreground", children: k === "bend" ? "Bend" : k === "horizontal" ? "H" : "V" }),
6410
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
6304
6411
  "input",
6305
6412
  {
6306
6413
  type: "number",
@@ -6321,9 +6428,9 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
6321
6428
  },
6322
6429
  `${k}:${warp[k]}`
6323
6430
  ),
6324
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "text-muted-foreground", children: "%" })
6431
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "text-muted-foreground", children: "%" })
6325
6432
  ] }, k)),
6326
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6433
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
6327
6434
  "button",
6328
6435
  {
6329
6436
  type: "button",
@@ -6335,9 +6442,9 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
6335
6442
  children: "Vertical"
6336
6443
  }
6337
6444
  ),
6338
- /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("label", { className: "flex items-center gap-1", children: [
6339
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "text-muted-foreground", children: "Grid" }),
6340
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6445
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("label", { className: "flex items-center gap-1", children: [
6446
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "text-muted-foreground", children: "Grid" }),
6447
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
6341
6448
  "select",
6342
6449
  {
6343
6450
  "aria-label": "Warp grid",
@@ -6347,14 +6454,14 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
6347
6454
  tool.setWarp({ columns: g.columns, rows: g.rows });
6348
6455
  },
6349
6456
  className: imageFieldClass,
6350
- children: import_image_editor21.WARP_GRID_OPTIONS.map((g) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("option", { value: g.id, children: g.label }, g.id))
6457
+ children: import_image_editor21.WARP_GRID_OPTIONS.map((g) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("option", { value: g.id, children: g.label }, g.id))
6351
6458
  }
6352
6459
  )
6353
6460
  ] })
6354
6461
  ] }),
6355
- tool.mode !== "warp" && import_image_editor21.FREE_TRANSFORM_FIELDS.map((f) => /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("label", { className: "flex items-center gap-1", title: f.title, children: [
6356
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "text-muted-foreground", children: f.label }),
6357
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6462
+ tool.mode !== "warp" && import_image_editor21.FREE_TRANSFORM_FIELDS.map((f) => /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("label", { className: "flex items-center gap-1", title: f.title, children: [
6463
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "text-muted-foreground", children: f.label }),
6464
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
6358
6465
  "input",
6359
6466
  {
6360
6467
  type: "number",
@@ -6374,8 +6481,8 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
6374
6481
  },
6375
6482
  `${f.id}:${round(bar[f.id], f.unit)}`
6376
6483
  ),
6377
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "text-muted-foreground", children: f.unit }),
6378
- f.id === "scaleX" && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6484
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "text-muted-foreground", children: f.unit }),
6485
+ f.id === "scaleX" && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
6379
6486
  "button",
6380
6487
  {
6381
6488
  type: "button",
@@ -6390,33 +6497,33 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
6390
6497
  }
6391
6498
  )
6392
6499
  ] }, f.id)),
6393
- /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("label", { className: "flex items-center gap-1", children: [
6394
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "text-muted-foreground", children: "Interpolation" }),
6395
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6500
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("label", { className: "flex items-center gap-1", children: [
6501
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "text-muted-foreground", children: "Interpolation" }),
6502
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
6396
6503
  "select",
6397
6504
  {
6398
6505
  "aria-label": "Interpolation",
6399
6506
  value: tool.interpolation,
6400
6507
  onChange: (e) => tool.setInterpolation(e.target.value),
6401
6508
  className: imageFieldClass,
6402
- children: import_image_editor21.INTERPOLATIONS.map((i) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("option", { value: i, children: i[0].toUpperCase() + i.slice(1) }, i))
6509
+ children: import_image_editor21.INTERPOLATIONS.map((i) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("option", { value: i, children: i[0].toUpperCase() + i.slice(1) }, i))
6403
6510
  }
6404
6511
  )
6405
6512
  ] }),
6406
- /* @__PURE__ */ (0, import_jsx_runtime33.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" }),
6407
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("button", { type: "button", title: "Cancel (Esc)", className: imageChipClass(false), onClick: () => tool.cancel(), children: "Cancel" }),
6408
- tool.error && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { role: "alert", className: "text-destructive", children: tool.error })
6513
+ /* @__PURE__ */ (0, import_jsx_runtime35.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" }),
6514
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("button", { type: "button", title: "Cancel (Esc)", className: imageChipClass(false), onClick: () => tool.cancel(), children: "Cancel" }),
6515
+ tool.error && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { role: "alert", className: "text-destructive", children: tool.error })
6409
6516
  ] });
6410
6517
  };
6411
6518
 
6412
6519
  // src/image-editor/ShapeOptionsBar.tsx
6413
- var import_react34 = require("react");
6520
+ var import_react36 = require("react");
6414
6521
  var import_image_editor22 = require("@pixerate/editor/image-editor");
6415
- var import_jsx_runtime34 = require("react/jsx-runtime");
6522
+ var import_jsx_runtime36 = require("react/jsx-runtime");
6416
6523
  var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
6417
- const [, setTick] = (0, import_react34.useState)(0);
6418
- (0, import_react34.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
6419
- const [error, setError] = (0, import_react34.useState)(null);
6524
+ const [, setTick] = (0, import_react36.useState)(0);
6525
+ (0, import_react36.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
6526
+ const [error, setError] = (0, import_react36.useState)(null);
6420
6527
  const active = controller.getActiveLayer();
6421
6528
  const shapeId = active?.type === "shape" ? active.id : null;
6422
6529
  const set = (change) => {
@@ -6430,22 +6537,22 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
6430
6537
  }
6431
6538
  };
6432
6539
  const num = (v, min, max) => Math.max(min, Math.min(max, Number(v) || min));
6433
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "shape-options", children: [
6434
- /* @__PURE__ */ (0, import_jsx_runtime34.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_runtime34.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)) }),
6435
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
6436
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("label", { className: "flex items-center gap-1", children: [
6437
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ImageCheckbox, { label: "Fill", checked: options.fill !== null, onChange: (on) => set({ fill: on ? "#4f46e5" : null }) }),
6540
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "shape-options", children: [
6541
+ /* @__PURE__ */ (0, import_jsx_runtime36.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_runtime36.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)) }),
6542
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
6543
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("label", { className: "flex items-center gap-1", children: [
6544
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ImageCheckbox, { label: "Fill", checked: options.fill !== null, onChange: (on) => set({ fill: on ? "#4f46e5" : null }) }),
6438
6545
  "Fill",
6439
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ImageColor, { label: "Fill colour", disabled: options.fill === null, value: options.fill ?? "#4f46e5", onChange: (fill) => set({ fill }) })
6546
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ImageColor, { label: "Fill colour", disabled: options.fill === null, value: options.fill ?? "#4f46e5", onChange: (fill) => set({ fill }) })
6440
6547
  ] }),
6441
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("label", { className: "flex items-center gap-1", children: [
6442
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ImageCheckbox, { label: "Stroke", checked: options.stroke !== null, onChange: (on) => set({ stroke: on ? "#000000" : null }) }),
6548
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("label", { className: "flex items-center gap-1", children: [
6549
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ImageCheckbox, { label: "Stroke", checked: options.stroke !== null, onChange: (on) => set({ stroke: on ? "#000000" : null }) }),
6443
6550
  "Stroke",
6444
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ImageColor, { label: "Stroke colour", disabled: options.stroke === null, value: options.stroke ?? "#000000", onChange: (stroke) => set({ stroke }) })
6551
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ImageColor, { label: "Stroke colour", disabled: options.stroke === null, value: options.stroke ?? "#000000", onChange: (stroke) => set({ stroke }) })
6445
6552
  ] }),
6446
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("label", { className: "flex items-center gap-1", children: [
6553
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("label", { className: "flex items-center gap-1", children: [
6447
6554
  "Width",
6448
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6555
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
6449
6556
  "input",
6450
6557
  {
6451
6558
  type: "number",
@@ -6459,52 +6566,52 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
6459
6566
  )
6460
6567
  ] })
6461
6568
  ] }),
6462
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
6463
- options.kind === "rect" && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("label", { className: "flex items-center gap-1", children: [
6569
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
6570
+ options.kind === "rect" && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("label", { className: "flex items-center gap-1", children: [
6464
6571
  "Radius",
6465
- /* @__PURE__ */ (0, import_jsx_runtime34.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}` })
6572
+ /* @__PURE__ */ (0, import_jsx_runtime36.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}` })
6466
6573
  ] }),
6467
- options.kind === "polygon" && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("label", { className: "flex items-center gap-1", children: [
6574
+ options.kind === "polygon" && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("label", { className: "flex items-center gap-1", children: [
6468
6575
  "Sides",
6469
- /* @__PURE__ */ (0, import_jsx_runtime34.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}` })
6576
+ /* @__PURE__ */ (0, import_jsx_runtime36.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}` })
6470
6577
  ] }),
6471
- options.kind === "star" && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
6472
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("label", { className: "flex items-center gap-1", children: [
6578
+ options.kind === "star" && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
6579
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("label", { className: "flex items-center gap-1", children: [
6473
6580
  "Points",
6474
- /* @__PURE__ */ (0, import_jsx_runtime34.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}` })
6581
+ /* @__PURE__ */ (0, import_jsx_runtime36.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}` })
6475
6582
  ] }),
6476
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("label", { className: "flex items-center gap-1", children: [
6583
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("label", { className: "flex items-center gap-1", children: [
6477
6584
  "Inner",
6478
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ImageRange, { label: "Inner radius", min: 0.05, max: 1, step: 0.05, value: options.innerRatio, onChange: (v) => set({ innerRatio: v }) })
6585
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ImageRange, { label: "Inner radius", min: 0.05, max: 1, step: 0.05, value: options.innerRatio, onChange: (v) => set({ innerRatio: v }) })
6479
6586
  ] })
6480
6587
  ] }),
6481
- options.kind === "line" && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
6482
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("label", { className: "flex items-center gap-1", children: [
6588
+ options.kind === "line" && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
6589
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("label", { className: "flex items-center gap-1", children: [
6483
6590
  "Weight",
6484
- /* @__PURE__ */ (0, import_jsx_runtime34.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}` })
6591
+ /* @__PURE__ */ (0, import_jsx_runtime36.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}` })
6485
6592
  ] }),
6486
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("label", { className: "flex items-center gap-1", children: [
6487
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ImageCheckbox, { label: "Arrowhead", checked: options.arrow, onChange: (on) => set({ arrow: on }) }),
6593
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("label", { className: "flex items-center gap-1", children: [
6594
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ImageCheckbox, { label: "Arrowhead", checked: options.arrow, onChange: (on) => set({ arrow: on }) }),
6488
6595
  "Arrowhead"
6489
6596
  ] })
6490
6597
  ] })
6491
6598
  ] }),
6492
- /* @__PURE__ */ (0, import_jsx_runtime34.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." }),
6493
- error && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("p", { role: "alert", className: "text-destructive", children: error })
6599
+ /* @__PURE__ */ (0, import_jsx_runtime36.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." }),
6600
+ error && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { role: "alert", className: "text-destructive", children: error })
6494
6601
  ] });
6495
6602
  };
6496
6603
 
6497
6604
  // src/image-editor/TypeOptionsBar.tsx
6498
- var import_react35 = require("react");
6605
+ var import_react37 = require("react");
6499
6606
  var import_image_editor23 = require("@pixerate/editor/image-editor");
6500
- var import_jsx_runtime35 = require("react/jsx-runtime");
6607
+ var import_jsx_runtime37 = require("react/jsx-runtime");
6501
6608
  var ALIGN_LABELS = { left: "Left", center: "Centre", right: "Right", justify: "Justify" };
6502
6609
  var ORIENTATION_LABELS = { horizontal: "Horizontal", vertical: "Vertical" };
6503
6610
  var TypeOptionsBar = ({ controller, options, onChange, session, className }) => {
6504
- const [, setTick] = (0, import_react35.useState)(0);
6505
- (0, import_react35.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
6506
- (0, import_react35.useEffect)(() => session?.subscribe(() => setTick((n) => n + 1)), [session]);
6507
- const [error, setError] = (0, import_react35.useState)(null);
6611
+ const [, setTick] = (0, import_react37.useState)(0);
6612
+ (0, import_react37.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
6613
+ (0, import_react37.useEffect)(() => session?.subscribe(() => setTick((n) => n + 1)), [session]);
6614
+ const [error, setError] = (0, import_react37.useState)(null);
6508
6615
  const active = controller.getActiveLayer();
6509
6616
  const typeId = !session && active?.type === "type" ? active.id : null;
6510
6617
  const here = session?.alive ? session.styleHere() : {};
@@ -6557,11 +6664,11 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
6557
6664
  setError(e instanceof Error ? e.message : String(e));
6558
6665
  }
6559
6666
  };
6560
- return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "type-options", children: [
6561
- /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
6562
- /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("label", { className: "flex items-center gap-1", children: [
6667
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "type-options", children: [
6668
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
6669
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("label", { className: "flex items-center gap-1", children: [
6563
6670
  "Font",
6564
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
6671
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
6565
6672
  "input",
6566
6673
  {
6567
6674
  list: "pixerate-type-fonts",
@@ -6571,11 +6678,11 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
6571
6678
  className: "w-32 rounded border border-border bg-background px-1 py-0.5"
6572
6679
  }
6573
6680
  ),
6574
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("datalist", { id: "pixerate-type-fonts", children: fonts.map((f) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("option", { value: f }, f)) })
6681
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("datalist", { id: "pixerate-type-fonts", children: fonts.map((f) => /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("option", { value: f }, f)) })
6575
6682
  ] }),
6576
- /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("label", { className: "flex items-center gap-1", children: [
6683
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("label", { className: "flex items-center gap-1", children: [
6577
6684
  "Size",
6578
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
6685
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
6579
6686
  "input",
6580
6687
  {
6581
6688
  type: "number",
@@ -6588,14 +6695,14 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
6588
6695
  }
6589
6696
  )
6590
6697
  ] }),
6591
- /* @__PURE__ */ (0, import_jsx_runtime35.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" }),
6592
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("button", { type: "button", "aria-pressed": shown.italic, className: `${imageChipClass(shown.italic)} italic`, onClick: () => style({ italic: !shown.italic }), children: "I" }),
6593
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ImageColor, { label: "Text colour", value: shown.color, onChange: (color) => style({ color }) })
6698
+ /* @__PURE__ */ (0, import_jsx_runtime37.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" }),
6699
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("button", { type: "button", "aria-pressed": shown.italic, className: `${imageChipClass(shown.italic)} italic`, onClick: () => style({ italic: !shown.italic }), children: "I" }),
6700
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(ImageColor, { label: "Text colour", value: shown.color, onChange: (color) => style({ color }) })
6594
6701
  ] }),
6595
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Alignment", children: import_image_editor23.TEXT_ALIGNS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("button", { type: "button", "aria-pressed": options.align === a, className: imageChipClass(options.align === a), onClick: () => style({ align: a }), children: ALIGN_LABELS[a] }, a)) }),
6596
- /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Orientation", children: [
6597
- import_image_editor23.TEXT_ORIENTATIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("button", { type: "button", "aria-pressed": orientation === o, className: imageChipClass(orientation === o), onClick: () => orient(o), children: ORIENTATION_LABELS[o] }, o)),
6598
- orientation === "vertical" && editedId && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
6702
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Alignment", children: import_image_editor23.TEXT_ALIGNS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("button", { type: "button", "aria-pressed": options.align === a, className: imageChipClass(options.align === a), onClick: () => style({ align: a }), children: ALIGN_LABELS[a] }, a)) }),
6703
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Orientation", children: [
6704
+ import_image_editor23.TEXT_ORIENTATIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("button", { type: "button", "aria-pressed": orientation === o, className: imageChipClass(orientation === o), onClick: () => orient(o), children: ORIENTATION_LABELS[o] }, o)),
6705
+ orientation === "vertical" && editedId && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
6599
6706
  "button",
6600
6707
  {
6601
6708
  type: "button",
@@ -6607,19 +6714,19 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
6607
6714
  }
6608
6715
  )
6609
6716
  ] }),
6610
- /* @__PURE__ */ (0, import_jsx_runtime35.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." }),
6611
- missing.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("p", { role: "status", className: "text-amber-600", "data-testid": "type-missing-fonts", children: [
6717
+ /* @__PURE__ */ (0, import_jsx_runtime37.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." }),
6718
+ missing.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("p", { role: "status", className: "text-amber-600", "data-testid": "type-missing-fonts", children: [
6612
6719
  "Missing ",
6613
6720
  missing.length === 1 ? "font" : "fonts",
6614
6721
  ": ",
6615
6722
  missing.join(", ")
6616
6723
  ] }),
6617
- error && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("p", { role: "alert", className: "text-destructive", children: error })
6724
+ error && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("p", { role: "alert", className: "text-destructive", children: error })
6618
6725
  ] });
6619
6726
  };
6620
6727
 
6621
6728
  // src/image-editor/ImageEditor.tsx
6622
- var import_jsx_runtime36 = require("react/jsx-runtime");
6729
+ var import_jsx_runtime38 = require("react/jsx-runtime");
6623
6730
  var ImageEditor = ({
6624
6731
  editor: externalEditor,
6625
6732
  src,
@@ -6644,32 +6751,32 @@ var ImageEditor = ({
6644
6751
  return l.type === "pixel" && !!l.generator || l.type === "smart" && !!l.smartFilters?.filters.some((f) => f.kind === "effect") || l.type === "group" && l.children.some(has);
6645
6752
  });
6646
6753
  const legacyProcess = (0, import_image_editor24.normalizeProcessVersion)(state.adjustments.process) < import_image_editor24.LATEST_PROCESS_VERSION;
6647
- const [activeTab, setActiveTab] = (0, import_react36.useState)("crop");
6648
- const rootRef = (0, import_react36.useRef)(null);
6754
+ const [activeTab, setActiveTab] = (0, import_react38.useState)("crop");
6755
+ const rootRef = (0, import_react38.useRef)(null);
6649
6756
  const canvasMode = activeTab === "crop" || activeTab === "select" || activeTab === "paint" || activeTab === "annotate" ? activeTab : "none";
6650
- const activeTabRef = (0, import_react36.useRef)(activeTab);
6757
+ const activeTabRef = (0, import_react38.useRef)(activeTab);
6651
6758
  activeTabRef.current = activeTab;
6652
6759
  const openPanel = async (ref) => {
6653
6760
  if (ref.kind !== "panel" || activeTabRef.current === ref.id) return;
6654
6761
  rootRef.current?.querySelector(`[data-image-tab="${CSS.escape(ref.id)}"]`)?.click();
6655
6762
  await new Promise((resolve) => setTimeout(resolve, 60));
6656
6763
  };
6657
- const [activeCropRatio, setActiveCropRatio] = (0, import_react36.useState)(null);
6658
- const [selectionOptions, setSelectionOptions] = (0, import_react36.useState)(import_image_editor24.DEFAULT_SELECTION_TOOL_OPTIONS);
6659
- const [shapeOptions, setShapeOptions] = (0, import_react36.useState)(import_image_editor24.DEFAULT_SHAPE_TOOL_OPTIONS);
6660
- const [typeOptions, setTypeOptions] = (0, import_react36.useState)(import_image_editor24.DEFAULT_TYPE_TOOL_OPTIONS);
6661
- const [typeSession, setTypeSession] = (0, import_react36.useState)(null);
6662
- const [selectionError, setSelectionError] = (0, import_react36.useState)(null);
6663
- const [paintError, setPaintError] = (0, import_react36.useState)(null);
6664
- const [shapeTypeError, setShapeTypeError] = (0, import_react36.useState)(null);
6764
+ const [activeCropRatio, setActiveCropRatio] = (0, import_react38.useState)(null);
6765
+ const [selectionOptions, setSelectionOptions] = (0, import_react38.useState)(import_image_editor24.DEFAULT_SELECTION_TOOL_OPTIONS);
6766
+ const [shapeOptions, setShapeOptions] = (0, import_react38.useState)(import_image_editor24.DEFAULT_SHAPE_TOOL_OPTIONS);
6767
+ const [typeOptions, setTypeOptions] = (0, import_react38.useState)(import_image_editor24.DEFAULT_TYPE_TOOL_OPTIONS);
6768
+ const [typeSession, setTypeSession] = (0, import_react38.useState)(null);
6769
+ const [selectionError, setSelectionError] = (0, import_react38.useState)(null);
6770
+ const [paintError, setPaintError] = (0, import_react38.useState)(null);
6771
+ const [shapeTypeError, setShapeTypeError] = (0, import_react38.useState)(null);
6665
6772
  const handleCanvasError = (source, message) => {
6666
6773
  if (source === "paint") setPaintError(message);
6667
6774
  else if (source === "select") setSelectionError(message);
6668
6775
  else setShapeTypeError(message);
6669
6776
  };
6670
6777
  const finishTyping = () => setTypeSession(null);
6671
- const transformToolRef = (0, import_react36.useRef)(null);
6672
- const transformControllerRef = (0, import_react36.useRef)(controller);
6778
+ const transformToolRef = (0, import_react38.useRef)(null);
6779
+ const transformControllerRef = (0, import_react38.useRef)(controller);
6673
6780
  if (!transformToolRef.current || transformControllerRef.current !== controller) {
6674
6781
  transformToolRef.current?.cancel();
6675
6782
  transformToolRef.current = new import_image_editor24.FreeTransformTool(controller, {
@@ -6678,16 +6785,16 @@ var ImageEditor = ({
6678
6785
  transformControllerRef.current = controller;
6679
6786
  }
6680
6787
  const transformTool = transformToolRef.current;
6681
- const [, setTransformTick] = (0, import_react36.useState)(0);
6682
- (0, import_react36.useEffect)(() => transformTool.subscribe(() => setTransformTick((n) => n + 1)), [transformTool]);
6683
- (0, import_react36.useEffect)(() => () => transformToolRef.current?.cancel(), []);
6684
- const [inpaintPrompt, setInpaintPrompt] = (0, import_react36.useState)("");
6685
- const [inpaintMaskMode, setInpaintMaskMode] = (0, import_react36.useState)("annotations");
6686
- const [isRemovingBg, setIsRemovingBg] = (0, import_react36.useState)(false);
6687
- const [isInpainting, setIsInpainting] = (0, import_react36.useState)(false);
6688
- const [aiError, setAiError] = (0, import_react36.useState)(null);
6689
- const [aiSuccess, setAiSuccess] = (0, import_react36.useState)(null);
6690
- const [aiTarget, setAiTarget] = (0, import_react36.useState)("auto");
6788
+ const [, setTransformTick] = (0, import_react38.useState)(0);
6789
+ (0, import_react38.useEffect)(() => transformTool.subscribe(() => setTransformTick((n) => n + 1)), [transformTool]);
6790
+ (0, import_react38.useEffect)(() => () => transformToolRef.current?.cancel(), []);
6791
+ const [inpaintPrompt, setInpaintPrompt] = (0, import_react38.useState)("");
6792
+ const [inpaintMaskMode, setInpaintMaskMode] = (0, import_react38.useState)("annotations");
6793
+ const [isRemovingBg, setIsRemovingBg] = (0, import_react38.useState)(false);
6794
+ const [isInpainting, setIsInpainting] = (0, import_react38.useState)(false);
6795
+ const [aiError, setAiError] = (0, import_react38.useState)(null);
6796
+ const [aiSuccess, setAiSuccess] = (0, import_react38.useState)(null);
6797
+ const [aiTarget, setAiTarget] = (0, import_react38.useState)("auto");
6691
6798
  const aiOptions = aiTarget === "auto" ? {} : { target: aiTarget };
6692
6799
  const effectiveOnInpaint = onInpaint || aiHooks?.onInpaint;
6693
6800
  const effectiveOnRemoveBg = onRemoveBackground || aiHooks?.onRemoveBackground;
@@ -6750,11 +6857,11 @@ var ImageEditor = ({
6750
6857
  setIsInpainting(false);
6751
6858
  }
6752
6859
  };
6753
- const [activeColor, setActiveColor] = (0, import_react36.useState)("#ef4444");
6754
- const [strokeWidth, setStrokeWidth] = (0, import_react36.useState)(3);
6755
- const [fontSize, setFontSize] = (0, import_react36.useState)(24);
6756
- const [textInput, setTextInput] = (0, import_react36.useState)("");
6757
- (0, import_react36.useEffect)(() => {
6860
+ const [activeColor, setActiveColor] = (0, import_react38.useState)("#ef4444");
6861
+ const [strokeWidth, setStrokeWidth] = (0, import_react38.useState)(3);
6862
+ const [fontSize, setFontSize] = (0, import_react38.useState)(24);
6863
+ const [textInput, setTextInput] = (0, import_react38.useState)("");
6864
+ (0, import_react38.useEffect)(() => {
6758
6865
  if (activeTab === "crop" && editor.state.activeTool !== "crop") {
6759
6866
  editor.setTool("crop");
6760
6867
  }
@@ -6782,16 +6889,16 @@ var ImageEditor = ({
6782
6889
  link.click();
6783
6890
  }
6784
6891
  };
6785
- return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
6892
+ return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
6786
6893
  "div",
6787
6894
  {
6788
6895
  ref: rootRef,
6789
6896
  className: `${imageEditorFrameClass} ${className}`,
6790
6897
  style,
6791
6898
  children: [
6792
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: imageEditorHeaderClass, children: [
6793
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { role: "tablist", className: imageTabListClass, children: [
6794
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
6899
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: imageEditorHeaderClass, children: [
6900
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { role: "tablist", className: imageTabListClass, children: [
6901
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
6795
6902
  "button",
6796
6903
  {
6797
6904
  type: "button",
@@ -6806,7 +6913,7 @@ var ImageEditor = ({
6806
6913
  children: "Transform & Crop"
6807
6914
  }
6808
6915
  ),
6809
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
6916
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
6810
6917
  "button",
6811
6918
  {
6812
6919
  type: "button",
@@ -6821,7 +6928,7 @@ var ImageEditor = ({
6821
6928
  children: "Adjustments"
6822
6929
  }
6823
6930
  ),
6824
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
6931
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
6825
6932
  "button",
6826
6933
  {
6827
6934
  type: "button",
@@ -6836,7 +6943,7 @@ var ImageEditor = ({
6836
6943
  children: "Layers"
6837
6944
  }
6838
6945
  ),
6839
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
6946
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
6840
6947
  "button",
6841
6948
  {
6842
6949
  type: "button",
@@ -6851,7 +6958,7 @@ var ImageEditor = ({
6851
6958
  children: "Paint"
6852
6959
  }
6853
6960
  ),
6854
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
6961
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
6855
6962
  "button",
6856
6963
  {
6857
6964
  type: "button",
@@ -6866,7 +6973,7 @@ var ImageEditor = ({
6866
6973
  children: "Select & Mask"
6867
6974
  }
6868
6975
  ),
6869
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
6976
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
6870
6977
  "button",
6871
6978
  {
6872
6979
  type: "button",
@@ -6881,7 +6988,7 @@ var ImageEditor = ({
6881
6988
  children: "Annotations"
6882
6989
  }
6883
6990
  ),
6884
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
6991
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
6885
6992
  "button",
6886
6993
  {
6887
6994
  type: "button",
@@ -6896,7 +7003,7 @@ var ImageEditor = ({
6896
7003
  children: "Depth Mask"
6897
7004
  }
6898
7005
  ),
6899
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
7006
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
6900
7007
  "button",
6901
7008
  {
6902
7009
  type: "button",
@@ -6909,14 +7016,14 @@ var ImageEditor = ({
6909
7016
  "aria-selected": activeTab === "ai",
6910
7017
  className: `${imageTabClass(activeTab === "ai")} flex items-center gap-1.5`,
6911
7018
  children: [
6912
- /* @__PURE__ */ (0, import_jsx_runtime36.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_runtime36.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" }) }),
7019
+ /* @__PURE__ */ (0, import_jsx_runtime38.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_runtime38.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" }) }),
6913
7020
  "AI Tools"
6914
7021
  ]
6915
7022
  }
6916
7023
  )
6917
7024
  ] }),
6918
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex items-center gap-2 text-xs", children: [
6919
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7025
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex items-center gap-2 text-xs", children: [
7026
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
6920
7027
  "button",
6921
7028
  {
6922
7029
  type: "button",
@@ -6927,7 +7034,7 @@ var ImageEditor = ({
6927
7034
  children: "\u21A9"
6928
7035
  }
6929
7036
  ),
6930
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7037
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
6931
7038
  "button",
6932
7039
  {
6933
7040
  type: "button",
@@ -6938,7 +7045,7 @@ var ImageEditor = ({
6938
7045
  children: "\u21AA"
6939
7046
  }
6940
7047
  ),
6941
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7048
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
6942
7049
  "button",
6943
7050
  {
6944
7051
  type: "button",
@@ -6947,8 +7054,8 @@ var ImageEditor = ({
6947
7054
  children: "Reset"
6948
7055
  }
6949
7056
  ),
6950
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "h-4 w-px bg-muted mx-1" }),
6951
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7057
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "h-4 w-px bg-muted mx-1" }),
7058
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
6952
7059
  "button",
6953
7060
  {
6954
7061
  type: "button",
@@ -6958,11 +7065,11 @@ var ImageEditor = ({
6958
7065
  children: "-"
6959
7066
  }
6960
7067
  ),
6961
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("span", { className: "font-mono text-muted-foreground w-10 text-center", children: [
7068
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("span", { className: "font-mono text-muted-foreground w-10 text-center", children: [
6962
7069
  Math.round(state.zoom * 100),
6963
7070
  "%"
6964
7071
  ] }),
6965
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7072
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
6966
7073
  "button",
6967
7074
  {
6968
7075
  type: "button",
@@ -6972,8 +7079,8 @@ var ImageEditor = ({
6972
7079
  children: "+"
6973
7080
  }
6974
7081
  ),
6975
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "h-4 w-px bg-muted mx-1" }),
6976
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7082
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "h-4 w-px bg-muted mx-1" }),
7083
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
6977
7084
  "button",
6978
7085
  {
6979
7086
  type: "button",
@@ -6984,7 +7091,7 @@ var ImageEditor = ({
6984
7091
  children: "Hold Compare"
6985
7092
  }
6986
7093
  ),
6987
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7094
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
6988
7095
  "button",
6989
7096
  {
6990
7097
  type: "button",
@@ -6995,10 +7102,10 @@ var ImageEditor = ({
6995
7102
  )
6996
7103
  ] })
6997
7104
  ] }),
6998
- transformTool.active && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(FreeTransformOptionsBar, { tool: transformTool, className: "border-b border-border bg-background/95 px-4 py-2" }),
6999
- !transformTool.active && transformTool.error && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { role: "alert", className: imageErrorBannerClass, children: transformTool.error }),
7000
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex flex-col md:flex-row flex-1 min-h-[520px] md:h-[560px]", children: [
7001
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7105
+ transformTool.active && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(FreeTransformOptionsBar, { tool: transformTool, className: "border-b border-border bg-background/95 px-4 py-2" }),
7106
+ !transformTool.active && transformTool.error && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { role: "alert", className: imageErrorBannerClass, children: transformTool.error }),
7107
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex flex-col md:flex-row flex-1 min-h-[520px] md:h-[560px]", children: [
7108
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
7002
7109
  ImageEditorCanvas,
7003
7110
  {
7004
7111
  editor,
@@ -7022,11 +7129,11 @@ var ImageEditor = ({
7022
7129
  className: "flex-1 h-[360px] md:h-full min-h-[320px] bg-muted"
7023
7130
  }
7024
7131
  ),
7025
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: imageSidebarClass, children: [
7026
- activeTab === "crop" && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
7027
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: imageSectionTitleClass, children: "Aspect Ratio Presets" }),
7028
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "grid grid-cols-3 gap-2", children: [
7029
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7132
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: imageSidebarClass, children: [
7133
+ activeTab === "crop" && /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
7134
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: imageSectionTitleClass, children: "Aspect Ratio Presets" }),
7135
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "grid grid-cols-3 gap-2", children: [
7136
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
7030
7137
  "button",
7031
7138
  {
7032
7139
  type: "button",
@@ -7038,7 +7145,7 @@ var ImageEditor = ({
7038
7145
  children: "Freeform"
7039
7146
  }
7040
7147
  ),
7041
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7148
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
7042
7149
  "button",
7043
7150
  {
7044
7151
  type: "button",
@@ -7050,7 +7157,7 @@ var ImageEditor = ({
7050
7157
  children: "1:1 Square"
7051
7158
  }
7052
7159
  ),
7053
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7160
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
7054
7161
  "button",
7055
7162
  {
7056
7163
  type: "button",
@@ -7062,7 +7169,7 @@ var ImageEditor = ({
7062
7169
  children: "4:3 Standard"
7063
7170
  }
7064
7171
  ),
7065
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7172
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
7066
7173
  "button",
7067
7174
  {
7068
7175
  type: "button",
@@ -7074,7 +7181,7 @@ var ImageEditor = ({
7074
7181
  children: "16:9 Wide"
7075
7182
  }
7076
7183
  ),
7077
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7184
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
7078
7185
  "button",
7079
7186
  {
7080
7187
  type: "button",
@@ -7086,7 +7193,7 @@ var ImageEditor = ({
7086
7193
  children: "3:2 Photo"
7087
7194
  }
7088
7195
  ),
7089
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7196
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
7090
7197
  "button",
7091
7198
  {
7092
7199
  type: "button",
@@ -7099,10 +7206,10 @@ var ImageEditor = ({
7099
7206
  }
7100
7207
  )
7101
7208
  ] }),
7102
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: imageDividerClass }),
7103
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: imageSectionTitleClass, children: "Orientation & Flips" }),
7104
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "grid grid-cols-2 gap-2", children: [
7105
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7209
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: imageDividerClass }),
7210
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: imageSectionTitleClass, children: "Orientation & Flips" }),
7211
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "grid grid-cols-2 gap-2", children: [
7212
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
7106
7213
  "button",
7107
7214
  {
7108
7215
  type: "button",
@@ -7111,7 +7218,7 @@ var ImageEditor = ({
7111
7218
  children: "Rotate -90\xB0"
7112
7219
  }
7113
7220
  ),
7114
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7221
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
7115
7222
  "button",
7116
7223
  {
7117
7224
  type: "button",
@@ -7120,7 +7227,7 @@ var ImageEditor = ({
7120
7227
  children: "Rotate +90\xB0"
7121
7228
  }
7122
7229
  ),
7123
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7230
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
7124
7231
  "button",
7125
7232
  {
7126
7233
  type: "button",
@@ -7129,7 +7236,7 @@ var ImageEditor = ({
7129
7236
  children: "Flip Horizontal"
7130
7237
  }
7131
7238
  ),
7132
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7239
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
7133
7240
  "button",
7134
7241
  {
7135
7242
  type: "button",
@@ -7140,10 +7247,10 @@ var ImageEditor = ({
7140
7247
  )
7141
7248
  ] })
7142
7249
  ] }),
7143
- activeTab === "adjust" && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
7144
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex items-center justify-between", children: [
7145
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: imageSectionTitleClass, children: "Color Adjustments" }),
7146
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7250
+ activeTab === "adjust" && /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
7251
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex items-center justify-between", children: [
7252
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: imageSectionTitleClass, children: "Color Adjustments" }),
7253
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
7147
7254
  "button",
7148
7255
  {
7149
7256
  type: "button",
@@ -7153,9 +7260,9 @@ var ImageEditor = ({
7153
7260
  }
7154
7261
  )
7155
7262
  ] }),
7156
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Histogram, { histogram: editor.histogram }),
7157
- import_image_editor24.IMAGE_ADJUSTMENT_CONTROLS.map((spec) => /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_react36.default.Fragment, { children: [
7158
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7263
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Histogram, { histogram: editor.histogram }),
7264
+ import_image_editor24.IMAGE_ADJUSTMENT_CONTROLS.map((spec) => /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_react38.default.Fragment, { children: [
7265
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
7159
7266
  ControlSlider,
7160
7267
  {
7161
7268
  spec,
@@ -7164,14 +7271,14 @@ var ImageEditor = ({
7164
7271
  onChange: (v) => editor.setAdjustments({ [spec.id]: v })
7165
7272
  }
7166
7273
  ),
7167
- spec.id === "tint" && legacyProcess && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
7274
+ spec.id === "tint" && legacyProcess && /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
7168
7275
  "div",
7169
7276
  {
7170
7277
  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",
7171
7278
  "data-testid": "image-editor-process-notice",
7172
7279
  children: [
7173
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { children: "Legacy rendering (process 1). Tint needs the current process." }),
7174
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7280
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { children: "Legacy rendering (process 1). Tint needs the current process." }),
7281
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
7175
7282
  "button",
7176
7283
  {
7177
7284
  type: "button",
@@ -7184,7 +7291,7 @@ var ImageEditor = ({
7184
7291
  }
7185
7292
  )
7186
7293
  ] }, spec.id)),
7187
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: imageSectionClass, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7294
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: imageSectionClass, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
7188
7295
  AdjustmentLayersPanel,
7189
7296
  {
7190
7297
  controller,
@@ -7193,9 +7300,9 @@ var ImageEditor = ({
7193
7300
  }
7194
7301
  ) })
7195
7302
  ] }),
7196
- activeTab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
7197
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: imageSectionTitleClass, children: "Layers" }),
7198
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7303
+ activeTab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
7304
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: imageSectionTitleClass, children: "Layers" }),
7305
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
7199
7306
  "button",
7200
7307
  {
7201
7308
  type: "button",
@@ -7206,15 +7313,15 @@ var ImageEditor = ({
7206
7313
  children: "Free Transform"
7207
7314
  }
7208
7315
  ),
7209
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(LayersPanel, { controller }),
7210
- effectsShown && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ImageProviderEffectsPanel, { controller, className: imageSectionClass }),
7211
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: imageSectionTitleClass, children: "Colour" }),
7212
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ColorProfilePanel, { controller })
7316
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(LayersPanel, { controller }),
7317
+ effectsShown && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(ImageProviderEffectsPanel, { controller, className: imageSectionClass }),
7318
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: imageSectionTitleClass, children: "Colour" }),
7319
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(ColorProfilePanel, { controller })
7213
7320
  ] }),
7214
- activeTab === "paint" && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
7215
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: imageSectionTitleClass, children: "Paint" }),
7216
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(BrushOptionsBar, { controller }),
7217
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7321
+ activeTab === "paint" && /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
7322
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: imageSectionTitleClass, children: "Paint" }),
7323
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(BrushOptionsBar, { controller }),
7324
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
7218
7325
  "button",
7219
7326
  {
7220
7327
  type: "button",
@@ -7225,12 +7332,12 @@ var ImageEditor = ({
7225
7332
  children: "Free Transform"
7226
7333
  }
7227
7334
  ),
7228
- paintError && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { role: "alert", className: "text-destructive", "data-testid": "paint-error", children: paintError }),
7229
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: imageSectionClass, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(LayersPanel, { controller }) })
7335
+ paintError && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("p", { role: "alert", className: "text-destructive", "data-testid": "paint-error", children: paintError }),
7336
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: imageSectionClass, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(LayersPanel, { controller }) })
7230
7337
  ] }),
7231
- activeTab === "annotate" && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
7232
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: imageSectionTitleClass, children: "Shape & Type Layers, Paths" }),
7233
- /* @__PURE__ */ (0, import_jsx_runtime36.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_runtime36.jsx)(
7338
+ activeTab === "annotate" && /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
7339
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: imageSectionTitleClass, children: "Shape & Type Layers, Paths" }),
7340
+ /* @__PURE__ */ (0, import_jsx_runtime38.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_runtime38.jsx)(
7234
7341
  "button",
7235
7342
  {
7236
7343
  type: "button",
@@ -7241,13 +7348,13 @@ var ImageEditor = ({
7241
7348
  },
7242
7349
  t
7243
7350
  )) }),
7244
- state.activeTool === "shape" && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ShapeOptionsBar, { controller, options: shapeOptions, onChange: setShapeOptions }),
7245
- state.activeTool === "type" && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(TypeOptionsBar, { controller, options: typeOptions, onChange: setTypeOptions, session: typeSession }),
7246
- state.activeTool === "type" && typeSession && /* @__PURE__ */ (0, import_jsx_runtime36.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" }),
7247
- shapeTypeError && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { role: "alert", className: "text-destructive", "data-testid": "shape-type-error", children: shapeTypeError }),
7248
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: imageDividerClass }),
7249
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: imageSectionTitleClass, children: "Draw & Annotate" }),
7250
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "grid grid-cols-3 gap-1.5", children: ["pen", "rect", "circle", "arrow", "line"].map((t) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7351
+ state.activeTool === "shape" && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(ShapeOptionsBar, { controller, options: shapeOptions, onChange: setShapeOptions }),
7352
+ state.activeTool === "type" && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(TypeOptionsBar, { controller, options: typeOptions, onChange: setTypeOptions, session: typeSession }),
7353
+ state.activeTool === "type" && typeSession && /* @__PURE__ */ (0, import_jsx_runtime38.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" }),
7354
+ shapeTypeError && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("p", { role: "alert", className: "text-destructive", "data-testid": "shape-type-error", children: shapeTypeError }),
7355
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: imageDividerClass }),
7356
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: imageSectionTitleClass, children: "Draw & Annotate" }),
7357
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "grid grid-cols-3 gap-1.5", children: ["pen", "rect", "circle", "arrow", "line"].map((t) => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
7251
7358
  "button",
7252
7359
  {
7253
7360
  type: "button",
@@ -7257,18 +7364,18 @@ var ImageEditor = ({
7257
7364
  },
7258
7365
  t
7259
7366
  )) }),
7260
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex items-center gap-2 mt-2", children: [
7261
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("label", { className: "text-muted-foreground", children: "Color:" }),
7262
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ImageColor, { label: "Annotation colour", value: activeColor, onChange: setActiveColor }),
7263
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex-1 ml-2", children: [
7264
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-0.5", children: [
7265
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { children: "Width:" }),
7266
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("span", { className: "font-mono", children: [
7367
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex items-center gap-2 mt-2", children: [
7368
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("label", { className: "text-muted-foreground", children: "Color:" }),
7369
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(ImageColor, { label: "Annotation colour", value: activeColor, onChange: setActiveColor }),
7370
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex-1 ml-2", children: [
7371
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-0.5", children: [
7372
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { children: "Width:" }),
7373
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("span", { className: "font-mono", children: [
7267
7374
  strokeWidth,
7268
7375
  "px"
7269
7376
  ] })
7270
7377
  ] }),
7271
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7378
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
7272
7379
  "input",
7273
7380
  {
7274
7381
  type: "range",
@@ -7281,10 +7388,10 @@ var ImageEditor = ({
7281
7388
  )
7282
7389
  ] })
7283
7390
  ] }),
7284
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: imageDividerClass }),
7285
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: imageSectionTitleClass, children: "Add Text" }),
7286
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex gap-2", children: [
7287
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7391
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: imageDividerClass }),
7392
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: imageSectionTitleClass, children: "Add Text" }),
7393
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex gap-2", children: [
7394
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
7288
7395
  "input",
7289
7396
  {
7290
7397
  type: "text",
@@ -7295,7 +7402,7 @@ var ImageEditor = ({
7295
7402
  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"
7296
7403
  }
7297
7404
  ),
7298
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7405
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
7299
7406
  "button",
7300
7407
  {
7301
7408
  type: "button",
@@ -7305,14 +7412,14 @@ var ImageEditor = ({
7305
7412
  }
7306
7413
  )
7307
7414
  ] }),
7308
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex items-center justify-between text-muted-foreground", children: [
7309
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { children: "Font Size:" }),
7310
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("span", { className: "font-mono", children: [
7415
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex items-center justify-between text-muted-foreground", children: [
7416
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { children: "Font Size:" }),
7417
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("span", { className: "font-mono", children: [
7311
7418
  fontSize,
7312
7419
  "px"
7313
7420
  ] })
7314
7421
  ] }),
7315
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7422
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
7316
7423
  "input",
7317
7424
  {
7318
7425
  type: "range",
@@ -7323,14 +7430,14 @@ var ImageEditor = ({
7323
7430
  className: imageRangeClass
7324
7431
  }
7325
7432
  ),
7326
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: imageDividerClass }),
7327
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex items-center justify-between", children: [
7328
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("span", { className: "text-muted-foreground", children: [
7433
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: imageDividerClass }),
7434
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex items-center justify-between", children: [
7435
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("span", { className: "text-muted-foreground", children: [
7329
7436
  "Layers (",
7330
7437
  state.annotations.length,
7331
7438
  ")"
7332
7439
  ] }),
7333
- state.selectedAnnotationId && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7440
+ state.selectedAnnotationId && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
7334
7441
  "button",
7335
7442
  {
7336
7443
  type: "button",
@@ -7339,7 +7446,7 @@ var ImageEditor = ({
7339
7446
  children: "Delete Selected"
7340
7447
  }
7341
7448
  ),
7342
- state.annotations.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7449
+ state.annotations.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
7343
7450
  "button",
7344
7451
  {
7345
7452
  type: "button",
@@ -7350,10 +7457,10 @@ var ImageEditor = ({
7350
7457
  )
7351
7458
  ] })
7352
7459
  ] }),
7353
- activeTab === "depth" && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
7354
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex items-center justify-between", children: [
7355
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: imageSectionTitleClass, children: "Depth Masking" }),
7356
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7460
+ activeTab === "depth" && /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
7461
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex items-center justify-between", children: [
7462
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: imageSectionTitleClass, children: "Depth Masking" }),
7463
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
7357
7464
  "button",
7358
7465
  {
7359
7466
  type: "button",
@@ -7363,8 +7470,8 @@ var ImageEditor = ({
7363
7470
  }
7364
7471
  )
7365
7472
  ] }),
7366
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("label", { className: "flex items-center gap-2 cursor-pointer text-foreground", children: [
7367
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7473
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("label", { className: "flex items-center gap-2 cursor-pointer text-foreground", children: [
7474
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
7368
7475
  "input",
7369
7476
  {
7370
7477
  type: "checkbox",
@@ -7373,12 +7480,12 @@ var ImageEditor = ({
7373
7480
  className: "rounded accent-primary"
7374
7481
  }
7375
7482
  ),
7376
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { children: "Enable Depth / Alpha Mask" })
7483
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { children: "Enable Depth / Alpha Mask" })
7377
7484
  ] }),
7378
- state.depthMask.enabled && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
7379
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { children: [
7380
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("label", { className: "text-muted-foreground block mb-1", children: "Mask Image URL:" }),
7381
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7485
+ state.depthMask.enabled && /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_jsx_runtime38.Fragment, { children: [
7486
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { children: [
7487
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("label", { className: "text-muted-foreground block mb-1", children: "Mask Image URL:" }),
7488
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
7382
7489
  "input",
7383
7490
  {
7384
7491
  type: "text",
@@ -7389,8 +7496,8 @@ var ImageEditor = ({
7389
7496
  }
7390
7497
  )
7391
7498
  ] }),
7392
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex gap-2", children: [
7393
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7499
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex gap-2", children: [
7500
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
7394
7501
  "button",
7395
7502
  {
7396
7503
  type: "button",
@@ -7399,7 +7506,7 @@ var ImageEditor = ({
7399
7506
  children: "Threshold Mode"
7400
7507
  }
7401
7508
  ),
7402
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7509
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
7403
7510
  "button",
7404
7511
  {
7405
7512
  type: "button",
@@ -7409,12 +7516,12 @@ var ImageEditor = ({
7409
7516
  }
7410
7517
  )
7411
7518
  ] }),
7412
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { children: [
7413
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
7414
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { children: "Depth Start (Lower):" }),
7415
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "font-mono", children: state.depthMask.depthRange[0] })
7519
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { children: [
7520
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
7521
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { children: "Depth Start (Lower):" }),
7522
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: "font-mono", children: state.depthMask.depthRange[0] })
7416
7523
  ] }),
7417
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7524
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
7418
7525
  "input",
7419
7526
  {
7420
7527
  type: "range",
@@ -7428,12 +7535,12 @@ var ImageEditor = ({
7428
7535
  }
7429
7536
  )
7430
7537
  ] }),
7431
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { children: [
7432
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
7433
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { children: "Depth Stop (Upper):" }),
7434
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "font-mono", children: state.depthMask.depthRange[1] })
7538
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { children: [
7539
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
7540
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { children: "Depth Stop (Upper):" }),
7541
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: "font-mono", children: state.depthMask.depthRange[1] })
7435
7542
  ] }),
7436
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7543
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
7437
7544
  "input",
7438
7545
  {
7439
7546
  type: "range",
@@ -7447,12 +7554,12 @@ var ImageEditor = ({
7447
7554
  }
7448
7555
  )
7449
7556
  ] }),
7450
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { children: [
7451
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
7452
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { children: "Softness:" }),
7453
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "font-mono", children: state.depthMask.softness })
7557
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { children: [
7558
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
7559
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { children: "Softness:" }),
7560
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: "font-mono", children: state.depthMask.softness })
7454
7561
  ] }),
7455
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7562
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
7456
7563
  "input",
7457
7564
  {
7458
7565
  type: "range",
@@ -7464,8 +7571,8 @@ var ImageEditor = ({
7464
7571
  }
7465
7572
  )
7466
7573
  ] }),
7467
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("label", { className: "flex items-center gap-2 cursor-pointer text-foreground mt-1", children: [
7468
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7574
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("label", { className: "flex items-center gap-2 cursor-pointer text-foreground mt-1", children: [
7575
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
7469
7576
  "input",
7470
7577
  {
7471
7578
  type: "checkbox",
@@ -7474,12 +7581,12 @@ var ImageEditor = ({
7474
7581
  className: "rounded accent-primary"
7475
7582
  }
7476
7583
  ),
7477
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { children: "Invert Mask" })
7584
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { children: "Invert Mask" })
7478
7585
  ] })
7479
7586
  ] })
7480
7587
  ] }),
7481
- activeTab === "select" && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
7482
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7588
+ activeTab === "select" && /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
7589
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
7483
7590
  SelectionOptionsBar,
7484
7591
  {
7485
7592
  controller,
@@ -7490,9 +7597,9 @@ var ImageEditor = ({
7490
7597
  selectionDisplay: state.selectionDisplay
7491
7598
  }
7492
7599
  ),
7493
- selectionError && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { role: "alert", className: "text-destructive", children: selectionError }),
7494
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex gap-1", children: [
7495
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7600
+ selectionError && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("p", { role: "alert", className: "text-destructive", children: selectionError }),
7601
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex gap-1", children: [
7602
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
7496
7603
  "button",
7497
7604
  {
7498
7605
  type: "button",
@@ -7503,7 +7610,7 @@ var ImageEditor = ({
7503
7610
  children: "Transform Selection"
7504
7611
  }
7505
7612
  ),
7506
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7613
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
7507
7614
  "button",
7508
7615
  {
7509
7616
  type: "button",
@@ -7515,14 +7622,14 @@ var ImageEditor = ({
7515
7622
  }
7516
7623
  )
7517
7624
  ] }),
7518
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(RefineEdgePanel, { controller, selection: state.selection ?? null, layers: state.adjustments.layers }),
7519
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ChannelsPanel, { controller }),
7520
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(PathsPanel, { controller })
7625
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(RefineEdgePanel, { controller, selection: state.selection ?? null, layers: state.adjustments.layers }),
7626
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(ChannelsPanel, { controller }),
7627
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(PathsPanel, { controller })
7521
7628
  ] }),
7522
- activeTab === "ai" && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
7523
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("label", { className: "flex items-center justify-between gap-2 text-foreground", children: [
7524
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { children: "Results go to" }),
7525
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
7629
+ activeTab === "ai" && /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
7630
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("label", { className: "flex items-center justify-between gap-2 text-foreground", children: [
7631
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { children: "Results go to" }),
7632
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
7526
7633
  "select",
7527
7634
  {
7528
7635
  "aria-label": "AI result target",
@@ -7530,54 +7637,54 @@ var ImageEditor = ({
7530
7637
  onChange: (e) => setAiTarget(e.target.value),
7531
7638
  className: imageSelectClass,
7532
7639
  children: [
7533
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("option", { value: "auto", children: controller.isMultiLayer ? "Auto (new layer)" : "Auto (replace image)" }),
7534
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("option", { value: "new-layer", children: "New layer / mask" }),
7535
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("option", { value: "replace", children: "Replace image" })
7640
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("option", { value: "auto", children: controller.isMultiLayer ? "Auto (new layer)" : "Auto (replace image)" }),
7641
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("option", { value: "new-layer", children: "New layer / mask" }),
7642
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("option", { value: "replace", children: "Replace image" })
7536
7643
  ]
7537
7644
  }
7538
7645
  )
7539
7646
  ] }),
7540
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
7541
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex items-center justify-between", children: [
7542
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
7543
- /* @__PURE__ */ (0, import_jsx_runtime36.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_runtime36.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" }) }),
7647
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
7648
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex items-center justify-between", children: [
7649
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
7650
+ /* @__PURE__ */ (0, import_jsx_runtime38.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_runtime38.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" }) }),
7544
7651
  "Background Removal"
7545
7652
  ] }),
7546
- isRemovingBg && /* @__PURE__ */ (0, import_jsx_runtime36.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..." })
7653
+ isRemovingBg && /* @__PURE__ */ (0, import_jsx_runtime38.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..." })
7547
7654
  ] }),
7548
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Isolate foreground subject with AI alpha transparency segmentation." }),
7549
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7655
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Isolate foreground subject with AI alpha transparency segmentation." }),
7656
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
7550
7657
  "button",
7551
7658
  {
7552
7659
  type: "button",
7553
7660
  onClick: handleRemoveBackground,
7554
7661
  disabled: isRemovingBg || isInpainting,
7555
7662
  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",
7556
- children: isRemovingBg ? /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
7557
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: imageSpinnerClass }),
7663
+ children: isRemovingBg ? /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_jsx_runtime38.Fragment, { children: [
7664
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: imageSpinnerClass }),
7558
7665
  "Removing Background..."
7559
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
7560
- /* @__PURE__ */ (0, import_jsx_runtime36.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_runtime36.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" }) }),
7666
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_jsx_runtime38.Fragment, { children: [
7667
+ /* @__PURE__ */ (0, import_jsx_runtime38.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_runtime38.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" }) }),
7561
7668
  "Remove Background"
7562
7669
  ] })
7563
7670
  }
7564
7671
  )
7565
7672
  ] }),
7566
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
7567
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex items-center justify-between", children: [
7568
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
7569
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("svg", { className: "w-3.5 h-3.5 text-primary", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
7570
- /* @__PURE__ */ (0, import_jsx_runtime36.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" }),
7571
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("path", { d: "m14 7 3 3" })
7673
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
7674
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex items-center justify-between", children: [
7675
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
7676
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("svg", { className: "w-3.5 h-3.5 text-primary", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
7677
+ /* @__PURE__ */ (0, import_jsx_runtime38.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" }),
7678
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("path", { d: "m14 7 3 3" })
7572
7679
  ] }),
7573
7680
  "Generative Inpainting"
7574
7681
  ] }),
7575
- isInpainting && /* @__PURE__ */ (0, import_jsx_runtime36.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..." })
7682
+ isInpainting && /* @__PURE__ */ (0, import_jsx_runtime38.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..." })
7576
7683
  ] }),
7577
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Replace, modify, or fill selected regions using prompt-guided generative inpainting." }),
7578
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex flex-col gap-1", children: [
7579
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("label", { htmlFor: "ai-inpaint-prompt-react", className: "text-foreground text-[11px] font-medium", children: "Prompt" }),
7580
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7684
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Replace, modify, or fill selected regions using prompt-guided generative inpainting." }),
7685
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex flex-col gap-1", children: [
7686
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("label", { htmlFor: "ai-inpaint-prompt-react", className: "text-foreground text-[11px] font-medium", children: "Prompt" }),
7687
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
7581
7688
  "textarea",
7582
7689
  {
7583
7690
  id: "ai-inpaint-prompt-react",
@@ -7589,10 +7696,10 @@ var ImageEditor = ({
7589
7696
  }
7590
7697
  )
7591
7698
  ] }),
7592
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex flex-col gap-1", children: [
7593
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "text-foreground text-[11px] font-medium", children: "Target Mask Region" }),
7594
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "grid grid-cols-2 gap-1.5", children: [
7595
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
7699
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex flex-col gap-1", children: [
7700
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: "text-foreground text-[11px] font-medium", children: "Target Mask Region" }),
7701
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "grid grid-cols-2 gap-1.5", children: [
7702
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
7596
7703
  "button",
7597
7704
  {
7598
7705
  type: "button",
@@ -7605,7 +7712,7 @@ var ImageEditor = ({
7605
7712
  ]
7606
7713
  }
7607
7714
  ),
7608
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
7715
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
7609
7716
  "button",
7610
7717
  {
7611
7718
  type: "button",
@@ -7620,25 +7727,25 @@ var ImageEditor = ({
7620
7727
  )
7621
7728
  ] })
7622
7729
  ] }),
7623
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7730
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
7624
7731
  "button",
7625
7732
  {
7626
7733
  type: "button",
7627
7734
  onClick: handleInpaint,
7628
7735
  disabled: isInpainting || isRemovingBg || !inpaintPrompt.trim(),
7629
7736
  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",
7630
- children: isInpainting ? /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
7631
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: imageSpinnerClass }),
7737
+ children: isInpainting ? /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_jsx_runtime38.Fragment, { children: [
7738
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: imageSpinnerClass }),
7632
7739
  "Generating Inpaint..."
7633
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
7634
- /* @__PURE__ */ (0, import_jsx_runtime36.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_runtime36.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" }) }),
7740
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_jsx_runtime38.Fragment, { children: [
7741
+ /* @__PURE__ */ (0, import_jsx_runtime38.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_runtime38.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" }) }),
7635
7742
  "Apply Inpainting"
7636
7743
  ] })
7637
7744
  }
7638
7745
  )
7639
7746
  ] }),
7640
- aiError && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "p-2.5 rounded-lg bg-destructive/10 border border-destructive/40 text-destructive text-[11px]", children: aiError }),
7641
- aiSuccess && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "p-2.5 rounded-lg bg-emerald-500/10 border border-emerald-500/30 text-emerald-600 text-[11px]", children: aiSuccess })
7747
+ aiError && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "p-2.5 rounded-lg bg-destructive/10 border border-destructive/40 text-destructive text-[11px]", children: aiError }),
7748
+ aiSuccess && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "p-2.5 rounded-lg bg-emerald-500/10 border border-emerald-500/30 text-emerald-600 text-[11px]", children: aiSuccess })
7642
7749
  ] })
7643
7750
  ] })
7644
7751
  ] })
@@ -7674,7 +7781,9 @@ var ImageEditor = ({
7674
7781
  PathsPanel,
7675
7782
  RefineEdgePanel,
7676
7783
  SelectAndMaskWorkspace,
7784
+ SelectionChangeCheck,
7677
7785
  SelectionOptionsBar,
7786
+ SeparateSubjectPanel,
7678
7787
  ShapeOptionsBar,
7679
7788
  TypeOptionsBar,
7680
7789
  useImageEditor,