@pixerate/editor-react 0.140.0 → 0.141.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.
package/dist/index.cjs CHANGED
@@ -73,6 +73,7 @@ __export(src_exports, {
73
73
  NameManager: () => NameManager,
74
74
  OutlinePanel: () => OutlinePanel,
75
75
  PaintGradientEditor: () => PaintGradientEditor,
76
+ PathsPanel: () => PathsPanel,
76
77
  PresenceLayer: () => PresenceLayer,
77
78
  RecoveryPrompt: () => RecoveryPrompt,
78
79
  RefineEdgePanel: () => RefineEdgePanel,
@@ -4042,8 +4043,8 @@ function useImageEffectsTools(registry, controller, options = {}) {
4042
4043
  }
4043
4044
 
4044
4045
  // src/image-editor/ImageEditor.tsx
4045
- var import_react69 = __toESM(require("react"), 1);
4046
- var import_image_editor22 = require("@pixerate/editor/image-editor");
4046
+ var import_react70 = __toESM(require("react"), 1);
4047
+ var import_image_editor23 = require("@pixerate/editor/image-editor");
4047
4048
 
4048
4049
  // src/image-editor/ImageEditorCanvas.tsx
4049
4050
  var import_react41 = require("react");
@@ -9678,14 +9679,121 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
9678
9679
  ] });
9679
9680
  };
9680
9681
 
9681
- // src/image-editor/FreeTransformOptionsBar.tsx
9682
+ // src/image-editor/PathsPanel.tsx
9682
9683
  var import_react66 = require("react");
9683
9684
  var import_image_editor19 = require("@pixerate/editor/image-editor");
9684
9685
  var import_jsx_runtime46 = require("react/jsx-runtime");
9686
+ 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"}`;
9687
+ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
9688
+ const [, setTick] = (0, import_react66.useState)(0);
9689
+ (0, import_react66.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
9690
+ const [renaming, setRenaming] = (0, import_react66.useState)(null);
9691
+ const [color, setColor] = (0, import_react66.useState)("#000000");
9692
+ const [width, setWidth] = (0, import_react66.useState)(2);
9693
+ const [error, setError] = (0, import_react66.useState)(null);
9694
+ const paths = controller.getPaths();
9695
+ const activeId = controller.getState().activePathId ?? null;
9696
+ const active = paths.find((p) => p.id === activeId) ?? null;
9697
+ const hasSelection = Boolean(controller.getSelection());
9698
+ const { width: w, height: h } = controller.getState().imageDimensions;
9699
+ const attempt = (fn) => {
9700
+ setError(null);
9701
+ try {
9702
+ fn();
9703
+ } catch (err) {
9704
+ setError(err instanceof Error ? err.message : String(err));
9705
+ }
9706
+ };
9707
+ return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { "data-testid": "paths-panel", className: `flex flex-col gap-2 text-xs ${className}`, children: [
9708
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { className: imageSectionTitleClass, children: "Paths" }),
9709
+ paths.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("p", { className: "text-muted-foreground", children: "No paths. Make a work path from a selection." }),
9710
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("ul", { role: "list", className: "flex flex-col gap-0.5", children: paths.map((p) => /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
9711
+ "li",
9712
+ {
9713
+ "data-testid": "path-row",
9714
+ "aria-current": p.id === activeId ? "true" : void 0,
9715
+ className: `flex items-center gap-1.5 px-1.5 py-1 rounded cursor-pointer select-none ${p.id === activeId ? "bg-primary/30 ring-1 ring-primary" : "hover:bg-muted"}`,
9716
+ onClick: () => attempt(() => controller.setActivePath(p.id)),
9717
+ onDoubleClick: () => setRenaming(p.id),
9718
+ children: [
9719
+ /* @__PURE__ */ (0, import_jsx_runtime46.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_runtime46.jsx)("path", { d: (0, import_image_editor19.pathSvgData)(p), fill: "currentColor", fillOpacity: 0.25, stroke: "currentColor", strokeWidth: Math.max(w, h) / 64, fillRule: p.fillRule ?? "nonzero" }) }),
9720
+ renaming === p.id ? /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
9721
+ "input",
9722
+ {
9723
+ autoFocus: true,
9724
+ "aria-label": "Path name",
9725
+ defaultValue: p.work ? "" : p.name,
9726
+ placeholder: "Path name",
9727
+ className: "min-w-0 flex-1 bg-background border border-border rounded px-1 py-0.5 text-foreground",
9728
+ onClick: (e) => e.stopPropagation(),
9729
+ onBlur: (e) => {
9730
+ setRenaming(null);
9731
+ const name = e.currentTarget.value.trim();
9732
+ if (name && name !== p.name) attempt(() => controller.renamePath(p.id, name));
9733
+ },
9734
+ onKeyDown: (e) => {
9735
+ if (e.key === "Enter") e.currentTarget.blur();
9736
+ if (e.key === "Escape") setRenaming(null);
9737
+ }
9738
+ }
9739
+ ) : /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { className: `min-w-0 flex-1 truncate ${p.work ? "italic" : ""}`, children: p.name })
9740
+ ]
9741
+ },
9742
+ p.id
9743
+ )) }),
9744
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
9745
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
9746
+ "button",
9747
+ {
9748
+ type: "button",
9749
+ className: btn3(),
9750
+ disabled: !active,
9751
+ title: "Load the path as the selection (Shift adds, Alt subtracts)",
9752
+ onClick: (e) => attempt(() => controller.loadPathAsSelection(active.id, { mode: (0, import_image_editor19.selectionModeFromModifiers)(e, "replace") })),
9753
+ children: "Load as Selection"
9754
+ }
9755
+ ),
9756
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("button", { type: "button", className: btn3(), disabled: !hasSelection, onClick: () => attempt(() => controller.makeWorkPath()), children: "Make Work Path" }),
9757
+ active?.work && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("button", { type: "button", className: btn3(), onClick: () => setRenaming(active.id), children: "Save Path" }),
9758
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.addVectorMaskFromPath(active.id)), children: "Add Vector Mask" })
9759
+ ] }),
9760
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
9761
+ /* @__PURE__ */ (0, import_jsx_runtime46.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" }),
9762
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.fillPath(active.id, { color })), children: "Fill Path" }),
9763
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
9764
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
9765
+ "input",
9766
+ {
9767
+ type: "number",
9768
+ min: 0.5,
9769
+ max: 250,
9770
+ step: 0.5,
9771
+ "aria-label": "Stroke width",
9772
+ value: width,
9773
+ onChange: (e) => setWidth(Math.min(250, Math.max(0.5, Number(e.target.value) || 1))),
9774
+ className: "w-12 bg-background border border-border rounded px-1 py-0.5 text-foreground"
9775
+ }
9776
+ ),
9777
+ "px"
9778
+ ] }),
9779
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.strokePath(active.id, { width, color })), children: "Stroke Path" })
9780
+ ] }),
9781
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
9782
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.duplicatePath(active.id)), children: "Duplicate" }),
9783
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.deletePath(active.id)), children: "Delete" })
9784
+ ] }),
9785
+ error && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("p", { role: "alert", className: "text-destructive", children: error })
9786
+ ] });
9787
+ };
9788
+
9789
+ // src/image-editor/FreeTransformOptionsBar.tsx
9790
+ var import_react67 = require("react");
9791
+ var import_image_editor20 = require("@pixerate/editor/image-editor");
9792
+ var import_jsx_runtime47 = require("react/jsx-runtime");
9685
9793
  var round = (v, unit) => unit === "px" ? Math.round(v * 10) / 10 : Math.round(v * 100) / 100;
9686
9794
  var FreeTransformOptionsBar = ({ tool, className }) => {
9687
- const [, setTick] = (0, import_react66.useState)(0);
9688
- (0, import_react66.useEffect)(() => tool.subscribe(() => setTick((n) => n + 1)), [tool]);
9795
+ const [, setTick] = (0, import_react67.useState)(0);
9796
+ (0, import_react67.useEffect)(() => tool.subscribe(() => setTick((n) => n + 1)), [tool]);
9689
9797
  const bar = tool.bar();
9690
9798
  if (!tool.active || !bar) return null;
9691
9799
  const warp = tool.warpBar();
@@ -9697,17 +9805,17 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
9697
9805
  const v = Number(raw);
9698
9806
  if (raw.trim() !== "" && Number.isFinite(v) && Math.abs(v - bar[field]) > 1e-9) tool.setField(field, v);
9699
9807
  };
9700
- return /* @__PURE__ */ (0, import_jsx_runtime46.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: [
9701
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: "flex gap-1", role: "group", "aria-label": "Transform mode", children: import_image_editor19.FREE_TRANSFORM_MODE_OPTIONS.map((m) => /* @__PURE__ */ (0, import_jsx_runtime46.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)) }),
9702
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: "grid grid-cols-3 gap-px", role: "group", "aria-label": "Reference point", children: import_image_editor19.TRANSFORM_ANCHORS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime46.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)) }),
9703
- tool.mode === "warp" && /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "flex flex-wrap items-center gap-2", role: "group", "aria-label": "Warp options", children: [
9704
- /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("label", { className: "flex items-center gap-1", children: [
9705
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { className: "text-muted-foreground", children: "Warp" }),
9706
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("select", { "aria-label": "Warp style", value: warp.style, onChange: (e) => tool.setWarp({ style: e.target.value }), className: imageFieldClass, children: import_image_editor19.WARP_STYLE_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("option", { value: o.id, children: o.label }, o.id)) })
9808
+ return /* @__PURE__ */ (0, import_jsx_runtime47.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: [
9809
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "flex gap-1", role: "group", "aria-label": "Transform mode", children: import_image_editor20.FREE_TRANSFORM_MODE_OPTIONS.map((m) => /* @__PURE__ */ (0, import_jsx_runtime47.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)) }),
9810
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "grid grid-cols-3 gap-px", role: "group", "aria-label": "Reference point", children: import_image_editor20.TRANSFORM_ANCHORS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime47.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)) }),
9811
+ tool.mode === "warp" && /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex flex-wrap items-center gap-2", role: "group", "aria-label": "Warp options", children: [
9812
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("label", { className: "flex items-center gap-1", children: [
9813
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "text-muted-foreground", children: "Warp" }),
9814
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("select", { "aria-label": "Warp style", value: warp.style, onChange: (e) => tool.setWarp({ style: e.target.value }), className: imageFieldClass, children: import_image_editor20.WARP_STYLE_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("option", { value: o.id, children: o.label }, o.id)) })
9707
9815
  ] }),
9708
- ["bend", "horizontal", "vertical"].map((k) => /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("label", { className: "flex items-center gap-1", children: [
9709
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { className: "text-muted-foreground", children: k === "bend" ? "Bend" : k === "horizontal" ? "H" : "V" }),
9710
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
9816
+ ["bend", "horizontal", "vertical"].map((k) => /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("label", { className: "flex items-center gap-1", children: [
9817
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "text-muted-foreground", children: k === "bend" ? "Bend" : k === "horizontal" ? "H" : "V" }),
9818
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
9711
9819
  "input",
9712
9820
  {
9713
9821
  type: "number",
@@ -9728,9 +9836,9 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
9728
9836
  },
9729
9837
  `${k}:${warp[k]}`
9730
9838
  ),
9731
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { className: "text-muted-foreground", children: "%" })
9839
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "text-muted-foreground", children: "%" })
9732
9840
  ] }, k)),
9733
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
9841
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
9734
9842
  "button",
9735
9843
  {
9736
9844
  type: "button",
@@ -9742,26 +9850,26 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
9742
9850
  children: "Vertical"
9743
9851
  }
9744
9852
  ),
9745
- /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("label", { className: "flex items-center gap-1", children: [
9746
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { className: "text-muted-foreground", children: "Grid" }),
9747
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
9853
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("label", { className: "flex items-center gap-1", children: [
9854
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "text-muted-foreground", children: "Grid" }),
9855
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
9748
9856
  "select",
9749
9857
  {
9750
9858
  "aria-label": "Warp grid",
9751
- value: import_image_editor19.WARP_GRID_OPTIONS.find((g) => g.columns === warp.columns && g.rows === warp.rows)?.id ?? "1x1",
9859
+ value: import_image_editor20.WARP_GRID_OPTIONS.find((g) => g.columns === warp.columns && g.rows === warp.rows)?.id ?? "1x1",
9752
9860
  onChange: (e) => {
9753
- const g = import_image_editor19.WARP_GRID_OPTIONS.find((o) => o.id === e.target.value);
9861
+ const g = import_image_editor20.WARP_GRID_OPTIONS.find((o) => o.id === e.target.value);
9754
9862
  tool.setWarp({ columns: g.columns, rows: g.rows });
9755
9863
  },
9756
9864
  className: imageFieldClass,
9757
- children: import_image_editor19.WARP_GRID_OPTIONS.map((g) => /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("option", { value: g.id, children: g.label }, g.id))
9865
+ children: import_image_editor20.WARP_GRID_OPTIONS.map((g) => /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("option", { value: g.id, children: g.label }, g.id))
9758
9866
  }
9759
9867
  )
9760
9868
  ] })
9761
9869
  ] }),
9762
- tool.mode !== "warp" && import_image_editor19.FREE_TRANSFORM_FIELDS.map((f) => /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("label", { className: "flex items-center gap-1", title: f.title, children: [
9763
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { className: "text-muted-foreground", children: f.label }),
9764
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
9870
+ tool.mode !== "warp" && import_image_editor20.FREE_TRANSFORM_FIELDS.map((f) => /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("label", { className: "flex items-center gap-1", title: f.title, children: [
9871
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "text-muted-foreground", children: f.label }),
9872
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
9765
9873
  "input",
9766
9874
  {
9767
9875
  type: "number",
@@ -9781,8 +9889,8 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
9781
9889
  },
9782
9890
  `${f.id}:${round(bar[f.id], f.unit)}`
9783
9891
  ),
9784
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { className: "text-muted-foreground", children: f.unit }),
9785
- f.id === "scaleX" && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
9892
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "text-muted-foreground", children: f.unit }),
9893
+ f.id === "scaleX" && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
9786
9894
  "button",
9787
9895
  {
9788
9896
  type: "button",
@@ -9797,33 +9905,33 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
9797
9905
  }
9798
9906
  )
9799
9907
  ] }, f.id)),
9800
- /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("label", { className: "flex items-center gap-1", children: [
9801
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { className: "text-muted-foreground", children: "Interpolation" }),
9802
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
9908
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("label", { className: "flex items-center gap-1", children: [
9909
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "text-muted-foreground", children: "Interpolation" }),
9910
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
9803
9911
  "select",
9804
9912
  {
9805
9913
  "aria-label": "Interpolation",
9806
9914
  value: tool.interpolation,
9807
9915
  onChange: (e) => tool.setInterpolation(e.target.value),
9808
9916
  className: imageFieldClass,
9809
- children: import_image_editor19.INTERPOLATIONS.map((i) => /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("option", { value: i, children: i[0].toUpperCase() + i.slice(1) }, i))
9917
+ children: import_image_editor20.INTERPOLATIONS.map((i) => /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("option", { value: i, children: i[0].toUpperCase() + i.slice(1) }, i))
9810
9918
  }
9811
9919
  )
9812
9920
  ] }),
9813
- /* @__PURE__ */ (0, import_jsx_runtime46.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" }),
9814
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("button", { type: "button", title: "Cancel (Esc)", className: imageChipClass(false), onClick: () => tool.cancel(), children: "Cancel" }),
9815
- tool.error && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { role: "alert", className: "text-destructive", children: tool.error })
9921
+ /* @__PURE__ */ (0, import_jsx_runtime47.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" }),
9922
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("button", { type: "button", title: "Cancel (Esc)", className: imageChipClass(false), onClick: () => tool.cancel(), children: "Cancel" }),
9923
+ tool.error && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { role: "alert", className: "text-destructive", children: tool.error })
9816
9924
  ] });
9817
9925
  };
9818
9926
 
9819
9927
  // src/image-editor/ShapeOptionsBar.tsx
9820
- var import_react67 = require("react");
9821
- var import_image_editor20 = require("@pixerate/editor/image-editor");
9822
- var import_jsx_runtime47 = require("react/jsx-runtime");
9928
+ var import_react68 = require("react");
9929
+ var import_image_editor21 = require("@pixerate/editor/image-editor");
9930
+ var import_jsx_runtime48 = require("react/jsx-runtime");
9823
9931
  var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
