@pixerate/editor-react 0.147.0 → 0.148.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -83,6 +83,7 @@ __export(src_exports, {
83
83
  SelectAndMaskWorkspace: () => SelectAndMaskWorkspace,
84
84
  SelectionChangeCheck: () => SelectionChangeCheck,
85
85
  SelectionOptionsBar: () => SelectionOptionsBar,
86
+ SeparateSubjectPanel: () => SeparateSubjectPanel,
86
87
  ShapeOptionsBar: () => ShapeOptionsBar,
87
88
  SheetTabs: () => SheetTabs,
88
89
  SpreadsheetConditionalFormatPanel: () => SpreadsheetConditionalFormatPanel,
@@ -2213,17 +2214,17 @@ var SpreadsheetValidationDialog = ({ prompt, onResolve }) => {
2213
2214
  style === "warning" && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "mt-2", children: "Continue?" })
2214
2215
  ] })
2215
2216
  ] }),
2216
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "mt-4 flex justify-end gap-2", children: buttons.map((button7, i) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2217
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "mt-4 flex justify-end gap-2", children: buttons.map((button8, i) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2217
2218
  "button",
2218
2219
  {
2219
2220
  ref: i === 0 ? firstButton : void 0,
2220
2221
  type: "button",
2221
- "data-action": button7.action,
2222
+ "data-action": button8.action,
2222
2223
  className: `rounded border border-border px-3 py-1 ${i === 0 ? "bg-primary text-primary-foreground" : "hover:bg-muted"}`,
2223
- onClick: () => onResolve(button7.action),
2224
- children: button7.label
2224
+ onClick: () => onResolve(button8.action),
2225
+ children: button8.label
2225
2226
  },
2226
- button7.action
2227
+ button8.action
2227
2228
  )) })
2228
2229
  ]
2229
2230
  }
@@ -4046,7 +4047,7 @@ function useImageEffectsTools(registry, controller, options = {}) {
4046
4047
  }
4047
4048
 
4048
4049
  // src/image-editor/ImageEditor.tsx
4049
- var import_react73 = __toESM(require("react"), 1);
4050
+ var import_react74 = __toESM(require("react"), 1);
4050
4051
  var import_image_editor24 = require("@pixerate/editor/image-editor");
4051
4052
 
4052
4053
  // src/image-editor/ImageEditorCanvas.tsx
@@ -9466,7 +9467,7 @@ var SelectionOptionsBar = ({
9466
9467
  };
9467
9468
 
9468
9469
  // src/image-editor/RefineEdgePanel.tsx
9469
- var import_react67 = require("react");
9470
+ var import_react68 = require("react");
9470
9471
  var import_image_editor18 = require("@pixerate/editor/image-editor");
9471
9472
 
9472
9473
  // src/image-editor/MaskEdgeCheck.tsx
@@ -9556,20 +9557,83 @@ var SelectionChangeCheck = ({ controller, selection, className = "" }) => {
9556
9557
  ] });
9557
9558
  };
9558
9559
 
9559
- // src/image-editor/RefineEdgePanel.tsx
9560
+ // src/image-editor/SeparateSubjectPanel.tsx
9561
+ var import_react67 = require("react");
9560
9562
  var import_jsx_runtime47 = require("react/jsx-runtime");
9561
- var DEFAULT_PARAMS = { radius: 8, smartRadius: false, smooth: 0, feather: 0, contrast: 0, shiftEdge: 0 };
9562
9563
  var button6 = "px-2 py-1 rounded-md border border-border bg-background text-[11px] text-foreground hover:bg-accent hover:text-accent-foreground disabled:opacity-40";
9563
- var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
9564
- const [params, setParams] = (0, import_react67.useState)(DEFAULT_PARAMS);
9565
- const [busy, setBusy] = (0, import_react67.useState)(false);
9564
+ var SeparateSubjectPanel = ({ controller, selection, className = "" }) => {
9565
+ const sel = selection === void 0 ? controller.getSelection() : selection;
9566
+ const [dilate, setDilate] = (0, import_react67.useState)(8);
9567
+ const [fill, setFill] = (0, import_react67.useState)(true);
9568
+ const [progress, setProgress] = (0, import_react67.useState)(null);
9566
9569
  const [error, setError] = (0, import_react67.useState)(null);
9567
- const [layerId, setLayerId] = (0, import_react67.useState)("");
9568
- const [newKind, setNewKind] = (0, import_react67.useState)("hueSaturation");
9569
- const [output, setOutput] = (0, import_react67.useState)("selection");
9570
- const [decontaminate, setDecontaminate] = (0, import_react67.useState)(0);
9571
- const [objectAware, setObjectAware] = (0, import_react67.useState)(false);
9572
- const [onlyUncertain, setOnlyUncertain] = (0, import_react67.useState)(false);
9570
+ const abort = (0, import_react67.useRef)(null);
9571
+ const run = async () => {
9572
+ setError(null);
9573
+ abort.current = new AbortController();
9574
+ setProgress("Starting");
9575
+ try {
9576
+ await controller.separateSubject({
9577
+ dilate,
9578
+ fill: fill ? "content-aware" : "none",
9579
+ signal: abort.current.signal,
9580
+ onProgress: (fraction, stage) => setProgress(`${stage ?? "Filling"} ${Math.round(fraction * 100)}%`)
9581
+ });
9582
+ } catch (err) {
9583
+ if (!abort.current.signal.aborted) setError(err instanceof Error ? err.message : String(err));
9584
+ } finally {
9585
+ abort.current = null;
9586
+ setProgress(null);
9587
+ }
9588
+ };
9589
+ return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { "data-testid": "separate-subject", className: `flex flex-col gap-1.5 text-xs ${className}`, children: [
9590
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px]", children: "Separate Subject" }),
9591
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("p", { className: "text-muted-foreground", children: "The selection onto its own masked layer, over the background with the subject filled out." }),
9592
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
9593
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
9594
+ "Grow",
9595
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
9596
+ "input",
9597
+ {
9598
+ type: "number",
9599
+ min: 0,
9600
+ max: 200,
9601
+ "aria-label": "Separate grow",
9602
+ value: dilate,
9603
+ onChange: (e) => setDilate(Math.min(200, Math.max(0, Number(e.target.value) || 0))),
9604
+ className: "w-12 bg-background border border-border rounded px-1 py-0.5 text-foreground"
9605
+ }
9606
+ ),
9607
+ "px"
9608
+ ] }),
9609
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("label", { className: "flex items-center gap-1 text-foreground", children: [
9610
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("input", { type: "checkbox", "aria-label": "Fill the background", checked: fill, onChange: (e) => setFill(e.target.checked) }),
9611
+ "Fill the background"
9612
+ ] })
9613
+ ] }),
9614
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex gap-1", children: [
9615
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("button", { type: "button", className: button6, disabled: !sel || progress !== null, onClick: run, children: "Separate Subject" }),
9616
+ progress !== null && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("button", { type: "button", className: button6, onClick: () => abort.current?.abort(), children: "Cancel" })
9617
+ ] }),
9618
+ progress !== null && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("p", { role: "status", className: "text-muted-foreground", children: progress }),
9619
+ error && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("p", { role: "alert", className: "text-destructive", children: error })
9620
+ ] });
9621
+ };
9622
+
9623
+ // src/image-editor/RefineEdgePanel.tsx
9624
+ var import_jsx_runtime48 = require("react/jsx-runtime");
9625
+ var DEFAULT_PARAMS = { radius: 8, smartRadius: false, smooth: 0, feather: 0, contrast: 0, shiftEdge: 0 };
9626
+ var button7 = "px-2 py-1 rounded-md border border-border bg-background text-[11px] text-foreground hover:bg-accent hover:text-accent-foreground disabled:opacity-40";
9627
+ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
9628
+ const [params, setParams] = (0, import_react68.useState)(DEFAULT_PARAMS);
9629
+ const [busy, setBusy] = (0, import_react68.useState)(false);
9630
+ const [error, setError] = (0, import_react68.useState)(null);
9631
+ const [layerId, setLayerId] = (0, import_react68.useState)("");
9632
+ const [newKind, setNewKind] = (0, import_react68.useState)("hueSaturation");
9633
+ const [output, setOutput] = (0, import_react68.useState)("selection");
9634
+ const [decontaminate, setDecontaminate] = (0, import_react68.useState)(0);
9635
+ const [objectAware, setObjectAware] = (0, import_react68.useState)(false);
9636
+ const [onlyUncertain, setOnlyUncertain] = (0, import_react68.useState)(false);
9573
9637
  const canObject = Boolean(controller.segmentationProvider);
9574
9638
  const toLayer = output !== "selection" && output !== "layer-mask";
9575
9639
  const sel = selection === void 0 ? controller.getSelection() : selection;
@@ -9592,17 +9656,17 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
9592
9656
  setBusy(false);
9593
9657
  }
9594
9658
  };
9595
- return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { "data-testid": "refine-edge-panel", className: `flex flex-col gap-3 text-xs ${className}`, children: [
9596
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: imageSectionTitleClass, children: "Refine Edge" }),
9597
- import_image_editor18.REFINE_EDGE_CONTROLS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("label", { className: "flex flex-col gap-1", children: [
9598
- /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
9599
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { children: c.label }),
9600
- /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("span", { className: "font-mono", children: [
9659
+ return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { "data-testid": "refine-edge-panel", className: `flex flex-col gap-3 text-xs ${className}`, children: [
9660
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: imageSectionTitleClass, children: "Refine Edge" }),
9661
+ import_image_editor18.REFINE_EDGE_CONTROLS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("label", { className: "flex flex-col gap-1", children: [
9662
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
9663
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { children: c.label }),
9664
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("span", { className: "font-mono", children: [
9601
9665
  params[c.id],
9602
9666
  c.unit
9603
9667
  ] })
9604
9668
  ] }),
9605
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
9669
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
9606
9670
  "input",
9607
9671
  {
9608
9672
  type: "range",
@@ -9616,43 +9680,43 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
9616
9680
  }
9617
9681
  )
9618
9682
  ] }, c.id)),
9619
- /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
9620
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("input", { type: "checkbox", checked: params.smartRadius, onChange: (e) => setParams({ ...params, smartRadius: e.target.checked }) }),
9683
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
9684
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("input", { type: "checkbox", checked: params.smartRadius, onChange: (e) => setParams({ ...params, smartRadius: e.target.checked }) }),
9621
9685
  "Smart Radius"
9622
9686
  ] }),
9623
- /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("label", { className: "flex items-center gap-2 text-foreground", title: "Refine only where the edge has no image edge under it", children: [
9624
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("input", { type: "checkbox", "aria-label": "Only uncertain areas", checked: onlyUncertain, onChange: (e) => setOnlyUncertain(e.target.checked) }),
9687
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("label", { className: "flex items-center gap-2 text-foreground", title: "Refine only where the edge has no image edge under it", children: [
9688
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("input", { type: "checkbox", "aria-label": "Only uncertain areas", checked: onlyUncertain, onChange: (e) => setOnlyUncertain(e.target.checked) }),
9625
9689
  "Only uncertain areas"
9626
9690
  ] }),
9627
- canObject && /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
9628
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("input", { type: "checkbox", "aria-label": "Object aware", checked: objectAware, onChange: (e) => setObjectAware(e.target.checked) }),
9691
+ canObject && /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
9692
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("input", { type: "checkbox", "aria-label": "Object aware", checked: objectAware, onChange: (e) => setObjectAware(e.target.checked) }),
9629
9693
  "Object aware (segmentation model)"
9630
9694
  ] }),
9631
- /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("label", { className: "flex items-center gap-2 text-muted-foreground", children: [
9695
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("label", { className: "flex items-center gap-2 text-muted-foreground", children: [
9632
9696
  "Output to",
9633
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
9697
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
9634
9698
  "select",
9635
9699
  {
9636
9700
  "aria-label": "Refine output",
9637
9701
  value: output,
9638
9702
  onChange: (e) => setOutput(e.target.value),
9639
9703
  className: "flex-1 bg-background border border-border rounded px-1 py-1 text-foreground",
9640
- children: import_image_editor18.REFINE_OUTPUTS.filter((o) => !o.needsDocuments || controller.canOpenDocuments).map((o) => /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("option", { value: o.id, children: o.label }, o.id))
9704
+ children: import_image_editor18.REFINE_OUTPUTS.filter((o) => !o.needsDocuments || controller.canOpenDocuments).map((o) => /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("option", { value: o.id, children: o.label }, o.id))
9641
9705
  }
9642
9706
  )
9643
9707
  ] }),
9644
- /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("label", { className: "flex flex-col gap-1", children: [
9645
- /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
9646
- /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("span", { children: [
9708
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("label", { className: "flex flex-col gap-1", children: [
9709
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
9710
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("span", { children: [
9647
9711
  "Decontaminate colors",
9648
9712
  toLayer ? "" : " (new layer or document outputs)"
9649
9713
  ] }),
9650
- /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("span", { className: "font-mono", children: [
9714
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("span", { className: "font-mono", children: [
9651
9715
  decontaminate,
9652
9716
  "%"
9653
9717
  ] })
9654
9718
  ] }),
9655
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
9719
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
9656
9720
  "input",
9657
9721
  {
9658
9722
  type: "range",
@@ -9667,65 +9731,66 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
9667
9731
  }
9668
9732
  )
9669
9733
  ] }),
9670
- /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex gap-1", children: [
9671
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("button", { type: "button", className: button6, disabled: !sel || busy, onClick: refine, children: "Refine Edge" }),
9672
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("button", { type: "button", className: button6, onClick: () => setParams(DEFAULT_PARAMS), children: "Reset" })
9734
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "flex gap-1", children: [
9735
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("button", { type: "button", className: button7, disabled: !sel || busy, onClick: refine, children: "Refine Edge" }),
9736
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("button", { type: "button", className: button7, onClick: () => setParams(DEFAULT_PARAMS), children: "Reset" })
9673
9737
  ] }),
9674
- error && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("p", { role: "alert", className: "text-destructive", children: error }),
9675
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(MaskEdgeCheck, { controller, selection: sel }),
9676
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(SelectionChangeCheck, { controller, selection: sel }),
9677
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] mt-2", children: "Layer Mask" }),
9678
- /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex gap-1 items-center", children: [
9679
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
9738
+ error && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("p", { role: "alert", className: "text-destructive", children: error }),
9739
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(MaskEdgeCheck, { controller, selection: sel }),
9740
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(SelectionChangeCheck, { controller, selection: sel }),
9741
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(SeparateSubjectPanel, { controller, selection: sel, className: "mt-2" }),
9742
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] mt-2", children: "Layer Mask" }),
9743
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "flex gap-1 items-center", children: [
9744
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
9680
9745
  "select",
9681
9746
  {
9682
9747
  "aria-label": "New masked layer kind",
9683
9748
  value: newKind,
9684
9749
  onChange: (e) => setNewKind(e.target.value),
9685
9750
  className: "flex-1 bg-background border border-border rounded px-1 py-1 text-foreground",
9686
- children: import_image_editor18.ADJUSTMENT_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("option", { value: k.kind, children: k.label }, k.kind))
9751
+ children: import_image_editor18.ADJUSTMENT_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("option", { value: k.kind, children: k.label }, k.kind))
9687
9752
  }
9688
9753
  ),
9689
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
9754
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
9690
9755
  "button",
9691
9756
  {
9692
9757
  type: "button",
9693
- className: button6,
9758
+ className: button7,
9694
9759
  disabled: !sel,
9695
9760
  onClick: () => sel && setLayerId(controller.addAdjustmentLayer({ kind: newKind, mask: (0, import_image_editor18.layerMaskFromSelection)(sel) })),
9696
9761
  children: "New Masked Layer"
9697
9762
  }
9698
9763
  )
9699
9764
  ] }),
9700
- list.length > 0 && target && /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex flex-col gap-2", children: [
9701
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
9765
+ list.length > 0 && target && /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "flex flex-col gap-2", children: [
9766
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
9702
9767
  "select",
9703
9768
  {
9704
9769
  "aria-label": "Mask layer",
9705
9770
  value: target.id,
9706
9771
  onChange: (e) => setLayerId(e.target.value),
9707
9772
  className: "bg-background border border-border rounded px-1 py-1 text-foreground",
9708
- children: list.map((l) => /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("option", { value: l.id, children: [
9773
+ children: list.map((l) => /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("option", { value: l.id, children: [
9709
9774
  l.name || (0, import_image_editor18.adjustmentKindLabel)(l.kind),
9710
9775
  l.mask ? " (masked)" : ""
9711
9776
  ] }, l.id))
9712
9777
  }
9713
9778
  ),
9714
- /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
9715
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("button", { type: "button", className: button6, disabled: !sel, onClick: () => controller.applySelectionAsLayerMask(target.id), children: "Mask with Selection" }),
9716
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("button", { type: "button", className: button6, disabled: !target.mask, onClick: () => controller.selectionFromLayerMask(target.id), children: "Load as Selection" }),
9717
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("button", { type: "button", className: button6, disabled: !target.mask, onClick: () => controller.setAdjustmentLayerMask(target.id, null), children: "Remove Mask" })
9779
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
9780
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("button", { type: "button", className: button7, disabled: !sel, onClick: () => controller.applySelectionAsLayerMask(target.id), children: "Mask with Selection" }),
9781
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("button", { type: "button", className: button7, disabled: !target.mask, onClick: () => controller.selectionFromLayerMask(target.id), children: "Load as Selection" }),
9782
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("button", { type: "button", className: button7, disabled: !target.mask, onClick: () => controller.setAdjustmentLayerMask(target.id, null), children: "Remove Mask" })
9718
9783
  ] }),
9719
- target.mask && /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_jsx_runtime47.Fragment, { children: [
9720
- /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("label", { className: "flex flex-col gap-1", children: [
9721
- /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
9722
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { children: "Density" }),
9723
- /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("span", { className: "font-mono", children: [
9784
+ target.mask && /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_jsx_runtime48.Fragment, { children: [
9785
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("label", { className: "flex flex-col gap-1", children: [
9786
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
9787
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { children: "Density" }),
9788
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("span", { className: "font-mono", children: [
9724
9789
  Math.round((target.mask.density ?? 1) * 100),
9725
9790
  "%"
9726
9791
  ] })
9727
9792
  ] }),
9728
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
9793
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
9729
9794
  "input",
9730
9795
  {
9731
9796
  type: "range",
@@ -9739,15 +9804,15 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
9739
9804
  }
9740
9805
  )
9741
9806
  ] }),
9742
- /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("label", { className: "flex flex-col gap-1", children: [
9743
- /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
9744
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { children: "Mask Feather" }),
9745
- /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("span", { className: "font-mono", children: [
9807
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("label", { className: "flex flex-col gap-1", children: [
9808
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
9809
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { children: "Mask Feather" }),
9810
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("span", { className: "font-mono", children: [
9746
9811
  target.mask.feather ?? 0,
9747
9812
  "px"
9748
9813
  ] })
9749
9814
  ] }),
9750
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
9815
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
9751
9816
  "input",
9752
9817
  {
9753
9818
  type: "range",
@@ -9767,13 +9832,13 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
9767
9832
  };
9768
9833
 
9769
9834
  // src/image-editor/ChannelsPanel.tsx
9770
- var import_react68 = require("react");
9835
+ var import_react69 = require("react");
9771
9836
  var import_image_editor19 = require("@pixerate/editor/image-editor");
9772
- var import_jsx_runtime48 = require("react/jsx-runtime");
9837
+ var import_jsx_runtime49 = require("react/jsx-runtime");
9773
9838
  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"}`;
9774
9839
  var ChannelThumb = ({ channel, size }) => {
9775
- const ref = (0, import_react68.useRef)(null);
9776
- (0, import_react68.useEffect)(() => {
9840
+ const ref = (0, import_react69.useRef)(null);
9841
+ (0, import_react69.useEffect)(() => {
9777
9842
  const canvas = ref.current;
9778
9843
  const ctx = canvas?.getContext("2d");
9779
9844
  if (!canvas || !ctx || typeof ctx.createImageData !== "function") return;
@@ -9784,15 +9849,15 @@ var ChannelThumb = ({ channel, size }) => {
9784
9849
  img.data.set(px.data);
9785
9850
  ctx.putImageData(img, 0, 0);
9786
9851
  }, [channel.mask]);
9787
- return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("canvas", { ref, "aria-hidden": "true", style: { width: size, height: size }, className: "shrink-0 rounded object-contain ring-1 ring-border bg-black" });
9852
+ return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("canvas", { ref, "aria-hidden": "true", style: { width: size, height: size }, className: "shrink-0 rounded object-contain ring-1 ring-border bg-black" });
9788
9853
  };
9789
9854
  var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
9790
- const [, setTick] = (0, import_react68.useState)(0);
9791
- (0, import_react68.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
9792
- const [activeId, setActiveId] = (0, import_react68.useState)(null);
9793
- const [renaming, setRenaming] = (0, import_react68.useState)(null);
9794
- const [error, setError] = (0, import_react68.useState)(null);
9795
- const fileInput = (0, import_react68.useRef)(null);
9855
+ const [, setTick] = (0, import_react69.useState)(0);
9856
+ (0, import_react69.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
9857
+ const [activeId, setActiveId] = (0, import_react69.useState)(null);
9858
+ const [renaming, setRenaming] = (0, import_react69.useState)(null);
9859
+ const [error, setError] = (0, import_react69.useState)(null);
9860
+ const fileInput = (0, import_react69.useRef)(null);
9796
9861
  const channels = controller.getChannels();
9797
9862
  const active = channels.find((c) => c.id === activeId) ?? null;
9798
9863
  const hasSelection = Boolean(controller.getSelection());
@@ -9814,13 +9879,13 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
9814
9879
  setError(err instanceof Error ? err.message : String(err));
9815
9880
  }
9816
9881
  };
9817
- return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { "data-testid": "channels-panel", className: `flex flex-col gap-2 text-xs ${className}`, children: [
9818
- /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "flex items-center justify-between", children: [
9819
- /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: imageSectionTitleClass, children: "Channels" }),
9820
- /* @__PURE__ */ (0, import_jsx_runtime48.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" })
9882
+ return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { "data-testid": "channels-panel", className: `flex flex-col gap-2 text-xs ${className}`, children: [
9883
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex items-center justify-between", children: [
9884
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { className: imageSectionTitleClass, children: "Channels" }),
9885
+ /* @__PURE__ */ (0, import_jsx_runtime49.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" })
9821
9886
  ] }),
9822
- channels.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("p", { className: "text-muted-foreground", children: "No channels. Save a selection to keep it." }),
9823
- /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("ul", { role: "list", className: "flex flex-col gap-0.5", children: channels.map((c) => /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
9887
+ channels.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("p", { className: "text-muted-foreground", children: "No channels. Save a selection to keep it." }),
9888
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("ul", { role: "list", className: "flex flex-col gap-0.5", children: channels.map((c) => /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
9824
9889
  "li",
9825
9890
  {
9826
9891
  "data-testid": "channel-row",
@@ -9832,7 +9897,7 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
9832
9897
  },
9833
9898
  onDoubleClick: () => setRenaming(c.id),
9834
9899
  children: [
9835
- /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
9900
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
9836
9901
  "button",
9837
9902
  {
9838
9903
  type: "button",
@@ -9846,8 +9911,8 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
9846
9911
  children: c.visible ? "\u25CF" : "\u25CB"
9847
9912
  }
9848
9913
  ),
9849
- /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(ChannelThumb, { channel: c, size: thumbnailSize }),
9850
- renaming === c.id ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
9914
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(ChannelThumb, { channel: c, size: thumbnailSize }),
9915
+ renaming === c.id ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
9851
9916
  "input",
9852
9917
  {
9853
9918
  autoFocus: true,
@@ -9864,16 +9929,16 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
9864
9929
  if (e.key === "Escape") setRenaming(null);
9865
9930
  }
9866
9931
  }
9867
- ) : /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "min-w-0 flex-1 truncate", children: c.name })
9932
+ ) : /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { className: "min-w-0 flex-1 truncate", children: c.name })
9868
9933
  ]
9869
9934
  },
9870
9935
  c.id
9871
9936
  )) }),
9872
- /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
9873
- /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("button", { type: "button", className: btn2(), disabled: !hasSelection, onClick: () => attempt(() => setActiveId(controller.saveSelection().id)), children: "Save Selection" }),
9874
- /* @__PURE__ */ (0, import_jsx_runtime48.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" }),
9875
- /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("button", { type: "button", className: btn2(), disabled: !active, onClick: () => attempt(() => setActiveId(controller.duplicateChannel(active.id).id)), children: "Duplicate" }),
9876
- /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
9937
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
9938
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("button", { type: "button", className: btn2(), disabled: !hasSelection, onClick: () => attempt(() => setActiveId(controller.saveSelection().id)), children: "Save Selection" }),
9939
+ /* @__PURE__ */ (0, import_jsx_runtime49.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" }),
9940
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("button", { type: "button", className: btn2(), disabled: !active, onClick: () => attempt(() => setActiveId(controller.duplicateChannel(active.id).id)), children: "Duplicate" }),
9941
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
9877
9942
  "button",
9878
9943
  {
9879
9944
  type: "button",
@@ -9886,8 +9951,8 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
9886
9951
  children: "Delete"
9887
9952
  }
9888
9953
  ),
9889
- /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("button", { type: "button", className: btn2(), title: "Load a mask image (white = selected) into a new channel", onClick: () => fileInput.current?.click(), children: "Import\u2026" }),
9890
- /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
9954
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("button", { type: "button", className: btn2(), title: "Load a mask image (white = selected) into a new channel", onClick: () => fileInput.current?.click(), children: "Import\u2026" }),
9955
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
9891
9956
  "button",
9892
9957
  {
9893
9958
  type: "button",
@@ -9898,7 +9963,7 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
9898
9963
  children: "Export PNG"
9899
9964
  }
9900
9965
  ),
9901
- /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
9966
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
9902
9967
  "input",
9903
9968
  {
9904
9969
  ref: fileInput,
@@ -9913,22 +9978,22 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
9913
9978
  }
9914
9979
  )
9915
9980
  ] }),
9916
- error && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("p", { role: "alert", className: "text-destructive", children: error })
9981
+ error && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("p", { role: "alert", className: "text-destructive", children: error })
9917
9982
  ] });
9918
9983
  };
9919
9984
 
9920
9985
  // src/image-editor/PathsPanel.tsx
9921
- var import_react69 = require("react");
9986
+ var import_react70 = require("react");
9922
9987
  var import_image_editor20 = require("@pixerate/editor/image-editor");
9923
- var import_jsx_runtime49 = require("react/jsx-runtime");
9988
+ var import_jsx_runtime50 = require("react/jsx-runtime");
9924
9989
  var btn3 = (on = false) => `px-2 py-1 rounded-md border text-[11px] transition-colors disabled:opacity-40 ${on ? "bg-primary border-primary text-primary-foreground" : "bg-background border-border text-foreground hover:bg-accent hover:text-accent-foreground"}`;
9925
9990
  var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
9926
- const [, setTick] = (0, import_react69.useState)(0);
9927
- (0, import_react69.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
9928
- const [renaming, setRenaming] = (0, import_react69.useState)(null);
9929
- const [color, setColor] = (0, import_react69.useState)("#000000");
9930
- const [width, setWidth] = (0, import_react69.useState)(2);
9931
- const [error, setError] = (0, import_react69.useState)(null);
9991
+ const [, setTick] = (0, import_react70.useState)(0);
9992
+ (0, import_react70.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
9993
+ const [renaming, setRenaming] = (0, import_react70.useState)(null);
9994
+ const [color, setColor] = (0, import_react70.useState)("#000000");
9995
+ const [width, setWidth] = (0, import_react70.useState)(2);
9996
+ const [error, setError] = (0, import_react70.useState)(null);
9932
9997
  const paths = controller.getPaths();
9933
9998
  const activeId = controller.getState().activePathId ?? null;
9934
9999
  const active = paths.find((p) => p.id === activeId) ?? null;
@@ -9944,10 +10009,10 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
9944
10009
  };
9945
10010
  return (
9946
10011
  // Clicking the panel's empty space deselects the path (the path tools then edit the active layer).
9947
- /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { "data-testid": "paths-panel", className: `flex flex-col gap-2 text-xs ${className}`, onClick: (e) => e.target === e.currentTarget && attempt(() => controller.setActivePath(null)), children: [
9948
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { className: imageSectionTitleClass, children: "Paths" }),
9949
- paths.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("p", { className: "text-muted-foreground", children: "No paths. Make a work path from a selection." }),
9950
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("ul", { role: "list", className: "flex flex-col gap-0.5 min-h-4", onClick: (e) => e.target === e.currentTarget && attempt(() => controller.setActivePath(null)), children: paths.map((p) => /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
10012
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { "data-testid": "paths-panel", className: `flex flex-col gap-2 text-xs ${className}`, onClick: (e) => e.target === e.currentTarget && attempt(() => controller.setActivePath(null)), children: [
10013
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: imageSectionTitleClass, children: "Paths" }),
10014
+ paths.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("p", { className: "text-muted-foreground", children: "No paths. Make a work path from a selection." }),
10015
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("ul", { role: "list", className: "flex flex-col gap-0.5 min-h-4", onClick: (e) => e.target === e.currentTarget && attempt(() => controller.setActivePath(null)), children: paths.map((p) => /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(
9951
10016
  "li",
9952
10017
  {
9953
10018
  "data-testid": "path-row",
@@ -9956,8 +10021,8 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
9956
10021
  onClick: () => attempt(() => controller.setActivePath(p.id)),
9957
10022
  onDoubleClick: () => setRenaming(p.id),
9958
10023
  children: [
9959
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("svg", { "aria-hidden": "true", viewBox: `0 0 ${w || 1} ${h || 1}`, style: { width: thumbnailSize, height: thumbnailSize }, className: "shrink-0 rounded ring-1 ring-border bg-background", children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("path", { d: (0, import_image_editor20.pathSvgData)(p), fill: "currentColor", fillOpacity: 0.25, stroke: "currentColor", strokeWidth: Math.max(w, h) / 64, fillRule: p.fillRule ?? "nonzero" }) }),
9960
- renaming === p.id ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
10024
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("svg", { "aria-hidden": "true", viewBox: `0 0 ${w || 1} ${h || 1}`, style: { width: thumbnailSize, height: thumbnailSize }, className: "shrink-0 rounded ring-1 ring-border bg-background", children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("path", { d: (0, import_image_editor20.pathSvgData)(p), fill: "currentColor", fillOpacity: 0.25, stroke: "currentColor", strokeWidth: Math.max(w, h) / 64, fillRule: p.fillRule ?? "nonzero" }) }),
10025
+ renaming === p.id ? /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
9961
10026
  "input",
9962
10027
  {
9963
10028
  autoFocus: true,
@@ -9976,13 +10041,13 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
9976
10041
  if (e.key === "Escape") setRenaming(null);
9977
10042
  }
9978
10043
  }
9979
- ) : /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { className: `min-w-0 flex-1 truncate ${p.work ? "italic" : ""}`, children: p.name })
10044
+ ) : /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: `min-w-0 flex-1 truncate ${p.work ? "italic" : ""}`, children: p.name })
9980
10045
  ]
9981
10046
  },
9982
10047
  p.id
9983
10048
  )) }),
9984
- /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
9985
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
10049
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
10050
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
9986
10051
  "button",
9987
10052
  {
9988
10053
  type: "button",
@@ -9993,15 +10058,15 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
9993
10058
  children: "Load as Selection"
9994
10059
  }
9995
10060
  ),
9996
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("button", { type: "button", className: btn3(), disabled: !hasSelection, onClick: () => attempt(() => controller.makeWorkPath()), children: "Make Work Path" }),
9997
- active?.work && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("button", { type: "button", className: btn3(), onClick: () => setRenaming(active.id), children: "Save Path" }),
9998
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.addVectorMaskFromPath(active.id)), children: "Add Vector Mask" })
10061
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("button", { type: "button", className: btn3(), disabled: !hasSelection, onClick: () => attempt(() => controller.makeWorkPath()), children: "Make Work Path" }),
10062
+ active?.work && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("button", { type: "button", className: btn3(), onClick: () => setRenaming(active.id), children: "Save Path" }),
10063
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.addVectorMaskFromPath(active.id)), children: "Add Vector Mask" })
9999
10064
  ] }),
10000
- /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
10001
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("input", { type: "color", "aria-label": "Path paint colour", value: color, onChange: (e) => setColor(e.target.value), className: "h-6 w-8 bg-background border border-border rounded" }),
10002
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.fillPath(active.id, { color })), children: "Fill Path" }),
10003
- /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
10004
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
10065
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
10066
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("input", { type: "color", "aria-label": "Path paint colour", value: color, onChange: (e) => setColor(e.target.value), className: "h-6 w-8 bg-background border border-border rounded" }),
10067
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.fillPath(active.id, { color })), children: "Fill Path" }),
10068
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
10069
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10005
10070
  "input",
10006
10071
  {
10007
10072
  type: "number",
@@ -10016,25 +10081,25 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
10016
10081
  ),
10017
10082
  "px"
10018
10083
  ] }),
10019
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.strokePath(active.id, { width, color })), children: "Stroke Path" })
10084
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.strokePath(active.id, { width, color })), children: "Stroke Path" })
10020
10085
  ] }),
