@pixerate/editor-react 0.121.0 → 0.123.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
@@ -36,6 +36,7 @@ __export(src_exports, {
36
36
  AssetMentionChips: () => AssetMentionChips,
37
37
  BrushOptionsBar: () => BrushOptionsBar,
38
38
  BubbleMenu: () => BubbleMenu,
39
+ ChannelsPanel: () => ChannelsPanel,
39
40
  ChartNodeView: () => ChartNodeView,
40
41
  ColorProfilePanel: () => ColorProfilePanel,
41
42
  CommandPalette: () => CommandPalette,
@@ -4039,8 +4040,8 @@ function useImageEffectsTools(registry, controller, options = {}) {
4039
4040
  }
4040
4041
 
4041
4042
  // src/image-editor/ImageEditor.tsx
4042
- var import_react66 = __toESM(require("react"), 1);
4043
- var import_image_editor19 = require("@pixerate/editor/image-editor");
4043
+ var import_react67 = __toESM(require("react"), 1);
4044
+ var import_image_editor20 = require("@pixerate/editor/image-editor");
4044
4045
 
4045
4046
  // src/image-editor/ImageEditorCanvas.tsx
4046
4047
  var import_react41 = require("react");
@@ -4417,6 +4418,10 @@ var ImageEditorCanvas = ({
4417
4418
  if (target?.closest?.('input, textarea, select, [contenteditable="true"]')) return;
4418
4419
  if (window.getSelection?.()?.toString()) return;
4419
4420
  const gesture = selectionGestureRef.current;
4421
+ if ((0, import_image_editor2.handleQuickMaskKey)(controller, e)) {
4422
+ e.preventDefault();
4423
+ return;
4424
+ }
4420
4425
  if ((0, import_image_editor2.handleSelectionShortcut)(controller, e, (message2) => report("select", message2))) {
4421
4426
  e.preventDefault();
4422
4427
  return;
@@ -8750,14 +8755,165 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
8750
8755
  ] });
8751
8756
  };
8752
8757
 
8753
- // src/image-editor/FreeTransformOptionsBar.tsx
8758
+ // src/image-editor/ChannelsPanel.tsx
8754
8759
  var import_react63 = require("react");
8755
8760
  var import_image_editor16 = require("@pixerate/editor/image-editor");
8756
8761
  var import_jsx_runtime43 = require("react/jsx-runtime");
8762
+ var btn2 = (on = false) => `px-2 py-1 rounded-md border text-[11px] transition-colors disabled:opacity-40 ${on ? "bg-primary border-primary text-primary-foreground" : "bg-background border-border text-foreground hover:bg-accent hover:text-accent-foreground"}`;
8763
+ var ChannelThumb = ({ channel, size }) => {
8764
+ const ref = (0, import_react63.useRef)(null);
8765
+ (0, import_react63.useEffect)(() => {
8766
+ const canvas = ref.current;
8767
+ const ctx = canvas?.getContext("2d");
8768
+ if (!canvas || !ctx || typeof ctx.createImageData !== "function") return;
8769
+ const px = (0, import_image_editor16.channelThumbnail)(channel, 64);
8770
+ canvas.width = px.width;
8771
+ canvas.height = px.height;
8772
+ const img = ctx.createImageData(px.width, px.height);
8773
+ img.data.set(px.data);
8774
+ ctx.putImageData(img, 0, 0);
8775
+ }, [channel.mask]);
8776
+ return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("canvas", { ref, "aria-hidden": "true", style: { width: size, height: size }, className: "shrink-0 rounded object-contain ring-1 ring-border bg-black" });
8777
+ };
8778
+ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
8779
+ const [, setTick] = (0, import_react63.useState)(0);
8780
+ (0, import_react63.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
8781
+ const [activeId, setActiveId] = (0, import_react63.useState)(null);
8782
+ const [renaming, setRenaming] = (0, import_react63.useState)(null);
8783
+ const [error, setError] = (0, import_react63.useState)(null);
8784
+ const fileInput = (0, import_react63.useRef)(null);
8785
+ const channels = controller.getChannels();
8786
+ const active = channels.find((c) => c.id === activeId) ?? null;
8787
+ const hasSelection = Boolean(controller.getSelection());
8788
+ const quickMask = controller.quickMaskEditing;
8789
+ const attempt = (fn) => {
8790
+ setError(null);
8791
+ try {
8792
+ fn();
8793
+ } catch (err) {
8794
+ setError(err instanceof Error ? err.message : String(err));
8795
+ }
8796
+ };
8797
+ const importFile = async (file) => {
8798
+ if (!file) return;
8799
+ setError(null);
8800
+ try {
8801
+ setActiveId((await (0, import_image_editor16.openMaskFile)(controller, file)).id);
8802
+ } catch (err) {
8803
+ setError(err instanceof Error ? err.message : String(err));
8804
+ }
8805
+ };
8806
+ return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { "data-testid": "channels-panel", className: `flex flex-col gap-2 text-xs ${className}`, children: [
8807
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex items-center justify-between", children: [
8808
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: imageSectionTitleClass, children: "Channels" }),
8809
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("button", { type: "button", "aria-pressed": quickMask, className: btn2(quickMask), title: "Paint the selection: white selects, black deselects (Q)", onClick: () => controller.setQuickMaskMode(!quickMask), children: "Quick Mask" })
8810
+ ] }),
8811
+ channels.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("p", { className: "text-muted-foreground", children: "No channels. Save a selection to keep it." }),
8812
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("ul", { role: "list", className: "flex flex-col gap-0.5", children: channels.map((c) => /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
8813
+ "li",
8814
+ {
8815
+ "data-testid": "channel-row",
8816
+ "aria-current": c.id === activeId ? "true" : void 0,
8817
+ className: `flex items-center gap-1.5 px-1.5 py-1 rounded cursor-pointer select-none ${c.id === activeId ? "bg-primary/30 ring-1 ring-primary" : "hover:bg-muted"}`,
8818
+ onClick: (e) => {
8819
+ setActiveId(c.id);
8820
+ attempt(() => controller.loadSelectionFromChannel(c.id, { mode: (0, import_image_editor16.selectionModeFromModifiers)(e, "replace") }));
8821
+ },
8822
+ onDoubleClick: () => setRenaming(c.id),
8823
+ children: [
8824
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
8825
+ "button",
8826
+ {
8827
+ type: "button",
8828
+ "aria-label": `${c.visible ? "Hide" : "Show"} ${c.name}`,
8829
+ "aria-pressed": c.visible,
8830
+ className: "w-4 text-muted-foreground",
8831
+ onClick: (e) => {
8832
+ e.stopPropagation();
8833
+ attempt(() => controller.setChannelProperties(c.id, { visible: !c.visible }));
8834
+ },
8835
+ children: c.visible ? "\u25CF" : "\u25CB"
8836
+ }
8837
+ ),
8838
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(ChannelThumb, { channel: c, size: thumbnailSize }),
8839
+ renaming === c.id ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
8840
+ "input",
8841
+ {
8842
+ autoFocus: true,
8843
+ "aria-label": "Channel name",
8844
+ defaultValue: c.name,
8845
+ className: "min-w-0 flex-1 bg-background border border-border rounded px-1 py-0.5 text-foreground",
8846
+ onClick: (e) => e.stopPropagation(),
8847
+ onBlur: (e) => {
8848
+ setRenaming(null);
8849
+ if (e.currentTarget.value.trim() && e.currentTarget.value !== c.name) attempt(() => controller.setChannelProperties(c.id, { name: e.currentTarget.value }));
8850
+ },
8851
+ onKeyDown: (e) => {
8852
+ if (e.key === "Enter") e.currentTarget.blur();
8853
+ if (e.key === "Escape") setRenaming(null);
8854
+ }
8855
+ }
8856
+ ) : /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "min-w-0 flex-1 truncate", children: c.name })
8857
+ ]
8858
+ },
8859
+ c.id
8860
+ )) }),
8861
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
8862
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("button", { type: "button", className: btn2(), disabled: !hasSelection, onClick: () => attempt(() => setActiveId(controller.saveSelection().id)), children: "Save Selection" }),
8863
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("button", { type: "button", className: btn2(), disabled: !active || !hasSelection, title: "Add the selection to the channel", onClick: () => attempt(() => controller.saveSelection({ channelId: active.id, mode: "add" })), children: "Add to Channel" }),
8864
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("button", { type: "button", className: btn2(), disabled: !active, onClick: () => attempt(() => setActiveId(controller.duplicateChannel(active.id).id)), children: "Duplicate" }),
8865
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
8866
+ "button",
8867
+ {
8868
+ type: "button",
8869
+ className: btn2(),
8870
+ disabled: !active,
8871
+ onClick: () => attempt(() => {
8872
+ controller.deleteChannel(active.id);
8873
+ setActiveId(null);
8874
+ }),
8875
+ children: "Delete"
8876
+ }
8877
+ ),
8878
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("button", { type: "button", className: btn2(), title: "Load a mask image (white = selected) into a new channel", onClick: () => fileInput.current?.click(), children: "Import\u2026" }),
8879
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
8880
+ "button",
8881
+ {
8882
+ type: "button",
8883
+ className: btn2(),
8884
+ disabled: !active && !hasSelection,
8885
+ title: active ? "Save the channel as a greyscale PNG" : "Save the selection as a greyscale PNG",
8886
+ onClick: () => attempt(() => (0, import_image_editor16.downloadMaskImage)(controller, active ? { channelId: active.id } : "selection", active?.name ?? "selection")),
8887
+ children: "Export PNG"
8888
+ }
8889
+ ),
8890
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
8891
+ "input",
8892
+ {
8893
+ ref: fileInput,
8894
+ type: "file",
8895
+ accept: import_image_editor16.MASK_FILE_ACCEPT,
8896
+ hidden: true,
8897
+ "data-testid": "channel-import-input",
8898
+ onChange: (e) => {
8899
+ void importFile(e.currentTarget.files?.[0]);
8900
+ e.currentTarget.value = "";
8901
+ }
8902
+ }
8903
+ )
8904
+ ] }),
8905
+ error && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("p", { role: "alert", className: "text-destructive", children: error })
8906
+ ] });
8907
+ };
8908
+
8909
+ // src/image-editor/FreeTransformOptionsBar.tsx
8910
+ var import_react64 = require("react");
8911
+ var import_image_editor17 = require("@pixerate/editor/image-editor");
8912
+ var import_jsx_runtime44 = require("react/jsx-runtime");
8757
8913
  var round = (v, unit) => unit === "px" ? Math.round(v * 10) / 10 : Math.round(v * 100) / 100;
8758
8914
  var FreeTransformOptionsBar = ({ tool, className }) => {
8759
- const [, setTick] = (0, import_react63.useState)(0);
8760
- (0, import_react63.useEffect)(() => tool.subscribe(() => setTick((n) => n + 1)), [tool]);
8915
+ const [, setTick] = (0, import_react64.useState)(0);
8916
+ (0, import_react64.useEffect)(() => tool.subscribe(() => setTick((n) => n + 1)), [tool]);
8761
8917
  const bar = tool.bar();
8762
8918
  if (!tool.active || !bar) return null;
8763
8919
  const warp = tool.warpBar();
@@ -8769,17 +8925,17 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
8769
8925
  const v = Number(raw);
8770
8926
  if (raw.trim() !== "" && Number.isFinite(v) && Math.abs(v - bar[field]) > 1e-9) tool.setField(field, v);
8771
8927
  };
8772
- return /* @__PURE__ */ (0, import_jsx_runtime43.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: [
8773
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "flex gap-1", role: "group", "aria-label": "Transform mode", children: import_image_editor16.FREE_TRANSFORM_MODE_OPTIONS.map((m) => /* @__PURE__ */ (0, import_jsx_runtime43.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)) }),
8774
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "grid grid-cols-3 gap-px", role: "group", "aria-label": "Reference point", children: import_image_editor16.TRANSFORM_ANCHORS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime43.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)) }),
8775
- tool.mode === "warp" && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex flex-wrap items-center gap-2", role: "group", "aria-label": "Warp options", children: [
8776
- /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("label", { className: "flex items-center gap-1", children: [
8777
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "text-muted-foreground", children: "Warp" }),
8778
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("select", { "aria-label": "Warp style", value: warp.style, onChange: (e) => tool.setWarp({ style: e.target.value }), className: imageFieldClass, children: import_image_editor16.WARP_STYLE_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("option", { value: o.id, children: o.label }, o.id)) })
8928
+ return /* @__PURE__ */ (0, import_jsx_runtime44.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: [
8929
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "flex gap-1", role: "group", "aria-label": "Transform mode", children: import_image_editor17.FREE_TRANSFORM_MODE_OPTIONS.map((m) => /* @__PURE__ */ (0, import_jsx_runtime44.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)) }),
8930
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "grid grid-cols-3 gap-px", role: "group", "aria-label": "Reference point", children: import_image_editor17.TRANSFORM_ANCHORS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime44.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)) }),
8931
+ tool.mode === "warp" && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "flex flex-wrap items-center gap-2", role: "group", "aria-label": "Warp options", children: [
8932
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("label", { className: "flex items-center gap-1", children: [
8933
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "text-muted-foreground", children: "Warp" }),
8934
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("select", { "aria-label": "Warp style", value: warp.style, onChange: (e) => tool.setWarp({ style: e.target.value }), className: imageFieldClass, children: import_image_editor17.WARP_STYLE_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("option", { value: o.id, children: o.label }, o.id)) })
8779
8935
  ] }),
8780
- ["bend", "horizontal", "vertical"].map((k) => /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("label", { className: "flex items-center gap-1", children: [
8781
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "text-muted-foreground", children: k === "bend" ? "Bend" : k === "horizontal" ? "H" : "V" }),
8782
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
8936
+ ["bend", "horizontal", "vertical"].map((k) => /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("label", { className: "flex items-center gap-1", children: [
8937
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "text-muted-foreground", children: k === "bend" ? "Bend" : k === "horizontal" ? "H" : "V" }),
8938
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
8783
8939
  "input",
8784
8940
  {
8785
8941
  type: "number",
@@ -8800,9 +8956,9 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
8800
8956
  },
8801
8957
  `${k}:${warp[k]}`
8802
8958
  ),
8803
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "text-muted-foreground", children: "%" })
8959
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "text-muted-foreground", children: "%" })
8804
8960
  ] }, k)),
8805
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
8961
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
8806
8962
  "button",
8807
8963
  {
8808
8964
  type: "button",
@@ -8814,26 +8970,26 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
8814
8970
  children: "Vertical"
8815
8971
  }
8816
8972
  ),
8817
- /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("label", { className: "flex items-center gap-1", children: [
8818
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "text-muted-foreground", children: "Grid" }),
8819
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
8973
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("label", { className: "flex items-center gap-1", children: [
8974
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "text-muted-foreground", children: "Grid" }),
8975
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
8820
8976
  "select",
8821
8977
  {
8822
8978
  "aria-label": "Warp grid",
8823
- value: import_image_editor16.WARP_GRID_OPTIONS.find((g) => g.columns === warp.columns && g.rows === warp.rows)?.id ?? "1x1",
8979
+ value: import_image_editor17.WARP_GRID_OPTIONS.find((g) => g.columns === warp.columns && g.rows === warp.rows)?.id ?? "1x1",
8824
8980
  onChange: (e) => {
8825
- const g = import_image_editor16.WARP_GRID_OPTIONS.find((o) => o.id === e.target.value);
8981
+ const g = import_image_editor17.WARP_GRID_OPTIONS.find((o) => o.id === e.target.value);
8826
8982
  tool.setWarp({ columns: g.columns, rows: g.rows });
8827
8983
  },
8828
8984
  className: imageFieldClass,
8829
- children: import_image_editor16.WARP_GRID_OPTIONS.map((g) => /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("option", { value: g.id, children: g.label }, g.id))
8985
+ children: import_image_editor17.WARP_GRID_OPTIONS.map((g) => /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("option", { value: g.id, children: g.label }, g.id))
8830
8986
  }
8831
8987
  )
8832
8988
  ] })
8833
8989
  ] }),
8834
- tool.mode !== "warp" && import_image_editor16.FREE_TRANSFORM_FIELDS.map((f) => /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("label", { className: "flex items-center gap-1", title: f.title, children: [
8835
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "text-muted-foreground", children: f.label }),
8836
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
8990
+ tool.mode !== "warp" && import_image_editor17.FREE_TRANSFORM_FIELDS.map((f) => /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("label", { className: "flex items-center gap-1", title: f.title, children: [
8991
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "text-muted-foreground", children: f.label }),
8992
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
8837
8993
  "input",
8838
8994
  {
8839
8995
  type: "number",
@@ -8853,8 +9009,8 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
8853
9009
  },
8854
9010
  `${f.id}:${round(bar[f.id], f.unit)}`
8855
9011
  ),
8856
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "text-muted-foreground", children: f.unit }),
8857
- f.id === "scaleX" && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
9012
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "text-muted-foreground", children: f.unit }),
9013
+ f.id === "scaleX" && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
8858
9014
  "button",
8859
9015
  {
8860
9016
  type: "button",
@@ -8869,33 +9025,33 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
8869
9025
  }
8870
9026
  )
8871
9027
  ] }, f.id)),
8872
- /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("label", { className: "flex items-center gap-1", children: [
8873
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "text-muted-foreground", children: "Interpolation" }),
8874
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
9028
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("label", { className: "flex items-center gap-1", children: [
9029
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "text-muted-foreground", children: "Interpolation" }),
9030
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
8875
9031
  "select",
8876
9032
  {
8877
9033
  "aria-label": "Interpolation",
8878
9034
  value: tool.interpolation,
8879
9035
  onChange: (e) => tool.setInterpolation(e.target.value),
8880
9036
  className: imageFieldClass,
8881
- children: import_image_editor16.INTERPOLATIONS.map((i) => /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("option", { value: i, children: i[0].toUpperCase() + i.slice(1) }, i))
9037
+ children: import_image_editor17.INTERPOLATIONS.map((i) => /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("option", { value: i, children: i[0].toUpperCase() + i.slice(1) }, i))
8882
9038
  }
8883
9039
  )
8884
9040
  ] }),
8885
- /* @__PURE__ */ (0, import_jsx_runtime43.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" }),
8886
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("button", { type: "button", title: "Cancel (Esc)", className: imageChipClass(false), onClick: () => tool.cancel(), children: "Cancel" }),
8887
- tool.error && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { role: "alert", className: "text-destructive", children: tool.error })
9041
+ /* @__PURE__ */ (0, import_jsx_runtime44.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" }),
9042
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("button", { type: "button", title: "Cancel (Esc)", className: imageChipClass(false), onClick: () => tool.cancel(), children: "Cancel" }),
9043
+ tool.error && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { role: "alert", className: "text-destructive", children: tool.error })
8888
9044
  ] });
8889
9045
  };
8890
9046
 
8891
9047
  // src/image-editor/ShapeOptionsBar.tsx
8892
- var import_react64 = require("react");
8893
- var import_image_editor17 = require("@pixerate/editor/image-editor");
8894
- var import_jsx_runtime44 = require("react/jsx-runtime");
9048
+ var import_react65 = require("react");
9049
+ var import_image_editor18 = require("@pixerate/editor/image-editor");
9050
+ var import_jsx_runtime45 = require("react/jsx-runtime");
8895
9051
  var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