9824
- const [, setTick] = (0, import_react67.useState)(0);
9825
- (0, import_react67.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
9826
- const [error, setError] = (0, import_react67.useState)(null);
9932
+ const [, setTick] = (0, import_react68.useState)(0);
9933
+ (0, import_react68.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
9934
+ const [error, setError] = (0, import_react68.useState)(null);
9827
9935
  const active = controller.getActiveLayer();
9828
9936
  const shapeId = active?.type === "shape" ? active.id : null;
9829
9937
  const set = (change) => {
@@ -9831,28 +9939,28 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
9831
9939
  if (!shapeId) return;
9832
9940
  try {
9833
9941
  setError(null);
9834
- (0, import_image_editor20.applyShapeOptions)(controller, shapeId, change);
9942
+ (0, import_image_editor21.applyShapeOptions)(controller, shapeId, change);
9835
9943
  } catch (e) {
9836
9944
  setError(e instanceof Error ? e.message : String(e));
9837
9945
  }
9838
9946
  };
9839
9947
  const num = (v, min, max) => Math.max(min, Math.min(max, Number(v) || min));
9840
- return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "shape-options", children: [
9841
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Shape kind", children: import_image_editor20.LIVE_SHAPE_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("button", { type: "button", "aria-pressed": options.kind === k, className: imageChipClass(options.kind === k), onClick: () => onChange({ ...options, kind: k }), children: import_image_editor20.SHAPE_KIND_LABELS[k] }, k)) }),
9842
- /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
9843
- /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("label", { className: "flex items-center gap-1", children: [
9844
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(ImageCheckbox, { label: "Fill", checked: options.fill !== null, onChange: (on) => set({ fill: on ? "#4f46e5" : null }) }),
9948
+ return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "shape-options", children: [
9949
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Shape kind", children: import_image_editor21.LIVE_SHAPE_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("button", { type: "button", "aria-pressed": options.kind === k, className: imageChipClass(options.kind === k), onClick: () => onChange({ ...options, kind: k }), children: import_image_editor21.SHAPE_KIND_LABELS[k] }, k)) }),
9950
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
9951
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("label", { className: "flex items-center gap-1", children: [
9952
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(ImageCheckbox, { label: "Fill", checked: options.fill !== null, onChange: (on) => set({ fill: on ? "#4f46e5" : null }) }),
9845
9953
  "Fill",
9846
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(ImageColor, { label: "Fill colour", disabled: options.fill === null, value: options.fill ?? "#4f46e5", onChange: (fill) => set({ fill }) })
9954
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(ImageColor, { label: "Fill colour", disabled: options.fill === null, value: options.fill ?? "#4f46e5", onChange: (fill) => set({ fill }) })
9847
9955
  ] }),
9848
- /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("label", { className: "flex items-center gap-1", children: [
9849
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(ImageCheckbox, { label: "Stroke", checked: options.stroke !== null, onChange: (on) => set({ stroke: on ? "#000000" : null }) }),
9956
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("label", { className: "flex items-center gap-1", children: [
9957
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(ImageCheckbox, { label: "Stroke", checked: options.stroke !== null, onChange: (on) => set({ stroke: on ? "#000000" : null }) }),
9850
9958
  "Stroke",
9851
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(ImageColor, { label: "Stroke colour", disabled: options.stroke === null, value: options.stroke ?? "#000000", onChange: (stroke) => set({ stroke }) })
9959
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(ImageColor, { label: "Stroke colour", disabled: options.stroke === null, value: options.stroke ?? "#000000", onChange: (stroke) => set({ stroke }) })
9852
9960
  ] }),
9853
- /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("label", { className: "flex items-center gap-1", children: [
9961
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("label", { className: "flex items-center gap-1", children: [
9854
9962
  "Width",
9855
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
9963
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
9856
9964
  "input",
9857
9965
  {
9858
9966
  type: "number",
@@ -9866,52 +9974,52 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
9866
9974
  )
9867
9975
  ] })
9868
9976
  ] }),
9869
- /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
9870
- options.kind === "rect" && /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("label", { className: "flex items-center gap-1", children: [
9977
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
9978
+ options.kind === "rect" && /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("label", { className: "flex items-center gap-1", children: [
9871
9979
  "Radius",
9872
- /* @__PURE__ */ (0, import_jsx_runtime47.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}` })
9980
+ /* @__PURE__ */ (0, import_jsx_runtime48.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}` })
9873
9981
  ] }),
9874
- options.kind === "polygon" && /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("label", { className: "flex items-center gap-1", children: [
9982
+ options.kind === "polygon" && /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("label", { className: "flex items-center gap-1", children: [
9875
9983
  "Sides",
9876
- /* @__PURE__ */ (0, import_jsx_runtime47.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}` })
9984
+ /* @__PURE__ */ (0, import_jsx_runtime48.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}` })
9877
9985
  ] }),
9878
- options.kind === "star" && /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_jsx_runtime47.Fragment, { children: [
9879
- /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("label", { className: "flex items-center gap-1", children: [
9986
+ options.kind === "star" && /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_jsx_runtime48.Fragment, { children: [
9987
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("label", { className: "flex items-center gap-1", children: [
9880
9988
  "Points",
9881
- /* @__PURE__ */ (0, import_jsx_runtime47.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}` })
9989
+ /* @__PURE__ */ (0, import_jsx_runtime48.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}` })
9882
9990
  ] }),
9883
- /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("label", { className: "flex items-center gap-1", children: [
9991
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("label", { className: "flex items-center gap-1", children: [
9884
9992
  "Inner",
9885
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(ImageRange, { label: "Inner radius", min: 0.05, max: 1, step: 0.05, value: options.innerRatio, onChange: (v) => set({ innerRatio: v }) })
9993
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(ImageRange, { label: "Inner radius", min: 0.05, max: 1, step: 0.05, value: options.innerRatio, onChange: (v) => set({ innerRatio: v }) })
9886
9994
  ] })
9887
9995
  ] }),
9888
- options.kind === "line" && /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_jsx_runtime47.Fragment, { children: [
9889
- /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("label", { className: "flex items-center gap-1", children: [
9996
+ options.kind === "line" && /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_jsx_runtime48.Fragment, { children: [
9997
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("label", { className: "flex items-center gap-1", children: [
9890
9998
  "Weight",
9891
- /* @__PURE__ */ (0, import_jsx_runtime47.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}` })
9999
+ /* @__PURE__ */ (0, import_jsx_runtime48.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}` })
9892
10000
  ] }),
9893
- /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("label", { className: "flex items-center gap-1", children: [
9894
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(ImageCheckbox, { label: "Arrowhead", checked: options.arrow, onChange: (on) => set({ arrow: on }) }),
10001
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("label", { className: "flex items-center gap-1", children: [
10002
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(ImageCheckbox, { label: "Arrowhead", checked: options.arrow, onChange: (on) => set({ arrow: on }) }),
9895
10003
  "Arrowhead"
9896
10004
  ] })
9897
10005
  ] })
9898
10006
  ] }),
9899
- /* @__PURE__ */ (0, import_jsx_runtime47.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." }),
9900
- error && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("p", { role: "alert", className: "text-destructive", children: error })
10007
+ /* @__PURE__ */ (0, import_jsx_runtime48.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." }),
10008
+ error && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("p", { role: "alert", className: "text-destructive", children: error })
9901
10009
  ] });
9902
10010
  };
9903
10011
 
9904
10012
  // src/image-editor/TypeOptionsBar.tsx
9905
- var import_react68 = require("react");
9906
- var import_image_editor21 = require("@pixerate/editor/image-editor");
9907
- var import_jsx_runtime48 = require("react/jsx-runtime");
10013
+ var import_react69 = require("react");
10014
+ var import_image_editor22 = require("@pixerate/editor/image-editor");
10015
+ var import_jsx_runtime49 = require("react/jsx-runtime");
9908
10016
  var ALIGN_LABELS = { left: "Left", center: "Centre", right: "Right", justify: "Justify" };
9909
10017
  var ORIENTATION_LABELS = { horizontal: "Horizontal", vertical: "Vertical" };
9910
10018
  var TypeOptionsBar = ({ controller, options, onChange, session, className }) => {
9911
- const [, setTick] = (0, import_react68.useState)(0);
9912
- (0, import_react68.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
9913
- (0, import_react68.useEffect)(() => session?.subscribe(() => setTick((n) => n + 1)), [session]);
9914
- const [error, setError] = (0, import_react68.useState)(null);
10019
+ const [, setTick] = (0, import_react69.useState)(0);
10020
+ (0, import_react69.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
10021
+ (0, import_react69.useEffect)(() => session?.subscribe(() => setTick((n) => n + 1)), [session]);
10022
+ const [error, setError] = (0, import_react69.useState)(null);
9915
10023
  const active = controller.getActiveLayer();
9916
10024
  const typeId = !session && active?.type === "type" ? active.id : null;
9917
10025
  const here = session?.alive ? session.styleHere() : {};
@@ -9964,11 +10072,11 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
9964
10072
  setError(e instanceof Error ? e.message : String(e));
9965
10073
  }
9966
10074
  };
9967
- return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "type-options", children: [
9968
- /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
9969
- /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("label", { className: "flex items-center gap-1", children: [
10075
+ return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "type-options", children: [
10076
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
10077
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("label", { className: "flex items-center gap-1", children: [
9970
10078
  "Font",
9971
- /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
10079
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
9972
10080
  "input",
9973
10081
  {
9974
10082
  list: "pixerate-type-fonts",
@@ -9978,11 +10086,11 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
9978
10086
  className: "w-32 rounded border border-border bg-background px-1 py-0.5"
9979
10087
  }
9980
10088
  ),
9981
- /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("datalist", { id: "pixerate-type-fonts", children: fonts.map((f) => /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("option", { value: f }, f)) })
10089
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("datalist", { id: "pixerate-type-fonts", children: fonts.map((f) => /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("option", { value: f }, f)) })
9982
10090
  ] }),
9983
- /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("label", { className: "flex items-center gap-1", children: [
10091
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("label", { className: "flex items-center gap-1", children: [
9984
10092
  "Size",
9985
- /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
10093
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
9986
10094
  "input",
9987
10095
  {
9988
10096
  type: "number",
@@ -9995,14 +10103,14 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
9995
10103
  }
9996
10104
  )
9997
10105
  ] }),
9998
- /* @__PURE__ */ (0, import_jsx_runtime48.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" }),
9999
- /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("button", { type: "button", "aria-pressed": shown.italic, className: `${imageChipClass(shown.italic)} italic`, onClick: () => style({ italic: !shown.italic }), children: "I" }),
10000
- /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(ImageColor, { label: "Text colour", value: shown.color, onChange: (color) => style({ color }) })
10106
+ /* @__PURE__ */ (0, import_jsx_runtime49.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" }),
10107
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("button", { type: "button", "aria-pressed": shown.italic, className: `${imageChipClass(shown.italic)} italic`, onClick: () => style({ italic: !shown.italic }), children: "I" }),
10108
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(ImageColor, { label: "Text colour", value: shown.color, onChange: (color) => style({ color }) })
10001
10109
  ] }),
10002
- /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Alignment", children: import_image_editor21.TEXT_ALIGNS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("button", { type: "button", "aria-pressed": options.align === a, className: imageChipClass(options.align === a), onClick: () => style({ align: a }), children: ALIGN_LABELS[a] }, a)) }),
10003
- /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Orientation", children: [
10004
- import_image_editor21.TEXT_ORIENTATIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("button", { type: "button", "aria-pressed": orientation === o, className: imageChipClass(orientation === o), onClick: () => orient(o), children: ORIENTATION_LABELS[o] }, o)),
10005
- orientation === "vertical" && editedId && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
10110
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Alignment", children: import_image_editor22.TEXT_ALIGNS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("button", { type: "button", "aria-pressed": options.align === a, className: imageChipClass(options.align === a), onClick: () => style({ align: a }), children: ALIGN_LABELS[a] }, a)) }),
10111
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Orientation", children: [
10112
+ import_image_editor22.TEXT_ORIENTATIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("button", { type: "button", "aria-pressed": orientation === o, className: imageChipClass(orientation === o), onClick: () => orient(o), children: ORIENTATION_LABELS[o] }, o)),
10113
+ orientation === "vertical" && editedId && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
10006
10114
  "button",
10007
10115
  {
10008
10116
  type: "button",
@@ -10014,19 +10122,19 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
10014
10122
  }
10015
10123
  )
10016
10124
  ] }),
10017
- /* @__PURE__ */ (0, import_jsx_runtime48.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." }),
10018
- missing.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("p", { role: "status", className: "text-amber-600", "data-testid": "type-missing-fonts", children: [
10125
+ /* @__PURE__ */ (0, import_jsx_runtime49.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." }),
10126
+ missing.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("p", { role: "status", className: "text-amber-600", "data-testid": "type-missing-fonts", children: [
10019
10127
  "Missing ",
10020
10128
  missing.length === 1 ? "font" : "fonts",
10021
10129
  ": ",
10022
10130
  missing.join(", ")
10023
10131
  ] }),
10024
- error && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("p", { role: "alert", className: "text-destructive", children: error })
10132
+ error && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("p", { role: "alert", className: "text-destructive", children: error })
10025
10133
  ] });
10026
10134
  };
10027
10135
 
10028
10136
  // src/image-editor/ImageEditor.tsx
10029
- var import_jsx_runtime49 = require("react/jsx-runtime");
10137
+ var import_jsx_runtime50 = require("react/jsx-runtime");
10030
10138
  var ImageEditor = ({
10031
10139
  editor: externalEditor,
10032
10140
  src,
@@ -10050,51 +10158,51 @@ var ImageEditor = ({
10050
10158
  const effectsShown = !!controller.effectsProvider || state.layers.some(function has(l) {
10051
10159
  return l.type === "pixel" && !!l.generator || l.type === "smart" && !!l.smartFilters?.filters.some((f) => f.kind === "effect") || l.type === "group" && l.children.some(has);
10052
10160
  });
10053
- const legacyProcess = (0, import_image_editor22.normalizeProcessVersion)(state.adjustments.process) < import_image_editor22.LATEST_PROCESS_VERSION;
10054
- const [activeTab, setActiveTab] = (0, import_react69.useState)("crop");
10055
- const rootRef = (0, import_react69.useRef)(null);
10161
+ const legacyProcess = (0, import_image_editor23.normalizeProcessVersion)(state.adjustments.process) < import_image_editor23.LATEST_PROCESS_VERSION;
10162
+ const [activeTab, setActiveTab] = (0, import_react70.useState)("crop");
10163
+ const rootRef = (0, import_react70.useRef)(null);
10056
10164
  const canvasMode = activeTab === "crop" || activeTab === "select" || activeTab === "paint" || activeTab === "annotate" ? activeTab : "none";
10057
- const activeTabRef = (0, import_react69.useRef)(activeTab);
10165
+ const activeTabRef = (0, import_react70.useRef)(activeTab);
10058
10166
  activeTabRef.current = activeTab;
10059
10167
  const openPanel = async (ref) => {
10060
10168
  if (ref.kind !== "panel" || activeTabRef.current === ref.id) return;
10061
10169
  rootRef.current?.querySelector(`[data-image-tab="${CSS.escape(ref.id)}"]`)?.click();
10062
10170
  await new Promise((resolve) => setTimeout(resolve, 60));
10063
10171
  };
10064
- const [activeCropRatio, setActiveCropRatio] = (0, import_react69.useState)(null);
10065
- const [selectionOptions, setSelectionOptions] = (0, import_react69.useState)(import_image_editor22.DEFAULT_SELECTION_TOOL_OPTIONS);
10066
- const [shapeOptions, setShapeOptions] = (0, import_react69.useState)(import_image_editor22.DEFAULT_SHAPE_TOOL_OPTIONS);
10067
- const [typeOptions, setTypeOptions] = (0, import_react69.useState)(import_image_editor22.DEFAULT_TYPE_TOOL_OPTIONS);
10068
- const [typeSession, setTypeSession] = (0, import_react69.useState)(null);
10069
- const [selectionError, setSelectionError] = (0, import_react69.useState)(null);
10070
- const [paintError, setPaintError] = (0, import_react69.useState)(null);
10071
- const [shapeTypeError, setShapeTypeError] = (0, import_react69.useState)(null);
10172
+ const [activeCropRatio, setActiveCropRatio] = (0, import_react70.useState)(null);
10173
+ const [selectionOptions, setSelectionOptions] = (0, import_react70.useState)(import_image_editor23.DEFAULT_SELECTION_TOOL_OPTIONS);
10174
+ const [shapeOptions, setShapeOptions] = (0, import_react70.useState)(import_image_editor23.DEFAULT_SHAPE_TOOL_OPTIONS);
10175
+ const [typeOptions, setTypeOptions] = (0, import_react70.useState)(import_image_editor23.DEFAULT_TYPE_TOOL_OPTIONS);
10176
+ const [typeSession, setTypeSession] = (0, import_react70.useState)(null);
10177
+ const [selectionError, setSelectionError] = (0, import_react70.useState)(null);
10178
+ const [paintError, setPaintError] = (0, import_react70.useState)(null);
10179
+ const [shapeTypeError, setShapeTypeError] = (0, import_react70.useState)(null);
10072
10180
  const handleCanvasError = (source, message2) => {
10073
10181
  if (source === "paint") setPaintError(message2);
10074
10182
  else if (source === "select") setSelectionError(message2);
10075
10183
  else setShapeTypeError(message2);
10076
10184
  };
10077
10185
  const finishTyping = () => setTypeSession(null);
10078
- const transformToolRef = (0, import_react69.useRef)(null);
10079
- const transformControllerRef = (0, import_react69.useRef)(controller);
10186
+ const transformToolRef = (0, import_react70.useRef)(null);
10187
+ const transformControllerRef = (0, import_react70.useRef)(controller);
10080
10188
  if (!transformToolRef.current || transformControllerRef.current !== controller) {
10081
10189
  transformToolRef.current?.cancel();
10082
- transformToolRef.current = new import_image_editor22.FreeTransformTool(controller, {
10190
+ transformToolRef.current = new import_image_editor23.FreeTransformTool(controller, {
10083
10191
  schedule: (run) => typeof requestAnimationFrame !== "undefined" ? requestAnimationFrame(run) : run()
10084
10192
  });
10085
10193
  transformControllerRef.current = controller;
10086
10194
  }
10087
10195
  const transformTool = transformToolRef.current;
10088
- const [, setTransformTick] = (0, import_react69.useState)(0);
10089
- (0, import_react69.useEffect)(() => transformTool.subscribe(() => setTransformTick((n) => n + 1)), [transformTool]);
10090
- (0, import_react69.useEffect)(() => () => transformToolRef.current?.cancel(), []);
10091
- const [inpaintPrompt, setInpaintPrompt] = (0, import_react69.useState)("");
10092
- const [inpaintMaskMode, setInpaintMaskMode] = (0, import_react69.useState)("annotations");
10093
- const [isRemovingBg, setIsRemovingBg] = (0, import_react69.useState)(false);
10094
- const [isInpainting, setIsInpainting] = (0, import_react69.useState)(false);
10095
- const [aiError, setAiError] = (0, import_react69.useState)(null);
10096
- const [aiSuccess, setAiSuccess] = (0, import_react69.useState)(null);
10097
- const [aiTarget, setAiTarget] = (0, import_react69.useState)("auto");
10196
+ const [, setTransformTick] = (0, import_react70.useState)(0);
10197
+ (0, import_react70.useEffect)(() => transformTool.subscribe(() => setTransformTick((n) => n + 1)), [transformTool]);
10198
+ (0, import_react70.useEffect)(() => () => transformToolRef.current?.cancel(), []);
10199
+ const [inpaintPrompt, setInpaintPrompt] = (0, import_react70.useState)("");
10200
+ const [inpaintMaskMode, setInpaintMaskMode] = (0, import_react70.useState)("annotations");
10201
+ const [isRemovingBg, setIsRemovingBg] = (0, import_react70.useState)(false);
10202
+ const [isInpainting, setIsInpainting] = (0, import_react70.useState)(false);
10203
+ const [aiError, setAiError] = (0, import_react70.useState)(null);
10204
+ const [aiSuccess, setAiSuccess] = (0, import_react70.useState)(null);
10205
+ const [aiTarget, setAiTarget] = (0, import_react70.useState)("auto");
10098
10206
  const aiOptions = aiTarget === "auto" ? {} : { target: aiTarget };
10099
10207
  const effectiveOnInpaint = onInpaint || aiHooks?.onInpaint;
10100
10208
  const effectiveOnRemoveBg = onRemoveBackground || aiHooks?.onRemoveBackground;
@@ -10157,11 +10265,11 @@ var ImageEditor = ({
10157
10265
  setIsInpainting(false);
10158
10266
  }
10159
10267
  };
10160
- const [activeColor, setActiveColor] = (0, import_react69.useState)("#ef4444");
10161
- const [strokeWidth, setStrokeWidth] = (0, import_react69.useState)(3);
10162
- const [fontSize, setFontSize] = (0, import_react69.useState)(24);
10163
- const [textInput, setTextInput] = (0, import_react69.useState)("");
10164
- (0, import_react69.useEffect)(() => {
10268
+ const [activeColor, setActiveColor] = (0, import_react70.useState)("#ef4444");
10269
+ const [strokeWidth, setStrokeWidth] = (0, import_react70.useState)(3);
10270
+ const [fontSize, setFontSize] = (0, import_react70.useState)(24);
10271
+ const [textInput, setTextInput] = (0, import_react70.useState)("");
10272
+ (0, import_react70.useEffect)(() => {
10165
10273
  if (activeTab === "crop" && editor.state.activeTool !== "crop") {
10166
10274
  editor.setTool("crop");
10167
10275
  }
@@ -10189,16 +10297,16 @@ var ImageEditor = ({
10189
10297
  link.click();
10190
10298
  }
10191
10299
  };
10192
- return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
10300
+ return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(
10193
10301
  "div",
10194
10302
  {
10195
10303
  ref: rootRef,
10196
10304
  className: `${imageEditorFrameClass} ${className}`,
10197
10305
  style,
10198
10306
  children: [
10199
- /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: imageEditorHeaderClass, children: [
10200
- /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { role: "tablist", className: imageTabListClass, children: [
10201
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
10307
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: imageEditorHeaderClass, children: [
10308
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { role: "tablist", className: imageTabListClass, children: [
10309
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10202
10310
  "button",
10203
10311
  {
10204
10312
  type: "button",
@@ -10213,7 +10321,7 @@ var ImageEditor = ({
10213
10321
  children: "Transform & Crop"
10214
10322
  }
10215
10323
  ),
10216
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
10324
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10217
10325
  "button",
10218
10326
  {
10219
10327
  type: "button",
@@ -10228,7 +10336,7 @@ var ImageEditor = ({
10228
10336
  children: "Adjustments"
10229
10337
  }
10230
10338
  ),
10231
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
10339
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10232
10340
  "button",
10233
10341
  {
10234
10342
  type: "button",
@@ -10243,7 +10351,7 @@ var ImageEditor = ({
10243
10351
  children: "Layers"
10244
10352
  }
10245
10353
  ),
10246
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
10354
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10247
10355
  "button",
10248
10356
  {
10249
10357
  type: "button",
@@ -10258,7 +10366,7 @@ var ImageEditor = ({
10258
10366
  children: "Paint"
10259
10367
  }
10260
10368
  ),
10261
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
10369
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10262
10370
  "button",
10263
10371
  {
10264
10372
  type: "button",
@@ -10273,7 +10381,7 @@ var ImageEditor = ({
10273
10381
  children: "Select & Mask"
10274
10382
  }
10275
10383
  ),
10276
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
10384
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10277
10385
  "button",
10278
10386
  {
10279
10387
  type: "button",
@@ -10288,7 +10396,7 @@ var ImageEditor = ({
10288
10396
  children: "Annotations"
10289
10397
  }
10290
10398
  ),
10291
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
10399
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10292
10400
  "button",
10293
10401
  {
10294
10402
  type: "button",
@@ -10303,7 +10411,7 @@ var ImageEditor = ({
10303
10411
  children: "Depth Mask"
10304
10412
  }
10305
10413
  ),
10306
- /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
10414
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(
10307
10415
  "button",
10308
10416
  {
10309
10417
  type: "button",
@@ -10316,14 +10424,14 @@ var ImageEditor = ({
10316
10424
  "aria-selected": activeTab === "ai",
10317
10425
  className: `${imageTabClass(activeTab === "ai")} flex items-center gap-1.5`,
10318
10426
  children: [
10319
- /* @__PURE__ */ (0, import_jsx_runtime49.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_runtime49.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" }) }),
10427
+ /* @__PURE__ */ (0, import_jsx_runtime50.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_runtime50.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" }) }),
10320
10428
  "AI Tools"
10321
10429
  ]
10322
10430
  }
10323
10431
  )
10324
10432
  ] }),
10325
- /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex items-center gap-2 text-xs", children: [
10326
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
10433
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex items-center gap-2 text-xs", children: [
10434
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10327
10435
  "button",
10328
10436
  {
10329
10437
  type: "button",
@@ -10334,7 +10442,7 @@ var ImageEditor = ({
10334
10442
  children: "\u21A9"
10335
10443
  }
10336
10444
  ),
10337
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
10445
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10338
10446
  "button",
10339
10447
  {
10340
10448
  type: "button",
@@ -10345,7 +10453,7 @@ var ImageEditor = ({
10345
10453
  children: "\u21AA"
10346
10454
  }
10347
10455
  ),
10348
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
10456
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10349
10457
  "button",
10350
10458
  {
10351
10459
  type: "button",
@@ -10354,8 +10462,8 @@ var ImageEditor = ({
10354
10462
  children: "Reset"
10355
10463
  }
10356
10464
  ),
10357
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "h-4 w-px bg-muted mx-1" }),
10358
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
10465
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: "h-4 w-px bg-muted mx-1" }),
10466
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10359
10467
  "button",
10360
10468
  {
10361
10469
  type: "button",
@@ -10365,11 +10473,11 @@ var ImageEditor = ({
10365
10473
  children: "-"
10366
10474
  }
10367
10475
  ),
10368
- /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("span", { className: "font-mono text-muted-foreground w-10 text-center", children: [
10476
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("span", { className: "font-mono text-muted-foreground w-10 text-center", children: [
10369
10477
  Math.round(state.zoom * 100),
10370
10478
  "%"
10371
10479
  ] }),
10372
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
10480
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10373
10481
  "button",
10374
10482
  {
10375
10483
  type: "button",
@@ -10379,8 +10487,8 @@ var ImageEditor = ({
10379
10487
  children: "+"
10380
10488
  }
10381
10489
  ),
10382
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "h-4 w-px bg-muted mx-1" }),
10383
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
10490
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: "h-4 w-px bg-muted mx-1" }),
10491
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10384
10492
  "button",
10385
10493
  {
10386
10494
  type: "button",
@@ -10391,7 +10499,7 @@ var ImageEditor = ({
10391
10499
  children: "Hold Compare"
10392
10500
  }
10393
10501
  ),
10394
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
10502
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10395
10503
  "button",
10396
10504
  {
10397
10505
  type: "button",
@@ -10402,10 +10510,10 @@ var ImageEditor = ({
10402
10510
  )
10403
10511
  ] })
10404
10512
  ] }),
10405
- transformTool.active && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(FreeTransformOptionsBar, { tool: transformTool, className: "border-b border-border bg-background/95 px-4 py-2" }),
10406
- !transformTool.active && transformTool.error && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { role: "alert", className: imageErrorBannerClass, children: transformTool.error }),
10407
- /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex flex-col md:flex-row flex-1 min-h-[520px] md:h-[560px]", children: [
10408
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
10513
+ transformTool.active && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(FreeTransformOptionsBar, { tool: transformTool, className: "border-b border-border bg-background/95 px-4 py-2" }),
10514
+ !transformTool.active && transformTool.error && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { role: "alert", className: imageErrorBannerClass, children: transformTool.error }),
10515
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex flex-col md:flex-row flex-1 min-h-[520px] md:h-[560px]", children: [
10516
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10409
10517
  ImageEditorCanvas,
10410
10518
  {
10411
10519
  editor,
@@ -10429,11 +10537,11 @@ var ImageEditor = ({
10429
10537
  className: "flex-1 h-[360px] md:h-full min-h-[320px] bg-muted"
10430
10538
  }
10431
10539
  ),
10432
- /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: imageSidebarClass, children: [
10433
- activeTab === "crop" && /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
10434
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { className: imageSectionTitleClass, children: "Aspect Ratio Presets" }),
10435
- /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "grid grid-cols-3 gap-2", children: [
10436
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
10540
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: imageSidebarClass, children: [
10541
+ activeTab === "crop" && /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
10542
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: imageSectionTitleClass, children: "Aspect Ratio Presets" }),
10543
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "grid grid-cols-3 gap-2", children: [
10544
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10437
10545
  "button",
10438
10546
  {
10439
10547
  type: "button",
@@ -10445,7 +10553,7 @@ var ImageEditor = ({
10445
10553
  children: "Freeform"
10446
10554
  }
10447
10555
  ),
10448
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
10556
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10449
10557
  "button",
10450
10558
  {
10451
10559
  type: "button",
@@ -10457,7 +10565,7 @@ var ImageEditor = ({
10457
10565
  children: "1:1 Square"
10458
10566
  }
10459
10567
  ),
10460
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
10568
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10461
10569
  "button",
10462
10570
  {
10463
10571
  type: "button",
@@ -10469,7 +10577,7 @@ var ImageEditor = ({
10469
10577
  children: "4:3 Standard"
10470
10578
  }
10471
10579
  ),
10472
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
10580
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10473
10581
  "button",
10474
10582
  {
10475
10583
  type: "button",
@@ -10481,7 +10589,7 @@ var ImageEditor = ({
10481
10589
  children: "16:9 Wide"
10482
10590
  }
10483
10591
  ),
10484
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
10592
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10485
10593
  "button",
10486
10594
  {
10487
10595
  type: "button",
@@ -10493,7 +10601,7 @@ var ImageEditor = ({
10493
10601
  children: "3:2 Photo"
10494
10602
  }
10495
10603
  ),
10496
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
10604
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10497
10605
  "button",
10498
10606
  {
10499
10607
  type: "button",
@@ -10506,10 +10614,10 @@ var ImageEditor = ({
10506
10614
  }
10507
10615
  )
10508
10616
  ] }),
10509
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: imageDividerClass }),
10510
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { className: imageSectionTitleClass, children: "Orientation & Flips" }),
10511
- /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "grid grid-cols-2 gap-2", children: [
10512
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
10617
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: imageDividerClass }),
10618
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: imageSectionTitleClass, children: "Orientation & Flips" }),
10619
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "grid grid-cols-2 gap-2", children: [
10620
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10513
10621
  "button",
10514
10622
  {
10515
10623
  type: "button",
@@ -10518,7 +10626,7 @@ var ImageEditor = ({
10518
10626
  children: "Rotate -90\xB0"
10519
10627
  }
10520
10628
  ),
10521
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
10629
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10522
10630
  "button",
10523
10631
  {
10524
10632
  type: "button",
@@ -10527,7 +10635,7 @@ var ImageEditor = ({
10527
10635
  children: "Rotate +90\xB0"
10528
10636
  }
10529
10637
  ),
10530
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
10638
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10531
10639
  "button",
10532
10640
  {
10533
10641
  type: "button",
@@ -10536,7 +10644,7 @@ var ImageEditor = ({
10536
10644
  children: "Flip Horizontal"
10537
10645
  }
10538
10646
  ),
10539
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
10647
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10540
10648
  "button",
10541
10649
  {
10542
10650
  type: "button",
@@ -10547,10 +10655,10 @@ var ImageEditor = ({
10547
10655
  )
10548
10656
  ] })
10549
10657
  ] }),
10550
- activeTab === "adjust" && /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
10551
- /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex items-center justify-between", children: [
10552
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { className: imageSectionTitleClass, children: "Color Adjustments" }),
10553
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
10658
+ activeTab === "adjust" && /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
10659
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex items-center justify-between", children: [
10660
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: imageSectionTitleClass, children: "Color Adjustments" }),
10661
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10554
10662
  "button",
10555
10663
  {
10556
10664
  type: "button",
@@ -10560,25 +10668,25 @@ var ImageEditor = ({
10560
10668
  }
10561
10669
  )
10562
10670
  ] }),
10563
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Histogram, { histogram: editor.histogram }),
10564
- import_image_editor22.IMAGE_ADJUSTMENT_CONTROLS.map((spec) => /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_react69.default.Fragment, { children: [
10565
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
10671
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Histogram, { histogram: editor.histogram }),
10672
+ import_image_editor23.IMAGE_ADJUSTMENT_CONTROLS.map((spec) => /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(import_react70.default.Fragment, { children: [
10673
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10566
10674
  ControlSlider,
10567
10675
  {
10568
10676
  spec,
10569
- value: (0, import_image_editor22.readAdjustmentControls)(state.adjustments)[spec.id],
10677
+ value: (0, import_image_editor23.readAdjustmentControls)(state.adjustments)[spec.id],
10570
10678
  disabled: spec.requiresProcess !== void 0 && legacyProcess,
10571
10679
  onChange: (v) => editor.setAdjustments({ [spec.id]: v })
10572
10680
  }
10573
10681
  ),
10574
- spec.id === "tint" && legacyProcess && /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
10682
+ spec.id === "tint" && legacyProcess && /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(
10575
10683
  "div",
10576
10684
  {
10577
10685
  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",
10578
10686
  "data-testid": "image-editor-process-notice",
10579
10687
  children: [
10580
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { children: "Legacy rendering (process 1). Tint needs the current process." }),
10581
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
10688
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { children: "Legacy rendering (process 1). Tint needs the current process." }),
10689
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10582
10690
  "button",
10583
10691
  {
10584
10692
  type: "button",
@@ -10591,7 +10699,7 @@ var ImageEditor = ({
10591
10699
  }
10592
10700
  )
10593
10701
  ] }, spec.id)),
10594
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: imageSectionClass, children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
10702
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: imageSectionClass, children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10595
10703
  AdjustmentLayersPanel,
10596
10704
  {
10597
10705
  controller,
@@ -10600,9 +10708,9 @@ var ImageEditor = ({
10600
10708
  }
10601
10709
  ) })
10602
10710
  ] }),
10603
- activeTab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
10604
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { className: imageSectionTitleClass, children: "Layers" }),
10605
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
10711
+ activeTab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
10712
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: imageSectionTitleClass, children: "Layers" }),
10713
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10606
10714
  "button",
10607
10715
  {
10608
10716
  type: "button",
@@ -10613,15 +10721,15 @@ var ImageEditor = ({
10613
10721
  children: "Free Transform"
10614
10722
  }
10615
10723
  ),
10616
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(LayersPanel, { controller }),
10617
- effectsShown && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(ImageProviderEffectsPanel, { controller, className: imageSectionClass }),
10618
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { className: imageSectionTitleClass, children: "Colour" }),
10619
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(ColorProfilePanel, { controller })
10724
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(LayersPanel, { controller }),
10725
+ effectsShown && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(ImageProviderEffectsPanel, { controller, className: imageSectionClass }),
10726
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: imageSectionTitleClass, children: "Colour" }),
10727
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(ColorProfilePanel, { controller })
10620
10728
  ] }),
10621
- activeTab === "paint" && /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
10622
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { className: imageSectionTitleClass, children: "Paint" }),
10623
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(BrushOptionsBar, { controller }),
10624
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
10729
+ activeTab === "paint" && /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
10730
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: imageSectionTitleClass, children: "Paint" }),
10731
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(BrushOptionsBar, { controller }),
10732
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10625
10733
  "button",
10626
10734
  {
10627
10735
  type: "button",
@@ -10632,12 +10740,12 @@ var ImageEditor = ({
10632
10740
  children: "Free Transform"
10633
10741
  }
10634
10742
  ),
10635
- paintError && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("p", { role: "alert", className: "text-destructive", "data-testid": "paint-error", children: paintError }),
10636
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: imageSectionClass, children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(LayersPanel, { controller }) })
10743
+ paintError && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("p", { role: "alert", className: "text-destructive", "data-testid": "paint-error", children: paintError }),
10744
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: imageSectionClass, children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(LayersPanel, { controller }) })
10637
10745
  ] }),
10638
- activeTab === "annotate" && /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
10639
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { className: imageSectionTitleClass, children: "Shape & Type Layers" }),
10640
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "grid grid-cols-2 gap-1.5", children: ["shape", "type"].map((t) => /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
10746
+ activeTab === "annotate" && /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
10747
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: imageSectionTitleClass, children: "Shape & Type Layers" }),
10748
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: "grid grid-cols-2 gap-1.5", children: ["shape", "type"].map((t) => /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10641
10749
  "button",
10642
10750
  {
10643
10751
  type: "button",
@@ -10648,13 +10756,13 @@ var ImageEditor = ({
10648
10756
  },
10649
10757
  t
10650
10758
  )) }),
10651
- state.activeTool === "shape" && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(ShapeOptionsBar, { controller, options: shapeOptions, onChange: setShapeOptions }),
10652
- state.activeTool === "type" && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(TypeOptionsBar, { controller, options: typeOptions, onChange: setTypeOptions, session: typeSession }),
10653
- state.activeTool === "type" && typeSession && /* @__PURE__ */ (0, import_jsx_runtime49.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" }),
10654
- shapeTypeError && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("p", { role: "alert", className: "text-destructive", "data-testid": "shape-type-error", children: shapeTypeError }),
10655
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: imageDividerClass }),
10656
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { className: imageSectionTitleClass, children: "Draw & Annotate" }),
10657
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "grid grid-cols-3 gap-1.5", children: ["pen", "rect", "circle", "arrow", "line"].map((t) => /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
10759
+ state.activeTool === "shape" && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(ShapeOptionsBar, { controller, options: shapeOptions, onChange: setShapeOptions }),
10760
+ state.activeTool === "type" && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(TypeOptionsBar, { controller, options: typeOptions, onChange: setTypeOptions, session: typeSession }),
10761
+ state.activeTool === "type" && typeSession && /* @__PURE__ */ (0, import_jsx_runtime50.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" }),
10762
+ shapeTypeError && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("p", { role: "alert", className: "text-destructive", "data-testid": "shape-type-error", children: shapeTypeError }),
10763
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: imageDividerClass }),
10764
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: imageSectionTitleClass, children: "Draw & Annotate" }),
10765
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: "grid grid-cols-3 gap-1.5", children: ["pen", "rect", "circle", "arrow", "line"].map((t) => /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10658
10766
  "button",
10659
10767
  {
10660
10768
  type: "button",
@@ -10664,18 +10772,18 @@ var ImageEditor = ({
10664
10772
  },
10665
10773
  t
10666
10774
  )) }),
10667
- /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex items-center gap-2 mt-2", children: [
10668
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("label", { className: "text-muted-foreground", children: "Color:" }),
10669
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(ImageColor, { label: "Annotation colour", value: activeColor, onChange: setActiveColor }),
10670
- /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex-1 ml-2", children: [
10671
- /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-0.5", children: [
10672
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { children: "Width:" }),
10673
- /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("span", { className: "font-mono", children: [
10775
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex items-center gap-2 mt-2", children: [
10776
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("label", { className: "text-muted-foreground", children: "Color:" }),
10777
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(ImageColor, { label: "Annotation colour", value: activeColor, onChange: setActiveColor }),
10778
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex-1 ml-2", children: [
10779
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-0.5", children: [
10780
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { children: "Width:" }),
10781
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("span", { className: "font-mono", children: [
10674
10782
  strokeWidth,
10675
10783
  "px"
10676
10784
  ] })
10677
10785
  ] }),
10678
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
10786
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10679
10787
  "input",
10680
10788
  {
10681
10789
  type: "range",
@@ -10688,10 +10796,10 @@ var ImageEditor = ({
10688
10796
  )
10689
10797
  ] })
10690
10798
  ] }),
10691
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: imageDividerClass }),
10692
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { className: imageSectionTitleClass, children: "Add Text" }),
10693
- /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex gap-2", children: [
10694
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
10799
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: imageDividerClass }),
10800
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: imageSectionTitleClass, children: "Add Text" }),
10801
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex gap-2", children: [
10802
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10695
10803
  "input",
10696
10804
  {
10697
10805
  type: "text",
@@ -10702,7 +10810,7 @@ var ImageEditor = ({
10702
10810
  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"
10703
10811
  }
10704
10812
  ),
10705
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
10813
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10706
10814
  "button",
10707
10815
  {
10708
10816
  type: "button",
@@ -10712,14 +10820,14 @@ var ImageEditor = ({
10712
10820
  }
10713
10821
  )
10714
10822
  ] }),
10715
- /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex items-center justify-between text-muted-foreground", children: [
10716
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { children: "Font Size:" }),
10717
- /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("span", { className: "font-mono", children: [
10823
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex items-center justify-between text-muted-foreground", children: [
10824
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { children: "Font Size:" }),
10825
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("span", { className: "font-mono", children: [
10718
10826
  fontSize,
10719
10827
  "px"
10720
10828
  ] })
10721
10829
  ] }),
10722
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
10830
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10723
10831
  "input",
10724
10832
  {
10725
10833
  type: "range",
@@ -10730,14 +10838,14 @@ var ImageEditor = ({
10730
10838
  className: imageRangeClass
10731
10839
  }
10732
10840
  ),
10733
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: imageDividerClass }),
10734
- /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex items-center justify-between", children: [
10735
- /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("span", { className: "text-muted-foreground", children: [
10841
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: imageDividerClass }),
10842
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex items-center justify-between", children: [
10843
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("span", { className: "text-muted-foreground", children: [
10736
10844
  "Layers (",
10737
10845
  state.annotations.length,
10738
10846
  ")"
10739
10847
  ] }),
10740
- state.selectedAnnotationId && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
10848
+ state.selectedAnnotationId && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10741
10849
  "button",
10742
10850
  {
10743
10851
  type: "button",
@@ -10746,7 +10854,7 @@ var ImageEditor = ({
10746
10854
  children: "Delete Selected"
10747
10855
  }
10748
10856
  ),
10749
- state.annotations.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
10857
+ state.annotations.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10750
10858
  "button",
10751
10859
  {
10752
10860
  type: "button",
@@ -10757,10 +10865,10 @@ var ImageEditor = ({
10757
10865
  )
10758
10866
  ] })
10759
10867
  ] }),
10760
- activeTab === "depth" && /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
10761
- /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex items-center justify-between", children: [
10762
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { className: imageSectionTitleClass, children: "Depth Masking" }),
10763
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
10868
+ activeTab === "depth" && /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
10869
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex items-center justify-between", children: [
10870
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: imageSectionTitleClass, children: "Depth Masking" }),
10871
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10764
10872
  "button",
10765
10873
  {
10766
10874
  type: "button",
@@ -10770,8 +10878,8 @@ var ImageEditor = ({
10770
10878
  }
10771
10879
  )
10772
10880
  ] }),
10773
- /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("label", { className: "flex items-center gap-2 cursor-pointer text-foreground", children: [
10774
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
10881
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("label", { className: "flex items-center gap-2 cursor-pointer text-foreground", children: [
10882
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10775
10883
  "input",
10776
10884
  {
10777
10885
  type: "checkbox",
@@ -10780,12 +10888,12 @@ var ImageEditor = ({
10780
10888
  className: "rounded accent-primary"
10781
10889
  }
10782
10890
  ),
10783
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { children: "Enable Depth / Alpha Mask" })
10891
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { children: "Enable Depth / Alpha Mask" })
10784
10892
  ] }),
10785
- state.depthMask.enabled && /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_jsx_runtime49.Fragment, { children: [
10786
- /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { children: [
10787
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("label", { className: "text-muted-foreground block mb-1", children: "Mask Image URL:" }),
10788
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
10893
+ state.depthMask.enabled && /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(import_jsx_runtime50.Fragment, { children: [
10894
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { children: [
10895
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("label", { className: "text-muted-foreground block mb-1", children: "Mask Image URL:" }),
10896
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10789
10897
  "input",
10790
10898
  {
10791
10899
  type: "text",
@@ -10796,8 +10904,8 @@ var ImageEditor = ({
10796
10904
  }
10797
10905
  )
10798
10906
  ] }),
10799
- /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex gap-2", children: [
10800
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
10907
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex gap-2", children: [
10908
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10801
10909
  "button",
10802
10910
  {
10803
10911
  type: "button",
@@ -10806,7 +10914,7 @@ var ImageEditor = ({
10806
10914
  children: "Threshold Mode"
10807
10915
  }
10808
10916
  ),
10809
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
10917
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10810
10918
  "button",
10811
10919
  {
10812
10920
  type: "button",
@@ -10816,12 +10924,12 @@ var ImageEditor = ({
10816
10924
  }
10817
10925
  )
10818
10926
  ] }),
10819
- /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { children: [
10820
- /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
10821
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { children: "Depth Start (Lower):" }),
10822
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { className: "font-mono", children: state.depthMask.depthRange[0] })
10927
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { children: [
10928
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
10929
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { children: "Depth Start (Lower):" }),
10930
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: "font-mono", children: state.depthMask.depthRange[0] })
10823
10931
  ] }),
10824
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
10932
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10825
10933
  "input",
10826
10934
  {
10827
10935
  type: "range",
@@ -10835,12 +10943,12 @@ var ImageEditor = ({
10835
10943
  }
10836
10944
  )
10837
10945
  ] }),
10838
- /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { children: [
10839
- /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
10840
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { children: "Depth Stop (Upper):" }),
10841
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { className: "font-mono", children: state.depthMask.depthRange[1] })
10946
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { children: [
10947
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
10948
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { children: "Depth Stop (Upper):" }),
10949
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: "font-mono", children: state.depthMask.depthRange[1] })
10842
10950
  ] }),
10843
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
10951
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10844
10952
  "input",
10845
10953
  {
10846
10954
  type: "range",
@@ -10854,12 +10962,12 @@ var ImageEditor = ({
10854
10962
  }
10855
10963
  )
10856
10964
  ] }),
10857
- /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { children: [
10858
- /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
10859
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { children: "Softness:" }),
10860
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { className: "font-mono", children: state.depthMask.softness })
10965
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { children: [
10966
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
10967
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { children: "Softness:" }),
10968
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: "font-mono", children: state.depthMask.softness })
10861
10969
  ] }),
10862
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
10970
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10863
10971
  "input",
10864
10972
  {
10865
10973
  type: "range",
@@ -10871,8 +10979,8 @@ var ImageEditor = ({
10871
10979
  }
10872
10980
  )
10873
10981
  ] }),
10874
- /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("label", { className: "flex items-center gap-2 cursor-pointer text-foreground mt-1", children: [
10875
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
10982
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("label", { className: "flex items-center gap-2 cursor-pointer text-foreground mt-1", children: [
10983
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10876
10984
  "input",
10877
10985
  {
10878
10986
  type: "checkbox",
@@ -10881,12 +10989,12 @@ var ImageEditor = ({
10881
10989
  className: "rounded accent-primary"
10882
10990
  }
10883
10991
  ),
10884
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { children: "Invert Mask" })
10992
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { children: "Invert Mask" })
10885
10993
  ] })
10886
10994
  ] })
10887
10995
  ] }),
10888
- activeTab === "select" && /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
10889
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
10996
+ activeTab === "select" && /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
10997
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10890
10998
  SelectionOptionsBar,
10891
10999
  {
10892
11000
  controller,
@@ -10897,9 +11005,9 @@ var ImageEditor = ({
10897
11005
  selectionDisplay: state.selectionDisplay
10898
11006
  }
10899
11007
  ),
10900
- selectionError && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("p", { role: "alert", className: "text-destructive", children: selectionError }),
10901
- /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex gap-1", children: [
10902
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
11008
+ selectionError && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("p", { role: "alert", className: "text-destructive", children: selectionError }),
11009
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex gap-1", children: [
11010
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10903
11011
  "button",
10904
11012
  {
10905
11013
  type: "button",
@@ -10910,7 +11018,7 @@ var ImageEditor = ({
10910
11018
  children: "Transform Selection"
10911
11019
  }
10912
11020
  ),
10913
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
11021
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10914
11022
  "button",
10915
11023
  {
10916
11024
  type: "button",
@@ -10922,13 +11030,14 @@ var ImageEditor = ({
10922
11030
  }
10923
11031
  )
10924
11032
  ] }),
10925
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(RefineEdgePanel, { controller, selection: state.selection ?? null, layers: state.adjustments.layers }),
10926
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(ChannelsPanel, { controller })
11033
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(RefineEdgePanel, { controller, selection: state.selection ?? null, layers: state.adjustments.layers }),
11034
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(ChannelsPanel, { controller }),
11035
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(PathsPanel, { controller })
10927
11036
  ] }),