10021
- /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
10022
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.duplicatePath(active.id)), children: "Duplicate" }),
10023
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.deletePath(active.id)), children: "Delete" })
10086
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
10087
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.duplicatePath(active.id)), children: "Duplicate" }),
10088
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.deletePath(active.id)), children: "Delete" })
10024
10089
  ] }),
10025
- error && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("p", { role: "alert", className: "text-destructive", children: error })
10090
+ error && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("p", { role: "alert", className: "text-destructive", children: error })
10026
10091
  ] })
10027
10092
  );
10028
10093
  };
10029
10094
 
10030
10095
  // src/image-editor/FreeTransformOptionsBar.tsx
10031
- var import_react70 = require("react");
10096
+ var import_react71 = require("react");
10032
10097
  var import_image_editor21 = require("@pixerate/editor/image-editor");
10033
- var import_jsx_runtime50 = require("react/jsx-runtime");
10098
+ var import_jsx_runtime51 = require("react/jsx-runtime");
10034
10099
  var round = (v, unit) => unit === "px" ? Math.round(v * 10) / 10 : Math.round(v * 100) / 100;
10035
10100
  var FreeTransformOptionsBar = ({ tool, className }) => {
10036
- const [, setTick] = (0, import_react70.useState)(0);
10037
- (0, import_react70.useEffect)(() => tool.subscribe(() => setTick((n) => n + 1)), [tool]);
10101
+ const [, setTick] = (0, import_react71.useState)(0);
10102
+ (0, import_react71.useEffect)(() => tool.subscribe(() => setTick((n) => n + 1)), [tool]);
10038
10103
  const bar = tool.bar();
10039
10104
  if (!tool.active || !bar) return null;
10040
10105
  const warp = tool.warpBar();
@@ -10046,17 +10111,17 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
10046
10111
  const v = Number(raw);
10047
10112
  if (raw.trim() !== "" && Number.isFinite(v) && Math.abs(v - bar[field]) > 1e-9) tool.setField(field, v);
10048
10113
  };
10049
- return /* @__PURE__ */ (0, import_jsx_runtime50.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: [
10050
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: "flex gap-1", role: "group", "aria-label": "Transform mode", children: import_image_editor21.FREE_TRANSFORM_MODE_OPTIONS.map((m) => /* @__PURE__ */ (0, import_jsx_runtime50.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)) }),
10051
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: "grid grid-cols-3 gap-px", role: "group", "aria-label": "Reference point", children: import_image_editor21.TRANSFORM_ANCHORS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime50.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)) }),
10052
- tool.mode === "warp" && /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex flex-wrap items-center gap-2", role: "group", "aria-label": "Warp options", children: [
10053
- /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("label", { className: "flex items-center gap-1", children: [
10054
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: "text-muted-foreground", children: "Warp" }),
10055
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("select", { "aria-label": "Warp style", value: warp.style, onChange: (e) => tool.setWarp({ style: e.target.value }), className: imageFieldClass, children: import_image_editor21.WARP_STYLE_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("option", { value: o.id, children: o.label }, o.id)) })
10114
+ return /* @__PURE__ */ (0, import_jsx_runtime51.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: [
10115
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: "flex gap-1", role: "group", "aria-label": "Transform mode", children: import_image_editor21.FREE_TRANSFORM_MODE_OPTIONS.map((m) => /* @__PURE__ */ (0, import_jsx_runtime51.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)) }),
10116
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: "grid grid-cols-3 gap-px", role: "group", "aria-label": "Reference point", children: import_image_editor21.TRANSFORM_ANCHORS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime51.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)) }),
10117
+ tool.mode === "warp" && /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "flex flex-wrap items-center gap-2", role: "group", "aria-label": "Warp options", children: [
10118
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("label", { className: "flex items-center gap-1", children: [
10119
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { className: "text-muted-foreground", children: "Warp" }),
10120
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("select", { "aria-label": "Warp style", value: warp.style, onChange: (e) => tool.setWarp({ style: e.target.value }), className: imageFieldClass, children: import_image_editor21.WARP_STYLE_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("option", { value: o.id, children: o.label }, o.id)) })
10056
10121
  ] }),
10057
- ["bend", "horizontal", "vertical"].map((k) => /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("label", { className: "flex items-center gap-1", children: [
10058
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: "text-muted-foreground", children: k === "bend" ? "Bend" : k === "horizontal" ? "H" : "V" }),
10059
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10122
+ ["bend", "horizontal", "vertical"].map((k) => /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("label", { className: "flex items-center gap-1", children: [
10123
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { className: "text-muted-foreground", children: k === "bend" ? "Bend" : k === "horizontal" ? "H" : "V" }),
10124
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
10060
10125
  "input",
10061
10126
  {
10062
10127
  type: "number",
@@ -10077,9 +10142,9 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
10077
10142
  },
10078
10143
  `${k}:${warp[k]}`
10079
10144
  ),
10080
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: "text-muted-foreground", children: "%" })
10145
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { className: "text-muted-foreground", children: "%" })
10081
10146
  ] }, k)),
10082
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10147
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
10083
10148
  "button",
10084
10149
  {
10085
10150
  type: "button",
@@ -10091,9 +10156,9 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
10091
10156
  children: "Vertical"
10092
10157
  }
10093
10158
  ),
10094
- /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("label", { className: "flex items-center gap-1", children: [
10095
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: "text-muted-foreground", children: "Grid" }),
10096
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10159
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("label", { className: "flex items-center gap-1", children: [
10160
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { className: "text-muted-foreground", children: "Grid" }),
10161
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
10097
10162
  "select",
10098
10163
  {
10099
10164
  "aria-label": "Warp grid",
@@ -10103,14 +10168,14 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
10103
10168
  tool.setWarp({ columns: g.columns, rows: g.rows });
10104
10169
  },
10105
10170
  className: imageFieldClass,
10106
- children: import_image_editor21.WARP_GRID_OPTIONS.map((g) => /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("option", { value: g.id, children: g.label }, g.id))
10171
+ children: import_image_editor21.WARP_GRID_OPTIONS.map((g) => /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("option", { value: g.id, children: g.label }, g.id))
10107
10172
  }
10108
10173
  )
10109
10174
  ] })
10110
10175
  ] }),
10111
- tool.mode !== "warp" && import_image_editor21.FREE_TRANSFORM_FIELDS.map((f) => /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("label", { className: "flex items-center gap-1", title: f.title, children: [
10112
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: "text-muted-foreground", children: f.label }),
10113
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10176
+ tool.mode !== "warp" && import_image_editor21.FREE_TRANSFORM_FIELDS.map((f) => /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("label", { className: "flex items-center gap-1", title: f.title, children: [
10177
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { className: "text-muted-foreground", children: f.label }),
10178
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
10114
10179
  "input",
10115
10180
  {
10116
10181
  type: "number",
@@ -10130,8 +10195,8 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
10130
10195
  },
10131
10196
  `${f.id}:${round(bar[f.id], f.unit)}`
10132
10197
  ),
10133
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: "text-muted-foreground", children: f.unit }),
10134
- f.id === "scaleX" && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10198
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { className: "text-muted-foreground", children: f.unit }),
10199
+ f.id === "scaleX" && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
10135
10200
  "button",
10136
10201
  {
10137
10202
  type: "button",
@@ -10146,33 +10211,33 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
10146
10211
  }
10147
10212
  )
10148
10213
  ] }, f.id)),
10149
- /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("label", { className: "flex items-center gap-1", children: [
10150
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: "text-muted-foreground", children: "Interpolation" }),
10151
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10214
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("label", { className: "flex items-center gap-1", children: [
10215
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { className: "text-muted-foreground", children: "Interpolation" }),
10216
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
10152
10217
  "select",
10153
10218
  {
10154
10219
  "aria-label": "Interpolation",
10155
10220
  value: tool.interpolation,
10156
10221
  onChange: (e) => tool.setInterpolation(e.target.value),
10157
10222
  className: imageFieldClass,
10158
- children: import_image_editor21.INTERPOLATIONS.map((i) => /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("option", { value: i, children: i[0].toUpperCase() + i.slice(1) }, i))
10223
+ children: import_image_editor21.INTERPOLATIONS.map((i) => /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("option", { value: i, children: i[0].toUpperCase() + i.slice(1) }, i))
10159
10224
  }
10160
10225
  )
10161
10226
  ] }),
10162
- /* @__PURE__ */ (0, import_jsx_runtime50.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" }),
10163
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("button", { type: "button", title: "Cancel (Esc)", className: imageChipClass(false), onClick: () => tool.cancel(), children: "Cancel" }),
10164
- tool.error && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { role: "alert", className: "text-destructive", children: tool.error })
10227
+ /* @__PURE__ */ (0, import_jsx_runtime51.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" }),
10228
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("button", { type: "button", title: "Cancel (Esc)", className: imageChipClass(false), onClick: () => tool.cancel(), children: "Cancel" }),
10229
+ tool.error && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { role: "alert", className: "text-destructive", children: tool.error })
10165
10230
  ] });
10166
10231
  };
10167
10232
 
10168
10233
  // src/image-editor/ShapeOptionsBar.tsx
10169
- var import_react71 = require("react");
10234
+ var import_react72 = require("react");
10170
10235
  var import_image_editor22 = require("@pixerate/editor/image-editor");
10171
- var import_jsx_runtime51 = require("react/jsx-runtime");
10236
+ var import_jsx_runtime52 = require("react/jsx-runtime");
10172
10237
  var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
10173
- const [, setTick] = (0, import_react71.useState)(0);
10174
- (0, import_react71.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
10175
- const [error, setError] = (0, import_react71.useState)(null);
10238
+ const [, setTick] = (0, import_react72.useState)(0);
10239
+ (0, import_react72.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
10240
+ const [error, setError] = (0, import_react72.useState)(null);
10176
10241
  const active = controller.getActiveLayer();
10177
10242
  const shapeId = active?.type === "shape" ? active.id : null;
10178
10243
  const set = (change) => {
@@ -10186,22 +10251,22 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
10186
10251
  }
10187
10252
  };
10188
10253
  const num = (v, min, max) => Math.max(min, Math.min(max, Number(v) || min));
10189
- return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "shape-options", children: [
10190
- /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Shape kind", children: import_image_editor22.LIVE_SHAPE_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("button", { type: "button", "aria-pressed": options.kind === k, className: imageChipClass(options.kind === k), onClick: () => onChange({ ...options, kind: k }), children: import_image_editor22.SHAPE_KIND_LABELS[k] }, k)) }),
10191
- /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
10192
- /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("label", { className: "flex items-center gap-1", children: [
10193
- /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(ImageCheckbox, { label: "Fill", checked: options.fill !== null, onChange: (on) => set({ fill: on ? "#4f46e5" : null }) }),
10254
+ return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "shape-options", children: [
10255
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Shape kind", children: import_image_editor22.LIVE_SHAPE_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("button", { type: "button", "aria-pressed": options.kind === k, className: imageChipClass(options.kind === k), onClick: () => onChange({ ...options, kind: k }), children: import_image_editor22.SHAPE_KIND_LABELS[k] }, k)) }),
10256
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
10257
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("label", { className: "flex items-center gap-1", children: [
10258
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(ImageCheckbox, { label: "Fill", checked: options.fill !== null, onChange: (on) => set({ fill: on ? "#4f46e5" : null }) }),
10194
10259
  "Fill",
10195
- /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(ImageColor, { label: "Fill colour", disabled: options.fill === null, value: options.fill ?? "#4f46e5", onChange: (fill) => set({ fill }) })
10260
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(ImageColor, { label: "Fill colour", disabled: options.fill === null, value: options.fill ?? "#4f46e5", onChange: (fill) => set({ fill }) })
10196
10261
  ] }),
10197
- /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("label", { className: "flex items-center gap-1", children: [
10198
- /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(ImageCheckbox, { label: "Stroke", checked: options.stroke !== null, onChange: (on) => set({ stroke: on ? "#000000" : null }) }),
10262
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("label", { className: "flex items-center gap-1", children: [
10263
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(ImageCheckbox, { label: "Stroke", checked: options.stroke !== null, onChange: (on) => set({ stroke: on ? "#000000" : null }) }),
10199
10264
  "Stroke",
10200
- /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(ImageColor, { label: "Stroke colour", disabled: options.stroke === null, value: options.stroke ?? "#000000", onChange: (stroke) => set({ stroke }) })
10265
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(ImageColor, { label: "Stroke colour", disabled: options.stroke === null, value: options.stroke ?? "#000000", onChange: (stroke) => set({ stroke }) })
10201
10266
  ] }),
10202
- /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("label", { className: "flex items-center gap-1", children: [
10267
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("label", { className: "flex items-center gap-1", children: [
10203
10268
  "Width",
10204
- /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
10269
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
10205
10270
  "input",
10206
10271
  {
10207
10272
  type: "number",
@@ -10215,52 +10280,52 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
10215
10280
  )
10216
10281
  ] })
10217
10282
  ] }),
10218
- /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
10219
- options.kind === "rect" && /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("label", { className: "flex items-center gap-1", children: [
10283
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
10284
+ options.kind === "rect" && /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("label", { className: "flex items-center gap-1", children: [
10220
10285
  "Radius",
10221
- /* @__PURE__ */ (0, import_jsx_runtime51.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}` })
10286
+ /* @__PURE__ */ (0, import_jsx_runtime52.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}` })
10222
10287
  ] }),
10223
- options.kind === "polygon" && /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("label", { className: "flex items-center gap-1", children: [
10288
+ options.kind === "polygon" && /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("label", { className: "flex items-center gap-1", children: [
10224
10289
  "Sides",
10225
- /* @__PURE__ */ (0, import_jsx_runtime51.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}` })
10290
+ /* @__PURE__ */ (0, import_jsx_runtime52.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}` })
10226
10291
  ] }),
10227
- options.kind === "star" && /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(import_jsx_runtime51.Fragment, { children: [
10228
- /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("label", { className: "flex items-center gap-1", children: [
10292
+ options.kind === "star" && /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(import_jsx_runtime52.Fragment, { children: [
10293
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("label", { className: "flex items-center gap-1", children: [
10229
10294
  "Points",
10230
- /* @__PURE__ */ (0, import_jsx_runtime51.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}` })
10295
+ /* @__PURE__ */ (0, import_jsx_runtime52.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}` })
10231
10296
  ] }),
10232
- /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("label", { className: "flex items-center gap-1", children: [
10297
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("label", { className: "flex items-center gap-1", children: [
10233
10298
  "Inner",
10234
- /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(ImageRange, { label: "Inner radius", min: 0.05, max: 1, step: 0.05, value: options.innerRatio, onChange: (v) => set({ innerRatio: v }) })
10299
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(ImageRange, { label: "Inner radius", min: 0.05, max: 1, step: 0.05, value: options.innerRatio, onChange: (v) => set({ innerRatio: v }) })
10235
10300
  ] })
10236
10301
  ] }),
10237
- options.kind === "line" && /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(import_jsx_runtime51.Fragment, { children: [
10238
- /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("label", { className: "flex items-center gap-1", children: [
10302
+ options.kind === "line" && /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(import_jsx_runtime52.Fragment, { children: [
10303
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("label", { className: "flex items-center gap-1", children: [
10239
10304
  "Weight",
10240
- /* @__PURE__ */ (0, import_jsx_runtime51.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}` })
10305
+ /* @__PURE__ */ (0, import_jsx_runtime52.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}` })
10241
10306
  ] }),
10242
- /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("label", { className: "flex items-center gap-1", children: [
10243
- /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(ImageCheckbox, { label: "Arrowhead", checked: options.arrow, onChange: (on) => set({ arrow: on }) }),
10307
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("label", { className: "flex items-center gap-1", children: [
10308
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(ImageCheckbox, { label: "Arrowhead", checked: options.arrow, onChange: (on) => set({ arrow: on }) }),
10244
10309
  "Arrowhead"
10245
10310
  ] })
10246
10311
  ] })
10247
10312
  ] }),
10248
- /* @__PURE__ */ (0, import_jsx_runtime51.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." }),
10249
- error && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("p", { role: "alert", className: "text-destructive", children: error })
10313
+ /* @__PURE__ */ (0, import_jsx_runtime52.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." }),
10314
+ error && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("p", { role: "alert", className: "text-destructive", children: error })
10250
10315
  ] });
10251
10316
  };
10252
10317
 
10253
10318
  // src/image-editor/TypeOptionsBar.tsx
10254
- var import_react72 = require("react");
10319
+ var import_react73 = require("react");
10255
10320
  var import_image_editor23 = require("@pixerate/editor/image-editor");
10256
- var import_jsx_runtime52 = require("react/jsx-runtime");
10321
+ var import_jsx_runtime53 = require("react/jsx-runtime");
10257
10322
  var ALIGN_LABELS = { left: "Left", center: "Centre", right: "Right", justify: "Justify" };
10258
10323
  var ORIENTATION_LABELS = { horizontal: "Horizontal", vertical: "Vertical" };
10259
10324
  var TypeOptionsBar = ({ controller, options, onChange, session, className }) => {
10260
- const [, setTick] = (0, import_react72.useState)(0);
10261
- (0, import_react72.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
10262
- (0, import_react72.useEffect)(() => session?.subscribe(() => setTick((n) => n + 1)), [session]);
10263
- const [error, setError] = (0, import_react72.useState)(null);
10325
+ const [, setTick] = (0, import_react73.useState)(0);
10326
+ (0, import_react73.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
10327
+ (0, import_react73.useEffect)(() => session?.subscribe(() => setTick((n) => n + 1)), [session]);
10328
+ const [error, setError] = (0, import_react73.useState)(null);
10264
10329
  const active = controller.getActiveLayer();
10265
10330
  const typeId = !session && active?.type === "type" ? active.id : null;
10266
10331
  const here = session?.alive ? session.styleHere() : {};
@@ -10313,11 +10378,11 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
10313
10378
  setError(e instanceof Error ? e.message : String(e));
10314
10379
  }
10315
10380
  };
10316
- return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "type-options", children: [
10317
- /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
10318
- /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("label", { className: "flex items-center gap-1", children: [
10381
+ return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "type-options", children: [
10382
+ /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
10383
+ /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("label", { className: "flex items-center gap-1", children: [
10319
10384
  "Font",
10320
- /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
10385
+ /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
10321
10386
  "input",
10322
10387
  {
10323
10388
  list: "pixerate-type-fonts",
@@ -10327,11 +10392,11 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
10327
10392
  className: "w-32 rounded border border-border bg-background px-1 py-0.5"
10328
10393
  }
10329
10394
  ),
10330
- /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("datalist", { id: "pixerate-type-fonts", children: fonts.map((f) => /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("option", { value: f }, f)) })
10395
+ /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("datalist", { id: "pixerate-type-fonts", children: fonts.map((f) => /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("option", { value: f }, f)) })
10331
10396
  ] }),
10332
- /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("label", { className: "flex items-center gap-1", children: [
10397
+ /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("label", { className: "flex items-center gap-1", children: [
10333
10398
  "Size",
10334
- /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
10399
+ /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
10335
10400
  "input",
10336
10401
  {
10337
10402
  type: "number",
@@ -10344,14 +10409,14 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
10344
10409
  }
10345
10410
  )
10346
10411
  ] }),
10347
- /* @__PURE__ */ (0, import_jsx_runtime52.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" }),
10348
- /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("button", { type: "button", "aria-pressed": shown.italic, className: `${imageChipClass(shown.italic)} italic`, onClick: () => style({ italic: !shown.italic }), children: "I" }),
10349
- /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(ImageColor, { label: "Text colour", value: shown.color, onChange: (color) => style({ color }) })
10412
+ /* @__PURE__ */ (0, import_jsx_runtime53.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" }),
10413
+ /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("button", { type: "button", "aria-pressed": shown.italic, className: `${imageChipClass(shown.italic)} italic`, onClick: () => style({ italic: !shown.italic }), children: "I" }),
10414
+ /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(ImageColor, { label: "Text colour", value: shown.color, onChange: (color) => style({ color }) })
10350
10415
  ] }),
10351
- /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Alignment", children: import_image_editor23.TEXT_ALIGNS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("button", { type: "button", "aria-pressed": options.align === a, className: imageChipClass(options.align === a), onClick: () => style({ align: a }), children: ALIGN_LABELS[a] }, a)) }),
10352
- /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Orientation", children: [
10353
- import_image_editor23.TEXT_ORIENTATIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("button", { type: "button", "aria-pressed": orientation === o, className: imageChipClass(orientation === o), onClick: () => orient(o), children: ORIENTATION_LABELS[o] }, o)),
10354
- orientation === "vertical" && editedId && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
10416
+ /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Alignment", children: import_image_editor23.TEXT_ALIGNS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("button", { type: "button", "aria-pressed": options.align === a, className: imageChipClass(options.align === a), onClick: () => style({ align: a }), children: ALIGN_LABELS[a] }, a)) }),
10417
+ /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Orientation", children: [
10418
+ import_image_editor23.TEXT_ORIENTATIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("button", { type: "button", "aria-pressed": orientation === o, className: imageChipClass(orientation === o), onClick: () => orient(o), children: ORIENTATION_LABELS[o] }, o)),
10419
+ orientation === "vertical" && editedId && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
10355
10420
  "button",
10356
10421
  {
10357
10422
  type: "button",
@@ -10363,19 +10428,19 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
10363
10428
  }
10364
10429
  )
10365
10430
  ] }),
10366
- /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("p", { className: "text-[10px] text-muted-foreground", children: "Click to type point text (vertical: a column down from the click), drag for a paragraph box, click text to edit it. Esc finishes." }),
10367
- missing.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("p", { role: "status", className: "text-amber-600", "data-testid": "type-missing-fonts", children: [
10431
+ /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("p", { className: "text-[10px] text-muted-foreground", children: "Click to type point text (vertical: a column down from the click), drag for a paragraph box, click text to edit it. Esc finishes." }),
10432
+ missing.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("p", { role: "status", className: "text-amber-600", "data-testid": "type-missing-fonts", children: [
10368
10433
  "Missing ",
10369
10434
  missing.length === 1 ? "font" : "fonts",
10370
10435
  ": ",
10371
10436
  missing.join(", ")
10372
10437
  ] }),
10373
- error && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("p", { role: "alert", className: "text-destructive", children: error })
10438
+ error && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("p", { role: "alert", className: "text-destructive", children: error })
10374
10439
  ] });
10375
10440
  };
10376
10441
 
10377
10442
  // src/image-editor/ImageEditor.tsx
10378
- var import_jsx_runtime53 = require("react/jsx-runtime");
10443
+ var import_jsx_runtime54 = require("react/jsx-runtime");
10379
10444
  var ImageEditor = ({
10380
10445
  editor: externalEditor,
10381
10446
  src,
@@ -10400,32 +10465,32 @@ var ImageEditor = ({
10400
10465
  return l.type === "pixel" && !!l.generator || l.type === "smart" && !!l.smartFilters?.filters.some((f) => f.kind === "effect") || l.type === "group" && l.children.some(has);
10401
10466
  });
10402
10467
  const legacyProcess = (0, import_image_editor24.normalizeProcessVersion)(state.adjustments.process) < import_image_editor24.LATEST_PROCESS_VERSION;
10403
- const [activeTab, setActiveTab] = (0, import_react73.useState)("crop");
10404
- const rootRef = (0, import_react73.useRef)(null);
10468
+ const [activeTab, setActiveTab] = (0, import_react74.useState)("crop");
10469
+ const rootRef = (0, import_react74.useRef)(null);
10405
10470
  const canvasMode = activeTab === "crop" || activeTab === "select" || activeTab === "paint" || activeTab === "annotate" ? activeTab : "none";
10406
- const activeTabRef = (0, import_react73.useRef)(activeTab);
10471
+ const activeTabRef = (0, import_react74.useRef)(activeTab);
10407
10472
  activeTabRef.current = activeTab;
10408
10473
  const openPanel = async (ref) => {
10409
10474
  if (ref.kind !== "panel" || activeTabRef.current === ref.id) return;
10410
10475
  rootRef.current?.querySelector(`[data-image-tab="${CSS.escape(ref.id)}"]`)?.click();
10411
10476
  await new Promise((resolve) => setTimeout(resolve, 60));
10412
10477
  };
10413
- const [activeCropRatio, setActiveCropRatio] = (0, import_react73.useState)(null);
10414
- const [selectionOptions, setSelectionOptions] = (0, import_react73.useState)(import_image_editor24.DEFAULT_SELECTION_TOOL_OPTIONS);
10415
- const [shapeOptions, setShapeOptions] = (0, import_react73.useState)(import_image_editor24.DEFAULT_SHAPE_TOOL_OPTIONS);
10416
- const [typeOptions, setTypeOptions] = (0, import_react73.useState)(import_image_editor24.DEFAULT_TYPE_TOOL_OPTIONS);
10417
- const [typeSession, setTypeSession] = (0, import_react73.useState)(null);
10418
- const [selectionError, setSelectionError] = (0, import_react73.useState)(null);
10419
- const [paintError, setPaintError] = (0, import_react73.useState)(null);
10420
- const [shapeTypeError, setShapeTypeError] = (0, import_react73.useState)(null);
10478
+ const [activeCropRatio, setActiveCropRatio] = (0, import_react74.useState)(null);
10479
+ const [selectionOptions, setSelectionOptions] = (0, import_react74.useState)(import_image_editor24.DEFAULT_SELECTION_TOOL_OPTIONS);
10480
+ const [shapeOptions, setShapeOptions] = (0, import_react74.useState)(import_image_editor24.DEFAULT_SHAPE_TOOL_OPTIONS);
10481
+ const [typeOptions, setTypeOptions] = (0, import_react74.useState)(import_image_editor24.DEFAULT_TYPE_TOOL_OPTIONS);
10482
+ const [typeSession, setTypeSession] = (0, import_react74.useState)(null);
10483
+ const [selectionError, setSelectionError] = (0, import_react74.useState)(null);
10484
+ const [paintError, setPaintError] = (0, import_react74.useState)(null);
10485
+ const [shapeTypeError, setShapeTypeError] = (0, import_react74.useState)(null);
10421
10486
  const handleCanvasError = (source, message2) => {
10422
10487
  if (source === "paint") setPaintError(message2);
10423
10488
  else if (source === "select") setSelectionError(message2);
10424
10489
  else setShapeTypeError(message2);
10425
10490
  };
10426
10491
  const finishTyping = () => setTypeSession(null);
10427
- const transformToolRef = (0, import_react73.useRef)(null);
10428
- const transformControllerRef = (0, import_react73.useRef)(controller);
10492
+ const transformToolRef = (0, import_react74.useRef)(null);
10493
+ const transformControllerRef = (0, import_react74.useRef)(controller);
10429
10494
  if (!transformToolRef.current || transformControllerRef.current !== controller) {
10430
10495
  transformToolRef.current?.cancel();
10431
10496
  transformToolRef.current = new import_image_editor24.FreeTransformTool(controller, {
@@ -10434,16 +10499,16 @@ var ImageEditor = ({
10434
10499
  transformControllerRef.current = controller;
10435
10500
  }
10436
10501
  const transformTool = transformToolRef.current;
10437
- const [, setTransformTick] = (0, import_react73.useState)(0);
10438
- (0, import_react73.useEffect)(() => transformTool.subscribe(() => setTransformTick((n) => n + 1)), [transformTool]);
10439
- (0, import_react73.useEffect)(() => () => transformToolRef.current?.cancel(), []);
10440
- const [inpaintPrompt, setInpaintPrompt] = (0, import_react73.useState)("");
10441
- const [inpaintMaskMode, setInpaintMaskMode] = (0, import_react73.useState)("annotations");
10442
- const [isRemovingBg, setIsRemovingBg] = (0, import_react73.useState)(false);
10443
- const [isInpainting, setIsInpainting] = (0, import_react73.useState)(false);
10444
- const [aiError, setAiError] = (0, import_react73.useState)(null);
10445
- const [aiSuccess, setAiSuccess] = (0, import_react73.useState)(null);
10446
- const [aiTarget, setAiTarget] = (0, import_react73.useState)("auto");
10502
+ const [, setTransformTick] = (0, import_react74.useState)(0);
10503
+ (0, import_react74.useEffect)(() => transformTool.subscribe(() => setTransformTick((n) => n + 1)), [transformTool]);
10504
+ (0, import_react74.useEffect)(() => () => transformToolRef.current?.cancel(), []);
10505
+ const [inpaintPrompt, setInpaintPrompt] = (0, import_react74.useState)("");
10506
+ const [inpaintMaskMode, setInpaintMaskMode] = (0, import_react74.useState)("annotations");
10507
+ const [isRemovingBg, setIsRemovingBg] = (0, import_react74.useState)(false);
10508
+ const [isInpainting, setIsInpainting] = (0, import_react74.useState)(false);
10509
+ const [aiError, setAiError] = (0, import_react74.useState)(null);
10510
+ const [aiSuccess, setAiSuccess] = (0, import_react74.useState)(null);
10511
+ const [aiTarget, setAiTarget] = (0, import_react74.useState)("auto");
10447
10512
  const aiOptions = aiTarget === "auto" ? {} : { target: aiTarget };
10448
10513
  const effectiveOnInpaint = onInpaint || aiHooks?.onInpaint;
10449
10514
  const effectiveOnRemoveBg = onRemoveBackground || aiHooks?.onRemoveBackground;
@@ -10506,11 +10571,11 @@ var ImageEditor = ({
10506
10571
  setIsInpainting(false);
10507
10572
  }
10508
10573
  };
10509
- const [activeColor, setActiveColor] = (0, import_react73.useState)("#ef4444");
10510
- const [strokeWidth, setStrokeWidth] = (0, import_react73.useState)(3);
10511
- const [fontSize, setFontSize] = (0, import_react73.useState)(24);
10512
- const [textInput, setTextInput] = (0, import_react73.useState)("");
10513
- (0, import_react73.useEffect)(() => {
10574
+ const [activeColor, setActiveColor] = (0, import_react74.useState)("#ef4444");
10575
+ const [strokeWidth, setStrokeWidth] = (0, import_react74.useState)(3);
10576
+ const [fontSize, setFontSize] = (0, import_react74.useState)(24);
10577
+ const [textInput, setTextInput] = (0, import_react74.useState)("");
10578
+ (0, import_react74.useEffect)(() => {
10514
10579
  if (activeTab === "crop" && editor.state.activeTool !== "crop") {
10515
10580
  editor.setTool("crop");
10516
10581
  }
@@ -10538,16 +10603,16 @@ var ImageEditor = ({
10538
10603
  link.click();
10539
10604
  }
10540
10605
  };
10541
- return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(
10606
+ return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
10542
10607
  "div",
10543
10608
  {
10544
10609
  ref: rootRef,
10545
10610
  className: `${imageEditorFrameClass} ${className}`,
10546
10611
  style,
10547
10612
  children: [
10548
- /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: imageEditorHeaderClass, children: [
10549
- /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { role: "tablist", className: imageTabListClass, children: [
10550
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
10613
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: imageEditorHeaderClass, children: [
10614
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { role: "tablist", className: imageTabListClass, children: [
10615
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
10551
10616
  "button",
10552
10617
  {
10553
10618
  type: "button",
@@ -10562,7 +10627,7 @@ var ImageEditor = ({
10562
10627
  children: "Transform & Crop"
10563
10628
  }
10564
10629
  ),
10565
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
10630
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
10566
10631
  "button",
10567
10632
  {
10568
10633
  type: "button",
@@ -10577,7 +10642,7 @@ var ImageEditor = ({
10577
10642
  children: "Adjustments"
10578
10643
  }
10579
10644
  ),
10580
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
10645
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
10581
10646
  "button",
10582
10647
  {
10583
10648
  type: "button",
@@ -10592,7 +10657,7 @@ var ImageEditor = ({
10592
10657
  children: "Layers"
10593
10658
  }
10594
10659
  ),
10595
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
10660
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
10596
10661
  "button",
10597
10662
  {
10598
10663
  type: "button",
@@ -10607,7 +10672,7 @@ var ImageEditor = ({
10607
10672
  children: "Paint"
10608
10673
  }
10609
10674
  ),
10610
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
10675
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
10611
10676
  "button",
10612
10677
  {
10613
10678
  type: "button",
@@ -10622,7 +10687,7 @@ var ImageEditor = ({
10622
10687
  children: "Select & Mask"
10623
10688
  }
10624
10689
  ),
10625
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
10690
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
10626
10691
  "button",
10627
10692
  {
10628
10693
  type: "button",
@@ -10637,7 +10702,7 @@ var ImageEditor = ({
10637
10702
  children: "Annotations"
10638
10703
  }
10639
10704
  ),
10640
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
10705
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
10641
10706
  "button",
10642
10707
  {
10643
10708
  type: "button",
@@ -10652,7 +10717,7 @@ var ImageEditor = ({
10652
10717
  children: "Depth Mask"
10653
10718
  }
10654
10719
  ),
10655
- /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(
10720
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
10656
10721
  "button",
10657
10722
  {
10658
10723
  type: "button",
@@ -10665,14 +10730,14 @@ var ImageEditor = ({
10665
10730
  "aria-selected": activeTab === "ai",
10666
10731
  className: `${imageTabClass(activeTab === "ai")} flex items-center gap-1.5`,
10667
10732
  children: [
10668
- /* @__PURE__ */ (0, import_jsx_runtime53.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_runtime53.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" }) }),
10733
+ /* @__PURE__ */ (0, import_jsx_runtime54.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_runtime54.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" }) }),
10669
10734
  "AI Tools"
10670
10735
  ]
10671
10736
  }
10672
10737
  )
10673
10738
  ] }),
10674
- /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex items-center gap-2 text-xs", children: [
10675
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
10739
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex items-center gap-2 text-xs", children: [
10740
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
10676
10741
  "button",
10677
10742
  {
10678
10743
  type: "button",
@@ -10683,7 +10748,7 @@ var ImageEditor = ({
10683
10748
  children: "\u21A9"
10684
10749
  }
10685
10750
  ),
10686
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
10751
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
10687
10752
  "button",
10688
10753
  {
10689
10754
  type: "button",
@@ -10694,7 +10759,7 @@ var ImageEditor = ({
10694
10759
  children: "\u21AA"
10695
10760
  }
10696
10761
  ),
10697
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
10762
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
10698
10763
  "button",
10699
10764
  {
10700
10765
  type: "button",
@@ -10703,8 +10768,8 @@ var ImageEditor = ({
10703
10768
  children: "Reset"
10704
10769
  }
10705
10770
  ),
10706
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: "h-4 w-px bg-muted mx-1" }),
10707
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
10771
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "h-4 w-px bg-muted mx-1" }),
10772
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
10708
10773
  "button",
10709
10774
  {
10710
10775
  type: "button",
@@ -10714,11 +10779,11 @@ var ImageEditor = ({
10714
10779
  children: "-"
10715
10780
  }
10716
10781
  ),
10717
- /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("span", { className: "font-mono text-muted-foreground w-10 text-center", children: [
10782
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("span", { className: "font-mono text-muted-foreground w-10 text-center", children: [
10718
10783
  Math.round(state.zoom * 100),
10719
10784
  "%"
10720
10785
  ] }),
10721
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
10786
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
10722
10787
  "button",
10723
10788
  {
10724
10789
  type: "button",
@@ -10728,8 +10793,8 @@ var ImageEditor = ({
10728
10793
  children: "+"
10729
10794
  }
10730
10795
  ),
10731
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: "h-4 w-px bg-muted mx-1" }),
10732
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
10796
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "h-4 w-px bg-muted mx-1" }),
10797
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
10733
10798
  "button",
10734
10799
  {
10735
10800
  type: "button",
@@ -10740,7 +10805,7 @@ var ImageEditor = ({
10740
10805
  children: "Hold Compare"
10741
10806
  }
10742
10807
  ),
10743
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
10808
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
10744
10809
  "button",
10745
10810
  {
10746
10811
  type: "button",
@@ -10751,10 +10816,10 @@ var ImageEditor = ({
10751
10816
  )
10752
10817
  ] })
10753
10818
  ] }),
10754
- transformTool.active && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(FreeTransformOptionsBar, { tool: transformTool, className: "border-b border-border bg-background/95 px-4 py-2" }),
10755
- !transformTool.active && transformTool.error && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { role: "alert", className: imageErrorBannerClass, children: transformTool.error }),
10756
- /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex flex-col md:flex-row flex-1 min-h-[520px] md:h-[560px]", children: [
10757
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
10819
+ transformTool.active && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(FreeTransformOptionsBar, { tool: transformTool, className: "border-b border-border bg-background/95 px-4 py-2" }),
10820
+ !transformTool.active && transformTool.error && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { role: "alert", className: imageErrorBannerClass, children: transformTool.error }),
10821
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex flex-col md:flex-row flex-1 min-h-[520px] md:h-[560px]", children: [
10822
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
10758
10823
  ImageEditorCanvas,
10759
10824
  {
10760
10825
  editor,
@@ -10778,11 +10843,11 @@ var ImageEditor = ({
10778
10843
  className: "flex-1 h-[360px] md:h-full min-h-[320px] bg-muted"
10779
10844
  }
10780
10845
  ),
10781
- /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: imageSidebarClass, children: [
10782
- activeTab === "crop" && /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
10783
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: imageSectionTitleClass, children: "Aspect Ratio Presets" }),
10784
- /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "grid grid-cols-3 gap-2", children: [
10785
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
10846
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: imageSidebarClass, children: [
10847
+ activeTab === "crop" && /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
10848
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: imageSectionTitleClass, children: "Aspect Ratio Presets" }),
10849
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "grid grid-cols-3 gap-2", children: [
10850
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
10786
10851
  "button",
10787
10852
  {
10788
10853
  type: "button",
@@ -10794,7 +10859,7 @@ var ImageEditor = ({
10794
10859
  children: "Freeform"
10795
10860
  }
10796
10861
  ),
10797
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
10862
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
10798
10863
  "button",
10799
10864
  {
10800
10865
  type: "button",
@@ -10806,7 +10871,7 @@ var ImageEditor = ({
10806
10871
  children: "1:1 Square"
10807
10872
  }
10808
10873
  ),
10809
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
10874
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
10810
10875
  "button",
10811
10876
  {
10812
10877
  type: "button",
@@ -10818,7 +10883,7 @@ var ImageEditor = ({
10818
10883
  children: "4:3 Standard"
10819
10884
  }
10820
10885
  ),
10821
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
10886
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
10822
10887
  "button",
10823
10888
  {
10824
10889
  type: "button",
@@ -10830,7 +10895,7 @@ var ImageEditor = ({
10830
10895
  children: "16:9 Wide"
10831
10896
  }
10832
10897
  ),
10833
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
10898
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
10834
10899
  "button",
10835
10900
  {
10836
10901
  type: "button",
@@ -10842,7 +10907,7 @@ var ImageEditor = ({
10842
10907
  children: "3:2 Photo"
10843
10908
  }
10844
10909
  ),
10845
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
10910
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
10846
10911
  "button",
10847
10912
  {
10848
10913
  type: "button",
@@ -10855,10 +10920,10 @@ var ImageEditor = ({
10855
10920
  }
10856
10921
  )
10857
10922
  ] }),
10858
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: imageDividerClass }),
10859
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: imageSectionTitleClass, children: "Orientation & Flips" }),
10860
- /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "grid grid-cols-2 gap-2", children: [
10861
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
10923
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: imageDividerClass }),
10924
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: imageSectionTitleClass, children: "Orientation & Flips" }),
10925
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "grid grid-cols-2 gap-2", children: [
10926
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
10862
10927
  "button",
10863
10928
  {
10864
10929
  type: "button",
@@ -10867,7 +10932,7 @@ var ImageEditor = ({
10867
10932
  children: "Rotate -90\xB0"
10868
10933
  }
10869
10934
  ),
10870
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
10935
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
10871
10936
  "button",
10872
10937
  {
10873
10938
  type: "button",
@@ -10876,7 +10941,7 @@ var ImageEditor = ({
10876
10941
  children: "Rotate +90\xB0"
10877
10942
  }
10878
10943
  ),
10879
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
10944
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
10880
10945
  "button",
10881
10946
  {
10882
10947
  type: "button",
@@ -10885,7 +10950,7 @@ var ImageEditor = ({
10885
10950
  children: "Flip Horizontal"
10886
10951
  }
10887
10952
  ),
10888
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
10953
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
10889
10954
  "button",
10890
10955
  {
10891
10956
  type: "button",
@@ -10896,10 +10961,10 @@ var ImageEditor = ({
10896
10961
  )
10897
10962
  ] })
10898
10963
  ] }),
10899
- activeTab === "adjust" && /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
10900
- /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex items-center justify-between", children: [
10901
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: imageSectionTitleClass, children: "Color Adjustments" }),
10902
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
10964
+ activeTab === "adjust" && /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
10965
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex items-center justify-between", children: [
10966
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: imageSectionTitleClass, children: "Color Adjustments" }),
10967
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
10903
10968
  "button",
10904
10969
  {
10905
10970
  type: "button",
@@ -10909,9 +10974,9 @@ var ImageEditor = ({
10909
10974
  }
10910
10975
  )
10911
10976
  ] }),
10912
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(Histogram, { histogram: editor.histogram }),
10913
- import_image_editor24.IMAGE_ADJUSTMENT_CONTROLS.map((spec) => /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(import_react73.default.Fragment, { children: [
10914
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
10977
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(Histogram, { histogram: editor.histogram }),
10978
+ import_image_editor24.IMAGE_ADJUSTMENT_CONTROLS.map((spec) => /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(import_react74.default.Fragment, { children: [
10979
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
10915
10980
  ControlSlider,
10916
10981
  {
10917
10982
  spec,
@@ -10920,14 +10985,14 @@ var ImageEditor = ({
10920
10985
  onChange: (v) => editor.setAdjustments({ [spec.id]: v })
10921
10986
  }
10922
10987
  ),
10923
- spec.id === "tint" && legacyProcess && /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(
10988
+ spec.id === "tint" && legacyProcess && /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
10924
10989
  "div",
10925
10990
  {
10926
10991
  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",
10927
10992
  "data-testid": "image-editor-process-notice",
10928
10993
  children: [
10929
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { children: "Legacy rendering (process 1). Tint needs the current process." }),
10930
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
10994
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { children: "Legacy rendering (process 1). Tint needs the current process." }),
10995
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
10931
10996
  "button",
10932
10997
  {
10933
10998
  type: "button",
@@ -10940,7 +11005,7 @@ var ImageEditor = ({
10940
11005
  }
10941
11006
  )
10942
11007
  ] }, spec.id)),
10943
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: imageSectionClass, children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
11008
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: imageSectionClass, children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
10944
11009
  AdjustmentLayersPanel,
10945
11010
  {
10946
11011
  controller,
@@ -10949,9 +11014,9 @@ var ImageEditor = ({
10949
11014
  }
10950
11015
  ) })
10951
11016
  ] }),
10952
- activeTab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
10953
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: imageSectionTitleClass, children: "Layers" }),
10954
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
11017
+ activeTab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
11018
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: imageSectionTitleClass, children: "Layers" }),
11019
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
10955
11020
  "button",
10956
11021
  {
10957
11022
  type: "button",
@@ -10962,15 +11027,15 @@ var ImageEditor = ({
10962
11027
  children: "Free Transform"
10963
11028
  }
10964
11029
  ),
10965
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(LayersPanel, { controller }),
10966
- effectsShown && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(ImageProviderEffectsPanel, { controller, className: imageSectionClass }),
10967
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: imageSectionTitleClass, children: "Colour" }),
10968
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(ColorProfilePanel, { controller })
11030
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(LayersPanel, { controller }),
11031
+ effectsShown && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(ImageProviderEffectsPanel, { controller, className: imageSectionClass }),
11032
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: imageSectionTitleClass, children: "Colour" }),
11033
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(ColorProfilePanel, { controller })
10969
11034
  ] }),
10970
- activeTab === "paint" && /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
10971
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: imageSectionTitleClass, children: "Paint" }),
10972
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(BrushOptionsBar, { controller }),
10973
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
11035
+ activeTab === "paint" && /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
11036
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: imageSectionTitleClass, children: "Paint" }),
11037
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(BrushOptionsBar, { controller }),
11038
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
10974
11039
  "button",
10975
11040
  {
10976
11041
  type: "button",
@@ -10981,12 +11046,12 @@ var ImageEditor = ({
10981
11046
  children: "Free Transform"
10982
11047
  }
10983
11048
  ),
10984
- paintError && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("p", { role: "alert", className: "text-destructive", "data-testid": "paint-error", children: paintError }),
10985
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: imageSectionClass, children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(LayersPanel, { controller }) })
11049
+ paintError && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("p", { role: "alert", className: "text-destructive", "data-testid": "paint-error", children: paintError }),
11050
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: imageSectionClass, children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(LayersPanel, { controller }) })
10986
11051
  ] }),
10987
- activeTab === "annotate" && /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
10988
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: imageSectionTitleClass, children: "Shape & Type Layers, Paths" }),
10989
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: "grid grid-cols-2 gap-1.5", children: ["shape", "type", "path-pen", "path-select", "direct-select"].map((t) => /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
11052
+ activeTab === "annotate" && /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
11053
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: imageSectionTitleClass, children: "Shape & Type Layers, Paths" }),
11054
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "grid grid-cols-2 gap-1.5", children: ["shape", "type", "path-pen", "path-select", "direct-select"].map((t) => /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
10990
11055
  "button",
10991
11056
  {
10992
11057
  type: "button",
@@ -10997,13 +11062,13 @@ var ImageEditor = ({
10997
11062
  },
10998
11063
  t
10999
11064
  )) }),
11000
- state.activeTool === "shape" && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(ShapeOptionsBar, { controller, options: shapeOptions, onChange: setShapeOptions }),
11001
- state.activeTool === "type" && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(TypeOptionsBar, { controller, options: typeOptions, onChange: setTypeOptions, session: typeSession }),
11002
- state.activeTool === "type" && typeSession && /* @__PURE__ */ (0, import_jsx_runtime53.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" }),
11003
- shapeTypeError && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("p", { role: "alert", className: "text-destructive", "data-testid": "shape-type-error", children: shapeTypeError }),
11004
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: imageDividerClass }),
11005
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: imageSectionTitleClass, children: "Draw & Annotate" }),
11006
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: "grid grid-cols-3 gap-1.5", children: ["pen", "rect", "circle", "arrow", "line"].map((t) => /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
11065
+ state.activeTool === "shape" && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(ShapeOptionsBar, { controller, options: shapeOptions, onChange: setShapeOptions }),
11066
+ state.activeTool === "type" && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(TypeOptionsBar, { controller, options: typeOptions, onChange: setTypeOptions, session: typeSession }),
11067
+ state.activeTool === "type" && typeSession && /* @__PURE__ */ (0, import_jsx_runtime54.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" }),
11068
+ shapeTypeError && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("p", { role: "alert", className: "text-destructive", "data-testid": "shape-type-error", children: shapeTypeError }),
11069
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: imageDividerClass }),
11070
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: imageSectionTitleClass, children: "Draw & Annotate" }),
11071
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "grid grid-cols-3 gap-1.5", children: ["pen", "rect", "circle", "arrow", "line"].map((t) => /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
11007
11072
  "button",
11008
11073
  {
11009
11074
  type: "button",
@@ -11013,18 +11078,18 @@ var ImageEditor = ({
11013
11078
  },
11014
11079
  t
11015
11080
  )) }),
11016
- /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex items-center gap-2 mt-2", children: [
11017
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("label", { className: "text-muted-foreground", children: "Color:" }),
11018
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(ImageColor, { label: "Annotation colour", value: activeColor, onChange: setActiveColor }),
11019
- /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex-1 ml-2", children: [
11020
- /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-0.5", children: [
11021
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { children: "Width:" }),
11022
- /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("span", { className: "font-mono", children: [
11081
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex items-center gap-2 mt-2", children: [
11082
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("label", { className: "text-muted-foreground", children: "Color:" }),
11083
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(ImageColor, { label: "Annotation colour", value: activeColor, onChange: setActiveColor }),
11084
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex-1 ml-2", children: [
11085
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-0.5", children: [
11086
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { children: "Width:" }),
11087
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("span", { className: "font-mono", children: [
11023
11088
  strokeWidth,
11024
11089
  "px"
11025
11090
  ] })
11026
11091
  ] }),
11027
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
11092
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
11028
11093
  "input",
11029
11094
  {
11030
11095
  type: "range",
@@ -11037,10 +11102,10 @@ var ImageEditor = ({
11037
11102
  )
11038
11103
  ] })
11039
11104
  ] }),