8896
- const [, setTick] = (0, import_react64.useState)(0);
8897
- (0, import_react64.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
8898
- const [error, setError] = (0, import_react64.useState)(null);
9052
+ const [, setTick] = (0, import_react65.useState)(0);
9053
+ (0, import_react65.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
9054
+ const [error, setError] = (0, import_react65.useState)(null);
8899
9055
  const active = controller.getActiveLayer();
8900
9056
  const shapeId = active?.type === "shape" ? active.id : null;
8901
9057
  const set = (change) => {
@@ -8903,28 +9059,28 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
8903
9059
  if (!shapeId) return;
8904
9060
  try {
8905
9061
  setError(null);
8906
- (0, import_image_editor17.applyShapeOptions)(controller, shapeId, change);
9062
+ (0, import_image_editor18.applyShapeOptions)(controller, shapeId, change);
8907
9063
  } catch (e) {
8908
9064
  setError(e instanceof Error ? e.message : String(e));
8909
9065
  }
8910
9066
  };
8911
9067
  const num = (v, min, max) => Math.max(min, Math.min(max, Number(v) || min));
8912
- return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "shape-options", children: [
8913
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Shape kind", children: import_image_editor17.LIVE_SHAPE_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("button", { type: "button", "aria-pressed": options.kind === k, className: imageChipClass(options.kind === k), onClick: () => onChange({ ...options, kind: k }), children: import_image_editor17.SHAPE_KIND_LABELS[k] }, k)) }),
8914
- /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
8915
- /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("label", { className: "flex items-center gap-1", children: [
8916
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(ImageCheckbox, { label: "Fill", checked: options.fill !== null, onChange: (on) => set({ fill: on ? "#4f46e5" : null }) }),
9068
+ return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "shape-options", children: [
9069
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Shape kind", children: import_image_editor18.LIVE_SHAPE_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("button", { type: "button", "aria-pressed": options.kind === k, className: imageChipClass(options.kind === k), onClick: () => onChange({ ...options, kind: k }), children: import_image_editor18.SHAPE_KIND_LABELS[k] }, k)) }),
9070
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
9071
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("label", { className: "flex items-center gap-1", children: [
9072
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(ImageCheckbox, { label: "Fill", checked: options.fill !== null, onChange: (on) => set({ fill: on ? "#4f46e5" : null }) }),
8917
9073
  "Fill",
8918
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(ImageColor, { label: "Fill colour", disabled: options.fill === null, value: options.fill ?? "#4f46e5", onChange: (fill) => set({ fill }) })
9074
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(ImageColor, { label: "Fill colour", disabled: options.fill === null, value: options.fill ?? "#4f46e5", onChange: (fill) => set({ fill }) })
8919
9075
  ] }),
8920
- /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("label", { className: "flex items-center gap-1", children: [
8921
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(ImageCheckbox, { label: "Stroke", checked: options.stroke !== null, onChange: (on) => set({ stroke: on ? "#000000" : null }) }),
9076
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("label", { className: "flex items-center gap-1", children: [
9077
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(ImageCheckbox, { label: "Stroke", checked: options.stroke !== null, onChange: (on) => set({ stroke: on ? "#000000" : null }) }),
8922
9078
  "Stroke",
8923
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(ImageColor, { label: "Stroke colour", disabled: options.stroke === null, value: options.stroke ?? "#000000", onChange: (stroke) => set({ stroke }) })
9079
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(ImageColor, { label: "Stroke colour", disabled: options.stroke === null, value: options.stroke ?? "#000000", onChange: (stroke) => set({ stroke }) })
8924
9080
  ] }),
8925
- /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("label", { className: "flex items-center gap-1", children: [
9081
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("label", { className: "flex items-center gap-1", children: [
8926
9082
  "Width",
8927
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
9083
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
8928
9084
  "input",
8929
9085
  {
8930
9086
  type: "number",
@@ -8938,51 +9094,51 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
8938
9094
  )
8939
9095
  ] })
8940
9096
  ] }),
8941
- /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
8942
- options.kind === "rect" && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("label", { className: "flex items-center gap-1", children: [
9097
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
9098
+ options.kind === "rect" && /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("label", { className: "flex items-center gap-1", children: [
8943
9099
  "Radius",
8944
- /* @__PURE__ */ (0, import_jsx_runtime44.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}` })
9100
+ /* @__PURE__ */ (0, import_jsx_runtime45.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}` })
8945
9101
  ] }),
8946
- options.kind === "polygon" && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("label", { className: "flex items-center gap-1", children: [
9102
+ options.kind === "polygon" && /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("label", { className: "flex items-center gap-1", children: [
8947
9103
  "Sides",
8948
- /* @__PURE__ */ (0, import_jsx_runtime44.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}` })
9104
+ /* @__PURE__ */ (0, import_jsx_runtime45.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}` })
8949
9105
  ] }),
8950
- options.kind === "star" && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_jsx_runtime44.Fragment, { children: [
8951
- /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("label", { className: "flex items-center gap-1", children: [
9106
+ options.kind === "star" && /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_jsx_runtime45.Fragment, { children: [
9107
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("label", { className: "flex items-center gap-1", children: [
8952
9108
  "Points",
8953
- /* @__PURE__ */ (0, import_jsx_runtime44.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}` })
9109
+ /* @__PURE__ */ (0, import_jsx_runtime45.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}` })
8954
9110
  ] }),
8955
- /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("label", { className: "flex items-center gap-1", children: [
9111
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("label", { className: "flex items-center gap-1", children: [
8956
9112
  "Inner",
8957
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(ImageRange, { label: "Inner radius", min: 0.05, max: 1, step: 0.05, value: options.innerRatio, onChange: (v) => set({ innerRatio: v }) })
9113
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(ImageRange, { label: "Inner radius", min: 0.05, max: 1, step: 0.05, value: options.innerRatio, onChange: (v) => set({ innerRatio: v }) })
8958
9114
  ] })
8959
9115
  ] }),
8960
- options.kind === "line" && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_jsx_runtime44.Fragment, { children: [
8961
- /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("label", { className: "flex items-center gap-1", children: [
9116
+ options.kind === "line" && /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_jsx_runtime45.Fragment, { children: [
9117
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("label", { className: "flex items-center gap-1", children: [
8962
9118
  "Weight",
8963
- /* @__PURE__ */ (0, import_jsx_runtime44.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}` })
9119
+ /* @__PURE__ */ (0, import_jsx_runtime45.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}` })
8964
9120
  ] }),
8965
- /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("label", { className: "flex items-center gap-1", children: [
8966
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(ImageCheckbox, { label: "Arrowhead", checked: options.arrow, onChange: (on) => set({ arrow: on }) }),
9121
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("label", { className: "flex items-center gap-1", children: [
9122
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(ImageCheckbox, { label: "Arrowhead", checked: options.arrow, onChange: (on) => set({ arrow: on }) }),
8967
9123
  "Arrowhead"
8968
9124
  ] })
8969
9125
  ] })
8970
9126
  ] }),
8971
- /* @__PURE__ */ (0, import_jsx_runtime44.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." }),
8972
- error && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("p", { role: "alert", className: "text-destructive", children: error })
9127
+ /* @__PURE__ */ (0, import_jsx_runtime45.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." }),
9128
+ error && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("p", { role: "alert", className: "text-destructive", children: error })
8973
9129
  ] });
8974
9130
  };
8975
9131
 
8976
9132
  // src/image-editor/TypeOptionsBar.tsx
8977
- var import_react65 = require("react");
8978
- var import_image_editor18 = require("@pixerate/editor/image-editor");
8979
- var import_jsx_runtime45 = require("react/jsx-runtime");
9133
+ var import_react66 = require("react");
9134
+ var import_image_editor19 = require("@pixerate/editor/image-editor");
9135
+ var import_jsx_runtime46 = require("react/jsx-runtime");
8980
9136
  var ALIGN_LABELS = { left: "Left", center: "Centre", right: "Right", justify: "Justify" };
8981
9137
  var TypeOptionsBar = ({ controller, options, onChange, session, className }) => {
8982
- const [, setTick] = (0, import_react65.useState)(0);
8983
- (0, import_react65.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
8984
- (0, import_react65.useEffect)(() => session?.subscribe(() => setTick((n) => n + 1)), [session]);
8985
- const [error, setError] = (0, import_react65.useState)(null);
9138
+ const [, setTick] = (0, import_react66.useState)(0);
9139
+ (0, import_react66.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
9140
+ (0, import_react66.useEffect)(() => session?.subscribe(() => setTick((n) => n + 1)), [session]);
9141
+ const [error, setError] = (0, import_react66.useState)(null);
8986
9142
  const active = controller.getActiveLayer();
8987
9143
  const typeId = !session && active?.type === "type" ? active.id : null;
8988
9144
  const here = session?.alive ? session.styleHere() : {};
@@ -9014,11 +9170,11 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
9014
9170
  setError(e instanceof Error ? e.message : String(e));
9015
9171
  }
9016
9172
  };
9017
- return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "type-options", children: [
9018
- /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
9019
- /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("label", { className: "flex items-center gap-1", children: [
9173
+ return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "type-options", children: [
9174
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
9175
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("label", { className: "flex items-center gap-1", children: [
9020
9176
  "Font",
9021
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
9177
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
9022
9178
  "input",
9023
9179
  {
9024
9180
  list: "pixerate-type-fonts",
@@ -9028,11 +9184,11 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
9028
9184
  className: "w-32 rounded border border-border bg-background px-1 py-0.5"
9029
9185
  }
9030
9186
  ),
9031
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("datalist", { id: "pixerate-type-fonts", children: fonts.map((f) => /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("option", { value: f }, f)) })
9187
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("datalist", { id: "pixerate-type-fonts", children: fonts.map((f) => /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("option", { value: f }, f)) })
9032
9188
  ] }),
9033
- /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("label", { className: "flex items-center gap-1", children: [
9189
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("label", { className: "flex items-center gap-1", children: [
9034
9190
  "Size",
9035
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
9191
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
9036
9192
  "input",
9037
9193
  {
9038
9194
  type: "number",
@@ -9045,24 +9201,24 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
9045
9201
  }
9046
9202
  )
9047
9203
  ] }),
9048
- /* @__PURE__ */ (0, import_jsx_runtime45.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" }),
9049
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("button", { type: "button", "aria-pressed": shown.italic, className: `${imageChipClass(shown.italic)} italic`, onClick: () => style({ italic: !shown.italic }), children: "I" }),
9050
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(ImageColor, { label: "Text colour", value: shown.color, onChange: (color) => style({ color }) })
9204
+ /* @__PURE__ */ (0, import_jsx_runtime46.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" }),
9205
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("button", { type: "button", "aria-pressed": shown.italic, className: `${imageChipClass(shown.italic)} italic`, onClick: () => style({ italic: !shown.italic }), children: "I" }),
9206
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(ImageColor, { label: "Text colour", value: shown.color, onChange: (color) => style({ color }) })
9051
9207
  ] }),
9052
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Alignment", children: import_image_editor18.TEXT_ALIGNS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("button", { type: "button", "aria-pressed": options.align === a, className: imageChipClass(options.align === a), onClick: () => style({ align: a }), children: ALIGN_LABELS[a] }, a)) }),
9053
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("p", { className: "text-[10px] text-muted-foreground", children: "Click to type point text, drag for a paragraph box, click text to edit it. Esc finishes." }),
9054
- missing.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("p", { role: "status", className: "text-amber-600", "data-testid": "type-missing-fonts", children: [
9208
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Alignment", children: import_image_editor19.TEXT_ALIGNS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("button", { type: "button", "aria-pressed": options.align === a, className: imageChipClass(options.align === a), onClick: () => style({ align: a }), children: ALIGN_LABELS[a] }, a)) }),
9209
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("p", { className: "text-[10px] text-muted-foreground", children: "Click to type point text, drag for a paragraph box, click text to edit it. Esc finishes." }),
9210
+ missing.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("p", { role: "status", className: "text-amber-600", "data-testid": "type-missing-fonts", children: [
9055
9211
  "Missing ",
9056
9212
  missing.length === 1 ? "font" : "fonts",
9057
9213
  ": ",
9058
9214
  missing.join(", ")
9059
9215
  ] }),
9060
- error && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("p", { role: "alert", className: "text-destructive", children: error })
9216
+ error && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("p", { role: "alert", className: "text-destructive", children: error })
9061
9217
  ] });
9062
9218
  };
9063
9219
 
9064
9220
  // src/image-editor/ImageEditor.tsx
9065
- var import_jsx_runtime46 = require("react/jsx-runtime");
9221
+ var import_jsx_runtime47 = require("react/jsx-runtime");
9066
9222
  var ImageEditor = ({
9067
9223
  editor: externalEditor,
9068
9224
  src,
@@ -9086,51 +9242,51 @@ var ImageEditor = ({
9086
9242
  const effectsShown = !!controller.effectsProvider || state.layers.some(function has(l) {
9087
9243
  return l.type === "pixel" && !!l.generator || l.type === "smart" && !!l.smartFilters?.filters.some((f) => f.kind === "effect") || l.type === "group" && l.children.some(has);
9088
9244
  });
9089
- const legacyProcess = (0, import_image_editor19.normalizeProcessVersion)(state.adjustments.process) < import_image_editor19.LATEST_PROCESS_VERSION;
9090
- const [activeTab, setActiveTab] = (0, import_react66.useState)("crop");
9091
- const rootRef = (0, import_react66.useRef)(null);
9245
+ const legacyProcess = (0, import_image_editor20.normalizeProcessVersion)(state.adjustments.process) < import_image_editor20.LATEST_PROCESS_VERSION;
9246
+ const [activeTab, setActiveTab] = (0, import_react67.useState)("crop");
9247
+ const rootRef = (0, import_react67.useRef)(null);
9092
9248
  const canvasMode = activeTab === "crop" || activeTab === "select" || activeTab === "paint" || activeTab === "annotate" ? activeTab : "none";
9093
- const activeTabRef = (0, import_react66.useRef)(activeTab);
9249
+ const activeTabRef = (0, import_react67.useRef)(activeTab);
9094
9250
  activeTabRef.current = activeTab;
9095
9251
  const openPanel = async (ref) => {
9096
9252
  if (ref.kind !== "panel" || activeTabRef.current === ref.id) return;
9097
9253
  rootRef.current?.querySelector(`[data-image-tab="${CSS.escape(ref.id)}"]`)?.click();
9098
9254
  await new Promise((resolve) => setTimeout(resolve, 60));
9099
9255
  };
9100
- const [activeCropRatio, setActiveCropRatio] = (0, import_react66.useState)(null);
9101
- const [selectionOptions, setSelectionOptions] = (0, import_react66.useState)(import_image_editor19.DEFAULT_SELECTION_TOOL_OPTIONS);
9102
- const [shapeOptions, setShapeOptions] = (0, import_react66.useState)(import_image_editor19.DEFAULT_SHAPE_TOOL_OPTIONS);
9103
- const [typeOptions, setTypeOptions] = (0, import_react66.useState)(import_image_editor19.DEFAULT_TYPE_TOOL_OPTIONS);
9104
- const [typeSession, setTypeSession] = (0, import_react66.useState)(null);
9105
- const [selectionError, setSelectionError] = (0, import_react66.useState)(null);
9106
- const [paintError, setPaintError] = (0, import_react66.useState)(null);
9107
- const [shapeTypeError, setShapeTypeError] = (0, import_react66.useState)(null);
9256
+ const [activeCropRatio, setActiveCropRatio] = (0, import_react67.useState)(null);
9257
+ const [selectionOptions, setSelectionOptions] = (0, import_react67.useState)(import_image_editor20.DEFAULT_SELECTION_TOOL_OPTIONS);
9258
+ const [shapeOptions, setShapeOptions] = (0, import_react67.useState)(import_image_editor20.DEFAULT_SHAPE_TOOL_OPTIONS);
9259
+ const [typeOptions, setTypeOptions] = (0, import_react67.useState)(import_image_editor20.DEFAULT_TYPE_TOOL_OPTIONS);
9260
+ const [typeSession, setTypeSession] = (0, import_react67.useState)(null);
9261
+ const [selectionError, setSelectionError] = (0, import_react67.useState)(null);
9262
+ const [paintError, setPaintError] = (0, import_react67.useState)(null);
9263
+ const [shapeTypeError, setShapeTypeError] = (0, import_react67.useState)(null);
9108
9264
  const handleCanvasError = (source, message2) => {
9109
9265
  if (source === "paint") setPaintError(message2);
9110
9266
  else if (source === "select") setSelectionError(message2);
9111
9267
  else setShapeTypeError(message2);
9112
9268
  };
9113
9269
  const finishTyping = () => setTypeSession(null);
9114
- const transformToolRef = (0, import_react66.useRef)(null);
9115
- const transformControllerRef = (0, import_react66.useRef)(controller);
9270
+ const transformToolRef = (0, import_react67.useRef)(null);
9271
+ const transformControllerRef = (0, import_react67.useRef)(controller);
9116
9272
  if (!transformToolRef.current || transformControllerRef.current !== controller) {
9117
9273
  transformToolRef.current?.cancel();
9118
- transformToolRef.current = new import_image_editor19.FreeTransformTool(controller, {
9274
+ transformToolRef.current = new import_image_editor20.FreeTransformTool(controller, {
9119
9275
  schedule: (run) => typeof requestAnimationFrame !== "undefined" ? requestAnimationFrame(run) : run()
9120
9276
  });
9121
9277
  transformControllerRef.current = controller;
9122
9278
  }
9123
9279
  const transformTool = transformToolRef.current;
9124
- const [, setTransformTick] = (0, import_react66.useState)(0);
9125
- (0, import_react66.useEffect)(() => transformTool.subscribe(() => setTransformTick((n) => n + 1)), [transformTool]);
9126
- (0, import_react66.useEffect)(() => () => transformToolRef.current?.cancel(), []);
9127
- const [inpaintPrompt, setInpaintPrompt] = (0, import_react66.useState)("");
9128
- const [inpaintMaskMode, setInpaintMaskMode] = (0, import_react66.useState)("annotations");
9129
- const [isRemovingBg, setIsRemovingBg] = (0, import_react66.useState)(false);
9130
- const [isInpainting, setIsInpainting] = (0, import_react66.useState)(false);
9131
- const [aiError, setAiError] = (0, import_react66.useState)(null);
9132
- const [aiSuccess, setAiSuccess] = (0, import_react66.useState)(null);
9133
- const [aiTarget, setAiTarget] = (0, import_react66.useState)("auto");
9280
+ const [, setTransformTick] = (0, import_react67.useState)(0);
9281
+ (0, import_react67.useEffect)(() => transformTool.subscribe(() => setTransformTick((n) => n + 1)), [transformTool]);
9282
+ (0, import_react67.useEffect)(() => () => transformToolRef.current?.cancel(), []);
9283
+ const [inpaintPrompt, setInpaintPrompt] = (0, import_react67.useState)("");
9284
+ const [inpaintMaskMode, setInpaintMaskMode] = (0, import_react67.useState)("annotations");
9285
+ const [isRemovingBg, setIsRemovingBg] = (0, import_react67.useState)(false);
9286
+ const [isInpainting, setIsInpainting] = (0, import_react67.useState)(false);
9287
+ const [aiError, setAiError] = (0, import_react67.useState)(null);
9288
+ const [aiSuccess, setAiSuccess] = (0, import_react67.useState)(null);
9289
+ const [aiTarget, setAiTarget] = (0, import_react67.useState)("auto");
9134
9290
  const aiOptions = aiTarget === "auto" ? {} : { target: aiTarget };
9135
9291
  const effectiveOnInpaint = onInpaint || aiHooks?.onInpaint;
9136
9292
  const effectiveOnRemoveBg = onRemoveBackground || aiHooks?.onRemoveBackground;
@@ -9193,11 +9349,11 @@ var ImageEditor = ({
9193
9349
  setIsInpainting(false);
9194
9350
  }
9195
9351
  };
9196
- const [activeColor, setActiveColor] = (0, import_react66.useState)("#ef4444");
9197
- const [strokeWidth, setStrokeWidth] = (0, import_react66.useState)(3);
9198
- const [fontSize, setFontSize] = (0, import_react66.useState)(24);
9199
- const [textInput, setTextInput] = (0, import_react66.useState)("");
9200
- (0, import_react66.useEffect)(() => {
9352
+ const [activeColor, setActiveColor] = (0, import_react67.useState)("#ef4444");
9353
+ const [strokeWidth, setStrokeWidth] = (0, import_react67.useState)(3);
9354
+ const [fontSize, setFontSize] = (0, import_react67.useState)(24);
9355
+ const [textInput, setTextInput] = (0, import_react67.useState)("");
9356
+ (0, import_react67.useEffect)(() => {
9201
9357
  if (activeTab === "crop" && editor.state.activeTool !== "crop") {
9202
9358
  editor.setTool("crop");
9203
9359
  }
@@ -9225,16 +9381,16 @@ var ImageEditor = ({
9225
9381
  link.click();
9226
9382
  }
9227
9383
  };
9228
- return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
9384
+ return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
9229
9385
  "div",
9230
9386
  {
9231
9387
  ref: rootRef,
9232
9388
  className: `${imageEditorFrameClass} ${className}`,
9233
9389
  style,
9234
9390
  children: [
9235
- /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: imageEditorHeaderClass, children: [
9236
- /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { role: "tablist", className: imageTabListClass, children: [
9237
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
9391
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: imageEditorHeaderClass, children: [
9392
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { role: "tablist", className: imageTabListClass, children: [
9393
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
9238
9394
  "button",
9239
9395
  {
9240
9396
  type: "button",
@@ -9249,7 +9405,7 @@ var ImageEditor = ({
9249
9405
  children: "Transform & Crop"
9250
9406
  }
9251
9407
  ),
9252
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
9408
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
9253
9409
  "button",
9254
9410
  {
9255
9411
  type: "button",
@@ -9264,7 +9420,7 @@ var ImageEditor = ({
9264
9420
  children: "Adjustments"
9265
9421
  }
9266
9422
  ),
9267
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
9423
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
9268
9424
  "button",
9269
9425
  {
9270
9426
  type: "button",
@@ -9279,7 +9435,7 @@ var ImageEditor = ({
9279
9435
  children: "Layers"
9280
9436
  }
9281
9437
  ),
9282
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
9438
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
9283
9439
  "button",
9284
9440
  {
9285
9441
  type: "button",
@@ -9294,7 +9450,7 @@ var ImageEditor = ({
9294
9450
  children: "Paint"
9295
9451
  }
9296
9452
  ),
9297
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
9453
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
9298
9454
  "button",
9299
9455
  {
9300
9456
  type: "button",
@@ -9309,7 +9465,7 @@ var ImageEditor = ({
9309
9465
  children: "Select & Mask"
9310
9466
  }
9311
9467
  ),
9312
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
9468
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
9313
9469
  "button",
9314
9470
  {
9315
9471
  type: "button",
@@ -9324,7 +9480,7 @@ var ImageEditor = ({
9324
9480
  children: "Annotations"
9325
9481
  }
9326
9482
  ),
9327
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
9483
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
9328
9484
  "button",
9329
9485
  {
9330
9486
  type: "button",
@@ -9339,7 +9495,7 @@ var ImageEditor = ({
9339
9495
  children: "Depth Mask"
9340
9496
  }
9341
9497
  ),
9342
- /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
9498
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
9343
9499
  "button",
9344
9500
  {
9345
9501
  type: "button",
@@ -9352,14 +9508,14 @@ var ImageEditor = ({
9352
9508
  "aria-selected": activeTab === "ai",
9353
9509
  className: `${imageTabClass(activeTab === "ai")} flex items-center gap-1.5`,
9354
9510
  children: [
9355
- /* @__PURE__ */ (0, import_jsx_runtime46.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_runtime46.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" }) }),
9511
+ /* @__PURE__ */ (0, import_jsx_runtime47.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_runtime47.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" }) }),
9356
9512
  "AI Tools"
9357
9513
  ]
9358
9514
  }
9359
9515
  )
9360
9516
  ] }),
9361
- /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "flex items-center gap-2 text-xs", children: [
9362
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
9517
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex items-center gap-2 text-xs", children: [
9518
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
9363
9519
  "button",
9364
9520
  {
9365
9521
  type: "button",
@@ -9370,7 +9526,7 @@ var ImageEditor = ({
9370
9526
  children: "\u21A9"
9371
9527
  }
9372
9528
  ),
9373
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
9529
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
9374
9530
  "button",
9375
9531
  {
9376
9532
  type: "button",
@@ -9381,7 +9537,7 @@ var ImageEditor = ({
9381
9537
  children: "\u21AA"
9382
9538
  }
9383
9539
  ),
9384
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
9540
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
9385
9541
  "button",
9386
9542
  {
9387
9543
  type: "button",
@@ -9390,8 +9546,8 @@ var ImageEditor = ({
9390
9546
  children: "Reset"
9391
9547
  }
9392
9548
  ),
9393
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: "h-4 w-px bg-muted mx-1" }),
9394
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
9549
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "h-4 w-px bg-muted mx-1" }),
9550
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
9395
9551
  "button",
9396
9552
  {
9397
9553
  type: "button",
@@ -9401,11 +9557,11 @@ var ImageEditor = ({
9401
9557
  children: "-"
9402
9558
  }
9403
9559
  ),
9404
- /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("span", { className: "font-mono text-muted-foreground w-10 text-center", children: [
9560
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("span", { className: "font-mono text-muted-foreground w-10 text-center", children: [
9405
9561
  Math.round(state.zoom * 100),
9406
9562
  "%"
9407
9563
  ] }),
9408
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
9564
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
9409
9565
  "button",
9410
9566
  {
9411
9567
  type: "button",
@@ -9415,8 +9571,8 @@ var ImageEditor = ({
9415
9571
  children: "+"
9416
9572
  }
9417
9573
  ),
9418
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: "h-4 w-px bg-muted mx-1" }),
9419
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
9574
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "h-4 w-px bg-muted mx-1" }),
9575
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
9420
9576
  "button",
9421
9577
  {
9422
9578
  type: "button",
@@ -9427,7 +9583,7 @@ var ImageEditor = ({
9427
9583
  children: "Hold Compare"
9428
9584
  }
9429
9585
  ),
9430
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
9586
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
9431
9587
  "button",
9432
9588
  {
9433
9589
  type: "button",
@@ -9438,10 +9594,10 @@ var ImageEditor = ({
9438
9594
  )
9439
9595
  ] })
9440
9596
  ] }),
9441
- transformTool.active && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(FreeTransformOptionsBar, { tool: transformTool, className: "border-b border-border bg-background/95 px-4 py-2" }),
9442
- !transformTool.active && transformTool.error && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { role: "alert", className: imageErrorBannerClass, children: transformTool.error }),
9443
- /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "flex flex-col md:flex-row flex-1 min-h-[520px] md:h-[560px]", children: [
9444
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
9597
+ transformTool.active && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(FreeTransformOptionsBar, { tool: transformTool, className: "border-b border-border bg-background/95 px-4 py-2" }),
9598
+ !transformTool.active && transformTool.error && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { role: "alert", className: imageErrorBannerClass, children: transformTool.error }),
9599
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex flex-col md:flex-row flex-1 min-h-[520px] md:h-[560px]", children: [
9600
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
9445
9601
  ImageEditorCanvas,
9446
9602
  {
9447
9603
  editor,
@@ -9465,11 +9621,11 @@ var ImageEditor = ({
9465
9621
  className: "flex-1 h-[360px] md:h-full min-h-[320px] bg-muted"
9466
9622
  }
9467
9623
  ),
9468
- /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: imageSidebarClass, children: [
9469
- activeTab === "crop" && /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
9470
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { className: imageSectionTitleClass, children: "Aspect Ratio Presets" }),
9471
- /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "grid grid-cols-3 gap-2", children: [
9472
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
9624
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: imageSidebarClass, children: [
9625
+ activeTab === "crop" && /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
9626
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: imageSectionTitleClass, children: "Aspect Ratio Presets" }),
9627
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "grid grid-cols-3 gap-2", children: [
9628
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
9473
9629
  "button",
9474
9630
  {
9475
9631
  type: "button",
@@ -9481,7 +9637,7 @@ var ImageEditor = ({
9481
9637
  children: "Freeform"
9482
9638
  }
9483
9639
  ),
9484
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
9640
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
9485
9641
  "button",
9486
9642
  {
9487
9643
  type: "button",
@@ -9493,7 +9649,7 @@ var ImageEditor = ({
9493
9649
  children: "1:1 Square"
9494
9650
  }
9495
9651
  ),
9496
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
9652
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
9497
9653
  "button",
9498
9654
  {
9499
9655
  type: "button",
@@ -9505,7 +9661,7 @@ var ImageEditor = ({
9505
9661
  children: "4:3 Standard"
9506
9662
  }
9507
9663
  ),
9508
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
9664
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
9509
9665
  "button",
9510
9666
  {
9511
9667
  type: "button",
@@ -9517,7 +9673,7 @@ var ImageEditor = ({
9517
9673
  children: "16:9 Wide"
9518
9674
  }
9519
9675
  ),
9520
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
9676
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
9521
9677
  "button",
9522
9678
  {
9523
9679
  type: "button",
@@ -9529,7 +9685,7 @@ var ImageEditor = ({
9529
9685
  children: "3:2 Photo"
9530
9686
  }
9531
9687
  ),
9532
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
9688
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
9533
9689
  "button",
9534
9690
  {
9535
9691
  type: "button",
@@ -9542,10 +9698,10 @@ var ImageEditor = ({
9542
9698
  }
9543
9699
  )
9544
9700
  ] }),
9545
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: imageDividerClass }),
9546
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { className: imageSectionTitleClass, children: "Orientation & Flips" }),
9547
- /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "grid grid-cols-2 gap-2", children: [
9548
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
9701
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: imageDividerClass }),
9702
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: imageSectionTitleClass, children: "Orientation & Flips" }),
9703
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "grid grid-cols-2 gap-2", children: [
9704
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
9549
9705
  "button",
9550
9706
  {
9551
9707
  type: "button",
@@ -9554,7 +9710,7 @@ var ImageEditor = ({
9554
9710
  children: "Rotate -90\xB0"
9555
9711
  }
9556
9712
  ),
9557
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
9713
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
9558
9714
  "button",
9559
9715
  {
9560
9716
  type: "button",
@@ -9563,7 +9719,7 @@ var ImageEditor = ({
9563
9719
  children: "Rotate +90\xB0"
9564
9720
  }
9565
9721
  ),
9566
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
9722
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
9567
9723
  "button",
9568
9724
  {
9569
9725
  type: "button",
@@ -9572,7 +9728,7 @@ var ImageEditor = ({
9572
9728
  children: "Flip Horizontal"
9573
9729
  }
9574
9730
  ),
9575
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
9731
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
9576
9732
  "button",
9577
9733
  {
9578
9734
  type: "button",
@@ -9583,10 +9739,10 @@ var ImageEditor = ({
9583
9739
  )
9584
9740
  ] })
9585
9741
  ] }),
9586
- activeTab === "adjust" && /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
9587
- /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "flex items-center justify-between", children: [
9588
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { className: imageSectionTitleClass, children: "Color Adjustments" }),
9589
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
9742
+ activeTab === "adjust" && /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
9743
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex items-center justify-between", children: [
9744
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: imageSectionTitleClass, children: "Color Adjustments" }),
9745
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
9590
9746
  "button",
9591
9747
  {
9592
9748
  type: "button",
@@ -9596,25 +9752,25 @@ var ImageEditor = ({
9596
9752
  }
9597
9753
  )
9598
9754
  ] }),
9599
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(Histogram, { histogram: editor.histogram }),
9600
- import_image_editor19.IMAGE_ADJUSTMENT_CONTROLS.map((spec) => /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_react66.default.Fragment, { children: [
9601
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
9755
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Histogram, { histogram: editor.histogram }),
9756
+ import_image_editor20.IMAGE_ADJUSTMENT_CONTROLS.map((spec) => /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_react67.default.Fragment, { children: [
9757
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
9602
9758
  ControlSlider,
9603
9759
  {
9604
9760
  spec,
9605
- value: (0, import_image_editor19.readAdjustmentControls)(state.adjustments)[spec.id],
9761
+ value: (0, import_image_editor20.readAdjustmentControls)(state.adjustments)[spec.id],
9606
9762
  disabled: spec.requiresProcess !== void 0 && legacyProcess,
9607
9763
  onChange: (v) => editor.setAdjustments({ [spec.id]: v })
9608
9764
  }
9609
9765
  ),
9610
- spec.id === "tint" && legacyProcess && /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
9766
+ spec.id === "tint" && legacyProcess && /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
9611
9767
  "div",
9612
9768
  {
9613
9769
  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",
9614
9770
  "data-testid": "image-editor-process-notice",
9615
9771
  children: [
9616
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { children: "Legacy rendering (process 1). Tint needs the current process." }),
9617
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
9772
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { children: "Legacy rendering (process 1). Tint needs the current process." }),
9773
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
9618
9774
  "button",
9619
9775
  {
9620
9776
  type: "button",
@@ -9627,7 +9783,7 @@ var ImageEditor = ({
9627
9783
  }
9628
9784
  )
9629
9785
  ] }, spec.id)),
9630
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: imageSectionClass, children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
9786
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: imageSectionClass, children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
9631
9787
  AdjustmentLayersPanel,
9632
9788
  {
9633
9789
  controller,
@@ -9636,9 +9792,9 @@ var ImageEditor = ({
9636
9792
  }
9637
9793
  ) })
9638
9794
  ] }),
9639
- activeTab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
9640
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { className: imageSectionTitleClass, children: "Layers" }),
9641
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
9795
+ activeTab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
9796
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: imageSectionTitleClass, children: "Layers" }),
9797
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
9642
9798
  "button",
9643
9799
  {
9644
9800
  type: "button",
@@ -9649,15 +9805,15 @@ var ImageEditor = ({
9649
9805
  children: "Free Transform"
9650
9806
  }
9651
9807
  ),
9652
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(LayersPanel, { controller }),
9653
- effectsShown && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(ImageProviderEffectsPanel, { controller, className: imageSectionClass }),
9654
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { className: imageSectionTitleClass, children: "Colour" }),
9655
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(ColorProfilePanel, { controller })
9808
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(LayersPanel, { controller }),
9809
+ effectsShown && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(ImageProviderEffectsPanel, { controller, className: imageSectionClass }),
9810
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: imageSectionTitleClass, children: "Colour" }),
9811
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(ColorProfilePanel, { controller })
9656
9812
  ] }),
9657
- activeTab === "paint" && /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
9658
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { className: imageSectionTitleClass, children: "Paint" }),
9659
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(BrushOptionsBar, { controller }),
9660
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
9813
+ activeTab === "paint" && /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
9814
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: imageSectionTitleClass, children: "Paint" }),
9815
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(BrushOptionsBar, { controller }),
9816
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
9661
9817
  "button",
9662
9818
  {
9663
9819
  type: "button",
@@ -9668,12 +9824,12 @@ var ImageEditor = ({
9668
9824
  children: "Free Transform"
9669
9825
  }
9670
9826
  ),
9671
- paintError && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("p", { role: "alert", className: "text-destructive", "data-testid": "paint-error", children: paintError }),
9672
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: imageSectionClass, children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(LayersPanel, { controller }) })
9827
+ paintError && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("p", { role: "alert", className: "text-destructive", "data-testid": "paint-error", children: paintError }),
9828
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: imageSectionClass, children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(LayersPanel, { controller }) })
9673
9829
  ] }),
9674
- activeTab === "annotate" && /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
9675
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { className: imageSectionTitleClass, children: "Shape & Type Layers" }),
9676
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: "grid grid-cols-2 gap-1.5", children: ["shape", "type"].map((t) => /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
9830
+ activeTab === "annotate" && /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
9831
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: imageSectionTitleClass, children: "Shape & Type Layers" }),
9832
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "grid grid-cols-2 gap-1.5", children: ["shape", "type"].map((t) => /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
9677
9833
  "button",
9678
9834
  {
9679
9835
  type: "button",
@@ -9684,13 +9840,13 @@ var ImageEditor = ({
9684
9840
  },
9685
9841
  t
9686
9842
  )) }),
9687
- state.activeTool === "shape" && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(ShapeOptionsBar, { controller, options: shapeOptions, onChange: setShapeOptions }),
9688
- state.activeTool === "type" && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(TypeOptionsBar, { controller, options: typeOptions, onChange: setTypeOptions, session: typeSession }),
9689
- state.activeTool === "type" && typeSession && /* @__PURE__ */ (0, import_jsx_runtime46.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" }),
9690
- shapeTypeError && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("p", { role: "alert", className: "text-destructive", "data-testid": "shape-type-error", children: shapeTypeError }),
9691
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: imageDividerClass }),
9692
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { className: imageSectionTitleClass, children: "Draw & Annotate" }),
9693
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: "grid grid-cols-3 gap-1.5", children: ["pen", "rect", "circle", "arrow", "line"].map((t) => /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
9843
+ state.activeTool === "shape" && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(ShapeOptionsBar, { controller, options: shapeOptions, onChange: setShapeOptions }),
9844
+ state.activeTool === "type" && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(TypeOptionsBar, { controller, options: typeOptions, onChange: setTypeOptions, session: typeSession }),
9845
+ state.activeTool === "type" && typeSession && /* @__PURE__ */ (0, import_jsx_runtime47.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" }),
9846
+ shapeTypeError && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("p", { role: "alert", className: "text-destructive", "data-testid": "shape-type-error", children: shapeTypeError }),
9847
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: imageDividerClass }),
9848
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: imageSectionTitleClass, children: "Draw & Annotate" }),
9849
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "grid grid-cols-3 gap-1.5", children: ["pen", "rect", "circle", "arrow", "line"].map((t) => /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
9694
9850
  "button",
9695
9851
  {
9696
9852
  type: "button",
@@ -9700,18 +9856,18 @@ var ImageEditor = ({
9700
9856
  },
9701
9857
  t
9702
9858
  )) }),
9703
- /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "flex items-center gap-2 mt-2", children: [
9704
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("label", { className: "text-muted-foreground", children: "Color:" }),
9705
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(ImageColor, { label: "Annotation colour", value: activeColor, onChange: setActiveColor }),
9706
- /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "flex-1 ml-2", children: [
9707
- /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-0.5", children: [
9708
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { children: "Width:" }),
9709
- /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("span", { className: "font-mono", children: [
9859
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex items-center gap-2 mt-2", children: [
9860
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("label", { className: "text-muted-foreground", children: "Color:" }),
9861
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(ImageColor, { label: "Annotation colour", value: activeColor, onChange: setActiveColor }),
9862
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex-1 ml-2", children: [
9863
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-0.5", children: [
9864
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { children: "Width:" }),
9865
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("span", { className: "font-mono", children: [
9710
9866
  strokeWidth,
9711
9867
  "px"
9712
9868
  ] })
9713
9869
  ] }),
9714
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
9870
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
9715
9871
  "input",
9716
9872
  {
9717
9873
  type: "range",
@@ -9724,10 +9880,10 @@ var ImageEditor = ({
9724
9880
  )
9725
9881
  ] })
9726
9882
  ] }),
9727
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: imageDividerClass }),
9728
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { className: imageSectionTitleClass, children: "Add Text" }),
9729
- /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "flex gap-2", children: [
9730
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
9883
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: imageDividerClass }),
9884
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: imageSectionTitleClass, children: "Add Text" }),
9885
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex gap-2", children: [
9886
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
9731
9887
  "input",
9732
9888
  {
9733
9889
  type: "text",
@@ -9738,7 +9894,7 @@ var ImageEditor = ({
9738
9894
  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"
9739
9895
  }
9740
9896
  ),
9741
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
9897
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
9742
9898
  "button",
9743
9899
  {
9744
9900
  type: "button",
@@ -9748,14 +9904,14 @@ var ImageEditor = ({
9748
9904
  }
9749
9905
  )
9750
9906
  ] }),
9751
- /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "flex items-center justify-between text-muted-foreground", children: [
9752
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { children: "Font Size:" }),
9753
- /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("span", { className: "font-mono", children: [
9907
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex items-center justify-between text-muted-foreground", children: [
9908
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { children: "Font Size:" }),
9909
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("span", { className: "font-mono", children: [
9754
9910
  fontSize,
9755
9911
  "px"
9756
9912
  ] })
9757
9913
  ] }),
9758
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
9914
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
9759
9915
  "input",
9760
9916
  {
9761
9917
  type: "range",
@@ -9766,14 +9922,14 @@ var ImageEditor = ({
9766
9922
  className: imageRangeClass
9767
9923
  }
9768
9924
  ),
9769
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: imageDividerClass }),
9770
- /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "flex items-center justify-between", children: [
9771
- /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("span", { className: "text-muted-foreground", children: [
9925
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: imageDividerClass }),
9926
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex items-center justify-between", children: [
9927
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("span", { className: "text-muted-foreground", children: [
9772
9928
  "Layers (",
9773
9929
  state.annotations.length,
9774
9930
  ")"
9775
9931
  ] }),
9776
- state.selectedAnnotationId && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
9932
+ state.selectedAnnotationId && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
9777
9933
  "button",
9778
9934
  {
9779
9935
  type: "button",
@@ -9782,7 +9938,7 @@ var ImageEditor = ({
9782
9938
  children: "Delete Selected"
9783
9939
  }
9784
9940
  ),
9785
- state.annotations.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
9941
+ state.annotations.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
9786
9942
  "button",
9787
9943
  {
9788
9944
  type: "button",
@@ -9793,10 +9949,10 @@ var ImageEditor = ({
9793
9949
  )
9794
9950
  ] })
9795
9951
  ] }),