10928
- activeTab === "ai" && /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
10929
- /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("label", { className: "flex items-center justify-between gap-2 text-foreground", children: [
10930
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { children: "Results go to" }),
10931
- /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
11037
+ activeTab === "ai" && /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
11038
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("label", { className: "flex items-center justify-between gap-2 text-foreground", children: [
11039
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { children: "Results go to" }),
11040
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(
10932
11041
  "select",
10933
11042
  {
10934
11043
  "aria-label": "AI result target",
@@ -10936,54 +11045,54 @@ var ImageEditor = ({
10936
11045
  onChange: (e) => setAiTarget(e.target.value),
10937
11046
  className: imageSelectClass,
10938
11047
  children: [
10939
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("option", { value: "auto", children: controller.isMultiLayer ? "Auto (new layer)" : "Auto (replace image)" }),
10940
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("option", { value: "new-layer", children: "New layer / mask" }),
10941
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("option", { value: "replace", children: "Replace image" })
11048
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("option", { value: "auto", children: controller.isMultiLayer ? "Auto (new layer)" : "Auto (replace image)" }),
11049
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("option", { value: "new-layer", children: "New layer / mask" }),
11050
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("option", { value: "replace", children: "Replace image" })
10942
11051
  ]
10943
11052
  }
10944
11053
  )
10945
11054
  ] }),
10946
- /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
10947
- /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex items-center justify-between", children: [
10948
- /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
10949
- /* @__PURE__ */ (0, import_jsx_runtime49.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_runtime49.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" }) }),
11055
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
11056
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex items-center justify-between", children: [
11057
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
11058
+ /* @__PURE__ */ (0, import_jsx_runtime50.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_runtime50.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" }) }),
10950
11059
  "Background Removal"
10951
11060
  ] }),
10952
- isRemovingBg && /* @__PURE__ */ (0, import_jsx_runtime49.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..." })
11061
+ isRemovingBg && /* @__PURE__ */ (0, import_jsx_runtime50.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..." })
10953
11062
  ] }),
10954
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Isolate foreground subject with AI alpha transparency segmentation." }),
10955
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
11063
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Isolate foreground subject with AI alpha transparency segmentation." }),
11064
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10956
11065
  "button",
10957
11066
  {
10958
11067
  type: "button",
10959
11068
  onClick: handleRemoveBackground,
10960
11069
  disabled: isRemovingBg || isInpainting,
10961
11070
  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",
10962
- children: isRemovingBg ? /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_jsx_runtime49.Fragment, { children: [
10963
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: imageSpinnerClass }),
11071
+ children: isRemovingBg ? /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(import_jsx_runtime50.Fragment, { children: [
11072
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: imageSpinnerClass }),
10964
11073
  "Removing Background..."
10965
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_jsx_runtime49.Fragment, { children: [
10966
- /* @__PURE__ */ (0, import_jsx_runtime49.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_runtime49.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" }) }),
11074
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(import_jsx_runtime50.Fragment, { children: [
11075
+ /* @__PURE__ */ (0, import_jsx_runtime50.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_runtime50.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" }) }),
10967
11076
  "Remove Background"
10968
11077
  ] })
10969
11078
  }
10970
11079
  )
10971
11080
  ] }),
10972
- /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
10973
- /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex items-center justify-between", children: [
10974
- /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
10975
- /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("svg", { className: "w-3.5 h-3.5 text-primary", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
10976
- /* @__PURE__ */ (0, import_jsx_runtime49.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" }),
10977
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("path", { d: "m14 7 3 3" })
11081
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
11082
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex items-center justify-between", children: [
11083
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
11084
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("svg", { className: "w-3.5 h-3.5 text-primary", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
11085
+ /* @__PURE__ */ (0, import_jsx_runtime50.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" }),
11086
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("path", { d: "m14 7 3 3" })
10978
11087
  ] }),
10979
11088
  "Generative Inpainting"
10980
11089
  ] }),
10981
- isInpainting && /* @__PURE__ */ (0, import_jsx_runtime49.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..." })
11090
+ isInpainting && /* @__PURE__ */ (0, import_jsx_runtime50.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..." })
10982
11091
  ] }),
10983
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Replace, modify, or fill selected regions using prompt-guided generative inpainting." }),
10984
- /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex flex-col gap-1", children: [
10985
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("label", { htmlFor: "ai-inpaint-prompt-react", className: "text-foreground text-[11px] font-medium", children: "Prompt" }),
10986
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
11092
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Replace, modify, or fill selected regions using prompt-guided generative inpainting." }),
11093
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex flex-col gap-1", children: [
11094
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("label", { htmlFor: "ai-inpaint-prompt-react", className: "text-foreground text-[11px] font-medium", children: "Prompt" }),
11095
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10987
11096
  "textarea",
10988
11097
  {
10989
11098
  id: "ai-inpaint-prompt-react",
@@ -10995,10 +11104,10 @@ var ImageEditor = ({
10995
11104
  }
10996
11105
  )
10997
11106
  ] }),
10998
- /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex flex-col gap-1", children: [
10999
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { className: "text-foreground text-[11px] font-medium", children: "Target Mask Region" }),
11000
- /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "grid grid-cols-2 gap-1.5", children: [
11001
- /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
11107
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex flex-col gap-1", children: [
11108
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: "text-foreground text-[11px] font-medium", children: "Target Mask Region" }),
11109
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "grid grid-cols-2 gap-1.5", children: [
11110
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(
11002
11111
  "button",
11003
11112
  {
11004
11113
  type: "button",
@@ -11011,7 +11120,7 @@ var ImageEditor = ({
11011
11120
  ]
11012
11121
  }
11013
11122
  ),
11014
- /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
11123
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(
11015
11124
  "button",
11016
11125
  {
11017
11126
  type: "button",
@@ -11026,25 +11135,25 @@ var ImageEditor = ({
11026
11135
  )
11027
11136
  ] })
11028
11137
  ] }),
11029
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
11138
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
11030
11139
  "button",
11031
11140
  {
11032
11141
  type: "button",
11033
11142
  onClick: handleInpaint,
11034
11143
  disabled: isInpainting || isRemovingBg || !inpaintPrompt.trim(),
11035
11144
  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",
11036
- children: isInpainting ? /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_jsx_runtime49.Fragment, { children: [
11037
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: imageSpinnerClass }),
11145
+ children: isInpainting ? /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(import_jsx_runtime50.Fragment, { children: [
11146
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: imageSpinnerClass }),
11038
11147
  "Generating Inpaint..."
11039
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_jsx_runtime49.Fragment, { children: [
11040
- /* @__PURE__ */ (0, import_jsx_runtime49.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_runtime49.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" }) }),
11148
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(import_jsx_runtime50.Fragment, { children: [
11149
+ /* @__PURE__ */ (0, import_jsx_runtime50.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_runtime50.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" }) }),
11041
11150
  "Apply Inpainting"
11042
11151
  ] })
11043
11152
  }
11044
11153
  )
11045
11154
  ] }),
11046
- aiError && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "p-2.5 rounded-lg bg-destructive/10 border border-destructive/40 text-destructive text-[11px]", children: aiError }),
11047
- aiSuccess && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "p-2.5 rounded-lg bg-emerald-500/10 border border-emerald-500/30 text-emerald-600 text-[11px]", children: aiSuccess })
11155
+ aiError && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: "p-2.5 rounded-lg bg-destructive/10 border border-destructive/40 text-destructive text-[11px]", children: aiError }),
11156
+ aiSuccess && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: "p-2.5 rounded-lg bg-emerald-500/10 border border-emerald-500/30 text-emerald-600 text-[11px]", children: aiSuccess })
11048
11157
  ] })
11049
11158
  ] })
11050
11159
  ] })