11040
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: imageDividerClass }),
11041
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: imageSectionTitleClass, children: "Add Text" }),
11042
- /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex gap-2", children: [
11043
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
11105
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: imageDividerClass }),
11106
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: imageSectionTitleClass, children: "Add Text" }),
11107
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex gap-2", children: [
11108
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
11044
11109
  "input",
11045
11110
  {
11046
11111
  type: "text",
@@ -11051,7 +11116,7 @@ var ImageEditor = ({
11051
11116
  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"
11052
11117
  }
11053
11118
  ),
11054
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
11119
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
11055
11120
  "button",
11056
11121
  {
11057
11122
  type: "button",
@@ -11061,14 +11126,14 @@ var ImageEditor = ({
11061
11126
  }
11062
11127
  )
11063
11128
  ] }),
11064
- /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex items-center justify-between text-muted-foreground", children: [
11065
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { children: "Font Size:" }),
11066
- /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("span", { className: "font-mono", children: [
11129
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex items-center justify-between text-muted-foreground", children: [
11130
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { children: "Font Size:" }),
11131
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("span", { className: "font-mono", children: [
11067
11132
  fontSize,
11068
11133
  "px"
11069
11134
  ] })
11070
11135
  ] }),
11071
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
11136
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
11072
11137
  "input",
11073
11138
  {
11074
11139
  type: "range",
@@ -11079,14 +11144,14 @@ var ImageEditor = ({
11079
11144
  className: imageRangeClass
11080
11145
  }
11081
11146
  ),
11082
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: imageDividerClass }),
11083
- /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex items-center justify-between", children: [
11084
- /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("span", { className: "text-muted-foreground", children: [
11147
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: imageDividerClass }),
11148
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex items-center justify-between", children: [
11149
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("span", { className: "text-muted-foreground", children: [
11085
11150
  "Layers (",
11086
11151
  state.annotations.length,
11087
11152
  ")"
11088
11153
  ] }),
11089
- state.selectedAnnotationId && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
11154
+ state.selectedAnnotationId && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
11090
11155
  "button",
11091
11156
  {
11092
11157
  type: "button",
@@ -11095,7 +11160,7 @@ var ImageEditor = ({
11095
11160
  children: "Delete Selected"
11096
11161
  }
11097
11162
  ),
11098
- state.annotations.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
11163
+ state.annotations.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
11099
11164
  "button",
11100
11165
  {
11101
11166
  type: "button",
@@ -11106,10 +11171,10 @@ var ImageEditor = ({
11106
11171
  )
11107
11172
  ] })
11108
11173
  ] }),
11109
- activeTab === "depth" && /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
11110
- /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex items-center justify-between", children: [
11111
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: imageSectionTitleClass, children: "Depth Masking" }),
11112
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
11174
+ activeTab === "depth" && /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
11175
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex items-center justify-between", children: [
11176
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: imageSectionTitleClass, children: "Depth Masking" }),
11177
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
11113
11178
  "button",
11114
11179
  {
11115
11180
  type: "button",
@@ -11119,8 +11184,8 @@ var ImageEditor = ({
11119
11184
  }
11120
11185
  )
11121
11186
  ] }),
11122
- /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("label", { className: "flex items-center gap-2 cursor-pointer text-foreground", children: [
11123
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
11187
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("label", { className: "flex items-center gap-2 cursor-pointer text-foreground", children: [
11188
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
11124
11189
  "input",
11125
11190
  {
11126
11191
  type: "checkbox",
@@ -11129,12 +11194,12 @@ var ImageEditor = ({
11129
11194
  className: "rounded accent-primary"
11130
11195
  }
11131
11196
  ),
11132
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { children: "Enable Depth / Alpha Mask" })
11197
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { children: "Enable Depth / Alpha Mask" })
11133
11198
  ] }),
11134
- state.depthMask.enabled && /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(import_jsx_runtime53.Fragment, { children: [
11135
- /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { children: [
11136
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("label", { className: "text-muted-foreground block mb-1", children: "Mask Image URL:" }),
11137
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
11199
+ state.depthMask.enabled && /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(import_jsx_runtime54.Fragment, { children: [
11200
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { children: [
11201
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("label", { className: "text-muted-foreground block mb-1", children: "Mask Image URL:" }),
11202
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
11138
11203
  "input",
11139
11204
  {
11140
11205
  type: "text",
@@ -11145,8 +11210,8 @@ var ImageEditor = ({
11145
11210
  }
11146
11211
  )
11147
11212
  ] }),
11148
- /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex gap-2", children: [
11149
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
11213
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex gap-2", children: [
11214
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
11150
11215
  "button",
11151
11216
  {
11152
11217
  type: "button",
@@ -11155,7 +11220,7 @@ var ImageEditor = ({
11155
11220
  children: "Threshold Mode"
11156
11221
  }
11157
11222
  ),
11158
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
11223
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
11159
11224
  "button",
11160
11225
  {
11161
11226
  type: "button",
@@ -11165,12 +11230,12 @@ var ImageEditor = ({
11165
11230
  }
11166
11231
  )
11167
11232
  ] }),
11168
- /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { children: [
11169
- /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
11170
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { children: "Depth Start (Lower):" }),
11171
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: "font-mono", children: state.depthMask.depthRange[0] })
11233
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { children: [
11234
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
11235
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { children: "Depth Start (Lower):" }),
11236
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "font-mono", children: state.depthMask.depthRange[0] })
11172
11237
  ] }),
11173
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
11238
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
11174
11239
  "input",
11175
11240
  {
11176
11241
  type: "range",
@@ -11184,12 +11249,12 @@ var ImageEditor = ({
11184
11249
  }
11185
11250
  )
11186
11251
  ] }),
11187
- /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { children: [
11188
- /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
11189
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { children: "Depth Stop (Upper):" }),
11190
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: "font-mono", children: state.depthMask.depthRange[1] })
11252
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { children: [
11253
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
11254
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { children: "Depth Stop (Upper):" }),
11255
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "font-mono", children: state.depthMask.depthRange[1] })
11191
11256
  ] }),
11192
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
11257
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
11193
11258
  "input",
11194
11259
  {
11195
11260
  type: "range",
@@ -11203,12 +11268,12 @@ var ImageEditor = ({
11203
11268
  }
11204
11269
  )
11205
11270
  ] }),
11206
- /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { children: [
11207
- /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
11208
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { children: "Softness:" }),
11209
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: "font-mono", children: state.depthMask.softness })
11271
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { children: [
11272
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
11273
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { children: "Softness:" }),
11274
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "font-mono", children: state.depthMask.softness })
11210
11275
  ] }),
11211
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
11276
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
11212
11277
  "input",
11213
11278
  {
11214
11279
  type: "range",
@@ -11220,8 +11285,8 @@ var ImageEditor = ({
11220
11285
  }
11221
11286
  )
11222
11287
  ] }),
11223
- /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("label", { className: "flex items-center gap-2 cursor-pointer text-foreground mt-1", children: [
11224
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
11288
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("label", { className: "flex items-center gap-2 cursor-pointer text-foreground mt-1", children: [
11289
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
11225
11290
  "input",
11226
11291
  {
11227
11292
  type: "checkbox",
@@ -11230,12 +11295,12 @@ var ImageEditor = ({
11230
11295
  className: "rounded accent-primary"
11231
11296
  }
11232
11297
  ),
11233
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { children: "Invert Mask" })
11298
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { children: "Invert Mask" })
11234
11299
  ] })
11235
11300
  ] })
11236
11301
  ] }),
11237
- activeTab === "select" && /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
11238
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
11302
+ activeTab === "select" && /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
11303
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
11239
11304
  SelectionOptionsBar,
11240
11305
  {
11241
11306
  controller,
@@ -11246,9 +11311,9 @@ var ImageEditor = ({
11246
11311
  selectionDisplay: state.selectionDisplay
11247
11312
  }
11248
11313
  ),
11249
- selectionError && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("p", { role: "alert", className: "text-destructive", children: selectionError }),
11250
- /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex gap-1", children: [
11251
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
11314
+ selectionError && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("p", { role: "alert", className: "text-destructive", children: selectionError }),
11315
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex gap-1", children: [
11316
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
11252
11317
  "button",
11253
11318
  {
11254
11319
  type: "button",
@@ -11259,7 +11324,7 @@ var ImageEditor = ({
11259
11324
  children: "Transform Selection"
11260
11325
  }
11261
11326
  ),
11262
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
11327
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
11263
11328
  "button",
11264
11329
  {
11265
11330
  type: "button",
@@ -11271,14 +11336,14 @@ var ImageEditor = ({
11271
11336
  }
11272
11337
  )
11273
11338
  ] }),
11274
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(RefineEdgePanel, { controller, selection: state.selection ?? null, layers: state.adjustments.layers }),
11275
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(ChannelsPanel, { controller }),
11276
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(PathsPanel, { controller })
11339
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(RefineEdgePanel, { controller, selection: state.selection ?? null, layers: state.adjustments.layers }),
11340
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(ChannelsPanel, { controller }),
11341
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(PathsPanel, { controller })
11277
11342
  ] }),
11278
- activeTab === "ai" && /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
11279
- /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("label", { className: "flex items-center justify-between gap-2 text-foreground", children: [
11280
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { children: "Results go to" }),
11281
- /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(
11343
+ activeTab === "ai" && /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
11344
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("label", { className: "flex items-center justify-between gap-2 text-foreground", children: [
11345
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { children: "Results go to" }),
11346
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
11282
11347
  "select",
11283
11348
  {
11284
11349
  "aria-label": "AI result target",
@@ -11286,54 +11351,54 @@ var ImageEditor = ({
11286
11351
  onChange: (e) => setAiTarget(e.target.value),
11287
11352
  className: imageSelectClass,
11288
11353
  children: [
11289
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("option", { value: "auto", children: controller.isMultiLayer ? "Auto (new layer)" : "Auto (replace image)" }),
11290
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("option", { value: "new-layer", children: "New layer / mask" }),
11291
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("option", { value: "replace", children: "Replace image" })
11354
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("option", { value: "auto", children: controller.isMultiLayer ? "Auto (new layer)" : "Auto (replace image)" }),
11355
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("option", { value: "new-layer", children: "New layer / mask" }),
11356
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("option", { value: "replace", children: "Replace image" })
11292
11357
  ]
11293
11358
  }
11294
11359
  )
11295
11360
  ] }),
11296
- /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
11297
- /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex items-center justify-between", children: [
11298
- /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
11299
- /* @__PURE__ */ (0, import_jsx_runtime53.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_runtime53.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" }) }),
11361
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
11362
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex items-center justify-between", children: [
11363
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
11364
+ /* @__PURE__ */ (0, import_jsx_runtime54.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_runtime54.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" }) }),
11300
11365
  "Background Removal"
11301
11366
  ] }),
11302
- isRemovingBg && /* @__PURE__ */ (0, import_jsx_runtime53.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..." })
11367
+ isRemovingBg && /* @__PURE__ */ (0, import_jsx_runtime54.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..." })
11303
11368
  ] }),
11304
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Isolate foreground subject with AI alpha transparency segmentation." }),
11305
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
11369
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Isolate foreground subject with AI alpha transparency segmentation." }),
11370
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
11306
11371
  "button",
11307
11372
  {
11308
11373
  type: "button",
11309
11374
  onClick: handleRemoveBackground,
11310
11375
  disabled: isRemovingBg || isInpainting,
11311
11376
  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",
11312
- children: isRemovingBg ? /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(import_jsx_runtime53.Fragment, { children: [
11313
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: imageSpinnerClass }),
11377
+ children: isRemovingBg ? /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(import_jsx_runtime54.Fragment, { children: [
11378
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: imageSpinnerClass }),
11314
11379
  "Removing Background..."
11315
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(import_jsx_runtime53.Fragment, { children: [
11316
- /* @__PURE__ */ (0, import_jsx_runtime53.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_runtime53.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" }) }),
11380
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(import_jsx_runtime54.Fragment, { children: [
11381
+ /* @__PURE__ */ (0, import_jsx_runtime54.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_runtime54.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" }) }),
11317
11382
  "Remove Background"
11318
11383
  ] })
11319
11384
  }
11320
11385
  )
11321
11386
  ] }),
11322
- /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
11323
- /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex items-center justify-between", children: [
11324
- /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
11325
- /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("svg", { className: "w-3.5 h-3.5 text-primary", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
11326
- /* @__PURE__ */ (0, import_jsx_runtime53.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" }),
11327
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("path", { d: "m14 7 3 3" })
11387
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
11388
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex items-center justify-between", children: [
11389
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
11390
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("svg", { className: "w-3.5 h-3.5 text-primary", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
11391
+ /* @__PURE__ */ (0, import_jsx_runtime54.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" }),
11392
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("path", { d: "m14 7 3 3" })
11328
11393
  ] }),
11329
11394
  "Generative Inpainting"
11330
11395
  ] }),
11331
- isInpainting && /* @__PURE__ */ (0, import_jsx_runtime53.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..." })
11396
+ isInpainting && /* @__PURE__ */ (0, import_jsx_runtime54.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..." })
11332
11397
  ] }),
11333
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Replace, modify, or fill selected regions using prompt-guided generative inpainting." }),
11334
- /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex flex-col gap-1", children: [
11335
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("label", { htmlFor: "ai-inpaint-prompt-react", className: "text-foreground text-[11px] font-medium", children: "Prompt" }),
11336
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
11398
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Replace, modify, or fill selected regions using prompt-guided generative inpainting." }),
11399
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex flex-col gap-1", children: [
11400
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("label", { htmlFor: "ai-inpaint-prompt-react", className: "text-foreground text-[11px] font-medium", children: "Prompt" }),
11401
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
11337
11402
  "textarea",
11338
11403
  {
11339
11404
  id: "ai-inpaint-prompt-react",
@@ -11345,10 +11410,10 @@ var ImageEditor = ({
11345
11410
  }
11346
11411
  )
11347
11412
  ] }),
11348
- /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex flex-col gap-1", children: [
11349
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: "text-foreground text-[11px] font-medium", children: "Target Mask Region" }),
11350
- /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "grid grid-cols-2 gap-1.5", children: [
11351
- /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(
11413
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex flex-col gap-1", children: [
11414
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "text-foreground text-[11px] font-medium", children: "Target Mask Region" }),
11415
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "grid grid-cols-2 gap-1.5", children: [
11416
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
11352
11417
  "button",
11353
11418
  {
11354
11419
  type: "button",
@@ -11361,7 +11426,7 @@ var ImageEditor = ({
11361
11426
  ]
11362
11427
  }
11363
11428
  ),
11364
- /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(
11429
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
11365
11430
  "button",
11366
11431
  {
11367
11432
  type: "button",
@@ -11376,25 +11441,25 @@ var ImageEditor = ({
11376
11441
  )
11377
11442
  ] })
11378
11443
  ] }),
11379
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
11444
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
11380
11445
  "button",
11381
11446
  {
11382
11447
  type: "button",
11383
11448
  onClick: handleInpaint,
11384
11449
  disabled: isInpainting || isRemovingBg || !inpaintPrompt.trim(),
11385
11450
  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",
11386
- children: isInpainting ? /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(import_jsx_runtime53.Fragment, { children: [
11387
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: imageSpinnerClass }),
11451
+ children: isInpainting ? /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(import_jsx_runtime54.Fragment, { children: [
11452
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: imageSpinnerClass }),
11388
11453
  "Generating Inpaint..."
11389
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(import_jsx_runtime53.Fragment, { children: [
11390
- /* @__PURE__ */ (0, import_jsx_runtime53.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_runtime53.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" }) }),
11454
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(import_jsx_runtime54.Fragment, { children: [
11455
+ /* @__PURE__ */ (0, import_jsx_runtime54.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_runtime54.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" }) }),
11391
11456
  "Apply Inpainting"
11392
11457
  ] })
11393
11458
  }
11394
11459
  )
11395
11460
  ] }),
11396
- aiError && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: "p-2.5 rounded-lg bg-destructive/10 border border-destructive/40 text-destructive text-[11px]", children: aiError }),
11397
- aiSuccess && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: "p-2.5 rounded-lg bg-emerald-500/10 border border-emerald-500/30 text-emerald-600 text-[11px]", children: aiSuccess })
11461
+ aiError && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "p-2.5 rounded-lg bg-destructive/10 border border-destructive/40 text-destructive text-[11px]", children: aiError }),
11462
+ aiSuccess && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "p-2.5 rounded-lg bg-emerald-500/10 border border-emerald-500/30 text-emerald-600 text-[11px]", children: aiSuccess })
11398
11463
  ] })
11399
11464
  ] })
11400
11465
  ] })