9796
- activeTab === "depth" && /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
9797
- /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "flex items-center justify-between", children: [
9798
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { className: imageSectionTitleClass, children: "Depth Masking" }),
9799
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
9952
+ activeTab === "depth" && /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
9953
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex items-center justify-between", children: [
9954
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: imageSectionTitleClass, children: "Depth Masking" }),
9955
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
9800
9956
  "button",
9801
9957
  {
9802
9958
  type: "button",
@@ -9806,8 +9962,8 @@ var ImageEditor = ({
9806
9962
  }
9807
9963
  )
9808
9964
  ] }),
9809
- /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("label", { className: "flex items-center gap-2 cursor-pointer text-foreground", children: [
9810
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
9965
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("label", { className: "flex items-center gap-2 cursor-pointer text-foreground", children: [
9966
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
9811
9967
  "input",
9812
9968
  {
9813
9969
  type: "checkbox",
@@ -9816,12 +9972,12 @@ var ImageEditor = ({
9816
9972
  className: "rounded accent-primary"
9817
9973
  }
9818
9974
  ),
9819
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { children: "Enable Depth / Alpha Mask" })
9975
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { children: "Enable Depth / Alpha Mask" })
9820
9976
  ] }),
9821
- state.depthMask.enabled && /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_jsx_runtime46.Fragment, { children: [
9822
- /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { children: [
9823
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("label", { className: "text-muted-foreground block mb-1", children: "Mask Image URL:" }),
9824
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
9977
+ state.depthMask.enabled && /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_jsx_runtime47.Fragment, { children: [
9978
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { children: [
9979
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("label", { className: "text-muted-foreground block mb-1", children: "Mask Image URL:" }),
9980
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
9825
9981
  "input",
9826
9982
  {
9827
9983
  type: "text",
@@ -9832,8 +9988,8 @@ var ImageEditor = ({
9832
9988
  }
9833
9989
  )
9834
9990
  ] }),
9835
- /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "flex gap-2", children: [
9836
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
9991
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex gap-2", children: [
9992
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
9837
9993
  "button",
9838
9994
  {
9839
9995
  type: "button",
@@ -9842,7 +9998,7 @@ var ImageEditor = ({
9842
9998
  children: "Threshold Mode"
9843
9999
  }
9844
10000
  ),
9845
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
10001
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
9846
10002
  "button",
9847
10003
  {
9848
10004
  type: "button",
@@ -9852,12 +10008,12 @@ var ImageEditor = ({
9852
10008
  }
9853
10009
  )
9854
10010
  ] }),
9855
- /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { children: [
9856
- /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
9857
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { children: "Depth Start (Lower):" }),
9858
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { className: "font-mono", children: state.depthMask.depthRange[0] })
10011
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { children: [
10012
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
10013
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { children: "Depth Start (Lower):" }),
10014
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "font-mono", children: state.depthMask.depthRange[0] })
9859
10015
  ] }),
9860
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
10016
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
9861
10017
  "input",
9862
10018
  {
9863
10019
  type: "range",
@@ -9871,12 +10027,12 @@ var ImageEditor = ({
9871
10027
  }
9872
10028
  )
9873
10029
  ] }),
9874
- /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { children: [
9875
- /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
9876
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { children: "Depth Stop (Upper):" }),
9877
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { className: "font-mono", children: state.depthMask.depthRange[1] })
10030
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { children: [
10031
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
10032
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { children: "Depth Stop (Upper):" }),
10033
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "font-mono", children: state.depthMask.depthRange[1] })
9878
10034
  ] }),
9879
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
10035
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
9880
10036
  "input",
9881
10037
  {
9882
10038
  type: "range",
@@ -9890,12 +10046,12 @@ var ImageEditor = ({
9890
10046
  }
9891
10047
  )
9892
10048
  ] }),
9893
- /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { children: [
9894
- /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
9895
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { children: "Softness:" }),
9896
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { className: "font-mono", children: state.depthMask.softness })
10049
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { children: [
10050
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
10051
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { children: "Softness:" }),
10052
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "font-mono", children: state.depthMask.softness })
9897
10053
  ] }),
9898
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
10054
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
9899
10055
  "input",
9900
10056
  {
9901
10057
  type: "range",
@@ -9907,8 +10063,8 @@ var ImageEditor = ({
9907
10063
  }
9908
10064
  )
9909
10065
  ] }),
9910
- /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("label", { className: "flex items-center gap-2 cursor-pointer text-foreground mt-1", children: [
9911
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
10066
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("label", { className: "flex items-center gap-2 cursor-pointer text-foreground mt-1", children: [
10067
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
9912
10068
  "input",
9913
10069
  {
9914
10070
  type: "checkbox",
@@ -9917,12 +10073,12 @@ var ImageEditor = ({
9917
10073
  className: "rounded accent-primary"
9918
10074
  }
9919
10075
  ),
9920
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { children: "Invert Mask" })
10076
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { children: "Invert Mask" })
9921
10077
  ] })
9922
10078
  ] })
9923
10079
  ] }),
9924
- activeTab === "select" && /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
9925
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
10080
+ activeTab === "select" && /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
10081
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
9926
10082
  SelectionOptionsBar,
9927
10083
  {
9928
10084
  controller,
@@ -9933,9 +10089,9 @@ var ImageEditor = ({
9933
10089
  selectionDisplay: state.selectionDisplay
9934
10090
  }
9935
10091
  ),
9936
- selectionError && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("p", { role: "alert", className: "text-destructive", children: selectionError }),
9937
- /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "flex gap-1", children: [
9938
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
10092
+ selectionError && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("p", { role: "alert", className: "text-destructive", children: selectionError }),
10093
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex gap-1", children: [
10094
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
9939
10095
  "button",
9940
10096
  {
9941
10097
  type: "button",
@@ -9946,7 +10102,7 @@ var ImageEditor = ({
9946
10102
  children: "Transform Selection"
9947
10103
  }
9948
10104
  ),
9949
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
10105
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
9950
10106
  "button",
9951
10107
  {
9952
10108
  type: "button",
@@ -9958,12 +10114,13 @@ var ImageEditor = ({
9958
10114
  }
9959
10115
  )
9960
10116
  ] }),
9961
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(RefineEdgePanel, { controller, selection: state.selection ?? null, layers: state.adjustments.layers })
10117
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(RefineEdgePanel, { controller, selection: state.selection ?? null, layers: state.adjustments.layers }),
10118
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(ChannelsPanel, { controller })
9962
10119
  ] }),
9963
- activeTab === "ai" && /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
9964
- /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("label", { className: "flex items-center justify-between gap-2 text-foreground", children: [
9965
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { children: "Results go to" }),
9966
- /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
10120
+ activeTab === "ai" && /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
10121
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("label", { className: "flex items-center justify-between gap-2 text-foreground", children: [
10122
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { children: "Results go to" }),
10123
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
9967
10124
  "select",
9968
10125
  {
9969
10126
  "aria-label": "AI result target",
@@ -9971,54 +10128,54 @@ var ImageEditor = ({
9971
10128
  onChange: (e) => setAiTarget(e.target.value),
9972
10129
  className: imageSelectClass,
9973
10130
  children: [
9974
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("option", { value: "auto", children: controller.isMultiLayer ? "Auto (new layer)" : "Auto (replace image)" }),
9975
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("option", { value: "new-layer", children: "New layer / mask" }),
9976
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("option", { value: "replace", children: "Replace image" })
10131
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("option", { value: "auto", children: controller.isMultiLayer ? "Auto (new layer)" : "Auto (replace image)" }),
10132
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("option", { value: "new-layer", children: "New layer / mask" }),
10133
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("option", { value: "replace", children: "Replace image" })
9977
10134
  ]
9978
10135
  }
9979
10136
  )
9980
10137
  ] }),
9981
- /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
9982
- /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "flex items-center justify-between", children: [
9983
- /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
9984
- /* @__PURE__ */ (0, import_jsx_runtime46.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_runtime46.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" }) }),
10138
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
10139
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex items-center justify-between", children: [
10140
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
10141
+ /* @__PURE__ */ (0, import_jsx_runtime47.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_runtime47.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" }) }),
9985
10142
  "Background Removal"
9986
10143
  ] }),
9987
- isRemovingBg && /* @__PURE__ */ (0, import_jsx_runtime46.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..." })
10144
+ isRemovingBg && /* @__PURE__ */ (0, import_jsx_runtime47.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..." })
9988
10145
  ] }),
9989
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Isolate foreground subject with AI alpha transparency segmentation." }),
9990
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
10146
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Isolate foreground subject with AI alpha transparency segmentation." }),
10147
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
9991
10148
  "button",
9992
10149
  {
9993
10150
  type: "button",
9994
10151
  onClick: handleRemoveBackground,
9995
10152
  disabled: isRemovingBg || isInpainting,
9996
10153
  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",
9997
- children: isRemovingBg ? /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_jsx_runtime46.Fragment, { children: [
9998
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: imageSpinnerClass }),
10154
+ children: isRemovingBg ? /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_jsx_runtime47.Fragment, { children: [
10155
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: imageSpinnerClass }),
9999
10156
  "Removing Background..."
10000
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_jsx_runtime46.Fragment, { children: [
10001
- /* @__PURE__ */ (0, import_jsx_runtime46.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_runtime46.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" }) }),
10157
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_jsx_runtime47.Fragment, { children: [
10158
+ /* @__PURE__ */ (0, import_jsx_runtime47.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_runtime47.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" }) }),
10002
10159
  "Remove Background"
10003
10160
  ] })
10004
10161
  }
10005
10162
  )
10006
10163
  ] }),
10007
- /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
10008
- /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "flex items-center justify-between", children: [
10009
- /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
10010
- /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("svg", { className: "w-3.5 h-3.5 text-primary", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
10011
- /* @__PURE__ */ (0, import_jsx_runtime46.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" }),
10012
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("path", { d: "m14 7 3 3" })
10164
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
10165
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex items-center justify-between", children: [
10166
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
10167
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("svg", { className: "w-3.5 h-3.5 text-primary", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
10168
+ /* @__PURE__ */ (0, import_jsx_runtime47.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" }),
10169
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("path", { d: "m14 7 3 3" })
10013
10170
  ] }),
10014
10171
  "Generative Inpainting"
10015
10172
  ] }),
10016
- isInpainting && /* @__PURE__ */ (0, import_jsx_runtime46.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..." })
10173
+ isInpainting && /* @__PURE__ */ (0, import_jsx_runtime47.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..." })
10017
10174
  ] }),
10018
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Replace, modify, or fill selected regions using prompt-guided generative inpainting." }),
10019
- /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "flex flex-col gap-1", children: [
10020
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("label", { htmlFor: "ai-inpaint-prompt-react", className: "text-foreground text-[11px] font-medium", children: "Prompt" }),
10021
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
10175
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Replace, modify, or fill selected regions using prompt-guided generative inpainting." }),
10176
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex flex-col gap-1", children: [
10177
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("label", { htmlFor: "ai-inpaint-prompt-react", className: "text-foreground text-[11px] font-medium", children: "Prompt" }),
10178
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
10022
10179
  "textarea",
10023
10180
  {
10024
10181
  id: "ai-inpaint-prompt-react",
@@ -10030,10 +10187,10 @@ var ImageEditor = ({
10030
10187
  }
10031
10188
  )
10032
10189
  ] }),
10033
- /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "flex flex-col gap-1", children: [
10034
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { className: "text-foreground text-[11px] font-medium", children: "Target Mask Region" }),
10035
- /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "grid grid-cols-2 gap-1.5", children: [
10036
- /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
10190
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex flex-col gap-1", children: [
10191
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "text-foreground text-[11px] font-medium", children: "Target Mask Region" }),
10192
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "grid grid-cols-2 gap-1.5", children: [
10193
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
10037
10194
  "button",
10038
10195
  {
10039
10196
  type: "button",
@@ -10046,7 +10203,7 @@ var ImageEditor = ({
10046
10203
  ]
10047
10204
  }
10048
10205
  ),
10049
- /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
10206
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
10050
10207
  "button",
10051
10208
  {
10052
10209
  type: "button",
@@ -10061,25 +10218,25 @@ var ImageEditor = ({
10061
10218
  )
10062
10219
  ] })
10063
10220
  ] }),
10064
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
10221
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
10065
10222
  "button",
10066
10223
  {
10067
10224
  type: "button",
10068
10225
  onClick: handleInpaint,
10069
10226
  disabled: isInpainting || isRemovingBg || !inpaintPrompt.trim(),
10070
10227
  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",
10071
- children: isInpainting ? /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_jsx_runtime46.Fragment, { children: [
10072
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: imageSpinnerClass }),
10228
+ children: isInpainting ? /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_jsx_runtime47.Fragment, { children: [
10229
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: imageSpinnerClass }),
10073
10230
  "Generating Inpaint..."
10074
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_jsx_runtime46.Fragment, { children: [
10075
- /* @__PURE__ */ (0, import_jsx_runtime46.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_runtime46.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" }) }),
10231
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_jsx_runtime47.Fragment, { children: [
10232
+ /* @__PURE__ */ (0, import_jsx_runtime47.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_runtime47.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" }) }),
10076
10233
  "Apply Inpainting"
10077
10234
  ] })
10078
10235
  }
10079
10236
  )
10080
10237
  ] }),
10081
- aiError && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: "p-2.5 rounded-lg bg-destructive/10 border border-destructive/40 text-destructive text-[11px]", children: aiError }),
10082
- aiSuccess && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: "p-2.5 rounded-lg bg-emerald-500/10 border border-emerald-500/30 text-emerald-600 text-[11px]", children: aiSuccess })
10238
+ aiError && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "p-2.5 rounded-lg bg-destructive/10 border border-destructive/40 text-destructive text-[11px]", children: aiError }),
10239
+ aiSuccess && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "p-2.5 rounded-lg bg-emerald-500/10 border border-emerald-500/30 text-emerald-600 text-[11px]", children: aiSuccess })
10083
10240
  ] })
10084
10241
  ] })
10085
10242
  ] })