@@ -11054,7 +11163,7 @@ var ImageEditor = ({
11054
11163
  };
11055
11164
 
11056
11165
  // src/review/useReview.ts
11057
- var import_react70 = require("react");
11166
+ var import_react71 = require("react");
11058
11167
  var import_editor13 = require("@pixerate/editor");
11059
11168
  var EMPTY_COMMENTS = Object.freeze({
11060
11169
  threads: [],
@@ -11073,23 +11182,23 @@ function isCommentStore(value) {
11073
11182
  }
11074
11183
  function useComments(source) {
11075
11184
  const store = isCommentStore(source) ? source : (0, import_editor13.getCommentStore)(source);
11076
- const subscribe = (0, import_react70.useCallback)(
11185
+ const subscribe = (0, import_react71.useCallback)(
11077
11186
  (onChange) => store ? store.subscribe(() => onChange()) : noopUnsubscribe,
11078
11187
  [store]
11079
11188
  );
11080
11189
  const getSnapshot2 = () => store?.getSnapshot() ?? EMPTY_COMMENTS;
11081
- const snapshot = (0, import_react70.useSyncExternalStore)(subscribe, getSnapshot2, getSnapshot2);
11082
- return (0, import_react70.useMemo)(() => ({ ...snapshot, store }), [snapshot, store]);
11190
+ const snapshot = (0, import_react71.useSyncExternalStore)(subscribe, getSnapshot2, getSnapshot2);
11191
+ return (0, import_react71.useMemo)(() => ({ ...snapshot, store }), [snapshot, store]);
11083
11192
  }
11084
11193
  function useTrackChanges(editor) {
11085
11194
  const store = (0, import_editor13.getTrackChangesStore)(editor ?? null);
11086
- const subscribe = (0, import_react70.useCallback)(
11195
+ const subscribe = (0, import_react71.useCallback)(
11087
11196
  (onChange) => store ? store.subscribe(() => onChange()) : noopUnsubscribe,
11088
11197
  [store]
11089
11198
  );
11090
11199
  const getSnapshot2 = () => store?.getSnapshot() ?? EMPTY_TRACK_CHANGES;
11091
- const snapshot = (0, import_react70.useSyncExternalStore)(subscribe, getSnapshot2, getSnapshot2);
11092
- return (0, import_react70.useMemo)(() => {
11200
+ const snapshot = (0, import_react71.useSyncExternalStore)(subscribe, getSnapshot2, getSnapshot2);
11201
+ return (0, import_react71.useMemo)(() => {
11093
11202
  const run = (fn) => () => {
11094
11203
  if (editor && !editor.isDestroyed) fn(editor);
11095
11204
  };
@@ -11112,9 +11221,9 @@ function useTrackChanges(editor) {
11112
11221
  }
11113
11222
 
11114
11223
  // src/review/CommentsPanel.tsx
11115
- var import_react71 = require("react");
11224
+ var import_react72 = require("react");
11116
11225
  var import_editor14 = require("@pixerate/editor");
11117
- var import_jsx_runtime50 = require("react/jsx-runtime");
11226
+ var import_jsx_runtime51 = require("react/jsx-runtime");
11118
11227
  var buttonClass2 = "rounded px-2 py-1 text-xs text-muted-foreground hover:bg-muted hover:text-foreground disabled:opacity-50";
11119
11228
  var primaryButtonClass = "rounded px-2 py-1 text-xs bg-primary/10 text-primary hover:bg-primary/20 disabled:opacity-50";
11120
11229
  var textareaClass = "w-full resize-y rounded-md border border-input bg-background p-2 text-sm text-foreground focus:outline-none focus:ring-2 focus:ring-primary";
@@ -11128,18 +11237,18 @@ var CommentsPanel = ({
11128
11237
  emptyMessage = "No comments yet. Select text and add a comment."
11129
11238
  }) => {
11130
11239
  const { threads, activeThreadId, store } = useComments(storeProp ?? editor);
11131
- const [showResolved, setShowResolved] = (0, import_react71.useState)(showResolvedInitial);
11240
+ const [showResolved, setShowResolved] = (0, import_react72.useState)(showResolvedInitial);
11132
11241
  const author = authorProp ?? (0, import_editor14.getCommentAuthor)(editor) ?? { id: "anonymous", name: "Anonymous" };
11133
11242
  const visible = threads.filter((t) => showResolved || !t.resolved);
11134
11243
  const resolvedCount = threads.filter((t) => t.resolved).length;
11135
- return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("aside", { className, "aria-label": "Comments", children: [
11136
- /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex items-center justify-between gap-2", children: [
11137
- /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("span", { className: "text-xs font-medium text-muted-foreground", children: [
11244
+ return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("aside", { className, "aria-label": "Comments", children: [
11245
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "flex items-center justify-between gap-2", children: [
11246
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("span", { className: "text-xs font-medium text-muted-foreground", children: [
11138
11247
  threads.length - resolvedCount,
11139
11248
  " open",
11140
11249
  resolvedCount > 0 ? ` \xB7 ${resolvedCount} resolved` : ""
11141
11250
  ] }),
11142
- resolvedCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
11251
+ resolvedCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
11143
11252
  "button",
11144
11253
  {
11145
11254
  type: "button",
@@ -11150,7 +11259,7 @@ var CommentsPanel = ({
11150
11259
  }
11151
11260
  )
11152
11261
  ] }),
11153
- visible.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("p", { className: "text-xs text-muted-foreground", children: emptyMessage }) : /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("ul", { className: "flex flex-col gap-2", role: "list", children: visible.map((thread) => /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
11262
+ visible.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("p", { className: "text-xs text-muted-foreground", children: emptyMessage }) : /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("ul", { className: "flex flex-col gap-2", role: "list", children: visible.map((thread) => /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
11154
11263
  CommentThreadCard,
11155
11264
  {
11156
11265
  thread,
@@ -11172,7 +11281,7 @@ var CommentThreadCard = ({
11172
11281
  author,
11173
11282
  formatTime
11174
11283
  }) => {
11175
- const [draft, setDraft] = (0, import_react71.useState)("");
11284
+ const [draft, setDraft] = (0, import_react72.useState)("");
11176
11285
  const isDraft = thread.body === "";
11177
11286
  const quote = thread.anchor?.quote ?? thread.lastQuote ?? "";
11178
11287
  const live = editor && !editor.isDestroyed ? editor : null;
@@ -11198,7 +11307,7 @@ var CommentThreadCard = ({
11198
11307
  setDraft("");
11199
11308
  };
11200
11309
  const stop = (e) => e.stopPropagation();
11201
- return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(
11310
+ return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(
11202
11311
  "li",
11203
11312
  {
11204
11313
  className: `flex flex-col gap-2 rounded-md border bg-background p-3 cursor-pointer ${active ? "border-primary ring-1 ring-primary" : "border-border"} ${thread.resolved ? "opacity-70" : ""}`,
@@ -11214,24 +11323,24 @@ var CommentThreadCard = ({
11214
11323
  }
11215
11324
  },
11216
11325
  children: [
11217
- /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex items-baseline justify-between gap-2", children: [
11218
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: "font-medium", children: thread.author.name }),
11219
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: "text-xs text-muted-foreground", children: formatTime(thread.createdAt) })
11326
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "flex items-baseline justify-between gap-2", children: [
11327
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { className: "font-medium", children: thread.author.name }),
11328
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { className: "text-xs text-muted-foreground", children: formatTime(thread.createdAt) })
11220
11329
  ] }),
11221
- quote && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("blockquote", { className: "border-l-2 border-border pl-2 text-xs text-muted-foreground line-clamp-2", children: quote }),
11222
- thread.orphaned && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: "text-xs text-destructive", children: "The commented text was deleted." }),
11223
- thread.resolved && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: "text-xs text-muted-foreground", children: "Resolved" }),
11224
- !isDraft && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("p", { className: "whitespace-pre-wrap break-words", children: thread.body }),
11225
- thread.replies.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("ul", { className: "flex flex-col gap-2 border-l border-border pl-3", role: "list", children: thread.replies.map((reply) => /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("li", { className: "flex flex-col gap-0.5", "data-reply-id": reply.id, children: [
11226
- /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("span", { className: "text-xs", children: [
11227
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: "font-medium", children: reply.author.name }),
11330
+ quote && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("blockquote", { className: "border-l-2 border-border pl-2 text-xs text-muted-foreground line-clamp-2", children: quote }),
11331
+ thread.orphaned && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { className: "text-xs text-destructive", children: "The commented text was deleted." }),
11332
+ thread.resolved && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { className: "text-xs text-muted-foreground", children: "Resolved" }),
11333
+ !isDraft && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("p", { className: "whitespace-pre-wrap break-words", children: thread.body }),
11334
+ thread.replies.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("ul", { className: "flex flex-col gap-2 border-l border-border pl-3", role: "list", children: thread.replies.map((reply) => /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("li", { className: "flex flex-col gap-0.5", "data-reply-id": reply.id, children: [
11335
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("span", { className: "text-xs", children: [
11336
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { className: "font-medium", children: reply.author.name }),
11228
11337
  " ",
11229
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: "text-muted-foreground", children: formatTime(reply.createdAt) })
11338
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { className: "text-muted-foreground", children: formatTime(reply.createdAt) })
11230
11339
  ] }),
11231
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("p", { className: "whitespace-pre-wrap break-words", children: reply.body })
11340
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("p", { className: "whitespace-pre-wrap break-words", children: reply.body })
11232
11341
  ] }, reply.id)) }),
11233
- (active || isDraft) && !thread.resolved && /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex flex-col gap-1", onClick: stop, children: [
11234
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
11342
+ (active || isDraft) && !thread.resolved && /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "flex flex-col gap-1", onClick: stop, children: [
11343
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
11235
11344
  "textarea",
11236
11345
  {
11237
11346
  className: textareaClass,
@@ -11249,9 +11358,9 @@ var CommentThreadCard = ({
11249
11358
  }
11250
11359
  }
11251
11360
  ),
11252
- /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex justify-end gap-1", children: [
11253
- isDraft && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("button", { type: "button", className: buttonClass2, onClick: remove, children: "Cancel" }),
11254
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
11361
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "flex justify-end gap-1", children: [
11362
+ isDraft && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("button", { type: "button", className: buttonClass2, onClick: remove, children: "Cancel" }),
11363
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
11255
11364
  "button",
11256
11365
  {
11257
11366
  type: "button",
@@ -11263,9 +11372,9 @@ var CommentThreadCard = ({
11263
11372
  )
11264
11373
  ] })
11265
11374
  ] }),
11266
- !isDraft && /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex justify-end gap-1", onClick: stop, children: [
11267
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("button", { type: "button", className: buttonClass2, onClick: () => setResolved(!thread.resolved), children: thread.resolved ? "Reopen" : "Resolve" }),
11268
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
11375
+ !isDraft && /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "flex justify-end gap-1", onClick: stop, children: [
11376
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("button", { type: "button", className: buttonClass2, onClick: () => setResolved(!thread.resolved), children: thread.resolved ? "Reopen" : "Resolve" }),
11377
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
11269
11378
  "button",
11270
11379
  {
11271
11380
  type: "button",
@@ -11281,7 +11390,7 @@ var CommentThreadCard = ({
11281
11390
  };
11282
11391
 
11283
11392
  // src/review/ReviewToolbar.tsx
11284
- var import_jsx_runtime51 = require("react/jsx-runtime");
11393
+ var import_jsx_runtime52 = require("react/jsx-runtime");
11285
11394
  var defaultDescriptionClass = "max-w-[16rem] truncate px-1 text-xs text-muted-foreground";
11286
11395
  var buttonClass3 = "rounded px-2 py-1 text-xs text-foreground hover:bg-muted disabled:opacity-40 disabled:hover:bg-transparent";
11287
11396
  var ReviewToolbar = ({
@@ -11294,8 +11403,8 @@ var ReviewToolbar = ({
11294
11403
  const count = review.changes.length;
11295
11404
  const current = review.currentChange;
11296
11405
  const index = current ? review.changes.findIndex((c) => c.id === current.id) + 1 : 0;
11297
- return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className, role: "toolbar", "aria-label": "Review", children: [
11298
- /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
11406
+ return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className, role: "toolbar", "aria-label": "Review", children: [
11407
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
11299
11408
  "button",
11300
11409
  {
11301
11410
  type: "button",
@@ -11306,8 +11415,8 @@ var ReviewToolbar = ({
11306
11415
  children: review.enabled ? "Tracking on" : "Track changes"
11307
11416
  }
11308
11417
  ),
11309
- /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { className: "mx-1 h-4 w-px bg-border", "aria-hidden": "true" }),
11310
- /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
11418
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { className: "mx-1 h-4 w-px bg-border", "aria-hidden": "true" }),
11419
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
11311
11420
  "button",
11312
11421
  {
11313
11422
  type: "button",
@@ -11318,8 +11427,8 @@ var ReviewToolbar = ({
11318
11427
  children: "\u2039"
11319
11428
  }
11320
11429
  ),
11321
- /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { className: "min-w-[4rem] text-center text-xs text-muted-foreground", "aria-live": "polite", children: count === 0 ? "No changes" : current ? `${index} of ${count}` : `${count} changes` }),
11322
- /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
11430
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { className: "min-w-[4rem] text-center text-xs text-muted-foreground", "aria-live": "polite", children: count === 0 ? "No changes" : current ? `${index} of ${count}` : `${count} changes` }),
11431
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
11323
11432
  "button",
11324
11433
  {
11325
11434
  type: "button",
@@ -11330,7 +11439,7 @@ var ReviewToolbar = ({
11330
11439
  children: "\u203A"
11331
11440
  }
11332
11441
  ),
11333
- showDescription && current && /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(
11442
+ showDescription && current && /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(
11334
11443
  "span",
11335
11444
  {
11336
11445
  className: descriptionClassName,
@@ -11342,8 +11451,8 @@ var ReviewToolbar = ({
11342
11451
  ]
11343
11452
  }
11344
11453
  ),
11345
- /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { className: "mx-1 h-4 w-px bg-border", "aria-hidden": "true" }),
11346
- /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
11454
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { className: "mx-1 h-4 w-px bg-border", "aria-hidden": "true" }),
11455
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
11347
11456
  "button",
11348
11457
  {
11349
11458
  type: "button",
@@ -11353,7 +11462,7 @@ var ReviewToolbar = ({
11353
11462
  children: "Accept"
11354
11463
  }
11355
11464
  ),
11356
- /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
11465
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
11357
11466
  "button",
11358
11467
  {
11359
11468
  type: "button",
@@ -11363,18 +11472,18 @@ var ReviewToolbar = ({
11363
11472
  children: "Reject"
11364
11473
  }
11365
11474
  ),
11366
- /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("button", { type: "button", className: buttonClass3, disabled: count === 0, onClick: review.acceptAll, children: "Accept all" }),
11367
- /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("button", { type: "button", className: buttonClass3, disabled: count === 0, onClick: review.rejectAll, children: "Reject all" })
11475
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("button", { type: "button", className: buttonClass3, disabled: count === 0, onClick: review.acceptAll, children: "Accept all" }),
11476
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("button", { type: "button", className: buttonClass3, disabled: count === 0, onClick: review.rejectAll, children: "Reject all" })
11368
11477
  ] });
11369
11478
  };
11370
11479
 
11371
11480
  // src/review/CommentButton.tsx
11372
- var import_jsx_runtime52 = require("react/jsx-runtime");
11481
+ var import_jsx_runtime53 = require("react/jsx-runtime");
11373
11482
  var CommentButton = ({
11374
11483
  editor,
11375
11484
  className = "rounded px-2 py-1 text-xs text-popover-foreground hover:bg-muted",
11376
11485
  children = "Comment"
11377
- }) => /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
11486
+ }) => /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
11378
11487
  "button",
11379
11488
  {
11380
11489
  type: "button",
@@ -11386,13 +11495,13 @@ var CommentButton = ({
11386
11495
  );
11387
11496
 
11388
11497
  // src/review/useDocumentCompare.ts
11389
- var import_react72 = require("react");
11498
+ var import_react73 = require("react");
11390
11499
  var import_editor15 = require("@pixerate/editor");
11391
11500
  function useDocumentCompare(editor, options) {
11392
- const [summary, setSummary] = (0, import_react72.useState)(null);
11393
- const defaults = (0, import_react72.useRef)(options);
11501
+ const [summary, setSummary] = (0, import_react73.useState)(null);
11502
+ const defaults = (0, import_react73.useRef)(options);
11394
11503
  defaults.current = options;
11395
- const compare = (0, import_react72.useCallback)(
11504
+ const compare = (0, import_react73.useCallback)(
11396
11505
  (original, revised, overrides) => {
11397
11506
  if (!editor || editor.isDestroyed) return null;
11398
11507
  const result = (0, import_editor15.applyDocumentComparison)(editor, original, revised, {
@@ -11404,13 +11513,13 @@ function useDocumentCompare(editor, options) {
11404
11513
  },
11405
11514
  [editor]
11406
11515
  );
11407
- const clear = (0, import_react72.useCallback)(() => setSummary(null), []);
11408
- return (0, import_react72.useMemo)(() => ({ summary, compare, clear }), [summary, compare, clear]);
11516
+ const clear = (0, import_react73.useCallback)(() => setSummary(null), []);
11517
+ return (0, import_react73.useMemo)(() => ({ summary, compare, clear }), [summary, compare, clear]);
11409
11518
  }
11410
11519
 
11411
11520
  // src/review/TrackedChangesList.tsx
11412
11521
  var import_editor16 = require("@pixerate/editor");
11413
- var import_jsx_runtime53 = require("react/jsx-runtime");
11522
+ var import_jsx_runtime54 = require("react/jsx-runtime");
11414
11523
  var buttonClass4 = "rounded px-1.5 py-0.5 text-xs text-foreground hover:bg-muted disabled:opacity-40";
11415
11524
  var TrackedChangesList = ({
11416
11525
  editor,
@@ -11421,18 +11530,18 @@ var TrackedChangesList = ({
11421
11530
  }) => {
11422
11531
  const review = useTrackChanges(editor);
11423
11532
  if (review.changes.length === 0) {
11424
- return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className, "data-tracked-changes-list": "", children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: "pixerate-changes-empty text-xs text-muted-foreground", children: emptyState }) });
11533
+ return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className, "data-tracked-changes-list": "", children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "pixerate-changes-empty text-xs text-muted-foreground", children: emptyState }) });
11425
11534
  }
11426
- return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("ul", { className, role: "list", "aria-label": "Tracked changes", "data-tracked-changes-list": "", children: review.changes.map((change) => {
11535
+ return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("ul", { className, role: "list", "aria-label": "Tracked changes", "data-tracked-changes-list": "", children: review.changes.map((change) => {
11427
11536
  const active = change.id === review.currentChangeId;
11428
- return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(
11537
+ return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
11429
11538
  "li",
11430
11539
  {
11431
11540
  className: active ? `${itemClassName} ${activeItemClassName}` : itemClassName,
11432
11541
  "data-change-type": change.type,
11433
11542
  "data-change-id": change.id,
11434
11543
  children: [
11435
- /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(
11544
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
11436
11545
  "button",
11437
11546
  {
11438
11547
  type: "button",
@@ -11440,14 +11549,14 @@ var TrackedChangesList = ({
11440
11549
  title: `${change.author.name}: ${change.description}`,
11441
11550
  onClick: () => review.select(change.id),
11442
11551
  children: [
11443
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: "font-medium", children: (0, import_editor16.trackedChangeLabel)(change) }),
11552
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "font-medium", children: (0, import_editor16.trackedChangeLabel)(change) }),
11444
11553
  change.author.name ? ` \xB7 ${change.author.name}` : "",
11445
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: "block truncate text-muted-foreground", children: change.description })
11554
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "block truncate text-muted-foreground", children: change.description })
11446
11555
  ]
11447
11556
  }
11448
11557
  ),
11449
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("button", { type: "button", className: buttonClass4, onClick: () => review.accept(change.id), children: "Accept" }),
11450
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("button", { type: "button", className: buttonClass4, onClick: () => review.reject(change.id), children: "Reject" })
11558
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("button", { type: "button", className: buttonClass4, onClick: () => review.accept(change.id), children: "Accept" }),
11559
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("button", { type: "button", className: buttonClass4, onClick: () => review.reject(change.id), children: "Reject" })
11451
11560
  ]
11452
11561
  },
11453
11562
  `${change.type}:${change.id}`
@@ -11456,12 +11565,12 @@ var TrackedChangesList = ({
11456
11565
  };
11457
11566
 
11458
11567
  // src/commands/useCommandPalette.ts
11459
- var import_react73 = require("react");
11568
+ var import_react74 = require("react");
11460
11569
  var import_commands2 = require("@pixerate/editor/commands");
11461
11570
  function useCommandPalette(registry, options = {}) {
11462
- const optionsRef = (0, import_react73.useRef)(options);
11571
+ const optionsRef = (0, import_react74.useRef)(options);
11463
11572
  optionsRef.current = options;
11464
- const controller = (0, import_react73.useMemo)(
11573
+ const controller = (0, import_react74.useMemo)(
11465
11574
  () => (0, import_commands2.createCommandPaletteController)(registry, {
11466
11575
  context: () => {
11467
11576
  const c = optionsRef.current.context;
@@ -11482,9 +11591,9 @@ function useCommandPalette(registry, options = {}) {
11482
11591
  // eslint-disable-next-line react-hooks/exhaustive-deps
11483
11592
  [registry]
11484
11593
  );
11485
- const state = (0, import_react73.useSyncExternalStore)(controller.subscribe, controller.getState, controller.getState);
11594
+ const state = (0, import_react74.useSyncExternalStore)(controller.subscribe, controller.getState, controller.getState);
11486
11595
  const { hotkey, hotkeyTarget } = options;
11487
- (0, import_react73.useEffect)(() => {
11596
+ (0, import_react74.useEffect)(() => {
11488
11597
  if (!hotkey) return;
11489
11598
  const target = hotkeyTarget ?? (typeof window !== "undefined" ? window : null);
11490
11599
  if (!target) return;
@@ -11512,13 +11621,13 @@ function useCommandPalette(registry, options = {}) {
11512
11621
  }
11513
11622
 
11514
11623
  // src/commands/CommandPalette.tsx
11515
- var import_react74 = __toESM(require("react"), 1);
11516
- var import_jsx_runtime54 = require("react/jsx-runtime");
11624
+ var import_react75 = __toESM(require("react"), 1);
11625
+ var import_jsx_runtime55 = require("react/jsx-runtime");
11517
11626
  function HighlightedLabel({ item }) {
11518
- if (item.labelIndices.length === 0) return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_jsx_runtime54.Fragment, { children: item.label });
11627
+ if (item.labelIndices.length === 0) return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_jsx_runtime55.Fragment, { children: item.label });
11519
11628
  const marked = new Set(item.labelIndices);
11520
- return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_jsx_runtime54.Fragment, { children: Array.from(item.label).map(
11521
- (ch, i) => marked.has(i) ? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "font-semibold text-foreground", "data-match": "", children: ch }, i) : /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_react74.default.Fragment, { children: ch }, i)
11629
+ return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_jsx_runtime55.Fragment, { children: Array.from(item.label).map(
11630
+ (ch, i) => marked.has(i) ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "font-semibold text-foreground", "data-match": "", children: ch }, i) : /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_react75.default.Fragment, { children: ch }, i)
11522
11631
  ) });
11523
11632
  }
11524
11633
  var CommandPalette = ({
@@ -11527,22 +11636,22 @@ var CommandPalette = ({
11527
11636
  emptyMessage = "No matching commands",
11528
11637
  className = ""
11529
11638
  }) => {
11530
- const inputRef = (0, import_react74.useRef)(null);
11531
- const listRef = (0, import_react74.useRef)(null);
11532
- const baseId = (0, import_react74.useId)();
11639
+ const inputRef = (0, import_react75.useRef)(null);
11640
+ const listRef = (0, import_react75.useRef)(null);
11641
+ const baseId = (0, import_react75.useId)();
11533
11642
  const listId = `${baseId}-list`;
11534
11643
  const optionId = (index) => `${baseId}-option-${index}`;
11535
11644
  const { open, query, items, activeIndex } = palette;
11536
- (0, import_react74.useEffect)(() => {
11645
+ (0, import_react75.useEffect)(() => {
11537
11646
  if (open) inputRef.current?.focus();
11538
11647
  }, [open]);
11539
- (0, import_react74.useEffect)(() => {
11648
+ (0, import_react75.useEffect)(() => {
11540
11649
  if (!open) return;
11541
11650
  const active = listRef.current?.querySelector('[aria-selected="true"]');
11542
11651
  active?.scrollIntoView?.({ block: "nearest" });
11543
11652
  }, [open, activeIndex]);
11544
11653
  if (!open) return null;
11545
- return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
11654
+ return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
11546
11655
  "div",
11547
11656
  {
11548
11657
  className: "fixed inset-0 z-50 flex items-start justify-center bg-black/30 px-4 pt-[15vh]",
@@ -11550,7 +11659,7 @@ var CommandPalette = ({
11550
11659
  onMouseDown: (e) => {
11551
11660
  if (e.target === e.currentTarget) palette.setOpen(false);
11552
11661
  },
11553
- children: /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
11662
+ children: /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(
11554
11663
  "div",
11555
11664
  {
11556
11665
  role: "dialog",
@@ -11559,7 +11668,7 @@ var CommandPalette = ({
11559
11668
  className: `w-full max-w-lg overflow-hidden rounded-lg border border-border bg-popover text-popover-foreground shadow-xl ${className}`,
11560
11669
  style: { background: "var(--popover, var(--background, #fff))" },
11561
11670
  children: [
11562
- /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
11671
+ /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
11563
11672
  "input",
11564
11673
  {
11565
11674
  ref: inputRef,
@@ -11579,7 +11688,7 @@ var CommandPalette = ({
11579
11688
  className: "w-full border-b border-border bg-transparent px-3 py-2 text-sm outline-none placeholder:text-muted-foreground"
11580
11689
  }
11581
11690
  ),
11582
- items.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "px-3 py-6 text-center text-sm text-muted-foreground", children: emptyMessage }) : /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("ul", { ref: listRef, id: listId, role: "listbox", "aria-label": "Commands", className: "max-h-80 overflow-y-auto py-1", children: items.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
11691
+ items.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: "px-3 py-6 text-center text-sm text-muted-foreground", children: emptyMessage }) : /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("ul", { ref: listRef, id: listId, role: "listbox", "aria-label": "Commands", className: "max-h-80 overflow-y-auto py-1", children: items.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(
11583
11692
  "li",
11584
11693
  {
11585
11694
  id: optionId(index),
@@ -11594,12 +11703,12 @@ var CommandPalette = ({
11594
11703
  onClick: () => palette.run(item.id),
11595
11704
  className: `flex cursor-pointer items-center gap-2 px-3 py-1.5 text-sm ${index === activeIndex ? "bg-muted" : ""} ${item.enabled ? "" : "cursor-default opacity-50"}`,
11596
11705
  children: [
11597
- /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("span", { className: "min-w-0 flex-1 truncate", children: [
11598
- /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(HighlightedLabel, { item }),
11599
- item.disabledReason && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "ml-2 text-xs text-muted-foreground", "data-disabled-reason": "", children: item.disabledReason })
11706
+ /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("span", { className: "min-w-0 flex-1 truncate", children: [
11707
+ /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(HighlightedLabel, { item }),
11708
+ item.disabledReason && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "ml-2 text-xs text-muted-foreground", "data-disabled-reason": "", children: item.disabledReason })
11600
11709
  ] }),
11601
- item.group && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "shrink-0 text-xs text-muted-foreground", children: item.group }),
11602
- item.shortcut && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("kbd", { className: "shrink-0 rounded border border-border px-1.5 font-mono text-[10px] text-muted-foreground", children: item.shortcut })
11710
+ item.group && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "shrink-0 text-xs text-muted-foreground", children: item.group }),
11711
+ item.shortcut && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("kbd", { className: "shrink-0 rounded border border-border px-1.5 font-mono text-[10px] text-muted-foreground", children: item.shortcut })
11603
11712
  ]
11604
11713
  },
11605
11714
  item.id
@@ -11612,12 +11721,12 @@ var CommandPalette = ({
11612
11721
  };
11613
11722
 
11614
11723
  // src/commands/useCommandShortcuts.ts
11615
- var import_react75 = require("react");
11724
+ var import_react76 = require("react");
11616
11725
  function useCommandShortcuts(registry, options = {}) {
11617
- const optionsRef = (0, import_react75.useRef)(options);
11726
+ const optionsRef = (0, import_react76.useRef)(options);
11618
11727
  optionsRef.current = options;
11619
11728
  const { enabled = true, target } = options;
11620
- (0, import_react75.useEffect)(() => {
11729
+ (0, import_react76.useEffect)(() => {
11621
11730
  if (!registry || !enabled) return;
11622
11731
  const eventTarget = target ?? (typeof window !== "undefined" ? window : null);
11623
11732
  if (!eventTarget) return;
@@ -11635,14 +11744,14 @@ function useCommandShortcuts(registry, options = {}) {
11635
11744
  }, [registry, enabled, target]);
11636
11745
  }
11637
11746
  function useRegisterCommands(registry, specs) {
11638
- (0, import_react75.useEffect)(() => {
11747
+ (0, import_react76.useEffect)(() => {
11639
11748
  if (!registry || !specs || specs.length === 0) return;
11640
11749
  return registry.register(specs);
11641
11750
  }, [registry, specs]);
11642
11751
  }
11643
11752
 
11644
11753
  // src/persistence/useAutosave.ts
11645
- var import_react76 = require("react");
11754
+ var import_react77 = require("react");
11646
11755
  var import_persistence = require("@pixerate/editor/persistence");
11647
11756
  var IDLE = {
11648
11757
  status: "idle",
@@ -11653,18 +11762,18 @@ var IDLE = {
11653
11762
  ready: false
11654
11763
  };
11655
11764
  function useAutosave(options) {
11656
- const optionsRef = (0, import_react76.useRef)(options);
11765
+ const optionsRef = (0, import_react77.useRef)(options);
11657
11766
  optionsRef.current = options;
11658
11767
  const { storage, key, history, dirty } = options;
11659
11768
  const recover = options.recover !== false;
11660
11769
  const flushOnHide = options.flushOnHide !== false;
11661
11770
  const ready = options.ready !== false;
11662
- const [controller, setController] = (0, import_react76.useState)(null);
11663
- const [status, setStatus] = (0, import_react76.useState)(IDLE);
11664
- const [recovery, setRecovery] = (0, import_react76.useState)(null);
11665
- const [pendingRecovery, setPendingRecovery] = (0, import_react76.useState)(recover);
11666
- const revisionsRef = (0, import_react76.useRef)(null);
11667
- (0, import_react76.useEffect)(() => {
11771
+ const [controller, setController] = (0, import_react77.useState)(null);
11772
+ const [status, setStatus] = (0, import_react77.useState)(IDLE);
11773
+ const [recovery, setRecovery] = (0, import_react77.useState)(null);
11774
+ const [pendingRecovery, setPendingRecovery] = (0, import_react77.useState)(recover);
11775
+ const revisionsRef = (0, import_react77.useRef)(null);
11776
+ (0, import_react77.useEffect)(() => {
11668
11777
  const revisions = (0, import_persistence.createRevisionTracker)({ history, dirty });
11669
11778
  const o = optionsRef.current;
11670
11779
  const instance = (0, import_persistence.createAutosaveController)({
@@ -11707,10 +11816,10 @@ function useAutosave(options) {
11707
11816
  if (revisionsRef.current === revisions) revisionsRef.current = null;
11708
11817
  };
11709
11818
  }, [storage, key, history, dirty, recover]);
11710
- (0, import_react76.useEffect)(() => {
11819
+ (0, import_react77.useEffect)(() => {
11711
11820
  if (controller && ready && !pendingRecovery) controller.ready();
11712
11821
  }, [controller, ready, pendingRecovery]);
11713
- (0, import_react76.useEffect)(() => {
11822
+ (0, import_react77.useEffect)(() => {
11714
11823
  if (!controller || !flushOnHide || typeof window === "undefined") return;
11715
11824
  const flush = () => void controller.flushNow();
11716
11825
  const onVisibility = () => {
@@ -11723,33 +11832,33 @@ function useAutosave(options) {
11723
11832
  document.removeEventListener("visibilitychange", onVisibility);
11724
11833
  };
11725
11834
  }, [controller, flushOnHide]);
11726
- const restore = (0, import_react76.useCallback)(() => {
11835
+ const restore = (0, import_react77.useCallback)(() => {
11727
11836
  const snapshot = recovery?.snapshot;
11728
11837
  setRecovery(null);
11729
11838
  setPendingRecovery(false);
11730
11839
  return snapshot;
11731
11840
  }, [recovery]);
11732
- const discard = (0, import_react76.useCallback)(async () => {
11841
+ const discard = (0, import_react77.useCallback)(async () => {
11733
11842
  if (controller) await controller.discardRecovery();
11734
11843
  setRecovery(null);
11735
11844
  setPendingRecovery(false);
11736
11845
  }, [controller]);
11737
- const flushNow = (0, import_react76.useCallback)(async () => {
11846
+ const flushNow = (0, import_react77.useCallback)(async () => {
11738
11847
  await controller?.flushNow();
11739
11848
  }, [controller]);
11740
- const markClean = (0, import_react76.useCallback)(async () => {
11849
+ const markClean = (0, import_react77.useCallback)(async () => {
11741
11850
  revisionsRef.current?.markSaved();
11742
11851
  await controller?.markClean();
11743
11852
  }, [controller]);
11744
- const notifyChange = (0, import_react76.useCallback)(() => revisionsRef.current?.bump(), []);
11853
+ const notifyChange = (0, import_react77.useCallback)(() => revisionsRef.current?.bump(), []);
11745
11854
  return { status, recovery, pendingRecovery, restore, discard, flushNow, markClean, notifyChange, controller };
11746
11855
  }
11747
11856
 
11748
11857
  // src/persistence/useEditorAutosave.ts
11749
- var import_react77 = require("react");
11858
+ var import_react78 = require("react");
11750
11859
  var import_persistence2 = require("@pixerate/editor/persistence");
11751
11860
  function useEditorAutosave(doc, { collectAssetGarbage, ...options }) {
11752
- const storage = (0, import_react77.useMemo)(
11861
+ const storage = (0, import_react78.useMemo)(
11753
11862
  () => doc.assets ? (0, import_persistence2.withEditorAssets)(options.storage, doc.assets) : options.storage,
11754
11863
  [options.storage, doc.assets]
11755
11864
  );
@@ -11762,19 +11871,19 @@ function useEditorAutosave(doc, { collectAssetGarbage, ...options }) {
11762
11871
  history: doc
11763
11872
  });
11764
11873
  const take = autosave.restore;
11765
- const restore = (0, import_react77.useCallback)(() => {
11874
+ const restore = (0, import_react78.useCallback)(() => {
11766
11875
  const snapshot = take();
11767
11876
  return snapshot ? doc.loadDocument(snapshot, { history: "reset" }) : void 0;
11768
11877
  }, [take, doc]);
11769
11878
  const { markClean: clean, discard: drop } = autosave;
11770
11879
  const rawStorage = options.storage;
11771
- const gcRef = (0, import_react77.useRef)(collectAssetGarbage);
11880
+ const gcRef = (0, import_react78.useRef)(collectAssetGarbage);
11772
11881
  gcRef.current = collectAssetGarbage;
11773
- const markClean = (0, import_react77.useCallback)(async () => {
11882
+ const markClean = (0, import_react78.useCallback)(async () => {
11774
11883
  await clean();
11775
11884
  await (0, import_persistence2.collectRetiredEditorAssets)(rawStorage, doc, gcRef.current);
11776
11885
  }, [clean, rawStorage, doc]);
11777
- const discard = (0, import_react77.useCallback)(async () => {
11886
+ const discard = (0, import_react78.useCallback)(async () => {
11778
11887
  await drop();
11779
11888
  await (0, import_persistence2.collectRetiredEditorAssets)(rawStorage, doc, gcRef.current);
11780
11889
  }, [drop, rawStorage, doc]);
@@ -11783,7 +11892,7 @@ function useEditorAutosave(doc, { collectAssetGarbage, ...options }) {
11783
11892
 
11784
11893
  // src/persistence/RecoveryPrompt.tsx
11785
11894
  var import_persistence3 = require("@pixerate/editor/persistence");
11786
- var import_jsx_runtime55 = require("react/jsx-runtime");
11895
+ var import_jsx_runtime56 = require("react/jsx-runtime");
11787
11896
  var RecoveryPrompt = ({
11788
11897
  recovery,
11789
11898
  onRestore,
@@ -11795,7 +11904,7 @@ var RecoveryPrompt = ({
11795
11904
  }) => {
11796
11905
  if (!recovery) return null;
11797
11906
  const { name } = recovery.meta;
11798
- return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(
11907
+ return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
11799
11908
  "div",
11800
11909
  {
11801
11910
  role: "alertdialog",
@@ -11803,15 +11912,15 @@ var RecoveryPrompt = ({
11803
11912
  "data-recovery-prompt": "",
11804
11913
  className: `flex flex-wrap items-center gap-3 rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground shadow-sm ${className}`,
11805
11914
  children: [
11806
- /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("span", { className: "min-w-0 flex-1", children: [
11915
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("span", { className: "min-w-0 flex-1", children: [
11807
11916
  (0, import_persistence3.formatRecoveryMessage)(recovery.meta, formatTime),
11808
- name ? /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("span", { className: "ml-1 text-xs text-muted-foreground", children: [
11917
+ name ? /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("span", { className: "ml-1 text-xs text-muted-foreground", children: [
11809
11918
  "(",
11810
11919
  name,
11811
11920
  ")"
11812
11921
  ] }) : null
11813
11922
  ] }),
11814
- /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
11923
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
11815
11924
  "button",
11816
11925
  {
11817
11926
  type: "button",
@@ -11821,7 +11930,7 @@ var RecoveryPrompt = ({
11821
11930
  children: restoreLabel
11822
11931
  }
11823
11932
  ),
11824
- /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
11933
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
11825
11934
  "button",
11826
11935
  {
11827
11936
  type: "button",
@@ -11837,17 +11946,17 @@ var RecoveryPrompt = ({
11837
11946
  };
11838
11947
 
11839
11948
  // src/generation/useGenerationPlan.ts
11840
- var import_react78 = require("react");
11949
+ var import_react79 = require("react");
11841
11950
  var import_generation = require("@pixerate/editor/generation");
11842
11951
  function useGenerationPlan(request, capabilities, options = {}) {
11843
11952
  const key = JSON.stringify([request, capabilities, options]);
11844
- return (0, import_react78.useMemo)(() => (0, import_generation.planGenerationRequest)(request, capabilities, options), [key]);
11953
+ return (0, import_react79.useMemo)(() => (0, import_generation.planGenerationRequest)(request, capabilities, options), [key]);
11845
11954
  }
11846
11955
  function useJobProgress(options) {
11847
11956
  const { startedAt, expectedMs, done, now, intervalMs = 1e3 } = options;
11848
- const [tick, setTick] = (0, import_react78.useState)(() => Date.now());
11957
+ const [tick, setTick] = (0, import_react79.useState)(() => Date.now());
11849
11958
  const ticking = !done && now === void 0;
11850
- (0, import_react78.useEffect)(() => {
11959
+ (0, import_react79.useEffect)(() => {
11851
11960
  if (!ticking) return;
11852
11961
  setTick(Date.now());
11853
11962
  const id = setInterval(() => setTick(Date.now()), Math.max(16, intervalMs));
@@ -11857,9 +11966,9 @@ function useJobProgress(options) {
11857
11966
  }
11858
11967
 
11859
11968
  // src/generation/GenerationSettings.tsx
11860
- var import_react79 = require("react");
11969
+ var import_react80 = require("react");
11861
11970
  var import_generation2 = require("@pixerate/editor/generation");
11862
- var import_jsx_runtime56 = require("react/jsx-runtime");
11971
+ var import_jsx_runtime57 = require("react/jsx-runtime");
11863
11972
  var inputClass2 = "w-full rounded-md border border-border bg-background px-2 py-1 text-sm outline-none focus:ring-1 focus:ring-ring";
11864
11973
  function Control({
11865
11974
  control,
@@ -11869,7 +11978,7 @@ function Control({
11869
11978
  }) {
11870
11979
  const shown = value ?? control.defaultValue;
11871
11980
  if (control.kind === "checkbox") {
11872
- return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
11981
+ return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
11873
11982
  "input",
11874
11983
  {
11875
11984
  id,
@@ -11881,7 +11990,7 @@ function Control({
11881
11990
  );
11882
11991
  }
11883
11992
  if (control.kind === "select") {
11884
- return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
11993
+ return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(
11885
11994
  "select",
11886
11995
  {
11887
11996
  id,
@@ -11890,14 +11999,14 @@ function Control({
11890
11999
  value: shown === void 0 ? "" : String(shown),
11891
12000
  onChange: (e) => onValue((0, import_generation2.parseControlValue)(control, e.target.value)),
11892
12001
  children: [
11893
- shown === void 0 && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("option", { value: "", children: "Default" }),
11894
- control.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("option", { value: String(option.value), children: option.label }, String(option.value)))
12002
+ shown === void 0 && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("option", { value: "", children: "Default" }),
12003
+ control.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("option", { value: String(option.value), children: option.label }, String(option.value)))
11895
12004
  ]
11896
12005
  }
11897
12006
  );
11898
12007
  }
11899
12008
  if (control.kind === "textarea") {
11900
- return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
12009
+ return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
11901
12010
  "textarea",
11902
12011
  {
11903
12012
  id,
@@ -11911,8 +12020,8 @@ function Control({
11911
12020
  );
11912
12021
  }
11913
12022
  const numeric = typeof shown === "number" ? shown : void 0;
11914
- return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: "flex items-center gap-2", children: [
11915
- /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
12023
+ return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: "flex items-center gap-2", children: [
12024
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
11916
12025
  "input",
11917
12026
  {
11918
12027
  id,
@@ -11926,7 +12035,7 @@ function Control({
11926
12035
  onChange: (e) => onValue((0, import_generation2.parseControlValue)(control, e.target.value))
11927
12036
  }
11928
12037
  ),
11929
- control.kind === "range" && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { className: "w-10 text-right tabular-nums text-muted-foreground", "data-field-value": "", children: numeric ?? "\u2013" })
12038
+ control.kind === "range" && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("span", { className: "w-10 text-right tabular-nums text-muted-foreground", "data-field-value": "", children: numeric ?? "\u2013" })
11930
12039
  ] });
11931
12040
  }
11932
12041
  var GenerationSettings = ({
@@ -11940,17 +12049,17 @@ var GenerationSettings = ({
11940
12049
  renderReference,
11941
12050
  className = ""
11942
12051
  }) => {
11943
- const baseId = (0, import_react79.useId)();
11944
- const controls = (0, import_react79.useMemo)(() => (0, import_generation2.getGenerationControls)(capabilities), [capabilities]);
12052
+ const baseId = (0, import_react80.useId)();
12053
+ const controls = (0, import_react80.useMemo)(() => (0, import_generation2.getGenerationControls)(capabilities), [capabilities]);
11945
12054
  const computed = useGenerationPlan(value, capabilities, { strategy });
11946
12055
  const plan = planProp ?? computed;
11947
12056
  const slots = (0, import_generation2.getReferenceSlots)(capabilities, value);
11948
- return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: `flex flex-col gap-3 text-sm ${className}`, "data-generation-settings": "", "data-model": capabilities.id, children: [
12057
+ return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: `flex flex-col gap-3 text-sm ${className}`, "data-generation-settings": "", "data-model": capabilities.id, children: [
11949
12058
  controls.map((control) => {
11950
12059
  const id = `${baseId}-${control.key}`;
11951
- return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: "flex flex-col gap-1", "data-control": control.key, children: [
11952
- /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("label", { htmlFor: id, className: "text-xs font-medium text-muted-foreground", title: control.description, children: control.label }),
11953
- /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
12060
+ return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: "flex flex-col gap-1", "data-control": control.key, children: [
12061
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("label", { htmlFor: id, className: "text-xs font-medium text-muted-foreground", title: control.description, children: control.label }),
12062
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
11954
12063
  Control,
11955
12064
  {
11956
12065
  control,
@@ -11961,23 +12070,23 @@ var GenerationSettings = ({
11961
12070
  )
11962
12071
  ] }, control.key);
11963
12072
  }),
11964
- slots.map((slot) => /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("fieldset", { className: "flex flex-col gap-1", "data-reference-role": slot.role, children: [
11965
- /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("legend", { className: "text-xs font-medium text-muted-foreground", title: slot.description, children: [
12073
+ slots.map((slot) => /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("fieldset", { className: "flex flex-col gap-1", "data-reference-role": slot.role, children: [
12074
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("legend", { className: "text-xs font-medium text-muted-foreground", title: slot.description, children: [
11966
12075
  slot.label,
11967
12076
  " ",
11968
- /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("span", { className: "tabular-nums", "data-reference-count": "", children: [
12077
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("span", { className: "tabular-nums", "data-reference-count": "", children: [
11969
12078
  "(",
11970
12079
  slot.references.length,
11971
12080
  "/",
11972
12081
  slot.max,
11973
12082
  ")"
11974
12083
  ] }),
11975
- slot.min > 0 && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { className: "text-destructive", children: " *" })
12084
+ slot.min > 0 && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("span", { className: "text-destructive", children: " *" })
11976
12085
  ] }),
11977
- /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("ul", { className: "flex flex-wrap gap-1", children: [
11978
- slot.references.map((ref) => /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("li", { className: "flex items-center gap-1 rounded border border-border px-1.5 py-0.5", "data-reference-id": ref.id, children: [
11979
- renderReference ? renderReference(ref) : /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { className: "max-w-[10rem] truncate", children: ref.id }),
11980
- /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
12086
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("ul", { className: "flex flex-wrap gap-1", children: [
12087
+ slot.references.map((ref) => /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("li", { className: "flex items-center gap-1 rounded border border-border px-1.5 py-0.5", "data-reference-id": ref.id, children: [
12088
+ renderReference ? renderReference(ref) : /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("span", { className: "max-w-[10rem] truncate", children: ref.id }),
12089
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
11981
12090
  "button",
11982
12091
  {
11983
12092
  type: "button",
@@ -11988,7 +12097,7 @@ var GenerationSettings = ({
11988
12097
  }
11989
12098
  )
11990
12099
  ] }, ref.id)),
11991
- onAddReference && slot.canAdd && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
12100
+ onAddReference && slot.canAdd && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
11992
12101
  "button",
11993
12102
  {
11994
12103
  type: "button",
@@ -11999,21 +12108,21 @@ var GenerationSettings = ({
11999
12108
  ) })
12000
12109
  ] })
12001
12110
  ] }, slot.role)),
12002
- showAdjustments && plan.adjustments.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("ul", { role: "status", className: "flex flex-col gap-0.5 text-xs text-muted-foreground", "data-generation-adjustments": "", children: plan.adjustments.map((adjustment, index) => /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("li", { "data-adjustment-field": adjustment.field, "data-adjustment-kind": adjustment.kind, children: adjustment.reason }, index)) }),
12003
- showAdjustments && plan.errors.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("ul", { role: "alert", className: "flex flex-col gap-0.5 text-xs text-destructive", "data-generation-errors": "", children: plan.errors.map((error, index) => /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("li", { "data-error-field": error.field, children: error.message }, index)) })
12111
+ showAdjustments && plan.adjustments.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("ul", { role: "status", className: "flex flex-col gap-0.5 text-xs text-muted-foreground", "data-generation-adjustments": "", children: plan.adjustments.map((adjustment, index) => /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("li", { "data-adjustment-field": adjustment.field, "data-adjustment-kind": adjustment.kind, children: adjustment.reason }, index)) }),
12112
+ showAdjustments && plan.errors.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("ul", { role: "alert", className: "flex flex-col gap-0.5 text-xs text-destructive", "data-generation-errors": "", children: plan.errors.map((error, index) => /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("li", { "data-error-field": error.field, children: error.message }, index)) })
12004
12113
  ] });
12005
12114
  };
12006
12115
 
12007
12116
  // src/generation/JobProgress.tsx
12008
- var import_jsx_runtime57 = require("react/jsx-runtime");
12117
+ var import_jsx_runtime58 = require("react/jsx-runtime");
12009
12118
  var JobProgress = ({ title, className = "", ...options }) => {
12010
12119
  const progress = useJobProgress(options);
12011
- return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: `flex flex-col gap-1 text-sm ${className}`, "data-job-progress": "", "data-done": options.done ? "" : void 0, children: [
12012
- /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: "flex items-center justify-between gap-2 text-muted-foreground", children: [
12013
- title && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("span", { className: "truncate text-foreground", children: title }),
12014
- /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("span", { "data-job-progress-label": "", "aria-live": "polite", children: progress.label })
12120
+ return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: `flex flex-col gap-1 text-sm ${className}`, "data-job-progress": "", "data-done": options.done ? "" : void 0, children: [
12121
+ /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: "flex items-center justify-between gap-2 text-muted-foreground", children: [
12122
+ title && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { className: "truncate text-foreground", children: title }),
12123
+ /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { "data-job-progress-label": "", "aria-live": "polite", children: progress.label })
12015
12124
  ] }),
12016
- /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
12125
+ /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
12017
12126
  "div",
12018
12127
  {
12019
12128
  role: "progressbar",
@@ -12023,7 +12132,7 @@ var JobProgress = ({ title, className = "", ...options }) => {
12023
12132
  "aria-valuenow": progress.percent,
12024
12133
  "aria-valuetext": `${progress.percent}%, ${progress.label}`,
12025
12134
  className: "h-1.5 w-full overflow-hidden rounded-full bg-muted",
12026
- children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
12135
+ children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
12027
12136
  "div",
12028
12137
  {
12029
12138
  className: "h-full rounded-full bg-primary transition-[width] duration-500",
@@ -12036,9 +12145,9 @@ var JobProgress = ({ title, className = "", ...options }) => {
12036
12145
  };
12037
12146
 
12038
12147
  // src/generation/AssetMentionChips.tsx
12039
- var import_react80 = require("react");
12148
+ var import_react81 = require("react");
12040
12149
  var import_generation3 = require("@pixerate/editor/generation");
12041
- var import_jsx_runtime58 = require("react/jsx-runtime");
12150
+ var import_jsx_runtime59 = require("react/jsx-runtime");
12042
12151
  var AssetMentionChips = ({
12043
12152
  content,
12044
12153
  onChange,
@@ -12048,14 +12157,14 @@ var AssetMentionChips = ({
12048
12157
  renderAsset,
12049
12158
  className = ""
12050
12159
  }) => {
12051
- const [open, setOpen] = (0, import_react80.useState)(null);
12052
- const rootRef = (0, import_react80.useRef)(null);
12053
- const chips = (0, import_react80.useMemo)(
12160
+ const [open, setOpen] = (0, import_react81.useState)(null);
12161
+ const rootRef = (0, import_react81.useRef)(null);
12162
+ const chips = (0, import_react81.useMemo)(
12054
12163
  () => (0, import_generation3.describeAssetMentions)((0, import_generation3.findTextMentions)(content), assets, capabilities),
12055
12164
  [content, assets, capabilities]
12056
12165
  );
12057
12166
  const options = roles ?? (capabilities ? (0, import_generation3.getAssetRoleOptions)(capabilities) : (0, import_generation3.defaultAssetRoleOptions)());
12058
- (0, import_react80.useEffect)(() => {
12167
+ (0, import_react81.useEffect)(() => {
12059
12168
  if (open === null) return;
12060
12169
  const onPointer = (event) => {
12061
12170
  if (!rootRef.current?.contains(event.target)) setOpen(null);
@@ -12069,13 +12178,13 @@ var AssetMentionChips = ({
12069
12178
  onChange((0, import_generation3.setMentionRoleInText)(content, chip2.start, role));
12070
12179
  };
12071
12180
  if (chips.length === 0) return null;
12072
- return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { ref: rootRef, className: `flex flex-wrap gap-1.5 ${className}`, "data-asset-mention-chips": "", children: chips.map((chip2) => {
12181
+ return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { ref: rootRef, className: `flex flex-wrap gap-1.5 ${className}`, "data-asset-mention-chips": "", children: chips.map((chip2) => {
12073
12182
  const error = chip2.issues.find((issue) => issue.severity === "error");
12074
12183
  const warning = chip2.issues.find((issue) => issue.severity === "warning");
12075
12184
  const problem = error ?? warning;
12076
12185
  const isOpen = open === chip2.index;
12077
- return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("span", { className: "relative inline-flex", "data-asset-chip": chip2.asset.id, children: [
12078
- /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(
12186
+ return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("span", { className: "relative inline-flex", "data-asset-chip": chip2.asset.id, children: [
12187
+ /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(
12079
12188
  "button",
12080
12189
  {
12081
12190
  type: "button",
@@ -12089,8 +12198,8 @@ var AssetMentionChips = ({
12089
12198
  },
12090
12199
  className: `inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-xs ${error ? "border-red-500/60" : warning ? "border-amber-500/60" : "border-border"} bg-muted/40 hover:bg-muted`,
12091
12200
  children: [
12092
- /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { children: renderAsset ? renderAsset(chip2) : `@${chip2.asset.label ?? chip2.handle}` }),
12093
- /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
12201
+ /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("span", { children: renderAsset ? renderAsset(chip2) : `@${chip2.asset.label ?? chip2.handle}` }),
12202
+ /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
12094
12203
  "span",
12095
12204
  {
12096
12205
  className: `rounded px-1 text-[10px] uppercase tracking-wide ${chip2.role ? "bg-primary/15" : "opacity-60"}`,
@@ -12101,7 +12210,7 @@ var AssetMentionChips = ({
12101
12210
  ]
12102
12211
  }
12103
12212
  ),
12104
- isOpen && /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(
12213
+ isOpen && /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(
12105
12214
  "div",
12106
12215
  {
12107
12216
  role: "listbox",
@@ -12112,7 +12221,7 @@ var AssetMentionChips = ({
12112
12221
  if (e.key === "Escape") setOpen(null);
12113
12222
  },
12114
12223
  children: [
12115
- options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(
12224
+ options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(
12116
12225
  "button",
12117
12226
  {
12118
12227
  type: "button",
@@ -12123,13 +12232,13 @@ var AssetMentionChips = ({
12123
12232
  onClick: () => pick(chip2, option.role),
12124
12233
  className: "flex items-center justify-between gap-2 rounded px-2 py-1 text-left hover:bg-muted",
12125
12234
  children: [
12126
- /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { children: option.label }),
12127
- option.accepts?.length ? /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { className: "text-[10px] opacity-60", children: option.accepts.join(", ") }) : null
12235
+ /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("span", { children: option.label }),
12236
+ option.accepts?.length ? /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("span", { className: "text-[10px] opacity-60", children: option.accepts.join(", ") }) : null
12128
12237
  ]
12129
12238
  },
12130
12239
  option.role
12131
12240
  )),
12132
- /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
12241
+ /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
12133
12242
  "button",
12134
12243
  {
12135
12244
  type: "button",
@@ -12141,7 +12250,7 @@ var AssetMentionChips = ({
12141
12250
  children: "No role"
12142
12251
  }
12143
12252
  ),
12144
- chip2.issues.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("ul", { className: "mt-1 border-t border-border px-2 pt-1 text-[10px]", "data-chip-issues": "", children: chip2.issues.map((issue, i) => /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("li", { className: issue.severity === "error" ? "text-red-500" : "text-amber-500", children: issue.message }, i)) })
12253
+ chip2.issues.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("ul", { className: "mt-1 border-t border-border px-2 pt-1 text-[10px]", "data-chip-issues": "", children: chip2.issues.map((issue, i) => /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("li", { className: issue.severity === "error" ? "text-red-500" : "text-amber-500", children: issue.message }, i)) })
12145
12254
  ]
12146
12255
  }
12147
12256
  )
@@ -12150,15 +12259,15 @@ var AssetMentionChips = ({
12150
12259
  };
12151
12260
 
12152
12261
  // src/generation/GenerationHistory.tsx
12153
- var import_react81 = require("react");
12262
+ var import_react82 = require("react");
12154
12263
  var import_generation4 = require("@pixerate/editor/generation");
12155
- var import_jsx_runtime59 = require("react/jsx-runtime");
12264
+ var import_jsx_runtime60 = require("react/jsx-runtime");
12156
12265
  function useGenerationRecords(store, filter) {
12157
- const [records, setRecords] = (0, import_react81.useState)([]);
12158
- const [loading, setLoading] = (0, import_react81.useState)(!!store);
12159
- const [error, setError] = (0, import_react81.useState)(null);
12266
+ const [records, setRecords] = (0, import_react82.useState)([]);
12267
+ const [loading, setLoading] = (0, import_react82.useState)(!!store);
12268
+ const [error, setError] = (0, import_react82.useState)(null);
12160
12269
  const filterKey = (0, import_generation4.stableStringify)(filter ?? {});
12161
- const refresh = (0, import_react81.useCallback)(async () => {
12270
+ const refresh = (0, import_react82.useCallback)(async () => {
12162
12271
  if (!store) {
12163
12272
  setRecords([]);
12164
12273
  setLoading(false);
@@ -12175,7 +12284,7 @@ function useGenerationRecords(store, filter) {
12175
12284
  setLoading(false);
12176
12285
  }
12177
12286
  }, [store, filterKey]);
12178
- (0, import_react81.useEffect)(() => {
12287
+ (0, import_react82.useEffect)(() => {
12179
12288
  void refresh();
12180
12289
  if (!store) return;
12181
12290
  return store.subscribe(() => void refresh());
@@ -12201,21 +12310,21 @@ var GenerationHistory = ({
12201
12310
  emptyText = "No generations yet.",
12202
12311
  className = ""
12203
12312
  }) => {
12204
- const [innerMode, setInnerMode] = (0, import_react81.useState)("exact");
12313
+ const [innerMode, setInnerMode] = (0, import_react82.useState)("exact");
12205
12314
  const mode = modeProp ?? innerMode;
12206
12315
  const setMode = (next) => {
12207
12316
  if (modeProp === void 0) setInnerMode(next);
12208
12317
  onModeChange?.(next);
12209
12318
  };
12210
- const options = (0, import_react81.useMemo)(() => ({ templates, capabilities, assets, mode }), [templates, capabilities, assets, mode]);
12211
- const results = (0, import_react81.useMemo)(() => records.map((record) => (0, import_generation4.recreateRequest)(record, options)), [records, options]);
12212
- const models = (0, import_react81.useMemo)(
12319
+ const options = (0, import_react82.useMemo)(() => ({ templates, capabilities, assets, mode }), [templates, capabilities, assets, mode]);
12320
+ const results = (0, import_react82.useMemo)(() => records.map((record) => (0, import_generation4.recreateRequest)(record, options)), [records, options]);
12321
+ const models = (0, import_react82.useMemo)(
12213
12322
  () => capabilities ? Array.isArray(capabilities) ? capabilities : [capabilities] : [],
12214
12323
  [capabilities]
12215
12324
  );
12216
- return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: `flex flex-col gap-2 text-sm ${className}`, "data-generation-history": "", children: [
12217
- /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "flex items-center gap-2 text-xs", role: "radiogroup", "aria-label": "Recreate mode", children: ["exact", "latest"].map((value) => /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("label", { className: "inline-flex items-center gap-1", children: [
12218
- /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
12325
+ return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { className: `flex flex-col gap-2 text-sm ${className}`, "data-generation-history": "", children: [
12326
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { className: "flex items-center gap-2 text-xs", role: "radiogroup", "aria-label": "Recreate mode", children: ["exact", "latest"].map((value) => /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("label", { className: "inline-flex items-center gap-1", children: [
12327
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
12219
12328
  "input",
12220
12329
  {
12221
12330
  type: "radio",
@@ -12228,34 +12337,34 @@ var GenerationHistory = ({
12228
12337
  ),
12229
12338
  value === "exact" ? "Exact (recorded versions)" : "Latest templates & settings"
12230
12339
  ] }, value)) }),
12231
- records.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("p", { className: "text-xs text-muted-foreground", children: emptyText }),
12232
- /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("ul", { className: "flex flex-col gap-2", children: records.map((record, i) => {
12340
+ records.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("p", { className: "text-xs text-muted-foreground", children: emptyText }),
12341
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("ul", { className: "flex flex-col gap-2", children: records.map((record, i) => {
12233
12342
  const result = results[i];
12234
12343
  const model = models.find((m) => m.id === record.provenance.modelId);
12235
12344
  const blocked = !result.ok;
12236
- return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(
12345
+ return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
12237
12346
  "li",
12238
12347
  {
12239
12348
  className: "rounded-md border border-border p-2",
12240
12349
  "data-record": record.id,
12241
12350
  "data-drift": result.drift.length,
12242
12351
  children: [
12243
- /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "flex flex-wrap items-center justify-between gap-2 text-xs", children: [
12244
- /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("span", { className: "font-medium", children: model?.name ?? record.provenance.modelId }),
12245
- /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("span", { className: "text-muted-foreground", children: [
12246
- record.kind !== "generate" && /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("span", { "data-kind": "", children: [
12352
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { className: "flex flex-wrap items-center justify-between gap-2 text-xs", children: [
12353
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("span", { className: "font-medium", children: model?.name ?? record.provenance.modelId }),
12354
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("span", { className: "text-muted-foreground", children: [
12355
+ record.kind !== "generate" && /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("span", { "data-kind": "", children: [
12247
12356
  record.kind,
12248
12357
  " \xB7 "
12249
12358
  ] }),
12250
- /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("time", { dateTime: record.createdAt, children: record.createdAt.replace("T", " ").slice(0, 16) }),
12251
- record.seed !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(import_jsx_runtime59.Fragment, { children: [
12359
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("time", { dateTime: record.createdAt, children: record.createdAt.replace("T", " ").slice(0, 16) }),
12360
+ record.seed !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(import_jsx_runtime60.Fragment, { children: [
12252
12361
  " \xB7 seed ",
12253
12362
  record.seed
12254
12363
  ] })
12255
12364
  ] })
12256
12365
  ] }),
12257
- /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("p", { className: "mt-1 line-clamp-3 break-words text-xs", "data-record-prompt": "", children: record.provenance.resolvedPrompt }),
12258
- record.assets.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "mt-1 flex flex-wrap gap-1", children: record.assets.map((asset) => /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(
12366
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("p", { className: "mt-1 line-clamp-3 break-words text-xs", "data-record-prompt": "", children: record.provenance.resolvedPrompt }),
12367
+ record.assets.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { className: "mt-1 flex flex-wrap gap-1", children: record.assets.map((asset) => /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
12259
12368
  "span",
12260
12369
  {
12261
12370
  className: "rounded-full bg-muted px-2 py-0.5 text-[10px]",
@@ -12269,16 +12378,16 @@ var GenerationHistory = ({
12269
12378
  `${asset.role}:${asset.id}`
12270
12379
  )) }),
12271
12380
  renderPreview?.(record),
12272
- result.drift.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("ul", { className: "mt-1 flex flex-col gap-0.5 text-[11px]", "data-drift-report": "", children: result.drift.map((item, j) => /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("li", { className: severityClass[item.severity], "data-drift-type": item.type, children: [
12273
- /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("strong", { children: [
12381
+ result.drift.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("ul", { className: "mt-1 flex flex-col gap-0.5 text-[11px]", "data-drift-report": "", children: result.drift.map((item, j) => /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("li", { className: severityClass[item.severity], "data-drift-type": item.type, children: [
12382
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("strong", { children: [
12274
12383
  import_generation4.DRIFT_TYPE_LABELS[item.type],
12275
12384
  ":"
12276
12385
  ] }),
12277
12386
  " ",
12278
12387
  item.message
12279
12388
  ] }, j)) }),
12280
- /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "mt-2 flex gap-2", children: [
12281
- onRecreate && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
12389
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { className: "mt-2 flex gap-2", children: [
12390
+ onRecreate && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
12282
12391
  "button",
12283
12392
  {
12284
12393
  type: "button",
@@ -12290,7 +12399,7 @@ var GenerationHistory = ({
12290
12399
  children: "Recreate"
12291
12400
  }
12292
12401
  ),
12293
- onVariation && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
12402
+ onVariation && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
12294
12403
  "button",
12295
12404
  {
12296
12405
  type: "button",
@@ -12300,7 +12409,7 @@ var GenerationHistory = ({
12300
12409
  children: "Variation"
12301
12410
  }
12302
12411
  ),
12303
- onRemove && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
12412
+ onRemove && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
12304
12413
  "button",
12305
12414
  {
12306
12415
  type: "button",
@@ -12320,19 +12429,19 @@ var GenerationHistory = ({
12320
12429
  };
12321
12430
 
12322
12431
  // src/find-replace/useFindReplace.ts
12323
- var import_react82 = require("react");
12432
+ var import_react83 = require("react");
12324
12433
  var import_editor17 = require("@pixerate/editor");
12325
12434
  var noopUnsubscribe2 = () => {
12326
12435
  };
12327
12436
  function useFindReplace(editor) {
12328
12437
  const store = (0, import_editor17.getFindReplaceStore)(editor ?? null);
12329
- const subscribe = (0, import_react82.useCallback)(
12438
+ const subscribe = (0, import_react83.useCallback)(
12330
12439
  (onChange) => store ? store.subscribe(() => onChange()) : noopUnsubscribe2,
12331
12440
  [store]
12332
12441
  );
12333
12442
  const getSnapshot2 = () => store?.getSnapshot() ?? import_editor17.EMPTY_FIND_REPLACE_SNAPSHOT;
12334
- const snapshot = (0, import_react82.useSyncExternalStore)(subscribe, getSnapshot2, getSnapshot2);
12335
- return (0, import_react82.useMemo)(() => {
12443
+ const snapshot = (0, import_react83.useSyncExternalStore)(subscribe, getSnapshot2, getSnapshot2);
12444
+ return (0, import_react83.useMemo)(() => {
12336
12445
  const run = (fn) => {
12337
12446
  if (editor && !editor.isDestroyed && store) fn(editor);
12338
12447
  };
@@ -12356,9 +12465,9 @@ function useFindReplace(editor) {
12356
12465
  }
12357
12466
 
12358
12467
  // src/find-replace/FindReplaceBar.tsx
12359
- var import_react83 = require("react");
12468
+ var import_react84 = require("react");
12360
12469
  var import_editor18 = require("@pixerate/editor");
12361
- var import_jsx_runtime60 = require("react/jsx-runtime");
12470
+ var import_jsx_runtime61 = require("react/jsx-runtime");
12362
12471
  var inputClass3 = "min-w-0 flex-1 rounded border border-input bg-background px-2 py-1 text-xs text-foreground focus:outline-none focus:ring-1 focus:ring-ring";
12363
12472
  var buttonClass5 = "rounded px-2 py-1 text-xs text-foreground hover:bg-muted disabled:opacity-40 disabled:hover:bg-transparent";
12364
12473
  var toggleClass = (on) => `${buttonClass5} font-mono ${on ? "bg-primary/10 text-primary" : "text-muted-foreground"}`;
@@ -12371,10 +12480,10 @@ var FindReplaceBar = ({
12371
12480
  onClose
12372
12481
  }) => {
12373
12482
  const find = useFindReplace(editor);
12374
- const findInput = (0, import_react83.useRef)(null);
12375
- const [moreOpen, setMoreOpen] = (0, import_react83.useState)(false);
12483
+ const findInput = (0, import_react84.useRef)(null);
12484
+ const [moreOpen, setMoreOpen] = (0, import_react84.useState)(false);
12376
12485
  const visible = find.available && (alwaysOpen || find.open);
12377
- (0, import_react83.useEffect)(() => {
12486
+ (0, import_react84.useEffect)(() => {
12378
12487
  if (!visible || find.focusRequest === 0) return;
12379
12488
  findInput.current?.focus();
12380
12489
  findInput.current?.select();
@@ -12412,9 +12521,9 @@ var FindReplaceBar = ({
12412
12521
  if (isMod(e)) find.replaceAll();
12413
12522
  else find.replace();
12414
12523
  };
12415
- return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { className, role: "search", "aria-label": "Find and replace", onKeyDown: onBarKeyDown, children: [
12416
- /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { className: "flex items-center gap-1", children: [
12417
- /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
12524
+ return /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("div", { className, role: "search", "aria-label": "Find and replace", onKeyDown: onBarKeyDown, children: [
12525
+ /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("div", { className: "flex items-center gap-1", children: [
12526
+ /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
12418
12527
  "button",
12419
12528
  {
12420
12529
  type: "button",
@@ -12425,7 +12534,7 @@ var FindReplaceBar = ({
12425
12534
  children: showReplace ? "\u25BE" : "\u25B8"
12426
12535
  }
12427
12536
  ),
12428
- /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
12537
+ /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
12429
12538
  "input",
12430
12539
  {
12431
12540
  ref: findInput,
@@ -12439,7 +12548,7 @@ var FindReplaceBar = ({
12439
12548
  onKeyDown: onFindKeyDown
12440
12549
  }
12441
12550
  ),
12442
- import_editor18.FIND_OPTION_TOGGLES.filter((t) => !t.advanced).map((t) => /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
12551
+ import_editor18.FIND_OPTION_TOGGLES.filter((t) => !t.advanced).map((t) => /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
12443
12552
  "button",
12444
12553
  {
12445
12554
  type: "button",
@@ -12452,7 +12561,7 @@ var FindReplaceBar = ({
12452
12561
  },
12453
12562
  t.key
12454
12563
  )),
12455
- /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
12564
+ /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
12456
12565
  "span",
12457
12566
  {
12458
12567
  className: `min-w-[5rem] px-1 text-center text-xs ${find.error ? "text-destructive" : "text-muted-foreground"}`,
@@ -12462,9 +12571,9 @@ var FindReplaceBar = ({
12462
12571
  children: status
12463
12572
  }
12464
12573
  ),
12465
- /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("button", { type: "button", className: buttonClass5, "aria-label": "Previous match", disabled: !hasMatches, onClick: find.previous, children: "\u2191" }),
12466
- /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("button", { type: "button", className: buttonClass5, "aria-label": "Next match", disabled: !hasMatches, onClick: find.next, children: "\u2193" }),
12467
- showMoreOptions && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
12574
+ /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("button", { type: "button", className: buttonClass5, "aria-label": "Previous match", disabled: !hasMatches, onClick: find.previous, children: "\u2191" }),
12575
+ /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("button", { type: "button", className: buttonClass5, "aria-label": "Next match", disabled: !hasMatches, onClick: find.next, children: "\u2193" }),
12576
+ showMoreOptions && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
12468
12577
  "button",
12469
12578
  {
12470
12579
  type: "button",
@@ -12475,10 +12584,10 @@ var FindReplaceBar = ({
12475
12584
  children: "\u2026"
12476
12585
  }
12477
12586
  ),
12478
- /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("button", { type: "button", className: buttonClass5, "aria-label": "Close find", onClick: close, children: "\xD7" })
12587
+ /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("button", { type: "button", className: buttonClass5, "aria-label": "Close find", onClick: close, children: "\xD7" })
12479
12588
  ] }),
12480
- showReplace && /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { className: "flex items-center gap-1 pl-7", children: [
12481
- /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
12589
+ showReplace && /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("div", { className: "flex items-center gap-1 pl-7", children: [
12590
+ /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
12482
12591
  "input",
12483
12592
  {
12484
12593
  type: "text",
@@ -12490,7 +12599,7 @@ var FindReplaceBar = ({
12490
12599
  onKeyDown: onReplaceKeyDown
12491
12600
  }
12492
12601
  ),
12493
- /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
12602
+ /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
12494
12603
  "button",
12495
12604
  {
12496
12605
  type: "button",
@@ -12500,11 +12609,11 @@ var FindReplaceBar = ({
12500
12609
  children: "Replace"
12501
12610
  }
12502
12611
  ),
12503
- /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("button", { type: "button", className: buttonClass5, disabled: !hasMatches, onClick: find.replaceAll, children: "Replace all" }),
12504
- find.lastReplaceCount !== null && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("span", { className: "px-1 text-xs text-muted-foreground", "aria-live": "polite", children: find.lastReplaceCount === 1 ? "1 replaced" : `${find.lastReplaceCount} replaced` })
12612
+ /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("button", { type: "button", className: buttonClass5, disabled: !hasMatches, onClick: find.replaceAll, children: "Replace all" }),
12613
+ find.lastReplaceCount !== null && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("span", { className: "px-1 text-xs text-muted-foreground", "aria-live": "polite", children: find.lastReplaceCount === 1 ? "1 replaced" : `${find.lastReplaceCount} replaced` })
12505
12614
  ] }),
12506
- showMoreOptions && moreOpen && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { className: "flex flex-wrap items-center gap-x-3 gap-y-1 pl-7 text-xs text-muted-foreground", children: import_editor18.FIND_OPTION_TOGGLES.filter((t) => t.advanced).map((t) => /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("label", { className: "flex items-center gap-1", children: [
12507
- /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
12615
+ showMoreOptions && moreOpen && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("div", { className: "flex flex-wrap items-center gap-x-3 gap-y-1 pl-7 text-xs text-muted-foreground", children: import_editor18.FIND_OPTION_TOGGLES.filter((t) => t.advanced).map((t) => /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("label", { className: "flex items-center gap-1", children: [
12616
+ /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
12508
12617
  "input",
12509
12618
  {
12510
12619
  type: "checkbox",
@@ -12518,12 +12627,12 @@ var FindReplaceBar = ({
12518
12627
  };
12519
12628
 
12520
12629
  // src/tables/useTableMenu.ts
12521
- var import_react84 = require("react");
12630
+ var import_react85 = require("react");
12522
12631
  var import_editor19 = require("@pixerate/editor");
12523
12632
  function useTableMenu(editor) {
12524
- const store = (0, import_react84.useMemo)(() => (0, import_editor19.createTableStore)(editor), [editor]);
12525
- const snapshot = (0, import_react84.useSyncExternalStore)(store.subscribe, store.getSnapshot, store.getSnapshot);
12526
- return (0, import_react84.useMemo)(
12633
+ const store = (0, import_react85.useMemo)(() => (0, import_editor19.createTableStore)(editor), [editor]);
12634
+ const snapshot = (0, import_react85.useSyncExternalStore)(store.subscribe, store.getSnapshot, store.getSnapshot);
12635
+ return (0, import_react85.useMemo)(
12527
12636
  () => ({
12528
12637
  ...snapshot,
12529
12638
  run: (action, params) => (0, import_editor19.runTableAction)(editor, action, params, { focus: true }),
@@ -12534,9 +12643,9 @@ function useTableMenu(editor) {
12534
12643
  }
12535
12644
 
12536
12645
  // src/tables/TableToolbar.tsx
12537
- var import_react85 = __toESM(require("react"), 1);
12646
+ var import_react86 = __toESM(require("react"), 1);
12538
12647
  var import_editor20 = require("@pixerate/editor");
12539
- var import_jsx_runtime61 = require("react/jsx-runtime");
12648
+ var import_jsx_runtime62 = require("react/jsx-runtime");
12540
12649
  var keepSelection2 = (event) => event.preventDefault();
12541
12650
  var TableToolbar = ({
12542
12651
  editor,
@@ -12550,14 +12659,14 @@ var TableToolbar = ({
12550
12659
  }) => {
12551
12660
  const table = useTableMenu(editor);
12552
12661
  if (!editor || !table.inTable && !showWhenOutside) return null;
12553
- return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("div", { className, role: "toolbar", "aria-label": "Table", "data-table-toolbar": "", children: items.map((item, index) => {
12662
+ return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className, role: "toolbar", "aria-label": "Table", "data-table-toolbar": "", children: items.map((item, index) => {
12554
12663
  const status = table.check(item.action, item.params);
12555
12664
  const enabled = status === true;
12556
12665
  const active = item.active?.(table);
12557
12666
  const separator = index > 0 && items[index - 1].group !== item.group;
12558
- return /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(import_react85.default.Fragment, { children: [
12559
- separator && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("span", { className: separatorClassName, "aria-hidden": "true" }),
12560
- /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
12667
+ return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(import_react86.default.Fragment, { children: [
12668
+ separator && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { className: separatorClassName, "aria-hidden": "true" }),
12669
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
12561
12670
  "button",
12562
12671
  {
12563
12672
  type: "button",
@@ -12579,8 +12688,8 @@ var TableToolbar = ({
12579
12688
  };
12580
12689
 
12581
12690
  // src/tables/InsertTableGrid.tsx
12582
- var import_react86 = require("react");
12583
- var import_jsx_runtime62 = require("react/jsx-runtime");
12691
+ var import_react87 = require("react");
12692
+ var import_jsx_runtime63 = require("react/jsx-runtime");
12584
12693
  var keepSelection3 = (event) => event.preventDefault();
12585
12694
  var InsertTableGrid = ({
12586
12695
  editor,
@@ -12593,14 +12702,14 @@ var InsertTableGrid = ({
12593
12702
  onInsert
12594
12703
  }) => {
12595
12704
  const table = useTableMenu(editor);
12596
- const [hover, setHover] = (0, import_react86.useState)(null);
12705
+ const [hover, setHover] = (0, import_react87.useState)(null);
12597
12706
  const status = table.actions.insertTable;
12598
12707
  const disabled = !editor || !status.enabled;
12599
12708
  const insert = (size) => {
12600
12709
  if (table.run("insertTable", { ...size, withHeaderRow })) onInsert?.(size);
12601
12710
  setHover(null);
12602
12711
  };
12603
- return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
12712
+ return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
12604
12713
  "div",
12605
12714
  {
12606
12715
  className,
@@ -12610,7 +12719,7 @@ var InsertTableGrid = ({
12610
12719
  "data-insert-table-grid": "",
12611
12720
  onMouseLeave: () => setHover(null),
12612
12721
  children: [
12613
- /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
12722
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
12614
12723
  "div",
12615
12724
  {
12616
12725
  role: "grid",
@@ -12619,7 +12728,7 @@ var InsertTableGrid = ({
12619
12728
  children: Array.from({ length: rows * cols }, (_, i) => {
12620
12729
  const size = { rows: Math.floor(i / cols) + 1, cols: i % cols + 1 };
12621
12730
  const active = !!hover && size.rows <= hover.rows && size.cols <= hover.cols;
12622
- return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
12731
+ return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
12623
12732
  "button",
12624
12733
  {
12625
12734
  type: "button",
@@ -12639,7 +12748,7 @@ var InsertTableGrid = ({
12639
12748
  })
12640
12749
  }
12641
12750
  ),
12642
- /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { "aria-live": "polite", "data-testid": "insert-table-size", children: disabled ? status.reason : hover ? `${hover.rows} \xD7 ${hover.cols}` : "Insert table" })
12751
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("div", { "aria-live": "polite", "data-testid": "insert-table-size", children: disabled ? status.reason : hover ? `${hover.rows} \xD7 ${hover.cols}` : "Insert table" })
12643
12752
  ]
12644
12753
  }
12645
12754
  );
@@ -12647,31 +12756,31 @@ var InsertTableGrid = ({
12647
12756
 
12648
12757
  // src/tables/TableBubbleMenu.tsx
12649
12758
  var import_editor21 = require("@pixerate/editor");
12650
- var import_jsx_runtime63 = require("react/jsx-runtime");
12759
+ var import_jsx_runtime64 = require("react/jsx-runtime");
12651
12760
  var TableBubbleMenu = ({
12652
12761
  editor,
12653
12762
  children,
12654
12763
  toolbarProps,
12655
12764
  pluginKey = "tableBubbleMenu",
12656
12765
  ...rest
12657
- }) => /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(BubbleMenu, { editor, pluginKey, shouldShow: import_editor21.shouldShowTableBubbleMenu, ...rest, children: children ?? /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(TableToolbar, { editor, ...toolbarProps }) });
12766
+ }) => /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(BubbleMenu, { editor, pluginKey, shouldShow: import_editor21.shouldShowTableBubbleMenu, ...rest, children: children ?? /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(TableToolbar, { editor, ...toolbarProps }) });
12658
12767
 
12659
12768
  // src/chart-node/ChartNodeView.tsx
12660
12769
  var import_client = require("react-dom/client");
12661
12770
 
12662
12771
  // src/chart/ChartCanvas.tsx
12663
- var import_react88 = require("react");
12772
+ var import_react89 = require("react");
12664
12773
  var import_chart2 = require("@pixerate/editor/chart");
12665
12774
 
12666
12775
  // src/chart/useChartEditor.ts
12667
- var import_react87 = require("react");
12776
+ var import_react88 = require("react");
12668
12777
  var import_chart = require("@pixerate/editor/chart");
12669
12778
  function useChartState(controller) {
12670
- return (0, import_react87.useSyncExternalStore)(controller.subscribe, controller.getState, controller.getState);
12779
+ return (0, import_react88.useSyncExternalStore)(controller.subscribe, controller.getState, controller.getState);
12671
12780
  }
12672
12781
 
12673
12782
  // src/chart/ChartCanvas.tsx
12674
- var import_jsx_runtime64 = require("react/jsx-runtime");
12783
+ var import_jsx_runtime65 = require("react/jsx-runtime");
12675
12784
  function renderChartMark(mark, fontFamily, interactive) {
12676
12785
  const common = {
12677
12786
  "data-role": mark.role,
@@ -12683,9 +12792,9 @@ function renderChartMark(mark, fontFamily, interactive) {
12683
12792
  };
12684
12793
  switch (mark.kind) {
12685
12794
  case "rect":
12686
- return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("rect", { ...common, x: mark.x, y: mark.y, width: mark.width, height: mark.height, rx: mark.radius, style: { fill: mark.fill, stroke: mark.stroke, strokeWidth: mark.strokeWidth } }, mark.key);
12795
+ return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("rect", { ...common, x: mark.x, y: mark.y, width: mark.width, height: mark.height, rx: mark.radius, style: { fill: mark.fill, stroke: mark.stroke, strokeWidth: mark.strokeWidth } }, mark.key);
12687
12796
  case "path":
12688
- return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
12797
+ return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
12689
12798
  "path",
12690
12799
  {
12691
12800
  ...common,
@@ -12698,11 +12807,11 @@ function renderChartMark(mark, fontFamily, interactive) {
12698
12807
  mark.key
12699
12808
  );
12700
12809
  case "circle":
12701
- return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("circle", { ...common, cx: mark.cx, cy: mark.cy, r: mark.r, style: { fill: mark.fill, stroke: mark.stroke, strokeWidth: mark.strokeWidth } }, mark.key);
12810
+ return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("circle", { ...common, cx: mark.cx, cy: mark.cy, r: mark.r, style: { fill: mark.fill, stroke: mark.stroke, strokeWidth: mark.strokeWidth } }, mark.key);
12702
12811
  case "line":
12703
- return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("line", { ...common, x1: mark.x1, y1: mark.y1, x2: mark.x2, y2: mark.y2, strokeDasharray: mark.dash, style: { stroke: mark.stroke, strokeWidth: mark.strokeWidth } }, mark.key);
12812
+ return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("line", { ...common, x1: mark.x1, y1: mark.y1, x2: mark.x2, y2: mark.y2, strokeDasharray: mark.dash, style: { stroke: mark.stroke, strokeWidth: mark.strokeWidth } }, mark.key);
12704
12813
  case "text":
12705
- return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
12814
+ return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
12706
12815
  "text",
12707
12816
  {
12708
12817
  ...common,
@@ -12719,36 +12828,36 @@ function renderChartMark(mark, fontFamily, interactive) {
12719
12828
  }
12720
12829
  }
12721
12830
  function ChartPresenceLayer({ presence }) {
12722
- const { actors } = (0, import_react88.useSyncExternalStore)(presence.subscribe, presence.getState, presence.getState);
12723
- return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("g", { "data-chart-presence": "", pointerEvents: "none", children: actors.map((a) => /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("g", { transform: `translate(${a.x} ${a.y})`, "data-actor": a.id, children: [
12724
- /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("path", { d: "M0,0 L0,14 L4,10.5 L7,17 L9.5,16 L6.5,9.5 L11.5,9.5 Z", style: { fill: a.color, stroke: "#ffffff", strokeWidth: 1 }, transform: a.pressed ? "scale(0.9)" : void 0 }),
12725
- /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("g", { transform: "translate(13 16)", children: [
12726
- /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("rect", { x: 0, y: 0, rx: 4, height: 18, width: Math.max(28, (a.message ?? a.name).length * 6.4 + 12), style: { fill: a.color } }),
12727
- /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("text", { x: 6, y: 9, dominantBaseline: "central", style: { fill: "#ffffff", fontSize: 11, fontWeight: 600, fontFamily: "inherit" }, children: a.message ?? a.name })
12831
+ const { actors } = (0, import_react89.useSyncExternalStore)(presence.subscribe, presence.getState, presence.getState);
12832
+ return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("g", { "data-chart-presence": "", pointerEvents: "none", children: actors.map((a) => /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("g", { transform: `translate(${a.x} ${a.y})`, "data-actor": a.id, children: [
12833
+ /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("path", { d: "M0,0 L0,14 L4,10.5 L7,17 L9.5,16 L6.5,9.5 L11.5,9.5 Z", style: { fill: a.color, stroke: "#ffffff", strokeWidth: 1 }, transform: a.pressed ? "scale(0.9)" : void 0 }),
12834
+ /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("g", { transform: "translate(13 16)", children: [
12835
+ /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("rect", { x: 0, y: 0, rx: 4, height: 18, width: Math.max(28, (a.message ?? a.name).length * 6.4 + 12), style: { fill: a.color } }),
12836
+ /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("text", { x: 6, y: 9, dominantBaseline: "central", style: { fill: "#ffffff", fontSize: 11, fontWeight: 600, fontFamily: "inherit" }, children: a.message ?? a.name })
12728
12837
  ] })
12729
12838
  ] }, a.id)) });
12730
12839
  }
12731
12840
  function ChartTooltipContent({ tooltip }) {
12732
- return /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(import_jsx_runtime64.Fragment, { children: [
12733
- tooltip.title && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("div", { className: "mb-1 font-medium", children: tooltip.title }),
12734
- tooltip.items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className: "flex items-center gap-2", children: [
12735
- /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("span", { className: "h-2 w-2 shrink-0 rounded-full", style: { background: item.color } }),
12736
- /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("span", { style: { color: "var(--muted-foreground, #64748b)" }, children: item.name }),
12737
- /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("span", { className: "ml-auto pl-3 font-medium tabular-nums", children: item.text })
12841
+ return /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(import_jsx_runtime65.Fragment, { children: [
12842
+ tooltip.title && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("div", { className: "mb-1 font-medium", children: tooltip.title }),
12843
+ tooltip.items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { className: "flex items-center gap-2", children: [
12844
+ /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("span", { className: "h-2 w-2 shrink-0 rounded-full", style: { background: item.color } }),
12845
+ /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("span", { style: { color: "var(--muted-foreground, #64748b)" }, children: item.name }),
12846
+ /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("span", { className: "ml-auto pl-3 font-medium tabular-nums", children: item.text })
12738
12847
  ] }, item.seriesId))
12739
12848
  ] });
12740
12849
  }
12741
12850
  function ChartCanvas({ controller, width = 640, height = 400, responsive = true, theme, editable = true, measureText, emptyMessage, className, presence, sceneRef, tooltip = false, renderTooltip }) {
12742
12851
  const state = useChartState(controller);
12743
- const wrapper = (0, import_react88.useRef)(null);
12744
- const svg = (0, import_react88.useRef)(null);
12745
- const drag = (0, import_react88.useRef)(null);
12746
- const [measured, setMeasured] = (0, import_react88.useState)(null);
12747
- const [frozen, setFrozen] = (0, import_react88.useState)(null);
12852
+ const wrapper = (0, import_react89.useRef)(null);
12853
+ const svg = (0, import_react89.useRef)(null);
12854
+ const drag = (0, import_react89.useRef)(null);
12855
+ const [measured, setMeasured] = (0, import_react89.useState)(null);
12856
+ const [frozen, setFrozen] = (0, import_react89.useState)(null);
12748
12857
  const tooltipMode = tooltip === true ? "point" : tooltip || null;
12749
- const [tip, setTip] = (0, import_react88.useState)(null);
12750
- const [tipAt, setTipAt] = (0, import_react88.useState)({ left: 0, top: 0, flip: false });
12751
- (0, import_react88.useEffect)(() => {
12858
+ const [tip, setTip] = (0, import_react89.useState)(null);
12859
+ const [tipAt, setTipAt] = (0, import_react89.useState)({ left: 0, top: 0, flip: false });
12860
+ (0, import_react89.useEffect)(() => {
12752
12861
  const el = wrapper.current;
12753
12862
  if (!responsive || !el || typeof ResizeObserver === "undefined") return;
12754
12863
  const observer = new ResizeObserver(([entry]) => {
@@ -12759,8 +12868,8 @@ function ChartCanvas({ controller, width = 640, height = 400, responsive = true,
12759
12868
  return () => observer.disconnect();
12760
12869
  }, [responsive]);
12761
12870
  const sceneWidth = responsive && measured || width;
12762
- const fullTheme = (0, import_react88.useMemo)(() => ({ ...import_chart2.CSS_VARIABLE_CHART_THEME, ...theme }), [theme]);
12763
- const scene = (0, import_react88.useMemo)(
12871
+ const fullTheme = (0, import_react89.useMemo)(() => ({ ...import_chart2.CSS_VARIABLE_CHART_THEME, ...theme }), [theme]);
12872
+ const scene = (0, import_react89.useMemo)(
12764
12873
  () => (0, import_chart2.layoutChart)(state.spec, {
12765
12874
  width: sceneWidth,
12766
12875
  height,
@@ -12777,8 +12886,8 @@ function ChartCanvas({ controller, width = 640, height = 400, responsive = true,
12777
12886
  [state.spec, state.selection, state.raceFrame, sceneWidth, height, fullTheme, editable, measureText, emptyMessage, frozen]
12778
12887
  );
12779
12888
  if (sceneRef) sceneRef.current = scene;
12780
- const byKey = (0, import_react88.useMemo)(() => new Map(scene.marks.map((m) => [m.key, m])), [scene]);
12781
- (0, import_react88.useEffect)(() => () => drag.current?.end(), []);
12889
+ const byKey = (0, import_react89.useMemo)(() => new Map(scene.marks.map((m) => [m.key, m])), [scene]);
12890
+ (0, import_react89.useEffect)(() => () => drag.current?.end(), []);
12782
12891
  const scenePoint = (e) => (0, import_chart2.chartClientToScene)(scene, svg.current.getBoundingClientRect(), e.clientX, e.clientY);
12783
12892
  const onPointerDown = (e) => {
12784
12893
  if (!editable || e.button !== 0) return;
@@ -12825,8 +12934,8 @@ function ChartCanvas({ controller, width = 640, height = 400, responsive = true,
12825
12934
  if (editable && (0, import_chart2.handleChartKey)(controller, scene, e)) e.preventDefault();
12826
12935
  };
12827
12936
  const label = state.spec.title || "Chart";
12828
- return /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { ref: wrapper, className: `relative w-full ${className ?? ""}`, "data-chart-canvas": "", children: [
12829
- /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(
12937
+ return /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { ref: wrapper, className: `relative w-full ${className ?? ""}`, "data-chart-canvas": "", children: [
12938
+ /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(
12830
12939
  "svg",
12831
12940
  {
12832
12941
  ref: svg,
@@ -12845,11 +12954,11 @@ function ChartCanvas({ controller, width = 640, height = 400, responsive = true,
12845
12954
  onKeyDown,
12846
12955
  children: [
12847
12956
  scene.marks.map((m) => renderChartMark(m, scene.theme.fontFamily, editable)),
12848
- presence && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(ChartPresenceLayer, { presence })
12957
+ presence && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(ChartPresenceLayer, { presence })
12849
12958
  ]
12850
12959
  }
12851
12960
  ),
12852
- tip && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
12961
+ tip && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
12853
12962
  "div",
12854
12963
  {
12855
12964
  role: "tooltip",
@@ -12864,14 +12973,14 @@ function ChartCanvas({ controller, width = 640, height = 400, responsive = true,
12864
12973
  borderColor: "var(--border, #e2e8f0)",
12865
12974
  fontFamily: scene.theme.fontFamily
12866
12975
  },
12867
- children: renderTooltip ? renderTooltip(tip) : /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(ChartTooltipContent, { tooltip: tip })
12976
+ children: renderTooltip ? renderTooltip(tip) : /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(ChartTooltipContent, { tooltip: tip })
12868
12977
  }
12869
12978
  )
12870
12979
  ] });
12871
12980
  }
12872
12981
 
12873
12982
  // src/chart/ChartDataGrid.tsx
12874
- var import_react89 = require("react");
12983
+ var import_react90 = require("react");
12875
12984
  var import_chart3 = require("@pixerate/editor/chart");
12876
12985
 
12877
12986
  // src/chart/styles.ts
@@ -12884,11 +12993,11 @@ var chartSectionClass = "space-y-2 border-b border-border pb-3 last:border-b-0";
12884
12993
  var chartCellClass = "h-7 w-full min-w-[4.5rem] bg-transparent px-2 text-right text-xs tabular-nums text-foreground focus-visible:bg-background focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-primary";
12885
12994
 
12886
12995
  // src/chart/ChartDataGrid.tsx
12887
- var import_jsx_runtime65 = require("react/jsx-runtime");
12996
+ var import_jsx_runtime66 = require("react/jsx-runtime");
12888
12997
  function ChartCommitInput({ value, onCommit, onKeyDown, onBlur, ...rest }) {
12889
- const [draft, setDraft] = (0, import_react89.useState)(value);
12890
- const typing = (0, import_react89.useRef)(false);
12891
- (0, import_react89.useEffect)(() => {
12998
+ const [draft, setDraft] = (0, import_react90.useState)(value);
12999
+ const typing = (0, import_react90.useRef)(false);
13000
+ (0, import_react90.useEffect)(() => {
12892
13001
  if (!typing.current) setDraft(value);
12893
13002
  }, [value]);
12894
13003
  const commit = () => {
@@ -12897,7 +13006,7 @@ function ChartCommitInput({ value, onCommit, onKeyDown, onBlur, ...rest }) {
12897
13006
  if (draft === value) return;
12898
13007
  if (onCommit(draft) === false) setDraft(value);
12899
13008
  };
12900
- return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
13009
+ return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
12901
13010
  "input",
12902
13011
  {
12903
13012
  ...rest,
@@ -12926,20 +13035,20 @@ function ChartCommitInput({ value, onCommit, onKeyDown, onBlur, ...rest }) {
12926
13035
  }
12927
13036
  function ChartTreeGrid({ controller, readOnly = false, className }) {
12928
13037
  const { spec } = useChartState(controller);
12929
- const [columns, setColumns] = (0, import_react89.useState)(1);
13038
+ const [columns, setColumns] = (0, import_react90.useState)(1);
12930
13039
  const rows = (0, import_chart3.chartTreeToRows)(spec.tree);
12931
13040
  const depth = Math.max(columns, (0, import_chart3.chartTreeDepth)(spec.tree));
12932
13041
  const labels = (0, import_chart3.chartTreeColumnLabels)(depth);
12933
13042
  const commit = (next) => controller.setTreeRows(next).ok;
12934
- return /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { className: `overflow-auto rounded-md border border-border ${className ?? ""}`, "data-chart-grid": "", "data-chart-tree-grid": "", children: [
12935
- /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("table", { className: "w-full border-collapse text-xs", children: [
12936
- /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("thead", { className: "bg-muted/50", children: /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("tr", { children: [
12937
- labels.map((label) => /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("th", { className: "border-b border-r border-border px-2 py-1 text-left font-medium text-muted-foreground", children: label }, label)),
12938
- /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("th", { className: "border-b border-r border-border px-2 py-1 text-right font-medium text-muted-foreground", children: "Value" }),
12939
- !readOnly && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("th", { className: "w-8 border-b border-border" })
13043
+ return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: `overflow-auto rounded-md border border-border ${className ?? ""}`, "data-chart-grid": "", "data-chart-tree-grid": "", children: [
13044
+ /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("table", { className: "w-full border-collapse text-xs", children: [
13045
+ /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("thead", { className: "bg-muted/50", children: /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("tr", { children: [
13046
+ labels.map((label) => /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("th", { className: "border-b border-r border-border px-2 py-1 text-left font-medium text-muted-foreground", children: label }, label)),
13047
+ /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("th", { className: "border-b border-r border-border px-2 py-1 text-right font-medium text-muted-foreground", children: "Value" }),
13048
+ !readOnly && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("th", { className: "w-8 border-b border-border" })
12940
13049
  ] }) }),
12941
- /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("tbody", { children: rows.map((row, r) => /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("tr", { "data-tree-row": r, children: [
12942
- labels.map((_, k) => /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("td", { className: "border-b border-r border-border p-0", children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
13050
+ /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("tbody", { children: rows.map((row, r) => /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("tr", { "data-tree-row": r, children: [
13051
+ labels.map((_, k) => /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("td", { className: "border-b border-r border-border p-0", children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
12943
13052
  ChartCommitInput,
12944
13053
  {
12945
13054
  value: row.path[k] ?? "",
@@ -12950,7 +13059,7 @@ function ChartTreeGrid({ controller, readOnly = false, className }) {
12950
13059
  className: `${chartCellClass} text-left`
12951
13060
  }
12952
13061
  ) }, k)),
12953
- /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("td", { className: "border-b border-r border-border p-0", children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
13062
+ /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("td", { className: "border-b border-r border-border p-0", children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
12954
13063
  ChartCommitInput,
12955
13064
  {
12956
13065
  value: String(row.value),
@@ -12963,14 +13072,14 @@ function ChartTreeGrid({ controller, readOnly = false, className }) {
12963
13072
  className: chartCellClass
12964
13073
  }
12965
13074
  ) }),
12966
- !readOnly && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("td", { className: "border-b border-border px-1", children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("button", { type: "button", className: chartIconButtonClass, title: "Delete item", "aria-label": `Delete ${row.path.join(" / ")}`, "data-action": "tree-remove-row", onClick: () => commit((0, import_chart3.removeChartTreeRow)(rows, r)), children: "\xD7" }) })
13075
+ !readOnly && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("td", { className: "border-b border-border px-1", children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("button", { type: "button", className: chartIconButtonClass, title: "Delete item", "aria-label": `Delete ${row.path.join(" / ")}`, "data-action": "tree-remove-row", onClick: () => commit((0, import_chart3.removeChartTreeRow)(rows, r)), children: "\xD7" }) })
12967
13076
  ] }, r)) })
12968
13077
  ] }),
12969
- !readOnly && /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { className: "flex flex-wrap gap-1 p-1", children: [
12970
- /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("button", { type: "button", className: `${chartButtonClass} h-6 border-dashed`, "data-action": "tree-add-row", onClick: () => commit((0, import_chart3.addChartTreeRow)(rows)), children: "+ Add item" }),
12971
- /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("button", { type: "button", className: `${chartButtonClass} h-6 border-dashed`, "data-action": "tree-add-level", disabled: depth >= 6, onClick: () => setColumns(depth + 1), children: "+ Level" }),
12972
- /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("span", { className: "flex-1" }),
12973
- /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("button", { type: "button", className: `${chartButtonClass} h-6`, "data-action": "tree-ungroup", title: "Keep the group totals as plain data", onClick: () => controller.setTree([]), children: "Ungroup" })
13078
+ !readOnly && /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: "flex flex-wrap gap-1 p-1", children: [
13079
+ /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("button", { type: "button", className: `${chartButtonClass} h-6 border-dashed`, "data-action": "tree-add-row", onClick: () => commit((0, import_chart3.addChartTreeRow)(rows)), children: "+ Add item" }),
13080
+ /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("button", { type: "button", className: `${chartButtonClass} h-6 border-dashed`, "data-action": "tree-add-level", disabled: depth >= 6, onClick: () => setColumns(depth + 1), children: "+ Level" }),
13081
+ /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("span", { className: "flex-1" }),
13082
+ /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("button", { type: "button", className: `${chartButtonClass} h-6`, "data-action": "tree-ungroup", title: "Keep the group totals as plain data", onClick: () => controller.setTree([]), children: "Ungroup" })
12974
13083
  ] })
12975
13084
  ] });
12976
13085
  }
@@ -12978,30 +13087,30 @@ function ChartLinksGrid({ controller, readOnly = false, className }) {
12978
13087
  const { spec } = useChartState(controller);
12979
13088
  const links = spec.links;
12980
13089
  const commit = (next) => controller.setLinks(next).ok;
12981
- return /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { className: `overflow-auto rounded-md border border-border ${className ?? ""}`, "data-chart-grid": "", "data-chart-links-grid": "", children: [
12982
- /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("table", { className: "w-full border-collapse text-xs", children: [
12983
- /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("thead", { className: "bg-muted/50", children: /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("tr", { children: [
12984
- ["Source", "Target"].map((label) => /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("th", { className: "border-b border-r border-border px-2 py-1 text-left font-medium text-muted-foreground", children: label }, label)),
12985
- /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("th", { className: "border-b border-r border-border px-2 py-1 text-right font-medium text-muted-foreground", children: "Value" }),
12986
- !readOnly && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("th", { className: "w-8 border-b border-border" })
13090
+ return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: `overflow-auto rounded-md border border-border ${className ?? ""}`, "data-chart-grid": "", "data-chart-links-grid": "", children: [
13091
+ /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("table", { className: "w-full border-collapse text-xs", children: [
13092
+ /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("thead", { className: "bg-muted/50", children: /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("tr", { children: [
13093
+ ["Source", "Target"].map((label) => /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("th", { className: "border-b border-r border-border px-2 py-1 text-left font-medium text-muted-foreground", children: label }, label)),
13094
+ /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("th", { className: "border-b border-r border-border px-2 py-1 text-right font-medium text-muted-foreground", children: "Value" }),
13095
+ !readOnly && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("th", { className: "w-8 border-b border-border" })
12987
13096
  ] }) }),
12988
- /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("tbody", { children: links.map((link, i) => /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("tr", { "data-link-row": i, children: [
12989
- ["source", "target"].map((field) => /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("td", { className: "border-b border-r border-border p-0", children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(ChartCommitInput, { value: link[field], "aria-label": `${field === "source" ? "Source" : "Target"} of flow ${i + 1}`, "data-link-cell": `${i}:${field}`, readOnly, onCommit: (text) => commit((0, import_chart3.setChartLinkField)(links, i, field, text)), className: `${chartCellClass} text-left` }) }, field)),
12990
- /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("td", { className: "border-b border-r border-border p-0", children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(ChartCommitInput, { value: String(link.value), inputMode: "decimal", "aria-label": `Value of ${link.source} \u2192 ${link.target}`, "data-link-cell": `${i}:value`, readOnly, onCommit: (text) => commit((0, import_chart3.setChartLinkField)(links, i, "value", text)), className: chartCellClass }) }),
12991
- !readOnly && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("td", { className: "border-b border-border px-1", children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("button", { type: "button", className: chartIconButtonClass, title: "Delete flow", "aria-label": `Delete ${link.source} \u2192 ${link.target}`, "data-action": "link-remove", onClick: () => controller.removeLink(i), children: "\xD7" }) })
13097
+ /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("tbody", { children: links.map((link, i) => /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("tr", { "data-link-row": i, children: [
13098
+ ["source", "target"].map((field) => /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("td", { className: "border-b border-r border-border p-0", children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(ChartCommitInput, { value: link[field], "aria-label": `${field === "source" ? "Source" : "Target"} of flow ${i + 1}`, "data-link-cell": `${i}:${field}`, readOnly, onCommit: (text) => commit((0, import_chart3.setChartLinkField)(links, i, field, text)), className: `${chartCellClass} text-left` }) }, field)),
13099
+ /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("td", { className: "border-b border-r border-border p-0", children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(ChartCommitInput, { value: String(link.value), inputMode: "decimal", "aria-label": `Value of ${link.source} \u2192 ${link.target}`, "data-link-cell": `${i}:value`, readOnly, onCommit: (text) => commit((0, import_chart3.setChartLinkField)(links, i, "value", text)), className: chartCellClass }) }),
13100
+ !readOnly && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("td", { className: "border-b border-border px-1", children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("button", { type: "button", className: chartIconButtonClass, title: "Delete flow", "aria-label": `Delete ${link.source} \u2192 ${link.target}`, "data-action": "link-remove", onClick: () => controller.removeLink(i), children: "\xD7" }) })
12992
13101
  ] }, i)) })
12993
13102
  ] }),
12994
- !readOnly && /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { className: "flex flex-wrap gap-1 p-1", children: [
12995
- /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("button", { type: "button", className: `${chartButtonClass} h-6 border-dashed`, "data-action": "link-add", onClick: () => commit((0, import_chart3.addChartLink)(links)), children: "+ Add flow" }),
12996
- /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("span", { className: "flex-1" }),
12997
- links.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("button", { type: "button", className: `${chartButtonClass} h-6`, "data-action": "links-clear", title: "Keep how much passes through each node as plain data", onClick: () => controller.setLinks([]), children: "Remove flows" })
13103
+ !readOnly && /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: "flex flex-wrap gap-1 p-1", children: [
13104
+ /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("button", { type: "button", className: `${chartButtonClass} h-6 border-dashed`, "data-action": "link-add", onClick: () => commit((0, import_chart3.addChartLink)(links)), children: "+ Add flow" }),
13105
+ /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("span", { className: "flex-1" }),
13106
+ links.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("button", { type: "button", className: `${chartButtonClass} h-6`, "data-action": "links-clear", title: "Keep how much passes through each node as plain data", onClick: () => controller.setLinks([]), children: "Remove flows" })
12998
13107
  ] })
12999
13108
  ] });
13000
13109
  }
13001
13110
  function ChartDataGrid({ controller, categoryHeader = "Category", readOnly = false, className }) {
13002
13111
  const { spec, selection } = useChartState(controller);
13003
- if (spec.links.length || spec.type === "sankey") return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(ChartLinksGrid, { controller, readOnly, className });
13004
- if (spec.tree.length) return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(ChartTreeGrid, { controller, readOnly, className });
13112
+ if (spec.links.length || spec.type === "sankey") return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(ChartLinksGrid, { controller, readOnly, className });
13113
+ if (spec.tree.length) return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(ChartTreeGrid, { controller, readOnly, className });
13005
13114
  const canGroup = spec.type === "treemap" || spec.type === "sunburst";
13006
13115
  const paste = (row, column) => (e) => {
13007
13116
  const text = e.clipboardData?.getData("text/plain") ?? "";
@@ -13009,15 +13118,15 @@ function ChartDataGrid({ controller, categoryHeader = "Category", readOnly = fal
13009
13118
  e.preventDefault();
13010
13119
  controller.pasteCells(row, column, text);
13011
13120
  };
13012
- return /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { className: `overflow-auto rounded-md border border-border ${className ?? ""}`, "data-chart-grid": "", children: [
13013
- /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("table", { className: "w-full border-collapse text-xs", children: [
13014
- /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("thead", { className: "bg-muted/50", children: /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("tr", { children: [
13015
- /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("th", { className: "border-b border-r border-border px-2 py-1 text-left font-medium text-muted-foreground", children: categoryHeader }),
13121
+ return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: `overflow-auto rounded-md border border-border ${className ?? ""}`, "data-chart-grid": "", children: [
13122
+ /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("table", { className: "w-full border-collapse text-xs", children: [
13123
+ /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("thead", { className: "bg-muted/50", children: /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("tr", { children: [
13124
+ /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("th", { className: "border-b border-r border-border px-2 py-1 text-left font-medium text-muted-foreground", children: categoryHeader }),
13016
13125
  spec.series.map((s, si) => {
13017
13126
  const color = (0, import_chart3.chartSeriesColor)(spec, si);
13018
13127
  const selected = selection?.kind === "series" && selection.seriesId === s.id;
13019
- return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("th", { "data-series-id": s.id, className: `border-b border-r border-border px-1 py-1 font-medium ${selected ? "bg-primary/10" : ""}`, children: /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { className: "flex items-center gap-1", children: [
13020
- /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
13128
+ return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("th", { "data-series-id": s.id, className: `border-b border-r border-border px-1 py-1 font-medium ${selected ? "bg-primary/10" : ""}`, children: /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: "flex items-center gap-1", children: [
13129
+ /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
13021
13130
  "input",
13022
13131
  {
13023
13132
  type: "color",
@@ -13030,7 +13139,7 @@ function ChartDataGrid({ controller, categoryHeader = "Category", readOnly = fal
13030
13139
  className: "h-5 w-5 shrink-0 cursor-pointer rounded border-0 bg-transparent p-0"
13031
13140
  }
13032
13141
  ),
13033
- /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
13142
+ /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
13034
13143
  ChartCommitInput,
13035
13144
  {
13036
13145
  value: s.name,
@@ -13040,8 +13149,8 @@ function ChartDataGrid({ controller, categoryHeader = "Category", readOnly = fal
13040
13149
  className: `${chartInputClass} h-6 min-w-[5rem] border-transparent bg-transparent font-medium ${s.hidden ? "text-muted-foreground line-through" : ""}`
13041
13150
  }
13042
13151
  ),
13043
- !readOnly && /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(import_jsx_runtime65.Fragment, { children: [
13044
- /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
13152
+ !readOnly && /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(import_jsx_runtime66.Fragment, { children: [
13153
+ /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
13045
13154
  "button",
13046
13155
  {
13047
13156
  type: "button",
@@ -13054,16 +13163,16 @@ function ChartDataGrid({ controller, categoryHeader = "Category", readOnly = fal
13054
13163
  children: s.hidden ? "\u25CB" : "\u25CF"
13055
13164
  }
13056
13165
  ),
13057
- /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("button", { type: "button", className: chartIconButtonClass, title: "Delete series", "aria-label": `Delete ${s.name}`, "data-action": "remove-series", onClick: () => controller.removeSeries(s.id), children: "\xD7" })
13166
+ /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("button", { type: "button", className: chartIconButtonClass, title: "Delete series", "aria-label": `Delete ${s.name}`, "data-action": "remove-series", onClick: () => controller.removeSeries(s.id), children: "\xD7" })
13058
13167
  ] })
13059
13168
  ] }) }, s.id);
13060
13169
  }),
13061
- !readOnly && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("th", { className: "w-8 border-b border-border px-1", children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("button", { type: "button", className: chartIconButtonClass, title: "Add series", "aria-label": "Add series", "data-action": "add-series", onClick: () => controller.addSeries(), children: "+" }) })
13170
+ !readOnly && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("th", { className: "w-8 border-b border-border px-1", children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("button", { type: "button", className: chartIconButtonClass, title: "Add series", "aria-label": "Add series", "data-action": "add-series", onClick: () => controller.addSeries(), children: "+" }) })
13062
13171
  ] }) }),
13063
- /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("tbody", { children: spec.categories.map((category, i) => {
13172
+ /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("tbody", { children: spec.categories.map((category, i) => {
13064
13173
  const rowSelected = selection?.kind === "category" && selection.index === i;
13065
- return /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("tr", { "data-category-index": i, className: rowSelected ? "bg-primary/10" : void 0, children: [
13066
- /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("th", { className: "border-b border-r border-border p-0 text-left font-normal", children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
13174
+ return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("tr", { "data-category-index": i, className: rowSelected ? "bg-primary/10" : void 0, children: [
13175
+ /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("th", { className: "border-b border-r border-border p-0 text-left font-normal", children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
13067
13176
  ChartCommitInput,
13068
13177
  {
13069
13178
  value: category,
@@ -13077,7 +13186,7 @@ function ChartDataGrid({ controller, categoryHeader = "Category", readOnly = fal
13077
13186
  spec.series.map((s) => {
13078
13187
  const value = s.values[i];
13079
13188
  const selected = selection?.kind === "point" && selection.seriesId === s.id && selection.index === i;
13080
- return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("td", { className: `border-b border-r border-border p-0 ${selected ? "bg-primary/10" : ""}`, children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
13189
+ return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("td", { className: `border-b border-r border-border p-0 ${selected ? "bg-primary/10" : ""}`, children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
13081
13190
  ChartCommitInput,
13082
13191
  {
13083
13192
  value: value === null || value === void 0 ? "" : String(value),
@@ -13092,13 +13201,13 @@ function ChartDataGrid({ controller, categoryHeader = "Category", readOnly = fal
13092
13201
  }
13093
13202
  ) }, s.id);
13094
13203
  }),
13095
- !readOnly && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("td", { className: "border-b border-border px-1", children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("button", { type: "button", className: chartIconButtonClass, title: "Delete category", "aria-label": `Delete ${category}`, "data-action": "remove-category", onClick: () => controller.removeCategory(i), children: "\xD7" }) })
13204
+ !readOnly && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("td", { className: "border-b border-border px-1", children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("button", { type: "button", className: chartIconButtonClass, title: "Delete category", "aria-label": `Delete ${category}`, "data-action": "remove-category", onClick: () => controller.removeCategory(i), children: "\xD7" }) })
13096
13205
  ] }, i);
13097
13206
  }) })
13098
13207
  ] }),
13099
- !readOnly && /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { className: "p-1", children: [
13100
- /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("button", { type: "button", className: `${chartButtonClass} h-6 border-dashed`, "data-action": "add-category", onClick: () => controller.addCategory(), children: "+ Add category" }),
13101
- canGroup && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
13208
+ !readOnly && /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: "p-1", children: [
13209
+ /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("button", { type: "button", className: `${chartButtonClass} h-6 border-dashed`, "data-action": "add-category", onClick: () => controller.addCategory(), children: "+ Add category" }),
13210
+ canGroup && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
13102
13211
  "button",
13103
13212
  {
13104
13213
  type: "button",
@@ -13114,29 +13223,29 @@ function ChartDataGrid({ controller, categoryHeader = "Category", readOnly = fal
13114
13223
  }
13115
13224
 
13116
13225
  // src/chart/ChartInspector.tsx
13117
- var import_react90 = require("react");
13226
+ var import_react91 = require("react");
13118
13227
  var import_chart4 = require("@pixerate/editor/chart");
13119
- var import_jsx_runtime66 = require("react/jsx-runtime");
13228
+ var import_jsx_runtime67 = require("react/jsx-runtime");
13120
13229
  var cap = (s) => s.charAt(0).toUpperCase() + s.slice(1);
13121
13230
  function Field({ label, htmlFor, children }) {
13122
- return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: "flex items-center gap-2", children: [
13123
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("label", { htmlFor, className: `${chartLabelClass} w-20 shrink-0`, children: label }),
13124
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { className: "min-w-0 flex-1", children })
13231
+ return /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: "flex items-center gap-2", children: [
13232
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("label", { htmlFor, className: `${chartLabelClass} w-20 shrink-0`, children: label }),
13233
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { className: "min-w-0 flex-1", children })
13125
13234
  ] });
13126
13235
  }
13127
13236
  function Toggle({ label, checked, onChange, name }) {
13128
- return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("label", { className: "flex cursor-pointer items-center gap-2 text-xs text-foreground", children: [
13129
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("input", { type: "checkbox", className: "h-3.5 w-3.5 accent-primary", checked, "data-option": name, onChange: (e) => onChange(e.currentTarget.checked) }),
13237
+ return /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("label", { className: "flex cursor-pointer items-center gap-2 text-xs text-foreground", children: [
13238
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("input", { type: "checkbox", className: "h-3.5 w-3.5 accent-primary", checked, "data-option": name, onChange: (e) => onChange(e.currentTarget.checked) }),
13130
13239
  label
13131
13240
  ] });
13132
13241
  }
13133
13242
  function Select({ id, value, options, onChange, name, labels }) {
13134
- return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("select", { id, className: chartInputClass, value, "data-option": name, onChange: (e) => onChange(e.currentTarget.value), children: options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("option", { value: o, children: labels?.[o] ?? cap(o) }, o)) });
13243
+ return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("select", { id, className: chartInputClass, value, "data-option": name, onChange: (e) => onChange(e.currentTarget.value), children: options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("option", { value: o, children: labels?.[o] ?? cap(o) }, o)) });
13135
13244
  }
13136
13245
  function AxisSection({ controller, axis, value, idBase, horizontal, numeric = false, scales = false }) {
13137
13246
  const set = (patch) => controller.setAxis(axis, patch);
13138
13247
  const setFormat = (patch) => set({ format: { ...value.format, ...patch } });
13139
- const bound = (key2) => /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
13248
+ const bound = (key2) => /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
13140
13249
  ChartCommitInput,
13141
13250
  {
13142
13251
  id: `${idBase}-${axis}-${key2}`,
@@ -13151,26 +13260,26 @@ function AxisSection({ controller, axis, value, idBase, horizontal, numeric = fa
13151
13260
  const name = axis === "x" ? numeric ? "X axis" : "Category axis" : axis === "y" ? "Value axis" : "Secondary axis";
13152
13261
  const valueAxis = axis !== "x" || numeric;
13153
13262
  const key = axis === "y2" ? "yAxis2" : `${axis}Axis`;
13154
- return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: chartSectionClass, "data-section": `axis-${axis}`, children: [
13155
- /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: "flex items-center justify-between", children: [
13156
- /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("h4", { className: "text-xs font-semibold text-foreground", children: [
13263
+ return /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: chartSectionClass, "data-section": `axis-${axis}`, children: [
13264
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: "flex items-center justify-between", children: [
13265
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("h4", { className: "text-xs font-semibold text-foreground", children: [
13157
13266
  name,
13158
- /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("span", { className: "ml-1 font-normal text-muted-foreground", children: [
13267
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("span", { className: "ml-1 font-normal text-muted-foreground", children: [
13159
13268
  "(",
13160
13269
  axis === "x" ? horizontal ? "left" : "bottom" : axis === "y2" ? horizontal ? "top" : "right" : horizontal ? "bottom" : "left",
13161
13270
  ")"
13162
13271
  ] })
13163
13272
  ] }),
13164
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Toggle, { label: "Show", name: `${axis}Axis.show`, checked: value.show, onChange: (show) => set({ show }) })
13273
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Toggle, { label: "Show", name: `${axis}Axis.show`, checked: value.show, onChange: (show) => set({ show }) })
13165
13274
  ] }),
13166
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Field, { label: "Title", htmlFor: `${idBase}-${axis}-title`, children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(ChartCommitInput, { id: `${idBase}-${axis}-title`, value: value.title, "data-option": `${axis}Axis.title`, className: chartInputClass, onCommit: (title) => void set({ title }) }) }),
13167
- /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: "flex flex-wrap gap-x-4 gap-y-1", children: [
13168
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Toggle, { label: "Grid lines", name: `${key}.gridlines`, checked: value.gridlines, onChange: (gridlines) => set({ gridlines }) }),
13169
- axis === "x" && !numeric && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Toggle, { label: "Dates", name: "xAxis.kind", checked: value.kind === "date", onChange: (dates) => set({ kind: dates ? "date" : void 0 }) }),
13170
- scales && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Toggle, { label: "Reverse", name: `${key}.reverse`, checked: !!value.reverse, onChange: (reverse) => set({ reverse }) }),
13171
- scales && valueAxis && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Toggle, { label: "Log scale", name: `${key}.scale`, checked: value.scale === "log", onChange: (log) => set({ scale: log ? "log" : "linear" }) })
13275
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Field, { label: "Title", htmlFor: `${idBase}-${axis}-title`, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(ChartCommitInput, { id: `${idBase}-${axis}-title`, value: value.title, "data-option": `${axis}Axis.title`, className: chartInputClass, onCommit: (title) => void set({ title }) }) }),
13276
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: "flex flex-wrap gap-x-4 gap-y-1", children: [
13277
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Toggle, { label: "Grid lines", name: `${key}.gridlines`, checked: value.gridlines, onChange: (gridlines) => set({ gridlines }) }),
13278
+ axis === "x" && !numeric && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Toggle, { label: "Dates", name: "xAxis.kind", checked: value.kind === "date", onChange: (dates) => set({ kind: dates ? "date" : void 0 }) }),
13279
+ scales && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Toggle, { label: "Reverse", name: `${key}.reverse`, checked: !!value.reverse, onChange: (reverse) => set({ reverse }) }),
13280
+ scales && valueAxis && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Toggle, { label: "Log scale", name: `${key}.scale`, checked: value.scale === "log", onChange: (log) => set({ scale: log ? "log" : "linear" }) })
13172
13281
  ] }),
13173
- scales && valueAxis && value.scale === "log" && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Field, { label: "Log base", htmlFor: `${idBase}-${axis}-log-base`, children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
13282
+ scales && valueAxis && value.scale === "log" && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Field, { label: "Log base", htmlFor: `${idBase}-${axis}-log-base`, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
13174
13283
  ChartCommitInput,
13175
13284
  {
13176
13285
  id: `${idBase}-${axis}-log-base`,
@@ -13181,7 +13290,7 @@ function AxisSection({ controller, axis, value, idBase, horizontal, numeric = fa
13181
13290
  onCommit: (text) => set({ logBase: text.trim() === "" ? void 0 : Number(text) }).ok
13182
13291
  }
13183
13292
  ) }),
13184
- valueAxis && value.scale !== "log" && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Field, { label: "Step", htmlFor: `${idBase}-${axis}-step`, children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
13293
+ valueAxis && value.scale !== "log" && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Field, { label: "Step", htmlFor: `${idBase}-${axis}-step`, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
13185
13294
  ChartCommitInput,
13186
13295
  {
13187
13296
  id: `${idBase}-${axis}-step`,
@@ -13193,14 +13302,14 @@ function AxisSection({ controller, axis, value, idBase, horizontal, numeric = fa
13193
13302
  onCommit: (text) => set({ step: text.trim() === "" ? null : Number(text) }).ok
13194
13303
  }
13195
13304
  ) }),
13196
- valueAxis && /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(import_jsx_runtime66.Fragment, { children: [
13197
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Field, { label: "Min / max", children: /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: "flex gap-1", children: [
13305
+ valueAxis && /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(import_jsx_runtime67.Fragment, { children: [
13306
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Field, { label: "Min / max", children: /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: "flex gap-1", children: [
13198
13307
  bound("min"),
13199
13308
  bound("max")
13200
13309
  ] }) }),
13201
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Field, { label: "Format", htmlFor: `${idBase}-${axis}-format`, children: /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: "flex gap-1", children: [
13202
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Select, { id: `${idBase}-${axis}-format`, name: `${key}.format.style`, value: value.format.style ?? "number", options: import_chart4.CHART_NUMBER_STYLES, onChange: (style) => setFormat({ style }) }),
13203
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
13310
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Field, { label: "Format", htmlFor: `${idBase}-${axis}-format`, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: "flex gap-1", children: [
13311
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Select, { id: `${idBase}-${axis}-format`, name: `${key}.format.style`, value: value.format.style ?? "number", options: import_chart4.CHART_NUMBER_STYLES, onChange: (style) => setFormat({ style }) }),
13312
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
13204
13313
  ChartCommitInput,
13205
13314
  {
13206
13315
  value: value.format.decimals === void 0 ? "" : String(value.format.decimals),
@@ -13219,8 +13328,8 @@ function AxisSection({ controller, axis, value, idBase, horizontal, numeric = fa
13219
13328
  }
13220
13329
  )
13221
13330
  ] }) }),
13222
- value.format.style === "currency" && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Field, { label: "Currency", htmlFor: `${idBase}-${axis}-currency`, children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(ChartCommitInput, { id: `${idBase}-${axis}-currency`, value: value.format.currency ?? "USD", "data-option": `${key}.format.currency`, className: chartInputClass, onCommit: (currency) => void setFormat({ currency: currency.toUpperCase() }) }) }),
13223
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Field, { label: "Code", htmlFor: `${idBase}-${axis}-code`, children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
13331
+ value.format.style === "currency" && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Field, { label: "Currency", htmlFor: `${idBase}-${axis}-currency`, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(ChartCommitInput, { id: `${idBase}-${axis}-currency`, value: value.format.currency ?? "USD", "data-option": `${key}.format.currency`, className: chartInputClass, onCommit: (currency) => void setFormat({ currency: currency.toUpperCase() }) }) }),
13332
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Field, { label: "Code", htmlFor: `${idBase}-${axis}-code`, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
13224
13333
  ChartCommitInput,
13225
13334
  {
13226
13335
  id: `${idBase}-${axis}-code`,
@@ -13246,15 +13355,15 @@ function ErrorBarFields({ controller, series, which, idBase }) {
13246
13355
  const values = which === "xErrorBars" ? series.x ?? [] : series.values;
13247
13356
  const set = (next) => controller.updateSeries(series.id, { [which]: next });
13248
13357
  const patch = (p) => bars && set({ ...bars, ...p });
13249
- return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: "space-y-1.5", "data-section": which === "errorBars" ? "error-bars" : "x-error-bars", children: [
13250
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Field, { label: which === "errorBars" ? "Error bars" : "X error bars", htmlFor: `${id}-type`, children: /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("select", { id: `${id}-type`, className: chartInputClass, value: bars?.type ?? "", "data-option": `${key}.type`, onChange: (e) => set((0, import_chart4.chartErrorBarsOfType)(e.currentTarget.value, bars, values)), children: [
13251
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("option", { value: "", children: "None" }),
13252
- import_chart4.CHART_ERROR_BAR_TYPES.map((t) => /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("option", { value: t, children: import_chart4.CHART_ERROR_BAR_LABELS[t] }, t))
13358
+ return /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: "space-y-1.5", "data-section": which === "errorBars" ? "error-bars" : "x-error-bars", children: [
13359
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Field, { label: which === "errorBars" ? "Error bars" : "X error bars", htmlFor: `${id}-type`, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("select", { id: `${id}-type`, className: chartInputClass, value: bars?.type ?? "", "data-option": `${key}.type`, onChange: (e) => set((0, import_chart4.chartErrorBarsOfType)(e.currentTarget.value, bars, values)), children: [
13360
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("option", { value: "", children: "None" }),
13361
+ import_chart4.CHART_ERROR_BAR_TYPES.map((t) => /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("option", { value: t, children: import_chart4.CHART_ERROR_BAR_LABELS[t] }, t))
13253
13362
  ] }) }),
13254
- bars && (bars.type === "fixed" || bars.type === "percent" || bars.type === "stddev") && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Field, { label: bars.type === "percent" ? "Percent" : bars.type === "stddev" ? "Deviations" : "Amount", htmlFor: `${id}-value`, children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(ChartCommitInput, { id: `${id}-value`, value: String(bars.value ?? (0, import_chart4.defaultChartErrorBarValue)(bars.type)), inputMode: "decimal", "data-option": `${key}.value`, className: chartInputClass, onCommit: (text) => !!patch({ value: text.trim() === "" ? void 0 : Number(text) })?.ok }) }),
13255
- bars?.type === "custom" && /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(import_jsx_runtime66.Fragment, { children: [
13256
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Field, { label: "Plus", htmlFor: `${id}-plus`, children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(ChartCommitInput, { id: `${id}-plus`, value: (0, import_chart4.formatChartAmountList)(bars.plus), placeholder: "1, 2, -, 0.5", "data-option": `${key}.plus`, className: chartInputClass, onCommit: (text) => !!patch({ plus: (0, import_chart4.parseChartAmountList)(text) })?.ok }) }),
13257
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Field, { label: "Minus", htmlFor: `${id}-minus`, children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
13363
+ bars && (bars.type === "fixed" || bars.type === "percent" || bars.type === "stddev") && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Field, { label: bars.type === "percent" ? "Percent" : bars.type === "stddev" ? "Deviations" : "Amount", htmlFor: `${id}-value`, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(ChartCommitInput, { id: `${id}-value`, value: String(bars.value ?? (0, import_chart4.defaultChartErrorBarValue)(bars.type)), inputMode: "decimal", "data-option": `${key}.value`, className: chartInputClass, onCommit: (text) => !!patch({ value: text.trim() === "" ? void 0 : Number(text) })?.ok }) }),
13364
+ bars?.type === "custom" && /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(import_jsx_runtime67.Fragment, { children: [
13365
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Field, { label: "Plus", htmlFor: `${id}-plus`, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(ChartCommitInput, { id: `${id}-plus`, value: (0, import_chart4.formatChartAmountList)(bars.plus), placeholder: "1, 2, -, 0.5", "data-option": `${key}.plus`, className: chartInputClass, onCommit: (text) => !!patch({ plus: (0, import_chart4.parseChartAmountList)(text) })?.ok }) }),
13366
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Field, { label: "Minus", htmlFor: `${id}-minus`, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
13258
13367
  ChartCommitInput,
13259
13368
  {
13260
13369
  id: `${id}-minus`,
@@ -13271,15 +13380,15 @@ function ErrorBarFields({ controller, series, which, idBase }) {
13271
13380
  }
13272
13381
  ) })
13273
13382
  ] }),
13274
- bars && /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: "flex items-center gap-2", children: [
13275
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("select", { className: `${chartInputClass} flex-1`, "aria-label": "Error bar direction", value: bars.direction ?? "both", "data-option": `${key}.direction`, onChange: (e) => patch({ direction: e.currentTarget.value }), children: import_chart4.CHART_ERROR_BAR_DIRECTIONS.map((d) => /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("option", { value: d, children: d === "both" ? "Both ways" : d === "plus" ? "Plus only" : "Minus only" }, d)) }),
13276
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Toggle, { label: "Caps", name: `${key}.cap`, checked: bars.cap !== false, onChange: (cap2) => patch({ cap: cap2 }) })
13383
+ bars && /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: "flex items-center gap-2", children: [
13384
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("select", { className: `${chartInputClass} flex-1`, "aria-label": "Error bar direction", value: bars.direction ?? "both", "data-option": `${key}.direction`, onChange: (e) => patch({ direction: e.currentTarget.value }), children: import_chart4.CHART_ERROR_BAR_DIRECTIONS.map((d) => /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("option", { value: d, children: d === "both" ? "Both ways" : d === "plus" ? "Plus only" : "Minus only" }, d)) }),
13385
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Toggle, { label: "Caps", name: `${key}.cap`, checked: bars.cap !== false, onChange: (cap2) => patch({ cap: cap2 }) })
13277
13386
  ] })
13278
13387
  ] });
13279
13388
  }
13280
13389
  function ChartInspector({ controller, sections, className }) {
13281
13390
  const { spec, selectedSeries, selection, raceFrame, racePlaying } = useChartState(controller);
13282
- const idBase = (0, import_react90.useId)();
13391
+ const idBase = (0, import_react91.useId)();
13283
13392
  const show = (section) => !sections || sections.includes(section);
13284
13393
  const cartesian = (0, import_chart4.isCartesianChart)(spec.type);
13285
13394
  const family = (0, import_chart4.chartFamily)(spec);
@@ -13294,30 +13403,30 @@ function ChartInspector({ controller, sections, className }) {
13294
13403
  const annotated = scales;
13295
13404
  const oneSeries = cartesian && spec.series.filter((s) => !s.hidden).length === 1;
13296
13405
  const calloutIndex = selection?.kind === "point" && selection.seriesId === selectedSeries?.id ? selection.index : null;
13297
- return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: `space-y-3 text-xs ${className ?? ""}`, "data-chart-inspector": "", children: [
13298
- show("type") && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { className: chartSectionClass, "data-section": "type", children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { className: "grid grid-cols-3 gap-0.5 rounded-md bg-muted p-0.5", role: "radiogroup", "aria-label": "Chart type", children: import_chart4.CHART_TYPES.map((type) => /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("button", { type: "button", role: "radio", "aria-checked": spec.type === type, "data-chart-type": type, className: chartSegmentClass(spec.type === type), onClick: () => controller.setType(type), children: import_chart4.CHART_TYPE_LABELS[type] }, type)) }) }),
13299
- show("style") && /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: chartSectionClass, "data-section": "style", children: [
13300
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Field, { label: "Layout", htmlFor: `${idBase}-layout`, children: /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("select", { id: `${idBase}-layout`, className: chartInputClass, value: "", "data-option": "preset.layout", onChange: (e) => e.currentTarget.value && controller.applyPreset({ layout: e.currentTarget.value }), children: [
13301
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("option", { value: "", children: "Quick layout\u2026" }),
13302
- import_chart4.CHART_LAYOUT_PRESETS.map((p) => /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("option", { value: p.id, title: p.description, children: p.label }, p.id))
13406
+ return /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: `space-y-3 text-xs ${className ?? ""}`, "data-chart-inspector": "", children: [
13407
+ show("type") && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { className: chartSectionClass, "data-section": "type", children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { className: "grid grid-cols-3 gap-0.5 rounded-md bg-muted p-0.5", role: "radiogroup", "aria-label": "Chart type", children: import_chart4.CHART_TYPES.map((type) => /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("button", { type: "button", role: "radio", "aria-checked": spec.type === type, "data-chart-type": type, className: chartSegmentClass(spec.type === type), onClick: () => controller.setType(type), children: import_chart4.CHART_TYPE_LABELS[type] }, type)) }) }),
13408
+ show("style") && /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: chartSectionClass, "data-section": "style", children: [
13409
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Field, { label: "Layout", htmlFor: `${idBase}-layout`, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("select", { id: `${idBase}-layout`, className: chartInputClass, value: "", "data-option": "preset.layout", onChange: (e) => e.currentTarget.value && controller.applyPreset({ layout: e.currentTarget.value }), children: [
13410
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("option", { value: "", children: "Quick layout\u2026" }),
13411
+ import_chart4.CHART_LAYOUT_PRESETS.map((p) => /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("option", { value: p.id, title: p.description, children: p.label }, p.id))
13303
13412
  ] }) }),
13304
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Field, { label: "Colours", htmlFor: `${idBase}-colors`, children: /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("select", { id: `${idBase}-colors`, className: chartInputClass, value: import_chart4.CHART_COLOR_SCHEMES.find((c) => c.palette.join() === spec.palette.join())?.id ?? "", "data-option": "preset.colors", onChange: (e) => e.currentTarget.value && controller.applyPreset({ colors: e.currentTarget.value }), children: [
13305
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("option", { value: "", children: "Custom" }),
13306
- import_chart4.CHART_COLOR_SCHEMES.map((c) => /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("option", { value: c.id, title: c.description, children: c.label }, c.id))
13413
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Field, { label: "Colours", htmlFor: `${idBase}-colors`, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("select", { id: `${idBase}-colors`, className: chartInputClass, value: import_chart4.CHART_COLOR_SCHEMES.find((c) => c.palette.join() === spec.palette.join())?.id ?? "", "data-option": "preset.colors", onChange: (e) => e.currentTarget.value && controller.applyPreset({ colors: e.currentTarget.value }), children: [
13414
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("option", { value: "", children: "Custom" }),
13415
+ import_chart4.CHART_COLOR_SCHEMES.map((c) => /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("option", { value: c.id, title: c.description, children: c.label }, c.id))
13307
13416
  ] }) }),
13308
- !colorCheck.ok && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("p", { className: "text-[11px] leading-snug text-amber-600 dark:text-amber-400", "data-chart-color-warning": "", children: colorCheck.issues[0] }),
13309
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("button", { type: "button", className: chartButtonClass, "data-action": "transpose", onClick: () => controller.transpose(), children: "Switch rows and columns" })
13417
+ !colorCheck.ok && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("p", { className: "text-[11px] leading-snug text-amber-600 dark:text-amber-400", "data-chart-color-warning": "", children: colorCheck.issues[0] }),
13418
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("button", { type: "button", className: chartButtonClass, "data-action": "transpose", onClick: () => controller.transpose(), children: "Switch rows and columns" })
13310
13419
  ] }),
13311
- show("titles") && /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: chartSectionClass, "data-section": "titles", children: [
13312
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Field, { label: "Title", htmlFor: `${idBase}-title`, children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(ChartCommitInput, { id: `${idBase}-title`, value: spec.title, "data-option": "title", className: chartInputClass, onCommit: (title) => void controller.setTitle(title) }) }),
13313
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Field, { label: "Subtitle", htmlFor: `${idBase}-subtitle`, children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(ChartCommitInput, { id: `${idBase}-subtitle`, value: spec.subtitle, "data-option": "subtitle", className: chartInputClass, onCommit: (subtitle) => void controller.setSubtitle(subtitle) }) }),
13314
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Field, { label: "Note", htmlFor: `${idBase}-note`, children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(ChartCommitInput, { id: `${idBase}-note`, value: spec.note, placeholder: "Source or footnote", "data-option": "note", className: chartInputClass, onCommit: (note) => void controller.setNote(note) }) })
13420
+ show("titles") && /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: chartSectionClass, "data-section": "titles", children: [
13421
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Field, { label: "Title", htmlFor: `${idBase}-title`, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(ChartCommitInput, { id: `${idBase}-title`, value: spec.title, "data-option": "title", className: chartInputClass, onCommit: (title) => void controller.setTitle(title) }) }),
13422
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Field, { label: "Subtitle", htmlFor: `${idBase}-subtitle`, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(ChartCommitInput, { id: `${idBase}-subtitle`, value: spec.subtitle, "data-option": "subtitle", className: chartInputClass, onCommit: (subtitle) => void controller.setSubtitle(subtitle) }) }),
13423
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Field, { label: "Note", htmlFor: `${idBase}-note`, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(ChartCommitInput, { id: `${idBase}-note`, value: spec.note, placeholder: "Source or footnote", "data-option": "note", className: chartInputClass, onCommit: (note) => void controller.setNote(note) }) })
13315
13424
  ] }),
13316
- show("options") && /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: chartSectionClass, "data-section": "options", children: [
13317
- cartesian && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Field, { label: "Stacking", htmlFor: `${idBase}-stacking`, children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Select, { id: `${idBase}-stacking`, name: "stacking", value: spec.stacking, options: import_chart4.CHART_STACKINGS, labels: { none: "None", stacked: "Stacked", percent: "100%" }, onChange: (stacking) => controller.update({ stacking }) }) }),
13318
- hasBars && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Field, { label: "Bars", children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { className: "flex gap-0.5 rounded-md bg-muted p-0.5", children: ["vertical", "horizontal"].map((o) => /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("button", { type: "button", "aria-pressed": spec.orientation === o, "data-option": `orientation.${o}`, className: chartSegmentClass(spec.orientation === o), onClick: () => controller.update({ orientation: o }), children: cap(o) }, o)) }) }),
13319
- hasLines && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Field, { label: "Lines", htmlFor: `${idBase}-curve`, children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Select, { id: `${idBase}-curve`, name: "curve", value: spec.curve, options: import_chart4.CHART_CURVES, onChange: (curve) => controller.update({ curve }) }) }),
13320
- spec.type === "donut" && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Field, { label: "Hole", htmlFor: `${idBase}-hole`, children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
13425
+ show("options") && /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: chartSectionClass, "data-section": "options", children: [
13426
+ cartesian && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Field, { label: "Stacking", htmlFor: `${idBase}-stacking`, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Select, { id: `${idBase}-stacking`, name: "stacking", value: spec.stacking, options: import_chart4.CHART_STACKINGS, labels: { none: "None", stacked: "Stacked", percent: "100%" }, onChange: (stacking) => controller.update({ stacking }) }) }),
13427
+ hasBars && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Field, { label: "Bars", children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { className: "flex gap-0.5 rounded-md bg-muted p-0.5", children: ["vertical", "horizontal"].map((o) => /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("button", { type: "button", "aria-pressed": spec.orientation === o, "data-option": `orientation.${o}`, className: chartSegmentClass(spec.orientation === o), onClick: () => controller.update({ orientation: o }), children: cap(o) }, o)) }) }),
13428
+ hasLines && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Field, { label: "Lines", htmlFor: `${idBase}-curve`, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Select, { id: `${idBase}-curve`, name: "curve", value: spec.curve, options: import_chart4.CHART_CURVES, onChange: (curve) => controller.update({ curve }) }) }),
13429
+ spec.type === "donut" && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Field, { label: "Hole", htmlFor: `${idBase}-hole`, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
13321
13430
  "input",
13322
13431
  {
13323
13432
  id: `${idBase}-hole`,
@@ -13333,7 +13442,7 @@ function ChartInspector({ controller, sections, className }) {
13333
13442
  onChange: (e) => controller.update({ innerRadius: Number(e.currentTarget.value) })
13334
13443
  }
13335
13444
  ) }),
13336
- hasBars && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Field, { label: "Spacing", htmlFor: `${idBase}-gap`, children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
13445
+ hasBars && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Field, { label: "Spacing", htmlFor: `${idBase}-gap`, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
13337
13446
  "input",
13338
13447
  {
13339
13448
  id: `${idBase}-gap`,
@@ -13349,9 +13458,9 @@ function ChartInspector({ controller, sections, className }) {
13349
13458
  onChange: (e) => controller.update({ gapWidth: Number(e.currentTarget.value) })
13350
13459
  }
13351
13460
  ) }),
13352
- spec.type === "choropleth" && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Field, { label: "Map", htmlFor: `${idBase}-map`, children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("select", { id: `${idBase}-map`, className: chartInputClass, value: spec.map, "data-option": "map", onChange: (e) => controller.update({ map: e.currentTarget.value }), children: [.../* @__PURE__ */ new Set([spec.map, ...(0, import_chart4.listChartMaps)().map((m) => m.id)])].map((id) => /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("option", { value: id, children: (0, import_chart4.listChartMaps)().find((m) => m.id === id)?.name ?? `${id} (not loaded)` }, id)) }) }),
13353
- spec.type === "choropleth" && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Field, { label: "Classes", htmlFor: `${idBase}-map-steps`, children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(ChartCommitInput, { id: `${idBase}-map-steps`, value: String(spec.mapSteps), inputMode: "numeric", "data-option": "mapSteps", disabled: spec.mapThresholds.length > 0, className: chartInputClass, onCommit: (text) => controller.update({ mapSteps: Number(text) }).ok }) }),
13354
- spec.type === "choropleth" && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Field, { label: "Breaks", htmlFor: `${idBase}-map-breaks`, children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
13461
+ spec.type === "choropleth" && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Field, { label: "Map", htmlFor: `${idBase}-map`, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("select", { id: `${idBase}-map`, className: chartInputClass, value: spec.map, "data-option": "map", onChange: (e) => controller.update({ map: e.currentTarget.value }), children: [.../* @__PURE__ */ new Set([spec.map, ...(0, import_chart4.listChartMaps)().map((m) => m.id)])].map((id) => /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("option", { value: id, children: (0, import_chart4.listChartMaps)().find((m) => m.id === id)?.name ?? `${id} (not loaded)` }, id)) }) }),
13462
+ spec.type === "choropleth" && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Field, { label: "Classes", htmlFor: `${idBase}-map-steps`, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(ChartCommitInput, { id: `${idBase}-map-steps`, value: String(spec.mapSteps), inputMode: "numeric", "data-option": "mapSteps", disabled: spec.mapThresholds.length > 0, className: chartInputClass, onCommit: (text) => controller.update({ mapSteps: Number(text) }).ok }) }),
13463
+ spec.type === "choropleth" && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Field, { label: "Breaks", htmlFor: `${idBase}-map-breaks`, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
13355
13464
  ChartCommitInput,
13356
13465
  {
13357
13466
  id: `${idBase}-map-breaks`,
@@ -13362,10 +13471,10 @@ function ChartInspector({ controller, sections, className }) {
13362
13471
  onCommit: (text) => controller.update({ mapThresholds: text.trim() ? text.split(",").map((t) => Number(t.trim())) : [] }).ok
13363
13472
  }
13364
13473
  ) }),
13365
- spec.type === "barrace" && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Field, { label: "Bars", htmlFor: `${idBase}-race-top`, children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(ChartCommitInput, { id: `${idBase}-race-top`, value: String(spec.raceTopN), inputMode: "numeric", "data-option": "raceTopN", className: chartInputClass, onCommit: (text) => controller.update({ raceTopN: Number(text) }).ok }) }),
13366
- spec.type === "barrace" && spec.categories.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Field, { label: "Time", htmlFor: `${idBase}-race-frame`, children: /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: "flex items-center gap-1", children: [
13367
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("button", { type: "button", className: chartButtonClass, "data-action": "race-play", "aria-label": racePlaying ? "Pause the race" : "Play the race", onClick: () => racePlaying ? controller.pauseRace() : controller.playRace(), children: racePlaying ? "Pause" : "Play" }),
13368
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
13474
+ spec.type === "barrace" && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Field, { label: "Bars", htmlFor: `${idBase}-race-top`, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(ChartCommitInput, { id: `${idBase}-race-top`, value: String(spec.raceTopN), inputMode: "numeric", "data-option": "raceTopN", className: chartInputClass, onCommit: (text) => controller.update({ raceTopN: Number(text) }).ok }) }),
13475
+ spec.type === "barrace" && spec.categories.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Field, { label: "Time", htmlFor: `${idBase}-race-frame`, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: "flex items-center gap-1", children: [
13476
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("button", { type: "button", className: chartButtonClass, "data-action": "race-play", "aria-label": racePlaying ? "Pause the race" : "Play the race", onClick: () => racePlaying ? controller.pauseRace() : controller.playRace(), children: racePlaying ? "Pause" : "Play" }),
13477
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
13369
13478
  "input",
13370
13479
  {
13371
13480
  id: `${idBase}-race-frame`,
@@ -13380,13 +13489,13 @@ function ChartInspector({ controller, sections, className }) {
13380
13489
  onChange: (e) => controller.setRaceFrame(Number(e.currentTarget.value))
13381
13490
  }
13382
13491
  ),
13383
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("span", { className: "w-12 shrink-0 truncate text-right tabular-nums text-muted-foreground", "data-race-time": "", children: spec.categories[Math.round(raceFrame ?? spec.categories.length - 1)] })
13492
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("span", { className: "w-12 shrink-0 truncate text-right tabular-nums text-muted-foreground", "data-race-time": "", children: spec.categories[Math.round(raceFrame ?? spec.categories.length - 1)] })
13384
13493
  ] }) }),
13385
- spec.type === "sankey" && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Field, { label: "Flows", htmlFor: `${idBase}-sankey-color`, children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Select, { id: `${idBase}-sankey-color`, name: "sankeyLinkColor", value: spec.sankeyLinkColor, options: import_chart4.CHART_SANKEY_LINK_COLORS, labels: { source: "Coloured by source", target: "Coloured by target", gray: "Grey" }, onChange: (sankeyLinkColor) => controller.update({ sankeyLinkColor }) }) }),
13386
- spec.type === "sunburst" && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Field, { label: "Caption", htmlFor: `${idBase}-sunburst-label`, children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(ChartCommitInput, { id: `${idBase}-sunburst-label`, value: spec.sunburstLabel, placeholder: "Under the total", "data-option": "sunburstLabel", className: chartInputClass, onCommit: (sunburstLabel) => controller.update({ sunburstLabel }).ok }) }),
13387
- spec.type === "likert" && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Field, { label: "Neutral", htmlFor: `${idBase}-likert-neutral`, children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Select, { id: `${idBase}-likert-neutral`, name: "likertNeutral", value: spec.likertNeutral, options: import_chart4.CHART_LIKERT_NEUTRALS, labels: { split: "Across the centre", separate: "In its own column" }, onChange: (likertNeutral) => controller.update({ likertNeutral }) }) }),
13388
- spec.type === "likert" && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Field, { label: "Order", htmlFor: `${idBase}-likert-sort`, children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Select, { id: `${idBase}-likert-sort`, name: "likertSort", value: spec.likertSort, options: import_chart4.CHART_LIKERT_SORTS, labels: { none: "As entered", positive: "Most agreement first", negative: "Most disagreement first" }, onChange: (likertSort) => controller.update({ likertSort }) }) }),
13389
- spec.type === "parliament" && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Field, { label: "Sweep", htmlFor: `${idBase}-parliament-arc`, children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
13494
+ spec.type === "sankey" && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Field, { label: "Flows", htmlFor: `${idBase}-sankey-color`, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Select, { id: `${idBase}-sankey-color`, name: "sankeyLinkColor", value: spec.sankeyLinkColor, options: import_chart4.CHART_SANKEY_LINK_COLORS, labels: { source: "Coloured by source", target: "Coloured by target", gray: "Grey" }, onChange: (sankeyLinkColor) => controller.update({ sankeyLinkColor }) }) }),
13495
+ spec.type === "sunburst" && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Field, { label: "Caption", htmlFor: `${idBase}-sunburst-label`, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(ChartCommitInput, { id: `${idBase}-sunburst-label`, value: spec.sunburstLabel, placeholder: "Under the total", "data-option": "sunburstLabel", className: chartInputClass, onCommit: (sunburstLabel) => controller.update({ sunburstLabel }).ok }) }),
13496
+ spec.type === "likert" && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Field, { label: "Neutral", htmlFor: `${idBase}-likert-neutral`, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Select, { id: `${idBase}-likert-neutral`, name: "likertNeutral", value: spec.likertNeutral, options: import_chart4.CHART_LIKERT_NEUTRALS, labels: { split: "Across the centre", separate: "In its own column" }, onChange: (likertNeutral) => controller.update({ likertNeutral }) }) }),
13497
+ spec.type === "likert" && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Field, { label: "Order", htmlFor: `${idBase}-likert-sort`, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Select, { id: `${idBase}-likert-sort`, name: "likertSort", value: spec.likertSort, options: import_chart4.CHART_LIKERT_SORTS, labels: { none: "As entered", positive: "Most agreement first", negative: "Most disagreement first" }, onChange: (likertSort) => controller.update({ likertSort }) }) }),
13498
+ spec.type === "parliament" && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Field, { label: "Sweep", htmlFor: `${idBase}-parliament-arc`, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
13390
13499
  "input",
13391
13500
  {
13392
13501
  id: `${idBase}-parliament-arc`,
@@ -13402,34 +13511,34 @@ function ChartInspector({ controller, sections, className }) {
13402
13511
  onChange: (e) => controller.update({ parliamentArc: Number(e.currentTarget.value) })
13403
13512
  }
13404
13513
  ) }),
13405
- spec.type === "parliament" && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Field, { label: "Majority", htmlFor: `${idBase}-parliament-majority`, children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(ChartCommitInput, { id: `${idBase}-parliament-majority`, value: spec.parliamentMajority === null ? "" : String(spec.parliamentMajority), placeholder: "Half plus one", inputMode: "numeric", "data-option": "parliamentMajority", className: chartInputClass, onCommit: (text) => controller.update({ parliamentMajority: text.trim() === "" ? null : Number(text) }).ok }) }),
13406
- spec.type === "parliament" && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Field, { label: "Caption", htmlFor: `${idBase}-parliament-label`, children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(ChartCommitInput, { id: `${idBase}-parliament-label`, value: spec.parliamentLabel, placeholder: "seats", "data-option": "parliamentLabel", className: chartInputClass, onCommit: (parliamentLabel) => controller.update({ parliamentLabel }).ok }) }),
13407
- spec.type === "radar" && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Field, { label: "Rings", htmlFor: `${idBase}-radar-ticks`, children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(ChartCommitInput, { id: `${idBase}-radar-ticks`, value: spec.radarTicks === null ? "" : String(spec.radarTicks), placeholder: "Auto", inputMode: "numeric", "data-option": "radarTicks", className: chartInputClass, onCommit: (text) => controller.update({ radarTicks: text.trim() === "" ? null : Number(text) }).ok }) }),
13408
- spec.type === "radar" && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Field, { label: "Grid", htmlFor: `${idBase}-radar-graticule`, children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Select, { id: `${idBase}-radar-graticule`, name: "radarGraticule", value: spec.radarGraticule, options: import_chart4.CHART_RADAR_GRATICULES, labels: { polygon: "Polygons", circle: "Circles" }, onChange: (radarGraticule) => controller.update({ radarGraticule }) }) }),
13409
- spec.dataLabels && hasBars && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Field, { label: "Labels", htmlFor: `${idBase}-label-position`, children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Select, { id: `${idBase}-label-position`, name: "labelPosition", value: spec.labelPosition, options: import_chart4.CHART_LABEL_POSITIONS, onChange: (labelPosition) => controller.update({ labelPosition }) }) }),
13410
- spec.type === "histogram" && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Field, { label: "Bins", htmlFor: `${idBase}-bins`, children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(ChartCommitInput, { id: `${idBase}-bins`, value: spec.bins === null ? "" : String(spec.bins), placeholder: "Auto", inputMode: "numeric", "data-option": "bins", className: chartInputClass, onCommit: (text) => controller.update({ bins: text.trim() === "" ? null : Number(text) }).ok }) }),
13411
- /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: "flex flex-wrap gap-x-4 gap-y-1", children: [
13412
- spec.type === "waterfall" && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Toggle, { label: "Total bar", name: "showTotal", checked: spec.showTotal, onChange: (showTotal) => controller.update({ showTotal }) }),
13413
- hasLines && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Toggle, { label: "Points", name: "points", checked: spec.points, onChange: (points) => controller.update({ points }) }),
13414
- oneSeries && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Toggle, { label: "Colour by category", name: "varyColors", checked: spec.varyColors, onChange: (varyColors) => controller.update({ varyColors }) }),
13415
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Toggle, { label: "Data labels", name: "dataLabels", checked: spec.dataLabels, onChange: (dataLabels) => controller.update({ dataLabels }) })
13514
+ spec.type === "parliament" && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Field, { label: "Majority", htmlFor: `${idBase}-parliament-majority`, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(ChartCommitInput, { id: `${idBase}-parliament-majority`, value: spec.parliamentMajority === null ? "" : String(spec.parliamentMajority), placeholder: "Half plus one", inputMode: "numeric", "data-option": "parliamentMajority", className: chartInputClass, onCommit: (text) => controller.update({ parliamentMajority: text.trim() === "" ? null : Number(text) }).ok }) }),
13515
+ spec.type === "parliament" && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Field, { label: "Caption", htmlFor: `${idBase}-parliament-label`, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(ChartCommitInput, { id: `${idBase}-parliament-label`, value: spec.parliamentLabel, placeholder: "seats", "data-option": "parliamentLabel", className: chartInputClass, onCommit: (parliamentLabel) => controller.update({ parliamentLabel }).ok }) }),
13516
+ spec.type === "radar" && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Field, { label: "Rings", htmlFor: `${idBase}-radar-ticks`, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(ChartCommitInput, { id: `${idBase}-radar-ticks`, value: spec.radarTicks === null ? "" : String(spec.radarTicks), placeholder: "Auto", inputMode: "numeric", "data-option": "radarTicks", className: chartInputClass, onCommit: (text) => controller.update({ radarTicks: text.trim() === "" ? null : Number(text) }).ok }) }),
13517
+ spec.type === "radar" && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Field, { label: "Grid", htmlFor: `${idBase}-radar-graticule`, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Select, { id: `${idBase}-radar-graticule`, name: "radarGraticule", value: spec.radarGraticule, options: import_chart4.CHART_RADAR_GRATICULES, labels: { polygon: "Polygons", circle: "Circles" }, onChange: (radarGraticule) => controller.update({ radarGraticule }) }) }),
13518
+ spec.dataLabels && hasBars && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Field, { label: "Labels", htmlFor: `${idBase}-label-position`, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Select, { id: `${idBase}-label-position`, name: "labelPosition", value: spec.labelPosition, options: import_chart4.CHART_LABEL_POSITIONS, onChange: (labelPosition) => controller.update({ labelPosition }) }) }),
13519
+ spec.type === "histogram" && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Field, { label: "Bins", htmlFor: `${idBase}-bins`, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(ChartCommitInput, { id: `${idBase}-bins`, value: spec.bins === null ? "" : String(spec.bins), placeholder: "Auto", inputMode: "numeric", "data-option": "bins", className: chartInputClass, onCommit: (text) => controller.update({ bins: text.trim() === "" ? null : Number(text) }).ok }) }),
13520
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: "flex flex-wrap gap-x-4 gap-y-1", children: [
13521
+ spec.type === "waterfall" && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Toggle, { label: "Total bar", name: "showTotal", checked: spec.showTotal, onChange: (showTotal) => controller.update({ showTotal }) }),
13522
+ hasLines && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Toggle, { label: "Points", name: "points", checked: spec.points, onChange: (points) => controller.update({ points }) }),
13523
+ oneSeries && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Toggle, { label: "Colour by category", name: "varyColors", checked: spec.varyColors, onChange: (varyColors) => controller.update({ varyColors }) }),
13524
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Toggle, { label: "Data labels", name: "dataLabels", checked: spec.dataLabels, onChange: (dataLabels) => controller.update({ dataLabels }) })
13416
13525
  ] })
13417
13526
  ] }),
13418
- show("legend") && /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: chartSectionClass, "data-section": "legend", children: [
13419
- /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: "flex items-center justify-between", children: [
13420
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("h4", { className: "text-xs font-semibold text-foreground", children: "Legend" }),
13421
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Toggle, { label: "Show", name: "legend.show", checked: spec.legend.show, onChange: (v) => controller.setLegend({ show: v }) })
13527
+ show("legend") && /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: chartSectionClass, "data-section": "legend", children: [
13528
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: "flex items-center justify-between", children: [
13529
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("h4", { className: "text-xs font-semibold text-foreground", children: "Legend" }),
13530
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Toggle, { label: "Show", name: "legend.show", checked: spec.legend.show, onChange: (v) => controller.setLegend({ show: v }) })
13422
13531
  ] }),
13423
- spec.legend.show && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { className: "flex gap-0.5 rounded-md bg-muted p-0.5", children: import_chart4.CHART_LEGEND_POSITIONS.map((p) => /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("button", { type: "button", "aria-pressed": spec.legend.position === p, "data-option": `legend.${p}`, className: chartSegmentClass(spec.legend.position === p), onClick: () => controller.setLegend({ position: p }), children: cap(p) }, p)) })
13532
+ spec.legend.show && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { className: "flex gap-0.5 rounded-md bg-muted p-0.5", children: import_chart4.CHART_LEGEND_POSITIONS.map((p) => /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("button", { type: "button", "aria-pressed": spec.legend.position === p, "data-option": `legend.${p}`, className: chartSegmentClass(spec.legend.position === p), onClick: () => controller.setLegend({ position: p }), children: cap(p) }, p)) })
13424
13533
  ] }),
13425
- show("axes") && hasAxes && /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(import_jsx_runtime66.Fragment, { children: [
13426
- family !== "box" && family !== "histogram" && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(AxisSection, { controller, axis: "x", value: spec.xAxis, idBase, horizontal: spec.orientation === "horizontal", numeric: family === "xy", scales }),
13427
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(AxisSection, { controller, axis: "y", value: spec.yAxis, idBase, horizontal: spec.orientation === "horizontal", scales }),
13428
- usesSecondary && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(AxisSection, { controller, axis: "y2", value: spec.yAxis2, idBase, horizontal: spec.orientation === "horizontal", scales })
13534
+ show("axes") && hasAxes && /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(import_jsx_runtime67.Fragment, { children: [
13535
+ family !== "box" && family !== "histogram" && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(AxisSection, { controller, axis: "x", value: spec.xAxis, idBase, horizontal: spec.orientation === "horizontal", numeric: family === "xy", scales }),
13536
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(AxisSection, { controller, axis: "y", value: spec.yAxis, idBase, horizontal: spec.orientation === "horizontal", scales }),
13537
+ usesSecondary && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(AxisSection, { controller, axis: "y2", value: spec.yAxis2, idBase, horizontal: spec.orientation === "horizontal", scales })
13429
13538
  ] }),
13430
- show("annotations") && annotated && /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: chartSectionClass, "data-section": "annotations", children: [
13431
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("h4", { className: "text-xs font-semibold text-foreground", children: "Annotations" }),
13432
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Field, { label: "Highlight", htmlFor: `${idBase}-highlight`, children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
13539
+ show("annotations") && annotated && /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: chartSectionClass, "data-section": "annotations", children: [
13540
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("h4", { className: "text-xs font-semibold text-foreground", children: "Annotations" }),
13541
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Field, { label: "Highlight", htmlFor: `${idBase}-highlight`, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
13433
13542
  ChartCommitInput,
13434
13543
  {
13435
13544
  id: `${idBase}-highlight`,
@@ -13440,27 +13549,27 @@ function ChartInspector({ controller, sections, className }) {
13440
13549
  onCommit: (text) => controller.setHighlight(text.split(",").map((n) => n.trim()).filter(Boolean)).ok
13441
13550
  }
13442
13551
  ) }),
13443
- spec.referenceLines.map((line, i) => /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: "flex items-center gap-1", "data-reference-line": i, children: [
13444
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(ChartCommitInput, { value: String(line.value), "aria-label": "Line value", inputMode: "decimal", "data-option": `referenceLine.${i}.value`, className: `${chartInputClass} w-16 shrink-0`, onCommit: (text) => controller.updateReferenceLine(i, { value: Number(text) }).ok }),
13445
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(ChartCommitInput, { value: line.label ?? "", "aria-label": "Line label", placeholder: "Label", "data-option": `referenceLine.${i}.label`, className: `${chartInputClass} flex-1`, onCommit: (text) => controller.updateReferenceLine(i, { label: text || null }).ok }),
13446
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("button", { type: "button", className: chartButtonClass, "aria-label": "Delete reference line", "data-action": "reference-line-delete", onClick: () => controller.removeReferenceLine(i), children: "\xD7" })
13552
+ spec.referenceLines.map((line, i) => /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: "flex items-center gap-1", "data-reference-line": i, children: [
13553
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(ChartCommitInput, { value: String(line.value), "aria-label": "Line value", inputMode: "decimal", "data-option": `referenceLine.${i}.value`, className: `${chartInputClass} w-16 shrink-0`, onCommit: (text) => controller.updateReferenceLine(i, { value: Number(text) }).ok }),
13554
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(ChartCommitInput, { value: line.label ?? "", "aria-label": "Line label", placeholder: "Label", "data-option": `referenceLine.${i}.label`, className: `${chartInputClass} flex-1`, onCommit: (text) => controller.updateReferenceLine(i, { label: text || null }).ok }),
13555
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("button", { type: "button", className: chartButtonClass, "aria-label": "Delete reference line", "data-action": "reference-line-delete", onClick: () => controller.removeReferenceLine(i), children: "\xD7" })
13447
13556
  ] }, `line-${i}`)),
13448
- spec.referenceBands.map((band, i) => /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: "flex items-center gap-1", "data-reference-band": i, children: [
13449
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(ChartCommitInput, { value: String(band.from), "aria-label": "Band from", inputMode: "decimal", "data-option": `referenceBand.${i}.from`, className: `${chartInputClass} w-14 shrink-0`, onCommit: (text) => controller.updateReferenceBand(i, { from: Number(text) }).ok }),
13450
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(ChartCommitInput, { value: String(band.to), "aria-label": "Band to", inputMode: "decimal", "data-option": `referenceBand.${i}.to`, className: `${chartInputClass} w-14 shrink-0`, onCommit: (text) => controller.updateReferenceBand(i, { to: Number(text) }).ok }),
13451
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(ChartCommitInput, { value: band.label ?? "", "aria-label": "Band label", placeholder: "Label", "data-option": `referenceBand.${i}.label`, className: `${chartInputClass} flex-1`, onCommit: (text) => controller.updateReferenceBand(i, { label: text || null }).ok }),
13452
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("button", { type: "button", className: chartButtonClass, "aria-label": "Delete reference band", "data-action": "reference-band-delete", onClick: () => controller.removeReferenceBand(i), children: "\xD7" })
13557
+ spec.referenceBands.map((band, i) => /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: "flex items-center gap-1", "data-reference-band": i, children: [
13558
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(ChartCommitInput, { value: String(band.from), "aria-label": "Band from", inputMode: "decimal", "data-option": `referenceBand.${i}.from`, className: `${chartInputClass} w-14 shrink-0`, onCommit: (text) => controller.updateReferenceBand(i, { from: Number(text) }).ok }),
13559
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(ChartCommitInput, { value: String(band.to), "aria-label": "Band to", inputMode: "decimal", "data-option": `referenceBand.${i}.to`, className: `${chartInputClass} w-14 shrink-0`, onCommit: (text) => controller.updateReferenceBand(i, { to: Number(text) }).ok }),
13560
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(ChartCommitInput, { value: band.label ?? "", "aria-label": "Band label", placeholder: "Label", "data-option": `referenceBand.${i}.label`, className: `${chartInputClass} flex-1`, onCommit: (text) => controller.updateReferenceBand(i, { label: text || null }).ok }),
13561
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("button", { type: "button", className: chartButtonClass, "aria-label": "Delete reference band", "data-action": "reference-band-delete", onClick: () => controller.removeReferenceBand(i), children: "\xD7" })
13453
13562
  ] }, `band-${i}`)),
13454
- /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: "flex gap-1", children: [
13455
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("button", { type: "button", className: chartButtonClass, "data-option": "referenceLine.add", onClick: () => controller.addReferenceLine((0, import_chart4.suggestChartReferences)(spec).line), children: "Add line" }),
13456
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("button", { type: "button", className: chartButtonClass, "data-option": "referenceBand.add", onClick: () => controller.addReferenceBand((0, import_chart4.suggestChartReferences)(spec).band), children: "Add band" })
13563
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: "flex gap-1", children: [
13564
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("button", { type: "button", className: chartButtonClass, "data-option": "referenceLine.add", onClick: () => controller.addReferenceLine((0, import_chart4.suggestChartReferences)(spec).line), children: "Add line" }),
13565
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("button", { type: "button", className: chartButtonClass, "data-option": "referenceBand.add", onClick: () => controller.addReferenceBand((0, import_chart4.suggestChartReferences)(spec).band), children: "Add band" })
13457
13566
  ] })
13458
13567
  ] }),
13459
- show("series") && selectedSeries && /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: chartSectionClass, "data-section": "series", "data-series-id": selectedSeries.id, children: [
13460
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("h4", { className: "text-xs font-semibold text-foreground", children: "Series" }),
13461
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Field, { label: "Name", htmlFor: `${idBase}-series-name`, children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(ChartCommitInput, { id: `${idBase}-series-name`, value: selectedSeries.name, "data-option": "series.name", className: chartInputClass, onCommit: (name) => void controller.updateSeries(selectedSeries.id, { name }) }) }),
13462
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Field, { label: "Colour", htmlFor: `${idBase}-series-color`, children: /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: "flex items-center gap-1", children: [
13463
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
13568
+ show("series") && selectedSeries && /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: chartSectionClass, "data-section": "series", "data-series-id": selectedSeries.id, children: [
13569
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("h4", { className: "text-xs font-semibold text-foreground", children: "Series" }),
13570
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Field, { label: "Name", htmlFor: `${idBase}-series-name`, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(ChartCommitInput, { id: `${idBase}-series-name`, value: selectedSeries.name, "data-option": "series.name", className: chartInputClass, onCommit: (name) => void controller.updateSeries(selectedSeries.id, { name }) }) }),
13571
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Field, { label: "Colour", htmlFor: `${idBase}-series-color`, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: "flex items-center gap-1", children: [
13572
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
13464
13573
  "input",
13465
13574
  {
13466
13575
  id: `${idBase}-series-color`,
@@ -13473,9 +13582,9 @@ function ChartInspector({ controller, sections, className }) {
13473
13582
  onChange: (e) => controller.updateSeries(selectedSeries.id, { color: e.currentTarget.value })
13474
13583
  }
13475
13584
  ),
13476
- selectedSeries.color && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("button", { type: "button", className: chartButtonClass, "data-action": "reset-color", onClick: () => controller.updateSeries(selectedSeries.id, { color: null }), children: "Palette" })
13585
+ selectedSeries.color && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("button", { type: "button", className: chartButtonClass, "data-action": "reset-color", onClick: () => controller.updateSeries(selectedSeries.id, { color: null }), children: "Palette" })
13477
13586
  ] }) }),
13478
- cartesian && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Field, { label: "Draw as", htmlFor: `${idBase}-series-type`, children: /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(
13587
+ cartesian && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Field, { label: "Draw as", htmlFor: `${idBase}-series-type`, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(
13479
13588
  "select",
13480
13589
  {
13481
13590
  id: `${idBase}-series-type`,
@@ -13484,12 +13593,12 @@ function ChartInspector({ controller, sections, className }) {
13484
13593
  "data-option": "series.type",
13485
13594
  onChange: (e) => controller.updateSeries(selectedSeries.id, { type: e.currentTarget.value || null }),
13486
13595
  children: [
13487
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("option", { value: "", children: "Chart type" }),
13488
- import_chart4.CHART_SERIES_TYPES.map((t) => /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("option", { value: t, children: import_chart4.CHART_TYPE_LABELS[t] }, t))
13596
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("option", { value: "", children: "Chart type" }),
13597
+ import_chart4.CHART_SERIES_TYPES.map((t) => /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("option", { value: t, children: import_chart4.CHART_TYPE_LABELS[t] }, t))
13489
13598
  ]
13490
13599
  }
13491
13600
  ) }),
13492
- (cartesian || family === "xy") && ["line", "area", "scatter"].includes((0, import_chart4.chartSeriesType)(spec, selectedSeries)) && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Field, { label: "Marker", htmlFor: `${idBase}-series-marker`, children: /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(
13601
+ (cartesian || family === "xy") && ["line", "area", "scatter"].includes((0, import_chart4.chartSeriesType)(spec, selectedSeries)) && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Field, { label: "Marker", htmlFor: `${idBase}-series-marker`, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(
13493
13602
  "select",
13494
13603
  {
13495
13604
  id: `${idBase}-series-marker`,
@@ -13498,12 +13607,12 @@ function ChartInspector({ controller, sections, className }) {
13498
13607
  "data-option": "series.marker",
13499
13608
  onChange: (e) => controller.updateSeries(selectedSeries.id, { marker: e.currentTarget.value || null }),
13500
13609
  children: [
13501
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("option", { value: "", children: "Default" }),
13502
- import_chart4.CHART_MARKERS.map((m) => /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("option", { value: m, children: cap(m) }, m))
13610
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("option", { value: "", children: "Default" }),
13611
+ import_chart4.CHART_MARKERS.map((m) => /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("option", { value: m, children: cap(m) }, m))
13503
13612
  ]
13504
13613
  }
13505
13614
  ) }),
13506
- annotated && calloutIndex !== null && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Field, { label: "Callout", htmlFor: `${idBase}-series-callout`, children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
13615
+ annotated && calloutIndex !== null && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Field, { label: "Callout", htmlFor: `${idBase}-series-callout`, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
13507
13616
  ChartCommitInput,
13508
13617
  {
13509
13618
  id: `${idBase}-series-callout`,
@@ -13514,15 +13623,15 @@ function ChartInspector({ controller, sections, className }) {
13514
13623
  onCommit: (text) => controller.setCallout(selectedSeries.id, calloutIndex, text || null).ok
13515
13624
  }
13516
13625
  ) }),
13517
- scales && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(ErrorBarFields, { controller, series: selectedSeries, which: "errorBars", idBase }),
13518
- family === "xy" && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(ErrorBarFields, { controller, series: selectedSeries, which: "xErrorBars", idBase }),
13519
- (0, import_chart4.chartSupportsTrendlines)(spec.type, spec.stacking) && /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: "space-y-1", "data-section": "trendlines", children: [
13520
- (selectedSeries.trendlines ?? []).map((t, i) => /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: "flex items-center gap-1", "data-trendline": i, children: [
13521
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("span", { className: "flex-1 truncate text-muted-foreground", children: (0, import_chart4.chartTrendlineName)(t, selectedSeries.name) }),
13522
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Toggle, { label: "R\xB2", name: `trendline.${i}.showR2`, checked: !!t.showR2, onChange: (showR2) => controller.updateTrendline(selectedSeries.id, i, { showR2 }) }),
13523
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("button", { type: "button", className: chartButtonClass, "aria-label": "Delete trendline", "data-action": "trendline-delete", onClick: () => controller.removeTrendline(selectedSeries.id, i), children: "\xD7" })
13626
+ scales && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(ErrorBarFields, { controller, series: selectedSeries, which: "errorBars", idBase }),
13627
+ family === "xy" && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(ErrorBarFields, { controller, series: selectedSeries, which: "xErrorBars", idBase }),
13628
+ (0, import_chart4.chartSupportsTrendlines)(spec.type, spec.stacking) && /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: "space-y-1", "data-section": "trendlines", children: [
13629
+ (selectedSeries.trendlines ?? []).map((t, i) => /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: "flex items-center gap-1", "data-trendline": i, children: [
13630
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("span", { className: "flex-1 truncate text-muted-foreground", children: (0, import_chart4.chartTrendlineName)(t, selectedSeries.name) }),
13631
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Toggle, { label: "R\xB2", name: `trendline.${i}.showR2`, checked: !!t.showR2, onChange: (showR2) => controller.updateTrendline(selectedSeries.id, i, { showR2 }) }),
13632
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("button", { type: "button", className: chartButtonClass, "aria-label": "Delete trendline", "data-action": "trendline-delete", onClick: () => controller.removeTrendline(selectedSeries.id, i), children: "\xD7" })
13524
13633
  ] }, i)),
13525
- /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(
13634
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(
13526
13635
  "select",
13527
13636
  {
13528
13637
  className: chartInputClass,
@@ -13531,32 +13640,32 @@ function ChartInspector({ controller, sections, className }) {
13531
13640
  "data-option": "trendline.add",
13532
13641
  onChange: (e) => e.currentTarget.value && controller.addTrendline(selectedSeries.id, { type: e.currentTarget.value }),
13533
13642
  children: [
13534
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("option", { value: "", children: "Add trendline\u2026" }),
13535
- import_chart4.CHART_TRENDLINE_TYPES.map((t) => /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("option", { value: t, children: cap(t.replace("-", " ")) }, t))
13643
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("option", { value: "", children: "Add trendline\u2026" }),
13644
+ import_chart4.CHART_TRENDLINE_TYPES.map((t) => /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("option", { value: t, children: cap(t.replace("-", " ")) }, t))
13536
13645
  ]
13537
13646
  }
13538
13647
  )
13539
13648
  ] }),
13540
- /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
13541
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Toggle, { label: "Hidden", name: "series.hidden", checked: !!selectedSeries.hidden, onChange: (hidden) => controller.updateSeries(selectedSeries.id, { hidden }) }),
13542
- family === "cartesian" && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Toggle, { label: "Secondary axis", name: "series.axis", checked: selectedSeries.axis === "secondary", onChange: (secondary) => controller.updateSeries(selectedSeries.id, { axis: secondary ? "secondary" : null }) }),
13543
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("span", { className: "flex-1" }),
13544
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("button", { type: "button", className: chartButtonClass, disabled: seriesIndex <= 0, "aria-label": "Move series earlier", "data-action": "series-up", onClick: () => controller.moveSeries(selectedSeries.id, seriesIndex - 1), children: "\u2191" }),
13545
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("button", { type: "button", className: chartButtonClass, disabled: seriesIndex >= spec.series.length - 1, "aria-label": "Move series later", "data-action": "series-down", onClick: () => controller.moveSeries(selectedSeries.id, seriesIndex + 1), children: "\u2193" }),
13546
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("button", { type: "button", className: `${chartButtonClass} text-destructive`, "data-action": "series-delete", onClick: () => controller.removeSeries(selectedSeries.id), children: "Delete" })
13649
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
13650
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Toggle, { label: "Hidden", name: "series.hidden", checked: !!selectedSeries.hidden, onChange: (hidden) => controller.updateSeries(selectedSeries.id, { hidden }) }),
13651
+ family === "cartesian" && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Toggle, { label: "Secondary axis", name: "series.axis", checked: selectedSeries.axis === "secondary", onChange: (secondary) => controller.updateSeries(selectedSeries.id, { axis: secondary ? "secondary" : null }) }),
13652
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("span", { className: "flex-1" }),
13653
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("button", { type: "button", className: chartButtonClass, disabled: seriesIndex <= 0, "aria-label": "Move series earlier", "data-action": "series-up", onClick: () => controller.moveSeries(selectedSeries.id, seriesIndex - 1), children: "\u2191" }),
13654
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("button", { type: "button", className: chartButtonClass, disabled: seriesIndex >= spec.series.length - 1, "aria-label": "Move series later", "data-action": "series-down", onClick: () => controller.moveSeries(selectedSeries.id, seriesIndex + 1), children: "\u2193" }),
13655
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("button", { type: "button", className: `${chartButtonClass} text-destructive`, "data-action": "series-delete", onClick: () => controller.removeSeries(selectedSeries.id), children: "Delete" })
13547
13656
  ] })
13548
13657
  ] })
13549
13658
  ] });
13550
13659
  }
13551
13660
 
13552
13661
  // src/chart-node/ChartNodeView.tsx
13553
- var import_jsx_runtime67 = require("react/jsx-runtime");
13662
+ var import_jsx_runtime68 = require("react/jsx-runtime");
13554
13663
  function ChartNodeView({ state, theme, showDataGrid = true }) {
13555
13664
  const { controller, editing, editable, selected, width, height, setEditing } = state;
13556
13665
  const open = () => {
13557
13666
  if (editable && !editing) setEditing(true);
13558
13667
  };
13559
- return /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(
13668
+ return /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(
13560
13669
  "div",
13561
13670
  {
13562
13671
  className: `not-prose my-2 rounded-md border bg-background p-1 ${selected ? "border-primary ring-1 ring-primary" : "border-border"}`,
@@ -13569,24 +13678,24 @@ function ChartNodeView({ state, theme, showDataGrid = true }) {
13569
13678
  }
13570
13679
  },
13571
13680
  children: [
13572
- editing && /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: "mb-1 flex items-center justify-between gap-2 px-1", "data-chart-node-toolbar": "", children: [
13573
- /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("span", { className: "text-xs text-muted-foreground", children: "Editing chart" }),
13574
- /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("button", { type: "button", className: chartButtonClass, "data-action": "done", onClick: () => setEditing(false), children: "Done" })
13681
+ editing && /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { className: "mb-1 flex items-center justify-between gap-2 px-1", "data-chart-node-toolbar": "", children: [
13682
+ /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("span", { className: "text-xs text-muted-foreground", children: "Editing chart" }),
13683
+ /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("button", { type: "button", className: chartButtonClass, "data-action": "done", onClick: () => setEditing(false), children: "Done" })
13575
13684
  ] }),
13576
- /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
13685
+ /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
13577
13686
  "div",
13578
13687
  {
13579
13688
  className: editable && !editing ? "cursor-pointer" : void 0,
13580
13689
  onClick: open,
13581
13690
  title: editable && !editing ? "Click to edit the chart" : void 0,
13582
13691
  "data-chart-node-canvas": "",
13583
- children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(ChartCanvas, { controller, width: width ?? 640, height, responsive: width === null, editable: editing, theme })
13692
+ children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(ChartCanvas, { controller, width: width ?? 640, height, responsive: width === null, editable: editing, theme })
13584
13693
  }
13585
13694
  ),
13586
13695
  editing && // Wraps by the document's width, not the viewport's: side by side when there is room.
13587
- /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: "mt-2 flex flex-wrap items-start gap-2", "data-chart-node-panel": "", children: [
13588
- showDataGrid && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { className: "min-w-0 flex-[1_1_20rem] overflow-x-auto", children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(ChartDataGrid, { controller }) }),
13589
- /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(ChartInspector, { controller, className: "max-h-96 min-w-0 flex-[1_1_16rem] overflow-y-auto rounded-md border border-border p-3" })
13696
+ /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { className: "mt-2 flex flex-wrap items-start gap-2", "data-chart-node-panel": "", children: [
13697
+ showDataGrid && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("div", { className: "min-w-0 flex-[1_1_20rem] overflow-x-auto", children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(ChartDataGrid, { controller }) }),
13698
+ /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(ChartInspector, { controller, className: "max-h-96 min-w-0 flex-[1_1_16rem] overflow-y-auto rounded-md border border-border p-3" })
13590
13699
  ] })
13591
13700
  ]
13592
13701
  }
@@ -13604,7 +13713,7 @@ function createReactChartNodeView(options = {}) {
13604
13713
  scheduled = true;
13605
13714
  queueMicrotask(() => {
13606
13715
  scheduled = false;
13607
- if (!destroyed) root.render(/* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Component, { ...props, state: latest }));
13716
+ if (!destroyed) root.render(/* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Component, { ...props, state: latest }));
13608
13717
  });
13609
13718
  };
13610
13719
  schedule();
@@ -13622,10 +13731,10 @@ function createReactChartNodeView(options = {}) {
13622
13731
  }
13623
13732
 
13624
13733
  // src/style/useStyle.ts
13625
- var import_react91 = require("react");
13734
+ var import_react92 = require("react");
13626
13735
  var message = (error) => error instanceof Error ? error.message : String(error);
13627
13736
  function useResolverTask(styles, run, deliver, deps) {
13628
- (0, import_react91.useEffect)(() => {
13737
+ (0, import_react92.useEffect)(() => {
13629
13738
  if (!styles || !run) {
13630
13739
  deliver({ value: null, error: null });
13631
13740
  return;
@@ -13652,7 +13761,7 @@ function useResolverTask(styles, run, deliver, deps) {
13652
13761
  }, [styles, ...deps]);
13653
13762
  }
13654
13763
  function useStyle(styles, domain) {
13655
- const [result, setResult] = (0, import_react91.useState)({ style: null, error: null });
13764
+ const [result, setResult] = (0, import_react92.useState)({ style: null, error: null });
13656
13765
  useResolverTask(
13657
13766
  styles,
13658
13767
  (s) => s.resolve(domain),
@@ -13662,7 +13771,7 @@ function useStyle(styles, domain) {
13662
13771
  return result;
13663
13772
  }
13664
13773
  function useStyleFindings(styles, domain, state) {
13665
- const [result, setResult] = (0, import_react91.useState)({ report: null, style: null, error: null });
13774
+ const [result, setResult] = (0, import_react92.useState)({ report: null, style: null, error: null });
13666
13775
  useResolverTask(
13667
13776
  styles,
13668
13777
  (s) => s.check(domain, state),
@@ -13679,7 +13788,7 @@ function useStyleFindings(styles, domain, state) {
13679
13788
  }
13680
13789
 
13681
13790
  // src/style/StyleFindings.tsx
13682
- var import_jsx_runtime68 = require("react/jsx-runtime");
13791
+ var import_jsx_runtime69 = require("react/jsx-runtime");
13683
13792
  var SEVERITY_CLASS = {
13684
13793
  error: "text-destructive",
13685
13794
  warning: "text-amber-600",
@@ -13688,24 +13797,24 @@ var SEVERITY_CLASS = {
13688
13797
  function StyleFindings({ report, onSelect, title = "House style", className = "" }) {
13689
13798
  if (!report) return null;
13690
13799
  const { findings, ran, skipped } = report;
13691
- return /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("section", { "data-style-findings": "", "aria-label": title, className: `flex flex-col gap-1.5 text-xs text-foreground ${className}`, children: [
13692
- /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("h3", { className: "text-[11px] font-semibold uppercase tracking-wide text-muted-foreground", children: title }),
13693
- findings.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("ul", { className: "flex flex-col gap-1", children: findings.map((finding, i) => {
13800
+ return /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("section", { "data-style-findings": "", "aria-label": title, className: `flex flex-col gap-1.5 text-xs text-foreground ${className}`, children: [
13801
+ /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("h3", { className: "text-[11px] font-semibold uppercase tracking-wide text-muted-foreground", children: title }),
13802
+ findings.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("ul", { className: "flex flex-col gap-1", children: findings.map((finding, i) => {
13694
13803
  const selectable = finding.target !== void 0 && !!onSelect;
13695
- const body = /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(import_jsx_runtime68.Fragment, { children: [
13696
- /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("span", { "data-style-severity": finding.severity, className: `shrink-0 font-semibold uppercase text-[10px] ${SEVERITY_CLASS[finding.severity]}`, children: finding.severity }),
13697
- /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("span", { className: "flex min-w-0 flex-col", children: [
13698
- /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("span", { "data-style-message": "", children: finding.message }),
13699
- /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("span", { className: "text-[10px] text-muted-foreground", children: [
13700
- /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("code", { children: finding.check }),
13701
- finding.layer && /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(import_jsx_runtime68.Fragment, { children: [
13804
+ const body = /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(import_jsx_runtime69.Fragment, { children: [
13805
+ /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("span", { "data-style-severity": finding.severity, className: `shrink-0 font-semibold uppercase text-[10px] ${SEVERITY_CLASS[finding.severity]}`, children: finding.severity }),
13806
+ /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("span", { className: "flex min-w-0 flex-col", children: [
13807
+ /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("span", { "data-style-message": "", children: finding.message }),
13808
+ /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("span", { className: "text-[10px] text-muted-foreground", children: [
13809
+ /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("code", { children: finding.check }),
13810
+ finding.layer && /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(import_jsx_runtime69.Fragment, { children: [
13702
13811
  " \xB7 ",
13703
13812
  finding.layer
13704
13813
  ] })
13705
13814
  ] })
13706
13815
  ] })
13707
13816
  ] });
13708
- return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("li", { "data-style-finding": finding.check, children: selectable ? /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
13817
+ return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("li", { "data-style-finding": finding.check, children: selectable ? /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
13709
13818
  "button",
13710
13819
  {
13711
13820
  type: "button",
@@ -13713,19 +13822,19 @@ function StyleFindings({ report, onSelect, title = "House style", className = ""
13713
13822
  onClick: () => onSelect(finding),
13714
13823
  children: body
13715
13824
  }
13716
- ) : /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("div", { className: "flex items-start gap-2 rounded border border-border px-2 py-1", children: body }) }, `${finding.check}-${i}`);
13825
+ ) : /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("div", { className: "flex items-start gap-2 rounded border border-border px-2 py-1", children: body }) }, `${finding.check}-${i}`);
13717
13826
  }) }),
13718
- findings.length === 0 && ran.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("p", { "data-style-clear": "", className: "text-emerald-600", children: [
13827
+ findings.length === 0 && ran.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("p", { "data-style-clear": "", className: "text-emerald-600", children: [
13719
13828
  "All clear: ",
13720
13829
  ran.length,
13721
13830
  " ",
13722
13831
  ran.length === 1 ? "check" : "checks",
13723
13832
  " passed."
13724
13833
  ] }),
13725
- findings.length === 0 && ran.length === 0 && skipped.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("p", { className: "text-muted-foreground", children: "No house-style checks apply." }),
13726
- skipped.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("ul", { "data-style-skipped": "", "aria-label": "Skipped checks", className: "flex flex-col gap-0.5 text-muted-foreground", children: skipped.map((s) => /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("li", { "data-style-skipped-check": s.check, children: [
13834
+ findings.length === 0 && ran.length === 0 && skipped.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("p", { className: "text-muted-foreground", children: "No house-style checks apply." }),
13835
+ skipped.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("ul", { "data-style-skipped": "", "aria-label": "Skipped checks", className: "flex flex-col gap-0.5 text-muted-foreground", children: skipped.map((s) => /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("li", { "data-style-skipped-check": s.check, children: [
13727
13836
  "Skipped ",
13728
- /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("code", { children: s.check }),
13837
+ /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("code", { children: s.check }),
13729
13838
  ": ",
13730
13839
  s.reason
13731
13840
  ] }, s.check)) })
@@ -13775,6 +13884,7 @@ function StyleFindings({ report, onSelect, title = "House style", className = ""
13775
13884
  NameManager,
13776
13885
  OutlinePanel,
13777
13886
  PaintGradientEditor,
13887
+ PathsPanel,
13778
13888
  PresenceLayer,
13779
13889
  RecoveryPrompt,
13780
13890
  RefineEdgePanel,