@@ -11404,7 +11469,7 @@ var ImageEditor = ({
11404
11469
  };
11405
11470
 
11406
11471
  // src/review/useReview.ts
11407
- var import_react74 = require("react");
11472
+ var import_react75 = require("react");
11408
11473
  var import_editor13 = require("@pixerate/editor");
11409
11474
  var EMPTY_COMMENTS = Object.freeze({
11410
11475
  threads: [],
@@ -11423,23 +11488,23 @@ function isCommentStore(value) {
11423
11488
  }
11424
11489
  function useComments(source) {
11425
11490
  const store = isCommentStore(source) ? source : (0, import_editor13.getCommentStore)(source);
11426
- const subscribe = (0, import_react74.useCallback)(
11491
+ const subscribe = (0, import_react75.useCallback)(
11427
11492
  (onChange) => store ? store.subscribe(() => onChange()) : noopUnsubscribe,
11428
11493
  [store]
11429
11494
  );
11430
11495
  const getSnapshot2 = () => store?.getSnapshot() ?? EMPTY_COMMENTS;
11431
- const snapshot = (0, import_react74.useSyncExternalStore)(subscribe, getSnapshot2, getSnapshot2);
11432
- return (0, import_react74.useMemo)(() => ({ ...snapshot, store }), [snapshot, store]);
11496
+ const snapshot = (0, import_react75.useSyncExternalStore)(subscribe, getSnapshot2, getSnapshot2);
11497
+ return (0, import_react75.useMemo)(() => ({ ...snapshot, store }), [snapshot, store]);
11433
11498
  }
11434
11499
  function useTrackChanges(editor) {
11435
11500
  const store = (0, import_editor13.getTrackChangesStore)(editor ?? null);
11436
- const subscribe = (0, import_react74.useCallback)(
11501
+ const subscribe = (0, import_react75.useCallback)(
11437
11502
  (onChange) => store ? store.subscribe(() => onChange()) : noopUnsubscribe,
11438
11503
  [store]
11439
11504
  );
11440
11505
  const getSnapshot2 = () => store?.getSnapshot() ?? EMPTY_TRACK_CHANGES;
11441
- const snapshot = (0, import_react74.useSyncExternalStore)(subscribe, getSnapshot2, getSnapshot2);
11442
- return (0, import_react74.useMemo)(() => {
11506
+ const snapshot = (0, import_react75.useSyncExternalStore)(subscribe, getSnapshot2, getSnapshot2);
11507
+ return (0, import_react75.useMemo)(() => {
11443
11508
  const run = (fn) => () => {
11444
11509
  if (editor && !editor.isDestroyed) fn(editor);
11445
11510
  };
@@ -11462,9 +11527,9 @@ function useTrackChanges(editor) {
11462
11527
  }
11463
11528
 
11464
11529
  // src/review/CommentsPanel.tsx
11465
- var import_react75 = require("react");
11530
+ var import_react76 = require("react");
11466
11531
  var import_editor14 = require("@pixerate/editor");
11467
- var import_jsx_runtime54 = require("react/jsx-runtime");
11532
+ var import_jsx_runtime55 = require("react/jsx-runtime");
11468
11533
  var buttonClass2 = "rounded px-2 py-1 text-xs text-muted-foreground hover:bg-muted hover:text-foreground disabled:opacity-50";
11469
11534
  var primaryButtonClass = "rounded px-2 py-1 text-xs bg-primary/10 text-primary hover:bg-primary/20 disabled:opacity-50";
11470
11535
  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";
@@ -11478,18 +11543,18 @@ var CommentsPanel = ({
11478
11543
  emptyMessage = "No comments yet. Select text and add a comment."
11479
11544
  }) => {
11480
11545
  const { threads, activeThreadId, store } = useComments(storeProp ?? editor);
11481
- const [showResolved, setShowResolved] = (0, import_react75.useState)(showResolvedInitial);
11546
+ const [showResolved, setShowResolved] = (0, import_react76.useState)(showResolvedInitial);
11482
11547
  const author = authorProp ?? (0, import_editor14.getCommentAuthor)(editor) ?? { id: "anonymous", name: "Anonymous" };
11483
11548
  const visible = threads.filter((t) => showResolved || !t.resolved);
11484
11549
  const resolvedCount = threads.filter((t) => t.resolved).length;
11485
- return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("aside", { className, "aria-label": "Comments", children: [
11486
- /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex items-center justify-between gap-2", children: [
11487
- /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("span", { className: "text-xs font-medium text-muted-foreground", children: [
11550
+ return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("aside", { className, "aria-label": "Comments", children: [
11551
+ /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "flex items-center justify-between gap-2", children: [
11552
+ /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("span", { className: "text-xs font-medium text-muted-foreground", children: [
11488
11553
  threads.length - resolvedCount,
11489
11554
  " open",
11490
11555
  resolvedCount > 0 ? ` \xB7 ${resolvedCount} resolved` : ""
11491
11556
  ] }),
11492
- resolvedCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
11557
+ resolvedCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
11493
11558
  "button",
11494
11559
  {
11495
11560
  type: "button",
@@ -11500,7 +11565,7 @@ var CommentsPanel = ({
11500
11565
  }
11501
11566
  )
11502
11567
  ] }),
11503
- visible.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("p", { className: "text-xs text-muted-foreground", children: emptyMessage }) : /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("ul", { className: "flex flex-col gap-2", role: "list", children: visible.map((thread) => /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
11568
+ visible.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("p", { className: "text-xs text-muted-foreground", children: emptyMessage }) : /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("ul", { className: "flex flex-col gap-2", role: "list", children: visible.map((thread) => /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
11504
11569
  CommentThreadCard,
11505
11570
  {
11506
11571
  thread,
@@ -11522,7 +11587,7 @@ var CommentThreadCard = ({
11522
11587
  author,
11523
11588
  formatTime
11524
11589
  }) => {
11525
- const [draft, setDraft] = (0, import_react75.useState)("");
11590
+ const [draft, setDraft] = (0, import_react76.useState)("");
11526
11591
  const isDraft = thread.body === "";
11527
11592
  const quote = thread.anchor?.quote ?? thread.lastQuote ?? "";
11528
11593
  const live = editor && !editor.isDestroyed ? editor : null;
@@ -11548,7 +11613,7 @@ var CommentThreadCard = ({
11548
11613
  setDraft("");
11549
11614
  };
11550
11615
  const stop = (e) => e.stopPropagation();
11551
- return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
11616
+ return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(
11552
11617
  "li",
11553
11618
  {
11554
11619
  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" : ""}`,
@@ -11564,24 +11629,24 @@ var CommentThreadCard = ({
11564
11629
  }
11565
11630
  },
11566
11631
  children: [
11567
- /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex items-baseline justify-between gap-2", children: [
11568
- /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "font-medium", children: thread.author.name }),
11569
- /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "text-xs text-muted-foreground", children: formatTime(thread.createdAt) })
11632
+ /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "flex items-baseline justify-between gap-2", children: [
11633
+ /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "font-medium", children: thread.author.name }),
11634
+ /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "text-xs text-muted-foreground", children: formatTime(thread.createdAt) })
11570
11635
  ] }),
11571
- quote && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("blockquote", { className: "border-l-2 border-border pl-2 text-xs text-muted-foreground line-clamp-2", children: quote }),
11572
- thread.orphaned && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "text-xs text-destructive", children: "The commented text was deleted." }),
11573
- thread.resolved && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "text-xs text-muted-foreground", children: "Resolved" }),
11574
- !isDraft && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("p", { className: "whitespace-pre-wrap break-words", children: thread.body }),
11575
- thread.replies.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime54.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_runtime54.jsxs)("li", { className: "flex flex-col gap-0.5", "data-reply-id": reply.id, children: [
11576
- /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("span", { className: "text-xs", children: [
11577
- /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "font-medium", children: reply.author.name }),
11636
+ quote && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("blockquote", { className: "border-l-2 border-border pl-2 text-xs text-muted-foreground line-clamp-2", children: quote }),
11637
+ thread.orphaned && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "text-xs text-destructive", children: "The commented text was deleted." }),
11638
+ thread.resolved && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "text-xs text-muted-foreground", children: "Resolved" }),
11639
+ !isDraft && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("p", { className: "whitespace-pre-wrap break-words", children: thread.body }),
11640
+ thread.replies.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime55.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_runtime55.jsxs)("li", { className: "flex flex-col gap-0.5", "data-reply-id": reply.id, children: [
11641
+ /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("span", { className: "text-xs", children: [
11642
+ /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "font-medium", children: reply.author.name }),
11578
11643
  " ",
11579
- /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "text-muted-foreground", children: formatTime(reply.createdAt) })
11644
+ /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "text-muted-foreground", children: formatTime(reply.createdAt) })
11580
11645
  ] }),
11581
- /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("p", { className: "whitespace-pre-wrap break-words", children: reply.body })
11646
+ /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("p", { className: "whitespace-pre-wrap break-words", children: reply.body })
11582
11647
  ] }, reply.id)) }),
11583
- (active || isDraft) && !thread.resolved && /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex flex-col gap-1", onClick: stop, children: [
11584
- /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
11648
+ (active || isDraft) && !thread.resolved && /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "flex flex-col gap-1", onClick: stop, children: [
11649
+ /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
11585
11650
  "textarea",
11586
11651
  {
11587
11652
  className: textareaClass,
@@ -11599,9 +11664,9 @@ var CommentThreadCard = ({
11599
11664
  }
11600
11665
  }
11601
11666
  ),
11602
- /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex justify-end gap-1", children: [
11603
- isDraft && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("button", { type: "button", className: buttonClass2, onClick: remove, children: "Cancel" }),
11604
- /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
11667
+ /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "flex justify-end gap-1", children: [
11668
+ isDraft && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("button", { type: "button", className: buttonClass2, onClick: remove, children: "Cancel" }),
11669
+ /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
11605
11670
  "button",
11606
11671
  {
11607
11672
  type: "button",
@@ -11613,9 +11678,9 @@ var CommentThreadCard = ({
11613
11678
  )
11614
11679
  ] })
11615
11680
  ] }),
11616
- !isDraft && /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex justify-end gap-1", onClick: stop, children: [
11617
- /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("button", { type: "button", className: buttonClass2, onClick: () => setResolved(!thread.resolved), children: thread.resolved ? "Reopen" : "Resolve" }),
11618
- /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
11681
+ !isDraft && /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "flex justify-end gap-1", onClick: stop, children: [
11682
+ /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("button", { type: "button", className: buttonClass2, onClick: () => setResolved(!thread.resolved), children: thread.resolved ? "Reopen" : "Resolve" }),
11683
+ /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
11619
11684
  "button",
11620
11685
  {
11621
11686
  type: "button",
@@ -11631,7 +11696,7 @@ var CommentThreadCard = ({
11631
11696
  };
11632
11697
 
11633
11698
  // src/review/ReviewToolbar.tsx
11634
- var import_jsx_runtime55 = require("react/jsx-runtime");
11699
+ var import_jsx_runtime56 = require("react/jsx-runtime");
11635
11700
  var defaultDescriptionClass = "max-w-[16rem] truncate px-1 text-xs text-muted-foreground";
11636
11701
  var buttonClass3 = "rounded px-2 py-1 text-xs text-foreground hover:bg-muted disabled:opacity-40 disabled:hover:bg-transparent";
11637
11702
  var ReviewToolbar = ({
@@ -11644,8 +11709,8 @@ var ReviewToolbar = ({
11644
11709
  const count = review.changes.length;
11645
11710
  const current = review.currentChange;
11646
11711
  const index = current ? review.changes.findIndex((c) => c.id === current.id) + 1 : 0;
11647
- return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className, role: "toolbar", "aria-label": "Review", children: [
11648
- /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
11712
+ return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className, role: "toolbar", "aria-label": "Review", children: [
11713
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
11649
11714
  "button",
11650
11715
  {
11651
11716
  type: "button",
@@ -11656,8 +11721,8 @@ var ReviewToolbar = ({
11656
11721
  children: review.enabled ? "Tracking on" : "Track changes"
11657
11722
  }
11658
11723
  ),
11659
- /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "mx-1 h-4 w-px bg-border", "aria-hidden": "true" }),
11660
- /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
11724
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { className: "mx-1 h-4 w-px bg-border", "aria-hidden": "true" }),
11725
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
11661
11726
  "button",
11662
11727
  {
11663
11728
  type: "button",
@@ -11668,8 +11733,8 @@ var ReviewToolbar = ({
11668
11733
  children: "\u2039"
11669
11734
  }
11670
11735
  ),
11671
- /* @__PURE__ */ (0, import_jsx_runtime55.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` }),
11672
- /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
11736
+ /* @__PURE__ */ (0, import_jsx_runtime56.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` }),
11737
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
11673
11738
  "button",
11674
11739
  {
11675
11740
  type: "button",
@@ -11680,7 +11745,7 @@ var ReviewToolbar = ({
11680
11745
  children: "\u203A"
11681
11746
  }
11682
11747
  ),
11683
- showDescription && current && /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(
11748
+ showDescription && current && /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
11684
11749
  "span",
11685
11750
  {
11686
11751
  className: descriptionClassName,
@@ -11692,8 +11757,8 @@ var ReviewToolbar = ({
11692
11757
  ]
11693
11758
  }
11694
11759
  ),
11695
- /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "mx-1 h-4 w-px bg-border", "aria-hidden": "true" }),
11696
- /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
11760
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { className: "mx-1 h-4 w-px bg-border", "aria-hidden": "true" }),
11761
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
11697
11762
  "button",
11698
11763
  {
11699
11764
  type: "button",
@@ -11703,7 +11768,7 @@ var ReviewToolbar = ({
11703
11768
  children: "Accept"
11704
11769
  }
11705
11770
  ),
11706
- /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
11771
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
11707
11772
  "button",
11708
11773
  {
11709
11774
  type: "button",
@@ -11713,18 +11778,18 @@ var ReviewToolbar = ({
11713
11778
  children: "Reject"
11714
11779
  }
11715
11780
  ),
11716
- /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("button", { type: "button", className: buttonClass3, disabled: count === 0, onClick: review.acceptAll, children: "Accept all" }),
11717
- /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("button", { type: "button", className: buttonClass3, disabled: count === 0, onClick: review.rejectAll, children: "Reject all" })
11781
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("button", { type: "button", className: buttonClass3, disabled: count === 0, onClick: review.acceptAll, children: "Accept all" }),
11782
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("button", { type: "button", className: buttonClass3, disabled: count === 0, onClick: review.rejectAll, children: "Reject all" })
11718
11783
  ] });
11719
11784
  };
11720
11785
 
11721
11786
  // src/review/CommentButton.tsx
11722
- var import_jsx_runtime56 = require("react/jsx-runtime");
11787
+ var import_jsx_runtime57 = require("react/jsx-runtime");
11723
11788
  var CommentButton = ({
11724
11789
  editor,
11725
11790
  className = "rounded px-2 py-1 text-xs text-popover-foreground hover:bg-muted",
11726
11791
  children = "Comment"
11727
- }) => /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
11792
+ }) => /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
11728
11793
  "button",
11729
11794
  {
11730
11795
  type: "button",
@@ -11736,13 +11801,13 @@ var CommentButton = ({
11736
11801
  );
11737
11802
 
11738
11803
  // src/review/useDocumentCompare.ts
11739
- var import_react76 = require("react");
11804
+ var import_react77 = require("react");
11740
11805
  var import_editor15 = require("@pixerate/editor");
11741
11806
  function useDocumentCompare(editor, options) {
11742
- const [summary, setSummary] = (0, import_react76.useState)(null);
11743
- const defaults = (0, import_react76.useRef)(options);
11807
+ const [summary, setSummary] = (0, import_react77.useState)(null);
11808
+ const defaults = (0, import_react77.useRef)(options);
11744
11809
  defaults.current = options;
11745
- const compare = (0, import_react76.useCallback)(
11810
+ const compare = (0, import_react77.useCallback)(
11746
11811
  (original, revised, overrides) => {
11747
11812
  if (!editor || editor.isDestroyed) return null;
11748
11813
  const result = (0, import_editor15.applyDocumentComparison)(editor, original, revised, {
@@ -11754,13 +11819,13 @@ function useDocumentCompare(editor, options) {
11754
11819
  },
11755
11820
  [editor]
11756
11821
  );
11757
- const clear = (0, import_react76.useCallback)(() => setSummary(null), []);
11758
- return (0, import_react76.useMemo)(() => ({ summary, compare, clear }), [summary, compare, clear]);
11822
+ const clear = (0, import_react77.useCallback)(() => setSummary(null), []);
11823
+ return (0, import_react77.useMemo)(() => ({ summary, compare, clear }), [summary, compare, clear]);
11759
11824
  }
11760
11825
 
11761
11826
  // src/review/TrackedChangesList.tsx
11762
11827
  var import_editor16 = require("@pixerate/editor");
11763
- var import_jsx_runtime57 = require("react/jsx-runtime");
11828
+ var import_jsx_runtime58 = require("react/jsx-runtime");
11764
11829
  var buttonClass4 = "rounded px-1.5 py-0.5 text-xs text-foreground hover:bg-muted disabled:opacity-40";
11765
11830
  var TrackedChangesList = ({
11766
11831
  editor,
@@ -11771,18 +11836,18 @@ var TrackedChangesList = ({
11771
11836
  }) => {
11772
11837
  const review = useTrackChanges(editor);
11773
11838
  if (review.changes.length === 0) {
11774
- return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { className, "data-tracked-changes-list": "", children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { className: "pixerate-changes-empty text-xs text-muted-foreground", children: emptyState }) });
11839
+ return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className, "data-tracked-changes-list": "", children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: "pixerate-changes-empty text-xs text-muted-foreground", children: emptyState }) });
11775
11840
  }
11776
- return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("ul", { className, role: "list", "aria-label": "Tracked changes", "data-tracked-changes-list": "", children: review.changes.map((change) => {
11841
+ return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("ul", { className, role: "list", "aria-label": "Tracked changes", "data-tracked-changes-list": "", children: review.changes.map((change) => {
11777
11842
  const active = change.id === review.currentChangeId;
11778
- return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(
11843
+ return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(
11779
11844
  "li",
11780
11845
  {
11781
11846
  className: active ? `${itemClassName} ${activeItemClassName}` : itemClassName,
11782
11847
  "data-change-type": change.type,
11783
11848
  "data-change-id": change.id,
11784
11849
  children: [
11785
- /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(
11850
+ /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(
11786
11851
  "button",
11787
11852
  {
11788
11853
  type: "button",
@@ -11790,14 +11855,14 @@ var TrackedChangesList = ({
11790
11855
  title: `${change.author.name}: ${change.description}`,
11791
11856
  onClick: () => review.select(change.id),
11792
11857
  children: [
11793
- /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("span", { className: "font-medium", children: (0, import_editor16.trackedChangeLabel)(change) }),
11858
+ /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { className: "font-medium", children: (0, import_editor16.trackedChangeLabel)(change) }),
11794
11859
  change.author.name ? ` \xB7 ${change.author.name}` : "",
11795
- /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("span", { className: "block truncate text-muted-foreground", children: change.description })
11860
+ /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { className: "block truncate text-muted-foreground", children: change.description })
11796
11861
  ]
11797
11862
  }
11798
11863
  ),
11799
- /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("button", { type: "button", className: buttonClass4, onClick: () => review.accept(change.id), children: "Accept" }),
11800
- /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("button", { type: "button", className: buttonClass4, onClick: () => review.reject(change.id), children: "Reject" })
11864
+ /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("button", { type: "button", className: buttonClass4, onClick: () => review.accept(change.id), children: "Accept" }),
11865
+ /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("button", { type: "button", className: buttonClass4, onClick: () => review.reject(change.id), children: "Reject" })
11801
11866
  ]
11802
11867
  },
11803
11868
  `${change.type}:${change.id}`
@@ -11806,12 +11871,12 @@ var TrackedChangesList = ({
11806
11871
  };
11807
11872
 
11808
11873
  // src/commands/useCommandPalette.ts
11809
- var import_react77 = require("react");
11874
+ var import_react78 = require("react");
11810
11875
  var import_commands2 = require("@pixerate/editor/commands");
11811
11876
  function useCommandPalette(registry, options = {}) {
11812
- const optionsRef = (0, import_react77.useRef)(options);
11877
+ const optionsRef = (0, import_react78.useRef)(options);
11813
11878
  optionsRef.current = options;
11814
- const controller = (0, import_react77.useMemo)(
11879
+ const controller = (0, import_react78.useMemo)(
11815
11880
  () => (0, import_commands2.createCommandPaletteController)(registry, {
11816
11881
  context: () => {
11817
11882
  const c = optionsRef.current.context;
@@ -11832,9 +11897,9 @@ function useCommandPalette(registry, options = {}) {
11832
11897
  // eslint-disable-next-line react-hooks/exhaustive-deps
11833
11898
  [registry]
11834
11899
  );
11835
- const state = (0, import_react77.useSyncExternalStore)(controller.subscribe, controller.getState, controller.getState);
11900
+ const state = (0, import_react78.useSyncExternalStore)(controller.subscribe, controller.getState, controller.getState);
11836
11901
  const { hotkey, hotkeyTarget } = options;
11837
- (0, import_react77.useEffect)(() => {
11902
+ (0, import_react78.useEffect)(() => {
11838
11903
  if (!hotkey) return;
11839
11904
  const target = hotkeyTarget ?? (typeof window !== "undefined" ? window : null);
11840
11905
  if (!target) return;
@@ -11862,13 +11927,13 @@ function useCommandPalette(registry, options = {}) {
11862
11927
  }
11863
11928
 
11864
11929
  // src/commands/CommandPalette.tsx
11865
- var import_react78 = __toESM(require("react"), 1);
11866
- var import_jsx_runtime58 = require("react/jsx-runtime");
11930
+ var import_react79 = __toESM(require("react"), 1);
11931
+ var import_jsx_runtime59 = require("react/jsx-runtime");
11867
11932
  function HighlightedLabel({ item }) {
11868
- if (item.labelIndices.length === 0) return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_jsx_runtime58.Fragment, { children: item.label });
11933
+ if (item.labelIndices.length === 0) return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(import_jsx_runtime59.Fragment, { children: item.label });
11869
11934
  const marked = new Set(item.labelIndices);
11870
- return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_jsx_runtime58.Fragment, { children: Array.from(item.label).map(
11871
- (ch, i) => marked.has(i) ? /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { className: "font-semibold text-foreground", "data-match": "", children: ch }, i) : /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_react78.default.Fragment, { children: ch }, i)
11935
+ return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(import_jsx_runtime59.Fragment, { children: Array.from(item.label).map(
11936
+ (ch, i) => marked.has(i) ? /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("span", { className: "font-semibold text-foreground", "data-match": "", children: ch }, i) : /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(import_react79.default.Fragment, { children: ch }, i)
11872
11937
  ) });
11873
11938
  }
11874
11939
  var CommandPalette = ({
@@ -11877,22 +11942,22 @@ var CommandPalette = ({
11877
11942
  emptyMessage = "No matching commands",
11878
11943
  className = ""
11879
11944
  }) => {
11880
- const inputRef = (0, import_react78.useRef)(null);
11881
- const listRef = (0, import_react78.useRef)(null);
11882
- const baseId = (0, import_react78.useId)();
11945
+ const inputRef = (0, import_react79.useRef)(null);
11946
+ const listRef = (0, import_react79.useRef)(null);
11947
+ const baseId = (0, import_react79.useId)();
11883
11948
  const listId = `${baseId}-list`;
11884
11949
  const optionId = (index) => `${baseId}-option-${index}`;
11885
11950
  const { open, query, items, activeIndex } = palette;
11886
- (0, import_react78.useEffect)(() => {
11951
+ (0, import_react79.useEffect)(() => {
11887
11952
  if (open) inputRef.current?.focus();
11888
11953
  }, [open]);
11889
- (0, import_react78.useEffect)(() => {
11954
+ (0, import_react79.useEffect)(() => {
11890
11955
  if (!open) return;
11891
11956
  const active = listRef.current?.querySelector('[aria-selected="true"]');
11892
11957
  active?.scrollIntoView?.({ block: "nearest" });
11893
11958
  }, [open, activeIndex]);
11894
11959
  if (!open) return null;
11895
- return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
11960
+ return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
11896
11961
  "div",
11897
11962
  {
11898
11963
  className: "fixed inset-0 z-50 flex items-start justify-center bg-black/30 px-4 pt-[15vh]",
@@ -11900,7 +11965,7 @@ var CommandPalette = ({
11900
11965
  onMouseDown: (e) => {
11901
11966
  if (e.target === e.currentTarget) palette.setOpen(false);
11902
11967
  },
11903
- children: /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(
11968
+ children: /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(
11904
11969
  "div",
11905
11970
  {
11906
11971
  role: "dialog",
@@ -11909,7 +11974,7 @@ var CommandPalette = ({
11909
11974
  className: `w-full max-w-lg overflow-hidden rounded-lg border border-border bg-popover text-popover-foreground shadow-xl ${className}`,
11910
11975
  style: { background: "var(--popover, var(--background, #fff))" },
11911
11976
  children: [
11912
- /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
11977
+ /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
11913
11978
  "input",
11914
11979
  {
11915
11980
  ref: inputRef,
@@ -11929,7 +11994,7 @@ var CommandPalette = ({
11929
11994
  className: "w-full border-b border-border bg-transparent px-3 py-2 text-sm outline-none placeholder:text-muted-foreground"
11930
11995
  }
11931
11996
  ),
11932
- items.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: "px-3 py-6 text-center text-sm text-muted-foreground", children: emptyMessage }) : /* @__PURE__ */ (0, import_jsx_runtime58.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_runtime58.jsxs)(
11997
+ items.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "px-3 py-6 text-center text-sm text-muted-foreground", children: emptyMessage }) : /* @__PURE__ */ (0, import_jsx_runtime59.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_runtime59.jsxs)(
11933
11998
  "li",
11934
11999
  {
11935
12000
  id: optionId(index),
@@ -11944,12 +12009,12 @@ var CommandPalette = ({
11944
12009
  onClick: () => palette.run(item.id),
11945
12010
  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"}`,
11946
12011
  children: [
11947
- /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("span", { className: "min-w-0 flex-1 truncate", children: [
11948
- /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(HighlightedLabel, { item }),
11949
- item.disabledReason && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { className: "ml-2 text-xs text-muted-foreground", "data-disabled-reason": "", children: item.disabledReason })
12012
+ /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("span", { className: "min-w-0 flex-1 truncate", children: [
12013
+ /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(HighlightedLabel, { item }),
12014
+ item.disabledReason && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("span", { className: "ml-2 text-xs text-muted-foreground", "data-disabled-reason": "", children: item.disabledReason })
11950
12015
  ] }),
11951
- item.group && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { className: "shrink-0 text-xs text-muted-foreground", children: item.group }),
11952
- item.shortcut && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("kbd", { className: "shrink-0 rounded border border-border px-1.5 font-mono text-[10px] text-muted-foreground", children: item.shortcut })
12016
+ item.group && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("span", { className: "shrink-0 text-xs text-muted-foreground", children: item.group }),
12017
+ item.shortcut && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("kbd", { className: "shrink-0 rounded border border-border px-1.5 font-mono text-[10px] text-muted-foreground", children: item.shortcut })
11953
12018
  ]
11954
12019
  },
11955
12020
  item.id
@@ -11962,12 +12027,12 @@ var CommandPalette = ({
11962
12027
  };
11963
12028
 
11964
12029
  // src/commands/useCommandShortcuts.ts
11965
- var import_react79 = require("react");
12030
+ var import_react80 = require("react");
11966
12031
  function useCommandShortcuts(registry, options = {}) {
11967
- const optionsRef = (0, import_react79.useRef)(options);
12032
+ const optionsRef = (0, import_react80.useRef)(options);
11968
12033
  optionsRef.current = options;
11969
12034
  const { enabled = true, target } = options;
11970
- (0, import_react79.useEffect)(() => {
12035
+ (0, import_react80.useEffect)(() => {
11971
12036
  if (!registry || !enabled) return;
11972
12037
  const eventTarget = target ?? (typeof window !== "undefined" ? window : null);
11973
12038
  if (!eventTarget) return;
@@ -11985,14 +12050,14 @@ function useCommandShortcuts(registry, options = {}) {
11985
12050
  }, [registry, enabled, target]);
11986
12051
  }
11987
12052
  function useRegisterCommands(registry, specs) {
11988
- (0, import_react79.useEffect)(() => {
12053
+ (0, import_react80.useEffect)(() => {
11989
12054
  if (!registry || !specs || specs.length === 0) return;
11990
12055
  return registry.register(specs);
11991
12056
  }, [registry, specs]);
11992
12057
  }
11993
12058
 
11994
12059
  // src/persistence/useAutosave.ts
11995
- var import_react80 = require("react");
12060
+ var import_react81 = require("react");
11996
12061
  var import_persistence = require("@pixerate/editor/persistence");
11997
12062
  var IDLE = {
11998
12063
  status: "idle",
@@ -12003,18 +12068,18 @@ var IDLE = {
12003
12068
  ready: false
12004
12069
  };
12005
12070
  function useAutosave(options) {
12006
- const optionsRef = (0, import_react80.useRef)(options);
12071
+ const optionsRef = (0, import_react81.useRef)(options);
12007
12072
  optionsRef.current = options;
12008
12073
  const { storage, key, history, dirty } = options;
12009
12074
  const recover = options.recover !== false;
12010
12075
  const flushOnHide = options.flushOnHide !== false;
12011
12076
  const ready = options.ready !== false;
12012
- const [controller, setController] = (0, import_react80.useState)(null);
12013
- const [status, setStatus] = (0, import_react80.useState)(IDLE);
12014
- const [recovery, setRecovery] = (0, import_react80.useState)(null);
12015
- const [pendingRecovery, setPendingRecovery] = (0, import_react80.useState)(recover);
12016
- const revisionsRef = (0, import_react80.useRef)(null);
12017
- (0, import_react80.useEffect)(() => {
12077
+ const [controller, setController] = (0, import_react81.useState)(null);
12078
+ const [status, setStatus] = (0, import_react81.useState)(IDLE);
12079
+ const [recovery, setRecovery] = (0, import_react81.useState)(null);
12080
+ const [pendingRecovery, setPendingRecovery] = (0, import_react81.useState)(recover);
12081
+ const revisionsRef = (0, import_react81.useRef)(null);
12082
+ (0, import_react81.useEffect)(() => {
12018
12083
  const revisions = (0, import_persistence.createRevisionTracker)({ history, dirty });
12019
12084
  const o = optionsRef.current;
12020
12085
  const instance = (0, import_persistence.createAutosaveController)({
@@ -12057,10 +12122,10 @@ function useAutosave(options) {
12057
12122
  if (revisionsRef.current === revisions) revisionsRef.current = null;
12058
12123
  };
12059
12124
  }, [storage, key, history, dirty, recover]);
12060
- (0, import_react80.useEffect)(() => {
12125
+ (0, import_react81.useEffect)(() => {
12061
12126
  if (controller && ready && !pendingRecovery) controller.ready();
12062
12127
  }, [controller, ready, pendingRecovery]);
12063
- (0, import_react80.useEffect)(() => {
12128
+ (0, import_react81.useEffect)(() => {
12064
12129
  if (!controller || !flushOnHide || typeof window === "undefined") return;
12065
12130
  const flush = () => void controller.flushNow();
12066
12131
  const onVisibility = () => {
@@ -12073,33 +12138,33 @@ function useAutosave(options) {
12073
12138
  document.removeEventListener("visibilitychange", onVisibility);
12074
12139
  };
12075
12140
  }, [controller, flushOnHide]);
12076
- const restore = (0, import_react80.useCallback)(() => {
12141
+ const restore = (0, import_react81.useCallback)(() => {
12077
12142
  const snapshot = recovery?.snapshot;
12078
12143
  setRecovery(null);
12079
12144
  setPendingRecovery(false);
12080
12145
  return snapshot;
12081
12146
  }, [recovery]);
12082
- const discard = (0, import_react80.useCallback)(async () => {
12147
+ const discard = (0, import_react81.useCallback)(async () => {
12083
12148
  if (controller) await controller.discardRecovery();
12084
12149
  setRecovery(null);
12085
12150
  setPendingRecovery(false);
12086
12151
  }, [controller]);
12087
- const flushNow = (0, import_react80.useCallback)(async () => {
12152
+ const flushNow = (0, import_react81.useCallback)(async () => {
12088
12153
  await controller?.flushNow();
12089
12154
  }, [controller]);
12090
- const markClean = (0, import_react80.useCallback)(async () => {
12155
+ const markClean = (0, import_react81.useCallback)(async () => {
12091
12156
  revisionsRef.current?.markSaved();
12092
12157
  await controller?.markClean();
12093
12158
  }, [controller]);
12094
- const notifyChange = (0, import_react80.useCallback)(() => revisionsRef.current?.bump(), []);
12159
+ const notifyChange = (0, import_react81.useCallback)(() => revisionsRef.current?.bump(), []);
12095
12160
  return { status, recovery, pendingRecovery, restore, discard, flushNow, markClean, notifyChange, controller };
12096
12161
  }
12097
12162
 
12098
12163
  // src/persistence/useEditorAutosave.ts
12099
- var import_react81 = require("react");
12164
+ var import_react82 = require("react");
12100
12165
  var import_persistence2 = require("@pixerate/editor/persistence");
12101
12166
  function useEditorAutosave(doc, { collectAssetGarbage, ...options }) {
12102
- const storage = (0, import_react81.useMemo)(
12167
+ const storage = (0, import_react82.useMemo)(
12103
12168
  () => doc.assets ? (0, import_persistence2.withEditorAssets)(options.storage, doc.assets) : options.storage,
12104
12169
  [options.storage, doc.assets]
12105
12170
  );
@@ -12112,19 +12177,19 @@ function useEditorAutosave(doc, { collectAssetGarbage, ...options }) {
12112
12177
  history: doc
12113
12178
  });
12114
12179
  const take = autosave.restore;
12115
- const restore = (0, import_react81.useCallback)(() => {
12180
+ const restore = (0, import_react82.useCallback)(() => {
12116
12181
  const snapshot = take();
12117
12182
  return snapshot ? doc.loadDocument(snapshot, { history: "reset" }) : void 0;
12118
12183
  }, [take, doc]);
12119
12184
  const { markClean: clean, discard: drop } = autosave;
12120
12185
  const rawStorage = options.storage;
12121
- const gcRef = (0, import_react81.useRef)(collectAssetGarbage);
12186
+ const gcRef = (0, import_react82.useRef)(collectAssetGarbage);
12122
12187
  gcRef.current = collectAssetGarbage;
12123
- const markClean = (0, import_react81.useCallback)(async () => {
12188
+ const markClean = (0, import_react82.useCallback)(async () => {
12124
12189
  await clean();
12125
12190
  await (0, import_persistence2.collectRetiredEditorAssets)(rawStorage, doc, gcRef.current);
12126
12191
  }, [clean, rawStorage, doc]);
12127
- const discard = (0, import_react81.useCallback)(async () => {
12192
+ const discard = (0, import_react82.useCallback)(async () => {
12128
12193
  await drop();
12129
12194
  await (0, import_persistence2.collectRetiredEditorAssets)(rawStorage, doc, gcRef.current);
12130
12195
  }, [drop, rawStorage, doc]);
@@ -12133,7 +12198,7 @@ function useEditorAutosave(doc, { collectAssetGarbage, ...options }) {
12133
12198
 
12134
12199
  // src/persistence/RecoveryPrompt.tsx
12135
12200
  var import_persistence3 = require("@pixerate/editor/persistence");
12136
- var import_jsx_runtime59 = require("react/jsx-runtime");
12201
+ var import_jsx_runtime60 = require("react/jsx-runtime");
12137
12202
  var RecoveryPrompt = ({
12138
12203
  recovery,
12139
12204
  onRestore,
@@ -12145,7 +12210,7 @@ var RecoveryPrompt = ({
12145
12210
  }) => {
12146
12211
  if (!recovery) return null;
12147
12212
  const { name } = recovery.meta;
12148
- return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(
12213
+ return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
12149
12214
  "div",
12150
12215
  {
12151
12216
  role: "alertdialog",
@@ -12153,15 +12218,15 @@ var RecoveryPrompt = ({
12153
12218
  "data-recovery-prompt": "",
12154
12219
  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}`,
12155
12220
  children: [
12156
- /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("span", { className: "min-w-0 flex-1", children: [
12221
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("span", { className: "min-w-0 flex-1", children: [
12157
12222
  (0, import_persistence3.formatRecoveryMessage)(recovery.meta, formatTime),
12158
- name ? /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("span", { className: "ml-1 text-xs text-muted-foreground", children: [
12223
+ name ? /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("span", { className: "ml-1 text-xs text-muted-foreground", children: [
12159
12224
  "(",
12160
12225
  name,
12161
12226
  ")"
12162
12227
  ] }) : null
12163
12228
  ] }),
12164
- /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
12229
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
12165
12230
  "button",
12166
12231
  {
12167
12232
  type: "button",
@@ -12171,7 +12236,7 @@ var RecoveryPrompt = ({
12171
12236
  children: restoreLabel
12172
12237
  }
12173
12238
  ),
12174
- /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
12239
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
12175
12240
  "button",
12176
12241
  {
12177
12242
  type: "button",
@@ -12187,17 +12252,17 @@ var RecoveryPrompt = ({
12187
12252
  };
12188
12253
 
12189
12254
  // src/generation/useGenerationPlan.ts
12190
- var import_react82 = require("react");
12255
+ var import_react83 = require("react");
12191
12256
  var import_generation = require("@pixerate/editor/generation");
12192
12257
  function useGenerationPlan(request, capabilities, options = {}) {
12193
12258
  const key = JSON.stringify([request, capabilities, options]);
12194
- return (0, import_react82.useMemo)(() => (0, import_generation.planGenerationRequest)(request, capabilities, options), [key]);
12259
+ return (0, import_react83.useMemo)(() => (0, import_generation.planGenerationRequest)(request, capabilities, options), [key]);
12195
12260
  }
12196
12261
  function useJobProgress(options) {
12197
12262
  const { startedAt, expectedMs, done, now, intervalMs = 1e3 } = options;
12198
- const [tick, setTick] = (0, import_react82.useState)(() => Date.now());
12263
+ const [tick, setTick] = (0, import_react83.useState)(() => Date.now());
12199
12264
  const ticking = !done && now === void 0;
12200
- (0, import_react82.useEffect)(() => {
12265
+ (0, import_react83.useEffect)(() => {
12201
12266
  if (!ticking) return;
12202
12267
  setTick(Date.now());
12203
12268
  const id = setInterval(() => setTick(Date.now()), Math.max(16, intervalMs));
@@ -12207,9 +12272,9 @@ function useJobProgress(options) {
12207
12272
  }
12208
12273
 
12209
12274
  // src/generation/GenerationSettings.tsx
12210
- var import_react83 = require("react");
12275
+ var import_react84 = require("react");
12211
12276
  var import_generation2 = require("@pixerate/editor/generation");
12212
- var import_jsx_runtime60 = require("react/jsx-runtime");
12277
+ var import_jsx_runtime61 = require("react/jsx-runtime");
12213
12278
  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";
12214
12279
  function Control({
12215
12280
  control,
@@ -12219,7 +12284,7 @@ function Control({
12219
12284
  }) {
12220
12285
  const shown = value ?? control.defaultValue;
12221
12286
  if (control.kind === "checkbox") {
12222
- return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
12287
+ return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
12223
12288
  "input",
12224
12289
  {
12225
12290
  id,
@@ -12231,7 +12296,7 @@ function Control({
12231
12296
  );
12232
12297
  }
12233
12298
  if (control.kind === "select") {
12234
- return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
12299
+ return /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(
12235
12300
  "select",
12236
12301
  {
12237
12302
  id,
@@ -12240,14 +12305,14 @@ function Control({
12240
12305
  value: shown === void 0 ? "" : String(shown),
12241
12306
  onChange: (e) => onValue((0, import_generation2.parseControlValue)(control, e.target.value)),
12242
12307
  children: [
12243
- shown === void 0 && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("option", { value: "", children: "Default" }),
12244
- control.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("option", { value: String(option.value), children: option.label }, String(option.value)))
12308
+ shown === void 0 && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("option", { value: "", children: "Default" }),
12309
+ control.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("option", { value: String(option.value), children: option.label }, String(option.value)))
12245
12310
  ]
12246
12311
  }
12247
12312
  );
12248
12313
  }
12249
12314
  if (control.kind === "textarea") {
12250
- return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
12315
+ return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
12251
12316
  "textarea",
12252
12317
  {
12253
12318
  id,
@@ -12261,8 +12326,8 @@ function Control({
12261
12326
  );
12262
12327
  }
12263
12328
  const numeric = typeof shown === "number" ? shown : void 0;
12264
- return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { className: "flex items-center gap-2", children: [
12265
- /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
12329
+ return /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("div", { className: "flex items-center gap-2", children: [
12330
+ /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
12266
12331
  "input",
12267
12332
  {
12268
12333
  id,
@@ -12276,7 +12341,7 @@ function Control({
12276
12341
  onChange: (e) => onValue((0, import_generation2.parseControlValue)(control, e.target.value))
12277
12342
  }
12278
12343
  ),
12279
- control.kind === "range" && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("span", { className: "w-10 text-right tabular-nums text-muted-foreground", "data-field-value": "", children: numeric ?? "\u2013" })
12344
+ control.kind === "range" && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("span", { className: "w-10 text-right tabular-nums text-muted-foreground", "data-field-value": "", children: numeric ?? "\u2013" })
12280
12345
  ] });
12281
12346
  }
12282
12347
  var GenerationSettings = ({
@@ -12290,17 +12355,17 @@ var GenerationSettings = ({
12290
12355
  renderReference,
12291
12356
  className = ""
12292
12357
  }) => {
12293
- const baseId = (0, import_react83.useId)();
12294
- const controls = (0, import_react83.useMemo)(() => (0, import_generation2.getGenerationControls)(capabilities), [capabilities]);
12358
+ const baseId = (0, import_react84.useId)();
12359
+ const controls = (0, import_react84.useMemo)(() => (0, import_generation2.getGenerationControls)(capabilities), [capabilities]);
12295
12360
  const computed = useGenerationPlan(value, capabilities, { strategy });
12296
12361
  const plan = planProp ?? computed;
12297
12362
  const slots = (0, import_generation2.getReferenceSlots)(capabilities, value);
12298
- return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { className: `flex flex-col gap-3 text-sm ${className}`, "data-generation-settings": "", "data-model": capabilities.id, children: [
12363
+ return /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("div", { className: `flex flex-col gap-3 text-sm ${className}`, "data-generation-settings": "", "data-model": capabilities.id, children: [
12299
12364
  controls.map((control) => {
12300
12365
  const id = `${baseId}-${control.key}`;
12301
- return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { className: "flex flex-col gap-1", "data-control": control.key, children: [
12302
- /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("label", { htmlFor: id, className: "text-xs font-medium text-muted-foreground", title: control.description, children: control.label }),
12303
- /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
12366
+ return /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("div", { className: "flex flex-col gap-1", "data-control": control.key, children: [
12367
+ /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("label", { htmlFor: id, className: "text-xs font-medium text-muted-foreground", title: control.description, children: control.label }),
12368
+ /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
12304
12369
  Control,
12305
12370
  {
12306
12371
  control,
@@ -12311,23 +12376,23 @@ var GenerationSettings = ({
12311
12376
  )
12312
12377
  ] }, control.key);
12313
12378
  }),
12314
- slots.map((slot) => /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("fieldset", { className: "flex flex-col gap-1", "data-reference-role": slot.role, children: [
12315
- /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("legend", { className: "text-xs font-medium text-muted-foreground", title: slot.description, children: [
12379
+ slots.map((slot) => /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("fieldset", { className: "flex flex-col gap-1", "data-reference-role": slot.role, children: [
12380
+ /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("legend", { className: "text-xs font-medium text-muted-foreground", title: slot.description, children: [
12316
12381
  slot.label,
12317
12382
  " ",
12318
- /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("span", { className: "tabular-nums", "data-reference-count": "", children: [
12383
+ /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("span", { className: "tabular-nums", "data-reference-count": "", children: [
12319
12384
  "(",
12320
12385
  slot.references.length,
12321
12386
  "/",
12322
12387
  slot.max,
12323
12388
  ")"
12324
12389
  ] }),
12325
- slot.min > 0 && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("span", { className: "text-destructive", children: " *" })
12390
+ slot.min > 0 && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("span", { className: "text-destructive", children: " *" })
12326
12391
  ] }),
12327
- /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("ul", { className: "flex flex-wrap gap-1", children: [
12328
- slot.references.map((ref) => /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("li", { className: "flex items-center gap-1 rounded border border-border px-1.5 py-0.5", "data-reference-id": ref.id, children: [
12329
- renderReference ? renderReference(ref) : /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("span", { className: "max-w-[10rem] truncate", children: ref.id }),
12330
- /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
12392
+ /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("ul", { className: "flex flex-wrap gap-1", children: [
12393
+ slot.references.map((ref) => /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("li", { className: "flex items-center gap-1 rounded border border-border px-1.5 py-0.5", "data-reference-id": ref.id, children: [
12394
+ renderReference ? renderReference(ref) : /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("span", { className: "max-w-[10rem] truncate", children: ref.id }),
12395
+ /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
12331
12396
  "button",
12332
12397
  {
12333
12398
  type: "button",
@@ -12338,7 +12403,7 @@ var GenerationSettings = ({
12338
12403
  }
12339
12404
  )
12340
12405
  ] }, ref.id)),
12341
- onAddReference && slot.canAdd && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
12406
+ onAddReference && slot.canAdd && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
12342
12407
  "button",
12343
12408
  {
12344
12409
  type: "button",
@@ -12349,21 +12414,21 @@ var GenerationSettings = ({
12349
12414
  ) })
12350
12415
  ] })
12351
12416
  ] }, slot.role)),
12352
- showAdjustments && plan.adjustments.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime60.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_runtime60.jsx)("li", { "data-adjustment-field": adjustment.field, "data-adjustment-kind": adjustment.kind, children: adjustment.reason }, index)) }),
12353
- showAdjustments && plan.errors.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime60.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_runtime60.jsx)("li", { "data-error-field": error.field, children: error.message }, index)) })
12417
+ showAdjustments && plan.adjustments.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime61.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_runtime61.jsx)("li", { "data-adjustment-field": adjustment.field, "data-adjustment-kind": adjustment.kind, children: adjustment.reason }, index)) }),
12418
+ showAdjustments && plan.errors.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime61.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_runtime61.jsx)("li", { "data-error-field": error.field, children: error.message }, index)) })
12354
12419
  ] });
12355
12420
  };
12356
12421
 
12357
12422
  // src/generation/JobProgress.tsx
12358
- var import_jsx_runtime61 = require("react/jsx-runtime");
12423
+ var import_jsx_runtime62 = require("react/jsx-runtime");
12359
12424
  var JobProgress = ({ title, className = "", ...options }) => {
12360
12425
  const progress = useJobProgress(options);
12361
- return /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("div", { className: `flex flex-col gap-1 text-sm ${className}`, "data-job-progress": "", "data-done": options.done ? "" : void 0, children: [
12362
- /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("div", { className: "flex items-center justify-between gap-2 text-muted-foreground", children: [
12363
- title && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("span", { className: "truncate text-foreground", children: title }),
12364
- /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("span", { "data-job-progress-label": "", "aria-live": "polite", children: progress.label })
12426
+ return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className: `flex flex-col gap-1 text-sm ${className}`, "data-job-progress": "", "data-done": options.done ? "" : void 0, children: [
12427
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className: "flex items-center justify-between gap-2 text-muted-foreground", children: [
12428
+ title && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { className: "truncate text-foreground", children: title }),
12429
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { "data-job-progress-label": "", "aria-live": "polite", children: progress.label })
12365
12430
  ] }),
12366
- /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
12431
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
12367
12432
  "div",
12368
12433
  {
12369
12434
  role: "progressbar",
@@ -12373,7 +12438,7 @@ var JobProgress = ({ title, className = "", ...options }) => {
12373
12438
  "aria-valuenow": progress.percent,
12374
12439
  "aria-valuetext": `${progress.percent}%, ${progress.label}`,
12375
12440
  className: "h-1.5 w-full overflow-hidden rounded-full bg-muted",
12376
- children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
12441
+ children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
12377
12442
  "div",
12378
12443
  {
12379
12444
  className: "h-full rounded-full bg-primary transition-[width] duration-500",
@@ -12386,9 +12451,9 @@ var JobProgress = ({ title, className = "", ...options }) => {
12386
12451
  };
12387
12452
 
12388
12453
  // src/generation/AssetMentionChips.tsx
12389
- var import_react84 = require("react");
12454
+ var import_react85 = require("react");
12390
12455
  var import_generation3 = require("@pixerate/editor/generation");
12391
- var import_jsx_runtime62 = require("react/jsx-runtime");
12456
+ var import_jsx_runtime63 = require("react/jsx-runtime");
12392
12457
  var AssetMentionChips = ({
12393
12458
  content,
12394
12459
  onChange,
@@ -12398,14 +12463,14 @@ var AssetMentionChips = ({
12398
12463
  renderAsset,
12399
12464
  className = ""
12400
12465
  }) => {
12401
- const [open, setOpen] = (0, import_react84.useState)(null);
12402
- const rootRef = (0, import_react84.useRef)(null);
12403
- const chips = (0, import_react84.useMemo)(
12466
+ const [open, setOpen] = (0, import_react85.useState)(null);
12467
+ const rootRef = (0, import_react85.useRef)(null);
12468
+ const chips = (0, import_react85.useMemo)(
12404
12469
  () => (0, import_generation3.describeAssetMentions)((0, import_generation3.findTextMentions)(content), assets, capabilities),
12405
12470
  [content, assets, capabilities]
12406
12471
  );
12407
12472
  const options = roles ?? (capabilities ? (0, import_generation3.getAssetRoleOptions)(capabilities) : (0, import_generation3.defaultAssetRoleOptions)());
12408
- (0, import_react84.useEffect)(() => {
12473
+ (0, import_react85.useEffect)(() => {
12409
12474
  if (open === null) return;
12410
12475
  const onPointer = (event) => {
12411
12476
  if (!rootRef.current?.contains(event.target)) setOpen(null);
@@ -12419,13 +12484,13 @@ var AssetMentionChips = ({
12419
12484
  onChange((0, import_generation3.setMentionRoleInText)(content, chip2.start, role));
12420
12485
  };
12421
12486
  if (chips.length === 0) return null;
12422
- return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { ref: rootRef, className: `flex flex-wrap gap-1.5 ${className}`, "data-asset-mention-chips": "", children: chips.map((chip2) => {
12487
+ return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("div", { ref: rootRef, className: `flex flex-wrap gap-1.5 ${className}`, "data-asset-mention-chips": "", children: chips.map((chip2) => {
12423
12488
  const error = chip2.issues.find((issue) => issue.severity === "error");
12424
12489
  const warning = chip2.issues.find((issue) => issue.severity === "warning");
12425
12490
  const problem = error ?? warning;
12426
12491
  const isOpen = open === chip2.index;
12427
- return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("span", { className: "relative inline-flex", "data-asset-chip": chip2.asset.id, children: [
12428
- /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
12492
+ return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("span", { className: "relative inline-flex", "data-asset-chip": chip2.asset.id, children: [
12493
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
12429
12494
  "button",
12430
12495
  {
12431
12496
  type: "button",
@@ -12439,8 +12504,8 @@ var AssetMentionChips = ({
12439
12504
  },
12440
12505
  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`,
12441
12506
  children: [
12442
- /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { children: renderAsset ? renderAsset(chip2) : `@${chip2.asset.label ?? chip2.handle}` }),
12443
- /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
12507
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("span", { children: renderAsset ? renderAsset(chip2) : `@${chip2.asset.label ?? chip2.handle}` }),
12508
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
12444
12509
  "span",
12445
12510
  {
12446
12511
  className: `rounded px-1 text-[10px] uppercase tracking-wide ${chip2.role ? "bg-primary/15" : "opacity-60"}`,
@@ -12451,7 +12516,7 @@ var AssetMentionChips = ({
12451
12516
  ]
12452
12517
  }
12453
12518
  ),
12454
- isOpen && /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
12519
+ isOpen && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
12455
12520
  "div",
12456
12521
  {
12457
12522
  role: "listbox",
@@ -12462,7 +12527,7 @@ var AssetMentionChips = ({
12462
12527
  if (e.key === "Escape") setOpen(null);
12463
12528
  },
12464
12529
  children: [
12465
- options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
12530
+ options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
12466
12531
  "button",
12467
12532
  {
12468
12533
  type: "button",
@@ -12473,13 +12538,13 @@ var AssetMentionChips = ({
12473
12538
  onClick: () => pick(chip2, option.role),
12474
12539
  className: "flex items-center justify-between gap-2 rounded px-2 py-1 text-left hover:bg-muted",
12475
12540
  children: [
12476
- /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { children: option.label }),
12477
- option.accepts?.length ? /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { className: "text-[10px] opacity-60", children: option.accepts.join(", ") }) : null
12541
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("span", { children: option.label }),
12542
+ option.accepts?.length ? /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("span", { className: "text-[10px] opacity-60", children: option.accepts.join(", ") }) : null
12478
12543
  ]
12479
12544
  },
12480
12545
  option.role
12481
12546
  )),
12482
- /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
12547
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
12483
12548
  "button",
12484
12549
  {
12485
12550
  type: "button",
@@ -12491,7 +12556,7 @@ var AssetMentionChips = ({
12491
12556
  children: "No role"
12492
12557
  }
12493
12558
  ),
12494
- chip2.issues.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime62.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_runtime62.jsx)("li", { className: issue.severity === "error" ? "text-red-500" : "text-amber-500", children: issue.message }, i)) })
12559
+ chip2.issues.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime63.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_runtime63.jsx)("li", { className: issue.severity === "error" ? "text-red-500" : "text-amber-500", children: issue.message }, i)) })
12495
12560
  ]
12496
12561
  }
12497
12562
  )
@@ -12500,15 +12565,15 @@ var AssetMentionChips = ({
12500
12565
  };
12501
12566
 
12502
12567
  // src/generation/GenerationHistory.tsx
12503
- var import_react85 = require("react");
12568
+ var import_react86 = require("react");
12504
12569
  var import_generation4 = require("@pixerate/editor/generation");
12505
- var import_jsx_runtime63 = require("react/jsx-runtime");
12570
+ var import_jsx_runtime64 = require("react/jsx-runtime");
12506
12571
  function useGenerationRecords(store, filter) {
12507
- const [records, setRecords] = (0, import_react85.useState)([]);
12508
- const [loading, setLoading] = (0, import_react85.useState)(!!store);
12509
- const [error, setError] = (0, import_react85.useState)(null);
12572
+ const [records, setRecords] = (0, import_react86.useState)([]);
12573
+ const [loading, setLoading] = (0, import_react86.useState)(!!store);
12574
+ const [error, setError] = (0, import_react86.useState)(null);
12510
12575
  const filterKey = (0, import_generation4.stableStringify)(filter ?? {});
12511
- const refresh = (0, import_react85.useCallback)(async () => {
12576
+ const refresh = (0, import_react86.useCallback)(async () => {
12512
12577
  if (!store) {
12513
12578
  setRecords([]);
12514
12579
  setLoading(false);
@@ -12525,7 +12590,7 @@ function useGenerationRecords(store, filter) {
12525
12590
  setLoading(false);
12526
12591
  }
12527
12592
  }, [store, filterKey]);
12528
- (0, import_react85.useEffect)(() => {
12593
+ (0, import_react86.useEffect)(() => {
12529
12594
  void refresh();
12530
12595
  if (!store) return;
12531
12596
  return store.subscribe(() => void refresh());
@@ -12551,21 +12616,21 @@ var GenerationHistory = ({
12551
12616
  emptyText = "No generations yet.",
12552
12617
  className = ""
12553
12618
  }) => {
12554
- const [innerMode, setInnerMode] = (0, import_react85.useState)("exact");
12619
+ const [innerMode, setInnerMode] = (0, import_react86.useState)("exact");
12555
12620
  const mode = modeProp ?? innerMode;
12556
12621
  const setMode = (next) => {
12557
12622
  if (modeProp === void 0) setInnerMode(next);
12558
12623
  onModeChange?.(next);
12559
12624
  };
12560
- const options = (0, import_react85.useMemo)(() => ({ templates, capabilities, assets, mode }), [templates, capabilities, assets, mode]);
12561
- const results = (0, import_react85.useMemo)(() => records.map((record) => (0, import_generation4.recreateRequest)(record, options)), [records, options]);
12562
- const models = (0, import_react85.useMemo)(
12625
+ const options = (0, import_react86.useMemo)(() => ({ templates, capabilities, assets, mode }), [templates, capabilities, assets, mode]);
12626
+ const results = (0, import_react86.useMemo)(() => records.map((record) => (0, import_generation4.recreateRequest)(record, options)), [records, options]);
12627
+ const models = (0, import_react86.useMemo)(
12563
12628
  () => capabilities ? Array.isArray(capabilities) ? capabilities : [capabilities] : [],
12564
12629
  [capabilities]
12565
12630
  );
12566
- return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { className: `flex flex-col gap-2 text-sm ${className}`, "data-generation-history": "", children: [
12567
- /* @__PURE__ */ (0, import_jsx_runtime63.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_runtime63.jsxs)("label", { className: "inline-flex items-center gap-1", children: [
12568
- /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
12631
+ return /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className: `flex flex-col gap-2 text-sm ${className}`, "data-generation-history": "", children: [
12632
+ /* @__PURE__ */ (0, import_jsx_runtime64.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_runtime64.jsxs)("label", { className: "inline-flex items-center gap-1", children: [
12633
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
12569
12634
  "input",
12570
12635
  {
12571
12636
  type: "radio",
@@ -12578,34 +12643,34 @@ var GenerationHistory = ({
12578
12643
  ),
12579
12644
  value === "exact" ? "Exact (recorded versions)" : "Latest templates & settings"
12580
12645
  ] }, value)) }),
12581
- records.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("p", { className: "text-xs text-muted-foreground", children: emptyText }),
12582
- /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("ul", { className: "flex flex-col gap-2", children: records.map((record, i) => {
12646
+ records.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("p", { className: "text-xs text-muted-foreground", children: emptyText }),
12647
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("ul", { className: "flex flex-col gap-2", children: records.map((record, i) => {
12583
12648
  const result = results[i];
12584
12649
  const model = models.find((m) => m.id === record.provenance.modelId);
12585
12650
  const blocked = !result.ok;
12586
- return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
12651
+ return /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(
12587
12652
  "li",
12588
12653
  {
12589
12654
  className: "rounded-md border border-border p-2",
12590
12655
  "data-record": record.id,
12591
12656
  "data-drift": result.drift.length,
12592
12657
  children: [
12593
- /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { className: "flex flex-wrap items-center justify-between gap-2 text-xs", children: [
12594
- /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("span", { className: "font-medium", children: model?.name ?? record.provenance.modelId }),
12595
- /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("span", { className: "text-muted-foreground", children: [
12596
- record.kind !== "generate" && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("span", { "data-kind": "", children: [
12658
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className: "flex flex-wrap items-center justify-between gap-2 text-xs", children: [
12659
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("span", { className: "font-medium", children: model?.name ?? record.provenance.modelId }),
12660
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("span", { className: "text-muted-foreground", children: [
12661
+ record.kind !== "generate" && /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("span", { "data-kind": "", children: [
12597
12662
  record.kind,
12598
12663
  " \xB7 "
12599
12664
  ] }),
12600
- /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("time", { dateTime: record.createdAt, children: record.createdAt.replace("T", " ").slice(0, 16) }),
12601
- record.seed !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(import_jsx_runtime63.Fragment, { children: [
12665
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("time", { dateTime: record.createdAt, children: record.createdAt.replace("T", " ").slice(0, 16) }),
12666
+ record.seed !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(import_jsx_runtime64.Fragment, { children: [
12602
12667
  " \xB7 seed ",
12603
12668
  record.seed
12604
12669
  ] })
12605
12670
  ] })
12606
12671
  ] }),
12607
- /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("p", { className: "mt-1 line-clamp-3 break-words text-xs", "data-record-prompt": "", children: record.provenance.resolvedPrompt }),
12608
- record.assets.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("div", { className: "mt-1 flex flex-wrap gap-1", children: record.assets.map((asset) => /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
12672
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("p", { className: "mt-1 line-clamp-3 break-words text-xs", "data-record-prompt": "", children: record.provenance.resolvedPrompt }),
12673
+ record.assets.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("div", { className: "mt-1 flex flex-wrap gap-1", children: record.assets.map((asset) => /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(
12609
12674
  "span",
12610
12675
  {
12611
12676
  className: "rounded-full bg-muted px-2 py-0.5 text-[10px]",
@@ -12619,16 +12684,16 @@ var GenerationHistory = ({
12619
12684
  `${asset.role}:${asset.id}`
12620
12685
  )) }),
12621
12686
  renderPreview?.(record),
12622
- result.drift.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime63.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_runtime63.jsxs)("li", { className: severityClass[item.severity], "data-drift-type": item.type, children: [
12623
- /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("strong", { children: [
12687
+ result.drift.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime64.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_runtime64.jsxs)("li", { className: severityClass[item.severity], "data-drift-type": item.type, children: [
12688
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("strong", { children: [
12624
12689
  import_generation4.DRIFT_TYPE_LABELS[item.type],
12625
12690
  ":"
12626
12691
  ] }),
12627
12692
  " ",
12628
12693
  item.message
12629
12694
  ] }, j)) }),
12630
- /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { className: "mt-2 flex gap-2", children: [
12631
- onRecreate && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
12695
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className: "mt-2 flex gap-2", children: [
12696
+ onRecreate && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
12632
12697
  "button",
12633
12698
  {
12634
12699
  type: "button",
@@ -12640,7 +12705,7 @@ var GenerationHistory = ({
12640
12705
  children: "Recreate"
12641
12706
  }
12642
12707
  ),
12643
- onVariation && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
12708
+ onVariation && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
12644
12709
  "button",
12645
12710
  {
12646
12711
  type: "button",
@@ -12650,7 +12715,7 @@ var GenerationHistory = ({
12650
12715
  children: "Variation"
12651
12716
  }
12652
12717
  ),
12653
- onRemove && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
12718
+ onRemove && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
12654
12719
  "button",
12655
12720
  {
12656
12721
  type: "button",
@@ -12670,19 +12735,19 @@ var GenerationHistory = ({
12670
12735
  };
12671
12736
 
12672
12737
  // src/find-replace/useFindReplace.ts
12673
- var import_react86 = require("react");
12738
+ var import_react87 = require("react");
12674
12739
  var import_editor17 = require("@pixerate/editor");
12675
12740
  var noopUnsubscribe2 = () => {
12676
12741
  };
12677
12742
  function useFindReplace(editor) {
12678
12743
  const store = (0, import_editor17.getFindReplaceStore)(editor ?? null);
12679
- const subscribe = (0, import_react86.useCallback)(
12744
+ const subscribe = (0, import_react87.useCallback)(
12680
12745
  (onChange) => store ? store.subscribe(() => onChange()) : noopUnsubscribe2,
12681
12746
  [store]
12682
12747
  );
12683
12748
  const getSnapshot2 = () => store?.getSnapshot() ?? import_editor17.EMPTY_FIND_REPLACE_SNAPSHOT;
12684
- const snapshot = (0, import_react86.useSyncExternalStore)(subscribe, getSnapshot2, getSnapshot2);
12685
- return (0, import_react86.useMemo)(() => {
12749
+ const snapshot = (0, import_react87.useSyncExternalStore)(subscribe, getSnapshot2, getSnapshot2);
12750
+ return (0, import_react87.useMemo)(() => {
12686
12751
  const run = (fn) => {
12687
12752
  if (editor && !editor.isDestroyed && store) fn(editor);
12688
12753
  };
@@ -12706,9 +12771,9 @@ function useFindReplace(editor) {
12706
12771
  }
12707
12772
 
12708
12773
  // src/find-replace/FindReplaceBar.tsx
12709
- var import_react87 = require("react");
12774
+ var import_react88 = require("react");
12710
12775
  var import_editor18 = require("@pixerate/editor");
12711
- var import_jsx_runtime64 = require("react/jsx-runtime");
12776
+ var import_jsx_runtime65 = require("react/jsx-runtime");
12712
12777
  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";
12713
12778
  var buttonClass5 = "rounded px-2 py-1 text-xs text-foreground hover:bg-muted disabled:opacity-40 disabled:hover:bg-transparent";
12714
12779
  var toggleClass = (on) => `${buttonClass5} font-mono ${on ? "bg-primary/10 text-primary" : "text-muted-foreground"}`;
@@ -12721,10 +12786,10 @@ var FindReplaceBar = ({
12721
12786
  onClose
12722
12787
  }) => {
12723
12788
  const find = useFindReplace(editor);
12724
- const findInput = (0, import_react87.useRef)(null);
12725
- const [moreOpen, setMoreOpen] = (0, import_react87.useState)(false);
12789
+ const findInput = (0, import_react88.useRef)(null);
12790
+ const [moreOpen, setMoreOpen] = (0, import_react88.useState)(false);
12726
12791
  const visible = find.available && (alwaysOpen || find.open);
12727
- (0, import_react87.useEffect)(() => {
12792
+ (0, import_react88.useEffect)(() => {
12728
12793
  if (!visible || find.focusRequest === 0) return;
12729
12794
  findInput.current?.focus();
12730
12795
  findInput.current?.select();
@@ -12762,9 +12827,9 @@ var FindReplaceBar = ({
12762
12827
  if (isMod(e)) find.replaceAll();
12763
12828
  else find.replace();
12764
12829
  };
12765
- return /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className, role: "search", "aria-label": "Find and replace", onKeyDown: onBarKeyDown, children: [
12766
- /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className: "flex items-center gap-1", children: [
12767
- /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
12830
+ return /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { className, role: "search", "aria-label": "Find and replace", onKeyDown: onBarKeyDown, children: [
12831
+ /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { className: "flex items-center gap-1", children: [
12832
+ /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
12768
12833
  "button",
12769
12834
  {
12770
12835
  type: "button",
@@ -12775,7 +12840,7 @@ var FindReplaceBar = ({
12775
12840
  children: showReplace ? "\u25BE" : "\u25B8"
12776
12841
  }
12777
12842
  ),
12778
- /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
12843
+ /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
12779
12844
  "input",
12780
12845
  {
12781
12846
  ref: findInput,
@@ -12789,7 +12854,7 @@ var FindReplaceBar = ({
12789
12854
  onKeyDown: onFindKeyDown
12790
12855
  }
12791
12856
  ),
12792
- import_editor18.FIND_OPTION_TOGGLES.filter((t) => !t.advanced).map((t) => /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
12857
+ import_editor18.FIND_OPTION_TOGGLES.filter((t) => !t.advanced).map((t) => /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
12793
12858
  "button",
12794
12859
  {
12795
12860
  type: "button",
@@ -12802,7 +12867,7 @@ var FindReplaceBar = ({
12802
12867
  },
12803
12868
  t.key
12804
12869
  )),
12805
- /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
12870
+ /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
12806
12871
  "span",
12807
12872
  {
12808
12873
  className: `min-w-[5rem] px-1 text-center text-xs ${find.error ? "text-destructive" : "text-muted-foreground"}`,
@@ -12812,9 +12877,9 @@ var FindReplaceBar = ({
12812
12877
  children: status
12813
12878
  }
12814
12879
  ),
12815
- /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("button", { type: "button", className: buttonClass5, "aria-label": "Previous match", disabled: !hasMatches, onClick: find.previous, children: "\u2191" }),
12816
- /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("button", { type: "button", className: buttonClass5, "aria-label": "Next match", disabled: !hasMatches, onClick: find.next, children: "\u2193" }),
12817
- showMoreOptions && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
12880
+ /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("button", { type: "button", className: buttonClass5, "aria-label": "Previous match", disabled: !hasMatches, onClick: find.previous, children: "\u2191" }),
12881
+ /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("button", { type: "button", className: buttonClass5, "aria-label": "Next match", disabled: !hasMatches, onClick: find.next, children: "\u2193" }),
12882
+ showMoreOptions && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
12818
12883
  "button",
12819
12884
  {
12820
12885
  type: "button",
@@ -12825,10 +12890,10 @@ var FindReplaceBar = ({
12825
12890
  children: "\u2026"
12826
12891
  }
12827
12892
  ),
12828
- /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("button", { type: "button", className: buttonClass5, "aria-label": "Close find", onClick: close, children: "\xD7" })
12893
+ /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("button", { type: "button", className: buttonClass5, "aria-label": "Close find", onClick: close, children: "\xD7" })
12829
12894
  ] }),
12830
- showReplace && /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className: "flex items-center gap-1 pl-7", children: [
12831
- /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
12895
+ showReplace && /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { className: "flex items-center gap-1 pl-7", children: [
12896
+ /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
12832
12897
  "input",
12833
12898
  {
12834
12899
  type: "text",
@@ -12840,7 +12905,7 @@ var FindReplaceBar = ({
12840
12905
  onKeyDown: onReplaceKeyDown
12841
12906
  }
12842
12907
  ),
12843
- /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
12908
+ /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
12844
12909
  "button",
12845
12910
  {
12846
12911
  type: "button",
@@ -12850,11 +12915,11 @@ var FindReplaceBar = ({
12850
12915
  children: "Replace"
12851
12916
  }
12852
12917
  ),
12853
- /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("button", { type: "button", className: buttonClass5, disabled: !hasMatches, onClick: find.replaceAll, children: "Replace all" }),
12854
- find.lastReplaceCount !== null && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("span", { className: "px-1 text-xs text-muted-foreground", "aria-live": "polite", children: find.lastReplaceCount === 1 ? "1 replaced" : `${find.lastReplaceCount} replaced` })
12918
+ /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("button", { type: "button", className: buttonClass5, disabled: !hasMatches, onClick: find.replaceAll, children: "Replace all" }),
12919
+ find.lastReplaceCount !== null && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("span", { className: "px-1 text-xs text-muted-foreground", "aria-live": "polite", children: find.lastReplaceCount === 1 ? "1 replaced" : `${find.lastReplaceCount} replaced` })
12855
12920
  ] }),
12856
- showMoreOptions && moreOpen && /* @__PURE__ */ (0, import_jsx_runtime64.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_runtime64.jsxs)("label", { className: "flex items-center gap-1", children: [
12857
- /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
12921
+ showMoreOptions && moreOpen && /* @__PURE__ */ (0, import_jsx_runtime65.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_runtime65.jsxs)("label", { className: "flex items-center gap-1", children: [
12922
+ /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
12858
12923
  "input",
12859
12924
  {
12860
12925
  type: "checkbox",
@@ -12868,12 +12933,12 @@ var FindReplaceBar = ({
12868
12933
  };
12869
12934
 
12870
12935
  // src/tables/useTableMenu.ts
12871
- var import_react88 = require("react");
12936
+ var import_react89 = require("react");
12872
12937
  var import_editor19 = require("@pixerate/editor");
12873
12938
  function useTableMenu(editor) {
12874
- const store = (0, import_react88.useMemo)(() => (0, import_editor19.createTableStore)(editor), [editor]);
12875
- const snapshot = (0, import_react88.useSyncExternalStore)(store.subscribe, store.getSnapshot, store.getSnapshot);
12876
- return (0, import_react88.useMemo)(
12939
+ const store = (0, import_react89.useMemo)(() => (0, import_editor19.createTableStore)(editor), [editor]);
12940
+ const snapshot = (0, import_react89.useSyncExternalStore)(store.subscribe, store.getSnapshot, store.getSnapshot);
12941
+ return (0, import_react89.useMemo)(
12877
12942
  () => ({
12878
12943
  ...snapshot,
12879
12944
  run: (action, params) => (0, import_editor19.runTableAction)(editor, action, params, { focus: true }),
@@ -12884,9 +12949,9 @@ function useTableMenu(editor) {
12884
12949
  }
12885
12950
 
12886
12951
  // src/tables/TableToolbar.tsx
12887
- var import_react89 = __toESM(require("react"), 1);
12952
+ var import_react90 = __toESM(require("react"), 1);
12888
12953
  var import_editor20 = require("@pixerate/editor");
12889
- var import_jsx_runtime65 = require("react/jsx-runtime");
12954
+ var import_jsx_runtime66 = require("react/jsx-runtime");
12890
12955
  var keepSelection2 = (event) => event.preventDefault();
12891
12956
  var TableToolbar = ({
12892
12957
  editor,
@@ -12900,14 +12965,14 @@ var TableToolbar = ({
12900
12965
  }) => {
12901
12966
  const table = useTableMenu(editor);
12902
12967
  if (!editor || !table.inTable && !showWhenOutside) return null;
12903
- return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("div", { className, role: "toolbar", "aria-label": "Table", "data-table-toolbar": "", children: items.map((item, index) => {
12968
+ return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { className, role: "toolbar", "aria-label": "Table", "data-table-toolbar": "", children: items.map((item, index) => {
12904
12969
  const status = table.check(item.action, item.params);
12905
12970
  const enabled = status === true;
12906
12971
  const active = item.active?.(table);
12907
12972
  const separator = index > 0 && items[index - 1].group !== item.group;
12908
- return /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(import_react89.default.Fragment, { children: [
12909
- separator && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("span", { className: separatorClassName, "aria-hidden": "true" }),
12910
- /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
12973
+ return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(import_react90.default.Fragment, { children: [
12974
+ separator && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("span", { className: separatorClassName, "aria-hidden": "true" }),
12975
+ /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
12911
12976
  "button",
12912
12977
  {
12913
12978
  type: "button",
@@ -12929,8 +12994,8 @@ var TableToolbar = ({
12929
12994
  };
12930
12995
 
12931
12996
  // src/tables/InsertTableGrid.tsx
12932
- var import_react90 = require("react");
12933
- var import_jsx_runtime66 = require("react/jsx-runtime");
12997
+ var import_react91 = require("react");
12998
+ var import_jsx_runtime67 = require("react/jsx-runtime");
12934
12999
  var keepSelection3 = (event) => event.preventDefault();
12935
13000
  var InsertTableGrid = ({
12936
13001
  editor,
@@ -12943,14 +13008,14 @@ var InsertTableGrid = ({
12943
13008
  onInsert
12944
13009
  }) => {
12945
13010
  const table = useTableMenu(editor);
12946
- const [hover, setHover] = (0, import_react90.useState)(null);
13011
+ const [hover, setHover] = (0, import_react91.useState)(null);
12947
13012
  const status = table.actions.insertTable;
12948
13013
  const disabled = !editor || !status.enabled;
12949
13014
  const insert = (size) => {
12950
13015
  if (table.run("insertTable", { ...size, withHeaderRow })) onInsert?.(size);
12951
13016
  setHover(null);
12952
13017
  };
12953
- return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(
13018
+ return /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(
12954
13019
  "div",
12955
13020
  {
12956
13021
  className,
@@ -12960,7 +13025,7 @@ var InsertTableGrid = ({
12960
13025
  "data-insert-table-grid": "",
12961
13026
  onMouseLeave: () => setHover(null),
12962
13027
  children: [
12963
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
13028
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
12964
13029
  "div",
12965
13030
  {
12966
13031
  role: "grid",
@@ -12969,7 +13034,7 @@ var InsertTableGrid = ({
12969
13034
  children: Array.from({ length: rows * cols }, (_, i) => {
12970
13035
  const size = { rows: Math.floor(i / cols) + 1, cols: i % cols + 1 };
12971
13036
  const active = !!hover && size.rows <= hover.rows && size.cols <= hover.cols;
12972
- return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
13037
+ return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
12973
13038
  "button",
12974
13039
  {
12975
13040
  type: "button",
@@ -12989,7 +13054,7 @@ var InsertTableGrid = ({
12989
13054
  })
12990
13055
  }
12991
13056
  ),
12992
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { "aria-live": "polite", "data-testid": "insert-table-size", children: disabled ? status.reason : hover ? `${hover.rows} \xD7 ${hover.cols}` : "Insert table" })
13057
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { "aria-live": "polite", "data-testid": "insert-table-size", children: disabled ? status.reason : hover ? `${hover.rows} \xD7 ${hover.cols}` : "Insert table" })
12993
13058
  ]
12994
13059
  }
12995
13060
  );
@@ -12997,31 +13062,31 @@ var InsertTableGrid = ({
12997
13062
 
12998
13063
  // src/tables/TableBubbleMenu.tsx
12999
13064
  var import_editor21 = require("@pixerate/editor");
13000
- var import_jsx_runtime67 = require("react/jsx-runtime");
13065
+ var import_jsx_runtime68 = require("react/jsx-runtime");
13001
13066
  var TableBubbleMenu = ({
13002
13067
  editor,
13003
13068
  children,
13004
13069
  toolbarProps,
13005
13070
  pluginKey = "tableBubbleMenu",
13006
13071
  ...rest
13007
- }) => /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(BubbleMenu, { editor, pluginKey, shouldShow: import_editor21.shouldShowTableBubbleMenu, ...rest, children: children ?? /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(TableToolbar, { editor, ...toolbarProps }) });
13072
+ }) => /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(BubbleMenu, { editor, pluginKey, shouldShow: import_editor21.shouldShowTableBubbleMenu, ...rest, children: children ?? /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(TableToolbar, { editor, ...toolbarProps }) });
13008
13073
 
13009
13074
  // src/chart-node/ChartNodeView.tsx
13010
13075
  var import_client = require("react-dom/client");
13011
13076
 
13012
13077
  // src/chart/ChartCanvas.tsx
13013
- var import_react92 = require("react");
13078
+ var import_react93 = require("react");
13014
13079
  var import_chart2 = require("@pixerate/editor/chart");
13015
13080
 
13016
13081
  // src/chart/useChartEditor.ts
13017
- var import_react91 = require("react");
13082
+ var import_react92 = require("react");
13018
13083
  var import_chart = require("@pixerate/editor/chart");
13019
13084
  function useChartState(controller) {
13020
- return (0, import_react91.useSyncExternalStore)(controller.subscribe, controller.getState, controller.getState);
13085
+ return (0, import_react92.useSyncExternalStore)(controller.subscribe, controller.getState, controller.getState);
13021
13086
  }
13022
13087
 
13023
13088
  // src/chart/ChartCanvas.tsx
13024
- var import_jsx_runtime68 = require("react/jsx-runtime");
13089
+ var import_jsx_runtime69 = require("react/jsx-runtime");
13025
13090
  function renderChartMark(mark, fontFamily, interactive) {
13026
13091
  const common = {
13027
13092
  "data-role": mark.role,
@@ -13033,9 +13098,9 @@ function renderChartMark(mark, fontFamily, interactive) {
13033
13098
  };
13034
13099
  switch (mark.kind) {
13035
13100
  case "rect":
13036
- return /* @__PURE__ */ (0, import_jsx_runtime68.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);
13101
+ return /* @__PURE__ */ (0, import_jsx_runtime69.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);
13037
13102
  case "path":
13038
- return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
13103
+ return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
13039
13104
  "path",
13040
13105
  {
13041
13106
  ...common,
@@ -13048,11 +13113,11 @@ function renderChartMark(mark, fontFamily, interactive) {
13048
13113
  mark.key
13049
13114
  );
13050
13115
  case "circle":
13051
- return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("circle", { ...common, cx: mark.cx, cy: mark.cy, r: mark.r, style: { fill: mark.fill, stroke: mark.stroke, strokeWidth: mark.strokeWidth } }, mark.key);
13116
+ return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("circle", { ...common, cx: mark.cx, cy: mark.cy, r: mark.r, style: { fill: mark.fill, stroke: mark.stroke, strokeWidth: mark.strokeWidth } }, mark.key);
13052
13117
  case "line":
13053
- return /* @__PURE__ */ (0, import_jsx_runtime68.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);
13118
+ return /* @__PURE__ */ (0, import_jsx_runtime69.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);
13054
13119
  case "text":
13055
- return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
13120
+ return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
13056
13121
  "text",
13057
13122
  {
13058
13123
  ...common,
@@ -13069,36 +13134,36 @@ function renderChartMark(mark, fontFamily, interactive) {
13069
13134
  }
13070
13135
  }
13071
13136
  function ChartPresenceLayer({ presence }) {
13072
- const { actors } = (0, import_react92.useSyncExternalStore)(presence.subscribe, presence.getState, presence.getState);
13073
- return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("g", { "data-chart-presence": "", pointerEvents: "none", children: actors.map((a) => /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("g", { transform: `translate(${a.x} ${a.y})`, "data-actor": a.id, children: [
13074
- /* @__PURE__ */ (0, import_jsx_runtime68.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 }),
13075
- /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("g", { transform: "translate(13 16)", children: [
13076
- /* @__PURE__ */ (0, import_jsx_runtime68.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 } }),
13077
- /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("text", { x: 6, y: 9, dominantBaseline: "central", style: { fill: "#ffffff", fontSize: 11, fontWeight: 600, fontFamily: "inherit" }, children: a.message ?? a.name })
13137
+ const { actors } = (0, import_react93.useSyncExternalStore)(presence.subscribe, presence.getState, presence.getState);
13138
+ return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("g", { "data-chart-presence": "", pointerEvents: "none", children: actors.map((a) => /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("g", { transform: `translate(${a.x} ${a.y})`, "data-actor": a.id, children: [
13139
+ /* @__PURE__ */ (0, import_jsx_runtime69.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 }),
13140
+ /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("g", { transform: "translate(13 16)", children: [
13141
+ /* @__PURE__ */ (0, import_jsx_runtime69.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 } }),
13142
+ /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("text", { x: 6, y: 9, dominantBaseline: "central", style: { fill: "#ffffff", fontSize: 11, fontWeight: 600, fontFamily: "inherit" }, children: a.message ?? a.name })
13078
13143
  ] })
13079
13144
  ] }, a.id)) });
13080
13145
  }
13081
13146
  function ChartTooltipContent({ tooltip }) {
13082
- return /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(import_jsx_runtime68.Fragment, { children: [
13083
- tooltip.title && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("div", { className: "mb-1 font-medium", children: tooltip.title }),
13084
- tooltip.items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { className: "flex items-center gap-2", children: [
13085
- /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("span", { className: "h-2 w-2 shrink-0 rounded-full", style: { background: item.color } }),
13086
- /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("span", { style: { color: "var(--muted-foreground, #64748b)" }, children: item.name }),
13087
- /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("span", { className: "ml-auto pl-3 font-medium tabular-nums", children: item.text })
13147
+ return /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(import_jsx_runtime69.Fragment, { children: [
13148
+ tooltip.title && /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("div", { className: "mb-1 font-medium", children: tooltip.title }),
13149
+ tooltip.items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("div", { className: "flex items-center gap-2", children: [
13150
+ /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("span", { className: "h-2 w-2 shrink-0 rounded-full", style: { background: item.color } }),
13151
+ /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("span", { style: { color: "var(--muted-foreground, #64748b)" }, children: item.name }),
13152
+ /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("span", { className: "ml-auto pl-3 font-medium tabular-nums", children: item.text })
13088
13153
  ] }, item.seriesId))
13089
13154
  ] });
13090
13155
  }
13091
13156
  function ChartCanvas({ controller, width = 640, height = 400, responsive = true, theme, editable = true, measureText, emptyMessage, className, presence, sceneRef, tooltip = false, renderTooltip }) {
13092
13157
  const state = useChartState(controller);
13093
- const wrapper = (0, import_react92.useRef)(null);
13094
- const svg = (0, import_react92.useRef)(null);
13095
- const drag = (0, import_react92.useRef)(null);
13096
- const [measured, setMeasured] = (0, import_react92.useState)(null);
13097
- const [frozen, setFrozen] = (0, import_react92.useState)(null);
13158
+ const wrapper = (0, import_react93.useRef)(null);
13159
+ const svg = (0, import_react93.useRef)(null);
13160
+ const drag = (0, import_react93.useRef)(null);
13161
+ const [measured, setMeasured] = (0, import_react93.useState)(null);
13162
+ const [frozen, setFrozen] = (0, import_react93.useState)(null);
13098
13163
  const tooltipMode = tooltip === true ? "point" : tooltip || null;
13099
- const [tip, setTip] = (0, import_react92.useState)(null);
13100
- const [tipAt, setTipAt] = (0, import_react92.useState)({ left: 0, top: 0, flip: false });
13101
- (0, import_react92.useEffect)(() => {
13164
+ const [tip, setTip] = (0, import_react93.useState)(null);
13165
+ const [tipAt, setTipAt] = (0, import_react93.useState)({ left: 0, top: 0, flip: false });
13166
+ (0, import_react93.useEffect)(() => {
13102
13167
  const el = wrapper.current;
13103
13168
  if (!responsive || !el || typeof ResizeObserver === "undefined") return;
13104
13169
  const observer = new ResizeObserver(([entry]) => {
@@ -13109,8 +13174,8 @@ function ChartCanvas({ controller, width = 640, height = 400, responsive = true,
13109
13174
  return () => observer.disconnect();
13110
13175
  }, [responsive]);
13111
13176
  const sceneWidth = responsive && measured || width;
13112
- const fullTheme = (0, import_react92.useMemo)(() => ({ ...import_chart2.CSS_VARIABLE_CHART_THEME, ...theme }), [theme]);
13113
- const scene = (0, import_react92.useMemo)(
13177
+ const fullTheme = (0, import_react93.useMemo)(() => ({ ...import_chart2.CSS_VARIABLE_CHART_THEME, ...theme }), [theme]);
13178
+ const scene = (0, import_react93.useMemo)(
13114
13179
  () => (0, import_chart2.layoutChart)(state.spec, {
13115
13180
  width: sceneWidth,
13116
13181
  height,
@@ -13127,8 +13192,8 @@ function ChartCanvas({ controller, width = 640, height = 400, responsive = true,
13127
13192
  [state.spec, state.selection, state.raceFrame, sceneWidth, height, fullTheme, editable, measureText, emptyMessage, frozen]
13128
13193
  );
13129
13194
  if (sceneRef) sceneRef.current = scene;
13130
- const byKey = (0, import_react92.useMemo)(() => new Map(scene.marks.map((m) => [m.key, m])), [scene]);
13131
- (0, import_react92.useEffect)(() => () => drag.current?.end(), []);
13195
+ const byKey = (0, import_react93.useMemo)(() => new Map(scene.marks.map((m) => [m.key, m])), [scene]);
13196
+ (0, import_react93.useEffect)(() => () => drag.current?.end(), []);
13132
13197
  const scenePoint = (e) => (0, import_chart2.chartClientToScene)(scene, svg.current.getBoundingClientRect(), e.clientX, e.clientY);
13133
13198
  const onPointerDown = (e) => {
13134
13199
  if (!editable || e.button !== 0) return;
@@ -13175,8 +13240,8 @@ function ChartCanvas({ controller, width = 640, height = 400, responsive = true,
13175
13240
  if (editable && (0, import_chart2.handleChartKey)(controller, scene, e)) e.preventDefault();
13176
13241
  };
13177
13242
  const label = state.spec.title || "Chart";
13178
- return /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { ref: wrapper, className: `relative w-full ${className ?? ""}`, "data-chart-canvas": "", children: [
13179
- /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(
13243
+ return /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("div", { ref: wrapper, className: `relative w-full ${className ?? ""}`, "data-chart-canvas": "", children: [
13244
+ /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(
13180
13245
  "svg",
13181
13246
  {
13182
13247
  ref: svg,
@@ -13195,11 +13260,11 @@ function ChartCanvas({ controller, width = 640, height = 400, responsive = true,
13195
13260
  onKeyDown,
13196
13261
  children: [
13197
13262
  scene.marks.map((m) => renderChartMark(m, scene.theme.fontFamily, editable)),
13198
- presence && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(ChartPresenceLayer, { presence })
13263
+ presence && /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(ChartPresenceLayer, { presence })
13199
13264
  ]
13200
13265
  }
13201
13266
  ),
13202
- tip && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
13267
+ tip && /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
13203
13268
  "div",
13204
13269
  {
13205
13270
  role: "tooltip",
@@ -13214,14 +13279,14 @@ function ChartCanvas({ controller, width = 640, height = 400, responsive = true,
13214
13279
  borderColor: "var(--border, #e2e8f0)",
13215
13280
  fontFamily: scene.theme.fontFamily
13216
13281
  },
13217
- children: renderTooltip ? renderTooltip(tip) : /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(ChartTooltipContent, { tooltip: tip })
13282
+ children: renderTooltip ? renderTooltip(tip) : /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(ChartTooltipContent, { tooltip: tip })
13218
13283
  }
13219
13284
  )
13220
13285
  ] });
13221
13286
  }
13222
13287
 
13223
13288
  // src/chart/ChartDataGrid.tsx
13224
- var import_react93 = require("react");
13289
+ var import_react94 = require("react");
13225
13290
  var import_chart3 = require("@pixerate/editor/chart");
13226
13291
 
13227
13292
  // src/chart/styles.ts
@@ -13234,11 +13299,11 @@ var chartSectionClass = "space-y-2 border-b border-border pb-3 last:border-b-0";
13234
13299
  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";
13235
13300
 
13236
13301
  // src/chart/ChartDataGrid.tsx
13237
- var import_jsx_runtime69 = require("react/jsx-runtime");
13302
+ var import_jsx_runtime70 = require("react/jsx-runtime");
13238
13303
  function ChartCommitInput({ value, onCommit, onKeyDown, onBlur, ...rest }) {
13239
- const [draft, setDraft] = (0, import_react93.useState)(value);
13240
- const typing = (0, import_react93.useRef)(false);
13241
- (0, import_react93.useEffect)(() => {
13304
+ const [draft, setDraft] = (0, import_react94.useState)(value);
13305
+ const typing = (0, import_react94.useRef)(false);
13306
+ (0, import_react94.useEffect)(() => {
13242
13307
  if (!typing.current) setDraft(value);
13243
13308
  }, [value]);
13244
13309
  const commit = () => {
@@ -13247,7 +13312,7 @@ function ChartCommitInput({ value, onCommit, onKeyDown, onBlur, ...rest }) {
13247
13312
  if (draft === value) return;
13248
13313
  if (onCommit(draft) === false) setDraft(value);
13249
13314
  };
13250
- return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
13315
+ return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
13251
13316
  "input",
13252
13317
  {
13253
13318
  ...rest,
@@ -13276,20 +13341,20 @@ function ChartCommitInput({ value, onCommit, onKeyDown, onBlur, ...rest }) {
13276
13341
  }
13277
13342
  function ChartTreeGrid({ controller, readOnly = false, className }) {
13278
13343
  const { spec } = useChartState(controller);
13279
- const [columns, setColumns] = (0, import_react93.useState)(1);
13344
+ const [columns, setColumns] = (0, import_react94.useState)(1);
13280
13345
  const rows = (0, import_chart3.chartTreeToRows)(spec.tree);
13281
13346
  const depth = Math.max(columns, (0, import_chart3.chartTreeDepth)(spec.tree));
13282
13347
  const labels = (0, import_chart3.chartTreeColumnLabels)(depth);
13283
13348
  const commit = (next) => controller.setTreeRows(next).ok;
13284
- return /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("div", { className: `overflow-auto rounded-md border border-border ${className ?? ""}`, "data-chart-grid": "", "data-chart-tree-grid": "", children: [
13285
- /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("table", { className: "w-full border-collapse text-xs", children: [
13286
- /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("thead", { className: "bg-muted/50", children: /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("tr", { children: [
13287
- labels.map((label) => /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("th", { className: "border-b border-r border-border px-2 py-1 text-left font-medium text-muted-foreground", children: label }, label)),
13288
- /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("th", { className: "border-b border-r border-border px-2 py-1 text-right font-medium text-muted-foreground", children: "Value" }),
13289
- !readOnly && /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("th", { className: "w-8 border-b border-border" })
13349
+ return /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: `overflow-auto rounded-md border border-border ${className ?? ""}`, "data-chart-grid": "", "data-chart-tree-grid": "", children: [
13350
+ /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("table", { className: "w-full border-collapse text-xs", children: [
13351
+ /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("thead", { className: "bg-muted/50", children: /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("tr", { children: [
13352
+ labels.map((label) => /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("th", { className: "border-b border-r border-border px-2 py-1 text-left font-medium text-muted-foreground", children: label }, label)),
13353
+ /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("th", { className: "border-b border-r border-border px-2 py-1 text-right font-medium text-muted-foreground", children: "Value" }),
13354
+ !readOnly && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("th", { className: "w-8 border-b border-border" })
13290
13355
  ] }) }),
13291
- /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("tbody", { children: rows.map((row, r) => /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("tr", { "data-tree-row": r, children: [
13292
- labels.map((_, k) => /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("td", { className: "border-b border-r border-border p-0", children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
13356
+ /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("tbody", { children: rows.map((row, r) => /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("tr", { "data-tree-row": r, children: [
13357
+ labels.map((_, k) => /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("td", { className: "border-b border-r border-border p-0", children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
13293
13358
  ChartCommitInput,
13294
13359
  {
13295
13360
  value: row.path[k] ?? "",
@@ -13300,7 +13365,7 @@ function ChartTreeGrid({ controller, readOnly = false, className }) {
13300
13365
  className: `${chartCellClass} text-left`
13301
13366
  }
13302
13367
  ) }, k)),
13303
- /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("td", { className: "border-b border-r border-border p-0", children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
13368
+ /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("td", { className: "border-b border-r border-border p-0", children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
13304
13369
  ChartCommitInput,
13305
13370
  {
13306
13371
  value: String(row.value),
@@ -13313,14 +13378,14 @@ function ChartTreeGrid({ controller, readOnly = false, className }) {
13313
13378
  className: chartCellClass
13314
13379
  }
13315
13380
  ) }),
13316
- !readOnly && /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("td", { className: "border-b border-border px-1", children: /* @__PURE__ */ (0, import_jsx_runtime69.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" }) })
13381
+ !readOnly && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("td", { className: "border-b border-border px-1", children: /* @__PURE__ */ (0, import_jsx_runtime70.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" }) })
13317
13382
  ] }, r)) })
13318
13383
  ] }),
13319
- !readOnly && /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("div", { className: "flex flex-wrap gap-1 p-1", children: [
13320
- /* @__PURE__ */ (0, import_jsx_runtime69.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" }),
13321
- /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("button", { type: "button", className: `${chartButtonClass} h-6 border-dashed`, "data-action": "tree-add-level", disabled: depth >= 6, onClick: () => setColumns(depth + 1), children: "+ Level" }),
13322
- /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("span", { className: "flex-1" }),
13323
- /* @__PURE__ */ (0, import_jsx_runtime69.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" })
13384
+ !readOnly && /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "flex flex-wrap gap-1 p-1", children: [
13385
+ /* @__PURE__ */ (0, import_jsx_runtime70.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" }),
13386
+ /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("button", { type: "button", className: `${chartButtonClass} h-6 border-dashed`, "data-action": "tree-add-level", disabled: depth >= 6, onClick: () => setColumns(depth + 1), children: "+ Level" }),
13387
+ /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("span", { className: "flex-1" }),
13388
+ /* @__PURE__ */ (0, import_jsx_runtime70.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" })
13324
13389
  ] })
13325
13390
  ] });
13326
13391
  }
@@ -13328,30 +13393,30 @@ function ChartLinksGrid({ controller, readOnly = false, className }) {
13328
13393
  const { spec } = useChartState(controller);
13329
13394
  const links = spec.links;
13330
13395
  const commit = (next) => controller.setLinks(next).ok;
13331
- return /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("div", { className: `overflow-auto rounded-md border border-border ${className ?? ""}`, "data-chart-grid": "", "data-chart-links-grid": "", children: [
13332
- /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("table", { className: "w-full border-collapse text-xs", children: [
13333
- /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("thead", { className: "bg-muted/50", children: /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("tr", { children: [
13334
- ["Source", "Target"].map((label) => /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("th", { className: "border-b border-r border-border px-2 py-1 text-left font-medium text-muted-foreground", children: label }, label)),
13335
- /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("th", { className: "border-b border-r border-border px-2 py-1 text-right font-medium text-muted-foreground", children: "Value" }),
13336
- !readOnly && /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("th", { className: "w-8 border-b border-border" })
13396
+ return /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: `overflow-auto rounded-md border border-border ${className ?? ""}`, "data-chart-grid": "", "data-chart-links-grid": "", children: [
13397
+ /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("table", { className: "w-full border-collapse text-xs", children: [
13398
+ /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("thead", { className: "bg-muted/50", children: /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("tr", { children: [
13399
+ ["Source", "Target"].map((label) => /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("th", { className: "border-b border-r border-border px-2 py-1 text-left font-medium text-muted-foreground", children: label }, label)),
13400
+ /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("th", { className: "border-b border-r border-border px-2 py-1 text-right font-medium text-muted-foreground", children: "Value" }),
13401
+ !readOnly && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("th", { className: "w-8 border-b border-border" })
13337
13402
  ] }) }),
13338
- /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("tbody", { children: links.map((link, i) => /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("tr", { "data-link-row": i, children: [
13339
- ["source", "target"].map((field) => /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("td", { className: "border-b border-r border-border p-0", children: /* @__PURE__ */ (0, import_jsx_runtime69.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)),
13340
- /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("td", { className: "border-b border-r border-border p-0", children: /* @__PURE__ */ (0, import_jsx_runtime69.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 }) }),
13341
- !readOnly && /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("td", { className: "border-b border-border px-1", children: /* @__PURE__ */ (0, import_jsx_runtime69.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" }) })
13403
+ /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("tbody", { children: links.map((link, i) => /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("tr", { "data-link-row": i, children: [
13404
+ ["source", "target"].map((field) => /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("td", { className: "border-b border-r border-border p-0", children: /* @__PURE__ */ (0, import_jsx_runtime70.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)),
13405
+ /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("td", { className: "border-b border-r border-border p-0", children: /* @__PURE__ */ (0, import_jsx_runtime70.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 }) }),
13406
+ !readOnly && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("td", { className: "border-b border-border px-1", children: /* @__PURE__ */ (0, import_jsx_runtime70.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" }) })
13342
13407
  ] }, i)) })
13343
13408
  ] }),
13344
- !readOnly && /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("div", { className: "flex flex-wrap gap-1 p-1", children: [
13345
- /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("button", { type: "button", className: `${chartButtonClass} h-6 border-dashed`, "data-action": "link-add", onClick: () => commit((0, import_chart3.addChartLink)(links)), children: "+ Add flow" }),
13346
- /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("span", { className: "flex-1" }),
13347
- links.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime69.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" })
13409
+ !readOnly && /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "flex flex-wrap gap-1 p-1", children: [
13410
+ /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("button", { type: "button", className: `${chartButtonClass} h-6 border-dashed`, "data-action": "link-add", onClick: () => commit((0, import_chart3.addChartLink)(links)), children: "+ Add flow" }),
13411
+ /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("span", { className: "flex-1" }),
13412
+ links.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime70.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" })
13348
13413
  ] })
13349
13414
  ] });
13350
13415
  }
13351
13416
  function ChartDataGrid({ controller, categoryHeader = "Category", readOnly = false, className }) {
13352
13417
  const { spec, selection } = useChartState(controller);
13353
- if (spec.links.length || spec.type === "sankey") return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(ChartLinksGrid, { controller, readOnly, className });
13354
- if (spec.tree.length) return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(ChartTreeGrid, { controller, readOnly, className });
13418
+ if (spec.links.length || spec.type === "sankey") return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(ChartLinksGrid, { controller, readOnly, className });
13419
+ if (spec.tree.length) return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(ChartTreeGrid, { controller, readOnly, className });
13355
13420
  const canGroup = spec.type === "treemap" || spec.type === "sunburst";
13356
13421
  const paste = (row, column) => (e) => {
13357
13422
  const text = e.clipboardData?.getData("text/plain") ?? "";
@@ -13359,15 +13424,15 @@ function ChartDataGrid({ controller, categoryHeader = "Category", readOnly = fal
13359
13424
  e.preventDefault();
13360
13425
  controller.pasteCells(row, column, text);
13361
13426
  };
13362
- return /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("div", { className: `overflow-auto rounded-md border border-border ${className ?? ""}`, "data-chart-grid": "", children: [
13363
- /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("table", { className: "w-full border-collapse text-xs", children: [
13364
- /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("thead", { className: "bg-muted/50", children: /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("tr", { children: [
13365
- /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("th", { className: "border-b border-r border-border px-2 py-1 text-left font-medium text-muted-foreground", children: categoryHeader }),
13427
+ return /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: `overflow-auto rounded-md border border-border ${className ?? ""}`, "data-chart-grid": "", children: [
13428
+ /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("table", { className: "w-full border-collapse text-xs", children: [
13429
+ /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("thead", { className: "bg-muted/50", children: /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("tr", { children: [
13430
+ /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("th", { className: "border-b border-r border-border px-2 py-1 text-left font-medium text-muted-foreground", children: categoryHeader }),
13366
13431
  spec.series.map((s, si) => {
13367
13432
  const color = (0, import_chart3.chartSeriesColor)(spec, si);
13368
13433
  const selected = selection?.kind === "series" && selection.seriesId === s.id;
13369
- return /* @__PURE__ */ (0, import_jsx_runtime69.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_runtime69.jsxs)("div", { className: "flex items-center gap-1", children: [
13370
- /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
13434
+ return /* @__PURE__ */ (0, import_jsx_runtime70.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_runtime70.jsxs)("div", { className: "flex items-center gap-1", children: [
13435
+ /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
13371
13436
  "input",
13372
13437
  {
13373
13438
  type: "color",
@@ -13380,7 +13445,7 @@ function ChartDataGrid({ controller, categoryHeader = "Category", readOnly = fal
13380
13445
  className: "h-5 w-5 shrink-0 cursor-pointer rounded border-0 bg-transparent p-0"
13381
13446
  }
13382
13447
  ),
13383
- /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
13448
+ /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
13384
13449
  ChartCommitInput,
13385
13450
  {
13386
13451
  value: s.name,
@@ -13390,8 +13455,8 @@ function ChartDataGrid({ controller, categoryHeader = "Category", readOnly = fal
13390
13455
  className: `${chartInputClass} h-6 min-w-[5rem] border-transparent bg-transparent font-medium ${s.hidden ? "text-muted-foreground line-through" : ""}`
13391
13456
  }
13392
13457
  ),
13393
- !readOnly && /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(import_jsx_runtime69.Fragment, { children: [
13394
- /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
13458
+ !readOnly && /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(import_jsx_runtime70.Fragment, { children: [
13459
+ /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
13395
13460
  "button",
13396
13461
  {
13397
13462
  type: "button",
@@ -13404,16 +13469,16 @@ function ChartDataGrid({ controller, categoryHeader = "Category", readOnly = fal
13404
13469
  children: s.hidden ? "\u25CB" : "\u25CF"
13405
13470
  }
13406
13471
  ),
13407
- /* @__PURE__ */ (0, import_jsx_runtime69.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" })
13472
+ /* @__PURE__ */ (0, import_jsx_runtime70.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" })
13408
13473
  ] })
13409
13474
  ] }) }, s.id);
13410
13475
  }),
13411
- !readOnly && /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("th", { className: "w-8 border-b border-border px-1", children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("button", { type: "button", className: chartIconButtonClass, title: "Add series", "aria-label": "Add series", "data-action": "add-series", onClick: () => controller.addSeries(), children: "+" }) })
13476
+ !readOnly && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("th", { className: "w-8 border-b border-border px-1", children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("button", { type: "button", className: chartIconButtonClass, title: "Add series", "aria-label": "Add series", "data-action": "add-series", onClick: () => controller.addSeries(), children: "+" }) })
13412
13477
  ] }) }),
13413
- /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("tbody", { children: spec.categories.map((category, i) => {
13478
+ /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("tbody", { children: spec.categories.map((category, i) => {
13414
13479
  const rowSelected = selection?.kind === "category" && selection.index === i;
13415
- return /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("tr", { "data-category-index": i, className: rowSelected ? "bg-primary/10" : void 0, children: [
13416
- /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("th", { className: "border-b border-r border-border p-0 text-left font-normal", children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
13480
+ return /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("tr", { "data-category-index": i, className: rowSelected ? "bg-primary/10" : void 0, children: [
13481
+ /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("th", { className: "border-b border-r border-border p-0 text-left font-normal", children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
13417
13482
  ChartCommitInput,
13418
13483
  {
13419
13484
  value: category,
@@ -13427,7 +13492,7 @@ function ChartDataGrid({ controller, categoryHeader = "Category", readOnly = fal
13427
13492
  spec.series.map((s) => {
13428
13493
  const value = s.values[i];
13429
13494
  const selected = selection?.kind === "point" && selection.seriesId === s.id && selection.index === i;
13430
- return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("td", { className: `border-b border-r border-border p-0 ${selected ? "bg-primary/10" : ""}`, children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
13495
+ return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("td", { className: `border-b border-r border-border p-0 ${selected ? "bg-primary/10" : ""}`, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
13431
13496
  ChartCommitInput,
13432
13497
  {
13433
13498
  value: value === null || value === void 0 ? "" : String(value),
@@ -13442,13 +13507,13 @@ function ChartDataGrid({ controller, categoryHeader = "Category", readOnly = fal
13442
13507
  }
13443
13508
  ) }, s.id);
13444
13509
  }),
13445
- !readOnly && /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("td", { className: "border-b border-border px-1", children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("button", { type: "button", className: chartIconButtonClass, title: "Delete category", "aria-label": `Delete ${category}`, "data-action": "remove-category", onClick: () => controller.removeCategory(i), children: "\xD7" }) })
13510
+ !readOnly && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("td", { className: "border-b border-border px-1", children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("button", { type: "button", className: chartIconButtonClass, title: "Delete category", "aria-label": `Delete ${category}`, "data-action": "remove-category", onClick: () => controller.removeCategory(i), children: "\xD7" }) })
13446
13511
  ] }, i);
13447
13512
  }) })
13448
13513
  ] }),
13449
- !readOnly && /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("div", { className: "p-1", children: [
13450
- /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("button", { type: "button", className: `${chartButtonClass} h-6 border-dashed`, "data-action": "add-category", onClick: () => controller.addCategory(), children: "+ Add category" }),
13451
- canGroup && /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
13514
+ !readOnly && /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "p-1", children: [
13515
+ /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("button", { type: "button", className: `${chartButtonClass} h-6 border-dashed`, "data-action": "add-category", onClick: () => controller.addCategory(), children: "+ Add category" }),
13516
+ canGroup && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
13452
13517
  "button",
13453
13518
  {
13454
13519
  type: "button",
@@ -13464,29 +13529,29 @@ function ChartDataGrid({ controller, categoryHeader = "Category", readOnly = fal
13464
13529
  }
13465
13530
 
13466
13531
  // src/chart/ChartInspector.tsx
13467
- var import_react94 = require("react");
13532
+ var import_react95 = require("react");
13468
13533
  var import_chart4 = require("@pixerate/editor/chart");
13469
- var import_jsx_runtime70 = require("react/jsx-runtime");
13534
+ var import_jsx_runtime71 = require("react/jsx-runtime");
13470
13535
  var cap = (s) => s.charAt(0).toUpperCase() + s.slice(1);
13471
13536
  function Field({ label, htmlFor, children }) {
13472
- return /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "flex items-center gap-2", children: [
13473
- /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("label", { htmlFor, className: `${chartLabelClass} w-20 shrink-0`, children: label }),
13474
- /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { className: "min-w-0 flex-1", children })
13537
+ return /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "flex items-center gap-2", children: [
13538
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("label", { htmlFor, className: `${chartLabelClass} w-20 shrink-0`, children: label }),
13539
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { className: "min-w-0 flex-1", children })
13475
13540
  ] });
13476
13541
  }
13477
13542
  function Toggle({ label, checked, onChange, name }) {
13478
- return /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("label", { className: "flex cursor-pointer items-center gap-2 text-xs text-foreground", children: [
13479
- /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("input", { type: "checkbox", className: "h-3.5 w-3.5 accent-primary", checked, "data-option": name, onChange: (e) => onChange(e.currentTarget.checked) }),
13543
+ return /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("label", { className: "flex cursor-pointer items-center gap-2 text-xs text-foreground", children: [
13544
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("input", { type: "checkbox", className: "h-3.5 w-3.5 accent-primary", checked, "data-option": name, onChange: (e) => onChange(e.currentTarget.checked) }),
13480
13545
  label
13481
13546
  ] });
13482
13547
  }
13483
13548
  function Select({ id, value, options, onChange, name, labels }) {
13484
- return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("select", { id, className: chartInputClass, value, "data-option": name, onChange: (e) => onChange(e.currentTarget.value), children: options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("option", { value: o, children: labels?.[o] ?? cap(o) }, o)) });
13549
+ return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("select", { id, className: chartInputClass, value, "data-option": name, onChange: (e) => onChange(e.currentTarget.value), children: options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("option", { value: o, children: labels?.[o] ?? cap(o) }, o)) });
13485
13550
  }
13486
13551
  function AxisSection({ controller, axis, value, idBase, horizontal, numeric = false, scales = false }) {
13487
13552
  const set = (patch) => controller.setAxis(axis, patch);
13488
13553
  const setFormat = (patch) => set({ format: { ...value.format, ...patch } });
13489
- const bound = (key2) => /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
13554
+ const bound = (key2) => /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
13490
13555
  ChartCommitInput,
13491
13556
  {
13492
13557
  id: `${idBase}-${axis}-${key2}`,
@@ -13501,26 +13566,26 @@ function AxisSection({ controller, axis, value, idBase, horizontal, numeric = fa
13501
13566
  const name = axis === "x" ? numeric ? "X axis" : "Category axis" : axis === "y" ? "Value axis" : "Secondary axis";
13502
13567
  const valueAxis = axis !== "x" || numeric;
13503
13568
  const key = axis === "y2" ? "yAxis2" : `${axis}Axis`;
13504
- return /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: chartSectionClass, "data-section": `axis-${axis}`, children: [
13505
- /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "flex items-center justify-between", children: [
13506
- /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("h4", { className: "text-xs font-semibold text-foreground", children: [
13569
+ return /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: chartSectionClass, "data-section": `axis-${axis}`, children: [
13570
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "flex items-center justify-between", children: [
13571
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("h4", { className: "text-xs font-semibold text-foreground", children: [
13507
13572
  name,
13508
- /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("span", { className: "ml-1 font-normal text-muted-foreground", children: [
13573
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("span", { className: "ml-1 font-normal text-muted-foreground", children: [
13509
13574
  "(",
13510
13575
  axis === "x" ? horizontal ? "left" : "bottom" : axis === "y2" ? horizontal ? "top" : "right" : horizontal ? "bottom" : "left",
13511
13576
  ")"
13512
13577
  ] })
13513
13578
  ] }),
13514
- /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Toggle, { label: "Show", name: `${axis}Axis.show`, checked: value.show, onChange: (show) => set({ show }) })
13579
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Toggle, { label: "Show", name: `${axis}Axis.show`, checked: value.show, onChange: (show) => set({ show }) })
13515
13580
  ] }),
13516
- /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Field, { label: "Title", htmlFor: `${idBase}-${axis}-title`, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(ChartCommitInput, { id: `${idBase}-${axis}-title`, value: value.title, "data-option": `${axis}Axis.title`, className: chartInputClass, onCommit: (title) => void set({ title }) }) }),
13517
- /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "flex flex-wrap gap-x-4 gap-y-1", children: [
13518
- /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Toggle, { label: "Grid lines", name: `${key}.gridlines`, checked: value.gridlines, onChange: (gridlines) => set({ gridlines }) }),
13519
- axis === "x" && !numeric && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Toggle, { label: "Dates", name: "xAxis.kind", checked: value.kind === "date", onChange: (dates) => set({ kind: dates ? "date" : void 0 }) }),
13520
- scales && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Toggle, { label: "Reverse", name: `${key}.reverse`, checked: !!value.reverse, onChange: (reverse) => set({ reverse }) }),
13521
- scales && valueAxis && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Toggle, { label: "Log scale", name: `${key}.scale`, checked: value.scale === "log", onChange: (log) => set({ scale: log ? "log" : "linear" }) })
13581
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Field, { label: "Title", htmlFor: `${idBase}-${axis}-title`, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(ChartCommitInput, { id: `${idBase}-${axis}-title`, value: value.title, "data-option": `${axis}Axis.title`, className: chartInputClass, onCommit: (title) => void set({ title }) }) }),
13582
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "flex flex-wrap gap-x-4 gap-y-1", children: [
13583
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Toggle, { label: "Grid lines", name: `${key}.gridlines`, checked: value.gridlines, onChange: (gridlines) => set({ gridlines }) }),
13584
+ axis === "x" && !numeric && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Toggle, { label: "Dates", name: "xAxis.kind", checked: value.kind === "date", onChange: (dates) => set({ kind: dates ? "date" : void 0 }) }),
13585
+ scales && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Toggle, { label: "Reverse", name: `${key}.reverse`, checked: !!value.reverse, onChange: (reverse) => set({ reverse }) }),
13586
+ scales && valueAxis && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Toggle, { label: "Log scale", name: `${key}.scale`, checked: value.scale === "log", onChange: (log) => set({ scale: log ? "log" : "linear" }) })
13522
13587
  ] }),
13523
- scales && valueAxis && value.scale === "log" && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Field, { label: "Log base", htmlFor: `${idBase}-${axis}-log-base`, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
13588
+ scales && valueAxis && value.scale === "log" && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Field, { label: "Log base", htmlFor: `${idBase}-${axis}-log-base`, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
13524
13589
  ChartCommitInput,
13525
13590
  {
13526
13591
  id: `${idBase}-${axis}-log-base`,
@@ -13531,7 +13596,7 @@ function AxisSection({ controller, axis, value, idBase, horizontal, numeric = fa
13531
13596
  onCommit: (text) => set({ logBase: text.trim() === "" ? void 0 : Number(text) }).ok
13532
13597
  }
13533
13598
  ) }),
13534
- valueAxis && value.scale !== "log" && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Field, { label: "Step", htmlFor: `${idBase}-${axis}-step`, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
13599
+ valueAxis && value.scale !== "log" && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Field, { label: "Step", htmlFor: `${idBase}-${axis}-step`, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
13535
13600
  ChartCommitInput,
13536
13601
  {
13537
13602
  id: `${idBase}-${axis}-step`,
@@ -13543,14 +13608,14 @@ function AxisSection({ controller, axis, value, idBase, horizontal, numeric = fa
13543
13608
  onCommit: (text) => set({ step: text.trim() === "" ? null : Number(text) }).ok
13544
13609
  }
13545
13610
  ) }),
13546
- valueAxis && /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(import_jsx_runtime70.Fragment, { children: [
13547
- /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Field, { label: "Min / max", children: /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "flex gap-1", children: [
13611
+ valueAxis && /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(import_jsx_runtime71.Fragment, { children: [
13612
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Field, { label: "Min / max", children: /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "flex gap-1", children: [
13548
13613
  bound("min"),
13549
13614
  bound("max")
13550
13615
  ] }) }),
13551
- /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Field, { label: "Format", htmlFor: `${idBase}-${axis}-format`, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "flex gap-1", children: [
13552
- /* @__PURE__ */ (0, import_jsx_runtime70.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 }) }),
13553
- /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
13616
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Field, { label: "Format", htmlFor: `${idBase}-${axis}-format`, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "flex gap-1", children: [
13617
+ /* @__PURE__ */ (0, import_jsx_runtime71.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 }) }),
13618
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
13554
13619
  ChartCommitInput,
13555
13620
  {
13556
13621
  value: value.format.decimals === void 0 ? "" : String(value.format.decimals),
@@ -13569,8 +13634,8 @@ function AxisSection({ controller, axis, value, idBase, horizontal, numeric = fa
13569
13634
  }
13570
13635
  )
13571
13636
  ] }) }),
13572
- value.format.style === "currency" && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Field, { label: "Currency", htmlFor: `${idBase}-${axis}-currency`, children: /* @__PURE__ */ (0, import_jsx_runtime70.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() }) }) }),
13573
- /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Field, { label: "Code", htmlFor: `${idBase}-${axis}-code`, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
13637
+ value.format.style === "currency" && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Field, { label: "Currency", htmlFor: `${idBase}-${axis}-currency`, children: /* @__PURE__ */ (0, import_jsx_runtime71.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() }) }) }),
13638
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Field, { label: "Code", htmlFor: `${idBase}-${axis}-code`, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
13574
13639
  ChartCommitInput,
13575
13640
  {
13576
13641
  id: `${idBase}-${axis}-code`,
@@ -13596,15 +13661,15 @@ function ErrorBarFields({ controller, series, which, idBase }) {
13596
13661
  const values = which === "xErrorBars" ? series.x ?? [] : series.values;
13597
13662
  const set = (next) => controller.updateSeries(series.id, { [which]: next });
13598
13663
  const patch = (p) => bars && set({ ...bars, ...p });
13599
- return /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "space-y-1.5", "data-section": which === "errorBars" ? "error-bars" : "x-error-bars", children: [
13600
- /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Field, { label: which === "errorBars" ? "Error bars" : "X error bars", htmlFor: `${id}-type`, children: /* @__PURE__ */ (0, import_jsx_runtime70.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: [
13601
- /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("option", { value: "", children: "None" }),
13602
- import_chart4.CHART_ERROR_BAR_TYPES.map((t) => /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("option", { value: t, children: import_chart4.CHART_ERROR_BAR_LABELS[t] }, t))
13664
+ return /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "space-y-1.5", "data-section": which === "errorBars" ? "error-bars" : "x-error-bars", children: [
13665
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Field, { label: which === "errorBars" ? "Error bars" : "X error bars", htmlFor: `${id}-type`, children: /* @__PURE__ */ (0, import_jsx_runtime71.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: [
13666
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("option", { value: "", children: "None" }),
13667
+ import_chart4.CHART_ERROR_BAR_TYPES.map((t) => /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("option", { value: t, children: import_chart4.CHART_ERROR_BAR_LABELS[t] }, t))
13603
13668
  ] }) }),
13604
- bars && (bars.type === "fixed" || bars.type === "percent" || bars.type === "stddev") && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Field, { label: bars.type === "percent" ? "Percent" : bars.type === "stddev" ? "Deviations" : "Amount", htmlFor: `${id}-value`, children: /* @__PURE__ */ (0, import_jsx_runtime70.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 }) }),
13605
- bars?.type === "custom" && /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(import_jsx_runtime70.Fragment, { children: [
13606
- /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Field, { label: "Plus", htmlFor: `${id}-plus`, children: /* @__PURE__ */ (0, import_jsx_runtime70.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 }) }),
13607
- /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Field, { label: "Minus", htmlFor: `${id}-minus`, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
13669
+ bars && (bars.type === "fixed" || bars.type === "percent" || bars.type === "stddev") && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Field, { label: bars.type === "percent" ? "Percent" : bars.type === "stddev" ? "Deviations" : "Amount", htmlFor: `${id}-value`, children: /* @__PURE__ */ (0, import_jsx_runtime71.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 }) }),
13670
+ bars?.type === "custom" && /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(import_jsx_runtime71.Fragment, { children: [
13671
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Field, { label: "Plus", htmlFor: `${id}-plus`, children: /* @__PURE__ */ (0, import_jsx_runtime71.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 }) }),
13672
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Field, { label: "Minus", htmlFor: `${id}-minus`, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
13608
13673
  ChartCommitInput,
13609
13674
  {
13610
13675
  id: `${id}-minus`,
@@ -13621,15 +13686,15 @@ function ErrorBarFields({ controller, series, which, idBase }) {
13621
13686
  }
13622
13687
  ) })
13623
13688
  ] }),
13624
- bars && /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "flex items-center gap-2", children: [
13625
- /* @__PURE__ */ (0, import_jsx_runtime70.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_runtime70.jsx)("option", { value: d, children: d === "both" ? "Both ways" : d === "plus" ? "Plus only" : "Minus only" }, d)) }),
13626
- /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Toggle, { label: "Caps", name: `${key}.cap`, checked: bars.cap !== false, onChange: (cap2) => patch({ cap: cap2 }) })
13689
+ bars && /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "flex items-center gap-2", children: [
13690
+ /* @__PURE__ */ (0, import_jsx_runtime71.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_runtime71.jsx)("option", { value: d, children: d === "both" ? "Both ways" : d === "plus" ? "Plus only" : "Minus only" }, d)) }),
13691
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Toggle, { label: "Caps", name: `${key}.cap`, checked: bars.cap !== false, onChange: (cap2) => patch({ cap: cap2 }) })
13627
13692
  ] })
13628
13693
  ] });
13629
13694
  }
13630
13695
  function ChartInspector({ controller, sections, className }) {
13631
13696
  const { spec, selectedSeries, selection, raceFrame, racePlaying } = useChartState(controller);
13632
- const idBase = (0, import_react94.useId)();
13697
+ const idBase = (0, import_react95.useId)();
13633
13698
  const show = (section) => !sections || sections.includes(section);
13634
13699
  const cartesian = (0, import_chart4.isCartesianChart)(spec.type);
13635
13700
  const family = (0, import_chart4.chartFamily)(spec);
@@ -13644,30 +13709,30 @@ function ChartInspector({ controller, sections, className }) {
13644
13709
  const annotated = scales;
13645
13710
  const oneSeries = cartesian && spec.series.filter((s) => !s.hidden).length === 1;
13646
13711
  const calloutIndex = selection?.kind === "point" && selection.seriesId === selectedSeries?.id ? selection.index : null;
13647
- return /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: `space-y-3 text-xs ${className ?? ""}`, "data-chart-inspector": "", children: [
13648
- show("type") && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { className: chartSectionClass, "data-section": "type", children: /* @__PURE__ */ (0, import_jsx_runtime70.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_runtime70.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)) }) }),
13649
- show("style") && /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: chartSectionClass, "data-section": "style", children: [
13650
- /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Field, { label: "Layout", htmlFor: `${idBase}-layout`, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("select", { id: `${idBase}-layout`, className: chartInputClass, value: "", "data-option": "preset.layout", onChange: (e) => e.currentTarget.value && controller.applyPreset({ layout: e.currentTarget.value }), children: [
13651
- /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("option", { value: "", children: "Quick layout\u2026" }),
13652
- import_chart4.CHART_LAYOUT_PRESETS.map((p) => /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("option", { value: p.id, title: p.description, children: p.label }, p.id))
13712
+ return /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: `space-y-3 text-xs ${className ?? ""}`, "data-chart-inspector": "", children: [
13713
+ show("type") && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { className: chartSectionClass, "data-section": "type", children: /* @__PURE__ */ (0, import_jsx_runtime71.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_runtime71.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)) }) }),
13714
+ show("style") && /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: chartSectionClass, "data-section": "style", children: [
13715
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Field, { label: "Layout", htmlFor: `${idBase}-layout`, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("select", { id: `${idBase}-layout`, className: chartInputClass, value: "", "data-option": "preset.layout", onChange: (e) => e.currentTarget.value && controller.applyPreset({ layout: e.currentTarget.value }), children: [
13716
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("option", { value: "", children: "Quick layout\u2026" }),
13717
+ import_chart4.CHART_LAYOUT_PRESETS.map((p) => /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("option", { value: p.id, title: p.description, children: p.label }, p.id))
13653
13718
  ] }) }),
13654
- /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Field, { label: "Colours", htmlFor: `${idBase}-colors`, children: /* @__PURE__ */ (0, import_jsx_runtime70.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: [
13655
- /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("option", { value: "", children: "Custom" }),
13656
- import_chart4.CHART_COLOR_SCHEMES.map((c) => /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("option", { value: c.id, title: c.description, children: c.label }, c.id))
13719
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Field, { label: "Colours", htmlFor: `${idBase}-colors`, children: /* @__PURE__ */ (0, import_jsx_runtime71.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: [
13720
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("option", { value: "", children: "Custom" }),
13721
+ import_chart4.CHART_COLOR_SCHEMES.map((c) => /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("option", { value: c.id, title: c.description, children: c.label }, c.id))
13657
13722
  ] }) }),
13658
- !colorCheck.ok && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("p", { className: "text-[11px] leading-snug text-amber-600 dark:text-amber-400", "data-chart-color-warning": "", children: colorCheck.issues[0] }),
13659
- /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("button", { type: "button", className: chartButtonClass, "data-action": "transpose", onClick: () => controller.transpose(), children: "Switch rows and columns" })
13723
+ !colorCheck.ok && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("p", { className: "text-[11px] leading-snug text-amber-600 dark:text-amber-400", "data-chart-color-warning": "", children: colorCheck.issues[0] }),
13724
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("button", { type: "button", className: chartButtonClass, "data-action": "transpose", onClick: () => controller.transpose(), children: "Switch rows and columns" })
13660
13725
  ] }),
13661
- show("titles") && /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: chartSectionClass, "data-section": "titles", children: [
13662
- /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Field, { label: "Title", htmlFor: `${idBase}-title`, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(ChartCommitInput, { id: `${idBase}-title`, value: spec.title, "data-option": "title", className: chartInputClass, onCommit: (title) => void controller.setTitle(title) }) }),
13663
- /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Field, { label: "Subtitle", htmlFor: `${idBase}-subtitle`, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(ChartCommitInput, { id: `${idBase}-subtitle`, value: spec.subtitle, "data-option": "subtitle", className: chartInputClass, onCommit: (subtitle) => void controller.setSubtitle(subtitle) }) }),
13664
- /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Field, { label: "Note", htmlFor: `${idBase}-note`, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(ChartCommitInput, { id: `${idBase}-note`, value: spec.note, placeholder: "Source or footnote", "data-option": "note", className: chartInputClass, onCommit: (note) => void controller.setNote(note) }) })
13726
+ show("titles") && /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: chartSectionClass, "data-section": "titles", children: [
13727
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Field, { label: "Title", htmlFor: `${idBase}-title`, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(ChartCommitInput, { id: `${idBase}-title`, value: spec.title, "data-option": "title", className: chartInputClass, onCommit: (title) => void controller.setTitle(title) }) }),
13728
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Field, { label: "Subtitle", htmlFor: `${idBase}-subtitle`, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(ChartCommitInput, { id: `${idBase}-subtitle`, value: spec.subtitle, "data-option": "subtitle", className: chartInputClass, onCommit: (subtitle) => void controller.setSubtitle(subtitle) }) }),
13729
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Field, { label: "Note", htmlFor: `${idBase}-note`, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(ChartCommitInput, { id: `${idBase}-note`, value: spec.note, placeholder: "Source or footnote", "data-option": "note", className: chartInputClass, onCommit: (note) => void controller.setNote(note) }) })
13665
13730
  ] }),
13666
- show("options") && /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: chartSectionClass, "data-section": "options", children: [
13667
- cartesian && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Field, { label: "Stacking", htmlFor: `${idBase}-stacking`, children: /* @__PURE__ */ (0, import_jsx_runtime70.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 }) }) }),
13668
- hasBars && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Field, { label: "Bars", children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { className: "flex gap-0.5 rounded-md bg-muted p-0.5", children: ["vertical", "horizontal"].map((o) => /* @__PURE__ */ (0, import_jsx_runtime70.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)) }) }),
13669
- hasLines && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Field, { label: "Lines", htmlFor: `${idBase}-curve`, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Select, { id: `${idBase}-curve`, name: "curve", value: spec.curve, options: import_chart4.CHART_CURVES, onChange: (curve) => controller.update({ curve }) }) }),
13670
- spec.type === "donut" && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Field, { label: "Hole", htmlFor: `${idBase}-hole`, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
13731
+ show("options") && /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: chartSectionClass, "data-section": "options", children: [
13732
+ cartesian && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Field, { label: "Stacking", htmlFor: `${idBase}-stacking`, children: /* @__PURE__ */ (0, import_jsx_runtime71.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 }) }) }),
13733
+ hasBars && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Field, { label: "Bars", children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { className: "flex gap-0.5 rounded-md bg-muted p-0.5", children: ["vertical", "horizontal"].map((o) => /* @__PURE__ */ (0, import_jsx_runtime71.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)) }) }),
13734
+ hasLines && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Field, { label: "Lines", htmlFor: `${idBase}-curve`, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Select, { id: `${idBase}-curve`, name: "curve", value: spec.curve, options: import_chart4.CHART_CURVES, onChange: (curve) => controller.update({ curve }) }) }),
13735
+ spec.type === "donut" && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Field, { label: "Hole", htmlFor: `${idBase}-hole`, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
13671
13736
  "input",
13672
13737
  {
13673
13738
  id: `${idBase}-hole`,
@@ -13683,7 +13748,7 @@ function ChartInspector({ controller, sections, className }) {
13683
13748
  onChange: (e) => controller.update({ innerRadius: Number(e.currentTarget.value) })
13684
13749
  }
13685
13750
  ) }),
13686
- hasBars && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Field, { label: "Spacing", htmlFor: `${idBase}-gap`, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
13751
+ hasBars && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Field, { label: "Spacing", htmlFor: `${idBase}-gap`, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
13687
13752
  "input",
13688
13753
  {
13689
13754
  id: `${idBase}-gap`,
@@ -13699,9 +13764,9 @@ function ChartInspector({ controller, sections, className }) {
13699
13764
  onChange: (e) => controller.update({ gapWidth: Number(e.currentTarget.value) })
13700
13765
  }
13701
13766
  ) }),
13702
- spec.type === "choropleth" && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Field, { label: "Map", htmlFor: `${idBase}-map`, children: /* @__PURE__ */ (0, import_jsx_runtime70.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_runtime70.jsx)("option", { value: id, children: (0, import_chart4.listChartMaps)().find((m) => m.id === id)?.name ?? `${id} (not loaded)` }, id)) }) }),
13703
- spec.type === "choropleth" && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Field, { label: "Classes", htmlFor: `${idBase}-map-steps`, children: /* @__PURE__ */ (0, import_jsx_runtime70.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 }) }),
13704
- spec.type === "choropleth" && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Field, { label: "Breaks", htmlFor: `${idBase}-map-breaks`, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
13767
+ spec.type === "choropleth" && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Field, { label: "Map", htmlFor: `${idBase}-map`, children: /* @__PURE__ */ (0, import_jsx_runtime71.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_runtime71.jsx)("option", { value: id, children: (0, import_chart4.listChartMaps)().find((m) => m.id === id)?.name ?? `${id} (not loaded)` }, id)) }) }),
13768
+ spec.type === "choropleth" && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Field, { label: "Classes", htmlFor: `${idBase}-map-steps`, children: /* @__PURE__ */ (0, import_jsx_runtime71.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 }) }),
13769
+ spec.type === "choropleth" && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Field, { label: "Breaks", htmlFor: `${idBase}-map-breaks`, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
13705
13770
  ChartCommitInput,
13706
13771
  {
13707
13772
  id: `${idBase}-map-breaks`,
@@ -13712,10 +13777,10 @@ function ChartInspector({ controller, sections, className }) {
13712
13777
  onCommit: (text) => controller.update({ mapThresholds: text.trim() ? text.split(",").map((t) => Number(t.trim())) : [] }).ok
13713
13778
  }
13714
13779
  ) }),
13715
- spec.type === "barrace" && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Field, { label: "Bars", htmlFor: `${idBase}-race-top`, children: /* @__PURE__ */ (0, import_jsx_runtime70.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 }) }),
13716
- spec.type === "barrace" && spec.categories.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Field, { label: "Time", htmlFor: `${idBase}-race-frame`, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "flex items-center gap-1", children: [
13717
- /* @__PURE__ */ (0, import_jsx_runtime70.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" }),
13718
- /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
13780
+ spec.type === "barrace" && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Field, { label: "Bars", htmlFor: `${idBase}-race-top`, children: /* @__PURE__ */ (0, import_jsx_runtime71.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 }) }),
13781
+ spec.type === "barrace" && spec.categories.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Field, { label: "Time", htmlFor: `${idBase}-race-frame`, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "flex items-center gap-1", children: [
13782
+ /* @__PURE__ */ (0, import_jsx_runtime71.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" }),
13783
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
13719
13784
  "input",
13720
13785
  {
13721
13786
  id: `${idBase}-race-frame`,
@@ -13730,13 +13795,13 @@ function ChartInspector({ controller, sections, className }) {
13730
13795
  onChange: (e) => controller.setRaceFrame(Number(e.currentTarget.value))
13731
13796
  }
13732
13797
  ),
13733
- /* @__PURE__ */ (0, import_jsx_runtime70.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)] })
13798
+ /* @__PURE__ */ (0, import_jsx_runtime71.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)] })
13734
13799
  ] }) }),
13735
- spec.type === "sankey" && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Field, { label: "Flows", htmlFor: `${idBase}-sankey-color`, children: /* @__PURE__ */ (0, import_jsx_runtime70.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 }) }) }),
13736
- spec.type === "sunburst" && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Field, { label: "Caption", htmlFor: `${idBase}-sunburst-label`, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(ChartCommitInput, { id: `${idBase}-sunburst-label`, value: spec.sunburstLabel, placeholder: "Under the total", "data-option": "sunburstLabel", className: chartInputClass, onCommit: (sunburstLabel) => controller.update({ sunburstLabel }).ok }) }),
13737
- spec.type === "likert" && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Field, { label: "Neutral", htmlFor: `${idBase}-likert-neutral`, children: /* @__PURE__ */ (0, import_jsx_runtime70.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 }) }) }),
13738
- spec.type === "likert" && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Field, { label: "Order", htmlFor: `${idBase}-likert-sort`, children: /* @__PURE__ */ (0, import_jsx_runtime70.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 }) }) }),
13739
- spec.type === "parliament" && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Field, { label: "Sweep", htmlFor: `${idBase}-parliament-arc`, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
13800
+ spec.type === "sankey" && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Field, { label: "Flows", htmlFor: `${idBase}-sankey-color`, children: /* @__PURE__ */ (0, import_jsx_runtime71.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 }) }) }),
13801
+ spec.type === "sunburst" && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Field, { label: "Caption", htmlFor: `${idBase}-sunburst-label`, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(ChartCommitInput, { id: `${idBase}-sunburst-label`, value: spec.sunburstLabel, placeholder: "Under the total", "data-option": "sunburstLabel", className: chartInputClass, onCommit: (sunburstLabel) => controller.update({ sunburstLabel }).ok }) }),
13802
+ spec.type === "likert" && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Field, { label: "Neutral", htmlFor: `${idBase}-likert-neutral`, children: /* @__PURE__ */ (0, import_jsx_runtime71.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 }) }) }),
13803
+ spec.type === "likert" && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Field, { label: "Order", htmlFor: `${idBase}-likert-sort`, children: /* @__PURE__ */ (0, import_jsx_runtime71.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 }) }) }),
13804
+ spec.type === "parliament" && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Field, { label: "Sweep", htmlFor: `${idBase}-parliament-arc`, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
13740
13805
  "input",
13741
13806
  {
13742
13807
  id: `${idBase}-parliament-arc`,
@@ -13752,34 +13817,34 @@ function ChartInspector({ controller, sections, className }) {
13752
13817
  onChange: (e) => controller.update({ parliamentArc: Number(e.currentTarget.value) })
13753
13818
  }
13754
13819
  ) }),
13755
- spec.type === "parliament" && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Field, { label: "Majority", htmlFor: `${idBase}-parliament-majority`, children: /* @__PURE__ */ (0, import_jsx_runtime70.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 }) }),
13756
- spec.type === "parliament" && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Field, { label: "Caption", htmlFor: `${idBase}-parliament-label`, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(ChartCommitInput, { id: `${idBase}-parliament-label`, value: spec.parliamentLabel, placeholder: "seats", "data-option": "parliamentLabel", className: chartInputClass, onCommit: (parliamentLabel) => controller.update({ parliamentLabel }).ok }) }),
13757
- spec.type === "radar" && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Field, { label: "Rings", htmlFor: `${idBase}-radar-ticks`, children: /* @__PURE__ */ (0, import_jsx_runtime70.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 }) }),
13758
- spec.type === "radar" && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Field, { label: "Grid", htmlFor: `${idBase}-radar-graticule`, children: /* @__PURE__ */ (0, import_jsx_runtime70.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 }) }) }),
13759
- spec.dataLabels && hasBars && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Field, { label: "Labels", htmlFor: `${idBase}-label-position`, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Select, { id: `${idBase}-label-position`, name: "labelPosition", value: spec.labelPosition, options: import_chart4.CHART_LABEL_POSITIONS, onChange: (labelPosition) => controller.update({ labelPosition }) }) }),
13760
- spec.type === "histogram" && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Field, { label: "Bins", htmlFor: `${idBase}-bins`, children: /* @__PURE__ */ (0, import_jsx_runtime70.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 }) }),
13761
- /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "flex flex-wrap gap-x-4 gap-y-1", children: [
13762
- spec.type === "waterfall" && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Toggle, { label: "Total bar", name: "showTotal", checked: spec.showTotal, onChange: (showTotal) => controller.update({ showTotal }) }),
13763
- hasLines && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Toggle, { label: "Points", name: "points", checked: spec.points, onChange: (points) => controller.update({ points }) }),
13764
- oneSeries && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Toggle, { label: "Colour by category", name: "varyColors", checked: spec.varyColors, onChange: (varyColors) => controller.update({ varyColors }) }),
13765
- /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Toggle, { label: "Data labels", name: "dataLabels", checked: spec.dataLabels, onChange: (dataLabels) => controller.update({ dataLabels }) })
13820
+ spec.type === "parliament" && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Field, { label: "Majority", htmlFor: `${idBase}-parliament-majority`, children: /* @__PURE__ */ (0, import_jsx_runtime71.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 }) }),
13821
+ spec.type === "parliament" && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Field, { label: "Caption", htmlFor: `${idBase}-parliament-label`, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(ChartCommitInput, { id: `${idBase}-parliament-label`, value: spec.parliamentLabel, placeholder: "seats", "data-option": "parliamentLabel", className: chartInputClass, onCommit: (parliamentLabel) => controller.update({ parliamentLabel }).ok }) }),
13822
+ spec.type === "radar" && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Field, { label: "Rings", htmlFor: `${idBase}-radar-ticks`, children: /* @__PURE__ */ (0, import_jsx_runtime71.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 }) }),
13823
+ spec.type === "radar" && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Field, { label: "Grid", htmlFor: `${idBase}-radar-graticule`, children: /* @__PURE__ */ (0, import_jsx_runtime71.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 }) }) }),
13824
+ spec.dataLabels && hasBars && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Field, { label: "Labels", htmlFor: `${idBase}-label-position`, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Select, { id: `${idBase}-label-position`, name: "labelPosition", value: spec.labelPosition, options: import_chart4.CHART_LABEL_POSITIONS, onChange: (labelPosition) => controller.update({ labelPosition }) }) }),
13825
+ spec.type === "histogram" && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Field, { label: "Bins", htmlFor: `${idBase}-bins`, children: /* @__PURE__ */ (0, import_jsx_runtime71.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 }) }),
13826
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "flex flex-wrap gap-x-4 gap-y-1", children: [
13827
+ spec.type === "waterfall" && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Toggle, { label: "Total bar", name: "showTotal", checked: spec.showTotal, onChange: (showTotal) => controller.update({ showTotal }) }),
13828
+ hasLines && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Toggle, { label: "Points", name: "points", checked: spec.points, onChange: (points) => controller.update({ points }) }),
13829
+ oneSeries && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Toggle, { label: "Colour by category", name: "varyColors", checked: spec.varyColors, onChange: (varyColors) => controller.update({ varyColors }) }),
13830
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Toggle, { label: "Data labels", name: "dataLabels", checked: spec.dataLabels, onChange: (dataLabels) => controller.update({ dataLabels }) })
13766
13831
  ] })
13767
13832
  ] }),
13768
- show("legend") && /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: chartSectionClass, "data-section": "legend", children: [
13769
- /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "flex items-center justify-between", children: [
13770
- /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("h4", { className: "text-xs font-semibold text-foreground", children: "Legend" }),
13771
- /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Toggle, { label: "Show", name: "legend.show", checked: spec.legend.show, onChange: (v) => controller.setLegend({ show: v }) })
13833
+ show("legend") && /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: chartSectionClass, "data-section": "legend", children: [
13834
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "flex items-center justify-between", children: [
13835
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("h4", { className: "text-xs font-semibold text-foreground", children: "Legend" }),
13836
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Toggle, { label: "Show", name: "legend.show", checked: spec.legend.show, onChange: (v) => controller.setLegend({ show: v }) })
13772
13837
  ] }),
13773
- spec.legend.show && /* @__PURE__ */ (0, import_jsx_runtime70.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_runtime70.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)) })
13838
+ spec.legend.show && /* @__PURE__ */ (0, import_jsx_runtime71.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_runtime71.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)) })
13774
13839
  ] }),
13775
- show("axes") && hasAxes && /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(import_jsx_runtime70.Fragment, { children: [
13776
- family !== "box" && family !== "histogram" && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(AxisSection, { controller, axis: "x", value: spec.xAxis, idBase, horizontal: spec.orientation === "horizontal", numeric: family === "xy", scales }),
13777
- /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(AxisSection, { controller, axis: "y", value: spec.yAxis, idBase, horizontal: spec.orientation === "horizontal", scales }),
13778
- usesSecondary && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(AxisSection, { controller, axis: "y2", value: spec.yAxis2, idBase, horizontal: spec.orientation === "horizontal", scales })
13840
+ show("axes") && hasAxes && /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(import_jsx_runtime71.Fragment, { children: [
13841
+ family !== "box" && family !== "histogram" && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(AxisSection, { controller, axis: "x", value: spec.xAxis, idBase, horizontal: spec.orientation === "horizontal", numeric: family === "xy", scales }),
13842
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(AxisSection, { controller, axis: "y", value: spec.yAxis, idBase, horizontal: spec.orientation === "horizontal", scales }),
13843
+ usesSecondary && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(AxisSection, { controller, axis: "y2", value: spec.yAxis2, idBase, horizontal: spec.orientation === "horizontal", scales })
13779
13844
  ] }),
13780
- show("annotations") && annotated && /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: chartSectionClass, "data-section": "annotations", children: [
13781
- /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("h4", { className: "text-xs font-semibold text-foreground", children: "Annotations" }),
13782
- /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Field, { label: "Highlight", htmlFor: `${idBase}-highlight`, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
13845
+ show("annotations") && annotated && /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: chartSectionClass, "data-section": "annotations", children: [
13846
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("h4", { className: "text-xs font-semibold text-foreground", children: "Annotations" }),
13847
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Field, { label: "Highlight", htmlFor: `${idBase}-highlight`, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
13783
13848
  ChartCommitInput,
13784
13849
  {
13785
13850
  id: `${idBase}-highlight`,
@@ -13790,27 +13855,27 @@ function ChartInspector({ controller, sections, className }) {
13790
13855
  onCommit: (text) => controller.setHighlight(text.split(",").map((n) => n.trim()).filter(Boolean)).ok
13791
13856
  }
13792
13857
  ) }),
13793
- spec.referenceLines.map((line, i) => /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "flex items-center gap-1", "data-reference-line": i, children: [
13794
- /* @__PURE__ */ (0, import_jsx_runtime70.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 }),
13795
- /* @__PURE__ */ (0, import_jsx_runtime70.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 }),
13796
- /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("button", { type: "button", className: chartButtonClass, "aria-label": "Delete reference line", "data-action": "reference-line-delete", onClick: () => controller.removeReferenceLine(i), children: "\xD7" })
13858
+ spec.referenceLines.map((line, i) => /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "flex items-center gap-1", "data-reference-line": i, children: [
13859
+ /* @__PURE__ */ (0, import_jsx_runtime71.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 }),
13860
+ /* @__PURE__ */ (0, import_jsx_runtime71.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 }),
13861
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("button", { type: "button", className: chartButtonClass, "aria-label": "Delete reference line", "data-action": "reference-line-delete", onClick: () => controller.removeReferenceLine(i), children: "\xD7" })
13797
13862
  ] }, `line-${i}`)),
13798
- spec.referenceBands.map((band, i) => /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "flex items-center gap-1", "data-reference-band": i, children: [
13799
- /* @__PURE__ */ (0, import_jsx_runtime70.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 }),
13800
- /* @__PURE__ */ (0, import_jsx_runtime70.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 }),
13801
- /* @__PURE__ */ (0, import_jsx_runtime70.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 }),
13802
- /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("button", { type: "button", className: chartButtonClass, "aria-label": "Delete reference band", "data-action": "reference-band-delete", onClick: () => controller.removeReferenceBand(i), children: "\xD7" })
13863
+ spec.referenceBands.map((band, i) => /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "flex items-center gap-1", "data-reference-band": i, children: [
13864
+ /* @__PURE__ */ (0, import_jsx_runtime71.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 }),
13865
+ /* @__PURE__ */ (0, import_jsx_runtime71.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 }),
13866
+ /* @__PURE__ */ (0, import_jsx_runtime71.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 }),
13867
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("button", { type: "button", className: chartButtonClass, "aria-label": "Delete reference band", "data-action": "reference-band-delete", onClick: () => controller.removeReferenceBand(i), children: "\xD7" })
13803
13868
  ] }, `band-${i}`)),
13804
- /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "flex gap-1", children: [
13805
- /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("button", { type: "button", className: chartButtonClass, "data-option": "referenceLine.add", onClick: () => controller.addReferenceLine((0, import_chart4.suggestChartReferences)(spec).line), children: "Add line" }),
13806
- /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("button", { type: "button", className: chartButtonClass, "data-option": "referenceBand.add", onClick: () => controller.addReferenceBand((0, import_chart4.suggestChartReferences)(spec).band), children: "Add band" })
13869
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "flex gap-1", children: [
13870
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("button", { type: "button", className: chartButtonClass, "data-option": "referenceLine.add", onClick: () => controller.addReferenceLine((0, import_chart4.suggestChartReferences)(spec).line), children: "Add line" }),
13871
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("button", { type: "button", className: chartButtonClass, "data-option": "referenceBand.add", onClick: () => controller.addReferenceBand((0, import_chart4.suggestChartReferences)(spec).band), children: "Add band" })
13807
13872
  ] })
13808
13873
  ] }),
13809
- show("series") && selectedSeries && /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: chartSectionClass, "data-section": "series", "data-series-id": selectedSeries.id, children: [
13810
- /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("h4", { className: "text-xs font-semibold text-foreground", children: "Series" }),
13811
- /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Field, { label: "Name", htmlFor: `${idBase}-series-name`, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(ChartCommitInput, { id: `${idBase}-series-name`, value: selectedSeries.name, "data-option": "series.name", className: chartInputClass, onCommit: (name) => void controller.updateSeries(selectedSeries.id, { name }) }) }),
13812
- /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Field, { label: "Colour", htmlFor: `${idBase}-series-color`, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "flex items-center gap-1", children: [
13813
- /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
13874
+ show("series") && selectedSeries && /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: chartSectionClass, "data-section": "series", "data-series-id": selectedSeries.id, children: [
13875
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("h4", { className: "text-xs font-semibold text-foreground", children: "Series" }),
13876
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Field, { label: "Name", htmlFor: `${idBase}-series-name`, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(ChartCommitInput, { id: `${idBase}-series-name`, value: selectedSeries.name, "data-option": "series.name", className: chartInputClass, onCommit: (name) => void controller.updateSeries(selectedSeries.id, { name }) }) }),
13877
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Field, { label: "Colour", htmlFor: `${idBase}-series-color`, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "flex items-center gap-1", children: [
13878
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
13814
13879
  "input",
13815
13880
  {
13816
13881
  id: `${idBase}-series-color`,
@@ -13823,9 +13888,9 @@ function ChartInspector({ controller, sections, className }) {
13823
13888
  onChange: (e) => controller.updateSeries(selectedSeries.id, { color: e.currentTarget.value })
13824
13889
  }
13825
13890
  ),
13826
- selectedSeries.color && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("button", { type: "button", className: chartButtonClass, "data-action": "reset-color", onClick: () => controller.updateSeries(selectedSeries.id, { color: null }), children: "Palette" })
13891
+ selectedSeries.color && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("button", { type: "button", className: chartButtonClass, "data-action": "reset-color", onClick: () => controller.updateSeries(selectedSeries.id, { color: null }), children: "Palette" })
13827
13892
  ] }) }),
13828
- cartesian && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Field, { label: "Draw as", htmlFor: `${idBase}-series-type`, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(
13893
+ cartesian && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Field, { label: "Draw as", htmlFor: `${idBase}-series-type`, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(
13829
13894
  "select",
13830
13895
  {
13831
13896
  id: `${idBase}-series-type`,
@@ -13834,12 +13899,12 @@ function ChartInspector({ controller, sections, className }) {
13834
13899
  "data-option": "series.type",
13835
13900
  onChange: (e) => controller.updateSeries(selectedSeries.id, { type: e.currentTarget.value || null }),
13836
13901
  children: [
13837
- /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("option", { value: "", children: "Chart type" }),
13838
- import_chart4.CHART_SERIES_TYPES.map((t) => /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("option", { value: t, children: import_chart4.CHART_TYPE_LABELS[t] }, t))
13902
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("option", { value: "", children: "Chart type" }),
13903
+ import_chart4.CHART_SERIES_TYPES.map((t) => /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("option", { value: t, children: import_chart4.CHART_TYPE_LABELS[t] }, t))
13839
13904
  ]
13840
13905
  }
13841
13906
  ) }),
13842
- (cartesian || family === "xy") && ["line", "area", "scatter"].includes((0, import_chart4.chartSeriesType)(spec, selectedSeries)) && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Field, { label: "Marker", htmlFor: `${idBase}-series-marker`, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(
13907
+ (cartesian || family === "xy") && ["line", "area", "scatter"].includes((0, import_chart4.chartSeriesType)(spec, selectedSeries)) && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Field, { label: "Marker", htmlFor: `${idBase}-series-marker`, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(
13843
13908
  "select",
13844
13909
  {
13845
13910
  id: `${idBase}-series-marker`,
@@ -13848,12 +13913,12 @@ function ChartInspector({ controller, sections, className }) {
13848
13913
  "data-option": "series.marker",
13849
13914
  onChange: (e) => controller.updateSeries(selectedSeries.id, { marker: e.currentTarget.value || null }),
13850
13915
  children: [
13851
- /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("option", { value: "", children: "Default" }),
13852
- import_chart4.CHART_MARKERS.map((m) => /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("option", { value: m, children: cap(m) }, m))
13916
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("option", { value: "", children: "Default" }),
13917
+ import_chart4.CHART_MARKERS.map((m) => /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("option", { value: m, children: cap(m) }, m))
13853
13918
  ]
13854
13919
  }
13855
13920
  ) }),
13856
- annotated && calloutIndex !== null && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Field, { label: "Callout", htmlFor: `${idBase}-series-callout`, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
13921
+ annotated && calloutIndex !== null && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Field, { label: "Callout", htmlFor: `${idBase}-series-callout`, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
13857
13922
  ChartCommitInput,
13858
13923
  {
13859
13924
  id: `${idBase}-series-callout`,
@@ -13864,15 +13929,15 @@ function ChartInspector({ controller, sections, className }) {
13864
13929
  onCommit: (text) => controller.setCallout(selectedSeries.id, calloutIndex, text || null).ok
13865
13930
  }
13866
13931
  ) }),
13867
- scales && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(ErrorBarFields, { controller, series: selectedSeries, which: "errorBars", idBase }),
13868
- family === "xy" && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(ErrorBarFields, { controller, series: selectedSeries, which: "xErrorBars", idBase }),
13869
- (0, import_chart4.chartSupportsTrendlines)(spec.type, spec.stacking) && /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "space-y-1", "data-section": "trendlines", children: [
13870
- (selectedSeries.trendlines ?? []).map((t, i) => /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "flex items-center gap-1", "data-trendline": i, children: [
13871
- /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("span", { className: "flex-1 truncate text-muted-foreground", children: (0, import_chart4.chartTrendlineName)(t, selectedSeries.name) }),
13872
- /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Toggle, { label: "R\xB2", name: `trendline.${i}.showR2`, checked: !!t.showR2, onChange: (showR2) => controller.updateTrendline(selectedSeries.id, i, { showR2 }) }),
13873
- /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("button", { type: "button", className: chartButtonClass, "aria-label": "Delete trendline", "data-action": "trendline-delete", onClick: () => controller.removeTrendline(selectedSeries.id, i), children: "\xD7" })
13932
+ scales && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(ErrorBarFields, { controller, series: selectedSeries, which: "errorBars", idBase }),
13933
+ family === "xy" && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(ErrorBarFields, { controller, series: selectedSeries, which: "xErrorBars", idBase }),
13934
+ (0, import_chart4.chartSupportsTrendlines)(spec.type, spec.stacking) && /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "space-y-1", "data-section": "trendlines", children: [
13935
+ (selectedSeries.trendlines ?? []).map((t, i) => /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "flex items-center gap-1", "data-trendline": i, children: [
13936
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("span", { className: "flex-1 truncate text-muted-foreground", children: (0, import_chart4.chartTrendlineName)(t, selectedSeries.name) }),
13937
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Toggle, { label: "R\xB2", name: `trendline.${i}.showR2`, checked: !!t.showR2, onChange: (showR2) => controller.updateTrendline(selectedSeries.id, i, { showR2 }) }),
13938
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("button", { type: "button", className: chartButtonClass, "aria-label": "Delete trendline", "data-action": "trendline-delete", onClick: () => controller.removeTrendline(selectedSeries.id, i), children: "\xD7" })
13874
13939
  ] }, i)),
13875
- /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(
13940
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(
13876
13941
  "select",
13877
13942
  {
13878
13943
  className: chartInputClass,
@@ -13881,32 +13946,32 @@ function ChartInspector({ controller, sections, className }) {
13881
13946
  "data-option": "trendline.add",
13882
13947
  onChange: (e) => e.currentTarget.value && controller.addTrendline(selectedSeries.id, { type: e.currentTarget.value }),
13883
13948
  children: [
13884
- /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("option", { value: "", children: "Add trendline\u2026" }),
13885
- import_chart4.CHART_TRENDLINE_TYPES.map((t) => /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("option", { value: t, children: cap(t.replace("-", " ")) }, t))
13949
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("option", { value: "", children: "Add trendline\u2026" }),
13950
+ import_chart4.CHART_TRENDLINE_TYPES.map((t) => /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("option", { value: t, children: cap(t.replace("-", " ")) }, t))
13886
13951
  ]
13887
13952
  }
13888
13953
  )
13889
13954
  ] }),
13890
- /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
13891
- /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Toggle, { label: "Hidden", name: "series.hidden", checked: !!selectedSeries.hidden, onChange: (hidden) => controller.updateSeries(selectedSeries.id, { hidden }) }),
13892
- family === "cartesian" && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Toggle, { label: "Secondary axis", name: "series.axis", checked: selectedSeries.axis === "secondary", onChange: (secondary) => controller.updateSeries(selectedSeries.id, { axis: secondary ? "secondary" : null }) }),
13893
- /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("span", { className: "flex-1" }),
13894
- /* @__PURE__ */ (0, import_jsx_runtime70.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" }),
13895
- /* @__PURE__ */ (0, import_jsx_runtime70.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" }),
13896
- /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("button", { type: "button", className: `${chartButtonClass} text-destructive`, "data-action": "series-delete", onClick: () => controller.removeSeries(selectedSeries.id), children: "Delete" })
13955
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
13956
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Toggle, { label: "Hidden", name: "series.hidden", checked: !!selectedSeries.hidden, onChange: (hidden) => controller.updateSeries(selectedSeries.id, { hidden }) }),
13957
+ family === "cartesian" && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Toggle, { label: "Secondary axis", name: "series.axis", checked: selectedSeries.axis === "secondary", onChange: (secondary) => controller.updateSeries(selectedSeries.id, { axis: secondary ? "secondary" : null }) }),
13958
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("span", { className: "flex-1" }),
13959
+ /* @__PURE__ */ (0, import_jsx_runtime71.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" }),
13960
+ /* @__PURE__ */ (0, import_jsx_runtime71.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" }),
13961
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("button", { type: "button", className: `${chartButtonClass} text-destructive`, "data-action": "series-delete", onClick: () => controller.removeSeries(selectedSeries.id), children: "Delete" })
13897
13962
  ] })
13898
13963
  ] })
13899
13964
  ] });
13900
13965
  }
13901
13966
 
13902
13967
  // src/chart-node/ChartNodeView.tsx
13903
- var import_jsx_runtime71 = require("react/jsx-runtime");
13968
+ var import_jsx_runtime72 = require("react/jsx-runtime");
13904
13969
  function ChartNodeView({ state, theme, showDataGrid = true }) {
13905
13970
  const { controller, editing, editable, selected, width, height, setEditing } = state;
13906
13971
  const open = () => {
13907
13972
  if (editable && !editing) setEditing(true);
13908
13973
  };
13909
- return /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(
13974
+ return /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(
13910
13975
  "div",
13911
13976
  {
13912
13977
  className: `not-prose my-2 rounded-md border bg-background p-1 ${selected ? "border-primary ring-1 ring-primary" : "border-border"}`,
@@ -13919,24 +13984,24 @@ function ChartNodeView({ state, theme, showDataGrid = true }) {
13919
13984
  }
13920
13985
  },
13921
13986
  children: [
13922
- editing && /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "mb-1 flex items-center justify-between gap-2 px-1", "data-chart-node-toolbar": "", children: [
13923
- /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("span", { className: "text-xs text-muted-foreground", children: "Editing chart" }),
13924
- /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("button", { type: "button", className: chartButtonClass, "data-action": "done", onClick: () => setEditing(false), children: "Done" })
13987
+ editing && /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: "mb-1 flex items-center justify-between gap-2 px-1", "data-chart-node-toolbar": "", children: [
13988
+ /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("span", { className: "text-xs text-muted-foreground", children: "Editing chart" }),
13989
+ /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("button", { type: "button", className: chartButtonClass, "data-action": "done", onClick: () => setEditing(false), children: "Done" })
13925
13990
  ] }),
13926
- /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
13991
+ /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
13927
13992
  "div",
13928
13993
  {
13929
13994
  className: editable && !editing ? "cursor-pointer" : void 0,
13930
13995
  onClick: open,
13931
13996
  title: editable && !editing ? "Click to edit the chart" : void 0,
13932
13997
  "data-chart-node-canvas": "",
13933
- children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(ChartCanvas, { controller, width: width ?? 640, height, responsive: width === null, editable: editing, theme })
13998
+ children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(ChartCanvas, { controller, width: width ?? 640, height, responsive: width === null, editable: editing, theme })
13934
13999
  }
13935
14000
  ),
13936
14001
  editing && // Wraps by the document's width, not the viewport's: side by side when there is room.
13937
- /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "mt-2 flex flex-wrap items-start gap-2", "data-chart-node-panel": "", children: [
13938
- showDataGrid && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { className: "min-w-0 flex-[1_1_20rem] overflow-x-auto", children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(ChartDataGrid, { controller }) }),
13939
- /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(ChartInspector, { controller, className: "max-h-96 min-w-0 flex-[1_1_16rem] overflow-y-auto rounded-md border border-border p-3" })
14002
+ /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: "mt-2 flex flex-wrap items-start gap-2", "data-chart-node-panel": "", children: [
14003
+ showDataGrid && /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: "min-w-0 flex-[1_1_20rem] overflow-x-auto", children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(ChartDataGrid, { controller }) }),
14004
+ /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(ChartInspector, { controller, className: "max-h-96 min-w-0 flex-[1_1_16rem] overflow-y-auto rounded-md border border-border p-3" })
13940
14005
  ] })
13941
14006
  ]
13942
14007
  }
@@ -13954,7 +14019,7 @@ function createReactChartNodeView(options = {}) {
13954
14019
  scheduled = true;
13955
14020
  queueMicrotask(() => {
13956
14021
  scheduled = false;
13957
- if (!destroyed) root.render(/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Component, { ...props, state: latest }));
14022
+ if (!destroyed) root.render(/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(Component, { ...props, state: latest }));
13958
14023
  });
13959
14024
  };
13960
14025
  schedule();
@@ -13972,10 +14037,10 @@ function createReactChartNodeView(options = {}) {
13972
14037
  }
13973
14038
 
13974
14039
  // src/style/useStyle.ts
13975
- var import_react95 = require("react");
14040
+ var import_react96 = require("react");
13976
14041
  var message = (error) => error instanceof Error ? error.message : String(error);
13977
14042
  function useResolverTask(styles, run, deliver, deps) {
13978
- (0, import_react95.useEffect)(() => {
14043
+ (0, import_react96.useEffect)(() => {
13979
14044
  if (!styles || !run) {
13980
14045
  deliver({ value: null, error: null });
13981
14046
  return;
@@ -14002,7 +14067,7 @@ function useResolverTask(styles, run, deliver, deps) {
14002
14067
  }, [styles, ...deps]);
14003
14068
  }
14004
14069
  function useStyle(styles, domain) {
14005
- const [result, setResult] = (0, import_react95.useState)({ style: null, error: null });
14070
+ const [result, setResult] = (0, import_react96.useState)({ style: null, error: null });
14006
14071
  useResolverTask(
14007
14072
  styles,
14008
14073
  (s) => s.resolve(domain),
@@ -14012,7 +14077,7 @@ function useStyle(styles, domain) {
14012
14077
  return result;
14013
14078
  }
14014
14079
  function useStyleFindings(styles, domain, state) {
14015
- const [result, setResult] = (0, import_react95.useState)({ report: null, style: null, error: null });
14080
+ const [result, setResult] = (0, import_react96.useState)({ report: null, style: null, error: null });
14016
14081
  useResolverTask(
14017
14082
  styles,
14018
14083
  (s) => s.check(domain, state),
@@ -14029,7 +14094,7 @@ function useStyleFindings(styles, domain, state) {
14029
14094
  }
14030
14095
 
14031
14096
  // src/style/StyleFindings.tsx
14032
- var import_jsx_runtime72 = require("react/jsx-runtime");
14097
+ var import_jsx_runtime73 = require("react/jsx-runtime");
14033
14098
  var SEVERITY_CLASS = {
14034
14099
  error: "text-destructive",
14035
14100
  warning: "text-amber-600",
@@ -14038,24 +14103,24 @@ var SEVERITY_CLASS = {
14038
14103
  function StyleFindings({ report, onSelect, title = "House style", className = "" }) {
14039
14104
  if (!report) return null;
14040
14105
  const { findings, ran, skipped } = report;
14041
- return /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("section", { "data-style-findings": "", "aria-label": title, className: `flex flex-col gap-1.5 text-xs text-foreground ${className}`, children: [
14042
- /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("h3", { className: "text-[11px] font-semibold uppercase tracking-wide text-muted-foreground", children: title }),
14043
- findings.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("ul", { className: "flex flex-col gap-1", children: findings.map((finding, i) => {
14106
+ return /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("section", { "data-style-findings": "", "aria-label": title, className: `flex flex-col gap-1.5 text-xs text-foreground ${className}`, children: [
14107
+ /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("h3", { className: "text-[11px] font-semibold uppercase tracking-wide text-muted-foreground", children: title }),
14108
+ findings.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("ul", { className: "flex flex-col gap-1", children: findings.map((finding, i) => {
14044
14109
  const selectable = finding.target !== void 0 && !!onSelect;
14045
- const body = /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(import_jsx_runtime72.Fragment, { children: [
14046
- /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("span", { "data-style-severity": finding.severity, className: `shrink-0 font-semibold uppercase text-[10px] ${SEVERITY_CLASS[finding.severity]}`, children: finding.severity }),
14047
- /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("span", { className: "flex min-w-0 flex-col", children: [
14048
- /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("span", { "data-style-message": "", children: finding.message }),
14049
- /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("span", { className: "text-[10px] text-muted-foreground", children: [
14050
- /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("code", { children: finding.check }),
14051
- finding.layer && /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(import_jsx_runtime72.Fragment, { children: [
14110
+ const body = /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)(import_jsx_runtime73.Fragment, { children: [
14111
+ /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { "data-style-severity": finding.severity, className: `shrink-0 font-semibold uppercase text-[10px] ${SEVERITY_CLASS[finding.severity]}`, children: finding.severity }),
14112
+ /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("span", { className: "flex min-w-0 flex-col", children: [
14113
+ /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { "data-style-message": "", children: finding.message }),
14114
+ /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("span", { className: "text-[10px] text-muted-foreground", children: [
14115
+ /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("code", { children: finding.check }),
14116
+ finding.layer && /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)(import_jsx_runtime73.Fragment, { children: [
14052
14117
  " \xB7 ",
14053
14118
  finding.layer
14054
14119
  ] })
14055
14120
  ] })
14056
14121
  ] })
14057
14122
  ] });
14058
- return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("li", { "data-style-finding": finding.check, children: selectable ? /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
14123
+ return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("li", { "data-style-finding": finding.check, children: selectable ? /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
14059
14124
  "button",
14060
14125
  {
14061
14126
  type: "button",
@@ -14063,19 +14128,19 @@ function StyleFindings({ report, onSelect, title = "House style", className = ""
14063
14128
  onClick: () => onSelect(finding),
14064
14129
  children: body
14065
14130
  }
14066
- ) : /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: "flex items-start gap-2 rounded border border-border px-2 py-1", children: body }) }, `${finding.check}-${i}`);
14131
+ ) : /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: "flex items-start gap-2 rounded border border-border px-2 py-1", children: body }) }, `${finding.check}-${i}`);
14067
14132
  }) }),
14068
- findings.length === 0 && ran.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("p", { "data-style-clear": "", className: "text-emerald-600", children: [
14133
+ findings.length === 0 && ran.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("p", { "data-style-clear": "", className: "text-emerald-600", children: [
14069
14134
  "All clear: ",
14070
14135
  ran.length,
14071
14136
  " ",
14072
14137
  ran.length === 1 ? "check" : "checks",
14073
14138
  " passed."
14074
14139
  ] }),
14075
- findings.length === 0 && ran.length === 0 && skipped.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("p", { className: "text-muted-foreground", children: "No house-style checks apply." }),
14076
- skipped.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime72.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_runtime72.jsxs)("li", { "data-style-skipped-check": s.check, children: [
14140
+ findings.length === 0 && ran.length === 0 && skipped.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("p", { className: "text-muted-foreground", children: "No house-style checks apply." }),
14141
+ skipped.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime73.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_runtime73.jsxs)("li", { "data-style-skipped-check": s.check, children: [
14077
14142
  "Skipped ",
14078
- /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("code", { children: s.check }),
14143
+ /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("code", { children: s.check }),
14079
14144
  ": ",
14080
14145
  s.reason
14081
14146
  ] }, s.check)) })
@@ -14135,6 +14200,7 @@ function StyleFindings({ report, onSelect, title = "House style", className = ""
14135
14200
  SelectAndMaskWorkspace,
14136
14201
  SelectionChangeCheck,
14137
14202
  SelectionOptionsBar,
14203
+ SeparateSubjectPanel,
14138
14204
  ShapeOptionsBar,
14139
14205
  SheetTabs,
14140
14206
  SpreadsheetConditionalFormatPanel,