@@ -10089,7 +10246,7 @@ var ImageEditor = ({
10089
10246
  };
10090
10247
 
10091
10248
  // src/review/useReview.ts
10092
- var import_react67 = require("react");
10249
+ var import_react68 = require("react");
10093
10250
  var import_editor13 = require("@pixerate/editor");
10094
10251
  var EMPTY_COMMENTS = Object.freeze({
10095
10252
  threads: [],
@@ -10108,23 +10265,23 @@ function isCommentStore(value) {
10108
10265
  }
10109
10266
  function useComments(source) {
10110
10267
  const store = isCommentStore(source) ? source : (0, import_editor13.getCommentStore)(source);
10111
- const subscribe = (0, import_react67.useCallback)(
10268
+ const subscribe = (0, import_react68.useCallback)(
10112
10269
  (onChange) => store ? store.subscribe(() => onChange()) : noopUnsubscribe,
10113
10270
  [store]
10114
10271
  );
10115
10272
  const getSnapshot2 = () => store?.getSnapshot() ?? EMPTY_COMMENTS;
10116
- const snapshot = (0, import_react67.useSyncExternalStore)(subscribe, getSnapshot2, getSnapshot2);
10117
- return (0, import_react67.useMemo)(() => ({ ...snapshot, store }), [snapshot, store]);
10273
+ const snapshot = (0, import_react68.useSyncExternalStore)(subscribe, getSnapshot2, getSnapshot2);
10274
+ return (0, import_react68.useMemo)(() => ({ ...snapshot, store }), [snapshot, store]);
10118
10275
  }
10119
10276
  function useTrackChanges(editor) {
10120
10277
  const store = (0, import_editor13.getTrackChangesStore)(editor ?? null);
10121
- const subscribe = (0, import_react67.useCallback)(
10278
+ const subscribe = (0, import_react68.useCallback)(
10122
10279
  (onChange) => store ? store.subscribe(() => onChange()) : noopUnsubscribe,
10123
10280
  [store]
10124
10281
  );
10125
10282
  const getSnapshot2 = () => store?.getSnapshot() ?? EMPTY_TRACK_CHANGES;
10126
- const snapshot = (0, import_react67.useSyncExternalStore)(subscribe, getSnapshot2, getSnapshot2);
10127
- return (0, import_react67.useMemo)(() => {
10283
+ const snapshot = (0, import_react68.useSyncExternalStore)(subscribe, getSnapshot2, getSnapshot2);
10284
+ return (0, import_react68.useMemo)(() => {
10128
10285
  const run = (fn) => () => {
10129
10286
  if (editor && !editor.isDestroyed) fn(editor);
10130
10287
  };
@@ -10147,9 +10304,9 @@ function useTrackChanges(editor) {
10147
10304
  }
10148
10305
 
10149
10306
  // src/review/CommentsPanel.tsx
10150
- var import_react68 = require("react");
10307
+ var import_react69 = require("react");
10151
10308
  var import_editor14 = require("@pixerate/editor");
10152
- var import_jsx_runtime47 = require("react/jsx-runtime");
10309
+ var import_jsx_runtime48 = require("react/jsx-runtime");
10153
10310
  var buttonClass2 = "rounded px-2 py-1 text-xs text-muted-foreground hover:bg-muted hover:text-foreground disabled:opacity-50";
10154
10311
  var primaryButtonClass = "rounded px-2 py-1 text-xs bg-primary/10 text-primary hover:bg-primary/20 disabled:opacity-50";
10155
10312
  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";
@@ -10163,18 +10320,18 @@ var CommentsPanel = ({
10163
10320
  emptyMessage = "No comments yet. Select text and add a comment."
10164
10321
  }) => {
10165
10322
  const { threads, activeThreadId, store } = useComments(storeProp ?? editor);
10166
- const [showResolved, setShowResolved] = (0, import_react68.useState)(showResolvedInitial);
10323
+ const [showResolved, setShowResolved] = (0, import_react69.useState)(showResolvedInitial);
10167
10324
  const author = authorProp ?? (0, import_editor14.getCommentAuthor)(editor) ?? { id: "anonymous", name: "Anonymous" };
10168
10325
  const visible = threads.filter((t) => showResolved || !t.resolved);
10169
10326
  const resolvedCount = threads.filter((t) => t.resolved).length;
10170
- return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("aside", { className, "aria-label": "Comments", children: [
10171
- /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex items-center justify-between gap-2", children: [
10172
- /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("span", { className: "text-xs font-medium text-muted-foreground", children: [
10327
+ return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("aside", { className, "aria-label": "Comments", children: [
10328
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "flex items-center justify-between gap-2", children: [
10329
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("span", { className: "text-xs font-medium text-muted-foreground", children: [
10173
10330
  threads.length - resolvedCount,
10174
10331
  " open",
10175
10332
  resolvedCount > 0 ? ` \xB7 ${resolvedCount} resolved` : ""
10176
10333
  ] }),
10177
- resolvedCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
10334
+ resolvedCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
10178
10335
  "button",
10179
10336
  {
10180
10337
  type: "button",
@@ -10185,7 +10342,7 @@ var CommentsPanel = ({
10185
10342
  }
10186
10343
  )
10187
10344
  ] }),
10188
- visible.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("p", { className: "text-xs text-muted-foreground", children: emptyMessage }) : /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("ul", { className: "flex flex-col gap-2", role: "list", children: visible.map((thread) => /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
10345
+ visible.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("p", { className: "text-xs text-muted-foreground", children: emptyMessage }) : /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("ul", { className: "flex flex-col gap-2", role: "list", children: visible.map((thread) => /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
10189
10346
  CommentThreadCard,
10190
10347
  {
10191
10348
  thread,
@@ -10207,7 +10364,7 @@ var CommentThreadCard = ({
10207
10364
  author,
10208
10365
  formatTime
10209
10366
  }) => {
10210
- const [draft, setDraft] = (0, import_react68.useState)("");
10367
+ const [draft, setDraft] = (0, import_react69.useState)("");
10211
10368
  const isDraft = thread.body === "";
10212
10369
  const quote = thread.anchor?.quote ?? thread.lastQuote ?? "";
10213
10370
  const live = editor && !editor.isDestroyed ? editor : null;
@@ -10233,7 +10390,7 @@ var CommentThreadCard = ({
10233
10390
  setDraft("");
10234
10391
  };
10235
10392
  const stop = (e) => e.stopPropagation();
10236
- return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
10393
+ return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
10237
10394
  "li",
10238
10395
  {
10239
10396
  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" : ""}`,
@@ -10249,24 +10406,24 @@ var CommentThreadCard = ({
10249
10406
  }
10250
10407
  },
10251
10408
  children: [
10252
- /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex items-baseline justify-between gap-2", children: [
10253
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "font-medium", children: thread.author.name }),
10254
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "text-xs text-muted-foreground", children: formatTime(thread.createdAt) })
10409
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "flex items-baseline justify-between gap-2", children: [
10410
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "font-medium", children: thread.author.name }),
10411
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "text-xs text-muted-foreground", children: formatTime(thread.createdAt) })
10255
10412
  ] }),
10256
- quote && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("blockquote", { className: "border-l-2 border-border pl-2 text-xs text-muted-foreground line-clamp-2", children: quote }),
10257
- thread.orphaned && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "text-xs text-destructive", children: "The commented text was deleted." }),
10258
- thread.resolved && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "text-xs text-muted-foreground", children: "Resolved" }),
10259
- !isDraft && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("p", { className: "whitespace-pre-wrap break-words", children: thread.body }),
10260
- thread.replies.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime47.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_runtime47.jsxs)("li", { className: "flex flex-col gap-0.5", "data-reply-id": reply.id, children: [
10261
- /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("span", { className: "text-xs", children: [
10262
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "font-medium", children: reply.author.name }),
10413
+ quote && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("blockquote", { className: "border-l-2 border-border pl-2 text-xs text-muted-foreground line-clamp-2", children: quote }),
10414
+ thread.orphaned && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "text-xs text-destructive", children: "The commented text was deleted." }),
10415
+ thread.resolved && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "text-xs text-muted-foreground", children: "Resolved" }),
10416
+ !isDraft && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("p", { className: "whitespace-pre-wrap break-words", children: thread.body }),
10417
+ thread.replies.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime48.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_runtime48.jsxs)("li", { className: "flex flex-col gap-0.5", "data-reply-id": reply.id, children: [
10418
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("span", { className: "text-xs", children: [
10419
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "font-medium", children: reply.author.name }),
10263
10420
  " ",
10264
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "text-muted-foreground", children: formatTime(reply.createdAt) })
10421
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "text-muted-foreground", children: formatTime(reply.createdAt) })
10265
10422
  ] }),
10266
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("p", { className: "whitespace-pre-wrap break-words", children: reply.body })
10423
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("p", { className: "whitespace-pre-wrap break-words", children: reply.body })
10267
10424
  ] }, reply.id)) }),
10268
- (active || isDraft) && !thread.resolved && /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex flex-col gap-1", onClick: stop, children: [
10269
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
10425
+ (active || isDraft) && !thread.resolved && /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "flex flex-col gap-1", onClick: stop, children: [
10426
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
10270
10427
  "textarea",
10271
10428
  {
10272
10429
  className: textareaClass,
@@ -10284,9 +10441,9 @@ var CommentThreadCard = ({
10284
10441
  }
10285
10442
  }
10286
10443
  ),
10287
- /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex justify-end gap-1", children: [
10288
- isDraft && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("button", { type: "button", className: buttonClass2, onClick: remove, children: "Cancel" }),
10289
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
10444
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "flex justify-end gap-1", children: [
10445
+ isDraft && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("button", { type: "button", className: buttonClass2, onClick: remove, children: "Cancel" }),
10446
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
10290
10447
  "button",
10291
10448
  {
10292
10449
  type: "button",
@@ -10298,9 +10455,9 @@ var CommentThreadCard = ({
10298
10455
  )
10299
10456
  ] })
10300
10457
  ] }),
10301
- !isDraft && /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex justify-end gap-1", onClick: stop, children: [
10302
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("button", { type: "button", className: buttonClass2, onClick: () => setResolved(!thread.resolved), children: thread.resolved ? "Reopen" : "Resolve" }),
10303
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
10458
+ !isDraft && /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "flex justify-end gap-1", onClick: stop, children: [
10459
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("button", { type: "button", className: buttonClass2, onClick: () => setResolved(!thread.resolved), children: thread.resolved ? "Reopen" : "Resolve" }),
10460
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
10304
10461
  "button",
10305
10462
  {
10306
10463
  type: "button",
@@ -10316,7 +10473,7 @@ var CommentThreadCard = ({
10316
10473
  };
10317
10474
 
10318
10475
  // src/review/ReviewToolbar.tsx
10319
- var import_jsx_runtime48 = require("react/jsx-runtime");
10476
+ var import_jsx_runtime49 = require("react/jsx-runtime");
10320
10477
  var defaultDescriptionClass = "max-w-[16rem] truncate px-1 text-xs text-muted-foreground";
10321
10478
  var buttonClass3 = "rounded px-2 py-1 text-xs text-foreground hover:bg-muted disabled:opacity-40 disabled:hover:bg-transparent";
10322
10479
  var ReviewToolbar = ({
@@ -10329,8 +10486,8 @@ var ReviewToolbar = ({
10329
10486
  const count = review.changes.length;
10330
10487
  const current = review.currentChange;
10331
10488
  const index = current ? review.changes.findIndex((c) => c.id === current.id) + 1 : 0;
10332
- return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className, role: "toolbar", "aria-label": "Review", children: [
10333
- /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
10489
+ return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className, role: "toolbar", "aria-label": "Review", children: [
10490
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
10334
10491
  "button",
10335
10492
  {
10336
10493
  type: "button",
@@ -10341,8 +10498,8 @@ var ReviewToolbar = ({
10341
10498
  children: review.enabled ? "Tracking on" : "Track changes"
10342
10499
  }
10343
10500
  ),
10344
- /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "mx-1 h-4 w-px bg-border", "aria-hidden": "true" }),
10345
- /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
10501
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { className: "mx-1 h-4 w-px bg-border", "aria-hidden": "true" }),
10502
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
10346
10503
  "button",
10347
10504
  {
10348
10505
  type: "button",
@@ -10353,8 +10510,8 @@ var ReviewToolbar = ({
10353
10510
  children: "\u2039"
10354
10511
  }
10355
10512
  ),
10356
- /* @__PURE__ */ (0, import_jsx_runtime48.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` }),
10357
- /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
10513
+ /* @__PURE__ */ (0, import_jsx_runtime49.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` }),
10514
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
10358
10515
  "button",
10359
10516
  {
10360
10517
  type: "button",
@@ -10365,7 +10522,7 @@ var ReviewToolbar = ({
10365
10522
  children: "\u203A"
10366
10523
  }
10367
10524
  ),
10368
- showDescription && current && /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
10525
+ showDescription && current && /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
10369
10526
  "span",
10370
10527
  {
10371
10528
  className: descriptionClassName,
@@ -10377,8 +10534,8 @@ var ReviewToolbar = ({
10377
10534
  ]
10378
10535
  }
10379
10536
  ),
10380
- /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "mx-1 h-4 w-px bg-border", "aria-hidden": "true" }),
10381
- /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
10537
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { className: "mx-1 h-4 w-px bg-border", "aria-hidden": "true" }),
10538
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
10382
10539
  "button",
10383
10540
  {
10384
10541
  type: "button",
@@ -10388,7 +10545,7 @@ var ReviewToolbar = ({
10388
10545
  children: "Accept"
10389
10546
  }
10390
10547
  ),
10391
- /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
10548
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
10392
10549
  "button",
10393
10550
  {
10394
10551
  type: "button",
@@ -10398,18 +10555,18 @@ var ReviewToolbar = ({
10398
10555
  children: "Reject"
10399
10556
  }
10400
10557
  ),
10401
- /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("button", { type: "button", className: buttonClass3, disabled: count === 0, onClick: review.acceptAll, children: "Accept all" }),
10402
- /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("button", { type: "button", className: buttonClass3, disabled: count === 0, onClick: review.rejectAll, children: "Reject all" })
10558
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("button", { type: "button", className: buttonClass3, disabled: count === 0, onClick: review.acceptAll, children: "Accept all" }),
10559
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("button", { type: "button", className: buttonClass3, disabled: count === 0, onClick: review.rejectAll, children: "Reject all" })
10403
10560
  ] });
10404
10561
  };
10405
10562
 
10406
10563
  // src/review/CommentButton.tsx
10407
- var import_jsx_runtime49 = require("react/jsx-runtime");
10564
+ var import_jsx_runtime50 = require("react/jsx-runtime");
10408
10565
  var CommentButton = ({
10409
10566
  editor,
10410
10567
  className = "rounded px-2 py-1 text-xs text-popover-foreground hover:bg-muted",
10411
10568
  children = "Comment"
10412
- }) => /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
10569
+ }) => /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10413
10570
  "button",
10414
10571
  {
10415
10572
  type: "button",
@@ -10421,13 +10578,13 @@ var CommentButton = ({
10421
10578
  );
10422
10579
 
10423
10580
  // src/review/useDocumentCompare.ts
10424
- var import_react69 = require("react");
10581
+ var import_react70 = require("react");
10425
10582
  var import_editor15 = require("@pixerate/editor");
10426
10583
  function useDocumentCompare(editor, options) {
10427
- const [summary, setSummary] = (0, import_react69.useState)(null);
10428
- const defaults = (0, import_react69.useRef)(options);
10584
+ const [summary, setSummary] = (0, import_react70.useState)(null);
10585
+ const defaults = (0, import_react70.useRef)(options);
10429
10586
  defaults.current = options;
10430
- const compare = (0, import_react69.useCallback)(
10587
+ const compare = (0, import_react70.useCallback)(
10431
10588
  (original, revised, overrides) => {
10432
10589
  if (!editor || editor.isDestroyed) return null;
10433
10590
  const result = (0, import_editor15.applyDocumentComparison)(editor, original, revised, {
@@ -10439,13 +10596,13 @@ function useDocumentCompare(editor, options) {
10439
10596
  },
10440
10597
  [editor]
10441
10598
  );
10442
- const clear = (0, import_react69.useCallback)(() => setSummary(null), []);
10443
- return (0, import_react69.useMemo)(() => ({ summary, compare, clear }), [summary, compare, clear]);
10599
+ const clear = (0, import_react70.useCallback)(() => setSummary(null), []);
10600
+ return (0, import_react70.useMemo)(() => ({ summary, compare, clear }), [summary, compare, clear]);
10444
10601
  }
10445
10602
 
10446
10603
  // src/review/TrackedChangesList.tsx
10447
10604
  var import_editor16 = require("@pixerate/editor");
10448
- var import_jsx_runtime50 = require("react/jsx-runtime");
10605
+ var import_jsx_runtime51 = require("react/jsx-runtime");
10449
10606
  var buttonClass4 = "rounded px-1.5 py-0.5 text-xs text-foreground hover:bg-muted disabled:opacity-40";
10450
10607
  var TrackedChangesList = ({
10451
10608
  editor,
@@ -10456,18 +10613,18 @@ var TrackedChangesList = ({
10456
10613
  }) => {
10457
10614
  const review = useTrackChanges(editor);
10458
10615
  if (review.changes.length === 0) {
10459
- return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className, "data-tracked-changes-list": "", children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: "pixerate-changes-empty text-xs text-muted-foreground", children: emptyState }) });
10616
+ return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className, "data-tracked-changes-list": "", children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: "pixerate-changes-empty text-xs text-muted-foreground", children: emptyState }) });
10460
10617
  }
10461
- return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("ul", { className, role: "list", "aria-label": "Tracked changes", "data-tracked-changes-list": "", children: review.changes.map((change) => {
10618
+ return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("ul", { className, role: "list", "aria-label": "Tracked changes", "data-tracked-changes-list": "", children: review.changes.map((change) => {
10462
10619
  const active = change.id === review.currentChangeId;
10463
- return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(
10620
+ return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(
10464
10621
  "li",
10465
10622
  {
10466
10623
  className: active ? `${itemClassName} ${activeItemClassName}` : itemClassName,
10467
10624
  "data-change-type": change.type,
10468
10625
  "data-change-id": change.id,
10469
10626
  children: [
10470
- /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(
10627
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(
10471
10628
  "button",
10472
10629
  {
10473
10630
  type: "button",
@@ -10475,14 +10632,14 @@ var TrackedChangesList = ({
10475
10632
  title: `${change.author.name}: ${change.description}`,
10476
10633
  onClick: () => review.select(change.id),
10477
10634
  children: [
10478
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: "font-medium", children: (0, import_editor16.trackedChangeLabel)(change) }),
10635
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { className: "font-medium", children: (0, import_editor16.trackedChangeLabel)(change) }),
10479
10636
  change.author.name ? ` \xB7 ${change.author.name}` : "",
10480
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: "block truncate text-muted-foreground", children: change.description })
10637
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { className: "block truncate text-muted-foreground", children: change.description })
10481
10638
  ]
10482
10639
  }
10483
10640
  ),
10484
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("button", { type: "button", className: buttonClass4, onClick: () => review.accept(change.id), children: "Accept" }),
10485
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("button", { type: "button", className: buttonClass4, onClick: () => review.reject(change.id), children: "Reject" })
10641
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("button", { type: "button", className: buttonClass4, onClick: () => review.accept(change.id), children: "Accept" }),
10642
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("button", { type: "button", className: buttonClass4, onClick: () => review.reject(change.id), children: "Reject" })
10486
10643
  ]
10487
10644
  },
10488
10645
  `${change.type}:${change.id}`
@@ -10491,12 +10648,12 @@ var TrackedChangesList = ({
10491
10648
  };
10492
10649
 
10493
10650
  // src/commands/useCommandPalette.ts
10494
- var import_react70 = require("react");
10651
+ var import_react71 = require("react");
10495
10652
  var import_commands2 = require("@pixerate/editor/commands");
10496
10653
  function useCommandPalette(registry, options = {}) {
10497
- const optionsRef = (0, import_react70.useRef)(options);
10654
+ const optionsRef = (0, import_react71.useRef)(options);
10498
10655
  optionsRef.current = options;
10499
- const controller = (0, import_react70.useMemo)(
10656
+ const controller = (0, import_react71.useMemo)(
10500
10657
  () => (0, import_commands2.createCommandPaletteController)(registry, {
10501
10658
  context: () => {
10502
10659
  const c = optionsRef.current.context;
@@ -10517,9 +10674,9 @@ function useCommandPalette(registry, options = {}) {
10517
10674
  // eslint-disable-next-line react-hooks/exhaustive-deps
10518
10675
  [registry]
10519
10676
  );
10520
- const state = (0, import_react70.useSyncExternalStore)(controller.subscribe, controller.getState, controller.getState);
10677
+ const state = (0, import_react71.useSyncExternalStore)(controller.subscribe, controller.getState, controller.getState);
10521
10678
  const { hotkey, hotkeyTarget } = options;
10522
- (0, import_react70.useEffect)(() => {
10679
+ (0, import_react71.useEffect)(() => {
10523
10680
  if (!hotkey) return;
10524
10681
  const target = hotkeyTarget ?? (typeof window !== "undefined" ? window : null);
10525
10682
  if (!target) return;
@@ -10547,13 +10704,13 @@ function useCommandPalette(registry, options = {}) {
10547
10704
  }
10548
10705
 
10549
10706
  // src/commands/CommandPalette.tsx
10550
- var import_react71 = __toESM(require("react"), 1);
10551
- var import_jsx_runtime51 = require("react/jsx-runtime");
10707
+ var import_react72 = __toESM(require("react"), 1);
10708
+ var import_jsx_runtime52 = require("react/jsx-runtime");
10552
10709
  function HighlightedLabel({ item }) {
10553
- if (item.labelIndices.length === 0) return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_jsx_runtime51.Fragment, { children: item.label });
10710
+ if (item.labelIndices.length === 0) return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_jsx_runtime52.Fragment, { children: item.label });
10554
10711
  const marked = new Set(item.labelIndices);
10555
- return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_jsx_runtime51.Fragment, { children: Array.from(item.label).map(
10556
- (ch, i) => marked.has(i) ? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { className: "font-semibold text-foreground", "data-match": "", children: ch }, i) : /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_react71.default.Fragment, { children: ch }, i)
10712
+ return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_jsx_runtime52.Fragment, { children: Array.from(item.label).map(
10713
+ (ch, i) => marked.has(i) ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { className: "font-semibold text-foreground", "data-match": "", children: ch }, i) : /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_react72.default.Fragment, { children: ch }, i)
10557
10714
  ) });
10558
10715
  }
10559
10716
  var CommandPalette = ({
@@ -10562,22 +10719,22 @@ var CommandPalette = ({
10562
10719
  emptyMessage = "No matching commands",
10563
10720
  className = ""
10564
10721
  }) => {
10565
- const inputRef = (0, import_react71.useRef)(null);
10566
- const listRef = (0, import_react71.useRef)(null);
10567
- const baseId = (0, import_react71.useId)();
10722
+ const inputRef = (0, import_react72.useRef)(null);
10723
+ const listRef = (0, import_react72.useRef)(null);
10724
+ const baseId = (0, import_react72.useId)();
10568
10725
  const listId = `${baseId}-list`;
10569
10726
  const optionId = (index) => `${baseId}-option-${index}`;
10570
10727
  const { open, query, items, activeIndex } = palette;
10571
- (0, import_react71.useEffect)(() => {
10728
+ (0, import_react72.useEffect)(() => {
10572
10729
  if (open) inputRef.current?.focus();
10573
10730
  }, [open]);
10574
- (0, import_react71.useEffect)(() => {
10731
+ (0, import_react72.useEffect)(() => {
10575
10732
  if (!open) return;
10576
10733
  const active = listRef.current?.querySelector('[aria-selected="true"]');
10577
10734
  active?.scrollIntoView?.({ block: "nearest" });
10578
10735
  }, [open, activeIndex]);
10579
10736
  if (!open) return null;
10580
- return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
10737
+ return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
10581
10738
  "div",
10582
10739
  {
10583
10740
  className: "fixed inset-0 z-50 flex items-start justify-center bg-black/30 px-4 pt-[15vh]",
@@ -10585,7 +10742,7 @@ var CommandPalette = ({
10585
10742
  onMouseDown: (e) => {
10586
10743
  if (e.target === e.currentTarget) palette.setOpen(false);
10587
10744
  },
10588
- children: /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(
10745
+ children: /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(
10589
10746
  "div",
10590
10747
  {
10591
10748
  role: "dialog",
@@ -10594,7 +10751,7 @@ var CommandPalette = ({
10594
10751
  className: `w-full max-w-lg overflow-hidden rounded-lg border border-border bg-popover text-popover-foreground shadow-xl ${className}`,
10595
10752
  style: { background: "var(--popover, var(--background, #fff))" },
10596
10753
  children: [
10597
- /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
10754
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
10598
10755
  "input",
10599
10756
  {
10600
10757
  ref: inputRef,
@@ -10614,7 +10771,7 @@ var CommandPalette = ({
10614
10771
  className: "w-full border-b border-border bg-transparent px-3 py-2 text-sm outline-none placeholder:text-muted-foreground"
10615
10772
  }
10616
10773
  ),
10617
- items.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: "px-3 py-6 text-center text-sm text-muted-foreground", children: emptyMessage }) : /* @__PURE__ */ (0, import_jsx_runtime51.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_runtime51.jsxs)(
10774
+ items.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: "px-3 py-6 text-center text-sm text-muted-foreground", children: emptyMessage }) : /* @__PURE__ */ (0, import_jsx_runtime52.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_runtime52.jsxs)(
10618
10775
  "li",
10619
10776
  {
10620
10777
  id: optionId(index),
@@ -10629,12 +10786,12 @@ var CommandPalette = ({
10629
10786
  onClick: () => palette.run(item.id),
10630
10787
  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"}`,
10631
10788
  children: [
10632
- /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("span", { className: "min-w-0 flex-1 truncate", children: [
10633
- /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(HighlightedLabel, { item }),
10634
- item.disabledReason && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { className: "ml-2 text-xs text-muted-foreground", "data-disabled-reason": "", children: item.disabledReason })
10789
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("span", { className: "min-w-0 flex-1 truncate", children: [
10790
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(HighlightedLabel, { item }),
10791
+ item.disabledReason && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { className: "ml-2 text-xs text-muted-foreground", "data-disabled-reason": "", children: item.disabledReason })
10635
10792
  ] }),
10636
- item.group && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { className: "shrink-0 text-xs text-muted-foreground", children: item.group }),
10637
- item.shortcut && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("kbd", { className: "shrink-0 rounded border border-border px-1.5 font-mono text-[10px] text-muted-foreground", children: item.shortcut })
10793
+ item.group && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { className: "shrink-0 text-xs text-muted-foreground", children: item.group }),
10794
+ item.shortcut && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("kbd", { className: "shrink-0 rounded border border-border px-1.5 font-mono text-[10px] text-muted-foreground", children: item.shortcut })
10638
10795
  ]
10639
10796
  },
10640
10797
  item.id
@@ -10647,12 +10804,12 @@ var CommandPalette = ({
10647
10804
  };
10648
10805
 
10649
10806
  // src/commands/useCommandShortcuts.ts
10650
- var import_react72 = require("react");
10807
+ var import_react73 = require("react");
10651
10808
  function useCommandShortcuts(registry, options = {}) {
10652
- const optionsRef = (0, import_react72.useRef)(options);
10809
+ const optionsRef = (0, import_react73.useRef)(options);
10653
10810
  optionsRef.current = options;
10654
10811
  const { enabled = true, target } = options;
10655
- (0, import_react72.useEffect)(() => {
10812
+ (0, import_react73.useEffect)(() => {
10656
10813
  if (!registry || !enabled) return;
10657
10814
  const eventTarget = target ?? (typeof window !== "undefined" ? window : null);
10658
10815
  if (!eventTarget) return;
@@ -10670,14 +10827,14 @@ function useCommandShortcuts(registry, options = {}) {
10670
10827
  }, [registry, enabled, target]);
10671
10828
  }
10672
10829
  function useRegisterCommands(registry, specs) {
10673
- (0, import_react72.useEffect)(() => {
10830
+ (0, import_react73.useEffect)(() => {
10674
10831
  if (!registry || !specs || specs.length === 0) return;
10675
10832
  return registry.register(specs);
10676
10833
  }, [registry, specs]);
10677
10834
  }
10678
10835
 
10679
10836
  // src/persistence/useAutosave.ts
10680
- var import_react73 = require("react");
10837
+ var import_react74 = require("react");
10681
10838
  var import_persistence = require("@pixerate/editor/persistence");
10682
10839
  var IDLE = {
10683
10840
  status: "idle",
@@ -10688,18 +10845,18 @@ var IDLE = {
10688
10845
  ready: false
10689
10846
  };
10690
10847
  function useAutosave(options) {
10691
- const optionsRef = (0, import_react73.useRef)(options);
10848
+ const optionsRef = (0, import_react74.useRef)(options);
10692
10849
  optionsRef.current = options;
10693
10850
  const { storage, key, history, dirty } = options;
10694
10851
  const recover = options.recover !== false;
10695
10852
  const flushOnHide = options.flushOnHide !== false;
10696
10853
  const ready = options.ready !== false;
10697
- const [controller, setController] = (0, import_react73.useState)(null);
10698
- const [status, setStatus] = (0, import_react73.useState)(IDLE);
10699
- const [recovery, setRecovery] = (0, import_react73.useState)(null);
10700
- const [pendingRecovery, setPendingRecovery] = (0, import_react73.useState)(recover);
10701
- const revisionsRef = (0, import_react73.useRef)(null);
10702
- (0, import_react73.useEffect)(() => {
10854
+ const [controller, setController] = (0, import_react74.useState)(null);
10855
+ const [status, setStatus] = (0, import_react74.useState)(IDLE);
10856
+ const [recovery, setRecovery] = (0, import_react74.useState)(null);
10857
+ const [pendingRecovery, setPendingRecovery] = (0, import_react74.useState)(recover);
10858
+ const revisionsRef = (0, import_react74.useRef)(null);
10859
+ (0, import_react74.useEffect)(() => {
10703
10860
  const revisions = (0, import_persistence.createRevisionTracker)({ history, dirty });
10704
10861
  const o = optionsRef.current;
10705
10862
  const instance = (0, import_persistence.createAutosaveController)({
@@ -10742,10 +10899,10 @@ function useAutosave(options) {
10742
10899
  if (revisionsRef.current === revisions) revisionsRef.current = null;
10743
10900
  };
10744
10901
  }, [storage, key, history, dirty, recover]);
10745
- (0, import_react73.useEffect)(() => {
10902
+ (0, import_react74.useEffect)(() => {
10746
10903
  if (controller && ready && !pendingRecovery) controller.ready();
10747
10904
  }, [controller, ready, pendingRecovery]);
10748
- (0, import_react73.useEffect)(() => {
10905
+ (0, import_react74.useEffect)(() => {
10749
10906
  if (!controller || !flushOnHide || typeof window === "undefined") return;
10750
10907
  const flush = () => void controller.flushNow();
10751
10908
  const onVisibility = () => {
@@ -10758,33 +10915,33 @@ function useAutosave(options) {
10758
10915
  document.removeEventListener("visibilitychange", onVisibility);
10759
10916
  };
10760
10917
  }, [controller, flushOnHide]);
10761
- const restore = (0, import_react73.useCallback)(() => {
10918
+ const restore = (0, import_react74.useCallback)(() => {
10762
10919
  const snapshot = recovery?.snapshot;
10763
10920
  setRecovery(null);
10764
10921
  setPendingRecovery(false);
10765
10922
  return snapshot;
10766
10923
  }, [recovery]);
10767
- const discard = (0, import_react73.useCallback)(async () => {
10924
+ const discard = (0, import_react74.useCallback)(async () => {
10768
10925
  if (controller) await controller.discardRecovery();
10769
10926
  setRecovery(null);
10770
10927
  setPendingRecovery(false);
10771
10928
  }, [controller]);
10772
- const flushNow = (0, import_react73.useCallback)(async () => {
10929
+ const flushNow = (0, import_react74.useCallback)(async () => {
10773
10930
  await controller?.flushNow();
10774
10931
  }, [controller]);
10775
- const markClean = (0, import_react73.useCallback)(async () => {
10932
+ const markClean = (0, import_react74.useCallback)(async () => {
10776
10933
  revisionsRef.current?.markSaved();
10777
10934
  await controller?.markClean();
10778
10935
  }, [controller]);
10779
- const notifyChange = (0, import_react73.useCallback)(() => revisionsRef.current?.bump(), []);
10936
+ const notifyChange = (0, import_react74.useCallback)(() => revisionsRef.current?.bump(), []);
10780
10937
  return { status, recovery, pendingRecovery, restore, discard, flushNow, markClean, notifyChange, controller };
10781
10938
  }
10782
10939
 
10783
10940
  // src/persistence/useEditorAutosave.ts
10784
- var import_react74 = require("react");
10941
+ var import_react75 = require("react");
10785
10942
  var import_persistence2 = require("@pixerate/editor/persistence");
10786
10943
  function useEditorAutosave(doc, { collectAssetGarbage, ...options }) {
10787
- const storage = (0, import_react74.useMemo)(
10944
+ const storage = (0, import_react75.useMemo)(
10788
10945
  () => doc.assets ? (0, import_persistence2.withEditorAssets)(options.storage, doc.assets) : options.storage,
10789
10946
  [options.storage, doc.assets]
10790
10947
  );
@@ -10797,19 +10954,19 @@ function useEditorAutosave(doc, { collectAssetGarbage, ...options }) {
10797
10954
  history: doc
10798
10955
  });
10799
10956
  const take = autosave.restore;
10800
- const restore = (0, import_react74.useCallback)(() => {
10957
+ const restore = (0, import_react75.useCallback)(() => {
10801
10958
  const snapshot = take();
10802
10959
  return snapshot ? doc.loadDocument(snapshot, { history: "reset" }) : void 0;
10803
10960
  }, [take, doc]);
10804
10961
  const { markClean: clean, discard: drop } = autosave;
10805
10962
  const rawStorage = options.storage;
10806
- const gcRef = (0, import_react74.useRef)(collectAssetGarbage);
10963
+ const gcRef = (0, import_react75.useRef)(collectAssetGarbage);
10807
10964
  gcRef.current = collectAssetGarbage;
10808
- const markClean = (0, import_react74.useCallback)(async () => {
10965
+ const markClean = (0, import_react75.useCallback)(async () => {
10809
10966
  await clean();
10810
10967
  await (0, import_persistence2.collectRetiredEditorAssets)(rawStorage, doc, gcRef.current);
10811
10968
  }, [clean, rawStorage, doc]);
10812
- const discard = (0, import_react74.useCallback)(async () => {
10969
+ const discard = (0, import_react75.useCallback)(async () => {
10813
10970
  await drop();
10814
10971
  await (0, import_persistence2.collectRetiredEditorAssets)(rawStorage, doc, gcRef.current);
10815
10972
  }, [drop, rawStorage, doc]);
@@ -10818,7 +10975,7 @@ function useEditorAutosave(doc, { collectAssetGarbage, ...options }) {
10818
10975
 
10819
10976
  // src/persistence/RecoveryPrompt.tsx
10820
10977
  var import_persistence3 = require("@pixerate/editor/persistence");
10821
- var import_jsx_runtime52 = require("react/jsx-runtime");
10978
+ var import_jsx_runtime53 = require("react/jsx-runtime");
10822
10979
  var RecoveryPrompt = ({
10823
10980
  recovery,
10824
10981
  onRestore,
@@ -10830,7 +10987,7 @@ var RecoveryPrompt = ({
10830
10987
  }) => {
10831
10988
  if (!recovery) return null;
10832
10989
  const { name } = recovery.meta;
10833
- return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(
10990
+ return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(
10834
10991
  "div",
10835
10992
  {
10836
10993
  role: "alertdialog",
@@ -10838,15 +10995,15 @@ var RecoveryPrompt = ({
10838
10995
  "data-recovery-prompt": "",
10839
10996
  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}`,
10840
10997
  children: [
10841
- /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("span", { className: "min-w-0 flex-1", children: [
10998
+ /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("span", { className: "min-w-0 flex-1", children: [
10842
10999
  (0, import_persistence3.formatRecoveryMessage)(recovery.meta, formatTime),
10843
- name ? /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("span", { className: "ml-1 text-xs text-muted-foreground", children: [
11000
+ name ? /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("span", { className: "ml-1 text-xs text-muted-foreground", children: [
10844
11001
  "(",
10845
11002
  name,
10846
11003
  ")"
10847
11004
  ] }) : null
10848
11005
  ] }),
10849
- /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
11006
+ /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
10850
11007
  "button",
10851
11008
  {
10852
11009
  type: "button",
@@ -10856,7 +11013,7 @@ var RecoveryPrompt = ({
10856
11013
  children: restoreLabel
10857
11014
  }
10858
11015
  ),
10859
- /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
11016
+ /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
10860
11017
  "button",
10861
11018
  {
10862
11019
  type: "button",
@@ -10872,17 +11029,17 @@ var RecoveryPrompt = ({
10872
11029
  };
10873
11030
 
10874
11031
  // src/generation/useGenerationPlan.ts
10875
- var import_react75 = require("react");
11032
+ var import_react76 = require("react");
10876
11033
  var import_generation = require("@pixerate/editor/generation");
10877
11034
  function useGenerationPlan(request, capabilities, options = {}) {
10878
11035
  const key = JSON.stringify([request, capabilities, options]);
10879
- return (0, import_react75.useMemo)(() => (0, import_generation.planGenerationRequest)(request, capabilities, options), [key]);
11036
+ return (0, import_react76.useMemo)(() => (0, import_generation.planGenerationRequest)(request, capabilities, options), [key]);
10880
11037
  }
10881
11038
  function useJobProgress(options) {
10882
11039
  const { startedAt, expectedMs, done, now, intervalMs = 1e3 } = options;
10883
- const [tick, setTick] = (0, import_react75.useState)(() => Date.now());
11040
+ const [tick, setTick] = (0, import_react76.useState)(() => Date.now());
10884
11041
  const ticking = !done && now === void 0;
10885
- (0, import_react75.useEffect)(() => {
11042
+ (0, import_react76.useEffect)(() => {
10886
11043
  if (!ticking) return;
10887
11044
  setTick(Date.now());
10888
11045
  const id = setInterval(() => setTick(Date.now()), Math.max(16, intervalMs));
@@ -10892,9 +11049,9 @@ function useJobProgress(options) {
10892
11049
  }
10893
11050
 
10894
11051
  // src/generation/GenerationSettings.tsx
10895
- var import_react76 = require("react");
11052
+ var import_react77 = require("react");
10896
11053
  var import_generation2 = require("@pixerate/editor/generation");
10897
- var import_jsx_runtime53 = require("react/jsx-runtime");
11054
+ var import_jsx_runtime54 = require("react/jsx-runtime");
10898
11055
  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";
10899
11056
  function Control({
10900
11057
  control,
@@ -10904,7 +11061,7 @@ function Control({
10904
11061
  }) {
10905
11062
  const shown = value ?? control.defaultValue;
10906
11063
  if (control.kind === "checkbox") {
10907
- return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
11064
+ return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
10908
11065
  "input",
10909
11066
  {
10910
11067
  id,
@@ -10916,7 +11073,7 @@ function Control({
10916
11073
  );
10917
11074
  }
10918
11075
  if (control.kind === "select") {
10919
- return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(
11076
+ return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
10920
11077
  "select",
10921
11078
  {
10922
11079
  id,
@@ -10925,14 +11082,14 @@ function Control({
10925
11082
  value: shown === void 0 ? "" : String(shown),
10926
11083
  onChange: (e) => onValue((0, import_generation2.parseControlValue)(control, e.target.value)),
10927
11084
  children: [
10928
- shown === void 0 && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("option", { value: "", children: "Default" }),
10929
- control.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("option", { value: String(option.value), children: option.label }, String(option.value)))
11085
+ shown === void 0 && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("option", { value: "", children: "Default" }),
11086
+ control.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("option", { value: String(option.value), children: option.label }, String(option.value)))
10930
11087
  ]
10931
11088
  }
10932
11089
  );
10933
11090
  }
10934
11091
  if (control.kind === "textarea") {
10935
- return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
11092
+ return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
10936
11093
  "textarea",
10937
11094
  {
10938
11095
  id,
@@ -10946,8 +11103,8 @@ function Control({
10946
11103
  );
10947
11104
  }
10948
11105
  const numeric = typeof shown === "number" ? shown : void 0;
10949
- return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex items-center gap-2", children: [
10950
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
11106
+ return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex items-center gap-2", children: [
11107
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
10951
11108
  "input",
10952
11109
  {
10953
11110
  id,
@@ -10961,7 +11118,7 @@ function Control({
10961
11118
  onChange: (e) => onValue((0, import_generation2.parseControlValue)(control, e.target.value))
10962
11119
  }
10963
11120
  ),
10964
- control.kind === "range" && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: "w-10 text-right tabular-nums text-muted-foreground", "data-field-value": "", children: numeric ?? "\u2013" })
11121
+ control.kind === "range" && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "w-10 text-right tabular-nums text-muted-foreground", "data-field-value": "", children: numeric ?? "\u2013" })
10965
11122
  ] });
10966
11123
  }
10967
11124
  var GenerationSettings = ({
@@ -10975,17 +11132,17 @@ var GenerationSettings = ({
10975
11132
  renderReference,
10976
11133
  className = ""
10977
11134
  }) => {
10978
- const baseId = (0, import_react76.useId)();
10979
- const controls = (0, import_react76.useMemo)(() => (0, import_generation2.getGenerationControls)(capabilities), [capabilities]);
11135
+ const baseId = (0, import_react77.useId)();
11136
+ const controls = (0, import_react77.useMemo)(() => (0, import_generation2.getGenerationControls)(capabilities), [capabilities]);
10980
11137
  const computed = useGenerationPlan(value, capabilities, { strategy });
10981
11138
  const plan = planProp ?? computed;
10982
11139
  const slots = (0, import_generation2.getReferenceSlots)(capabilities, value);
10983
- return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: `flex flex-col gap-3 text-sm ${className}`, "data-generation-settings": "", "data-model": capabilities.id, children: [
11140
+ return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: `flex flex-col gap-3 text-sm ${className}`, "data-generation-settings": "", "data-model": capabilities.id, children: [
10984
11141
  controls.map((control) => {
10985
11142
  const id = `${baseId}-${control.key}`;
10986
- return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex flex-col gap-1", "data-control": control.key, children: [
10987
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("label", { htmlFor: id, className: "text-xs font-medium text-muted-foreground", title: control.description, children: control.label }),
10988
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
11143
+ return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex flex-col gap-1", "data-control": control.key, children: [
11144
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("label", { htmlFor: id, className: "text-xs font-medium text-muted-foreground", title: control.description, children: control.label }),
11145
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
10989
11146
  Control,
10990
11147
  {
10991
11148
  control,
@@ -10996,23 +11153,23 @@ var GenerationSettings = ({
10996
11153
  )
10997
11154
  ] }, control.key);
10998
11155
  }),
10999
- slots.map((slot) => /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("fieldset", { className: "flex flex-col gap-1", "data-reference-role": slot.role, children: [
11000
- /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("legend", { className: "text-xs font-medium text-muted-foreground", title: slot.description, children: [
11156
+ slots.map((slot) => /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("fieldset", { className: "flex flex-col gap-1", "data-reference-role": slot.role, children: [
11157
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("legend", { className: "text-xs font-medium text-muted-foreground", title: slot.description, children: [
11001
11158
  slot.label,
11002
11159
  " ",
11003
- /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("span", { className: "tabular-nums", "data-reference-count": "", children: [
11160
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("span", { className: "tabular-nums", "data-reference-count": "", children: [
11004
11161
  "(",
11005
11162
  slot.references.length,
11006
11163
  "/",
11007
11164
  slot.max,
11008
11165
  ")"
11009
11166
  ] }),
11010
- slot.min > 0 && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: "text-destructive", children: " *" })
11167
+ slot.min > 0 && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "text-destructive", children: " *" })
11011
11168
  ] }),
11012
- /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("ul", { className: "flex flex-wrap gap-1", children: [
11013
- slot.references.map((ref) => /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("li", { className: "flex items-center gap-1 rounded border border-border px-1.5 py-0.5", "data-reference-id": ref.id, children: [
11014
- renderReference ? renderReference(ref) : /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: "max-w-[10rem] truncate", children: ref.id }),
11015
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
11169
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("ul", { className: "flex flex-wrap gap-1", children: [
11170
+ slot.references.map((ref) => /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("li", { className: "flex items-center gap-1 rounded border border-border px-1.5 py-0.5", "data-reference-id": ref.id, children: [
11171
+ renderReference ? renderReference(ref) : /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "max-w-[10rem] truncate", children: ref.id }),
11172
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
11016
11173
  "button",
11017
11174
  {
11018
11175
  type: "button",
@@ -11023,7 +11180,7 @@ var GenerationSettings = ({
11023
11180
  }
11024
11181
  )
11025
11182
  ] }, ref.id)),
11026
- onAddReference && slot.canAdd && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
11183
+ onAddReference && slot.canAdd && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
11027
11184
  "button",
11028
11185
  {
11029
11186
  type: "button",
@@ -11034,21 +11191,21 @@ var GenerationSettings = ({
11034
11191
  ) })
11035
11192
  ] })
11036
11193
  ] }, slot.role)),
11037
- showAdjustments && plan.adjustments.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime53.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_runtime53.jsx)("li", { "data-adjustment-field": adjustment.field, "data-adjustment-kind": adjustment.kind, children: adjustment.reason }, index)) }),
11038
- showAdjustments && plan.errors.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime53.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_runtime53.jsx)("li", { "data-error-field": error.field, children: error.message }, index)) })
11194
+ showAdjustments && plan.adjustments.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime54.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_runtime54.jsx)("li", { "data-adjustment-field": adjustment.field, "data-adjustment-kind": adjustment.kind, children: adjustment.reason }, index)) }),
11195
+ showAdjustments && plan.errors.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime54.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_runtime54.jsx)("li", { "data-error-field": error.field, children: error.message }, index)) })
11039
11196
  ] });
11040
11197
  };
11041
11198
 
11042
11199
  // src/generation/JobProgress.tsx
11043
- var import_jsx_runtime54 = require("react/jsx-runtime");
11200
+ var import_jsx_runtime55 = require("react/jsx-runtime");
11044
11201
  var JobProgress = ({ title, className = "", ...options }) => {
11045
11202
  const progress = useJobProgress(options);
11046
- return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: `flex flex-col gap-1 text-sm ${className}`, "data-job-progress": "", "data-done": options.done ? "" : void 0, children: [
11047
- /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex items-center justify-between gap-2 text-muted-foreground", children: [
11048
- title && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "truncate text-foreground", children: title }),
11049
- /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { "data-job-progress-label": "", "aria-live": "polite", children: progress.label })
11203
+ return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: `flex flex-col gap-1 text-sm ${className}`, "data-job-progress": "", "data-done": options.done ? "" : void 0, children: [
11204
+ /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "flex items-center justify-between gap-2 text-muted-foreground", children: [
11205
+ title && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "truncate text-foreground", children: title }),
11206
+ /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { "data-job-progress-label": "", "aria-live": "polite", children: progress.label })
11050
11207
  ] }),
11051
- /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
11208
+ /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
11052
11209
  "div",
11053
11210
  {
11054
11211
  role: "progressbar",
@@ -11058,7 +11215,7 @@ var JobProgress = ({ title, className = "", ...options }) => {
11058
11215
  "aria-valuenow": progress.percent,
11059
11216
  "aria-valuetext": `${progress.percent}%, ${progress.label}`,
11060
11217
  className: "h-1.5 w-full overflow-hidden rounded-full bg-muted",
11061
- children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
11218
+ children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
11062
11219
  "div",
11063
11220
  {
11064
11221
  className: "h-full rounded-full bg-primary transition-[width] duration-500",
@@ -11071,9 +11228,9 @@ var JobProgress = ({ title, className = "", ...options }) => {
11071
11228
  };
11072
11229
 
11073
11230
  // src/generation/AssetMentionChips.tsx
11074
- var import_react77 = require("react");
11231
+ var import_react78 = require("react");
11075
11232
  var import_generation3 = require("@pixerate/editor/generation");
11076
- var import_jsx_runtime55 = require("react/jsx-runtime");
11233
+ var import_jsx_runtime56 = require("react/jsx-runtime");
11077
11234
  var AssetMentionChips = ({
11078
11235
  content,
11079
11236
  onChange,
@@ -11083,14 +11240,14 @@ var AssetMentionChips = ({
11083
11240
  renderAsset,
11084
11241
  className = ""
11085
11242
  }) => {
11086
- const [open, setOpen] = (0, import_react77.useState)(null);
11087
- const rootRef = (0, import_react77.useRef)(null);
11088
- const chips = (0, import_react77.useMemo)(
11243
+ const [open, setOpen] = (0, import_react78.useState)(null);
11244
+ const rootRef = (0, import_react78.useRef)(null);
11245
+ const chips = (0, import_react78.useMemo)(
11089
11246
  () => (0, import_generation3.describeAssetMentions)((0, import_generation3.findTextMentions)(content), assets, capabilities),
11090
11247
  [content, assets, capabilities]
11091
11248
  );
11092
11249
  const options = roles ?? (capabilities ? (0, import_generation3.getAssetRoleOptions)(capabilities) : (0, import_generation3.defaultAssetRoleOptions)());
11093
- (0, import_react77.useEffect)(() => {
11250
+ (0, import_react78.useEffect)(() => {
11094
11251
  if (open === null) return;
11095
11252
  const onPointer = (event) => {
11096
11253
  if (!rootRef.current?.contains(event.target)) setOpen(null);
@@ -11104,13 +11261,13 @@ var AssetMentionChips = ({
11104
11261
  onChange((0, import_generation3.setMentionRoleInText)(content, chip2.start, role));
11105
11262
  };
11106
11263
  if (chips.length === 0) return null;
11107
- return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { ref: rootRef, className: `flex flex-wrap gap-1.5 ${className}`, "data-asset-mention-chips": "", children: chips.map((chip2) => {
11264
+ return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { ref: rootRef, className: `flex flex-wrap gap-1.5 ${className}`, "data-asset-mention-chips": "", children: chips.map((chip2) => {
11108
11265
  const error = chip2.issues.find((issue) => issue.severity === "error");
11109
11266
  const warning = chip2.issues.find((issue) => issue.severity === "warning");
11110
11267
  const problem = error ?? warning;
11111
11268
  const isOpen = open === chip2.index;
11112
- return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("span", { className: "relative inline-flex", "data-asset-chip": chip2.asset.id, children: [
11113
- /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(
11269
+ return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("span", { className: "relative inline-flex", "data-asset-chip": chip2.asset.id, children: [
11270
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
11114
11271
  "button",
11115
11272
  {
11116
11273
  type: "button",
@@ -11124,8 +11281,8 @@ var AssetMentionChips = ({
11124
11281
  },
11125
11282
  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`,
11126
11283
  children: [
11127
- /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { children: renderAsset ? renderAsset(chip2) : `@${chip2.asset.label ?? chip2.handle}` }),
11128
- /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
11284
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { children: renderAsset ? renderAsset(chip2) : `@${chip2.asset.label ?? chip2.handle}` }),
11285
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
11129
11286
  "span",
11130
11287
  {
11131
11288
  className: `rounded px-1 text-[10px] uppercase tracking-wide ${chip2.role ? "bg-primary/15" : "opacity-60"}`,
@@ -11136,7 +11293,7 @@ var AssetMentionChips = ({
11136
11293
  ]
11137
11294
  }
11138
11295
  ),
11139
- isOpen && /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(
11296
+ isOpen && /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
11140
11297
  "div",
11141
11298
  {
11142
11299
  role: "listbox",
@@ -11147,7 +11304,7 @@ var AssetMentionChips = ({
11147
11304
  if (e.key === "Escape") setOpen(null);
11148
11305
  },
11149
11306
  children: [
11150
- options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(
11307
+ options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
11151
11308
  "button",
11152
11309
  {
11153
11310
  type: "button",
@@ -11158,13 +11315,13 @@ var AssetMentionChips = ({
11158
11315
  onClick: () => pick(chip2, option.role),
11159
11316
  className: "flex items-center justify-between gap-2 rounded px-2 py-1 text-left hover:bg-muted",
11160
11317
  children: [
11161
- /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { children: option.label }),
11162
- option.accepts?.length ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "text-[10px] opacity-60", children: option.accepts.join(", ") }) : null
11318
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { children: option.label }),
11319
+ option.accepts?.length ? /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { className: "text-[10px] opacity-60", children: option.accepts.join(", ") }) : null
11163
11320
  ]
11164
11321
  },
11165
11322
  option.role
11166
11323
  )),
11167
- /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
11324
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
11168
11325
  "button",
11169
11326
  {
11170
11327
  type: "button",
@@ -11176,7 +11333,7 @@ var AssetMentionChips = ({
11176
11333
  children: "No role"
11177
11334
  }
11178
11335
  ),
11179
- chip2.issues.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime55.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_runtime55.jsx)("li", { className: issue.severity === "error" ? "text-red-500" : "text-amber-500", children: issue.message }, i)) })
11336
+ chip2.issues.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime56.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_runtime56.jsx)("li", { className: issue.severity === "error" ? "text-red-500" : "text-amber-500", children: issue.message }, i)) })
11180
11337
  ]
11181
11338
  }
11182
11339
  )
@@ -11185,15 +11342,15 @@ var AssetMentionChips = ({
11185
11342
  };
11186
11343
 
11187
11344
  // src/generation/GenerationHistory.tsx
11188
- var import_react78 = require("react");
11345
+ var import_react79 = require("react");
11189
11346
  var import_generation4 = require("@pixerate/editor/generation");
11190
- var import_jsx_runtime56 = require("react/jsx-runtime");
11347
+ var import_jsx_runtime57 = require("react/jsx-runtime");
11191
11348
  function useGenerationRecords(store, filter) {
11192
- const [records, setRecords] = (0, import_react78.useState)([]);
11193
- const [loading, setLoading] = (0, import_react78.useState)(!!store);
11194
- const [error, setError] = (0, import_react78.useState)(null);
11349
+ const [records, setRecords] = (0, import_react79.useState)([]);
11350
+ const [loading, setLoading] = (0, import_react79.useState)(!!store);
11351
+ const [error, setError] = (0, import_react79.useState)(null);
11195
11352
  const filterKey = (0, import_generation4.stableStringify)(filter ?? {});
11196
- const refresh = (0, import_react78.useCallback)(async () => {
11353
+ const refresh = (0, import_react79.useCallback)(async () => {
11197
11354
  if (!store) {
11198
11355
  setRecords([]);
11199
11356
  setLoading(false);
@@ -11210,7 +11367,7 @@ function useGenerationRecords(store, filter) {
11210
11367
  setLoading(false);
11211
11368
  }
11212
11369
  }, [store, filterKey]);
11213
- (0, import_react78.useEffect)(() => {
11370
+ (0, import_react79.useEffect)(() => {
11214
11371
  void refresh();
11215
11372
  if (!store) return;
11216
11373
  return store.subscribe(() => void refresh());
@@ -11236,21 +11393,21 @@ var GenerationHistory = ({
11236
11393
  emptyText = "No generations yet.",
11237
11394
  className = ""
11238
11395
  }) => {
11239
- const [innerMode, setInnerMode] = (0, import_react78.useState)("exact");
11396
+ const [innerMode, setInnerMode] = (0, import_react79.useState)("exact");
11240
11397
  const mode = modeProp ?? innerMode;
11241
11398
  const setMode = (next) => {
11242
11399
  if (modeProp === void 0) setInnerMode(next);
11243
11400
  onModeChange?.(next);
11244
11401
  };
11245
- const options = (0, import_react78.useMemo)(() => ({ templates, capabilities, assets, mode }), [templates, capabilities, assets, mode]);
11246
- const results = (0, import_react78.useMemo)(() => records.map((record) => (0, import_generation4.recreateRequest)(record, options)), [records, options]);
11247
- const models = (0, import_react78.useMemo)(
11402
+ const options = (0, import_react79.useMemo)(() => ({ templates, capabilities, assets, mode }), [templates, capabilities, assets, mode]);
11403
+ const results = (0, import_react79.useMemo)(() => records.map((record) => (0, import_generation4.recreateRequest)(record, options)), [records, options]);
11404
+ const models = (0, import_react79.useMemo)(
11248
11405
  () => capabilities ? Array.isArray(capabilities) ? capabilities : [capabilities] : [],
11249
11406
  [capabilities]
11250
11407
  );
11251
- return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: `flex flex-col gap-2 text-sm ${className}`, "data-generation-history": "", children: [
11252
- /* @__PURE__ */ (0, import_jsx_runtime56.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_runtime56.jsxs)("label", { className: "inline-flex items-center gap-1", children: [
11253
- /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
11408
+ return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: `flex flex-col gap-2 text-sm ${className}`, "data-generation-history": "", children: [
11409
+ /* @__PURE__ */ (0, import_jsx_runtime57.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_runtime57.jsxs)("label", { className: "inline-flex items-center gap-1", children: [
11410
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
11254
11411
  "input",
11255
11412
  {
11256
11413
  type: "radio",
@@ -11263,34 +11420,34 @@ var GenerationHistory = ({
11263
11420
  ),
11264
11421
  value === "exact" ? "Exact (recorded versions)" : "Latest templates & settings"
11265
11422
  ] }, value)) }),
11266
- records.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("p", { className: "text-xs text-muted-foreground", children: emptyText }),
11267
- /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("ul", { className: "flex flex-col gap-2", children: records.map((record, i) => {
11423
+ records.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("p", { className: "text-xs text-muted-foreground", children: emptyText }),
11424
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("ul", { className: "flex flex-col gap-2", children: records.map((record, i) => {
11268
11425
  const result = results[i];
11269
11426
  const model = models.find((m) => m.id === record.provenance.modelId);
11270
11427
  const blocked = !result.ok;
11271
- return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
11428
+ return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(
11272
11429
  "li",
11273
11430
  {
11274
11431
  className: "rounded-md border border-border p-2",
11275
11432
  "data-record": record.id,
11276
11433
  "data-drift": result.drift.length,
11277
11434
  children: [
11278
- /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: "flex flex-wrap items-center justify-between gap-2 text-xs", children: [
11279
- /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { className: "font-medium", children: model?.name ?? record.provenance.modelId }),
11280
- /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("span", { className: "text-muted-foreground", children: [
11281
- record.kind !== "generate" && /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("span", { "data-kind": "", children: [
11435
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: "flex flex-wrap items-center justify-between gap-2 text-xs", children: [
11436
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("span", { className: "font-medium", children: model?.name ?? record.provenance.modelId }),
11437
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("span", { className: "text-muted-foreground", children: [
11438
+ record.kind !== "generate" && /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("span", { "data-kind": "", children: [
11282
11439
  record.kind,
11283
11440
  " \xB7 "
11284
11441
  ] }),
11285
- /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("time", { dateTime: record.createdAt, children: record.createdAt.replace("T", " ").slice(0, 16) }),
11286
- record.seed !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(import_jsx_runtime56.Fragment, { children: [
11442
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("time", { dateTime: record.createdAt, children: record.createdAt.replace("T", " ").slice(0, 16) }),
11443
+ record.seed !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(import_jsx_runtime57.Fragment, { children: [
11287
11444
  " \xB7 seed ",
11288
11445
  record.seed
11289
11446
  ] })
11290
11447
  ] })
11291
11448
  ] }),
11292
- /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("p", { className: "mt-1 line-clamp-3 break-words text-xs", "data-record-prompt": "", children: record.provenance.resolvedPrompt }),
11293
- record.assets.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: "mt-1 flex flex-wrap gap-1", children: record.assets.map((asset) => /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
11449
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("p", { className: "mt-1 line-clamp-3 break-words text-xs", "data-record-prompt": "", children: record.provenance.resolvedPrompt }),
11450
+ record.assets.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { className: "mt-1 flex flex-wrap gap-1", children: record.assets.map((asset) => /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(
11294
11451
  "span",
11295
11452
  {
11296
11453
  className: "rounded-full bg-muted px-2 py-0.5 text-[10px]",
@@ -11304,16 +11461,16 @@ var GenerationHistory = ({
11304
11461
  `${asset.role}:${asset.id}`
11305
11462
  )) }),
11306
11463
  renderPreview?.(record),
11307
- result.drift.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime56.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_runtime56.jsxs)("li", { className: severityClass[item.severity], "data-drift-type": item.type, children: [
11308
- /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("strong", { children: [
11464
+ result.drift.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime57.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_runtime57.jsxs)("li", { className: severityClass[item.severity], "data-drift-type": item.type, children: [
11465
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("strong", { children: [
11309
11466
  import_generation4.DRIFT_TYPE_LABELS[item.type],
11310
11467
  ":"
11311
11468
  ] }),
11312
11469
  " ",
11313
11470
  item.message
11314
11471
  ] }, j)) }),
11315
- /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: "mt-2 flex gap-2", children: [
11316
- onRecreate && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
11472
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: "mt-2 flex gap-2", children: [
11473
+ onRecreate && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
11317
11474
  "button",
11318
11475
  {
11319
11476
  type: "button",
@@ -11325,7 +11482,7 @@ var GenerationHistory = ({
11325
11482
  children: "Recreate"
11326
11483
  }
11327
11484
  ),
11328
- onVariation && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
11485
+ onVariation && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
11329
11486
  "button",
11330
11487
  {
11331
11488
  type: "button",
@@ -11335,7 +11492,7 @@ var GenerationHistory = ({
11335
11492
  children: "Variation"
11336
11493
  }
11337
11494
  ),
11338
- onRemove && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
11495
+ onRemove && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
11339
11496
  "button",
11340
11497
  {
11341
11498
  type: "button",
@@ -11355,19 +11512,19 @@ var GenerationHistory = ({
11355
11512
  };
11356
11513
 
11357
11514
  // src/find-replace/useFindReplace.ts
11358
- var import_react79 = require("react");
11515
+ var import_react80 = require("react");
11359
11516
  var import_editor17 = require("@pixerate/editor");
11360
11517
  var noopUnsubscribe2 = () => {
11361
11518
  };
11362
11519
  function useFindReplace(editor) {
11363
11520
  const store = (0, import_editor17.getFindReplaceStore)(editor ?? null);
11364
- const subscribe = (0, import_react79.useCallback)(
11521
+ const subscribe = (0, import_react80.useCallback)(
11365
11522
  (onChange) => store ? store.subscribe(() => onChange()) : noopUnsubscribe2,
11366
11523
  [store]
11367
11524
  );
11368
11525
  const getSnapshot2 = () => store?.getSnapshot() ?? import_editor17.EMPTY_FIND_REPLACE_SNAPSHOT;
11369
- const snapshot = (0, import_react79.useSyncExternalStore)(subscribe, getSnapshot2, getSnapshot2);
11370
- return (0, import_react79.useMemo)(() => {
11526
+ const snapshot = (0, import_react80.useSyncExternalStore)(subscribe, getSnapshot2, getSnapshot2);
11527
+ return (0, import_react80.useMemo)(() => {
11371
11528
  const run = (fn) => {
11372
11529
  if (editor && !editor.isDestroyed && store) fn(editor);
11373
11530
  };
@@ -11391,9 +11548,9 @@ function useFindReplace(editor) {
11391
11548
  }
11392
11549
 
11393
11550
  // src/find-replace/FindReplaceBar.tsx
11394
- var import_react80 = require("react");
11551
+ var import_react81 = require("react");
11395
11552
  var import_editor18 = require("@pixerate/editor");
11396
- var import_jsx_runtime57 = require("react/jsx-runtime");
11553
+ var import_jsx_runtime58 = require("react/jsx-runtime");
11397
11554
  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";
11398
11555
  var buttonClass5 = "rounded px-2 py-1 text-xs text-foreground hover:bg-muted disabled:opacity-40 disabled:hover:bg-transparent";
11399
11556
  var toggleClass = (on) => `${buttonClass5} font-mono ${on ? "bg-primary/10 text-primary" : "text-muted-foreground"}`;
@@ -11406,10 +11563,10 @@ var FindReplaceBar = ({
11406
11563
  onClose
11407
11564
  }) => {
11408
11565
  const find = useFindReplace(editor);
11409
- const findInput = (0, import_react80.useRef)(null);
11410
- const [moreOpen, setMoreOpen] = (0, import_react80.useState)(false);
11566
+ const findInput = (0, import_react81.useRef)(null);
11567
+ const [moreOpen, setMoreOpen] = (0, import_react81.useState)(false);
11411
11568
  const visible = find.available && (alwaysOpen || find.open);
11412
- (0, import_react80.useEffect)(() => {
11569
+ (0, import_react81.useEffect)(() => {
11413
11570
  if (!visible || find.focusRequest === 0) return;
11414
11571
  findInput.current?.focus();
11415
11572
  findInput.current?.select();
@@ -11447,9 +11604,9 @@ var FindReplaceBar = ({
11447
11604
  if (isMod(e)) find.replaceAll();
11448
11605
  else find.replace();
11449
11606
  };
11450
- return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className, role: "search", "aria-label": "Find and replace", onKeyDown: onBarKeyDown, children: [
11451
- /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: "flex items-center gap-1", children: [
11452
- /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
11607
+ return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className, role: "search", "aria-label": "Find and replace", onKeyDown: onBarKeyDown, children: [
11608
+ /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: "flex items-center gap-1", children: [
11609
+ /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
11453
11610
  "button",
11454
11611
  {
11455
11612
  type: "button",
@@ -11460,7 +11617,7 @@ var FindReplaceBar = ({
11460
11617
  children: showReplace ? "\u25BE" : "\u25B8"
11461
11618
  }
11462
11619
  ),
11463
- /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
11620
+ /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
11464
11621
  "input",
11465
11622
  {
11466
11623
  ref: findInput,
@@ -11474,7 +11631,7 @@ var FindReplaceBar = ({
11474
11631
  onKeyDown: onFindKeyDown
11475
11632
  }
11476
11633
  ),
11477
- import_editor18.FIND_OPTION_TOGGLES.filter((t) => !t.advanced).map((t) => /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
11634
+ import_editor18.FIND_OPTION_TOGGLES.filter((t) => !t.advanced).map((t) => /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
11478
11635
  "button",
11479
11636
  {
11480
11637
  type: "button",
@@ -11487,7 +11644,7 @@ var FindReplaceBar = ({
11487
11644
  },
11488
11645
  t.key
11489
11646
  )),
11490
- /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
11647
+ /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
11491
11648
  "span",
11492
11649
  {
11493
11650
  className: `min-w-[5rem] px-1 text-center text-xs ${find.error ? "text-destructive" : "text-muted-foreground"}`,
@@ -11497,9 +11654,9 @@ var FindReplaceBar = ({
11497
11654
  children: status
11498
11655
  }
11499
11656
  ),
11500
- /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("button", { type: "button", className: buttonClass5, "aria-label": "Previous match", disabled: !hasMatches, onClick: find.previous, children: "\u2191" }),
11501
- /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("button", { type: "button", className: buttonClass5, "aria-label": "Next match", disabled: !hasMatches, onClick: find.next, children: "\u2193" }),
11502
- showMoreOptions && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
11657
+ /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("button", { type: "button", className: buttonClass5, "aria-label": "Previous match", disabled: !hasMatches, onClick: find.previous, children: "\u2191" }),
11658
+ /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("button", { type: "button", className: buttonClass5, "aria-label": "Next match", disabled: !hasMatches, onClick: find.next, children: "\u2193" }),
11659
+ showMoreOptions && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
11503
11660
  "button",
11504
11661
  {
11505
11662
  type: "button",
@@ -11510,10 +11667,10 @@ var FindReplaceBar = ({
11510
11667
  children: "\u2026"
11511
11668
  }
11512
11669
  ),
11513
- /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("button", { type: "button", className: buttonClass5, "aria-label": "Close find", onClick: close, children: "\xD7" })
11670
+ /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("button", { type: "button", className: buttonClass5, "aria-label": "Close find", onClick: close, children: "\xD7" })
11514
11671
  ] }),
11515
- showReplace && /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: "flex items-center gap-1 pl-7", children: [
11516
- /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
11672
+ showReplace && /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: "flex items-center gap-1 pl-7", children: [
11673
+ /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
11517
11674
  "input",
11518
11675
  {
11519
11676
  type: "text",
@@ -11525,7 +11682,7 @@ var FindReplaceBar = ({
11525
11682
  onKeyDown: onReplaceKeyDown
11526
11683
  }
11527
11684
  ),
11528
- /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
11685
+ /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
11529
11686
  "button",
11530
11687
  {
11531
11688
  type: "button",
@@ -11535,11 +11692,11 @@ var FindReplaceBar = ({
11535
11692
  children: "Replace"
11536
11693
  }
11537
11694
  ),
11538
- /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("button", { type: "button", className: buttonClass5, disabled: !hasMatches, onClick: find.replaceAll, children: "Replace all" }),
11539
- find.lastReplaceCount !== null && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("span", { className: "px-1 text-xs text-muted-foreground", "aria-live": "polite", children: find.lastReplaceCount === 1 ? "1 replaced" : `${find.lastReplaceCount} replaced` })
11695
+ /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("button", { type: "button", className: buttonClass5, disabled: !hasMatches, onClick: find.replaceAll, children: "Replace all" }),
11696
+ find.lastReplaceCount !== null && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { className: "px-1 text-xs text-muted-foreground", "aria-live": "polite", children: find.lastReplaceCount === 1 ? "1 replaced" : `${find.lastReplaceCount} replaced` })
11540
11697
  ] }),
11541
- showMoreOptions && moreOpen && /* @__PURE__ */ (0, import_jsx_runtime57.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_runtime57.jsxs)("label", { className: "flex items-center gap-1", children: [
11542
- /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
11698
+ showMoreOptions && moreOpen && /* @__PURE__ */ (0, import_jsx_runtime58.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_runtime58.jsxs)("label", { className: "flex items-center gap-1", children: [
11699
+ /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
11543
11700
  "input",
11544
11701
  {
11545
11702
  type: "checkbox",
@@ -11553,12 +11710,12 @@ var FindReplaceBar = ({
11553
11710
  };
11554
11711
 
11555
11712
  // src/tables/useTableMenu.ts
11556
- var import_react81 = require("react");
11713
+ var import_react82 = require("react");
11557
11714
  var import_editor19 = require("@pixerate/editor");
11558
11715
  function useTableMenu(editor) {
11559
- const store = (0, import_react81.useMemo)(() => (0, import_editor19.createTableStore)(editor), [editor]);
11560
- const snapshot = (0, import_react81.useSyncExternalStore)(store.subscribe, store.getSnapshot, store.getSnapshot);
11561
- return (0, import_react81.useMemo)(
11716
+ const store = (0, import_react82.useMemo)(() => (0, import_editor19.createTableStore)(editor), [editor]);
11717
+ const snapshot = (0, import_react82.useSyncExternalStore)(store.subscribe, store.getSnapshot, store.getSnapshot);
11718
+ return (0, import_react82.useMemo)(
11562
11719
  () => ({
11563
11720
  ...snapshot,
11564
11721
  run: (action, params) => (0, import_editor19.runTableAction)(editor, action, params, { focus: true }),
@@ -11569,9 +11726,9 @@ function useTableMenu(editor) {
11569
11726
  }
11570
11727
 
11571
11728
  // src/tables/TableToolbar.tsx
11572
- var import_react82 = __toESM(require("react"), 1);
11729
+ var import_react83 = __toESM(require("react"), 1);
11573
11730
  var import_editor20 = require("@pixerate/editor");
11574
- var import_jsx_runtime58 = require("react/jsx-runtime");
11731
+ var import_jsx_runtime59 = require("react/jsx-runtime");
11575
11732
  var keepSelection2 = (event) => event.preventDefault();
11576
11733
  var TableToolbar = ({
11577
11734
  editor,
@@ -11585,14 +11742,14 @@ var TableToolbar = ({
11585
11742
  }) => {
11586
11743
  const table = useTableMenu(editor);
11587
11744
  if (!editor || !table.inTable && !showWhenOutside) return null;
11588
- return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className, role: "toolbar", "aria-label": "Table", "data-table-toolbar": "", children: items.map((item, index) => {
11745
+ return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className, role: "toolbar", "aria-label": "Table", "data-table-toolbar": "", children: items.map((item, index) => {
11589
11746
  const status = table.check(item.action, item.params);
11590
11747
  const enabled = status === true;
11591
11748
  const active = item.active?.(table);
11592
11749
  const separator = index > 0 && items[index - 1].group !== item.group;
11593
- return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(import_react82.default.Fragment, { children: [
11594
- separator && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { className: separatorClassName, "aria-hidden": "true" }),
11595
- /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
11750
+ return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(import_react83.default.Fragment, { children: [
11751
+ separator && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("span", { className: separatorClassName, "aria-hidden": "true" }),
11752
+ /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
11596
11753
  "button",
11597
11754
  {
11598
11755
  type: "button",
@@ -11614,8 +11771,8 @@ var TableToolbar = ({
11614
11771
  };
11615
11772
 
11616
11773
  // src/tables/InsertTableGrid.tsx
11617
- var import_react83 = require("react");
11618
- var import_jsx_runtime59 = require("react/jsx-runtime");
11774
+ var import_react84 = require("react");
11775
+ var import_jsx_runtime60 = require("react/jsx-runtime");
11619
11776
  var keepSelection3 = (event) => event.preventDefault();
11620
11777
  var InsertTableGrid = ({
11621
11778
  editor,
@@ -11628,14 +11785,14 @@ var InsertTableGrid = ({
11628
11785
  onInsert
11629
11786
  }) => {
11630
11787
  const table = useTableMenu(editor);
11631
- const [hover, setHover] = (0, import_react83.useState)(null);
11788
+ const [hover, setHover] = (0, import_react84.useState)(null);
11632
11789
  const status = table.actions.insertTable;
11633
11790
  const disabled = !editor || !status.enabled;
11634
11791
  const insert = (size) => {
11635
11792
  if (table.run("insertTable", { ...size, withHeaderRow })) onInsert?.(size);
11636
11793
  setHover(null);
11637
11794
  };
11638
- return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(
11795
+ return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
11639
11796
  "div",
11640
11797
  {
11641
11798
  className,
@@ -11645,7 +11802,7 @@ var InsertTableGrid = ({
11645
11802
  "data-insert-table-grid": "",
11646
11803
  onMouseLeave: () => setHover(null),
11647
11804
  children: [
11648
- /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
11805
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
11649
11806
  "div",
11650
11807
  {
11651
11808
  role: "grid",
@@ -11654,7 +11811,7 @@ var InsertTableGrid = ({
11654
11811
  children: Array.from({ length: rows * cols }, (_, i) => {
11655
11812
  const size = { rows: Math.floor(i / cols) + 1, cols: i % cols + 1 };
11656
11813
  const active = !!hover && size.rows <= hover.rows && size.cols <= hover.cols;
11657
- return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
11814
+ return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
11658
11815
  "button",
11659
11816
  {
11660
11817
  type: "button",
@@ -11674,7 +11831,7 @@ var InsertTableGrid = ({
11674
11831
  })
11675
11832
  }
11676
11833
  ),
11677
- /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { "aria-live": "polite", "data-testid": "insert-table-size", children: disabled ? status.reason : hover ? `${hover.rows} \xD7 ${hover.cols}` : "Insert table" })
11834
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { "aria-live": "polite", "data-testid": "insert-table-size", children: disabled ? status.reason : hover ? `${hover.rows} \xD7 ${hover.cols}` : "Insert table" })
11678
11835
  ]
11679
11836
  }
11680
11837
  );
@@ -11682,31 +11839,31 @@ var InsertTableGrid = ({
11682
11839
 
11683
11840
  // src/tables/TableBubbleMenu.tsx
11684
11841
  var import_editor21 = require("@pixerate/editor");
11685
- var import_jsx_runtime60 = require("react/jsx-runtime");
11842
+ var import_jsx_runtime61 = require("react/jsx-runtime");
11686
11843
  var TableBubbleMenu = ({
11687
11844
  editor,
11688
11845
  children,
11689
11846
  toolbarProps,
11690
11847
  pluginKey = "tableBubbleMenu",
11691
11848
  ...rest
11692
- }) => /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(BubbleMenu, { editor, pluginKey, shouldShow: import_editor21.shouldShowTableBubbleMenu, ...rest, children: children ?? /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(TableToolbar, { editor, ...toolbarProps }) });
11849
+ }) => /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(BubbleMenu, { editor, pluginKey, shouldShow: import_editor21.shouldShowTableBubbleMenu, ...rest, children: children ?? /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(TableToolbar, { editor, ...toolbarProps }) });
11693
11850
 
11694
11851
  // src/chart-node/ChartNodeView.tsx
11695
11852
  var import_client = require("react-dom/client");
11696
11853
 
11697
11854
  // src/chart/ChartCanvas.tsx
11698
- var import_react85 = require("react");
11855
+ var import_react86 = require("react");
11699
11856
  var import_chart2 = require("@pixerate/editor/chart");
11700
11857
 
11701
11858
  // src/chart/useChartEditor.ts
11702
- var import_react84 = require("react");
11859
+ var import_react85 = require("react");
11703
11860
  var import_chart = require("@pixerate/editor/chart");
11704
11861
  function useChartState(controller) {
11705
- return (0, import_react84.useSyncExternalStore)(controller.subscribe, controller.getState, controller.getState);
11862
+ return (0, import_react85.useSyncExternalStore)(controller.subscribe, controller.getState, controller.getState);
11706
11863
  }
11707
11864
 
11708
11865
  // src/chart/ChartCanvas.tsx
11709
- var import_jsx_runtime61 = require("react/jsx-runtime");
11866
+ var import_jsx_runtime62 = require("react/jsx-runtime");
11710
11867
  function renderChartMark(mark, fontFamily, interactive) {
11711
11868
  const common = {
11712
11869
  "data-role": mark.role,
@@ -11718,9 +11875,9 @@ function renderChartMark(mark, fontFamily, interactive) {
11718
11875
  };
11719
11876
  switch (mark.kind) {
11720
11877
  case "rect":
11721
- return /* @__PURE__ */ (0, import_jsx_runtime61.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);
11878
+ return /* @__PURE__ */ (0, import_jsx_runtime62.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);
11722
11879
  case "path":
11723
- return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
11880
+ return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
11724
11881
  "path",
11725
11882
  {
11726
11883
  ...common,
@@ -11733,11 +11890,11 @@ function renderChartMark(mark, fontFamily, interactive) {
11733
11890
  mark.key
11734
11891
  );
11735
11892
  case "circle":
11736
- return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("circle", { ...common, cx: mark.cx, cy: mark.cy, r: mark.r, style: { fill: mark.fill, stroke: mark.stroke, strokeWidth: mark.strokeWidth } }, mark.key);
11893
+ return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("circle", { ...common, cx: mark.cx, cy: mark.cy, r: mark.r, style: { fill: mark.fill, stroke: mark.stroke, strokeWidth: mark.strokeWidth } }, mark.key);
11737
11894
  case "line":
11738
- return /* @__PURE__ */ (0, import_jsx_runtime61.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);
11895
+ return /* @__PURE__ */ (0, import_jsx_runtime62.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);
11739
11896
  case "text":
11740
- return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
11897
+ return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
11741
11898
  "text",
11742
11899
  {
11743
11900
  ...common,
@@ -11754,36 +11911,36 @@ function renderChartMark(mark, fontFamily, interactive) {
11754
11911
  }
11755
11912
  }
11756
11913
  function ChartPresenceLayer({ presence }) {
11757
- const { actors } = (0, import_react85.useSyncExternalStore)(presence.subscribe, presence.getState, presence.getState);
11758
- return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("g", { "data-chart-presence": "", pointerEvents: "none", children: actors.map((a) => /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("g", { transform: `translate(${a.x} ${a.y})`, "data-actor": a.id, children: [
11759
- /* @__PURE__ */ (0, import_jsx_runtime61.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 }),
11760
- /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("g", { transform: "translate(13 16)", children: [
11761
- /* @__PURE__ */ (0, import_jsx_runtime61.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 } }),
11762
- /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("text", { x: 6, y: 9, dominantBaseline: "central", style: { fill: "#ffffff", fontSize: 11, fontWeight: 600, fontFamily: "inherit" }, children: a.message ?? a.name })
11914
+ const { actors } = (0, import_react86.useSyncExternalStore)(presence.subscribe, presence.getState, presence.getState);
11915
+ return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("g", { "data-chart-presence": "", pointerEvents: "none", children: actors.map((a) => /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("g", { transform: `translate(${a.x} ${a.y})`, "data-actor": a.id, children: [
11916
+ /* @__PURE__ */ (0, import_jsx_runtime62.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 }),
11917
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("g", { transform: "translate(13 16)", children: [
11918
+ /* @__PURE__ */ (0, import_jsx_runtime62.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 } }),
11919
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("text", { x: 6, y: 9, dominantBaseline: "central", style: { fill: "#ffffff", fontSize: 11, fontWeight: 600, fontFamily: "inherit" }, children: a.message ?? a.name })
11763
11920
  ] })
11764
11921
  ] }, a.id)) });
11765
11922
  }
11766
11923
  function ChartTooltipContent({ tooltip }) {
11767
- return /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(import_jsx_runtime61.Fragment, { children: [
11768
- tooltip.title && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("div", { className: "mb-1 font-medium", children: tooltip.title }),
11769
- tooltip.items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("div", { className: "flex items-center gap-2", children: [
11770
- /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("span", { className: "h-2 w-2 shrink-0 rounded-full", style: { background: item.color } }),
11771
- /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("span", { style: { color: "var(--muted-foreground, #64748b)" }, children: item.name }),
11772
- /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("span", { className: "ml-auto pl-3 font-medium tabular-nums", children: item.text })
11924
+ return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(import_jsx_runtime62.Fragment, { children: [
11925
+ tooltip.title && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: "mb-1 font-medium", children: tooltip.title }),
11926
+ tooltip.items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className: "flex items-center gap-2", children: [
11927
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { className: "h-2 w-2 shrink-0 rounded-full", style: { background: item.color } }),
11928
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { style: { color: "var(--muted-foreground, #64748b)" }, children: item.name }),
11929
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { className: "ml-auto pl-3 font-medium tabular-nums", children: item.text })
11773
11930
  ] }, item.seriesId))
11774
11931
  ] });
11775
11932
  }
11776
11933
  function ChartCanvas({ controller, width = 640, height = 400, responsive = true, theme, editable = true, measureText, emptyMessage, className, presence, sceneRef, tooltip = false, renderTooltip }) {
11777
11934
  const state = useChartState(controller);
11778
- const wrapper = (0, import_react85.useRef)(null);
11779
- const svg = (0, import_react85.useRef)(null);
11780
- const drag = (0, import_react85.useRef)(null);
11781
- const [measured, setMeasured] = (0, import_react85.useState)(null);
11782
- const [frozen, setFrozen] = (0, import_react85.useState)(null);
11935
+ const wrapper = (0, import_react86.useRef)(null);
11936
+ const svg = (0, import_react86.useRef)(null);
11937
+ const drag = (0, import_react86.useRef)(null);
11938
+ const [measured, setMeasured] = (0, import_react86.useState)(null);
11939
+ const [frozen, setFrozen] = (0, import_react86.useState)(null);
11783
11940
  const tooltipMode = tooltip === true ? "point" : tooltip || null;
11784
- const [tip, setTip] = (0, import_react85.useState)(null);
11785
- const [tipAt, setTipAt] = (0, import_react85.useState)({ left: 0, top: 0, flip: false });
11786
- (0, import_react85.useEffect)(() => {
11941
+ const [tip, setTip] = (0, import_react86.useState)(null);
11942
+ const [tipAt, setTipAt] = (0, import_react86.useState)({ left: 0, top: 0, flip: false });
11943
+ (0, import_react86.useEffect)(() => {
11787
11944
  const el = wrapper.current;
11788
11945
  if (!responsive || !el || typeof ResizeObserver === "undefined") return;
11789
11946
  const observer = new ResizeObserver(([entry]) => {
@@ -11794,8 +11951,8 @@ function ChartCanvas({ controller, width = 640, height = 400, responsive = true,
11794
11951
  return () => observer.disconnect();
11795
11952
  }, [responsive]);
11796
11953
  const sceneWidth = responsive && measured || width;
11797
- const fullTheme = (0, import_react85.useMemo)(() => ({ ...import_chart2.CSS_VARIABLE_CHART_THEME, ...theme }), [theme]);
11798
- const scene = (0, import_react85.useMemo)(
11954
+ const fullTheme = (0, import_react86.useMemo)(() => ({ ...import_chart2.CSS_VARIABLE_CHART_THEME, ...theme }), [theme]);
11955
+ const scene = (0, import_react86.useMemo)(
11799
11956
  () => (0, import_chart2.layoutChart)(state.spec, {
11800
11957
  width: sceneWidth,
11801
11958
  height,
@@ -11812,8 +11969,8 @@ function ChartCanvas({ controller, width = 640, height = 400, responsive = true,
11812
11969
  [state.spec, state.selection, state.raceFrame, sceneWidth, height, fullTheme, editable, measureText, emptyMessage, frozen]
11813
11970
  );
11814
11971
  if (sceneRef) sceneRef.current = scene;
11815
- const byKey = (0, import_react85.useMemo)(() => new Map(scene.marks.map((m) => [m.key, m])), [scene]);
11816
- (0, import_react85.useEffect)(() => () => drag.current?.end(), []);
11972
+ const byKey = (0, import_react86.useMemo)(() => new Map(scene.marks.map((m) => [m.key, m])), [scene]);
11973
+ (0, import_react86.useEffect)(() => () => drag.current?.end(), []);
11817
11974
  const scenePoint = (e) => (0, import_chart2.chartClientToScene)(scene, svg.current.getBoundingClientRect(), e.clientX, e.clientY);
11818
11975
  const onPointerDown = (e) => {
11819
11976
  if (!editable || e.button !== 0) return;
@@ -11860,8 +12017,8 @@ function ChartCanvas({ controller, width = 640, height = 400, responsive = true,
11860
12017
  if (editable && (0, import_chart2.handleChartKey)(controller, scene, e)) e.preventDefault();
11861
12018
  };
11862
12019
  const label = state.spec.title || "Chart";
11863
- return /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("div", { ref: wrapper, className: `relative w-full ${className ?? ""}`, "data-chart-canvas": "", children: [
11864
- /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(
12020
+ return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { ref: wrapper, className: `relative w-full ${className ?? ""}`, "data-chart-canvas": "", children: [
12021
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
11865
12022
  "svg",
11866
12023
  {
11867
12024
  ref: svg,
@@ -11880,11 +12037,11 @@ function ChartCanvas({ controller, width = 640, height = 400, responsive = true,
11880
12037
  onKeyDown,
11881
12038
  children: [
11882
12039
  scene.marks.map((m) => renderChartMark(m, scene.theme.fontFamily, editable)),
11883
- presence && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(ChartPresenceLayer, { presence })
12040
+ presence && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(ChartPresenceLayer, { presence })
11884
12041
  ]
11885
12042
  }
11886
12043
  ),
11887
- tip && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
12044
+ tip && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
11888
12045
  "div",
11889
12046
  {
11890
12047
  role: "tooltip",
@@ -11899,14 +12056,14 @@ function ChartCanvas({ controller, width = 640, height = 400, responsive = true,
11899
12056
  borderColor: "var(--border, #e2e8f0)",
11900
12057
  fontFamily: scene.theme.fontFamily
11901
12058
  },
11902
- children: renderTooltip ? renderTooltip(tip) : /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(ChartTooltipContent, { tooltip: tip })
12059
+ children: renderTooltip ? renderTooltip(tip) : /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(ChartTooltipContent, { tooltip: tip })
11903
12060
  }
11904
12061
  )
11905
12062
  ] });
11906
12063
  }
11907
12064
 
11908
12065
  // src/chart/ChartDataGrid.tsx
11909
- var import_react86 = require("react");
12066
+ var import_react87 = require("react");
11910
12067
  var import_chart3 = require("@pixerate/editor/chart");
11911
12068
 
11912
12069
  // src/chart/styles.ts
@@ -11919,11 +12076,11 @@ var chartSectionClass = "space-y-2 border-b border-border pb-3 last:border-b-0";
11919
12076
  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";
11920
12077
 
11921
12078
  // src/chart/ChartDataGrid.tsx
11922
- var import_jsx_runtime62 = require("react/jsx-runtime");
12079
+ var import_jsx_runtime63 = require("react/jsx-runtime");
11923
12080
  function ChartCommitInput({ value, onCommit, onKeyDown, onBlur, ...rest }) {
11924
- const [draft, setDraft] = (0, import_react86.useState)(value);
11925
- const typing = (0, import_react86.useRef)(false);
11926
- (0, import_react86.useEffect)(() => {
12081
+ const [draft, setDraft] = (0, import_react87.useState)(value);
12082
+ const typing = (0, import_react87.useRef)(false);
12083
+ (0, import_react87.useEffect)(() => {
11927
12084
  if (!typing.current) setDraft(value);
11928
12085
  }, [value]);
11929
12086
  const commit = () => {
@@ -11932,7 +12089,7 @@ function ChartCommitInput({ value, onCommit, onKeyDown, onBlur, ...rest }) {
11932
12089
  if (draft === value) return;
11933
12090
  if (onCommit(draft) === false) setDraft(value);
11934
12091
  };
11935
- return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
12092
+ return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
11936
12093
  "input",
11937
12094
  {
11938
12095
  ...rest,
@@ -11961,20 +12118,20 @@ function ChartCommitInput({ value, onCommit, onKeyDown, onBlur, ...rest }) {
11961
12118
  }
11962
12119
  function ChartTreeGrid({ controller, readOnly = false, className }) {
11963
12120
  const { spec } = useChartState(controller);
11964
- const [columns, setColumns] = (0, import_react86.useState)(1);
12121
+ const [columns, setColumns] = (0, import_react87.useState)(1);
11965
12122
  const rows = (0, import_chart3.chartTreeToRows)(spec.tree);
11966
12123
  const depth = Math.max(columns, (0, import_chart3.chartTreeDepth)(spec.tree));
11967
12124
  const labels = (0, import_chart3.chartTreeColumnLabels)(depth);
11968
12125
  const commit = (next) => controller.setTreeRows(next).ok;
11969
- return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className: `overflow-auto rounded-md border border-border ${className ?? ""}`, "data-chart-grid": "", "data-chart-tree-grid": "", children: [
11970
- /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("table", { className: "w-full border-collapse text-xs", children: [
11971
- /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("thead", { className: "bg-muted/50", children: /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("tr", { children: [
11972
- labels.map((label) => /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("th", { className: "border-b border-r border-border px-2 py-1 text-left font-medium text-muted-foreground", children: label }, label)),
11973
- /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("th", { className: "border-b border-r border-border px-2 py-1 text-right font-medium text-muted-foreground", children: "Value" }),
11974
- !readOnly && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("th", { className: "w-8 border-b border-border" })
12126
+ return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { className: `overflow-auto rounded-md border border-border ${className ?? ""}`, "data-chart-grid": "", "data-chart-tree-grid": "", children: [
12127
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("table", { className: "w-full border-collapse text-xs", children: [
12128
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("thead", { className: "bg-muted/50", children: /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("tr", { children: [
12129
+ labels.map((label) => /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("th", { className: "border-b border-r border-border px-2 py-1 text-left font-medium text-muted-foreground", children: label }, label)),
12130
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("th", { className: "border-b border-r border-border px-2 py-1 text-right font-medium text-muted-foreground", children: "Value" }),
12131
+ !readOnly && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("th", { className: "w-8 border-b border-border" })
11975
12132
  ] }) }),
11976
- /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("tbody", { children: rows.map((row, r) => /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("tr", { "data-tree-row": r, children: [
11977
- labels.map((_, k) => /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("td", { className: "border-b border-r border-border p-0", children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
12133
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("tbody", { children: rows.map((row, r) => /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("tr", { "data-tree-row": r, children: [
12134
+ labels.map((_, k) => /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("td", { className: "border-b border-r border-border p-0", children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
11978
12135
  ChartCommitInput,
11979
12136
  {
11980
12137
  value: row.path[k] ?? "",
@@ -11985,7 +12142,7 @@ function ChartTreeGrid({ controller, readOnly = false, className }) {
11985
12142
  className: `${chartCellClass} text-left`
11986
12143
  }
11987
12144
  ) }, k)),
11988
- /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("td", { className: "border-b border-r border-border p-0", children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
12145
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("td", { className: "border-b border-r border-border p-0", children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
11989
12146
  ChartCommitInput,
11990
12147
  {
11991
12148
  value: String(row.value),
@@ -11998,14 +12155,14 @@ function ChartTreeGrid({ controller, readOnly = false, className }) {
11998
12155
  className: chartCellClass
11999
12156
  }
12000
12157
  ) }),
12001
- !readOnly && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("td", { className: "border-b border-border px-1", children: /* @__PURE__ */ (0, import_jsx_runtime62.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" }) })
12158
+ !readOnly && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("td", { className: "border-b border-border px-1", children: /* @__PURE__ */ (0, import_jsx_runtime63.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" }) })
12002
12159
  ] }, r)) })
12003
12160
  ] }),
12004
- !readOnly && /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className: "flex flex-wrap gap-1 p-1", children: [
12005
- /* @__PURE__ */ (0, import_jsx_runtime62.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" }),
12006
- /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("button", { type: "button", className: `${chartButtonClass} h-6 border-dashed`, "data-action": "tree-add-level", disabled: depth >= 6, onClick: () => setColumns(depth + 1), children: "+ Level" }),
12007
- /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { className: "flex-1" }),
12008
- /* @__PURE__ */ (0, import_jsx_runtime62.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" })
12161
+ !readOnly && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { className: "flex flex-wrap gap-1 p-1", children: [
12162
+ /* @__PURE__ */ (0, import_jsx_runtime63.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" }),
12163
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("button", { type: "button", className: `${chartButtonClass} h-6 border-dashed`, "data-action": "tree-add-level", disabled: depth >= 6, onClick: () => setColumns(depth + 1), children: "+ Level" }),
12164
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("span", { className: "flex-1" }),
12165
+ /* @__PURE__ */ (0, import_jsx_runtime63.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" })
12009
12166
  ] })
12010
12167
  ] });
12011
12168
  }
@@ -12013,30 +12170,30 @@ function ChartLinksGrid({ controller, readOnly = false, className }) {
12013
12170
  const { spec } = useChartState(controller);
12014
12171
  const links = spec.links;
12015
12172
  const commit = (next) => controller.setLinks(next).ok;
12016
- return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className: `overflow-auto rounded-md border border-border ${className ?? ""}`, "data-chart-grid": "", "data-chart-links-grid": "", children: [
12017
- /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("table", { className: "w-full border-collapse text-xs", children: [
12018
- /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("thead", { className: "bg-muted/50", children: /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("tr", { children: [
12019
- ["Source", "Target"].map((label) => /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("th", { className: "border-b border-r border-border px-2 py-1 text-left font-medium text-muted-foreground", children: label }, label)),
12020
- /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("th", { className: "border-b border-r border-border px-2 py-1 text-right font-medium text-muted-foreground", children: "Value" }),
12021
- !readOnly && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("th", { className: "w-8 border-b border-border" })
12173
+ return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { className: `overflow-auto rounded-md border border-border ${className ?? ""}`, "data-chart-grid": "", "data-chart-links-grid": "", children: [
12174
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("table", { className: "w-full border-collapse text-xs", children: [
12175
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("thead", { className: "bg-muted/50", children: /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("tr", { children: [
12176
+ ["Source", "Target"].map((label) => /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("th", { className: "border-b border-r border-border px-2 py-1 text-left font-medium text-muted-foreground", children: label }, label)),
12177
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("th", { className: "border-b border-r border-border px-2 py-1 text-right font-medium text-muted-foreground", children: "Value" }),
12178
+ !readOnly && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("th", { className: "w-8 border-b border-border" })
12022
12179
  ] }) }),
12023
- /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("tbody", { children: links.map((link, i) => /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("tr", { "data-link-row": i, children: [
12024
- ["source", "target"].map((field) => /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("td", { className: "border-b border-r border-border p-0", children: /* @__PURE__ */ (0, import_jsx_runtime62.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)),
12025
- /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("td", { className: "border-b border-r border-border p-0", children: /* @__PURE__ */ (0, import_jsx_runtime62.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 }) }),
12026
- !readOnly && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("td", { className: "border-b border-border px-1", children: /* @__PURE__ */ (0, import_jsx_runtime62.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" }) })
12180
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("tbody", { children: links.map((link, i) => /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("tr", { "data-link-row": i, children: [
12181
+ ["source", "target"].map((field) => /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("td", { className: "border-b border-r border-border p-0", children: /* @__PURE__ */ (0, import_jsx_runtime63.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)),
12182
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("td", { className: "border-b border-r border-border p-0", children: /* @__PURE__ */ (0, import_jsx_runtime63.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 }) }),
12183
+ !readOnly && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("td", { className: "border-b border-border px-1", children: /* @__PURE__ */ (0, import_jsx_runtime63.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" }) })
12027
12184
  ] }, i)) })
12028
12185
  ] }),
12029
- !readOnly && /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className: "flex flex-wrap gap-1 p-1", children: [
12030
- /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("button", { type: "button", className: `${chartButtonClass} h-6 border-dashed`, "data-action": "link-add", onClick: () => commit((0, import_chart3.addChartLink)(links)), children: "+ Add flow" }),
12031
- /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { className: "flex-1" }),
12032
- links.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime62.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" })
12186
+ !readOnly && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { className: "flex flex-wrap gap-1 p-1", children: [
12187
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("button", { type: "button", className: `${chartButtonClass} h-6 border-dashed`, "data-action": "link-add", onClick: () => commit((0, import_chart3.addChartLink)(links)), children: "+ Add flow" }),
12188
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("span", { className: "flex-1" }),
12189
+ links.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime63.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" })
12033
12190
  ] })
12034
12191
  ] });
12035
12192
  }
12036
12193
  function ChartDataGrid({ controller, categoryHeader = "Category", readOnly = false, className }) {
12037
12194
  const { spec, selection } = useChartState(controller);
12038
- if (spec.links.length || spec.type === "sankey") return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(ChartLinksGrid, { controller, readOnly, className });
12039
- if (spec.tree.length) return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(ChartTreeGrid, { controller, readOnly, className });
12195
+ if (spec.links.length || spec.type === "sankey") return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(ChartLinksGrid, { controller, readOnly, className });
12196
+ if (spec.tree.length) return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(ChartTreeGrid, { controller, readOnly, className });
12040
12197
  const canGroup = spec.type === "treemap" || spec.type === "sunburst";
12041
12198
  const paste = (row, column) => (e) => {
12042
12199
  const text = e.clipboardData?.getData("text/plain") ?? "";
@@ -12044,15 +12201,15 @@ function ChartDataGrid({ controller, categoryHeader = "Category", readOnly = fal
12044
12201
  e.preventDefault();
12045
12202
  controller.pasteCells(row, column, text);
12046
12203
  };
12047
- return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className: `overflow-auto rounded-md border border-border ${className ?? ""}`, "data-chart-grid": "", children: [
12048
- /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("table", { className: "w-full border-collapse text-xs", children: [
12049
- /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("thead", { className: "bg-muted/50", children: /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("tr", { children: [
12050
- /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("th", { className: "border-b border-r border-border px-2 py-1 text-left font-medium text-muted-foreground", children: categoryHeader }),
12204
+ return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { className: `overflow-auto rounded-md border border-border ${className ?? ""}`, "data-chart-grid": "", children: [
12205
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("table", { className: "w-full border-collapse text-xs", children: [
12206
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("thead", { className: "bg-muted/50", children: /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("tr", { children: [
12207
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("th", { className: "border-b border-r border-border px-2 py-1 text-left font-medium text-muted-foreground", children: categoryHeader }),
12051
12208
  spec.series.map((s, si) => {
12052
12209
  const color = (0, import_chart3.chartSeriesColor)(spec, si);
12053
12210
  const selected = selection?.kind === "series" && selection.seriesId === s.id;
12054
- return /* @__PURE__ */ (0, import_jsx_runtime62.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_runtime62.jsxs)("div", { className: "flex items-center gap-1", children: [
12055
- /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
12211
+ return /* @__PURE__ */ (0, import_jsx_runtime63.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_runtime63.jsxs)("div", { className: "flex items-center gap-1", children: [
12212
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
12056
12213
  "input",
12057
12214
  {
12058
12215
  type: "color",
@@ -12065,7 +12222,7 @@ function ChartDataGrid({ controller, categoryHeader = "Category", readOnly = fal
12065
12222
  className: "h-5 w-5 shrink-0 cursor-pointer rounded border-0 bg-transparent p-0"
12066
12223
  }
12067
12224
  ),
12068
- /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
12225
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
12069
12226
  ChartCommitInput,
12070
12227
  {
12071
12228
  value: s.name,
@@ -12075,8 +12232,8 @@ function ChartDataGrid({ controller, categoryHeader = "Category", readOnly = fal
12075
12232
  className: `${chartInputClass} h-6 min-w-[5rem] border-transparent bg-transparent font-medium ${s.hidden ? "text-muted-foreground line-through" : ""}`
12076
12233
  }
12077
12234
  ),
12078
- !readOnly && /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(import_jsx_runtime62.Fragment, { children: [
12079
- /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
12235
+ !readOnly && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(import_jsx_runtime63.Fragment, { children: [
12236
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
12080
12237
  "button",
12081
12238
  {
12082
12239
  type: "button",
@@ -12089,16 +12246,16 @@ function ChartDataGrid({ controller, categoryHeader = "Category", readOnly = fal
12089
12246
  children: s.hidden ? "\u25CB" : "\u25CF"
12090
12247
  }
12091
12248
  ),
12092
- /* @__PURE__ */ (0, import_jsx_runtime62.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" })
12249
+ /* @__PURE__ */ (0, import_jsx_runtime63.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" })
12093
12250
  ] })
12094
12251
  ] }) }, s.id);
12095
12252
  }),
12096
- !readOnly && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("th", { className: "w-8 border-b border-border px-1", children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("button", { type: "button", className: chartIconButtonClass, title: "Add series", "aria-label": "Add series", "data-action": "add-series", onClick: () => controller.addSeries(), children: "+" }) })
12253
+ !readOnly && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("th", { className: "w-8 border-b border-border px-1", children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("button", { type: "button", className: chartIconButtonClass, title: "Add series", "aria-label": "Add series", "data-action": "add-series", onClick: () => controller.addSeries(), children: "+" }) })
12097
12254
  ] }) }),
12098
- /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("tbody", { children: spec.categories.map((category, i) => {
12255
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("tbody", { children: spec.categories.map((category, i) => {
12099
12256
  const rowSelected = selection?.kind === "category" && selection.index === i;
12100
- return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("tr", { "data-category-index": i, className: rowSelected ? "bg-primary/10" : void 0, children: [
12101
- /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("th", { className: "border-b border-r border-border p-0 text-left font-normal", children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
12257
+ return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("tr", { "data-category-index": i, className: rowSelected ? "bg-primary/10" : void 0, children: [
12258
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("th", { className: "border-b border-r border-border p-0 text-left font-normal", children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
12102
12259
  ChartCommitInput,
12103
12260
  {
12104
12261
  value: category,
@@ -12112,7 +12269,7 @@ function ChartDataGrid({ controller, categoryHeader = "Category", readOnly = fal
12112
12269
  spec.series.map((s) => {
12113
12270
  const value = s.values[i];
12114
12271
  const selected = selection?.kind === "point" && selection.seriesId === s.id && selection.index === i;
12115
- return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("td", { className: `border-b border-r border-border p-0 ${selected ? "bg-primary/10" : ""}`, children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
12272
+ return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("td", { className: `border-b border-r border-border p-0 ${selected ? "bg-primary/10" : ""}`, children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
12116
12273
  ChartCommitInput,
12117
12274
  {
12118
12275
  value: value === null || value === void 0 ? "" : String(value),
@@ -12127,13 +12284,13 @@ function ChartDataGrid({ controller, categoryHeader = "Category", readOnly = fal
12127
12284
  }
12128
12285
  ) }, s.id);
12129
12286
  }),
12130
- !readOnly && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("td", { className: "border-b border-border px-1", children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("button", { type: "button", className: chartIconButtonClass, title: "Delete category", "aria-label": `Delete ${category}`, "data-action": "remove-category", onClick: () => controller.removeCategory(i), children: "\xD7" }) })
12287
+ !readOnly && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("td", { className: "border-b border-border px-1", children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("button", { type: "button", className: chartIconButtonClass, title: "Delete category", "aria-label": `Delete ${category}`, "data-action": "remove-category", onClick: () => controller.removeCategory(i), children: "\xD7" }) })
12131
12288
  ] }, i);
12132
12289
  }) })
12133
12290
  ] }),
12134
- !readOnly && /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className: "p-1", children: [
12135
- /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("button", { type: "button", className: `${chartButtonClass} h-6 border-dashed`, "data-action": "add-category", onClick: () => controller.addCategory(), children: "+ Add category" }),
12136
- canGroup && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
12291
+ !readOnly && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { className: "p-1", children: [
12292
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("button", { type: "button", className: `${chartButtonClass} h-6 border-dashed`, "data-action": "add-category", onClick: () => controller.addCategory(), children: "+ Add category" }),
12293
+ canGroup && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
12137
12294
  "button",
12138
12295
  {
12139
12296
  type: "button",
@@ -12149,29 +12306,29 @@ function ChartDataGrid({ controller, categoryHeader = "Category", readOnly = fal
12149
12306
  }
12150
12307
 
12151
12308
  // src/chart/ChartInspector.tsx
12152
- var import_react87 = require("react");
12309
+ var import_react88 = require("react");
12153
12310
  var import_chart4 = require("@pixerate/editor/chart");
12154
- var import_jsx_runtime63 = require("react/jsx-runtime");
12311
+ var import_jsx_runtime64 = require("react/jsx-runtime");
12155
12312
  var cap = (s) => s.charAt(0).toUpperCase() + s.slice(1);
12156
12313
  function Field({ label, htmlFor, children }) {
12157
- return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { className: "flex items-center gap-2", children: [
12158
- /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("label", { htmlFor, className: `${chartLabelClass} w-20 shrink-0`, children: label }),
12159
- /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("div", { className: "min-w-0 flex-1", children })
12314
+ return /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className: "flex items-center gap-2", children: [
12315
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("label", { htmlFor, className: `${chartLabelClass} w-20 shrink-0`, children: label }),
12316
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("div", { className: "min-w-0 flex-1", children })
12160
12317
  ] });
12161
12318
  }
12162
12319
  function Toggle({ label, checked, onChange, name }) {
12163
- return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("label", { className: "flex cursor-pointer items-center gap-2 text-xs text-foreground", children: [
12164
- /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("input", { type: "checkbox", className: "h-3.5 w-3.5 accent-primary", checked, "data-option": name, onChange: (e) => onChange(e.currentTarget.checked) }),
12320
+ return /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("label", { className: "flex cursor-pointer items-center gap-2 text-xs text-foreground", children: [
12321
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("input", { type: "checkbox", className: "h-3.5 w-3.5 accent-primary", checked, "data-option": name, onChange: (e) => onChange(e.currentTarget.checked) }),
12165
12322
  label
12166
12323
  ] });
12167
12324
  }
12168
12325
  function Select({ id, value, options, onChange, name, labels }) {
12169
- return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("select", { id, className: chartInputClass, value, "data-option": name, onChange: (e) => onChange(e.currentTarget.value), children: options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("option", { value: o, children: labels?.[o] ?? cap(o) }, o)) });
12326
+ return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("select", { id, className: chartInputClass, value, "data-option": name, onChange: (e) => onChange(e.currentTarget.value), children: options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("option", { value: o, children: labels?.[o] ?? cap(o) }, o)) });
12170
12327
  }
12171
12328
  function AxisSection({ controller, axis, value, idBase, horizontal, numeric = false, scales = false }) {
12172
12329
  const set = (patch) => controller.setAxis(axis, patch);
12173
12330
  const setFormat = (patch) => set({ format: { ...value.format, ...patch } });
12174
- const bound = (key2) => /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
12331
+ const bound = (key2) => /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
12175
12332
  ChartCommitInput,
12176
12333
  {
12177
12334
  id: `${idBase}-${axis}-${key2}`,
@@ -12186,26 +12343,26 @@ function AxisSection({ controller, axis, value, idBase, horizontal, numeric = fa
12186
12343
  const name = axis === "x" ? numeric ? "X axis" : "Category axis" : axis === "y" ? "Value axis" : "Secondary axis";
12187
12344
  const valueAxis = axis !== "x" || numeric;
12188
12345
  const key = axis === "y2" ? "yAxis2" : `${axis}Axis`;
12189
- return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { className: chartSectionClass, "data-section": `axis-${axis}`, children: [
12190
- /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { className: "flex items-center justify-between", children: [
12191
- /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("h4", { className: "text-xs font-semibold text-foreground", children: [
12346
+ return /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className: chartSectionClass, "data-section": `axis-${axis}`, children: [
12347
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className: "flex items-center justify-between", children: [
12348
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("h4", { className: "text-xs font-semibold text-foreground", children: [
12192
12349
  name,
12193
- /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("span", { className: "ml-1 font-normal text-muted-foreground", children: [
12350
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("span", { className: "ml-1 font-normal text-muted-foreground", children: [
12194
12351
  "(",
12195
12352
  axis === "x" ? horizontal ? "left" : "bottom" : axis === "y2" ? horizontal ? "top" : "right" : horizontal ? "bottom" : "left",
12196
12353
  ")"
12197
12354
  ] })
12198
12355
  ] }),
12199
- /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Toggle, { label: "Show", name: `${axis}Axis.show`, checked: value.show, onChange: (show) => set({ show }) })
12356
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Toggle, { label: "Show", name: `${axis}Axis.show`, checked: value.show, onChange: (show) => set({ show }) })
12200
12357
  ] }),
12201
- /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Field, { label: "Title", htmlFor: `${idBase}-${axis}-title`, children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(ChartCommitInput, { id: `${idBase}-${axis}-title`, value: value.title, "data-option": `${axis}Axis.title`, className: chartInputClass, onCommit: (title) => void set({ title }) }) }),
12202
- /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { className: "flex flex-wrap gap-x-4 gap-y-1", children: [
12203
- /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Toggle, { label: "Grid lines", name: `${key}.gridlines`, checked: value.gridlines, onChange: (gridlines) => set({ gridlines }) }),
12204
- axis === "x" && !numeric && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Toggle, { label: "Dates", name: "xAxis.kind", checked: value.kind === "date", onChange: (dates) => set({ kind: dates ? "date" : void 0 }) }),
12205
- scales && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Toggle, { label: "Reverse", name: `${key}.reverse`, checked: !!value.reverse, onChange: (reverse) => set({ reverse }) }),
12206
- scales && valueAxis && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Toggle, { label: "Log scale", name: `${key}.scale`, checked: value.scale === "log", onChange: (log) => set({ scale: log ? "log" : "linear" }) })
12358
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Field, { label: "Title", htmlFor: `${idBase}-${axis}-title`, children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(ChartCommitInput, { id: `${idBase}-${axis}-title`, value: value.title, "data-option": `${axis}Axis.title`, className: chartInputClass, onCommit: (title) => void set({ title }) }) }),
12359
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className: "flex flex-wrap gap-x-4 gap-y-1", children: [
12360
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Toggle, { label: "Grid lines", name: `${key}.gridlines`, checked: value.gridlines, onChange: (gridlines) => set({ gridlines }) }),
12361
+ axis === "x" && !numeric && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Toggle, { label: "Dates", name: "xAxis.kind", checked: value.kind === "date", onChange: (dates) => set({ kind: dates ? "date" : void 0 }) }),
12362
+ scales && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Toggle, { label: "Reverse", name: `${key}.reverse`, checked: !!value.reverse, onChange: (reverse) => set({ reverse }) }),
12363
+ scales && valueAxis && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Toggle, { label: "Log scale", name: `${key}.scale`, checked: value.scale === "log", onChange: (log) => set({ scale: log ? "log" : "linear" }) })
12207
12364
  ] }),
12208
- scales && valueAxis && value.scale === "log" && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Field, { label: "Log base", htmlFor: `${idBase}-${axis}-log-base`, children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
12365
+ scales && valueAxis && value.scale === "log" && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Field, { label: "Log base", htmlFor: `${idBase}-${axis}-log-base`, children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
12209
12366
  ChartCommitInput,
12210
12367
  {
12211
12368
  id: `${idBase}-${axis}-log-base`,
@@ -12216,7 +12373,7 @@ function AxisSection({ controller, axis, value, idBase, horizontal, numeric = fa
12216
12373
  onCommit: (text) => set({ logBase: text.trim() === "" ? void 0 : Number(text) }).ok
12217
12374
  }
12218
12375
  ) }),
12219
- valueAxis && value.scale !== "log" && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Field, { label: "Step", htmlFor: `${idBase}-${axis}-step`, children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
12376
+ valueAxis && value.scale !== "log" && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Field, { label: "Step", htmlFor: `${idBase}-${axis}-step`, children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
12220
12377
  ChartCommitInput,
12221
12378
  {
12222
12379
  id: `${idBase}-${axis}-step`,
@@ -12228,14 +12385,14 @@ function AxisSection({ controller, axis, value, idBase, horizontal, numeric = fa
12228
12385
  onCommit: (text) => set({ step: text.trim() === "" ? null : Number(text) }).ok
12229
12386
  }
12230
12387
  ) }),
12231
- valueAxis && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(import_jsx_runtime63.Fragment, { children: [
12232
- /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Field, { label: "Min / max", children: /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { className: "flex gap-1", children: [
12388
+ valueAxis && /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(import_jsx_runtime64.Fragment, { children: [
12389
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Field, { label: "Min / max", children: /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className: "flex gap-1", children: [
12233
12390
  bound("min"),
12234
12391
  bound("max")
12235
12392
  ] }) }),
12236
- /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Field, { label: "Format", htmlFor: `${idBase}-${axis}-format`, children: /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { className: "flex gap-1", children: [
12237
- /* @__PURE__ */ (0, import_jsx_runtime63.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 }) }),
12238
- /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
12393
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Field, { label: "Format", htmlFor: `${idBase}-${axis}-format`, children: /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className: "flex gap-1", children: [
12394
+ /* @__PURE__ */ (0, import_jsx_runtime64.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 }) }),
12395
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
12239
12396
  ChartCommitInput,
12240
12397
  {
12241
12398
  value: value.format.decimals === void 0 ? "" : String(value.format.decimals),
@@ -12254,8 +12411,8 @@ function AxisSection({ controller, axis, value, idBase, horizontal, numeric = fa
12254
12411
  }
12255
12412
  )
12256
12413
  ] }) }),
12257
- value.format.style === "currency" && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Field, { label: "Currency", htmlFor: `${idBase}-${axis}-currency`, children: /* @__PURE__ */ (0, import_jsx_runtime63.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() }) }) }),
12258
- /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Field, { label: "Code", htmlFor: `${idBase}-${axis}-code`, children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
12414
+ value.format.style === "currency" && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Field, { label: "Currency", htmlFor: `${idBase}-${axis}-currency`, children: /* @__PURE__ */ (0, import_jsx_runtime64.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() }) }) }),
12415
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Field, { label: "Code", htmlFor: `${idBase}-${axis}-code`, children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
12259
12416
  ChartCommitInput,
12260
12417
  {
12261
12418
  id: `${idBase}-${axis}-code`,
@@ -12281,15 +12438,15 @@ function ErrorBarFields({ controller, series, which, idBase }) {
12281
12438
  const values = which === "xErrorBars" ? series.x ?? [] : series.values;
12282
12439
  const set = (next) => controller.updateSeries(series.id, { [which]: next });
12283
12440
  const patch = (p) => bars && set({ ...bars, ...p });
12284
- return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { className: "space-y-1.5", "data-section": which === "errorBars" ? "error-bars" : "x-error-bars", children: [
12285
- /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Field, { label: which === "errorBars" ? "Error bars" : "X error bars", htmlFor: `${id}-type`, children: /* @__PURE__ */ (0, import_jsx_runtime63.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: [
12286
- /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("option", { value: "", children: "None" }),
12287
- import_chart4.CHART_ERROR_BAR_TYPES.map((t) => /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("option", { value: t, children: import_chart4.CHART_ERROR_BAR_LABELS[t] }, t))
12441
+ return /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className: "space-y-1.5", "data-section": which === "errorBars" ? "error-bars" : "x-error-bars", children: [
12442
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Field, { label: which === "errorBars" ? "Error bars" : "X error bars", htmlFor: `${id}-type`, children: /* @__PURE__ */ (0, import_jsx_runtime64.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: [
12443
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("option", { value: "", children: "None" }),
12444
+ import_chart4.CHART_ERROR_BAR_TYPES.map((t) => /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("option", { value: t, children: import_chart4.CHART_ERROR_BAR_LABELS[t] }, t))
12288
12445
  ] }) }),
12289
- bars && (bars.type === "fixed" || bars.type === "percent" || bars.type === "stddev") && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Field, { label: bars.type === "percent" ? "Percent" : bars.type === "stddev" ? "Deviations" : "Amount", htmlFor: `${id}-value`, children: /* @__PURE__ */ (0, import_jsx_runtime63.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 }) }),
12290
- bars?.type === "custom" && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(import_jsx_runtime63.Fragment, { children: [
12291
- /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Field, { label: "Plus", htmlFor: `${id}-plus`, children: /* @__PURE__ */ (0, import_jsx_runtime63.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 }) }),
12292
- /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Field, { label: "Minus", htmlFor: `${id}-minus`, children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
12446
+ bars && (bars.type === "fixed" || bars.type === "percent" || bars.type === "stddev") && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Field, { label: bars.type === "percent" ? "Percent" : bars.type === "stddev" ? "Deviations" : "Amount", htmlFor: `${id}-value`, children: /* @__PURE__ */ (0, import_jsx_runtime64.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 }) }),
12447
+ bars?.type === "custom" && /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(import_jsx_runtime64.Fragment, { children: [
12448
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Field, { label: "Plus", htmlFor: `${id}-plus`, children: /* @__PURE__ */ (0, import_jsx_runtime64.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 }) }),
12449
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Field, { label: "Minus", htmlFor: `${id}-minus`, children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
12293
12450
  ChartCommitInput,
12294
12451
  {
12295
12452
  id: `${id}-minus`,
@@ -12306,15 +12463,15 @@ function ErrorBarFields({ controller, series, which, idBase }) {
12306
12463
  }
12307
12464
  ) })
12308
12465
  ] }),
12309
- bars && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { className: "flex items-center gap-2", children: [
12310
- /* @__PURE__ */ (0, import_jsx_runtime63.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_runtime63.jsx)("option", { value: d, children: d === "both" ? "Both ways" : d === "plus" ? "Plus only" : "Minus only" }, d)) }),
12311
- /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Toggle, { label: "Caps", name: `${key}.cap`, checked: bars.cap !== false, onChange: (cap2) => patch({ cap: cap2 }) })
12466
+ bars && /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className: "flex items-center gap-2", children: [
12467
+ /* @__PURE__ */ (0, import_jsx_runtime64.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_runtime64.jsx)("option", { value: d, children: d === "both" ? "Both ways" : d === "plus" ? "Plus only" : "Minus only" }, d)) }),
12468
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Toggle, { label: "Caps", name: `${key}.cap`, checked: bars.cap !== false, onChange: (cap2) => patch({ cap: cap2 }) })
12312
12469
  ] })
12313
12470
  ] });
12314
12471
  }
12315
12472
  function ChartInspector({ controller, sections, className }) {
12316
12473
  const { spec, selectedSeries, selection, raceFrame, racePlaying } = useChartState(controller);
12317
- const idBase = (0, import_react87.useId)();
12474
+ const idBase = (0, import_react88.useId)();
12318
12475
  const show = (section) => !sections || sections.includes(section);
12319
12476
  const cartesian = (0, import_chart4.isCartesianChart)(spec.type);
12320
12477
  const family = (0, import_chart4.chartFamily)(spec);
@@ -12329,30 +12486,30 @@ function ChartInspector({ controller, sections, className }) {
12329
12486
  const annotated = scales;
12330
12487
  const oneSeries = cartesian && spec.series.filter((s) => !s.hidden).length === 1;
12331
12488
  const calloutIndex = selection?.kind === "point" && selection.seriesId === selectedSeries?.id ? selection.index : null;
12332
- return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { className: `space-y-3 text-xs ${className ?? ""}`, "data-chart-inspector": "", children: [
12333
- show("type") && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("div", { className: chartSectionClass, "data-section": "type", children: /* @__PURE__ */ (0, import_jsx_runtime63.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_runtime63.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)) }) }),
12334
- show("style") && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { className: chartSectionClass, "data-section": "style", children: [
12335
- /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Field, { label: "Layout", htmlFor: `${idBase}-layout`, children: /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("select", { id: `${idBase}-layout`, className: chartInputClass, value: "", "data-option": "preset.layout", onChange: (e) => e.currentTarget.value && controller.applyPreset({ layout: e.currentTarget.value }), children: [
12336
- /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("option", { value: "", children: "Quick layout\u2026" }),
12337
- import_chart4.CHART_LAYOUT_PRESETS.map((p) => /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("option", { value: p.id, title: p.description, children: p.label }, p.id))
12489
+ return /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className: `space-y-3 text-xs ${className ?? ""}`, "data-chart-inspector": "", children: [
12490
+ show("type") && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("div", { className: chartSectionClass, "data-section": "type", children: /* @__PURE__ */ (0, import_jsx_runtime64.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_runtime64.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)) }) }),
12491
+ show("style") && /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className: chartSectionClass, "data-section": "style", children: [
12492
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Field, { label: "Layout", htmlFor: `${idBase}-layout`, children: /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("select", { id: `${idBase}-layout`, className: chartInputClass, value: "", "data-option": "preset.layout", onChange: (e) => e.currentTarget.value && controller.applyPreset({ layout: e.currentTarget.value }), children: [
12493
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("option", { value: "", children: "Quick layout\u2026" }),
12494
+ import_chart4.CHART_LAYOUT_PRESETS.map((p) => /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("option", { value: p.id, title: p.description, children: p.label }, p.id))
12338
12495
  ] }) }),
12339
- /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Field, { label: "Colours", htmlFor: `${idBase}-colors`, children: /* @__PURE__ */ (0, import_jsx_runtime63.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: [
12340
- /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("option", { value: "", children: "Custom" }),
12341
- import_chart4.CHART_COLOR_SCHEMES.map((c) => /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("option", { value: c.id, title: c.description, children: c.label }, c.id))
12496
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Field, { label: "Colours", htmlFor: `${idBase}-colors`, children: /* @__PURE__ */ (0, import_jsx_runtime64.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: [
12497
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("option", { value: "", children: "Custom" }),
12498
+ import_chart4.CHART_COLOR_SCHEMES.map((c) => /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("option", { value: c.id, title: c.description, children: c.label }, c.id))
12342
12499
  ] }) }),
12343
- !colorCheck.ok && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("p", { className: "text-[11px] leading-snug text-amber-600 dark:text-amber-400", "data-chart-color-warning": "", children: colorCheck.issues[0] }),
12344
- /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("button", { type: "button", className: chartButtonClass, "data-action": "transpose", onClick: () => controller.transpose(), children: "Switch rows and columns" })
12500
+ !colorCheck.ok && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("p", { className: "text-[11px] leading-snug text-amber-600 dark:text-amber-400", "data-chart-color-warning": "", children: colorCheck.issues[0] }),
12501
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("button", { type: "button", className: chartButtonClass, "data-action": "transpose", onClick: () => controller.transpose(), children: "Switch rows and columns" })
12345
12502
  ] }),
12346
- show("titles") && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { className: chartSectionClass, "data-section": "titles", children: [
12347
- /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Field, { label: "Title", htmlFor: `${idBase}-title`, children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(ChartCommitInput, { id: `${idBase}-title`, value: spec.title, "data-option": "title", className: chartInputClass, onCommit: (title) => void controller.setTitle(title) }) }),
12348
- /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Field, { label: "Subtitle", htmlFor: `${idBase}-subtitle`, children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(ChartCommitInput, { id: `${idBase}-subtitle`, value: spec.subtitle, "data-option": "subtitle", className: chartInputClass, onCommit: (subtitle) => void controller.setSubtitle(subtitle) }) }),
12349
- /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Field, { label: "Note", htmlFor: `${idBase}-note`, children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(ChartCommitInput, { id: `${idBase}-note`, value: spec.note, placeholder: "Source or footnote", "data-option": "note", className: chartInputClass, onCommit: (note) => void controller.setNote(note) }) })
12503
+ show("titles") && /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className: chartSectionClass, "data-section": "titles", children: [
12504
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Field, { label: "Title", htmlFor: `${idBase}-title`, children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(ChartCommitInput, { id: `${idBase}-title`, value: spec.title, "data-option": "title", className: chartInputClass, onCommit: (title) => void controller.setTitle(title) }) }),
12505
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Field, { label: "Subtitle", htmlFor: `${idBase}-subtitle`, children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(ChartCommitInput, { id: `${idBase}-subtitle`, value: spec.subtitle, "data-option": "subtitle", className: chartInputClass, onCommit: (subtitle) => void controller.setSubtitle(subtitle) }) }),
12506
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Field, { label: "Note", htmlFor: `${idBase}-note`, children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(ChartCommitInput, { id: `${idBase}-note`, value: spec.note, placeholder: "Source or footnote", "data-option": "note", className: chartInputClass, onCommit: (note) => void controller.setNote(note) }) })
12350
12507
  ] }),
12351
- show("options") && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { className: chartSectionClass, "data-section": "options", children: [
12352
- cartesian && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Field, { label: "Stacking", htmlFor: `${idBase}-stacking`, children: /* @__PURE__ */ (0, import_jsx_runtime63.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 }) }) }),
12353
- hasBars && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Field, { label: "Bars", children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("div", { className: "flex gap-0.5 rounded-md bg-muted p-0.5", children: ["vertical", "horizontal"].map((o) => /* @__PURE__ */ (0, import_jsx_runtime63.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)) }) }),
12354
- hasLines && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Field, { label: "Lines", htmlFor: `${idBase}-curve`, children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Select, { id: `${idBase}-curve`, name: "curve", value: spec.curve, options: import_chart4.CHART_CURVES, onChange: (curve) => controller.update({ curve }) }) }),
12355
- spec.type === "donut" && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Field, { label: "Hole", htmlFor: `${idBase}-hole`, children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
12508
+ show("options") && /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className: chartSectionClass, "data-section": "options", children: [
12509
+ cartesian && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Field, { label: "Stacking", htmlFor: `${idBase}-stacking`, children: /* @__PURE__ */ (0, import_jsx_runtime64.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 }) }) }),
12510
+ hasBars && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Field, { label: "Bars", children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("div", { className: "flex gap-0.5 rounded-md bg-muted p-0.5", children: ["vertical", "horizontal"].map((o) => /* @__PURE__ */ (0, import_jsx_runtime64.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)) }) }),
12511
+ hasLines && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Field, { label: "Lines", htmlFor: `${idBase}-curve`, children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Select, { id: `${idBase}-curve`, name: "curve", value: spec.curve, options: import_chart4.CHART_CURVES, onChange: (curve) => controller.update({ curve }) }) }),
12512
+ spec.type === "donut" && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Field, { label: "Hole", htmlFor: `${idBase}-hole`, children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
12356
12513
  "input",
12357
12514
  {
12358
12515
  id: `${idBase}-hole`,
@@ -12368,7 +12525,7 @@ function ChartInspector({ controller, sections, className }) {
12368
12525
  onChange: (e) => controller.update({ innerRadius: Number(e.currentTarget.value) })
12369
12526
  }
12370
12527
  ) }),
12371
- hasBars && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Field, { label: "Spacing", htmlFor: `${idBase}-gap`, children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
12528
+ hasBars && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Field, { label: "Spacing", htmlFor: `${idBase}-gap`, children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
12372
12529
  "input",
12373
12530
  {
12374
12531
  id: `${idBase}-gap`,
@@ -12384,9 +12541,9 @@ function ChartInspector({ controller, sections, className }) {
12384
12541
  onChange: (e) => controller.update({ gapWidth: Number(e.currentTarget.value) })
12385
12542
  }
12386
12543
  ) }),
12387
- spec.type === "choropleth" && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Field, { label: "Map", htmlFor: `${idBase}-map`, children: /* @__PURE__ */ (0, import_jsx_runtime63.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_runtime63.jsx)("option", { value: id, children: (0, import_chart4.listChartMaps)().find((m) => m.id === id)?.name ?? `${id} (not loaded)` }, id)) }) }),
12388
- spec.type === "choropleth" && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Field, { label: "Classes", htmlFor: `${idBase}-map-steps`, children: /* @__PURE__ */ (0, import_jsx_runtime63.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 }) }),
12389
- spec.type === "choropleth" && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Field, { label: "Breaks", htmlFor: `${idBase}-map-breaks`, children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
12544
+ spec.type === "choropleth" && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Field, { label: "Map", htmlFor: `${idBase}-map`, children: /* @__PURE__ */ (0, import_jsx_runtime64.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_runtime64.jsx)("option", { value: id, children: (0, import_chart4.listChartMaps)().find((m) => m.id === id)?.name ?? `${id} (not loaded)` }, id)) }) }),
12545
+ spec.type === "choropleth" && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Field, { label: "Classes", htmlFor: `${idBase}-map-steps`, children: /* @__PURE__ */ (0, import_jsx_runtime64.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 }) }),
12546
+ spec.type === "choropleth" && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Field, { label: "Breaks", htmlFor: `${idBase}-map-breaks`, children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
12390
12547
  ChartCommitInput,
12391
12548
  {
12392
12549
  id: `${idBase}-map-breaks`,
@@ -12397,10 +12554,10 @@ function ChartInspector({ controller, sections, className }) {
12397
12554
  onCommit: (text) => controller.update({ mapThresholds: text.trim() ? text.split(",").map((t) => Number(t.trim())) : [] }).ok
12398
12555
  }
12399
12556
  ) }),
12400
- spec.type === "barrace" && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Field, { label: "Bars", htmlFor: `${idBase}-race-top`, children: /* @__PURE__ */ (0, import_jsx_runtime63.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 }) }),
12401
- spec.type === "barrace" && spec.categories.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Field, { label: "Time", htmlFor: `${idBase}-race-frame`, children: /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { className: "flex items-center gap-1", children: [
12402
- /* @__PURE__ */ (0, import_jsx_runtime63.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" }),
12403
- /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
12557
+ spec.type === "barrace" && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Field, { label: "Bars", htmlFor: `${idBase}-race-top`, children: /* @__PURE__ */ (0, import_jsx_runtime64.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 }) }),
12558
+ spec.type === "barrace" && spec.categories.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Field, { label: "Time", htmlFor: `${idBase}-race-frame`, children: /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className: "flex items-center gap-1", children: [
12559
+ /* @__PURE__ */ (0, import_jsx_runtime64.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" }),
12560
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
12404
12561
  "input",
12405
12562
  {
12406
12563
  id: `${idBase}-race-frame`,
@@ -12415,13 +12572,13 @@ function ChartInspector({ controller, sections, className }) {
12415
12572
  onChange: (e) => controller.setRaceFrame(Number(e.currentTarget.value))
12416
12573
  }
12417
12574
  ),
12418
- /* @__PURE__ */ (0, import_jsx_runtime63.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)] })
12575
+ /* @__PURE__ */ (0, import_jsx_runtime64.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)] })
12419
12576
  ] }) }),
12420
- spec.type === "sankey" && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Field, { label: "Flows", htmlFor: `${idBase}-sankey-color`, children: /* @__PURE__ */ (0, import_jsx_runtime63.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 }) }) }),
12421
- spec.type === "sunburst" && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Field, { label: "Caption", htmlFor: `${idBase}-sunburst-label`, children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(ChartCommitInput, { id: `${idBase}-sunburst-label`, value: spec.sunburstLabel, placeholder: "Under the total", "data-option": "sunburstLabel", className: chartInputClass, onCommit: (sunburstLabel) => controller.update({ sunburstLabel }).ok }) }),
12422
- spec.type === "likert" && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Field, { label: "Neutral", htmlFor: `${idBase}-likert-neutral`, children: /* @__PURE__ */ (0, import_jsx_runtime63.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 }) }) }),
12423
- spec.type === "likert" && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Field, { label: "Order", htmlFor: `${idBase}-likert-sort`, children: /* @__PURE__ */ (0, import_jsx_runtime63.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 }) }) }),
12424
- spec.type === "parliament" && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Field, { label: "Sweep", htmlFor: `${idBase}-parliament-arc`, children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
12577
+ spec.type === "sankey" && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Field, { label: "Flows", htmlFor: `${idBase}-sankey-color`, children: /* @__PURE__ */ (0, import_jsx_runtime64.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 }) }) }),
12578
+ spec.type === "sunburst" && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Field, { label: "Caption", htmlFor: `${idBase}-sunburst-label`, children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(ChartCommitInput, { id: `${idBase}-sunburst-label`, value: spec.sunburstLabel, placeholder: "Under the total", "data-option": "sunburstLabel", className: chartInputClass, onCommit: (sunburstLabel) => controller.update({ sunburstLabel }).ok }) }),
12579
+ spec.type === "likert" && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Field, { label: "Neutral", htmlFor: `${idBase}-likert-neutral`, children: /* @__PURE__ */ (0, import_jsx_runtime64.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 }) }) }),
12580
+ spec.type === "likert" && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Field, { label: "Order", htmlFor: `${idBase}-likert-sort`, children: /* @__PURE__ */ (0, import_jsx_runtime64.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 }) }) }),
12581
+ spec.type === "parliament" && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Field, { label: "Sweep", htmlFor: `${idBase}-parliament-arc`, children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
12425
12582
  "input",
12426
12583
  {
12427
12584
  id: `${idBase}-parliament-arc`,
@@ -12437,34 +12594,34 @@ function ChartInspector({ controller, sections, className }) {
12437
12594
  onChange: (e) => controller.update({ parliamentArc: Number(e.currentTarget.value) })
12438
12595
  }
12439
12596
  ) }),
12440
- spec.type === "parliament" && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Field, { label: "Majority", htmlFor: `${idBase}-parliament-majority`, children: /* @__PURE__ */ (0, import_jsx_runtime63.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 }) }),
12441
- spec.type === "parliament" && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Field, { label: "Caption", htmlFor: `${idBase}-parliament-label`, children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(ChartCommitInput, { id: `${idBase}-parliament-label`, value: spec.parliamentLabel, placeholder: "seats", "data-option": "parliamentLabel", className: chartInputClass, onCommit: (parliamentLabel) => controller.update({ parliamentLabel }).ok }) }),
12442
- spec.type === "radar" && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Field, { label: "Rings", htmlFor: `${idBase}-radar-ticks`, children: /* @__PURE__ */ (0, import_jsx_runtime63.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 }) }),
12443
- spec.type === "radar" && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Field, { label: "Grid", htmlFor: `${idBase}-radar-graticule`, children: /* @__PURE__ */ (0, import_jsx_runtime63.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 }) }) }),
12444
- spec.dataLabels && hasBars && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Field, { label: "Labels", htmlFor: `${idBase}-label-position`, children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Select, { id: `${idBase}-label-position`, name: "labelPosition", value: spec.labelPosition, options: import_chart4.CHART_LABEL_POSITIONS, onChange: (labelPosition) => controller.update({ labelPosition }) }) }),
12445
- spec.type === "histogram" && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Field, { label: "Bins", htmlFor: `${idBase}-bins`, children: /* @__PURE__ */ (0, import_jsx_runtime63.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 }) }),
12446
- /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { className: "flex flex-wrap gap-x-4 gap-y-1", children: [
12447
- spec.type === "waterfall" && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Toggle, { label: "Total bar", name: "showTotal", checked: spec.showTotal, onChange: (showTotal) => controller.update({ showTotal }) }),
12448
- hasLines && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Toggle, { label: "Points", name: "points", checked: spec.points, onChange: (points) => controller.update({ points }) }),
12449
- oneSeries && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Toggle, { label: "Colour by category", name: "varyColors", checked: spec.varyColors, onChange: (varyColors) => controller.update({ varyColors }) }),
12450
- /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Toggle, { label: "Data labels", name: "dataLabels", checked: spec.dataLabels, onChange: (dataLabels) => controller.update({ dataLabels }) })
12597
+ spec.type === "parliament" && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Field, { label: "Majority", htmlFor: `${idBase}-parliament-majority`, children: /* @__PURE__ */ (0, import_jsx_runtime64.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 }) }),
12598
+ spec.type === "parliament" && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Field, { label: "Caption", htmlFor: `${idBase}-parliament-label`, children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(ChartCommitInput, { id: `${idBase}-parliament-label`, value: spec.parliamentLabel, placeholder: "seats", "data-option": "parliamentLabel", className: chartInputClass, onCommit: (parliamentLabel) => controller.update({ parliamentLabel }).ok }) }),
12599
+ spec.type === "radar" && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Field, { label: "Rings", htmlFor: `${idBase}-radar-ticks`, children: /* @__PURE__ */ (0, import_jsx_runtime64.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 }) }),
12600
+ spec.type === "radar" && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Field, { label: "Grid", htmlFor: `${idBase}-radar-graticule`, children: /* @__PURE__ */ (0, import_jsx_runtime64.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 }) }) }),
12601
+ spec.dataLabels && hasBars && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Field, { label: "Labels", htmlFor: `${idBase}-label-position`, children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Select, { id: `${idBase}-label-position`, name: "labelPosition", value: spec.labelPosition, options: import_chart4.CHART_LABEL_POSITIONS, onChange: (labelPosition) => controller.update({ labelPosition }) }) }),
12602
+ spec.type === "histogram" && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Field, { label: "Bins", htmlFor: `${idBase}-bins`, children: /* @__PURE__ */ (0, import_jsx_runtime64.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 }) }),
12603
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className: "flex flex-wrap gap-x-4 gap-y-1", children: [
12604
+ spec.type === "waterfall" && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Toggle, { label: "Total bar", name: "showTotal", checked: spec.showTotal, onChange: (showTotal) => controller.update({ showTotal }) }),
12605
+ hasLines && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Toggle, { label: "Points", name: "points", checked: spec.points, onChange: (points) => controller.update({ points }) }),
12606
+ oneSeries && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Toggle, { label: "Colour by category", name: "varyColors", checked: spec.varyColors, onChange: (varyColors) => controller.update({ varyColors }) }),
12607
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Toggle, { label: "Data labels", name: "dataLabels", checked: spec.dataLabels, onChange: (dataLabels) => controller.update({ dataLabels }) })
12451
12608
  ] })
12452
12609
  ] }),
12453
- show("legend") && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { className: chartSectionClass, "data-section": "legend", children: [
12454
- /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { className: "flex items-center justify-between", children: [
12455
- /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("h4", { className: "text-xs font-semibold text-foreground", children: "Legend" }),
12456
- /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Toggle, { label: "Show", name: "legend.show", checked: spec.legend.show, onChange: (v) => controller.setLegend({ show: v }) })
12610
+ show("legend") && /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className: chartSectionClass, "data-section": "legend", children: [
12611
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className: "flex items-center justify-between", children: [
12612
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("h4", { className: "text-xs font-semibold text-foreground", children: "Legend" }),
12613
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Toggle, { label: "Show", name: "legend.show", checked: spec.legend.show, onChange: (v) => controller.setLegend({ show: v }) })
12457
12614
  ] }),
12458
- spec.legend.show && /* @__PURE__ */ (0, import_jsx_runtime63.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_runtime63.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)) })
12615
+ spec.legend.show && /* @__PURE__ */ (0, import_jsx_runtime64.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_runtime64.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)) })
12459
12616
  ] }),
12460
- show("axes") && hasAxes && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(import_jsx_runtime63.Fragment, { children: [
12461
- family !== "box" && family !== "histogram" && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(AxisSection, { controller, axis: "x", value: spec.xAxis, idBase, horizontal: spec.orientation === "horizontal", numeric: family === "xy", scales }),
12462
- /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(AxisSection, { controller, axis: "y", value: spec.yAxis, idBase, horizontal: spec.orientation === "horizontal", scales }),
12463
- usesSecondary && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(AxisSection, { controller, axis: "y2", value: spec.yAxis2, idBase, horizontal: spec.orientation === "horizontal", scales })
12617
+ show("axes") && hasAxes && /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(import_jsx_runtime64.Fragment, { children: [
12618
+ family !== "box" && family !== "histogram" && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(AxisSection, { controller, axis: "x", value: spec.xAxis, idBase, horizontal: spec.orientation === "horizontal", numeric: family === "xy", scales }),
12619
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(AxisSection, { controller, axis: "y", value: spec.yAxis, idBase, horizontal: spec.orientation === "horizontal", scales }),
12620
+ usesSecondary && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(AxisSection, { controller, axis: "y2", value: spec.yAxis2, idBase, horizontal: spec.orientation === "horizontal", scales })
12464
12621
  ] }),
12465
- show("annotations") && annotated && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { className: chartSectionClass, "data-section": "annotations", children: [
12466
- /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("h4", { className: "text-xs font-semibold text-foreground", children: "Annotations" }),
12467
- /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Field, { label: "Highlight", htmlFor: `${idBase}-highlight`, children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
12622
+ show("annotations") && annotated && /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className: chartSectionClass, "data-section": "annotations", children: [
12623
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("h4", { className: "text-xs font-semibold text-foreground", children: "Annotations" }),
12624
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Field, { label: "Highlight", htmlFor: `${idBase}-highlight`, children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
12468
12625
  ChartCommitInput,
12469
12626
  {
12470
12627
  id: `${idBase}-highlight`,
@@ -12475,27 +12632,27 @@ function ChartInspector({ controller, sections, className }) {
12475
12632
  onCommit: (text) => controller.setHighlight(text.split(",").map((n) => n.trim()).filter(Boolean)).ok
12476
12633
  }
12477
12634
  ) }),
12478
- spec.referenceLines.map((line, i) => /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { className: "flex items-center gap-1", "data-reference-line": i, children: [
12479
- /* @__PURE__ */ (0, import_jsx_runtime63.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 }),
12480
- /* @__PURE__ */ (0, import_jsx_runtime63.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 }),
12481
- /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("button", { type: "button", className: chartButtonClass, "aria-label": "Delete reference line", "data-action": "reference-line-delete", onClick: () => controller.removeReferenceLine(i), children: "\xD7" })
12635
+ spec.referenceLines.map((line, i) => /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className: "flex items-center gap-1", "data-reference-line": i, children: [
12636
+ /* @__PURE__ */ (0, import_jsx_runtime64.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 }),
12637
+ /* @__PURE__ */ (0, import_jsx_runtime64.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 }),
12638
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("button", { type: "button", className: chartButtonClass, "aria-label": "Delete reference line", "data-action": "reference-line-delete", onClick: () => controller.removeReferenceLine(i), children: "\xD7" })
12482
12639
  ] }, `line-${i}`)),
12483
- spec.referenceBands.map((band, i) => /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { className: "flex items-center gap-1", "data-reference-band": i, children: [
12484
- /* @__PURE__ */ (0, import_jsx_runtime63.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 }),
12485
- /* @__PURE__ */ (0, import_jsx_runtime63.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 }),
12486
- /* @__PURE__ */ (0, import_jsx_runtime63.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 }),
12487
- /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("button", { type: "button", className: chartButtonClass, "aria-label": "Delete reference band", "data-action": "reference-band-delete", onClick: () => controller.removeReferenceBand(i), children: "\xD7" })
12640
+ spec.referenceBands.map((band, i) => /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className: "flex items-center gap-1", "data-reference-band": i, children: [
12641
+ /* @__PURE__ */ (0, import_jsx_runtime64.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 }),
12642
+ /* @__PURE__ */ (0, import_jsx_runtime64.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 }),
12643
+ /* @__PURE__ */ (0, import_jsx_runtime64.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 }),
12644
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("button", { type: "button", className: chartButtonClass, "aria-label": "Delete reference band", "data-action": "reference-band-delete", onClick: () => controller.removeReferenceBand(i), children: "\xD7" })
12488
12645
  ] }, `band-${i}`)),
12489
- /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { className: "flex gap-1", children: [
12490
- /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("button", { type: "button", className: chartButtonClass, "data-option": "referenceLine.add", onClick: () => controller.addReferenceLine((0, import_chart4.suggestChartReferences)(spec).line), children: "Add line" }),
12491
- /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("button", { type: "button", className: chartButtonClass, "data-option": "referenceBand.add", onClick: () => controller.addReferenceBand((0, import_chart4.suggestChartReferences)(spec).band), children: "Add band" })
12646
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className: "flex gap-1", children: [
12647
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("button", { type: "button", className: chartButtonClass, "data-option": "referenceLine.add", onClick: () => controller.addReferenceLine((0, import_chart4.suggestChartReferences)(spec).line), children: "Add line" }),
12648
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("button", { type: "button", className: chartButtonClass, "data-option": "referenceBand.add", onClick: () => controller.addReferenceBand((0, import_chart4.suggestChartReferences)(spec).band), children: "Add band" })
12492
12649
  ] })
12493
12650
  ] }),
12494
- show("series") && selectedSeries && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { className: chartSectionClass, "data-section": "series", "data-series-id": selectedSeries.id, children: [
12495
- /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("h4", { className: "text-xs font-semibold text-foreground", children: "Series" }),
12496
- /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Field, { label: "Name", htmlFor: `${idBase}-series-name`, children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(ChartCommitInput, { id: `${idBase}-series-name`, value: selectedSeries.name, "data-option": "series.name", className: chartInputClass, onCommit: (name) => void controller.updateSeries(selectedSeries.id, { name }) }) }),
12497
- /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Field, { label: "Colour", htmlFor: `${idBase}-series-color`, children: /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { className: "flex items-center gap-1", children: [
12498
- /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
12651
+ show("series") && selectedSeries && /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className: chartSectionClass, "data-section": "series", "data-series-id": selectedSeries.id, children: [
12652
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("h4", { className: "text-xs font-semibold text-foreground", children: "Series" }),
12653
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Field, { label: "Name", htmlFor: `${idBase}-series-name`, children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(ChartCommitInput, { id: `${idBase}-series-name`, value: selectedSeries.name, "data-option": "series.name", className: chartInputClass, onCommit: (name) => void controller.updateSeries(selectedSeries.id, { name }) }) }),
12654
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Field, { label: "Colour", htmlFor: `${idBase}-series-color`, children: /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className: "flex items-center gap-1", children: [
12655
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
12499
12656
  "input",
12500
12657
  {
12501
12658
  id: `${idBase}-series-color`,
@@ -12508,9 +12665,9 @@ function ChartInspector({ controller, sections, className }) {
12508
12665
  onChange: (e) => controller.updateSeries(selectedSeries.id, { color: e.currentTarget.value })
12509
12666
  }
12510
12667
  ),
12511
- selectedSeries.color && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("button", { type: "button", className: chartButtonClass, "data-action": "reset-color", onClick: () => controller.updateSeries(selectedSeries.id, { color: null }), children: "Palette" })
12668
+ selectedSeries.color && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("button", { type: "button", className: chartButtonClass, "data-action": "reset-color", onClick: () => controller.updateSeries(selectedSeries.id, { color: null }), children: "Palette" })
12512
12669
  ] }) }),
12513
- cartesian && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Field, { label: "Draw as", htmlFor: `${idBase}-series-type`, children: /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
12670
+ cartesian && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Field, { label: "Draw as", htmlFor: `${idBase}-series-type`, children: /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(
12514
12671
  "select",
12515
12672
  {
12516
12673
  id: `${idBase}-series-type`,
@@ -12519,12 +12676,12 @@ function ChartInspector({ controller, sections, className }) {
12519
12676
  "data-option": "series.type",
12520
12677
  onChange: (e) => controller.updateSeries(selectedSeries.id, { type: e.currentTarget.value || null }),
12521
12678
  children: [
12522
- /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("option", { value: "", children: "Chart type" }),
12523
- import_chart4.CHART_SERIES_TYPES.map((t) => /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("option", { value: t, children: import_chart4.CHART_TYPE_LABELS[t] }, t))
12679
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("option", { value: "", children: "Chart type" }),
12680
+ import_chart4.CHART_SERIES_TYPES.map((t) => /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("option", { value: t, children: import_chart4.CHART_TYPE_LABELS[t] }, t))
12524
12681
  ]
12525
12682
  }
12526
12683
  ) }),
12527
- (cartesian || family === "xy") && ["line", "area", "scatter"].includes((0, import_chart4.chartSeriesType)(spec, selectedSeries)) && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Field, { label: "Marker", htmlFor: `${idBase}-series-marker`, children: /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
12684
+ (cartesian || family === "xy") && ["line", "area", "scatter"].includes((0, import_chart4.chartSeriesType)(spec, selectedSeries)) && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Field, { label: "Marker", htmlFor: `${idBase}-series-marker`, children: /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(
12528
12685
  "select",
12529
12686
  {
12530
12687
  id: `${idBase}-series-marker`,
@@ -12533,12 +12690,12 @@ function ChartInspector({ controller, sections, className }) {
12533
12690
  "data-option": "series.marker",
12534
12691
  onChange: (e) => controller.updateSeries(selectedSeries.id, { marker: e.currentTarget.value || null }),
12535
12692
  children: [
12536
- /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("option", { value: "", children: "Default" }),
12537
- import_chart4.CHART_MARKERS.map((m) => /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("option", { value: m, children: cap(m) }, m))
12693
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("option", { value: "", children: "Default" }),
12694
+ import_chart4.CHART_MARKERS.map((m) => /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("option", { value: m, children: cap(m) }, m))
12538
12695
  ]
12539
12696
  }
12540
12697
  ) }),
12541
- annotated && calloutIndex !== null && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Field, { label: "Callout", htmlFor: `${idBase}-series-callout`, children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
12698
+ annotated && calloutIndex !== null && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Field, { label: "Callout", htmlFor: `${idBase}-series-callout`, children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
12542
12699
  ChartCommitInput,
12543
12700
  {
12544
12701
  id: `${idBase}-series-callout`,
@@ -12549,15 +12706,15 @@ function ChartInspector({ controller, sections, className }) {
12549
12706
  onCommit: (text) => controller.setCallout(selectedSeries.id, calloutIndex, text || null).ok
12550
12707
  }
12551
12708
  ) }),
12552
- scales && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(ErrorBarFields, { controller, series: selectedSeries, which: "errorBars", idBase }),
12553
- family === "xy" && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(ErrorBarFields, { controller, series: selectedSeries, which: "xErrorBars", idBase }),
12554
- (0, import_chart4.chartSupportsTrendlines)(spec.type, spec.stacking) && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { className: "space-y-1", "data-section": "trendlines", children: [
12555
- (selectedSeries.trendlines ?? []).map((t, i) => /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { className: "flex items-center gap-1", "data-trendline": i, children: [
12556
- /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("span", { className: "flex-1 truncate text-muted-foreground", children: (0, import_chart4.chartTrendlineName)(t, selectedSeries.name) }),
12557
- /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Toggle, { label: "R\xB2", name: `trendline.${i}.showR2`, checked: !!t.showR2, onChange: (showR2) => controller.updateTrendline(selectedSeries.id, i, { showR2 }) }),
12558
- /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("button", { type: "button", className: chartButtonClass, "aria-label": "Delete trendline", "data-action": "trendline-delete", onClick: () => controller.removeTrendline(selectedSeries.id, i), children: "\xD7" })
12709
+ scales && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(ErrorBarFields, { controller, series: selectedSeries, which: "errorBars", idBase }),
12710
+ family === "xy" && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(ErrorBarFields, { controller, series: selectedSeries, which: "xErrorBars", idBase }),
12711
+ (0, import_chart4.chartSupportsTrendlines)(spec.type, spec.stacking) && /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className: "space-y-1", "data-section": "trendlines", children: [
12712
+ (selectedSeries.trendlines ?? []).map((t, i) => /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className: "flex items-center gap-1", "data-trendline": i, children: [
12713
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("span", { className: "flex-1 truncate text-muted-foreground", children: (0, import_chart4.chartTrendlineName)(t, selectedSeries.name) }),
12714
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Toggle, { label: "R\xB2", name: `trendline.${i}.showR2`, checked: !!t.showR2, onChange: (showR2) => controller.updateTrendline(selectedSeries.id, i, { showR2 }) }),
12715
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("button", { type: "button", className: chartButtonClass, "aria-label": "Delete trendline", "data-action": "trendline-delete", onClick: () => controller.removeTrendline(selectedSeries.id, i), children: "\xD7" })
12559
12716
  ] }, i)),
12560
- /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
12717
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(
12561
12718
  "select",
12562
12719
  {
12563
12720
  className: chartInputClass,
@@ -12566,32 +12723,32 @@ function ChartInspector({ controller, sections, className }) {
12566
12723
  "data-option": "trendline.add",
12567
12724
  onChange: (e) => e.currentTarget.value && controller.addTrendline(selectedSeries.id, { type: e.currentTarget.value }),
12568
12725
  children: [
12569
- /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("option", { value: "", children: "Add trendline\u2026" }),
12570
- import_chart4.CHART_TRENDLINE_TYPES.map((t) => /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("option", { value: t, children: cap(t.replace("-", " ")) }, t))
12726
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("option", { value: "", children: "Add trendline\u2026" }),
12727
+ import_chart4.CHART_TRENDLINE_TYPES.map((t) => /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("option", { value: t, children: cap(t.replace("-", " ")) }, t))
12571
12728
  ]
12572
12729
  }
12573
12730
  )
12574
12731
  ] }),
12575
- /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
12576
- /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Toggle, { label: "Hidden", name: "series.hidden", checked: !!selectedSeries.hidden, onChange: (hidden) => controller.updateSeries(selectedSeries.id, { hidden }) }),
12577
- family === "cartesian" && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Toggle, { label: "Secondary axis", name: "series.axis", checked: selectedSeries.axis === "secondary", onChange: (secondary) => controller.updateSeries(selectedSeries.id, { axis: secondary ? "secondary" : null }) }),
12578
- /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("span", { className: "flex-1" }),
12579
- /* @__PURE__ */ (0, import_jsx_runtime63.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" }),
12580
- /* @__PURE__ */ (0, import_jsx_runtime63.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" }),
12581
- /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("button", { type: "button", className: `${chartButtonClass} text-destructive`, "data-action": "series-delete", onClick: () => controller.removeSeries(selectedSeries.id), children: "Delete" })
12732
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
12733
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Toggle, { label: "Hidden", name: "series.hidden", checked: !!selectedSeries.hidden, onChange: (hidden) => controller.updateSeries(selectedSeries.id, { hidden }) }),
12734
+ family === "cartesian" && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Toggle, { label: "Secondary axis", name: "series.axis", checked: selectedSeries.axis === "secondary", onChange: (secondary) => controller.updateSeries(selectedSeries.id, { axis: secondary ? "secondary" : null }) }),
12735
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("span", { className: "flex-1" }),
12736
+ /* @__PURE__ */ (0, import_jsx_runtime64.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" }),
12737
+ /* @__PURE__ */ (0, import_jsx_runtime64.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" }),
12738
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("button", { type: "button", className: `${chartButtonClass} text-destructive`, "data-action": "series-delete", onClick: () => controller.removeSeries(selectedSeries.id), children: "Delete" })
12582
12739
  ] })
12583
12740
  ] })
12584
12741
  ] });
12585
12742
  }
12586
12743
 
12587
12744
  // src/chart-node/ChartNodeView.tsx
12588
- var import_jsx_runtime64 = require("react/jsx-runtime");
12745
+ var import_jsx_runtime65 = require("react/jsx-runtime");
12589
12746
  function ChartNodeView({ state, theme, showDataGrid = true }) {
12590
12747
  const { controller, editing, editable, selected, width, height, setEditing } = state;
12591
12748
  const open = () => {
12592
12749
  if (editable && !editing) setEditing(true);
12593
12750
  };
12594
- return /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(
12751
+ return /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(
12595
12752
  "div",
12596
12753
  {
12597
12754
  className: `not-prose my-2 rounded-md border bg-background p-1 ${selected ? "border-primary ring-1 ring-primary" : "border-border"}`,
@@ -12604,24 +12761,24 @@ function ChartNodeView({ state, theme, showDataGrid = true }) {
12604
12761
  }
12605
12762
  },
12606
12763
  children: [
12607
- editing && /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className: "mb-1 flex items-center justify-between gap-2 px-1", "data-chart-node-toolbar": "", children: [
12608
- /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("span", { className: "text-xs text-muted-foreground", children: "Editing chart" }),
12609
- /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("button", { type: "button", className: chartButtonClass, "data-action": "done", onClick: () => setEditing(false), children: "Done" })
12764
+ editing && /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { className: "mb-1 flex items-center justify-between gap-2 px-1", "data-chart-node-toolbar": "", children: [
12765
+ /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("span", { className: "text-xs text-muted-foreground", children: "Editing chart" }),
12766
+ /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("button", { type: "button", className: chartButtonClass, "data-action": "done", onClick: () => setEditing(false), children: "Done" })
12610
12767
  ] }),
12611
- /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
12768
+ /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
12612
12769
  "div",
12613
12770
  {
12614
12771
  className: editable && !editing ? "cursor-pointer" : void 0,
12615
12772
  onClick: open,
12616
12773
  title: editable && !editing ? "Click to edit the chart" : void 0,
12617
12774
  "data-chart-node-canvas": "",
12618
- children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(ChartCanvas, { controller, width: width ?? 640, height, responsive: width === null, editable: editing, theme })
12775
+ children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(ChartCanvas, { controller, width: width ?? 640, height, responsive: width === null, editable: editing, theme })
12619
12776
  }
12620
12777
  ),
12621
12778
  editing && // Wraps by the document's width, not the viewport's: side by side when there is room.
12622
- /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className: "mt-2 flex flex-wrap items-start gap-2", "data-chart-node-panel": "", children: [
12623
- showDataGrid && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("div", { className: "min-w-0 flex-[1_1_20rem] overflow-x-auto", children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(ChartDataGrid, { controller }) }),
12624
- /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(ChartInspector, { controller, className: "max-h-96 min-w-0 flex-[1_1_16rem] overflow-y-auto rounded-md border border-border p-3" })
12779
+ /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { className: "mt-2 flex flex-wrap items-start gap-2", "data-chart-node-panel": "", children: [
12780
+ showDataGrid && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("div", { className: "min-w-0 flex-[1_1_20rem] overflow-x-auto", children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(ChartDataGrid, { controller }) }),
12781
+ /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(ChartInspector, { controller, className: "max-h-96 min-w-0 flex-[1_1_16rem] overflow-y-auto rounded-md border border-border p-3" })
12625
12782
  ] })
12626
12783
  ]
12627
12784
  }
@@ -12639,7 +12796,7 @@ function createReactChartNodeView(options = {}) {
12639
12796
  scheduled = true;
12640
12797
  queueMicrotask(() => {
12641
12798
  scheduled = false;
12642
- if (!destroyed) root.render(/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Component, { ...props, state: latest }));
12799
+ if (!destroyed) root.render(/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(Component, { ...props, state: latest }));
12643
12800
  });
12644
12801
  };
12645
12802
  schedule();
@@ -12657,10 +12814,10 @@ function createReactChartNodeView(options = {}) {
12657
12814
  }
12658
12815
 
12659
12816
  // src/style/useStyle.ts
12660
- var import_react88 = require("react");
12817
+ var import_react89 = require("react");
12661
12818
  var message = (error) => error instanceof Error ? error.message : String(error);
12662
12819
  function useResolverTask(styles, run, deliver, deps) {
12663
- (0, import_react88.useEffect)(() => {
12820
+ (0, import_react89.useEffect)(() => {
12664
12821
  if (!styles || !run) {
12665
12822
  deliver({ value: null, error: null });
12666
12823
  return;
@@ -12687,7 +12844,7 @@ function useResolverTask(styles, run, deliver, deps) {
12687
12844
  }, [styles, ...deps]);
12688
12845
  }
12689
12846
  function useStyle(styles, domain) {
12690
- const [result, setResult] = (0, import_react88.useState)({ style: null, error: null });
12847
+ const [result, setResult] = (0, import_react89.useState)({ style: null, error: null });
12691
12848
  useResolverTask(
12692
12849
  styles,
12693
12850
  (s) => s.resolve(domain),
@@ -12697,7 +12854,7 @@ function useStyle(styles, domain) {
12697
12854
  return result;
12698
12855
  }
12699
12856
  function useStyleFindings(styles, domain, state) {
12700
- const [result, setResult] = (0, import_react88.useState)({ report: null, style: null, error: null });
12857
+ const [result, setResult] = (0, import_react89.useState)({ report: null, style: null, error: null });
12701
12858
  useResolverTask(
12702
12859
  styles,
12703
12860
  (s) => s.check(domain, state),
@@ -12714,7 +12871,7 @@ function useStyleFindings(styles, domain, state) {
12714
12871
  }
12715
12872
 
12716
12873
  // src/style/StyleFindings.tsx
12717
- var import_jsx_runtime65 = require("react/jsx-runtime");
12874
+ var import_jsx_runtime66 = require("react/jsx-runtime");
12718
12875
  var SEVERITY_CLASS = {
12719
12876
  error: "text-destructive",
12720
12877
  warning: "text-amber-600",
@@ -12723,24 +12880,24 @@ var SEVERITY_CLASS = {
12723
12880
  function StyleFindings({ report, onSelect, title = "House style", className = "" }) {
12724
12881
  if (!report) return null;
12725
12882
  const { findings, ran, skipped } = report;
12726
- return /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("section", { "data-style-findings": "", "aria-label": title, className: `flex flex-col gap-1.5 text-xs text-foreground ${className}`, children: [
12727
- /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("h3", { className: "text-[11px] font-semibold uppercase tracking-wide text-muted-foreground", children: title }),
12728
- findings.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("ul", { className: "flex flex-col gap-1", children: findings.map((finding, i) => {
12883
+ return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("section", { "data-style-findings": "", "aria-label": title, className: `flex flex-col gap-1.5 text-xs text-foreground ${className}`, children: [
12884
+ /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("h3", { className: "text-[11px] font-semibold uppercase tracking-wide text-muted-foreground", children: title }),
12885
+ findings.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("ul", { className: "flex flex-col gap-1", children: findings.map((finding, i) => {
12729
12886
  const selectable = finding.target !== void 0 && !!onSelect;
12730
- const body = /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(import_jsx_runtime65.Fragment, { children: [
12731
- /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("span", { "data-style-severity": finding.severity, className: `shrink-0 font-semibold uppercase text-[10px] ${SEVERITY_CLASS[finding.severity]}`, children: finding.severity }),
12732
- /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("span", { className: "flex min-w-0 flex-col", children: [
12733
- /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("span", { "data-style-message": "", children: finding.message }),
12734
- /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("span", { className: "text-[10px] text-muted-foreground", children: [
12735
- /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("code", { children: finding.check }),
12736
- finding.layer && /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(import_jsx_runtime65.Fragment, { children: [
12887
+ const body = /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(import_jsx_runtime66.Fragment, { children: [
12888
+ /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("span", { "data-style-severity": finding.severity, className: `shrink-0 font-semibold uppercase text-[10px] ${SEVERITY_CLASS[finding.severity]}`, children: finding.severity }),
12889
+ /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("span", { className: "flex min-w-0 flex-col", children: [
12890
+ /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("span", { "data-style-message": "", children: finding.message }),
12891
+ /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("span", { className: "text-[10px] text-muted-foreground", children: [
12892
+ /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("code", { children: finding.check }),
12893
+ finding.layer && /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(import_jsx_runtime66.Fragment, { children: [
12737
12894
  " \xB7 ",
12738
12895
  finding.layer
12739
12896
  ] })
12740
12897
  ] })
12741
12898
  ] })
12742
12899
  ] });
12743
- return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("li", { "data-style-finding": finding.check, children: selectable ? /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
12900
+ return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("li", { "data-style-finding": finding.check, children: selectable ? /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
12744
12901
  "button",
12745
12902
  {
12746
12903
  type: "button",
@@ -12748,19 +12905,19 @@ function StyleFindings({ report, onSelect, title = "House style", className = ""
12748
12905
  onClick: () => onSelect(finding),
12749
12906
  children: body
12750
12907
  }
12751
- ) : /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("div", { className: "flex items-start gap-2 rounded border border-border px-2 py-1", children: body }) }, `${finding.check}-${i}`);
12908
+ ) : /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { className: "flex items-start gap-2 rounded border border-border px-2 py-1", children: body }) }, `${finding.check}-${i}`);
12752
12909
  }) }),
12753
- findings.length === 0 && ran.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("p", { "data-style-clear": "", className: "text-emerald-600", children: [
12910
+ findings.length === 0 && ran.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("p", { "data-style-clear": "", className: "text-emerald-600", children: [
12754
12911
  "All clear: ",
12755
12912
  ran.length,
12756
12913
  " ",
12757
12914
  ran.length === 1 ? "check" : "checks",
12758
12915
  " passed."
12759
12916
  ] }),
12760
- findings.length === 0 && ran.length === 0 && skipped.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("p", { className: "text-muted-foreground", children: "No house-style checks apply." }),
12761
- skipped.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime65.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_runtime65.jsxs)("li", { "data-style-skipped-check": s.check, children: [
12917
+ findings.length === 0 && ran.length === 0 && skipped.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("p", { className: "text-muted-foreground", children: "No house-style checks apply." }),
12918
+ skipped.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime66.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_runtime66.jsxs)("li", { "data-style-skipped-check": s.check, children: [
12762
12919
  "Skipped ",
12763
- /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("code", { children: s.check }),
12920
+ /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("code", { children: s.check }),
12764
12921
  ": ",
12765
12922
  s.reason
12766
12923
  ] }, s.check)) })
@@ -12773,6 +12930,7 @@ function StyleFindings({ report, onSelect, title = "House style", className = ""
12773
12930
  AssetMentionChips,
12774
12931
  BrushOptionsBar,
12775
12932
  BubbleMenu,
12933
+ ChannelsPanel,
12776
12934
  ChartNodeView,
12777
12935
  ColorProfilePanel,
12778
12936
  CommandPalette,